Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • Martino
    replied
    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...

    Leave a comment:


  • maubp
    replied
    Try samtools view with -X to explain the flags.

    Leave a comment:


  • Azazel
    replied
    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.

    Leave a comment:


  • maubp
    replied
    Look at the FLAG bit field.

    Leave a comment:


  • Azazel
    started a topic paired-end, bam-file-format

    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!

Latest Articles

Collapse

  • seqadmin
    Exploring the Dynamics of the Tumor Microenvironment
    by seqadmin




    The complexity of cancer is clearly demonstrated in the diverse ecosystem of the tumor microenvironment (TME). The TME is made up of numerous cell types and its development begins with the changes that happen during oncogenesis. “Genomic mutations, copy number changes, epigenetic alterations, and alternative gene expression occur to varying degrees within the affected tumor cells,” explained Andrea O’Hara, Ph.D., Strategic Technical Specialist at Azenta. “As...
    07-08-2024, 03:19 PM
  • seqadmin
    Exploring Human Diversity Through Large-Scale Omics
    by seqadmin


    In 2003, researchers from the Human Genome Project (HGP) announced the most comprehensive genome to date1. Although the genome wasn’t fully completed until nearly 20 years later2, numerous large-scale projects, such as the International HapMap Project and 1000 Genomes Project, continued the HGP's work, capturing extensive variation and genomic diversity within humans. Recently, newer initiatives have significantly increased in scale and expanded beyond genomics, offering a more detailed...
    06-25-2024, 06:43 AM

ad_right_rmr

Collapse

News

Collapse

Topics Statistics Last Post
Started by seqadmin, Yesterday, 05:49 AM
0 responses
13 views
0 likes
Last Post seqadmin  
Started by seqadmin, 07-15-2024, 06:53 AM
0 responses
24 views
0 likes
Last Post seqadmin  
Started by seqadmin, 07-10-2024, 07:30 AM
0 responses
37 views
0 likes
Last Post seqadmin  
Started by seqadmin, 07-03-2024, 09:45 AM
0 responses
204 views
0 likes
Last Post seqadmin  
Working...
X