Mercurial > repos > tyty > structurefold
view upload/Iterative_mapping/truncate.py @ 34:d74ed492efdd draft
Uploaded
author | tyty |
---|---|
date | Mon, 20 Oct 2014 14:55:16 -0400 |
parents | |
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()