SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error with GTF file when using htseq-count MDonlin Bioinformatics 13 01-13-2015 08:29 AM
Problems with htseq-count reading bam file created by STAR priya RNA Sequencing 3 06-01-2013 11:32 PM
HTseq Error occured:'need more than 10 values to unpack' in line of sam file Tuinhof RNA Sequencing 0 05-30-2013 05:19 AM
Do I need to sort and index a bam file? ejfuchs Bioinformatics 4 08-21-2012 12:53 AM
Local Blast Error of index file Shani Bioinformatics 0 02-12-2011 01:45 AM

Reply
 
Thread Tools
Old 10-08-2013, 08:51 PM   #1
JIrish
Junior Member
 
Location: Charleston/Detroit

Join Date: Jul 2012
Posts: 8
Default HTSeq.BAM_Reader error: .bam-file has no index ...

I'm running into a problem with HTSeq that I can't seem to solve on my own:

As running through the entire bam file to find alignments corresponding to a genomic position (from a gtf file) works, but takes a long time, I'm trying to use the indexed random access approach. Code is identical (except filenames and window postitions) to the docs tutorial for HTSeq, and my input file is a coordinate-sorted bam file with index file of the same name (but with .bai extension of course) in same folder as sorted bam file. Bam file was sorted with Picard Tools if that matters. After attempting to run the code below, I get the following error:

sortedbam = \
HTSeq.BAM_Reader("729_GCCAAT_L007_R1_001_trimmed.sorted.bam")
for alnmt in sortedbam[ window ]:
print alnmt

ERROR: ValueError: The .bam-file has no index, random-access is disabled!

The index filename is 729_GCCAAT_L007_R1_001_trimmed.sorted.bai

I'm stumped.

For what it's worth, htseq_count and dexseq_count both work fine (obviously fewer chances to screw something up passing arguments to a script but I wanted to mention it).
JIrish is offline   Reply With Quote
Old 10-09-2013, 01:19 AM   #2
dpryan
Devon Ryan
 
Location: Freiburg, Germany

Join Date: Jul 2011
Posts: 3,480
Default

Try renaming the index to 729_GCCAAT_L007_R1_001_trimmed.sorted.bam.bai
dpryan is offline   Reply With Quote
Old 10-09-2013, 09:23 AM   #3
JIrish
Junior Member
 
Location: Charleston/Detroit

Join Date: Jul 2012
Posts: 8
Default

Worked beautifully, thank you.

Any idea why that filename format is assumed? Is there a standard for naming bam index files?
JIrish is offline   Reply With Quote
Old 10-09-2013, 09:32 AM   #4
dpryan
Devon Ryan
 
Location: Freiburg, Germany

Join Date: Jul 2011
Posts: 3,480
Default

Well, if you just
Code:
samtools index blah.bam
then the index file will be automatically named "blah.bam.bai". Generally, whatever samtools does is the standard
dpryan is offline   Reply With Quote
Old 10-09-2013, 09:35 AM   #5
JIrish
Junior Member
 
Location: Charleston/Detroit

Join Date: Jul 2012
Posts: 8
Default

Fair enough. Thanks again for your help.
JIrish is offline   Reply With Quote
Reply

Tags
.bai, bam_reader, htseq, index

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


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