Changes between Version 3 and Version 4 of SOPs/miningSAMBAM


Ignore:
Timestamp:
07/18/13 12:16:07 (12 years ago)
Author:
gbell
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SOPs/miningSAMBAM

    v3 v4  
    2525Both foo.sorted.bam and foo.sorted.bam.bai are needed for visualization.
    2626 }}} 
     27
     28=== Process a BAM file into another BAM file ===
     29
     30In many cases, there's no need to create an intermediate SAM file.  For example, to extract selected (mapped to chrM) reads:
     31{{{
     32samtools view -h accepted_hits.bam | awk -F "\t" '$3 ~ /chrM/ || $1 ~ /^@/ {print $0}' | samtools view -bS - > ~/accepted_hits.chrM_only.bam
     33}}}
     34We need to keep the header to convert back to BAM (hence the '-h' with 'samtools view' and the '$1 ~ ...' with awk).
    2735
    2836=== Count the number of mapped reads ===
     
    5866
    5967
    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? ===
    6169
    6270{{{
    6371bam_stat.py -i mapped_reads.bam >& bam_stat.out.txt
    6472}}}
     73