comparison splitFasta.py @ 0:bc25ba9d9fcf draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/hacked/splitFasta commit fcd6ef7e59971abd6b6a3a5401f92bcdef6ef76c
author rnateam
date Sun, 05 Jul 2015 08:37:52 -0400
parents
children ae4d5733272f
comparison
equal deleted inserted replaced
-1:000000000000 0:bc25ba9d9fcf
1 import sys, os
2 if __name__ == "__main__":
3 #assuming perfect input, read every two lines
4 inpath = sys.argv[1]
5 file_contents = open(inpath, 'r').readlines()
6 os.makedirs('splits')
7 inname = os.path.basename(inpath)
8 for i in range(0, len(file_contents), 2):
9 headline = file_contents[i]
10 outname = headline[1:headline.index(' ')]+'.fa'
11 outfile = open(os.path.join('splits',outname), 'w')
12 outfile.write(file_contents[i])
13 outfile.write(file_contents[i+1])
14 outfile.close()