Dear all
I have a text file containing all the sequences which I wanted to extract from the fasta file. I tried as an example with some raw sequences using grep function and it works perfectly
But I am facing some problem with the original file. I am getting the blank output file. I tried different way and found that there is a problem with the IDs which is in the text file.
Problem which I could understand until now "ids in the text file have the space character at the end" due to this space I am getting the blank output file.
I took some of the sequences from the ID file and remove the space at the end and run again the grep script. It gives me result.
I would like to know
- Is space at the end of the id in the text file matter?
- How can I remove the space from the id file with some command?
- Is there some way that I can tell grep that do not consider the space at the end?
My code is
grep -A1 -wFf ID.txt input.fasta > result.fa
Thanks
0 answers
No answers yet.
Log in to answer this question.
While you are searching using
-w, the white space is causing the problems. You can remove it using sed:It's not working. The output file has the same with space at the end of the id.
Hello tcf.hcdg!
Questions similar to yours can already be found at:
We have closed your question to allow us to keep similar content in the same thread.
If you disagree with this please tell us why in a reply below. We'll be happy to talk about it.
Cheers!
PS: Please add a comment to your other post about this topic instead of opening a new thread.