Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bfantinatti
    Member
    • Aug 2012
    • 22

    #1

    Mpileup output

    Hello!
    I'm using "mpileup -p reference.fasta my_file.bam" to generate a file that gives me the coverage for each base. This command generates a file with 6 columns but only the column 1, 2 and 4 (scaffold, position and coverage, respectively) are useful for me in this case. A can easily delete the useless columns using awk after, but in order to save disk space (around 50% for each file) I need some alternative to generate the mpileup report whitout the useless columns already. I need only the 1st, 2nd and 4th columns only. Is there some parameter that give-me this? (sorry about my poor english).
  • swbarnes2
    Senior Member
    • May 2008
    • 910

    #2
    Pipe the mpileup output to awk (or cut would work too), and then as it gets each line, it will cut out the parts you want, and only output that.

    Comment

    • westerman
      Rick Westerman
      • Jun 2008
      • 1104

      #3
      'cut' is so much more simple than 'awk' (in my opinion, of course). To use 'cut' just do:

      mpileup -p reference.fasta my_file.bam | cut -f 1,2,4

      Comment

      • bfantinatti
        Member
        • Aug 2012
        • 22

        #4
        Hello

        I used pipe awk and worked very well, thank you for the two answers.
        Despite generated the files as I wanted, I detected a little problem in results.
        The columns of the coverage shows some wrong nombers compared to the grafical view of the assembly.
        I'm using Tablet (http://bioinf.scri.ac.uk/tablet/) and IGV (http://www.broadinstitute.org/igv/) for visualize the reads. And looking to both visual and mpileup output, some positions shows a different coverage number, for example: The positions 1-4 is has exactly the same coverage in Tablet, IGV and mpileup. But the position 5-8 shows me one coverage point more in tablet and IGV than in mpileup (was this clear for you?).
        Is there some error in Tablet and IGV or in mpileup output? Or is the mpileup disregarding some reads because some quality problem or other stuff, resulting in diferences in coverage value?
        Thank you

        Comment

        • swbarnes2
          Senior Member
          • May 2008
          • 910

          #5
          The two softwares might differ in how they treat anamalous reads, or reads with zero mapq. For instance, the default on mpileup is to ignore anamlous pairs, and you change that with the command line option -A. I bet IGV counts them all.

          Comment

          • bfantinatti
            Member
            • Aug 2012
            • 22

            #6
            Hello

            I tried using -A and worked very well Thank you for the answer.
            One more question:
            When I have some gap on assembly, mpileup jumps directly to the next position presenting a coverage:
            scaffold_0 1 4
            scaffold_0 2 4
            scaffold_0 3 4
            scaffold_0 7 8
            scaffold_0 8 8
            scaffold_0 9 8

            I need the positions with 0 coverage also be included on mpileup output. Something like this:
            scaffold_0 1 4
            scaffold_0 2 4
            scaffold_0 3 4
            scaffold_0 4 0
            scaffold_0 5 0
            scaffold_0 6 0
            scaffold_0 7 8
            scaffold_0 8 8
            scaffold_0 9 8

            Comment

            • dnusol
              Senior Member
              • Jul 2009
              • 136

              #7
              hi bfantinatti,

              did you manage to get positions with 0 coverage in your mpileup output?

              cheers,

              D.

              Comment

              • bfantinatti
                Member
                • Aug 2012
                • 22

                #8
                Yes

                Hello dnusol, yes i did. Sorry, I forgot to post the solution here. I got the solution on annother forum related to bash issues.
                The solution was to apply the following code:

                awk '($2-p2)>1{
                for(i=p2+1;i<$2;i++)
                print $1,i,0
                }
                {p2=$2}1' file

                This will add lines where its lacks, keeping the sequence of the second column, and adding 0 on the respective 3rd column.

                Comment

                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, 10-22-2026, 11:13 AM
                0 responses
                27 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 10-22-2026, 10:48 AM
                0 responses
                20 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
                43 views
                0 reactions
                Last Post SEQadmin2  
                Working...