Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prs321
    Member
    • Jun 2013
    • 96

    #1

    How do I go about converting a BCF file to a VCF file?

    I tried using BCFtools but I keep getting an error.



    1. I had 2 SAM files that converted to BAM, sorted by chromosome, and finally indexed using Picard.




    2. Using the 2 manipulated BAM files, I used the mpileup command in SAMtools. Here is the specific command:

    samtools mpileup -f ref.fa in.bam in2.bam > in_in2_pileup.bcf




    3. After this step I wanted to get the vcf format. I used bcftools and the command view in order to do this:

    bcftools view in_in2_pileup.bcf > in_in2_pileup.vcf


    The error that I received after executing this command:

    incorrect number of fields (0 != 5) at 0:0






    PS. I tried looking my problem up in google search and every example seemed to be irrelevant in my case.
  • westerman
    Rick Westerman
    • Jun 2008
    • 1104

    #2
    Every example? How about http://samtools.sourceforge.net/mpileup.shtml. One of my first hits via Google.

    However what you are probably overlooking is the proper command line option to mpileup. Either look at the above web page and/or type in 'samtools mpileup' and read the help or look at your output file. It will be good for your eyes to spot the mistake. :-)

    Comment

    • prs321
      Member
      • Jun 2013
      • 96

      #3
      Ahh I see i see, thanks.

      Comment

      • Giffredo
        Member
        • Feb 2014
        • 36

        #4
        I have the same problem but I have not "seen" yet ...

        i want to use mpileup without -u and -g options but all the command line used did not work..

        Comment

        • TiborNagy
          Senior Member
          • Mar 2010
          • 329

          #5
          Can you share us the command line?

          Comment

          • Giffredo
            Member
            • Feb 2014
            • 36

            #6
            Code:
            samtools mpileup -f .fas .sorted.bam > .bcf | bcftools view > .vcf&

            Just now I have used

            Code:
            samtools mpileup -f .fas .sorted.bam | tee teeoutput.bcf&
            This "artefact" maybe works..

            Comment

            • dpryan
              Devon Ryan
              • Jul 2011
              • 3478

              #7
              I just replied on biostars, but this won't work since bcftools is expecting BCF, and you're giving it mpileup, which is text.

              Comment

              • Giffredo
                Member
                • Feb 2014
                • 36

                #8
                So, are you telling me that the output from
                Code:
                samtools mpileup -f .fas .sorted.bam
                is a .txt?

                .. then if I use..

                Code:
                samtools mpileup -f .fas .sorted.bam | tee teeoutput.txt&
                ...I ll reach the table that I pine for!!

                Comment

                • dpryan
                  Devon Ryan
                  • Jul 2011
                  • 3478

                  #9
                  Originally posted by Giffredo View Post
                  .. then if I use..

                  Code:
                  samtools mpileup -f .fas .sorted.bam | tee teeoutput.txt&
                  ...I ll reach the table that I pine for!!
                  Well, it depends on what sort of table you're after. If you just want the pileup and not variant calls then:

                  Code:
                  samtools mpileup -f .fas .sorted.bam > output.txt
                  would seem to do what you want. There'd be no need to pipe things to tee in that case. Also, there's no reason to always end commands with "&", particularly if they'll just be printing stuff to the screen.

                  Comment

                  • Giffredo
                    Member
                    • Feb 2014
                    • 36

                    #10
                    Ok thanks!!! I will try.
                    About & I know.. I put it because of force of habit.. ...

                    Comment

                    • Giffredo
                      Member
                      • Feb 2014
                      • 36

                      #11
                      chrM 136 A 6 ,,,,,, 896774
                      chrM 137 A 6 ,,,,,, ?=@===
                      chrM 138 A 6 ,,,,,, ?=<=8<
                      chrM 139 C 6 ,,,,,, 887801
                      chrM 140 C 6 ,,,,,, @>==9;
                      chrM 141 C 6 ,,,,,, ><==9;
                      chrM 142 T 6 ,,,,,, 747701

                      the manual say: each line represents a genomic position, consisting of chromosome name, coordinate, reference base, read bases, read qualities and alignment mapping qualities. Information on match, mismatch, indel, strand, mapping quality and start and end of a read are all encoded at the read base column.

                      it is not like expected... this txt is not useful at all.

                      Comment

                      • dpryan
                        Devon Ryan
                        • Jul 2011
                        • 3478

                        #12
                        That text file is exactly the output that the manual is describing, so I'm not sure what else you were expecting.

                        Comment

                        • Giffredo
                          Member
                          • Feb 2014
                          • 36

                          #13
                          I think it is not...
                          I expected something like this but with the right symbol in the right positions in order to have the possibility to translate and understand them!
                          where are the read bases? and the quality value? why so many ',' if the position is one?
                          and..
                          what mean @ it is not in the legend.. for me there is characters mismatch because of file wrong conversion...

                          Comes on the question: using pmileup is possible to reach other types of results different from these i reached so far?

                          Comment

                          • dpryan
                            Devon Ryan
                            • Jul 2011
                            • 3478

                            #14
                            You need to read the manual a bit more. "," is a base call, it just means "the same as the reference, on the reverse orientation". The base quality scores are in the last column, they're phred encoded. "@", for example, is 31.

                            Regarding mpileup vs. pileup, the output is the same. The only difference is that mpileup can deal with multiple files at once (it just tacks on an extra 3 columns per file).

                            Perhaps it would help if you mentioned what your actual goal is.

                            Comment

                            • Giffredo
                              Member
                              • Feb 2014
                              • 36

                              #15
                              "," is a base call, it just means "the same as the reference, on the reverse orientation". The base quality scores are in the last column, they're phred encoded. "@", for example, is 31.
                              OK.. but I have still some doubts: I know "," is a base call and for this reason I don t understand why I have more than one "," for only one base in one position...

                              ..and what is Phred code? I know the ASCII code but Phred for me is only a number derived from a logarithmic operation...

                              My goal is measure the editing sites position, splicing, post transcription modifications in general from my mutant sample mRNA. And I want to make a statistical work on these variations.

                              Comment

                              Latest Articles

                              Collapse

                              • 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
                                ...
                                Yesterday, 10:25 AM
                              • SEQadmin2
                                How Immunogenomics Decodes Immunity’s Genetic Blueprint
                                by SEQadmin2




                                The immune system’s power comes from its genetic diversity, allowing myriad threats to be neutralized through first recognizing foreign antigens. That diversity is also what makes the immune system so difficult to study. Recent advances in sequencing technology and computational biology, however, are giving researchers new tools to understand immune responses and immune-related diseases in greater detail.

                                This convergence of genetics, immunology, and computation...
                                09-01-2026, 05:41 AM

                              ad_right_rmr

                              Collapse

                              News

                              Collapse

                              Topics Statistics Last Post
                              Started by SEQadmin2, Today, 09:51 AM
                              0 responses
                              7 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 09-25-2026, 09:06 AM
                              0 responses
                              31 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 09-23-2026, 11:05 AM
                              0 responses
                              26 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 09-18-2026, 11:37 AM
                              1 response
                              46 views
                              0 reactions
                              Last Post pekgio
                              by pekgio
                               
                              Working...