SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
samtools view without header Gen2007 Bioinformatics 4 11-16-2011 09:58 AM
Question about samtools view -r? syedsaid Bioinformatics 0 09-29-2011 02:00 AM
Samtools view michalkovac Bioinformatics 2 07-19-2011 05:25 AM
samtools view error after reheader Hkins552 Bioinformatics 3 07-17-2011 10:32 AM
Duplicates in samtools view when using ranges jdrum00 Bioinformatics 5 12-17-2009 11:48 AM

Reply
 
Thread Tools
Old 04-26-2012, 07:38 PM   #1
seq_lover
Member
 
Location: Memphis

Join Date: Oct 2011
Posts: 18
Default samtools view

Hi,

I am using samtools view -f option to output mate-pair reads that are properly placed in pair in the bam file.

My command is as follows: (67,131- first read, second read and 115,179 first , second mapped to reverse complement)

samtools view -b -f 67 -f 131 -f 179 -f 115 old.bam > new.bam

But in the new.bam file all i get are the reads with -f 115 flag. I assume that you can't use more than one flag for the view command and that's why the last flag overrules the other flag.

I can write four samtools view commands , each for one of the flag and merge the bam files but is there any proper or one step way to accomplish the same.
Also, is merging the right thing to do ?

Thanks.
seq_lover is offline   Reply With Quote
Old 04-26-2012, 07:53 PM   #2
seq_lover
Member
 
Location: Memphis

Join Date: Oct 2011
Posts: 18
Default

Hey I figured it out myself:

The following commands works:
samtools view -b -f 67,131,179,115 old.bam > new.bam

I am sorry for not giving this enough try before posting. I will not delete the post as it may help someone stupid like me in future.
seq_lover is offline   Reply With Quote
Old 04-27-2012, 11:22 AM   #3
seq_lover
Member
 
Location: Memphis

Join Date: Oct 2011
Posts: 18
Default Hey I thought I found the solution but I was wrong

Hi,

I am using the following samtool view command to output the information about properly placed mate pairs (solid) in the output bam file.

samtools view -b -f 67,131,179,115 old.bam > new.bam

-f 67 and -f 115 correspond to first read in the mate pairs that are properly placed on forward strand and reverse strand respectively.

-f 131 and -f 179 correspond to second read in the mate pairs that are properly placed on forward strand and reverse strand respectively.

Somehow in the new.bam file I am only getting reads with -f 115 and -f 67 flags (first read in the mate pair). The reads for -f 131 and -f 179 flags are totally missing (second read in the mate pair). When I run samtool flagstat I get something like:

71398431 + 0 read1
0 + 0 read2

Can someone help me with this ? I need both first and second reads of the mate-pair in the output file.

Thanks.
seq_lover is offline   Reply With Quote
Reply

Tags
samtools, view option

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 02:11 PM.


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