How can I create a new fasta file after modifying an existing fasta file?
0
0
Entering edit mode
3.4 years ago
kbaitsi • 0

I have a fasta file with 10 protein sequences. Using R I generate a new protein sequence and using write.fasta I insert the new sequence in the original file. Is there a way to create a new fasta file with a new name containing the 11 sequences? Basically I need to "save as".

r write.fasta new_fasta_file • 683 views
ADD COMMENT
0
Entering edit mode

What have you tried? Show us your code please.

ADD REPLY
0
Entering edit mode

The original fasta file is called histone4.fa. After I have generated the new sequence(new hist) I write write.fasta(newhist, names = names("histone4.fa"), file.out = "histone4.fa", open = "a") and a new line is added to my open fasta file. If I write write.fasta(newhist, names = names("histone4.fa"), file.out = "histone4new.fa", open = "a") a new file is created but only with the new sequence. If I write

write.fasta(histone, names = names("histone4.fa"), file.out = "histone4new.fa", open = "a")
write.fasta(newhist, names = names("histone4.fa"), file.out = "histone4new.fa", open = "a")

it works but I was wondering if there is a more compact way to do it.

*histone = readAAStringSet("histone4.fa")

ADD REPLY
0
Entering edit mode

You could concatenate histone and newhist and write it in a single line.

ADD REPLY

Login before adding your answer.

Traffic: 2925 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