Question: How can I create a new fasta file after modifying an existing fasta file?
0
gravatar for kbaitsi
16 days ago by
kbaitsi0
kbaitsi0 wrote:

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".

new_fasta_file R write.fasta • 105 views
ADD COMMENTlink modified 16 days ago • written 16 days ago by kbaitsi0

What have you tried? Show us your code please.

ADD REPLYlink written 16 days ago by _r_am31k

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 REPLYlink modified 16 days ago • written 16 days ago by kbaitsi0

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

ADD REPLYlink written 15 days ago by _r_am31k
Please log in to add an answer.

Help
Access

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