Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • sam output from bwa colorspace alignment

    Hi,

    I am trying bwa with SOLiD input but encounter a problem with the SAM output. Reads aligned to the - strand are stored in such a way that using them in e.g. samtools pileup or samtools tview does not report the alignment properly.

    How to easily reproduce the problem:

    #prepare a short reference sequence using the samtools example sequence:
    head -3 /usr/local/samtools-0.1.6/examples/ex1.fa > ref.fa
    samtools faidx ref.fa
    qbwa index -c -p ref -a is ref.fa

    #simulate a few SOLiD reads with no mismatches:
    wgsim -c -e 0.0 -d 110 -s 0.00001 -N 10 -1 50 -2 50 -r0.0 -R 0.0 ref.fa sim_F3.fq sim_R3.fq

    #align:
    bwa aln -c ref sim_F3.fq > sim_F3.sai
    bwa aln -c ref sim_R3.fq > sim_R3.sai
    bwa sampe ref sim_R3.sai sim_F3.sai sim_R3.fq sim_F3.fq > sim.sam

    #reformat:
    samtools import ref sim.sam sim.unsorted.bam
    samtools sort sim.unsorted.bam sim
    samtools index sim.bam

    #display alignments with tview (and edit, copy and paste output):
    samtools tview sim.bam ref.fa

    1 11 21 31 41 51
    CACTAGTGGCTCATTGTAAATGTGTGGTTTAACTCGTCCATGGCCCAGCATTAGGGAGCT
    ........A..AACA...ACACACCAAA...A.CA...ACC....C..AATCCCTC
    .................................................
    .................................................
    atcaccgagtaacatttacacaccaaattgagcaggtaccgggtcgtaa
    .................................................
    accgagtaacatttacacaccaaattgagcaggtaccgggtcgtaatcc
    .................................................
    .................................................
    gagtaacatttacacaccaaattgagcaggtaccgggtcgtaatccctc
    gagtaacatttacacaccaaattgagcaggtaccgggtcgtaatccctc
    gagtaacatttacacaccaaattgagcaggtaccgggtcgtaatccctc

    61 71 81 91 101 111
    GTGGACCCTGCAGCCTGGCTGTGGGGGCCGCAGTGGCTGAGGGGTGCAGAGCCGAGTCACNNNN
    ........AC..C..ACC.ACACCCCC..C..CACC.AC.CCCCAC..CTCGGCTC
    .................................................
    .................................................
    acctgggacgtcggaccgacacccccggcgtcaccgactccccacgtct
    .................................................
    tgggacgtcggaccgacacccccggcgtcaccgactccccacgtctcgg
    .................................................
    .................................................
    gacgtcggaccgacacccccggcgtcaccgactccccacgtctcggctc
    gacgtcggaccgacacccccggcgtcaccgactccccacgtctcggctc
    gacgtcggaccgacacccccggcgtcaccgactccccacgtctcggctc


    #pileup:
    samtools pileup -c -f ref.fa sim.bam | head -10
    seq1 3 C C 10 0 37 1 ^F. +
    seq1 4 T T 8 0 37 3 .^F.^Fa +++
    seq1 5 A A 15 0 37 4 ..t^F. ++++
    seq1 6 G G 15 0 37 4 ..c. ++++
    seq1 7 T T 7 0 37 5 ..a.^Fa +++++
    seq1 8 G G 12 0 37 6 ..c.c^F. ++++++
    seq1 9 G G 17 0 37 7 ..c.c.^F. +++++++
    seq1 10 C C 0 0 37 10 ..g.g..^Fg^Fg^Fg ++++++++++
    seq1 11 T A 0 0 37 10 ..a.a..aaa ++++++++++
    seq1 12 C C 0 0 37 10 ..g.g..ggg ++++++++++


    The above outputs look a bit messy here but it's clear that half of the reads are displayed as not matching the reference sequence, which is not the case. Reads in the SAM file which have a flag field value of 65 or 129 (half of them) have a sequence in the SEQ field that can be found within the + strand of the reference sequence. In contrast the reads in the SAM file that have a flag filed value of 113 or 177 have a sequence which is the complement of part of the reference sequence (but not the reverse complement) e.g.:

    seq1_56_114_0:0:0_0:0:0_1 113 seq1 7 37 49M = 65 58 ACCGAGTAACATTTACACACCAAATTGA
    GCAGGTACCGGGTCGTAATCC +++++++++++++++++++++++++++++++++++++++++++++++++ XT:A:U CM:i:0 SM:i:37 AM:i:37 X0:i:1 X1:i

    (sorry about the wrapping)

    This line reports ACCGAG..etc which is actually the complement of part of the reference sequence (GTGGCTCATTGTAAATGTGTGGTTTAACTCGTCCATGGCCCAGCATTAGG). SO there are good alignments but they are not stored correctly in the sam file because the SAM specification say that "All mapped reads are represented on the forward genomic strand."

    So am I doing something dumb or is this a problem with the way BWA produces sam format output?

    Thanks for any advice or comments.

    Mr M

Latest Articles

Collapse

  • seqadmin
    Current Approaches to Protein Sequencing
    by seqadmin


    Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
    04-04-2024, 04:25 PM
  • seqadmin
    Strategies for Sequencing Challenging Samples
    by seqadmin


    Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
    03-22-2024, 06:39 AM

ad_right_rmr

Collapse

News

Collapse

Topics Statistics Last Post
Started by seqadmin, 04-11-2024, 12:08 PM
0 responses
30 views
0 likes
Last Post seqadmin  
Started by seqadmin, 04-10-2024, 10:19 PM
0 responses
32 views
0 likes
Last Post seqadmin  
Started by seqadmin, 04-10-2024, 09:21 AM
0 responses
28 views
0 likes
Last Post seqadmin  
Started by seqadmin, 04-04-2024, 09:00 AM
0 responses
53 views
0 likes
Last Post seqadmin  
Working...
X