Mercurial > repos > rmarenco > hub_archive_creator
view 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 |
line wrap: on
line source
#!/usr/bin/python import os import tempfile import subprocess def twoBitFileCreator(fastaFile, toolDirectory, mySpecieFolder): """ 2bit file creator from a fasta file. Need faTwoBit kentUtil. Output a .2bit file """ baseNameFasta = os.path.basename(fastaFile.name) suffixTwoBit, extensionTwoBit = os.path.splitext(baseNameFasta) nameTwoBit = suffixTwoBit + '.2bit' with open(os.path.join(mySpecieFolder, nameTwoBit), 'w') as twoBitFile: p = subprocess.Popen( [os.path.join(toolDirectory, 'tools/faToTwoBit'), fastaFile.name, twoBitFile.name]) p.wait() return twoBitFile