Announcement

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

  • parsing bam

    Hi,

    I recently concatenated many 200nt sequences to the end of each other; these sequences were from different parts of genome. Then I fed this to Geneious as a reference sequences and mapped sequencing reads (each read = 70nt) to it. I exported the results as a bam file. Now I need to write a Perl script that parses the bam file and finds out whether or not each of those initial sequences (the 200nt ones that were concatenated) is covered in sequencing reads. I have read the Bio:B::Sam tutorial on CPAN but I am still stuck. Here is all the code I have written so far:
    Code:
    use Bio::DB::Sam;
    my $sam = Bio::DB::Sam -> new (-fasta => ... , -bam => ...) ;
    my $segment;
    ($id)=$sam -> seq_ids;
    while ($i < $sam->length($id)) { 
    $segment =$ sam -> segment($id , $i ,$i +200) ;
    
    # What should I write here?  
    
    $i +=200; 
    }
    I would appreciate your help, since CPAN manual only confuses me.

  • #2
    What do you mean by covered? Do you mean the coverage across every position of a 200nt fragment is at least 1X?

    If so its a pretty simple problem to solve. If you don't care about speed you could use mpileup to check if each of the 200 positions for a given range are covered by at least 1 70nt read.

    If you like to program, then you could use any of the various samtools bindings to PERL, C, C++,etc. You would open the BAM and step through each position to see if there is at least 1 read returned. Maybe there is even a faster way to do it, but either of the above two suggestions would work.

    Comment


    • #3
      Thanks for the suggestion. I used the pileup method in Perl and it worked fine.

      Comment

      Latest Articles

      Collapse

      • seqadmin
        Advanced Methods for the Detection of Infectious Disease
        by seqadmin




        The recent pandemic caused worldwide health, economic, and social disruptions with its reverberations still felt today. A key takeaway from this event is the need for accurate and accessible tools for detecting and tracking infectious diseases. Timely identification is essential for early intervention, managing outbreaks, and preventing their spread. This article reviews several valuable tools employed in the detection and surveillance of infectious diseases.
        ...
        Yesterday, 01:15 PM
      • seqadmin
        Strategies for Investigating the Microbiome
        by seqadmin




        Microbiome research has led to the discovery of important connections to human and environmental health. Sequencing has become a core investigational tool in microbiome research, a subject that we covered during a recent webinar. Our expert speakers shared a number of advancements including improved experimental workflows, research involving transmission dynamics, and invaluable analysis resources. This article recaps their informative presentations, offering insights...
        11-09-2023, 07:02 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by seqadmin, Yesterday, 08:12 AM
      0 responses
      14 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 11-22-2023, 09:29 AM
      1 response
      46 views
      0 likes
      Last Post VilliamPast  
      Started by seqadmin, 11-22-2023, 08:53 AM
      0 responses
      30 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 11-21-2023, 08:24 AM
      0 responses
      23 views
      0 likes
      Last Post seqadmin  
      Working...
      X