Mercurial > repos > tyty > structurefold
diff Iterative_mapping/truncate.py @ 56:9d26c2e4953e draft
Uploaded
author | tyty |
---|---|
date | Tue, 18 Nov 2014 01:00:33 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Iterative_mapping/truncate.py Tue Nov 18 01:00:33 2014 -0500 @@ -0,0 +1,36 @@ +#!/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] +t_end = sys.argv[5] + +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') + if t_end == 'three_end': + h.write(sequence[0:(len(sequence)-shift)]) + if t_end == 'five_end': + h.write(sequence[(shift):(len(sequence))]) + h.write('\n') + + + + +h.close() + + + +