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
            Best Practices for Single-Cell Sequencing Analysis
            by seqadmin



            While isolating and preparing single cells for sequencing was historically the bottleneck, recent technological advancements have shifted the challenge to data analysis. This highlights the rapidly evolving nature of single-cell sequencing. The inherent complexity of single-cell analysis has intensified with the surge in data volume and the incorporation of diverse and more complex datasets. This article explores the challenges in analysis, examines common pitfalls, offers...
            06-06-2024, 07:15 AM
          • seqadmin
            Latest Developments in Precision Medicine
            by seqadmin



            Technological advances have led to drastic improvements in the field of precision medicine, enabling more personalized approaches to treatment. This article explores four leading groups that are overcoming many of the challenges of genomic profiling and precision medicine through their innovative platforms and technologies.

            Somatic Genomics
            “We have such a tremendous amount of genetic diversity that exists within each of us, and not just between us as individuals,”...
            05-24-2024, 01:16 PM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by seqadmin, Today, 07:24 AM
          0 responses
          9 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, Yesterday, 08:58 AM
          0 responses
          11 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 06-12-2024, 02:20 PM
          0 responses
          15 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 06-07-2024, 06:58 AM
          0 responses
          182 views
          0 likes
          Last Post seqadmin  
          Working...
          X