annotate hub-archive-creator-1.6/twoBitCreator.py @ 1:bfa14bec861c draft default tip

Deleted selected files
author rmarenco
date Fri, 04 Mar 2016 11:20:43 -0500
parents 163b2de763ea
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
1 #!/usr/bin/python
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
2
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
3 import os
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
4 import tempfile
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
5 import subprocess
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
6
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
7
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
8 def twoBitFileCreator(fastaFile, toolDirectory, mySpecieFolder):
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
9 """
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
10 2bit file creator from a fasta file.
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
11 Need faTwoBit kentUtil.
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
12 Output a .2bit file
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
13 """
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
14 baseNameFasta = os.path.basename(fastaFile.name)
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
15 suffixTwoBit, extensionTwoBit = os.path.splitext(baseNameFasta)
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
16 nameTwoBit = suffixTwoBit + '.2bit'
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
17
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
18 with open(os.path.join(mySpecieFolder, nameTwoBit), 'w') as twoBitFile:
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
19 p = subprocess.Popen(
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
20 [os.path.join(toolDirectory, 'tools/faToTwoBit'),
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
21 fastaFile.name,
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
22 twoBitFile.name])
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
23
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
24 p.wait()
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
25
163b2de763ea Upload the full hubArchiveCreator archive
rmarenco
parents:
diff changeset
26 return twoBitFile