Skip to content

Commit 438e5d7

Browse files
committed
Merge branch 'release/v3.1.0'
2 parents b900cdc + 0ba2784 commit 438e5d7

18 files changed

Lines changed: 592 additions & 180 deletions

.travis.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
notifications:
2+
slack: wtsi-cgpit:ptUMR1tkNyZJYd9TpGoss8WR
3+
email: false
4+
5+
env:
6+
- CC=gcc
7+
8+
addons:
9+
apt:
10+
packages:
11+
- build-essential
12+
- autoconf
13+
- bsdtar
14+
- time
15+
- curl
16+
- libcurl4-openssl-dev
17+
- nettle-dev
18+
- zlib1g-dev
19+
- libncurses5-dev
20+
- libpstreams-dev
21+
- unzip
22+
- libpng12-dev
23+
- libexpat1-dev
24+
25+
install: true
26+
27+
language: perl
28+
29+
perl:
30+
- "5.22"
31+
32+
script:
33+
- ./setup.sh ~/wtsi-opt
34+
- ~/wtsi-opt/bin/samtools view # dump usage to show intact

MANIFEST

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.travis.yml
2+
bin/bam2bedgraph
13
bin/bam_stats.pl
24
bin/bam_to_sra_sub.pl
35
bin/bamToBw.pl
@@ -9,6 +11,7 @@ bin/gnos_pull.pl
911
bin/monitor.pl
1012
bin/xam_coverage_bins.pl
1113
bin/xml_to_bas.pl
14+
c/bam2bedgraph.c
1215
c/bam_access.c
1316
c/bam_access.h
1417
c/bam_stats.c
@@ -27,6 +30,7 @@ c/dbg.h
2730
c/khash.h
2831
c/reheadSQ.c
2932
CHANGES.md
33+
dists/patch/Bio-BigFile_build.patch
3034
dists/snappy-1.1.2.tar.gz
3135
docs.tar.gz
3236
examples/gnos_pull.ini

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
ICGC-TCGA-PCAP
22
==============
33

4-
NGS reference implementations and helper code for the ICGC/TCGA Pan-Cancer Analysis Project
4+
NGS reference implementations and helper code for the ICGC/TCGA Pan-Cancer Analysis Project.
5+
6+
| Master | Dev |
7+
|---|---|
8+
| [![Build Status](https://travis-ci.org/ICGC-TCGA-PanCancer/PCAP-core.svg?branch=master)](https://travis-ci.org/ICGC-TCGA-PanCancer/PCAP-core) | [![Build Status](https://travis-ci.org/ICGC-TCGA-PanCancer/PCAP-core.svg?branch=dev)](https://travis-ci.org/ICGC-TCGA-PanCancer/PCAP-core) |
59

610
This repository contains code to run genomic alignments of paired end data
711
and subsequent calling algorithms.

bin/bamToBw.pl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ sub setup {
8282
'r|reference=s' => \$opts{'reference'},
8383
'p|process=s' => \$opts{'process'},
8484
'i|index=i' => \$opts{'index'},
85+
'f|filter=i' => \$opts{'filter'},
8586
'j|jobs' => \$opts{'jobs'},
8687
) or pod2usage(2);
8788

@@ -106,6 +107,7 @@ sub setup {
106107

107108
delete $opts{'process'} unless(defined $opts{'process'});
108109
delete $opts{'index'} unless(defined $opts{'index'});
110+
delete $opts{'filter'} unless(defined $opts{'filter'});
109111

110112
# now safe to apply defaults
111113
$opts{'threads'} = 1 unless(defined $opts{'threads'});
@@ -160,10 +162,13 @@ =head1 SYNOPSIS
160162
Required parameters:
161163
-bam -b BAM/CRAM file to be processed.
162164
-outdir -o Folder to output result to.
163-
-threads -t Number of threads to use. [1]
164165
-reference -r Path to genome.fa.
165166
- Actually using fa.fai but for convention just provide '.fa' file
166167
168+
Optional parameters:
169+
-threads -t Number of threads to use. [1]
170+
-filter -f Ignore reads with the filter flags [int]
171+
167172
Targeted processing:
168173
-process -p Only process this step then exit, optionally set -index
169174
bamToBw - Per chromosome BigWigs

bin/bam_stats.pl

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,8 @@
3232
use Config; # so we can see if threads are enabled
3333
use Data::Dumper;
3434

35-
BEGIN {
36-
if($Config{useithreads}) {
37-
require threads;
38-
}
39-
};
35+
our $CAN_USE_THREADS = 0;
36+
$CAN_USE_THREADS = eval 'use threads; 1';
4037

4138
use PCAP::Bam::Stats;
4239

@@ -54,15 +51,20 @@ BEGIN
5451
$out_location = 'STDOUT';
5552
}
5653

54+
if($opts->{'threads'} > 1 && $CAN_USE_THREADS == 0) {
55+
warn "Threading is not available perl component will run as a single process";
56+
$opts->{'threads'} = 1;
57+
}
58+
5759
try{
5860
my $stats;
59-
if($opts->{'threads'} > 1 && $Config{useithreads}) {
61+
if($opts->{'threads'} > 1 && $CAN_USE_THREADS) {
6062
for my $thread(0..($opts->{'threads'}-1)) {
6163
my ($thr) = threads->create(\&stat_thread, $opts, $thread);
6264
}
63-
sleep 2 while(threads->list(threads::running) > 0);
65+
sleep 2 while(threads->list(threads::running()) > 0);
6466
my @bas_objs;
65-
for my $thr(threads->list(threads::joinable)) {
67+
for my $thr(threads->list(threads::joinable())) {
6668
push @bas_objs, $thr->join;
6769
if(my $err = $thr->error) { die "Thread error: $err\n"; }
6870
}

bin/bwa_mem.pl

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ sub setup {
9797
'p|process=s' => \$opts{'process'},
9898
'i|index=i' => \$opts{'index'},
9999
'b|bwa=s' => \$opts{'bwa'},
100+
'c|cram' => \$opts{'cram'},
101+
'sc|scramble=s' => \$opts{'scramble'},
100102
) or pod2usage(2);
101103

102104
pod2usage(-verbose => 1, -exitval => 0) if(defined $opts{'h'});
@@ -126,6 +128,9 @@ sub setup {
126128
delete $opts{'process'} unless(defined $opts{'process'});
127129
delete $opts{'index'} unless(defined $opts{'index'});
128130
delete $opts{'bwa'} unless(defined $opts{'bwa'});
131+
delete $opts{'scramble'} unless(defined $opts{'scramble'});
132+
133+
PCAP::Cli::opt_requires_opts('scramble', \%opts, ['cram']);
129134

130135
# now safe to apply defaults
131136
$opts{'threads'} = 1 unless(defined $opts{'threads'});
@@ -189,10 +194,13 @@ =head1 SYNOPSIS
189194
-threads -t Number of threads to use. [1]
190195
191196
Optional parameters:
192-
-fragment -f Split input into fragements of X million repairs
197+
-fragment -f Split input into fragements of X million repairs [10]
193198
-nomarkdup -n Don't mark duplicates
194-
-bwa -b Single quoted string of parameters to pass to BWA
195-
- overrides all defaults except '-t,-p,-R'
199+
-cram -c Output cram, see '-sc'
200+
-scramble -sc Single quoted string of parameters to pass to Scramble when '-c' used
201+
- '-I,-O' are used internally and should not be provided
202+
-bwa -b Single quoted string of additional parameters to pass to BWA
203+
- '-t,-p,-R' are used internally and should not be provided
196204
197205
Targeted processing:
198206
-process -p Only process this step then exit, optionally set -index

bin/gnos_pull.pl

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
use Proc::PID::File;
4444
use Data::Dumper;
4545

46+
my $CAN_USE_THREADS = 0;
47+
$CAN_USE_THREADS = eval 'use threads; 1';
48+
4649
use PCAP;
4750
use PCAP::Cli;
4851

@@ -99,7 +102,7 @@ sub load_config {
99102
}
100103
if(exists $options->{'COMPOSITE_FILTERS'}->{'not_sanger_workflow'}) {
101104
my %bl_workflows = map { $_ => 1 } split /[\n,]/, $options->{'COMPOSITE_FILTERS'}->{'not_sanger_workflow'};
102-
$options->{'COMPOSITE_FILTERS'}->{'not_sanger_workflow'} = [keys \%bl_workflows];
105+
$options->{'COMPOSITE_FILTERS'}->{'not_sanger_workflow'} = [keys %bl_workflows];
103106
}
104107

105108
croak sprintf q{'KEY_FILE' Ssection is absent from %s}, $options->{'config'} unless($cfg->SectionExists('KEY_FILES'));
@@ -132,8 +135,6 @@ sub load_config {
132135
return 1;
133136
}
134137

135-
use threads;
136-
137138
sub pull_data {
138139
my ($options, $to_process) = @_;
139140

@@ -153,6 +154,10 @@ sub pull_data {
153154
}
154155

155156
my $thread_count = $options->{'threads'};
157+
if($CAN_USE_THREADS == 0) {
158+
warn "Threading is not available perl component will run as a single process";
159+
$thread_count = 1;
160+
}
156161

157162

158163
while(@{$to_process} > 0) {
@@ -170,13 +175,13 @@ sub pull_data {
170175

171176
warn "Submitting: $donor->{donor_unique_id}\n";
172177
if($thread_count > 1) {
173-
if(threads->list(threads::all) < $thread_count) {
178+
if(threads->list(threads::all()) < $thread_count) {
174179
threads->create($code_ref, $options, $donor, $orig_base, $donor_base);
175180
# don't sleep if not full yet
176-
next if(threads->list(threads::all) < $thread_count);
181+
next if(threads->list(threads::all()) < $thread_count);
177182
}
178-
sleep 1 while(threads->list(threads::joinable) == 0);
179-
for my $thr(threads->list(threads::joinable)) {
183+
sleep 1 while(threads->list(threads::joinable()) == 0);
184+
for my $thr(threads->list(threads::joinable())) {
180185
$thr->join;
181186
if(my $err = $thr->error) { die "Thread error: $err\n"; }
182187
}
@@ -187,8 +192,8 @@ sub pull_data {
187192
}
188193
if($thread_count > 1) {
189194
# last gasp for any remaining threads
190-
sleep 1 while(threads->list(threads::running) > 0);
191-
for my $thr(threads->list(threads::joinable)) {
195+
sleep 1 while(threads->list(threads::running()) > 0);
196+
for my $thr(threads->list(threads::joinable())) {
192197
$thr->join;
193198
if(my $err = $thr->error) { die "Thread error: $err\n"; }
194199
}

c/Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ LFLAGS?= -L$(HTSTMP)
4242
# define any libraries to link into executable:
4343
# if I want to link in libraries (libx.so or libx.a) I use the -llibname
4444
# option, something like (this will link in libmylib.so and libm.so:
45-
LIBS =-lhts -lpthread -lz -lm
45+
LIBS =-lhts -lpthread -lz -lm -ldl
4646

4747
# define the C source files
4848
SRCS = ./bam_access.c ./bam_stats_output.c ./bam_stats_calcs.c
@@ -66,6 +66,7 @@ MD := mkdir
6666
BAM_STATS_TARGET=../bin/bam_stats
6767
CAT_TARGET=../bin/bwcat
6868
SQ_TARGET=../bin/reheadSQ
69+
BAM2BG_TARGET=../bin/bam2bedgraph
6970

7071
#
7172
# The following part of the makefile is generic; it can be used to
@@ -77,7 +78,7 @@ SQ_TARGET=../bin/reheadSQ
7778

7879
.NOTPARALLEL: test
7980

80-
all: clean pre make_htslib_tmp $(BAM_STATS_TARGET) test remove_htslib_tmp $(CAT_TARGET) $(SQ_TARGET)
81+
all: clean pre make_htslib_tmp $(BAM_STATS_TARGET) $(BAM2BG_TARGET) test remove_htslib_tmp $(CAT_TARGET) $(SQ_TARGET)
8182
@echo bam_stats, reheadSQ and bwcat compiled.
8283

8384
$(BAM_STATS_TARGET): $(OBJS)
@@ -86,6 +87,9 @@ $(BAM_STATS_TARGET): $(OBJS)
8687
$(CAT_TARGET):
8788
$(CC) $(CAT_INCLUDES) $(CFLAGS) ./bwcat.c $(CAT_LFLAGS) -lBigWig -lz -lcurl -lm -lgnutls -ltasn1 -lhogweed -lnettle -lgmp -lp11-kit -o $(CAT_TARGET)
8889

90+
$(BAM2BG_TARGET): $(OBJS)
91+
$(CC) $(CFLAGS) $(INCLUDES) -o $(BAM2BG_TARGET) $(OBJS) $(LFLAGS) $(LIBS) ./bam2bedgraph.c
92+
8993
$(SQ_TARGET):
9094
$(CC) $(CFLAGS) ./reheadSQ.c -o $(SQ_TARGET)
9195

0 commit comments

Comments
 (0)