Hi all,
Does anyone knows who to convert a DNA sequence from a fasta file to a table of one column? Can be in R or python!
I tried this fasta to table converter but is not working for me.. https://rstudio-pubs-static.s3.amazonaws.com/518943_a6bb21f87f594e6fb2aaa9ca2ef79cc0.html
Then I also tried to convert my fasta file into a csv (using https://birdlet.github.io/2017/12/13/fasta2csv/ ) but is not working either becuse then I have multiples columns, not one as I need.
1 >DENV4_(consensus)
2 A G T T G T T A G T C T G T G T G G A C C G A C A A G G A C A G T T C C A A A
3 T T C T A A C A G T T T G T T T A G A T A G A G A G C A G A T C T C T G G A A
Can anyone help me?
Thanks a lot!
Fabiana
If you linearize the fasta file then it should become what you are looking for. Try this code from @Pierre.
`Hey! Thanks for the help!!
So, I first linearized my fasta as you suggested:
Then i converted my fasta into csv:
fasta2csv.py ipc214_S8_DENV4_linearized.fasta ipc214_S8_linearized.csv
And then in R i try to open my csv file:
And I get the following:
1 >DENV4_(consensus) AGTTGTTAGTCTGTGTGGACCGACAAGGACAGTTCCAAATCGGAAGCTTGCTTAACACAGTTCTAACAGTTTGTTTAGATAGAGAGCAGATCTCTGGAAAAATGAACCAACGAAAGAAGGTGGCTAGACCACCTTTCAATATGCTGAAACGCGAGAGAAACCGCGTATCAACCCCTCAAGGGTTGGTGAAGAGATTCTCGACTGGACTTTTTTCCGGGAAAGGACCCTTACGGATGATGTTGGCATTCATTACGTTTTTGAGAGTTCTTTCCATCCCACCAACAGCAGGGATTCTAAAAAGATGGGGACAGTTAAAGAAAAACAAGGCCGTGAAG.. <truncated>
Which is not exactly what I need. I want to have a table like this:
1 A
2 G
3 T
4 T
etc..
Maybe my approach is not the best! What do you think?
Thanks a lot again!
Here are some other options to linearize fasta: Linearize fasta files