covert pandas dataframe into fasta file
1
0
Entering edit mode
16 months ago
Mohan • 0

How to covert pandas dataframe into fasta file with python script?

I have data in pandas data frame as which contains below data.

dataframe content

I want to store above "df" dataframe content to fasta file.

fasta pandas • 2.2k views
ADD COMMENT
3
Entering edit mode

"Title" refers to a title for your question, not your job title.

ADD REPLY
0
Entering edit mode

added the correct title

ADD REPLY
1
Entering edit mode

please, take the time to write a correct title for your question. Also, show us what you tried.

ADD REPLY
0
Entering edit mode
16 months ago
Ram 43k

The FASTA format is very loosely defined - all it needs is a single line header with a ">" and sequence in the next line. You can join/concatenate all fields except sequence using a delimiter (say _ or __ or even blank space but I recommend using a non-blank-space delimiter). Append this concatenated string to > and print it, then print sequence in the next line. Rinse and repeat.

I've outlined the approach for you, writing the code should be trivial.

ADD COMMENT

Login before adding your answer.

Traffic: 1822 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6