Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mr Mutundes
    Member
    • Jan 2009
    • 17

    #1

    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

  • SEQadmin2
    Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
    by SEQadmin2



    Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

    Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
    ...
    10-14-2026, 09:55 AM
  • SEQadmin2
    New Genomics Technologies Take Aim at Long-Standing Limits
    by SEQadmin2


    Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

    We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
    ...
    09-28-2026, 10:25 AM

ad_right_rmr

Collapse

News

Collapse

Topics Statistics Last Post
Started by SEQadmin2, Yesterday, 11:13 AM
0 responses
21 views
0 reactions
Last Post SEQadmin2  
Started by SEQadmin2, Yesterday, 10:48 AM
0 responses
18 views
0 reactions
Last Post SEQadmin2  
Started by SEQadmin2, 10-15-2026, 10:52 AM
0 responses
36 views
0 reactions
Last Post SEQadmin2  
Started by SEQadmin2, 10-14-2026, 05:39 AM
0 responses
42 views
0 reactions
Last Post SEQadmin2  
Working...