Hi,
I am processing ChIP sequencing data. I mapped FASTQ files using Bowtie2 then I tried to convert sam files to bam files, then sort and index the files using samtools. When I try to sort the bam files, gibberish letters show up and crash in the middle. I have total four files but I got the same error in all four files (all files were downloaded from publicly available data). I used samtools 1.2 this time(server in my university installed samtools1.2), I also used samtools 1.12 on the laptop computer, the same error occurred.
The code I used was:
for i in *.sam
do
samtools view -b -S $i -o $i.bam
samtools sort $i.bam -o $i.sorted.bam
samtools index $i.sorted.bam
done
I also tried:
for i in *.sam
do
samtools sort $i -o $i.sorted.bam
samtools index $i.sorted.bam
done
but the same result.
These codes worked in the past, and I could not figure out where the problem is.
for i in *.sam
you should learn about
make
and about workflow managers (nextflow, snakemake....)is there any space in the filenames ? protect the filenames with quotes:
Thank you for your reply.
I got error message saying
What version of samtools are you using?
1.2
according to original post. So older.yomogy : Latest version is 1.16. It may feel odd but 1.2 is not the latest. It goes 1.1, 1.2,1.3 and so on.
add an
echo
in front of eachsamtools
command, then send us the resulting outputPS. if you have only four samples, just run them manually :-) or add the commands to a text file manually
then run
see if they crashes that way as well