This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Samtools software error

Dear all,

When I did the RNA seq analysis using the "STAR-SAMTOOLS-HTSEQ" pipeline, I meet an error in the samtools step. Here is my script:

module load samtools
samtools sort -n -T /home/chan7_1_test/tmp/ -o /home/chan7_1_test/chan7_1_aftersort /home/chan7_1_test/chan711_mappedAligned.out.bam

it runs pretty good for some of my samples, but for several samples, it report an error:

[E::bam_read1] CIGAR and query sequence lengths differ for GWNJ-0850:425:GW1812271727:1:1122:23054:8657
samtools sort: truncated file. Aborting

I searched internet but it still error report and haven't been resolved. Will be really appreciated if you could give some advices. Thank you!!

rna-seq

Hi, it is this version : samtools/gcc/5.3.0/1.6

Please run samtools --version and paste the output here.

Hi, it is this:

samtools 1.6
Using htslib 1.6
Copyright (C) 2017 Genome Research Ltd.

So it maybe samtools 1.6 ?

Thank you!

Yes, it is. Please use the formatting bar (especially the code option) to present your post better. You can use backticks for inline code (`text` becomes text), or select a chunk of text and use the highlighted button to format it as a code block. I've done it for you this time.
code_formatting

WIll do! thank u. and any suggestions for the error...

I don't think it's a bug with samtools (anyway, you should update it) but rather with STAR. What's the version of star

Hi, the version of star is star/2.6.0 and no error report when using star...

1 answer

star/2.6.0

update to 2.7.0

Furthermore, it looks like it's a known problem: https://github.com/alexdobin/STAR/issues/530#issuecomment-444913496

A few things I would suggest:

Run with the precompiled executables from bin/Linux_x86_64 and bin/Linux_x86_64_static, or compile your own with
$ cd source && make
Change the number of threads from 8 to 4.
Cut a few thousands reads around the problematic read and run mapping.
  

If the problem still occurs for the same read, I would need a sample of your data to reproduce the problem on my system.

Thanks for your kindly reply! But I am not sure what is Run with the precompiled executables from bin/Linux_x86_64 and bin/Linux_x86_64_static, or compile your own with $ cd source && make

if it is a command or something else....

Here is my script for STAR (I will update it to 2.7.0 later..)

  1. index

STAR --runMode genomeGenerate --runThreadN 16 --genomeDir /home/STAR2/star_index/ --genomeFastaFiles /home/00166062_genome.fna --sjdbGTFfile /home/GCF_0016606_genomic.gtf --sjdbOverhang 149 --sjdbGTFfeatureExon CDS

  1. map

STAR --runThreadN 1 --genomeDir /home/star_index/ --readFilesIn /home/Chan7-1_R1_left_paired_trimmed.fq /home/Chan7-1_R2_right_paired_trimmed.fq --outFileNamePrefix /home/chan711_mapped --limitOutSJcollapsed 5000000 --limitIObufferSize 300000000 --outSAMtype BAM Unsorted --limitBAMsortRAM 87162435271

Log in to answer this question.