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
                  The Factors Reshaping Genome Assembly
                  by SEQadmin2



                  When the Human Genome Project declared the human genome finished in 2003, portions of the sequence were still missing, including many of its most repetitive and structurally complex regions.1 Still, for the next two decades, researchers analyzed their sequencing data against the single linear reference that came out of this effort. Released in 2013 as GRCh38, that reference has powered countless discoveries, but it has gaps and cannot capture the genetic diversity of the world’s...
                  11-24-2026, 07:04 AM
                • SEQadmin2
                  16S/ITS Profiling vs. Shotgun Metagenomics: What Changes in Your Workflow?
                  by SEQadmin2





                  NGS has revolutionized clinical microbiology by offering new ways to identify and surveil pathogens without prior knowledge of the target. One popular approach is 16S rRNA and ITS amplicon sequencing, which targets specific microbial markers. But studies are increasingly incorporating shotgun metagenomics, a technique that sequences all DNA from a sample without targeting specific microbial markers. This approach allows more detailed taxonomic classification,...
                  10-30-2026, 06:46 AM

                ad_right_rmr

                Collapse

                News

                Collapse

                Topics Statistics Last Post
                Started by SEQadmin2, 11-23-2026, 11:11 AM
                0 responses
                39 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 11-17-2026, 06:27 AM
                0 responses
                47 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 11-12-2026, 07:59 AM
                0 responses
                68 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 11-05-2026, 09:25 AM
                0 responses
                68 views
                0 reactions
                Last Post SEQadmin2  
                Working...