I have a file (data.txt) that contains 2 DNA sequences (ORF):
data = readDNAStringSet(file="data.txt")
data
# A DNAStringSet instance of length 2
# width seq names
#[1] 57 ATGACCCCCACCTCCATCCCCACACTTCTATCCCGCTGCCCCGCCTCTCTCCCCTAA GPG
#[2] 54 ATGACCCATGAGCACCATGCAGCCAAAACCCTGGGAATCGGCAAAGCCATCTAG PfK
I want to convert them to aminoacids:
t=vector(mode="list", length=length(data))
for (i in seq_along(data))
{
t[[i]]=translate(data[[i]])
}
t
#[[1]]
#19-letter "AAString" instance
#seq: MTPTSIPTLLSRCPASLP*
#[[2]]
#18-letter "AAString" instance
#seq: MTHEHHAAKTLGIGKAI*
then write a table and have an output using:
tt=do.call(rbind,t)
write.table(tt,"aa.txt",sep="\t\t")
but these commands don't work. I couldn't find the problem. How can I write a table?
Note: translate is a function from the [seqinr] and readDNAStringSet is a function from the [Biostrings].
I don't know why you need seqinr. Biostrings does everything you need.
Maybe you want to use
writeXStringSetinstead ofwrite.table.