Skip to content

Commit

Permalink
Merge branch 'hotfix/5.0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrajones committed May 1, 2020
2 parents 6e974f2 + 24c8215 commit d0bb91b
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 12 deletions.
6 changes: 5 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# CHANGES

## 5.0.5

* Add `noindex` commandline flag to `merge_or_mark.pl` for bammerge calls. Only permitted alongisde `qnamesort`

## 5.0.4

* Add `qnamesort` connamdline flag to `merge_or_mark.pl` for bammerge calls (Defaults to `SO=coordinate` without)
* Add `qnamesort` commandline flag to `merge_or_mark.pl` for bammerge calls (Defaults to `SO=coordinate` without)

## 5.0.3

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ FROM ubuntu:16.04

LABEL maintainer="cgphelp@sanger.ac.uk"\
uk.ac.sanger.cgp="Cancer, Ageing and Somatic Mutation, Wellcome Sanger Institute" \
version="5.0.4" \
version="5.0.5" \
description="pcap-core"

ENV OPT /opt/wtsi-cgp
Expand Down
11 changes: 11 additions & 0 deletions bin/merge_or_mark.pl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ sub setup {
'n|nomarkdup' => \$opts{'nomarkdup'},
'p|process=s' => \$opts{'process'},
'q|querynamesort' => \$opts{'qnamesort'},
'i|noindex' => \$opts{'noindex'},
'csi' => \$opts{'csi'},
'c|cram' => \$opts{'cram'},
'sc|scramble=s' => \$opts{'scramble'},
Expand Down Expand Up @@ -119,6 +120,9 @@ sub setup {
if($opts{'qnamesort'} && !$opts{'nomarkdup'}){
die "ERROR: -qnamesort can only be used in conjunction with -nomarkdups\n";
}
if($opts{'noindex'} && !$opts{'qnamesort'}){
die "ERROR: -noindex can only be used in conjunction with -qnamesort\n";
}
$opts{'sortorder'} = $QUERYNAME_SORT_ORDER if($opts{'qnamesort'});

if($opts{'threads'} > 4) {
Expand Down Expand Up @@ -168,6 +172,8 @@ =head1 SYNOPSIS
-nomarkdup -n Don't mark duplicates [flag]
-qnamesort -q Use queryname sorting flag in bammerge rather than coordinate. [flag].
To be used in conjunction with -nomarkdup only
-noindex -i Don't attempt to index the merged file. Only available in conjunction with
-qnamesort.
-csi Use CSI index instead of BAI for BAM files [flag].
-cram -c Output cram, see '-sc' [flag]
-scramble -sc Single quoted string of parameters to pass to Scramble when '-c' used
Expand Down Expand Up @@ -243,6 +249,11 @@ =head2 OPTIONAL parameters
Use queryname sorting in bammerge calls rather than the default coordinate.
Can only be used in combination with B<-nomarkdup>
=item B<-noindex>
Don't attempt to generate an index for the merged file.
Can only be used in combination with B<-qnamesort>
=item B<-cram>
Final output file will be a CRAM file instead of BAM. To tune the the compression methods see then
Expand Down
2 changes: 1 addition & 1 deletion lib/PCAP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use FindBin qw($Bin);
use File::Which qw(which);
# don't use autodie, only core perl in here

our $VERSION = '5.0.4';
our $VERSION = '5.0.5';
our @EXPORT = qw($VERSION _which);

const my $LICENSE =>
Expand Down
53 changes: 44 additions & 9 deletions lib/PCAP/Bam.pm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ const my $BAMBAM_MERGE_CRAM => q{%s %s tmpfile=%s level=0 %s| %s -r %s -t %d -I

const my $LANE_BAMBAM_MERGE => q{%s SO=%s %s tmpfile=%s level=0 | pee '%s tmpfile=%s index=1 md5=1 numthreads=%d md5filename=%s.md5 indexfilename=%s.%s > %s' '%s -o %s.bas -@ %d'};
const my $LANE_BAMBAM_MERGE_CRAM => q{%s SO=%s %s tmpfile=%s level=0 | %s -r %s -t %d -I bam -O cram %s | tee %s | %s index - %s.crai};
const my $LANE_BAMBAM_MERGE_NOIDX => q{%s SO=%s %s tmpfile=%s level=0 | pee '%s tmpfile=%s md5=1 numthreads=%d md5filename=%s.md5 > %s' '%s -o %s.bas -@ %d'};
const my $LANE_BAMBAM_MERGE_CRAM_NOIDX => q{%s SO=%s %s tmpfile=%s level=0 | %s -r %s -t %d -I bam -O cram %s %s};

const my $LANE_BAMBAM_DUP => q{%s level=0 %s | %s -l 0 -m | %s tmpfile=%s level=0 markthreads=%d M=%s.met | %s -l 0 -p | pee '%s tmpfile=%s index=1 md5=1 numthreads=%d md5filename=%s.md5 indexfilename=%s.%s > %s' '%s -o %s.bas -@ %d'};
const my $LANE_BAMBAM_DUP_CRAM => q{%s level=0 %s | %s -l 0 -m | %s tmpfile=%s level=0 markthreads=%d M=%s.met | %s -l 0 -p | %s -r %s -t %d -I bam -O cram %s | tee %s | %s index - %s.crai};

Expand Down Expand Up @@ -131,9 +134,10 @@ sub merge_or_mark_lanes {

# subtly different, as need to strip mmQc before dup-rem, and then reapply
if(defined $options->{'nomarkdup'} && $options->{'nomarkdup'} == 1) {
if($options->{'cram'}) {
my $add_sc = $options->{'scramble'} || q{};
$commands[0] = sprintf $LANE_BAMBAM_MERGE_CRAM,
if(defined $options->{'noindex'} && $options->{'noindex'} == 1){
if($options->{'cram'}) {
my $add_sc = $options->{'scramble'} || q{};
$commands[0] = sprintf $LANE_BAMBAM_MERGE_CRAM_NOIDX,
$tools{'bammerge'},
$options->{'sortorder'},
$input_str,
Expand All @@ -142,12 +146,10 @@ sub merge_or_mark_lanes {
$options->{'reference'},
$helper_threads,
$add_sc,
$marked,
$tools{'samtools'},
$marked;
}
else {
$commands[0] = sprintf $LANE_BAMBAM_MERGE,
}
else {
$commands[0] = sprintf $LANE_BAMBAM_MERGE_NOIDX,
$tools{'bammerge'},
$options->{'sortorder'},
$input_str,
Expand All @@ -156,11 +158,44 @@ sub merge_or_mark_lanes {
$brc_tmp,
$helper_threads,
$marked,
$marked, $idx_type,
$marked,
$tools{'bam_stats'},
$marked,
$helper_threads;
}
}
else{
if($options->{'cram'}) {
my $add_sc = $options->{'scramble'} || q{};
$commands[0] = sprintf $LANE_BAMBAM_MERGE_CRAM,
$tools{'bammerge'},
$options->{'sortorder'},
$input_str,
$bbb_tmp,
$tools{'scramble'},
$options->{'reference'},
$helper_threads,
$add_sc,
$marked,
$tools{'samtools'},
$marked;
}
else {
$commands[0] = sprintf $LANE_BAMBAM_MERGE,
$tools{'bammerge'},
$options->{'sortorder'},
$input_str,
$bbb_tmp,
$tools{'bamrecompress'},
$brc_tmp,
$helper_threads,
$marked,
$marked, $idx_type,
$marked,
$tools{'bam_stats'},
$marked,
$helper_threads;
}
}
}
else {
Expand Down

0 comments on commit d0bb91b

Please sign in to comment.