Changes between Version 12 and Version 13 of SOPs/miningSAMBAM
- Timestamp:
- 05/15/14 09:42:41 (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
SOPs/miningSAMBAM
v12 v13 7 7 8 8 {{{ 9 Convert SAM to BAM:10 9 # Convert SAM to BAM: 10 samtools view -bS -o foo.bam foo.sam 11 11 }}} 12 12 13 13 {{{ 14 Convert BAM to SAM:15 14 # Convert BAM to SAM: 15 samtools view -h -o foo.sam foo.bam 16 16 }}} 17 17 {{{ 18 Sort BAM file (where ".bam" is added to "foo.sorted")19 18 # Sort BAM file (where ".bam" is added to "foo.sorted") 19 samtools sort foo.bam foo.sorted 20 20 }}} 21 21 {{{ 22 Index a sorted BAM file (which creates foo.sorted.bam.bai):23 22 # Index a sorted BAM file (which creates foo.sorted.bam.bai): 23 samtools index foo.sorted.bam 24 24 25 25 # Both foo.sorted.bam and foo.sorted.bam.bai are needed for visualization. … … 49 49 50 50 {{{ 51 Method 1 (all chromosomes)52 1 - Index the BAM file:53 54 2 - Get index statistics (including the number of mapped reads in the third column:55 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 56 56 }}} 57 57 58 58 {{{ 59 Method 2 (one chromosome at a time, for example, chr2)60 From SAM61 62 From BAM63 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 64 64 }}} 65 65 … … 81 81 82 82 {{{ 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|more83 # -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 85 85 }}} 86 86 … … 88 88 === Use QualiMap to get (visual) summary of mapping statistics eg. coverage/distribution === 89 89 {{{ 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: 93 92 unset DISPLAY #needed for submitting to cluster 94 93 bsub "qualimap bamqc -bam myFile.bam -outdir output_qualimap"