Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • paired-end, bam-file-format

    1.) Having a bam-file of paired-end data, how can I find out what the pairs are? I.e. which sequence is the start and which one the end of which pair?

    2.) If I only want the 5-prime end of each pair: how can I remove all the downstream pairs?

    Thanks!

  • #2
    Look at the FLAG bit field.

    Comment


    • #3
      Originally posted by maubp View Post
      Look at the FLAG bit field.
      Code:
      0x1 template having multiple fragments in sequencing
      0x2 each fragment properly aligned according to the aligner
      0x4 fragment unmapped
      0x8 next fragment in the template unmapped
      0x10 SEQ being reverse complemented
      0x20 SEQ of the next fragment in the template being reversed
      0x40 the rst fragment in the template
      0x80 the last fragment in the template
      0x100 secondary alignment
      0x200 not passing quality controls
      0x400 PCR or optical duplicate
      I do not understand the semantics of this and anyway I guess it's a little bit hard working with the bam-files directly anyway. I mean how are you supposed to look at the bit-field, with a hex-editor?!

      Is there an easier way? For example, can't I convert to bed-format, so that the paired-end information is retained? I tried bamToBed, but there as well I don't see how the pairs are matched. I also tried "view" from samtools.

      Comment


      • #4
        Try samtools view with -X to explain the flags.

        Comment


        • #5
          Use Pysam in Python!

          You can use Pysam in Python.

          First, you have to install this library.

          After that, you have to type the following code:
          ====================================

          import pysam
          samfile = pysam.Samfile("ex1.bam", "rb")
          pairedreads = pysam.Samfile("allpaired.bam", "wb", template=samfile)
          for read in samfile.fetch():
          if read.is_paired:
          pairedreads.write(read)

          pairedreads.close()
          samfile.close()
          =====================================

          This code is from: http://wwwfgu.anat.ox.ac.uk/~andreas...tools/api.html

          There, you can read more about it.

          The function read.is_paired looks, if a read is a paired-end read or a single read.

          I hope this helps you...

          Comment

          Latest Articles

          Collapse

          • seqadmin
            Current Approaches to Protein Sequencing
            by seqadmin


            Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
            04-04-2024, 04:25 PM
          • seqadmin
            Strategies for Sequencing Challenging Samples
            by seqadmin


            Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
            03-22-2024, 06:39 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by seqadmin, 04-11-2024, 12:08 PM
          0 responses
          18 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-10-2024, 10:19 PM
          0 responses
          22 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-10-2024, 09:21 AM
          0 responses
          16 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-04-2024, 09:00 AM
          0 responses
          47 views
          0 likes
          Last Post seqadmin  
          Working...
          X