From 7f1956236d9d2b192c43a28c555c31edf8cc77df Mon Sep 17 00:00:00 2001 From: shanghungshih Date: Tue, 17 Jul 2018 17:33:18 +0800 Subject: [PATCH] update to version 1.1.0 --- autoOncotator.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/autoOncotator.py b/autoOncotator.py index 74779c5..1443df2 100644 --- a/autoOncotator.py +++ b/autoOncotator.py @@ -6,6 +6,7 @@ @author: shanghungshih """ +import sys import os import time import warnings @@ -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: @@ -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) @@ -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) @@ -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):