Changes between Version 3 and Version 4 of SOPs/miningSAMBAM
- Timestamp:
- 07/18/13 12:16:07 (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
SOPs/miningSAMBAM
v3 v4 25 25 Both foo.sorted.bam and foo.sorted.bam.bai are needed for visualization. 26 26 }}} 27 28 === Process a BAM file into another BAM file === 29 30 In many cases, there's no need to create an intermediate SAM file. For example, to extract selected (mapped to chrM) reads: 31 {{{ 32 samtools view -h accepted_hits.bam | awk -F "\t" '$3 ~ /chrM/ || $1 ~ /^@/ {print $0}' | samtools view -bS - > ~/accepted_hits.chrM_only.bam 33 }}} 34 We need to keep the header to convert back to BAM (hence the '-h' with 'samtools view' and the '$1 ~ ...' with awk). 27 35 28 36 === Count the number of mapped reads === … … 58 66 59 67 60 === How many multiple/uniquely mapped reads are in a bam/sam file? 68 === How many multiple/uniquely mapped reads are in a bam/sam file? === 61 69 62 70 {{{ 63 71 bam_stat.py -i mapped_reads.bam >& bam_stat.out.txt 64 72 }}} 73