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
                  Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
                  by SEQadmin2



                  CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

                  Despite this, “CRISPR helped turn genome editing from a specialized technique into
                  ...
                  07-31-2026, 11:01 AM
                • SEQadmin2
                  Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
                  by SEQadmin2


                  Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

                  The systematic characterization of the human proteome has
                  ...
                  07-20-2026, 11:48 AM
                • SEQadmin2
                  Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                  by SEQadmin2



                  Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
                  ...
                  07-09-2026, 11:10 AM

                ad_right_rmr

                Collapse

                News

                Collapse

                Topics Statistics Last Post
                Started by SEQadmin2, 08-06-2026, 07:41 AM
                0 responses
                13 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 08-03-2026, 10:13 AM
                0 responses
                31 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 07-31-2026, 02:55 AM
                0 responses
                40 views
                0 reactions
                Last Post SEQadmin2  
                Started by SEQadmin2, 07-24-2026, 12:17 PM
                0 responses
                26 views
                0 reactions
                Last Post SEQadmin2  
                Working...