Hi
I am new in python and want to see how this can be done in python (I can do this in R). I have a text file myfile.txt
with one column and thousands of rows as shown below. I want to convert this to fasta result.fasta
format as shown below. How can I do this in python?
myfile.txt
ATGTGTGGTTTTCCCCC
ATTGGCGGGGTTTTTCAGGGG
ATGGGGGGGCCCCCCCCAAAAAA
TTGGTGGGGGGGGGGGGAA
result.fasta
>1
ATGTGTGGTTTTCCCCC
>2
ATTGGCGGGGTTTTTCAGGGG
>3
ATGGGGGGGCCCCCCCCAAAAAA
>4
TTGGTGGGGGGGGGGGGAA
For the OP, Kevin did a good job showing the pseudocode, and each step.This will run in the same fashion.
I also have the similar query but I want to use the names of sequences to be used after the
'>
' symbol. for example:and I want:
result.fasta
Can I get some guidelines?
Sometimes if you try and search for this type of information you would not need to wait to get an answer. Here is one solution.
I am really thankful for your support. I would want to discuss that I receive an error,
when I try using this solution (code) on windows OS and I do not use linux. Since according to my knowledge, argv is the built-in array of linux and so I guess it does not work when I run the script in python IDLE (3.6.4).