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 10:58 AM
error message with samtools converting pileup to vcf kym Bioinformatics 1 07-21-2011 12:43 AM
Samtools view michalkovac Bioinformatics 2 07-19-2011 06:25 AM
samtools view error after reheader Hkins552 Bioinformatics 3 07-17-2011 11:32 AM
samtools view error: CIGAR and sequence length are inconsistent (tophat/bowtie) glacierbird Bioinformatics 2 06-29-2010 02:58 AM

Reply
 
Thread Tools
Old 06-07-2010, 12:54 PM   #1
Jan
Junior Member
 
Location: Phoenix, AZ

Join Date: May 2009
Posts: 6
Default Samtools view error message

I am attempting to generate a bam file with just chromosome 12 from my larger whole genome bam file. I entered the following code and got the following error message:

samtools view -b myfile.bam chr12 > myfile_chr12.bam
[main_samview] fail to get the reference name. Continue anyway.

I then tried adding in the -f command with the fai file of my reference thinking I need to have the fai file and got the same error message.

Have I used this command incorrectly? How can I remedy this problem?
Jan is offline   Reply With Quote
Old 06-07-2010, 01:38 PM   #2
nilshomer
Nils Homer
 
nilshomer's Avatar
 
Location: Boston, MA, USA

Join Date: Nov 2008
Posts: 1,285
Default

Quote:
Originally Posted by Jan View Post
I am attempting to generate a bam file with just chromosome 12 from my larger whole genome bam file. I entered the following code and got the following error message:

samtools view -b myfile.bam chr12 > myfile_chr12.bam
[main_samview] fail to get the reference name. Continue anyway.

I then tried adding in the -f command with the fai file of my reference thinking I need to have the fai file and got the same error message.

Have I used this command incorrectly? How can I remedy this problem?
What is the output of "samtools view -H myfile.bam"? Chromosome 12 should be in the header.
nilshomer is offline   Reply With Quote
Old 06-07-2010, 02:22 PM   #3
Jan
Junior Member
 
Location: Phoenix, AZ

Join Date: May 2009
Posts: 6
Default Tried the view -H

Here is the first bit of output that looked most relevant although I don't understand what it means (I'm a biologist by training so the learning curve is steep right now). Should I be typing "12" instead of chr12? Thanks!
@HD VN:0.1.2 SO:unsorted GO:none
@SQ SN:1 LN:247249719
@SQ SN:2 LN:242951149
@SQ SN:3 LN:199501827
@SQ SN:4 LN:191273063
@SQ SN:5 LN:180857866
@SQ SN:6 LN:170899992
@SQ SN:7 LN:158821424
@SQ SN:8 LN:146274826
@SQ SN:9 LN:140273252
@SQ SN:10 LN:135374737
@SQ SN:11 LN:134452384
@SQ SN:12 LN:132349534
@SQ SN:13 LN:114142980
@SQ SN:14 LN:106368585
@SQ SN:15 LN:100338915
@SQ SN:16 LN:88827254
@SQ SN:17 LN:78774742
@SQ SN:18 LN:76117153
@SQ SN:19 LN:63811651
@SQ SN:20 LN:62435964
@SQ SN:21 LN:46944323
@SQ SN:22 LN:49691432
@SQ SN:X LN:154913754
@SQ SN:Y LN:57772954
@SQ SN:MT LN:16571
@SQ SN:NT_113887 LN:3994
@SQ SN:NT_113947 LN:4262
@SQ SN:NT_113903 LN:12854
@SQ SN:NT_113908 LN:13036
@SQ SN:NT_113940 LN:19187
@SQ SN:NT_113917 LN:19840
@SQ SN:NT_113963 LN:24360
Jan is offline   Reply With Quote
Old 06-07-2010, 02:37 PM   #4
nilshomer
Nils Homer
 
nilshomer's Avatar
 
Location: Boston, MA, USA

Join Date: Nov 2008
Posts: 1,285
Default

Quote:
Originally Posted by Jan View Post
Here is the first bit of output that looked most relevant although I don't understand what it means (I'm a biologist by training so the learning curve is steep right now). Should I be typing "12" instead of chr12? Thanks!
@HD VN:0.1.2 SO:unsorted GO:none
@SQ SN:1 LN:247249719
@SQ SN:2 LN:242951149
@SQ SN:3 LN:199501827
@SQ SN:4 LN:191273063
@SQ SN:5 LN:180857866
@SQ SN:6 LN:170899992
@SQ SN:7 LN:158821424
@SQ SN:8 LN:146274826
@SQ SN:9 LN:140273252
@SQ SN:10 LN:135374737
@SQ SN:11 LN:134452384
@SQ SN:12 LN:132349534
@SQ SN:13 LN:114142980
@SQ SN:14 LN:106368585
@SQ SN:15 LN:100338915
@SQ SN:16 LN:88827254
@SQ SN:17 LN:78774742
@SQ SN:18 LN:76117153
@SQ SN:19 LN:63811651
@SQ SN:20 LN:62435964
@SQ SN:21 LN:46944323
@SQ SN:22 LN:49691432
@SQ SN:X LN:154913754
@SQ SN:Y LN:57772954
@SQ SN:MT LN:16571
@SQ SN:NT_113887 LN:3994
@SQ SN:NT_113947 LN:4262
@SQ SN:NT_113903 LN:12854
@SQ SN:NT_113908 LN:13036
@SQ SN:NT_113940 LN:19187
@SQ SN:NT_113917 LN:19840
@SQ SN:NT_113963 LN:24360
Type "12" instead of "chr12". It looks like your FASTA reference had chromsome 12 named "12" instead of "chr12" (1000 Genomes reference? ).
nilshomer is offline   Reply With Quote
Old 06-07-2010, 03:45 PM   #5
Jan
Junior Member
 
Location: Phoenix, AZ

Join Date: May 2009
Posts: 6
Default Thanks!

That did it! Now I know to run -H to check the header to avoid this problem in the future. Thank you!
Jan is offline   Reply With Quote
Reply

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 09:03 PM.


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