Search And Replace Old Seq-Id With New Seq-Id Across Fasta Files Using A List.Txt Of Both Ids?
2
0
Entering edit mode
11.1 years ago
hosseinv ▴ 20

Hi Folk,

I have about 90 fasta files, each having multiple sequences. I want to rename the current seq IDs to new seq IDs across all 90 fasta files for all sequences.

How can I do the renaming having a list of current seq IDs (current.txt) and a list of new seq IDs (new.txt) over all fasta files?

Or any other way is much appreciated>

Hossein

unix • 4.9k views
ADD COMMENT
1
Entering edit mode
11.1 years ago

From your question, we can't say much about your fasta headers and how you should transform them.

For example, your could use sed with option -f script-file

$ cat change.sed
s/^>ABCD/>EFG/
s/^>ID1/>sequence_1/
s/^>id\([A-Z]*\)/>sequence_\1/

$ for F in OLD*.fasta; do sed -f change.sed $F >  NEW/`basename $F` ; done
ADD COMMENT
0
Entering edit mode
11.1 years ago
hosseinv ▴ 20

Thanks a lot Pierre. I did what you wrote and that worked well.

I would like to remind the beginners like me that NEW in the command line is a folder name we need to make in the same working directory.

Best

Hossein

ADD COMMENT

Login before adding your answer.

Traffic: 1857 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6