Entering edit mode
5.3 years ago
tikshyadav19
•
0
My file is dna.fasta
>dna1
ATATTCGGATTCGAGCTTAGGT
I want to convert it into dna.txt?
My file is dna.fasta
>dna1
ATATTCGGATTCGAGCTTAGGT
I want to convert it into dna.txt?
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
There's no reason to do this...file extensions are arbitrary, and fasta files are already text files.
for example there is file dna.fasta with some sequence i want to convert this file in dna.txt format
To add to Joe's explanation: files with
.fasta
extension are usually of the typeASCII text
, which means plain text. They have the.fasta
extension only for convenience, to signify that sequences in it have a header and a string of letters. You can give those files literally any extension (and many are used, such as.fa
,.faa
,.fas
,.fna
) without changing anything about the file contents. All of them should work just like a file with.txt
extension.i want to count NT after it converts in .txt
Please stop changing the question. Either ensure you ask the right question to start with, or open a new question, because now you’re confusing the thread for other people in future.
Show the data! Words are meaningless until you finally show how this
txt
file is suppoed to look like..txt
isnt a 'format' in the way you're thinking of..fasta
is already.txt
, you just rename it and change the extension if you desperately need it to be.txt
.To make it simple, please show an example of how
dna.txt
is supposed to look like. Then we can provide adequate solutions.Python:
oh is open handle or OH :)
dna.fastq has format as
and
dna.txt has format as
ATATTCGGATTCGAGCTTAGGT
along with it should count the number of nucleotides in dna.txt
by using python program in idle script
Do you just want to remove the header lines (i.e. the
> sequence_name
lines that appear before each sequence)?You didn’t ask for a script which counts nucleotide length.
You need to fix your question, ideally with some example input and output.
a.zielezinski's post inspired me to come up with really complicated ways to do this task.
Here is one:
python -c "print('>dna1\nATATTCGGATTCGAGCTTAGGT\n')" > dna.txt
If you really want to complicate the living daylights out of this, here is another solution:
Save this code as
task.py
and type:python task.py > dna.txt
This will work only for python 2.7. I will post python 3.x code if there is interest.
Still laughing. This one has made my day. "I will post python 3.x code if there is interest."
I am not laughing sir this is really complecated.
You can edit files in fasta in whatever text editor, i think it does not have sense, but you can change the extension in the prompt shell by by typing:
mv file.fasta file.txt
tikshyadav19, please say what you are ultimately trying to do. Are you trying to use a program that requires FASTA data in a different format?