MergeAllBamFilesWithBash.sh

From ZhangLabWiki
Revision as of 01:07, 21 March 2016 by >Shicheng (Created page with " find $BAM_DIR -name '*.bam' | { read firstbam samtools view -h "$firstbam" while read bam; do samtools view "$bam" done } | samtools view -ubS - | sa...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
find $BAM_DIR -name '*.bam' | {
   read firstbam
   samtools view -h "$firstbam"
   while read bam; do
       samtools view "$bam"
   done
} | samtools view -ubS - | samtools sort -o merged.bam -
samtools index merged.bam
ls -l merged.bam merged.bam.bai