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
            Addressing Off-Target Effects in CRISPR Technologies
            by seqadmin






            The first FDA-approved CRISPR-based therapy marked the transition of therapeutic gene editing from a dream to reality1. CRISPR technologies have streamlined gene editing, and CRISPR screens have become an important approach for identifying genes involved in disease processes2. This technique introduces targeted mutations across numerous genes, enabling large-scale identification of gene functions, interactions, and pathways3. Identifying the full range...
            08-27-2024, 04:44 AM
          • seqadmin
            Selecting and Optimizing mRNA Library Preparations
            by seqadmin



            Sequencing mRNA provides a snapshot of cellular activity, allowing researchers to study the dynamics of cellular processes, compare gene expression across different tissue types, and gain insights into the mechanisms of complex diseases. “mRNA’s central role in the dogma of molecular biology makes it a logical and relevant focus for transcriptomic studies,” stated Sebastian Aguilar Pierlé, Ph.D., Application Development Lead at Inorevia. “One of the major hurdles for...
            08-07-2024, 12:11 PM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by seqadmin, 08-27-2024, 04:40 AM
          0 responses
          16 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 08-22-2024, 05:00 AM
          0 responses
          293 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 08-21-2024, 10:49 AM
          0 responses
          135 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 08-19-2024, 05:12 AM
          0 responses
          124 views
          0 likes
          Last Post seqadmin  
          Working...
          X