#!/usr/bin/python2.7 import string from sys import * from Bio import SeqIO from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord def stripPunct(astr): #For now, only output letters to satisfy EMBOSS tmpstr = astr.translate(None, string.digits + string.punctuation + string.whitespace) #tmpstr = astr.translate(None, string.whitespace) return tmpstr def main(): txtfile1 = open(argv[1],"r") txtfile2 = open(argv[2],"r") txt1 = txtfile1.read() txt2 = txtfile2.read() txtfile1.close() txtfile2.close() txtstrip1 = stripPunct(txt1) txtstrip2 = stripPunct(txt2) seq1 = Seq(txtstrip1) seq2 = Seq(txtstrip2) rec1 = SeqRecord(seq1,id="FILE_ONE") rec2 = SeqRecord(seq2,id="FILE_TWO") out1 = open(".tmp1.fasta", "w") out2 = open(".tmp2.fasta", "w") SeqIO.write(rec1, out1, "fasta") SeqIO.write(rec2, out2, "fasta") if __name__ == "__main__": main()