Last active
December 23, 2015 21:29
-
-
Save mtw/6696800 to your computer and use it in GitHub Desktop.
Wrapper script for counting mapped reads in a bam file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
countdir="./count" | |
count_mapped_reads=`which count_mapped_reads_fast.pl` | |
bam_stat=`which bam_stat.py` | |
samtools=`which samtools` | |
samstats=`which sam-stats` | |
if [ -d "$countdir" ]; | |
then | |
echo "$countdir available" | |
else | |
mkdir -p $countdir | |
fi | |
set -x | |
for BAM in $(ls *.bam) | |
do | |
#$bn=$(basename $BAM .bam) | |
name=${BAM%.bam} | |
$count_mapped_reads -bam $name.bam > $countdir/$name.count | |
$bam_stat -i $name.bam 2> $countdir/$name.bamstat | |
$samtools flagstat $name.bam > $countdir/$name.flagstat | |
$samstats -B $name.bam > $countdir/$name.samstats | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment