# HG changeset patch # User romaingred # Date 1508402373 14400 # Node ID 39b039d82743cc8c4168f0111c21681691943186 # Parent fcaea740c23a0ca779e83c3f3c6a392acef78512 Uploaded diff -r fcaea740c23a -r 39b039d82743 bin/align.pm --- a/bin/align.pm Thu Oct 19 04:39:18 2017 -0400 +++ b/bin/align.pm Thu Oct 19 04:39:33 2017 -0400 @@ -302,14 +302,16 @@ sub sam_to_bam_bg { my ( $sam, $scale, $number_of_cpus ) = @_; - my ( $bam_sorted, $bedgraphM, $bedgraphP ) = ( '', '', '' ); + my ( $bam_sorted, $bedgraphM, $bedgraphP, $view_err, $sort_err ) = ( '', '', '', '', '' ); if ( $sam =~ /(.*?).sam$/ ) { $bam_sorted = $1.'_sorted.bam'; $bedgraphP= $1.'_plus.bedgraph'; $bedgraphM = $1.'_minus.bedgraph'; + $view_err = $1.'_view.err'; + $sort_err = $1.'_sort.err'; } - `samtools view -Shb --threads $number_of_cpus $sam | samtools sort -O BAM --threads $number_of_cpus /dev/stdin > $bam_sorted`; + `samtools view -Shb --threads $number_of_cpus $sam 2> $view_err | samtools sort -O BAM --threads $number_of_cpus /dev/stdin 2> $sort_err > $bam_sorted`; `bedtools genomecov -scale $scale -strand + -bga -ibam $bam_sorted > $bedgraphP`; `bedtools genomecov -scale $scale -strand - -bga -ibam $bam_sorted > $bedgraphM`; } @@ -317,12 +319,15 @@ sub sam_sorted_bam { my ( $sam, $number_of_cpus ) = @_; - my $bam_sorted =''; + my ( $bam_sorted, $view_err, $sort_err ) = ( '', '', '' ); if ( $sam =~ /(.*?).sam$/ ) { $bam_sorted = $1.'_sorted.bam'; + $view_err = $1.'_view.err'; + $sort_err = $1.'_sort.err'; + } - `samtools view -Shb --threads $number_of_cpus $sam | samtools sort -O BAM --threads $number_of_cpus /dev/stdin > $bam_sorted`; + `samtools view -Shb --threads $number_of_cpus $sam 2> $view_err | samtools sort -O BAM --threads $number_of_cpus /dev/stdin 2> $sort_err > $bam_sorted`; } sub BWA_call @@ -401,7 +406,7 @@ $arn =reverse($arn); $arn =~ tr/atgcuATGCU/tacgaTACGA/; } - #&& $line[11] eq "XT:A:U" ) + if ( ( $line[1] == 16 || $line[1] == 0 ) ) { print $f_out "\@".$line[0]."\n".$arn."\n+\n".$line[10]."\n" ;