Mercurial > repos > rnateam > splitfasta
view splitFasta.py @ 2:a9803f1fff75 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/hacked/splitFasta commit 7e4c12467b74b77f04ca3817518cc4066aa507fe
author | rnateam |
---|---|
date | Sun, 05 Jul 2015 10:04:33 -0400 |
parents | bc25ba9d9fcf |
children | ae4d5733272f |
line wrap: on
line source
import sys, os if __name__ == "__main__": #assuming perfect input, read every two lines inpath = sys.argv[1] file_contents = open(inpath, 'r').readlines() os.makedirs('splits') inname = os.path.basename(inpath) for i in range(0, len(file_contents), 2): headline = file_contents[i] outname = headline[1:headline.index(' ')]+'.fa' outfile = open(os.path.join('splits',outname), 'w') outfile.write(file_contents[i]) outfile.write(file_contents[i+1]) outfile.close()