Changes between Version 5 and Version 6 of SOPs/miningSAMBAM
- Timestamp:
- 01/31/14 11:17:02 (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
SOPs/miningSAMBAM
v5 v6 35 35 In many cases, there's no need to create an intermediate SAM file. For example, to extract selected (mapped to chrM) reads: 36 36 {{{ 37 samtools view -h accepted_hits.bam | awk -F "\t" '$3 ~ /chrM/ || $1 ~ /^@/ {print $0}' | samtools view -bS - > ~/accepted_hits.chrM_only.bam 37 samtools index accepted_hits.bam # Required if you want to select a genome region (like chrM) 38 samtools view -h accepted_hits.bam chrM | samtools view -bS - > accepted_hits.chrM_only.bam 38 39 }}} 39 40 We need to keep the header to convert back to BAM (hence the '-h' with 'samtools view' and the '$1 ~ ...' with awk).