Changes between Version 5 and Version 6 of SOPs/miningSAMBAM


Ignore:
Timestamp:
01/31/14 11:17:02 (11 years ago)
Author:
gbell
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SOPs/miningSAMBAM

    v5 v6  
    3535In many cases, there's no need to create an intermediate SAM file.  For example, to extract selected (mapped to chrM) reads:
    3636{{{
    37 samtools view -h accepted_hits.bam | awk -F "\t" '$3 ~ /chrM/ || $1 ~ /^@/ {print $0}' | samtools view -bS - > ~/accepted_hits.chrM_only.bam
     37samtools index accepted_hits.bam   # Required if you want to select a genome region (like chrM)
     38samtools view -h accepted_hits.bam chrM | samtools view -bS - > accepted_hits.chrM_only.bam
    3839}}}
    3940We need to keep the header to convert back to BAM (hence the '-h' with 'samtools view' and the '$1 ~ ...' with awk).