comparison hub-archive-creator-1.6/twoBitCreator.py @ 0:163b2de763ea draft

Upload the full hubArchiveCreator archive
author rmarenco
date Tue, 01 Mar 2016 19:43:25 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:163b2de763ea
1 #!/usr/bin/python
2
3 import os
4 import tempfile
5 import subprocess
6
7
8 def twoBitFileCreator(fastaFile, toolDirectory, mySpecieFolder):
9 """
10 2bit file creator from a fasta file.
11 Need faTwoBit kentUtil.
12 Output a .2bit file
13 """
14 baseNameFasta = os.path.basename(fastaFile.name)
15 suffixTwoBit, extensionTwoBit = os.path.splitext(baseNameFasta)
16 nameTwoBit = suffixTwoBit + '.2bit'
17
18 with open(os.path.join(mySpecieFolder, nameTwoBit), 'w') as twoBitFile:
19 p = subprocess.Popen(
20 [os.path.join(toolDirectory, 'tools/faToTwoBit'),
21 fastaFile.name,
22 twoBitFile.name])
23
24 p.wait()
25
26 return twoBitFile