Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • joa_ds
    Member
    • Dec 2008
    • 52

    BWA - Samtools problem

    Hello everyone

    There are some topics concerning BWA and Samtools, but i still haven't found the solution to my problem...

    Ok, here is what i do

    1. I run BWA aln and I get a .sai file
    2. I run BWA samse and I get a .sam file

    So far so good.

    But now i am having troubles using the 'pileup function'

    As far as i understand i should use ./samtools -f ref.fna testing.sam

    but it is giving me errors.

    I am probably just using a wrong command or maybe i should convert the .sam file to a .bam file? I have tried this using:
    samtools view -bt ref.fna -o out.bam testing.sam:sam_header_read2: Assertion `fp' failed.
    samtools view -b ref.fna -o out.bam testing.sam:segmentation error

    Anyone has the exact commando for me to got from BWA to 'pileup results' in samtools?

    thx
    Last edited by joa_ds; 08-05-2009, 01:05 AM.
  • nilshomer
    Nils Homer
    • Nov 2008
    • 1283

    #2
    Originally posted by joa_ds View Post
    Hello everyone

    There are some topics concerning BWA and Samtools, but i still haven't found the solution to my problem...

    Ok, here is what i do

    1. I run BWA aln and I get a .sai file
    2. I run BWA samse and I get a .sam file

    So far so good.

    But now i am having troubles using the 'pileup function'

    As far as i understand i should use ./samtools -f ref.fna testing.sam

    but it is giving me errors.

    I am probably just using a wrong command or maybe i should convert the .sam file to a .bam file? I have tried this using:
    samtools view -bt ref.fna -o out.bam testing.sam:sam_header_read2: Assertion `fp' failed.
    samtools view -b ref.fna -o out.bam testing.sam:segmentation error

    Anyone has the exact commando for me to got from BWA to 'pileup results' in samtools?

    thx
    If you have a "sam" file, then you must use the "-S" flag (for the input is SAM) with "samtools view". "samtools view" expects a ".bam" file, so you could also convert it to a BAM file.

    Comment

    • totalnew
      Member
      • Apr 2009
      • 46

      #3
      Try these two commands:

      >samtools pileup -cf ref.fa testing.bam
      or
      >samtools pileup -cf ref.fa -t ref.fa.fai testing.sam

      They are actually the same, but you would have to get bam file first which will require the indexed reference sequence (use faidx option to get it).

      Comment

      • totalnew
        Member
        • Apr 2009
        • 46

        #4
        For samtools view ..., I don't see any sense you need to use it, since I normally use it to convert bam file back to sam file.

        Comment

        • yasu
          Member
          • Jul 2009
          • 10

          #5
          I have a quick question. How can I use 'samtools view' for converting bam file to sam file? I tried some times but I failed to do it...

          Comment

          • nilshomer
            Nils Homer
            • Nov 2008
            • 1283

            #6
            Originally posted by yasu View Post
            I have a quick question. How can I use 'samtools view' for converting bam file to sam file? I tried some times but I failed to do it...
            You can, but include the header ("-h").

            Comment

            • joa_ds
              Member
              • Dec 2008
              • 52

              #7
              hi there again...

              The reasons I am trying BWA (still hasn't worked... ) is because I am analyzing illumina data for counting variant frequencies for a pool of several patients.

              So far so good, BowTie gives 15%, Maq gives 40% and Sanger validation gives 0% for a certain variant. We have around 1000 variants, so this is kinda annoying.

              I am doing a very simple thing: I align the reads using BowTie and i just parse the output file and count the variant frequencies. Some other people used MAQ and in the lab they verified using Sanger.

              Before I spend another 10h trying to figure out why this BWA thing ain't working, is it worth trying to determine variant frequencies in a pool? And if so, what is the best strategy to do so.

              And on the BWA/samtools thingie. I tryed using the -S flag but i keep getting "Segmentation fault"

              I must be doing something totally wrong here...


              Step 0:
              /data/illumina/bwa-0.4.9/bwa index -a is Final

              Step 1:
              /data/illumina/bwa-0.4.9/bwa aln -t 12 Final Risk_no_haplos.txt > Risk_no_haplos.sai

              Step 2:
              /data/illumina/bwa-0.4.9/bwa samse Final Risk_no_haplos.sai Risk_no_haplos.txt > Risk_no_haplos.sam

              Step 3:
              ../../samtools-0.1.5c_x86_64-linux/samtools view -S -h Risk_no_haplos.sam \
              is giving
              missing header? Abort!

              ../../samtools-0.1.5c_x86_64-linux/samtools pileup -S -cf Final Risk_no_haplos.sam
              is giving
              [samopen] no @SQ lines in the header.
              [sam_read1] missing header? Abort!


              aargh

              EDIT: Woohoo, finally figured it out... Apparently i had to use faidx before i could use pileup straight away... The question remains if using BWA is a wise thing for the presented problem...
              Last edited by joa_ds; 08-10-2009, 07:10 AM. Reason: Woops

              Comment

              • totalnew
                Member
                • Apr 2009
                • 46

                #8
                Originally posted by yasu View Post
                I have a quick question. How can I use 'samtools view' for converting bam file to sam file? I tried some times but I failed to do it...
                That is way simple, try this linux command

                samtools view test.bam > test.sam

                Comment

                • totalnew
                  Member
                  • Apr 2009
                  • 46

                  #9
                  Originally posted by joa_ds View Post
                  hi there again...


                  Step 3:
                  ../../samtools-0.1.5c_x86_64-linux/samtools view -S -h Risk_no_haplos.sam \
                  is giving
                  missing header? Abort!

                  ../../samtools-0.1.5c_x86_64-linux/samtools pileup -S -cf Final Risk_no_haplos.sam
                  is giving
                  [samopen] no @SQ lines in the header.
                  [sam_read1] missing header? Abort!


                  aargh

                  EDIT: Woohoo, finally figured it out... Apparently i had to use faidx before i could use pileup straight away... The question remains if using BWA is a wise thing for the presented problem...
                  Apparently, you shouldn't use samtools view sam file, that is for bam file. To pileup, you would either make bam file or get indexed reference sequence (.fai).
                  Last edited by totalnew; 08-10-2009, 08:27 AM.

                  Comment

                  • kraigrs
                    Junior Member
                    • Oct 2009
                    • 3

                    #10
                    When I attempt to align mated paired-end sequence reads and output the file
                    in SAM format, I receive a segmentation fault. If I try the same thing
                    without the -S/--sam option, it works fine. Here is what I am getting:

                    EEB-WITT5:Bowtie wittkopp-lab$ ./bowtie -q -k 1 --sam --best
                    --solexa1.3-quals dmel-all-CDS-r5.21 -1
                    ./mel_sim_data/Hybrids/s_2_1_sequence.txt -2
                    ./mel_sim_data/Hybrids/s_2_2_sequence.txt > s_2_sequence.sam

                    Segmentation fault

                    Any help in this matter would be greatly appreciated! Again, I would like
                    this output to be in SAM format. I tried converting the bowtie output to
                    SAM but the bowtie2sam.pl script from SAMtools doesn't do that for me.

                    Comment

                    • xuer
                      Member
                      • Sep 2008
                      • 17

                      #11
                      I tried to use sort command :
                      samtools sort aln.sam aln.sam.sorted
                      i also got
                      Segmentation fault
                      is there anybody had this probelm before?

                      Comment

                      • totalnew
                        Member
                        • Apr 2009
                        • 46

                        #12
                        Originally posted by xuer View Post
                        I tried to use sort command :
                        samtools sort aln.sam aln.sam.sorted
                        i also got
                        Segmentation fault
                        is there anybody had this probelm before?

                        You should sort bam file, try this

                        samtools sort -n aln.bam sorted

                        then mv the sorted.bam file to whatever name you want.

                        Comment

                        • Victory
                          Member
                          • Nov 2009
                          • 13

                          #13
                          Install SAM tool

                          Are there anyone know how to install SAM tool? I read in the SAM document and it didn't say anything about that. Thank you.

                          Comment

                          • nilshomer
                            Nils Homer
                            • Nov 2008
                            • 1283

                            #14
                            Originally posted by Victory View Post
                            Are there anyone know how to install SAM tool? I read in the SAM document and it didn't say anything about that. Thank you.
                            Download it from http://samtools.sourceforge.net/. Copy the binaries to your typical install directory (which depends on your system).

                            Comment

                            • Victory
                              Member
                              • Nov 2009
                              • 13

                              #15
                              Thank you. I use SUN cluster computer. I have already copy whole folder of SAM version 0.1.6 to my working directory. However, it still doesn't work. I'm not sure which one is the install directory.

                              Comment

                              Latest Articles

                              Collapse

                              • SEQadmin2
                                Nine Things a Sample Prep Scientist Thinks About Before Sequencing
                                by SEQadmin2


                                I’m not a sequencing expert. I’m a purification scientist who uses NGS to evaluate workflows my group develops. With this perspective, we think about the sample first and the NGS workflow second. The sequencer is an exceptionally honest reporter, but it can only report on what you give it, so whether you get clean, interpretable data from an NGS workflow is largely determined before you begin.

                                Here are nine questions we think about, in roughly the order they matter, before...
                                06-18-2026, 07:11 AM
                              • SEQadmin2
                                From Collection to Sequencing: Why Sample Preparation and Preservation Define Sequencing Data
                                by SEQadmin2


                                Data variability is still an issue in sequencing technologies despite the advances in reproducibility and accuracy of these platforms. But the problem does not originate in the sequencing itself, but in the previous steps, before the sample reaches the sequencer.


                                The first step is collection, followed by preservation and sample preparation for analysis. Most scientists overlook those steps, but not being careful might just be skewing the experiment’s results.
                                ...
                                06-02-2026, 10:05 AM

                              ad_right_rmr

                              Collapse

                              News

                              Collapse

                              Topics Statistics Last Post
                              Started by SEQadmin2, Yesterday, 11:10 AM
                              0 responses
                              7 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 06-17-2026, 06:09 AM
                              0 responses
                              42 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 06-09-2026, 11:58 AM
                              0 responses
                              103 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 06-05-2026, 10:09 AM
                              0 responses
                              125 views
                              0 reactions
                              Last Post SEQadmin2  
                              Working...