I need to write a Python script to convert two sequences to interleaved FASTA format with 10 characters per line.
so if the input is
>human
ACACCGGTACCAGAT ATGATATACCGAGA
>mouse
ACCAGAGGGGGTTTT AAACCACAGCG
(saved as dna.txt)
the output should be
>human
ACACCGGTAC
CAGATATGAT
ATACCGAGA
>mouse
ACCAGAGGGG
GTTTTAAACC
ACAGCG
i have no idea what to do.
this is all i have so far
so if the input is
>human
ACACCGGTACCAGAT ATGATATACCGAGA
>mouse
ACCAGAGGGGGTTTT AAACCACAGCG
(saved as dna.txt)
the output should be
>human
ACACCGGTAC
CAGATATGAT
ATACCGAGA
>mouse
ACCAGAGGGG
GTTTTAAACC
ACAGCG
i have no idea what to do.
this is all i have so far
Code:
def read_data(filename):
with open("p:/dna.txt", "r") as myfile:
data = myfile.readlines()
myfile.close()
for i in range(0, len(data)):
data[i] = data[i].rstrip("\n")
return data
seq1 = data[1]
seq2 = data[3]
Comment