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
            Genetic Variation in Immunogenetics and Antibody Diversity
            by seqadmin



            The field of immunogenetics explores how genetic variations influence immune responses and susceptibility to disease. In a recent SEQanswers webinar, Oscar Rodriguez, Ph.D., Postdoctoral Researcher at the University of Louisville, and Ruben Martínez Barricarte, Ph.D., Assistant Professor of Medicine at Vanderbilt University, shared recent advancements in immunogenetics. This article discusses their research on genetic variation in antibody loci, antibody production processes,...
            11-06-2024, 07:24 PM
          • seqadmin
            Choosing Between NGS and qPCR
            by seqadmin



            Next-generation sequencing (NGS) and quantitative polymerase chain reaction (qPCR) are essential techniques for investigating the genome, transcriptome, and epigenome. In many cases, choosing the appropriate technique is straightforward, but in others, it can be more challenging to determine the most effective option. A simple distinction is that smaller, more focused projects are typically better suited for qPCR, while larger, more complex datasets benefit from NGS. However,...
            10-18-2024, 07:11 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by seqadmin, Today, 11:09 AM
          0 responses
          23 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, Today, 06:13 AM
          0 responses
          20 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 11-01-2024, 06:09 AM
          0 responses
          30 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 10-30-2024, 05:31 AM
          0 responses
          21 views
          0 likes
          Last Post seqadmin  
          Working...
          X