SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fastq format and Paired-end reads sandhya Bioinformatics 10 07-03-2013 04:24 AM
The best output format for paired-end alignment using bowtie chedonat Bioinformatics 4 02-01-2012 01:03 PM
Paired-end Bam from single-end aligned sam ramouz87 Bioinformatics 4 08-17-2011 12:55 PM
Filter paired end BAM file based on iSize Leif Bergsagel Bioinformatics 2 12-16-2010 11:50 AM
paired end fastq format in bwa Protaeus Bioinformatics 4 12-09-2010 02:28 PM

Reply
 
Thread Tools
Old 02-22-2011, 09:20 PM   #1
Azazel
Member
 
Location: Japan

Join Date: Oct 2010
Posts: 52
Default 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!
Azazel is offline   Reply With Quote
Old 02-23-2011, 01:22 AM   #2
maubp
Peter (Biopython etc)
 
Location: Dundee, Scotland, UK

Join Date: Jul 2009
Posts: 1,543
Default

Look at the FLAG bit field.
maubp is offline   Reply With Quote
Old 02-23-2011, 01:37 AM   #3
Azazel
Member
 
Location: Japan

Join Date: Oct 2010
Posts: 52
Default

Quote:
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.
Azazel is offline   Reply With Quote
Old 02-23-2011, 02:22 AM   #4
maubp
Peter (Biopython etc)
 
Location: Dundee, Scotland, UK

Join Date: Jul 2009
Posts: 1,543
Default

Try samtools view with -X to explain the flags.
maubp is offline   Reply With Quote
Old 06-27-2012, 11:09 PM   #5
Martino
Member
 
Location: Netherlands

Join Date: Apr 2011
Posts: 15
Default 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...
Martino is offline   Reply With Quote
Reply

Tags
bam, paired-end

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 05:01 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO