https://github.com/fjruizruano/ngs-protocols
Raw File
Tip revision: 39a091d1fa569a7fc717ac73c4b3de07f0a1204d authored by fjruizruano on 03 August 2023, 11:48:27 UTC
adding gfa2fas.py and extract_gfa.py
Tip revision: 39a091d
cut_seq_unequal.py
#!/usr/bin/python

from Bio import SeqIO

file = raw_input("FASTA file: ")
length = int(raw_input("Length of the sequences: "))

secu = SeqIO.parse(open(file), "fasta")

output = open("output.fas","w")

for s in secu:
	cut_times = len(str(s.seq))/length
	for n in range(0, cut_times+1):
		output.write(">%s_%s\n%s\n" % (s.id, str(n), str(s.seq)[n*length:(n+1)*length]))
back to top