Skip to content

Commit

Permalink
system calls
Browse files Browse the repository at this point in the history
  • Loading branch information
cutpatel committed Jul 17, 2018
1 parent 3a56466 commit 643c547
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/TBbwa.pm
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ sub tbbwa {
# map reads with bwa-mem and -t parameter.
print $logprint "<INFO>\t",timer(),"\tStart BWA mapping for $fullID...\n";
print $logprint "<INFO>\t",timer(),"\t$BWA_dir/bwa mem -t $threads -R $read_naming_scheme $VAR_dir/$ref $files_string > $BAM_OUT/$fullID.sam 2>> $BAM_OUT/$logfile\n";
$commandline = "$BWA_dir/bwa mem -t $threads -R $read_naming_scheme $VAR_dir/$ref $files_string > $BAM_OUT/$fullID.sam 2>> $BAM_OUT/$logfile";
system($commandline)==0 or die "$commandline failed: $?\n";
print $logprint "<INFO>\t",timer(),"\tFinished BWA mapping for $fullID!\n";
# convert from .sam to .bam format with samtools -S (sam input) and (-b bam output) and -T (reference).
Expand All @@ -100,16 +101,19 @@ sub tbbwa {
# indexing with samtools.
print $logprint "<INFO>\t",timer(),"\tStart using samtools for indexing of $fullID...\n";
print $logprint "<INFO>\t",timer(),"\t$SAMTOOLS_dir/samtools index -b $BAM_OUT/$fullID.sorted.bam 2>> $BAM_OUT/$logfile\n";
$commandline = "$SAMTOOLS_dir/samtools index -b $BAM_OUT/$fullID.sorted.bam 2>> $BAM_OUT/$logfile";
system($commandline)==0 or die "$commandline failed: $?\n";
print $logprint "<INFO>\t",timer(),"\tFinished using samtools for indexing of $fullID!\n";
# removing pcr duplicates with samtools.
print $logprint "<INFO>\t",timer(),"\tStart removing putative PCR duplicates from $fullID...\n";
print $logprint "<INFO>\t",timer(),"\t$SAMTOOLS_dir/samtools rmdup $BAM_OUT/$fullID.sorted.bam $BAM_OUT/$fullID.nodup.bam 2>> $BAM_OUT/$logfile\n";
$commandline = "$SAMTOOLS_dir/samtools rmdup $BAM_OUT/$fullID.sorted.bam $BAM_OUT/$fullID.nodup.bam 2>> $BAM_OUT/$logfile";
system($commandline)==0 or die "$commandline failed: $?\n";
print $logprint "<INFO>\t",timer(),"\tFinished removing putative PCR duplicates for $fullID!\n";
# recreate index with samtools.
print $logprint "<INFO>\t",timer(),"\tStart recreating index for $fullID...\n";
print $logprint "<INFO>\t",timer(),"\t$SAMTOOLS_dir/samtools index -b $BAM_OUT/$fullID.nodup.bam 2>> $BAM_OUT/$logfile\n";
$commandline = "$SAMTOOLS_dir/samtools index -b $BAM_OUT/$fullID.nodup.bam 2>> $BAM_OUT/$logfile";
system($commandline)==0 or die "$commandline failed: $?\n";
print $logprint "<INFO>\t",timer(),"\tFinished recreating index for $fullID!\n";
# removing temporary files.
Expand Down
4 changes: 4 additions & 0 deletions lib/TBrefine.pm
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ sub tbrefine {
# use RealignerTargetCreator from GATK.
print $logprint "<INFO>\t",timer(),"\tStart using GATK RealignerTargetCreator for $fullID...\n";
print $logprint "<INFO>\t",timer(),"\tjava -jar $GATK_dir/GenomeAnalysisTK.jar --analysis_type RealignerTargetCreator --reference_sequence $VAR_dir/$ref --input_file $BAM_OUT/$fullID.bam --downsample_to_coverage 10000 --num_threads $threads --out $GATK_OUT/$fullID.gatk.intervals 2>> $GATK_OUT/$logfile\n";
$commandline = "java -jar $GATK_dir/GenomeAnalysisTK.jar --analysis_type RealignerTargetCreator --reference_sequence $VAR_dir/$ref --input_file $BAM_OUT/$fullID.bam --downsample_to_coverage 10000 --num_threads $threads --out $GATK_OUT/$fullID.gatk.intervals 2>> $GATK_OUT/$logfile";
system($commandline)==0 or die "$commandline failed: $?\n";
print $logprint "<INFO>\t",timer(),"\tFinished using GATK RealignerTargetCreator for $fullID!\n";
# use IndelRealigner from GATK.
print $logprint "<INFO>\t",timer(),"\tStart using GATK IndelRealigner for $fullID...\n";
print $logprint "<INFO>\t",timer(),"\tjava -jar $GATK_dir/GenomeAnalysisTK.jar --analysis_type IndelRealigner --reference_sequence $VAR_dir/$ref --input_file $BAM_OUT/$fullID.bam --defaultBaseQualities 12 --targetIntervals $GATK_OUT/$fullID.gatk.intervals --noOriginalAlignmentTags --out $GATK_OUT/$fullID.realigned.bam 2>> $GATK_OUT/$logfile\n";
$commandline = "java -jar $GATK_dir/GenomeAnalysisTK.jar --analysis_type IndelRealigner --reference_sequence $VAR_dir/$ref --input_file $BAM_OUT/$fullID.bam --defaultBaseQualities 12 --targetIntervals $GATK_OUT/$fullID.gatk.intervals --noOriginalAlignmentTags --out $GATK_OUT/$fullID.realigned.bam 2>> $GATK_OUT/$logfile";
system($commandline)==0 or die "$commandline failed: $?\n";
print $logprint "<INFO>\t",timer(),"\tFinished using GATK IndelRealigner for $fullID!\n";
# if $basecalib is not defined, skip the next parts.
Expand All @@ -93,11 +95,13 @@ sub tbrefine {
# use BaseRecalibrator from GATK.
print $logprint "<INFO>\t",timer(),"\tStart using GATK BaseRecalibrator for $fullID...\n";
print $logprint "<INFO>\t",timer(),"\tjava -jar $GATK_dir/GenomeAnalysisTK.jar --analysis_type BaseRecalibrator --reference_sequence $VAR_dir/$ref --input_file $GATK_OUT/$fullID.realigned.bam --knownSites $basecalib --maximum_cycle_value 600 --num_cpu_threads_per_data_thread $threads --out $GATK_OUT/$fullID.gatk.grp 2>> $GATK_OUT/$logfile\n";
$commandline = "java -jar $GATK_dir/GenomeAnalysisTK.jar --analysis_type BaseRecalibrator --reference_sequence $VAR_dir/$ref --input_file $GATK_OUT/$fullID.realigned.bam --knownSites $basecalib --maximum_cycle_value 600 --num_cpu_threads_per_data_thread $threads --out $GATK_OUT/$fullID.gatk.grp 2>> $GATK_OUT/$logfile";
system($commandline)==0 or die "$commandline failed: $?\n";
print $logprint "<INFO>\t",timer(),"\tFinished using GATK BaseRecalibrator for $fullID!\n";
# use PrintReads with GATK.
print $logprint "<INFO>\t",timer(),"\tStart using GATK PrintReads for $fullID...\n";
print $logprint "<INFO>\t",timer(),"\tjava -jar $GATK_dir/GenomeAnalysisTK.jar -T --analysis_type PrintReads --reference_sequence $VAR_dir/$ref --input_file $GATK_OUT/$fullID.realigned.bam --BQSR $GATK_OUT/$fullID.gatk.grp --num_cpu_threads_per_data_thread $threads --out $GATK_OUT/$fullID.gatk.bam 2>> $GATK_OUT/$logfile\n";
$commandline = "java -jar $GATK_dir/GenomeAnalysisTK.jar -T --analysis_type PrintReads --reference_sequence $VAR_dir/$ref --input_file $GATK_OUT/$fullID.realigned.bam --BQSR $GATK_OUT/$fullID.gatk.grp --num_cpu_threads_per_data_thread $threads --out $GATK_OUT/$fullID.gatk.bam 2>> $GATK_OUT/$logfile";
system($commandline)==0 or die "$commandline failed: $?\n";
print $logprint "<INFO>\t",timer(),"\tFinished using GATK PrintReads for $fullID!\n";
# removing temporary files.
Expand Down

0 comments on commit 643c547

Please sign in to comment.