Mercurial > repos > tyty > structurefold
view Iterative_mapping/truncate.py @ 53:52538ebd3c4b draft
Uploaded
author | tyty |
---|---|
date | Mon, 17 Nov 2014 15:14:21 -0500 |
parents | d56631911cc1 |
children |
line wrap: on
line source
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from Bio import SeqIO fasta_file = sys.argv[1] shift_in = sys.argv[2] result_file = sys.argv[3] length = sys.argv[4] shift = int(shift_in) fasta_sequences = SeqIO.parse(open(fasta_file),'fasta'); h = file(result_file,'w') for seq in fasta_sequences: nuc = seq.id; sequence = seq.seq.tostring(); if (len(sequence)-shift)>=int(length): h.write('>'+nuc) h.write('\n') h.write(sequence[0:(len(sequence)-shift)]) h.write('\n') h.close()