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

Hello everyone,

I am interested in a sequence ranging from 111614 to 111868 in a fasta sequence (scaffold sequence)

I am trying to use samtools faidx to tkae this sequence but it doesn't work and keep returning me :

[fai_fetch] Warning - Reference 111-555 not found in FASTA file, returning empty sequence

After seeing some other users with the same problems, i tried to change the header name for it to contain no space (like ">scaffoldX") but it still doesn't work

Here is the exact command I type (my fasta file only contain the sequence of my scaffold) :

samtools faidx scaffold.fasta 111614-111868

Thanks a lot for your help.

sequence genome samtools faidx fasta

If someone know an other way to simply extract a sequence from pos X to Y in a fasta file, i am interested ! Thanks ^^

2 answers

Shouldn't it be "samtools faidx scaffold.fasta scaffoldX:111614-111868"?

It worked !! Thanks a lot ! I feel so stupid now

The same issue probably explains why bedtools didn't work.

I have moved the comment of cmdcolin to an answer so you can accept it to mark this thread as solved.

This sounds like a job for bedtools getfasta.

Sounds awesome, going to check it, thanks !

It doesn't seems to work better ...

bedtools getfasta -fi scaffold.fasta -bed test.bed > result_test

Result : nothing ...

I have no idea how the chromosome identifier of your fasta file looks like, and how you formatted your bed file. As such you are making it rather hard to troubleshoot.

Log in to answer this question.