This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Converting txt file into fasta file

Dear All, I have collected 20 sequences for a gene in 20 species in a txt file. I need to convert this file into a fasta file, so that to read it in R function to perform sequence alignment and phylogenetic. I knew that R have a function for "system.file", whihc is for fasta files in a packages not an external one as in my case.

Any help ?

program r

post example lines and expected output.

1 answer

To generate a FASTA file, just follow the definition of a FASTA file. Basically, an uninterrupted chain of amino acids or nucleotide letters which are preceded by an identifier line that starts with ">"

>MCHU - Calmodulin - Human, rabbit, bovine, rat, and chicken
MADQLTEEQIAEFKEAFSLFDKDGDGTITTKELGTVMRSLGQNPTEAELQDMINEVDADGNGTID
FPEFLTMMARKMKDTDSEEEIREAFRVFDKDGNGYISAAELRHVMTNLGEKLTDEEVDEMIREA
DIDGDGQVNYEEFVQMMTAK*

>gi|5524211|gb|AAD44166.1| cytochrome b [Elephas maximus maximus]
LCLYTHIGRNIYYGSYLYSETWNTGIMLLLITMATAFMGYVLPWGQMSFWGATVITNLFSAIPYIGTNLV
EWIWGGFSVDKATLNRFFAFHFILPFTMVALAGVHLTFLHETGSNNPLGLTSDSDKIPFHPYYTIKDFLG
LLILILLLLLLALLSPDMLGDPDNHMPADPLNTPLHIKPEWYFLFAYAILRSVPNKLGGVLALFLSIVIL
GLMPFLHTSKHRSMMLRPLSQALFWTLTMDLLTLTWIGSQPVEYPYTIIGQMASILYFSIILAFLPIAGX
IENY

More details can be found all over the internet, wikipedia is a great starting point.

Log in to answer this question.