I was wondering how I can export the results of my `msa` run into a file.
I know I can export it to a fasta file using `unmasked(msa)`, but I would like to export the complete results I see in the terminal to a file or if possible in clustal format.
this is my script:
P <- msa(seqs, order = "input", "ClustalOmega")
print(P, show = "complete")
writeXStringSet(unmasked(P), file="test.clustal")
But this gives ma a fasta file. Is there a way to get the clustal format as an output?
Reply to question #1: The width is controlled by the global R option 'width' (in line with the print() methods in the 'Biostrings' package). So you can change the number of columns yourself. If you want to avoid this to have a global effect on your R session, you should save the current value and then, after running print(), revert to the previous value. Here is an example (the first lines are to be copied from above):
Reply to question #2: Sorry, no. This is an implementation that is, to quite some extent, copied from or at least inspired by the methods in the 'Biostrings' package. You can influence the width of names by the 'nameWidth' argument, but that's all. If you want to tailor the print() methods to your very specific needs, you will have to make a copy of the relevant parts of the source file msa/R/print-methods.R and customize the code of your local copy to your needs.
I am sorry, we currently do not have any functionality for saving clustal files in our 'msa' package. I quickly had a look whether there are other options. I came across the thread "R write alignment MSA" on Biostars. The second option sounds fantastic, but I checked it and it does not seem possible. So it seems what you are asking for does not exist. So you'd probably better resort to the option to save the multiple alignment to a FASTA file and to convert it to clustal format using an external tool (option #1 in the Biostars thread mentioned above).
In any case, we are currently thinking of what extensions can be useful for the 'msa' package. The methods for saving clustal files are hidden in the multiple sequence alignment tools that are part of the 'msa' package, they are just not exposed to the end user. So it should not be a big deal to do this. We will not manage for this year's spring release of Bioconductor (3.7), but I am optimistic for 3.8.
Sorry i was happy too fast. this is not exactly what I need. When I do this, I still get only the first nine row and the lst nine rows of the file with the ... between them.
I would like to get the complete file - in my case all 154 rows in the text file. Is this possible?
thanks, this was very helpful.