Skip to content

Commit

Permalink
Merge pull request #88 from andrewjpage/use_requested_fragment_size_i…
Browse files Browse the repository at this point in the history
…n_bamcheck_qc

pass in requested fragment size to bamcheck qc
  • Loading branch information
andrewjpage committed May 31, 2012
2 parents 0ffebfa + 25e7271 commit 420bbb0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions modules/VertRes/Pipelines/TrackQC_Bam.pm
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,11 @@ sub stats_and_graphs
my $lane = $$self{lane};
my $stats_ref = exists($$self{stats_ref}) ? $$self{stats_ref} : '';
my $class = (caller(0))[0]; # In case we are called from a inherited object

if ( !$$self{db} ) { $self->throw("Expected the db key.\n"); }
my $vrtrack = VRTrack::VRTrack->new($$self{db}) or $self->throw("Could not connect to the database: ",join(',',%{$$self{db}}),"\n");
my $vrlane = VRTrack::Lane->new_by_hierarchy_name($vrtrack,$name) or $self->throw("No such lane in the DB: [$name]\n");
my $insert_size = (VRTrack::Library->new($vrtrack, $vrlane->library_id())->insert_size() )*3 || 8000;

# Dynamic script to be run by LSF.
open(my $fh, '>', "$lane_path/$sample_dir/_graphs.pl") or Utils::error("$lane_path/$sample_dir/_graphs.pl: $!");
Expand All @@ -517,7 +522,7 @@ my \%params =
);
my \$qc = VertRes::Pipelines::TrackQC_Bam->new(\%params);
\$qc->run_graphs(\$params{lane_path});
\$qc->run_graphs(\$params{lane_path}, $insert_size);
];
close $fh;

Expand All @@ -528,7 +533,7 @@ my \$qc = VertRes::Pipelines::TrackQC_Bam->new(\%params);

sub run_graphs
{
my ($self,$lane_path) = @_;
my ($self,$lane_path,$insert_size) = @_;

use Graphs;
use SamTools;
Expand All @@ -548,11 +553,11 @@ sub run_graphs
my $bindepth = "$outdir/gc-depth.bindepth";
my $gcdepth_R = $$self{'gcdepth_R'};
my $stats_file = "$outdir/$$self{stats_detailed}";

# Run bamcheck even if bamcheck output already exists. The import pipeline does not have
# the reference sequence and bamcheck only approximates the GC depth graph. It takes 8 minutes
# to run 17GB file, no big overhead.
Utils::CMD(qq[$$self{bamcheck} -r $refseq $bam_file > $bam_file.bc.tmp]);
Utils::CMD(qq[$$self{bamcheck} -r $refseq -i $insert_size $bam_file > $bam_file.bc.tmp]);
rename("$bam_file.bc.tmp","$bam_file.bc") or $self->throw("rename $bam_file.bc.tmp $bam_file.bc: $!");
if ( ! -e "$bam_file.rmdup.bc" )
{
Expand Down

0 comments on commit 420bbb0

Please sign in to comment.