Changes between Version 12 and Version 13 of SOPs/miningSAMBAM


Ignore:
Timestamp:
05/15/14 09:42:41 (11 years ago)
Author:
gbell
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SOPs/miningSAMBAM

    v12 v13  
    77
    88{{{
    9 Convert SAM to BAM:
    10  samtools view -bS -o foo.bam foo.sam
     9# Convert SAM to BAM:
     10samtools view -bS -o foo.bam foo.sam
    1111}}}
    1212
    1313{{{
    14 Convert BAM to SAM:
    15  samtools view -h -o foo.sam foo.bam
     14# Convert BAM to SAM:
     15samtools view -h -o foo.sam foo.bam
    1616}}}
    1717{{{
    18 Sort BAM file (where ".bam" is added to "foo.sorted")
    19  samtools sort foo.bam foo.sorted
     18# Sort BAM file (where ".bam" is added to "foo.sorted")
     19samtools sort foo.bam foo.sorted
    2020}}}
    2121{{{
    22 Index a sorted BAM file (which creates foo.sorted.bam.bai):
    23  samtools index foo.sorted.bam
     22# Index a sorted BAM file (which creates foo.sorted.bam.bai):
     23samtools index foo.sorted.bam
    2424   
    2525# Both foo.sorted.bam and foo.sorted.bam.bai are needed for visualization.
     
    4949
    5050{{{
    51 Method 1 (all chromosomes)
    52 1 - Index the BAM file:
    53  samtools index mapped_reads.bam
    54 2 - Get index statistics (including the number of mapped reads in the third column:
    55  samtools idxstats mapped_reads.bam
     51# Method 1 (all chromosomes)
     52# 1 - Index the BAM file:
     53samtools index mapped_reads.bam
     54# 2 - Get index statistics (including the number of mapped reads in the third column:
     55samtools idxstats mapped_reads.bam
    5656}}}
    5757
    5858{{{
    59 Method 2 (one chromosome at a time, for example, chr2)
    60 From SAM
    61  awk -F"\t" '$3 == "chr2" {print $1}' mapped_reads.sam | sort -u | wc -l
    62 From BAM
    63  samtools view mapped_reads.bam chr2 | cut -f 1 | sort -u | wc -l
     59# Method 2 (one chromosome at a time, for example, chr2)
     60# From SAM
     61awk -F"\t" '$3 == "chr2" {print $1}' mapped_reads.sam | sort -u | wc -l
     62# From BAM
     63samtools view mapped_reads.bam chr2 | cut -f 1 | sort -u | wc -l
    6464}}}
    6565
     
    8181
    8282{{{
    83 -e: change identical bases to '='
    84 samtools view -b accepted_hits.bam |samtools fillmd -e - /nfs/genomes/mouse_mm10_dec_11_no_random/fasta_whole_genome/mm10.fa|more
     83# -e: change identical bases to '='
     84samtools view -b accepted_hits.bam | samtools fillmd -e - /nfs/genomes/mouse_mm10_dec_11_no_random/fasta_whole_genome/mm10.fa | more
    8585}}}
    8686
     
    8888=== Use QualiMap to get (visual) summary of mapping statistics eg. coverage/distribution ===
    8989{{{
    90 Graphical interface: enter 'qualimap' on the command line
    91 
    92 Command line:
     90# Graphical interface: enter 'qualimap' on the command line
     91# Command line:
    9392unset DISPLAY  #needed for submitting to cluster
    9493bsub "qualimap bamqc -bam myFile.bam -outdir output_qualimap"