Question: Cuffdiff Says Sam Isn'T Sorted, Although It Handled It Cufflinks
0
gravatar for Rubellus
7.0 years ago by
Rubellus10
Rubellus10 wrote:

Hi all, I'm having an issue with cufflinks in that I can get through cufflinks with a de novo, but am halted here:

cuffdiff -o diffout -b annolrubtran.fasta -p 20 -L 0mg,36mg,125mg -u cuffcmp.combined.gtf ./tophat008paired/acceptedhits.sam.sorted ./tophat009paired/acceptedhits.sam.sorted ./tophat010paired/acceptedhits.sam.sorted You are using Cufflinks v1.3.0, which is the most recent release. [bamheaderread] EOF marker is absent. [bamheaderread] invalid BAM binary header (this is not a BAM file). File ./tophat008paired/acceptedhits.sam.sorted doesn't appear to be a valid BAM file, trying SAM... [bamheaderread] EOF marker is absent. [bamheaderread] invalid BAM binary header (this is not a BAM file). File ./tophat009paired/acceptedhits.sam.sorted doesn't appear to be a valid BAM file, trying SAM... [bamheaderread] EOF marker is absent. [bamheaderread] invalid BAM binary header (this is not a BAM file). File ./tophat010paired/accepted_hits.sam.sorted doesn't appear to be a valid BAM file, trying SAM... [19:24:38] Loading reference annotation and sequence. [19:25:40] Inspecting maps and determining fragment length distributions.

Error: this SAM file doesn't appear to be correctly sorted! current hit is at Contig10010|nucleolin-:26, last one was at Contig1000|---NA---:198 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.

I've prviouisly converted the tophat output into a .sam before sorting:

samtools view -h -o acceptedhits.sam acceptedhits.bam

sort -k 3,3 -k 4,4n acceptedhits.sam > acceptedhits.sam.sorted

This feeds into cufflinks alright, but stops as above when shuttled into cuffdiff. If anyone could offer me a suggestion, I'd thoroughly appreciate it!!

ADD COMMENTlink modified 7.0 years ago by Arun2.3k • written 7.0 years ago by Rubellus10
1
gravatar for Vikas Bansal
7.0 years ago by
Vikas Bansal2.3k
Berlin, Germany
Vikas Bansal2.3k wrote:

You should sort your bam file (accepted_hits.bam) using samtools. Use

samtools sort accepted_hits.bam  accepted_hits_sorted

This will give you accepted_hits_sorted.bam file in your directory and Cufflinks do accept bam file, so there will be no need of converting it into sam.

Also if you have used TopHat, then your file is already sorted. So it is ready to use for Cufflinks.

EDIT

If A.bam is the problem file, then [?]samtools view -H A.bam > header.sam samtools reheader header.sam A.bam > B.bam[?]

Source

ADD COMMENTlink modified 7.0 years ago • written 7.0 years ago by Vikas Bansal2.3k
1

Reheading didn't work, but I've altered hits.cpp and will get our dude to make install in the morning. Thanks for your help!

cufflinks -p 20 -o 36mg rehead.bam [20:23:19] Inspecting reads and determining fragment length distribution.

Processed 0 loci. [*******] 100% Map Properties: Total Map Mass: 0.00 Fragment Length Distribution: Truncated Gaussian (default) Default Mean: 200 Default Std Dev: 80 [20:23:19] Assembling transcripts and estimating abundances. Processed 0 loci. [*******] 100%

ADD REPLYlink written 7.0 years ago by Rubellus10

Did you solve the problem after you altered hits.cpp file?I meet the same error thanks

ADD REPLYlink written 6.1 years ago by wangxjem0

Hi, I am getting the same error. What should I alter in hits.cpp file?

ADD REPLYlink written 19 months ago by mail2steff50

It starts to give me hassles as here: http://biostar.stackexchange.com/questions/14985/struggling-with-cufflinks-into-cuffmerge when I put the .bam files in. Is there a faster work-around without changing the hitts.cpp? (I don't have permissions and am working off site).

ADD REPLYlink written 7.0 years ago by Rubellus10

I just found something here (http://seqanswers.com/forums/showthread.php?t=15751). If you got error about BAM header is big, then try reheader with samtools. See my edit.

ADD REPLYlink written 7.0 years ago by Vikas Bansal2.3k
0
gravatar for Swbarnes2
7.0 years ago by
Swbarnes21.4k
Swbarnes21.4k wrote:

It doesn't think you have a .bam file. That's a bigger problem than the lack of sorting.

ADD COMMENTlink written 7.0 years ago by Swbarnes21.4k
0
gravatar for Arun
7.0 years ago by
Arun2.3k
Germany
Arun2.3k wrote:

Your problem seems to be in the creation of BAM from SAM file. The best way to convert a SAM to BAM file is to use picard tools SamFormatConverter as:

java -jar SamFormatConverter.jar I=input.sam O=output.bam

If you want to sort a SAM file by coordinate and convert it to bam all at the same time, you could use MergeSamFiles with just 1 input as:

java -jar MergeSamFiles.jar I=input.sam O=output.bam SO=coordinate AS=false USE_THREADING=true TMP_DIR=<Path_to_TEMP_dir>
ADD COMMENTlink written 7.0 years ago by Arun2.3k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1164 users visited in the last hour