Using inspiration from this thread HISAT2 output direct to bam, I'm attempting to run this command. The shell variables in this case represent paths to files/locations that make sense and in fact this command runs fine on my Ubuntu 18.04 LTS server using hisat 2.1 and samtools 1.10 (this seems quite old, I should update). It appears to correctly output a sorted bam and index from some paired end reads.
hisat2 -x $INDEX -1 $PAIR1 -2 $PAIR2 -p 16 --no-unal --new-summary --no-mixed --no-discordant | \
samtools sort -T $TMP -O BAM |
tee $BAM | \
samtools index - $BAM.bai
When I try to run this on our computer cluster (having hisat 2.2.1, samtools 1.3.1, uses SLURM), the same command gives me an error for samtools
index: invalid option -- '-'
As well as one for hisat2
Error: Must specify at least one read input with -U/-1/-2/--sra-acc
(ERR): hisat2-align exited with value 1
I'm quite certain this is not a path issue, all input files and dirs exist. I think if anything, it might have to do with the way I'm running the slurm script which is that I have a file where each line is a set of options for hisat2 (imagine the variables in the above command change for each sample name) and I make an array out of them while assigning a SLURM array ID like this
LINE=$(sed -n "$SLURM_ARRAY_TASK_ID"p hisat2_options.txt)
Then execute like so
hisat2 $LINE
This works just fine if I just make sam files and separately convert to bam and index but I want to do it in one shot. Somehow, I think all the piping and tee
is making the command not get read correctly. I thought doing "$LINE"
might work but it does not, it does give a different error at least.
Error: reads file does not look like a FASTQ file
terminate called after throwing an instance of 'int'
It looks like a fastq file to me. If anyone can see something obvious that'd be great.
samtools 1.3.1 is a lot older than samtools 1.10
Yeah... Perhaps I'm blind, maybe the version is the problem. I'll play around with the versions.