Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for rare out of order mpileup failures in genotype qc #389

Merged
merged 1 commit into from
Dec 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
LIST OF CHANGES FOR NPG-QC PACKAGE

- Fix in npg_qc::utils::bam_genotype for rare out of order mpileup failures
- Travis CI build: when building dependencies, us the same
branch as the one the pull request is made to.
- back to testing with mysql 5.7.13 in travis
Expand Down
42 changes: 4 additions & 38 deletions lib/npg_qc/utils/bam_genotype.pm
Original file line number Diff line number Diff line change
Expand Up @@ -110,40 +110,6 @@ sub _build_samtools {
return $self->samtools_name;
}

has 'samtools_extract_regions' => (
is => 'ro',
isa => 'NpgCommonResolvedPathExecutable',
lazy_build => 1,
coerce => 1,
);
sub _build_samtools_extract_regions {
my ($self) = @_;
return $self->samtools_name;
}

has 'samtools_mpileup' => (
is => 'ro',
isa => 'NpgCommonResolvedPathExecutable',
lazy_build => 1,
coerce => 1,
);
sub _build_samtools_mpileup {
my ($self) = @_;
return $self->samtools_name;
}

has 'samtools_merge' => (
is => 'ro',
isa => 'NpgCommonResolvedPathExecutable',
lazy_build => 1,
coerce => 1,
);
sub _build_samtools_merge {
my ($self) = @_;
return $self->samtools_name;
}

# you can override the executable name. May be useful for variants like "samtools_irods"
has 'bcftools_name' => (
is => 'ro',
isa => 'Str',
Expand Down Expand Up @@ -334,14 +300,14 @@ sub _build__call_gt_cmd {
my $bam_file_list = $self->bam_file_list;

if(@{$bam_file_list} == 1) {
$cmd = sprintf q{bash -c 'set -o pipefail && %s view -b %s %s 2>/dev/null | %s mpileup -l %s -f %s -g - 2>/dev/null | %s call -c -O v - 2>/dev/null'}, $self->samtools_extract_regions, $bam_file_list->[0], $self->_regions_string, $self->samtools_mpileup, $self->pos_snpname_map_filename, $self->reference, $self->bcftools;
$cmd = sprintf q{bash -c 'set -o pipefail && %s view -b %s %s 2>/dev/null | %s sort -l 0 - 2>/dev/null | %s mpileup -l %s -f %s -g - 2>/dev/null | %s call -c -O v - 2>/dev/null'}, $self->samtools, $bam_file_list->[0], $self->_regions_string, $self->samtools, $self->samtools, $self->pos_snpname_map_filename, $self->reference, $self->bcftools;
}
else {
$cmd = sprintf q{bash -c 'set -o pipefail && %s merge -- - }, $self->samtools_merge;
$cmd = sprintf q{bash -c 'set -o pipefail && %s merge -- - }, $self->samtools;
for my $bam_file (@{$bam_file_list}) {
$cmd .= sprintf q{<(%s view -b %s %s) }, $self->samtools_extract_regions, $bam_file, $self->_regions_string;
$cmd .= sprintf q{<(%s view -b %s %s) }, $self->samtools, $bam_file, $self->_regions_string;
}
$cmd .= sprintf q{ | %s mpileup -l %s -f %s -g - 2>/dev/null | %s call -c -O v - 2>/dev/null'}, $self->samtools_mpileup, $self->pos_snpname_map_filename, $self->reference, $self->bcftools;
$cmd .= sprintf q{ | %s mpileup -l %s -f %s -g - 2>/dev/null | %s call -c -O v - 2>/dev/null'}, $self->samtools, $self->pos_snpname_map_filename, $self->reference, $self->bcftools;
}

return $cmd;
Expand Down