Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • base coverage per position on scaffolds

    Hi all,

    i've mapped my reads with Bowtie to a number of scaffolds, and now i want to know on every position on the scaffolds what the coverage is. Does anyone know how to do this, or is there a script/program available?

    As output I want something like;

    scaffold pos coverage
    scaffold1 1 4
    scaffold1 2 6
    scaffold1 3 10
    ...
    scaffold2 1 5
    scaffold2 2 15
    ...

    Thanks in advance,
    Marten

  • #2
    If you produced a sam file using bowtie, you can convert this to bam using samtools and then use bedtools to get per position coverage information.

    Comment


    • #3
      Use samtools pileup:

      Code:
      $ samtools pileup -f your_ref.fa your.bam
      Column # 4 is what you wanted.
      -drd

      Comment


      • #4
        Thanks both for your reply. I've used Drio's method since it's the easiest one. It works very good!

        Comment


        • #5
          Different values

          Hello there, I had the same problem, and previous posts solved my problems. But there is an little detail:
          I have a bam file, and used mpileup to list the per position coverage. Resulted in a file with some columns where the column #4 is the coverage. But opening in Tablet the same bam file using the same reference genome, the coverage number are not the same. Some one knows what is happening?
          Thank you a lot

          Comment


          • #6
            I'm doing this sort of thing at the moment and just as the following snippet of Perl is really useful for working with Bam files..

            Code:
            #!/usr/bin/perl
            open(INFILE,"samtools view $ARGV[0] |");
            while(<INFILE>)
            {
            	#do something with $_;
            
            }
            You can also say..

            Code:
            #!/usr/bin/perl
            open(INFILE,"samtools mpileup $ARGV[0] |");
            while(<INFILE>)
            {
            	#do something with $_;
            
            }
            And the coverage is in column 4. I'm just adding this post to caution that mpileup doesn't report the positions where coverage is zero (my source of this info being some other posts on seqanswers).. but samtools depth does report the zero's.

            Does anyone have a nice way to deal with multiply mapping reads here? The standard way to deal with a read that maps to multiple contigs is to count it towards the coverage at every position where it maps right?

            Comment

            Latest Articles

            Collapse

            • seqadmin
              Exploring the Dynamics of the Tumor Microenvironment
              by seqadmin




              The complexity of cancer is clearly demonstrated in the diverse ecosystem of the tumor microenvironment (TME). The TME is made up of numerous cell types and its development begins with the changes that happen during oncogenesis. “Genomic mutations, copy number changes, epigenetic alterations, and alternative gene expression occur to varying degrees within the affected tumor cells,” explained Andrea O’Hara, Ph.D., Strategic Technical Specialist at Azenta. “As...
              07-08-2024, 03:19 PM
            • seqadmin
              Exploring Human Diversity Through Large-Scale Omics
              by seqadmin


              In 2003, researchers from the Human Genome Project (HGP) announced the most comprehensive genome to date1. Although the genome wasn’t fully completed until nearly 20 years later2, numerous large-scale projects, such as the International HapMap Project and 1000 Genomes Project, continued the HGP's work, capturing extensive variation and genomic diversity within humans. Recently, newer initiatives have significantly increased in scale and expanded beyond genomics, offering a more detailed...
              06-25-2024, 06:43 AM

            ad_right_rmr

            Collapse

            News

            Collapse

            Topics Statistics Last Post
            Started by seqadmin, Yesterday, 05:49 AM
            0 responses
            15 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 07-15-2024, 06:53 AM
            0 responses
            26 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 07-10-2024, 07:30 AM
            0 responses
            37 views
            0 likes
            Last Post seqadmin  
            Started by seqadmin, 07-03-2024, 09:45 AM
            0 responses
            204 views
            0 likes
            Last Post seqadmin  
            Working...
            X