This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Samtools faidx not printing reverse complement

I'm struggling to get samtools faidx to print the reverse complement of sequences: I believe the -i option should do the trick, but I keep getting an error message. I think it is trying to find "-i" in the fasta.

Command:

samtools faidx ./file_1.fasta MHLFILTNLILPAFEDLAQG -i

Output:

>MHLFILTNLILPAFEDLAQG
TCAGTCTGCAACTCCAAATACTTCAAGCGCATCTGGACCGCCGTGGAGTTCATCAGAAGT
GAGCGTGTCAGAATGATGATCAGCAACTATACTTACTTTCCCGACCTTGATGACCCTGCA
TCCCTGGGCCAGGTCTTCAAAGGCTGGAAGGATGAGGTTCGTCAATATGAAAAGGTGCAT
>-i
[fai_fetch] Warning - Reference --i not found in FASTA file, returning empty sequence
Segmentation fault (core dumped)

Samtools Version: 0.1.19-96b5f2294a

What am I doing wrong?

samtools faidx samtools reverse complement

Try samtools faidx ./file_1.fasta -i MHLFILTNLILPAFEDLAQG or samtools faidx -i ./file_1.fasta MHLFILTNLILPAFEDLAQG

Same problem I'm afraid:

samtools faidx ./file_1.fasta -i MHLFILTNLILPAFEDLAQG
>-i
[fai_fetch] Warning - Reference -i not found in FASTA file, returning empty sequence
>MHLFILTNLILPAFEDLAQG
TCAGTCTGCAACTCCAAATACTTCAAGCGCATCTGGACCGCCGTGGAGTTCATCAGAAGT
GAGCGTGTCAGAATGATGATCAGCAACTATACTTACTTTCCCGACCTTGATGACCCTGCA
TCCCTGGGCCAGGTCTTCAAAGGCTGGAAGGATGAGGTTCGTCAATATGAAAAGGTGCAT


samtools faidx -i ./file_1.fasta MHLFILTNLILPAFEDLAQG
[fai_load] build FASTA index.
open: No such file or directory
[_razf_open] fail to open -i
[fai_build] fail to open the FASTA file -i
[fai_load] fail to open FASTA index.

I'm not sure why it is not work-ng -it usually does!!

1 answer

Your version of samtools is SUPER old. Looking at the samtools github, 0.1.19 was released at least 7 years ago. I'm guessing there was no -i option 7 years ago.

You're right -it was the version! I am now using 1.9 and "-i" works perfectly. Thank you

Log in to answer this question.