Question: (Closed) id in text file for sequence retrival from multifasta
0
gravatar for tcf.hcdg
3.7 years ago by
tcf.hcdg60
European Union
tcf.hcdg60 wrote:

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 blanck 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 untill now "ids in the text file have the space character at the end"  due to this space I am getting the blanck 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 

1 is space at the end of the id in the text file matter?

2  how can I remove the space from the id file with some command?

3 Is ther 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

 

 

id grep fasta • 1.4k views
ADD COMMENTlink written 3.7 years ago by tcf.hcdg60

While you are searching using '-w', the white space is causing the problems. You can remove it using sed:

sed -i 's/ *$//' ID.txt
ADD REPLYlink written 3.7 years ago by iraun3.5k

its not working . out put file has the same with space at the end of the id.

 

ADD REPLYlink written 3.7 years ago by tcf.hcdg60

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.
ADD REPLYlink written 3.7 years ago by Matt Shirley8.9k
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 690 users visited in the last hour