Go Back   SEQanswers > Bioinformatics > Bioinformatics

Similar Threads
Thread Thread Starter Forum Replies Last Post
sorting bam files frymor Bioinformatics 23 02-10-2016 05:46 PM
Cufflinks sorting Error nr23 RNA Sequencing 3 05-07-2013 01:32 AM
cuffdiff error, issues with bam sorting rhcr56 Bioinformatics 1 10-18-2012 11:21 AM
NEw to Chip-seq and have .bam/.sam/.bam.bai files... then what? NGS newbie Bioinformatics 11 05-25-2011 07:48 AM
Problem with sam files created by bfast Fabrice ODEFREY Bioinformatics 2 09-22-2010 09:40 PM

Thread Tools
Old 06-24-2013, 12:49 PM   #1
Junior Member
Location: Calgary

Join Date: May 2013
Posts: 2
Default Cufflinks refuses to operate on Tophat2 created bam or sam files due to sorting error

Hi there,

I have really had alot of trouble over the last couple weeks trying to get either Cufflinks 2.0 and 2.1 to accept Tophat 2 (latest version) 'accepted_hits.bam(and sam) files. I repeatedly get sorting errors of many natures. I have read about 10 threads on similar problems but nothing seems to solve my sorting problem. If I include the annotation in the Cufflinks runs, the runs do not work and give me this error:

cufflinks -p 24 -o ./TrueTophat2output/ABZ_3497_lax_nofilter/cufflinks/ -g ./Hc_genome/Hc_rztk_1+2+8+9.augustus.gtf ./TrueTophat2output/ABZ_3920_lax_nofilter/accepted_hits.sam
Warning: Your version of Cufflinks is not up-to-date. It is recommended that you upgrade to Cufflinks v2.1.1 to benefit from the most recent features and bug fixes (
[bam_header_read] EOF marker is absent.
[bam_header_read] invalid BAM binary header (this is not a BAM file).
File ./TrueTophat2output/ABZ_3920_lax_nofilter/accepted_hits doesn't appear to be a valid BAM file, trying SAM...
[14:33:19] Loading reference annotation.
[14:33:20] Inspecting reads and determining fragment length distribution.
> Processing Locus scaffold100.1_size305125:90 [************************ ] 99%
Error: this SAM file doesn't appear to be correctly sorted!
current hit is at scaffold1000.1_size94939:19257, last one was at scaffold100.1_size305125:90495-305068:213981
Cufflinks requires that if your file has SQ records in
the SAM header that they appear in the same order as the chromosomes names
in the alignments.
If there are no SQ records in the header, or if the header is missing,
the alignments must be sorted lexicographically by chromsome
name and by position.

If I do not include the annotation file the cufflinks runs work, but I get the sorting error when I run Cuffmerge in all cases. ie even when I exclude the reference genome and the reference annotation from the Cuffmerge command. Ex:

Error: sort order of reads in BAMs must be the same
Error: could not execute cufflinks

So it appears that the accepted hits files are at their core inproperly sorted. And it appears I dont have a clue how to get them sorted properly. Here is how my .sam files look, this is the first entry, note that I dont have headers:

IL17_3497:1:19:1189:1264 99 scaffold1.1_size947603 31379 50 76M = 31436 748 ATGAGGCTGTAATGGATGGATGAGTGCAGGGTGCATTTCTTTTCGATGAACCGTATATTCGATGATGCCAAGTTTT AA?@@AA@?>>>@???@?<<??<?9=>>>@@?A=1>A@@@AA@?===>=?<=?>?>>@A@:6<<?;==>>8>=<=> AS:i:0 XN:i:0 XM:i:0 XO:i:0 XG:i:0 NM:i:0 MD:Z:76 YT:Z:UU NH:i:1

I have no headers in these files, and my genome, and therefore my accecpted_hits.sam files, are aligned on ~25000 scaffolds, or chromosomes, whatever you would like to call them (it is a very fragmented genome N50 83000). So this problem can't be identified and solved manually unfortunately. But yet there still must be a way to get these sam files organized by location (scaffold) properly. Any guidance would be very greatly appreciated.

Honestly as of right now I think that if I can sort the .sam files as well as my annotation file by location (ie scaffold1.1_size947603, and so on), I'm hoping that this would solve this problem. Does anyone agree with this? If so, do you know how I might easily sort the .sam file locations lexicographically? As well as a .gtf annotation file? If not please give me your thoughts on what might actually solve this problem.

Thank you very much for your input.

amrezans is offline   Reply With Quote
Old 06-24-2013, 12:54 PM   #2
PhD Student
Location: Denmark

Join Date: Jul 2012
Posts: 164

Look for picard SortSam module.
vivek_ is offline   Reply With Quote

cufflinks, error, sam bam, sorting, tophat 2.0.1

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 01:05 AM.

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