Mercurial > repos > xuebing > sharplabtool
diff seqshuffle.py @ 14:76e1b1b21cce default tip
Deleted selected files
author | xuebing |
---|---|
date | Tue, 13 Mar 2012 19:05:10 -0400 |
parents | 292186c14b08 |
children |
line wrap: on
line diff
--- a/seqshuffle.py Sat Mar 10 08:17:36 2012 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -import sys - -from altschulEriksonDinuclShuffle import * - -def readFastaFile(infile,outfile): - - fin = open(infile) - out = open(outfile,'w') - - currSeq='' - currSeqname=None - for line in fin: - if '>' in line: - if currSeqname !=None: - out.write(currSeqname+dinuclShuffle(currSeq)+'\n') - currSeqname=None - currSeq='' - currSeqname=line - else: - currSeq=currSeq+line.strip().upper() - - if currSeqname!=None: - out.write(currSeqname+dinuclShuffle(currSeq)+'\n') - - fin.close() - out.close() - -def readrawseq(infile,outfile): - ''' - each line is a sequence - ''' - fin = open(infile) - out = open(outfile,'w') - for line in fin: - out.write(dinuclShuffle(line.strip().upper())+'\n') - fin.close() - out.close() - -def main(): - seqfile = sys.argv[1] - outfile = sys.argv[2] - fasta = sys.argv[3] - - if fasta == 'fasta': - readFastaFile(seqfile,outfile) - else: - readrawseq(seqfile,outfile) - -main()