Skip to content

Commit

Permalink
update to version 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shanghungshih committed Jul 17, 2018
1 parent 8c39545 commit 7f19562
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions autoOncotator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@author: shanghungshih
"""

import sys
import os
import time
import warnings
Expand All @@ -25,7 +26,7 @@
null_handler = logging.NullHandler()
logger_null.addHandler(null_handler)

VERSION = (1, 0, 0)
VERSION = (1, 1, 0)
__version__ = '.'.join(map(str, VERSION[0:3])) + ''.join(VERSION[3:])

class autoOncotator:
Expand Down Expand Up @@ -77,7 +78,11 @@ def vcf2oncotator(self, project, output_dir, tsv):
def oncotator(self, filesize, project, output_dir, tsv, maf, num):
fail = []
xpath = '/html/body/div[2]/div[3]/div[1]/a[1]'

output_dir_raw = output_dir
output_dir = os.path.join(output_dir, project.split('.')[0])
if os.path.exists(output_dir) is False:
os.mkdir(output_dir)

profile = webdriver.FirefoxProfile()
profile.set_preference('browser.download.folderList', 2)
profile.set_preference('browser.download.dir', output_dir)
Expand All @@ -93,10 +98,10 @@ def oncotator(self, filesize, project, output_dir, tsv, maf, num):
while True:
try:
time.sleep(480)
time.sleep(9*num*2)
driver.find_element_by_xpath(xpath).click()
time.sleep(5)
os.system('mv %s %s' %(os.path.join(output_dir, 'oncotator.maf.txt'), os.path.join(output_dir, project.replace('.vcf', '.'+maf))))
os.system('mv %s %s' %(os.path.join(output_dir, project.replace('.vcf', '.'+maf)), output_dir_raw))
break
except:
fail.append(project)
Expand All @@ -105,15 +110,16 @@ def oncotator(self, filesize, project, output_dir, tsv, maf, num):
while True:
try:
time.sleep(240)
time.sleep(9*num*2)
driver.find_element_by_xpath(xpath).click()
time.sleep(5)
os.system('mv %s %s' %(os.path.join(output_dir, 'oncotator.maf.txt'), os.path.join(output_dir, project.replace('.vcf', '.'+maf))))
os.system('mv %s %s' %(os.path.join(output_dir, project.replace('.vcf', '.'+maf)), output_dir_raw))
break
except:
fail.append(project)
warnings.warn('selenium webdriver error occor: [%s]' %(project))
driver.close()
os.rmdir(output_dir)
return fail

def work_log(work_data):
Expand Down

0 comments on commit 7f19562

Please sign in to comment.