From d22a0e130f321a0523a1f90023185177394c729b Mon Sep 17 00:00:00 2001 From: basti Date: Tue, 4 Dec 2018 15:34:04 +0100 Subject: [PATCH] Fixed: "Paths" V2 --- bin/Modules/Ensembl/ActivityCategorizer.py | 4 ++-- bin/Modules/Ensembl/ActivityTable.py | 2 +- bin/Modules/Ensembl/FTPHandling/VersionChecker.py | 6 +++--- bin/Modules/Ensembl/GTFGen.py | 2 +- bin/Modules/SaveResults.py | 4 ++-- bin/Modules/ucsc/ucsc.py | 8 ++++---- bin/RegGTFExtractor.py | 8 ++++---- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/bin/Modules/Ensembl/ActivityCategorizer.py b/bin/Modules/Ensembl/ActivityCategorizer.py index f1973c5..3ef0258 100644 --- a/bin/Modules/Ensembl/ActivityCategorizer.py +++ b/bin/Modules/Ensembl/ActivityCategorizer.py @@ -32,7 +32,7 @@ def get_categorization(self): def read_config(self, organism, wd): c_dict = {} - path_to_config = os.path.join(wd, "/config/celltypes_"+organism+".json") + path_to_config = os.path.join(wd +"/config/celltypes_"+organism+".json") with open(path_to_config) as input_file: data = json.loads(input_file.read()) for x in data: @@ -45,7 +45,7 @@ def get_activity_data(self, release, organism, wd): for folder in self.folderlist: # Generate path to binary File - file = os.path.join(wd, "/EnsemblData", release, organism, "activity", folder, "table.bin") + file = os.path.join(wd + "/EnsemblData", release, organism, "activity", folder, "table.bin") with open(file, "rb") as tables: self.activity[folder] = bytearray(tables.read()) diff --git a/bin/Modules/Ensembl/ActivityTable.py b/bin/Modules/Ensembl/ActivityTable.py index 105c351..34f4719 100644 --- a/bin/Modules/Ensembl/ActivityTable.py +++ b/bin/Modules/Ensembl/ActivityTable.py @@ -16,7 +16,7 @@ class ActivityTable: """ def __init__(self, organism, current_release, wd): - self.link = os.path.join(wd, "/EnsemblData/", current_release, organism, "activity") + self.link = os.path.join(wd + "/EnsemblData/", current_release, organism, "activity") self.folders = next(os.walk(self.link))[1] self.generator = ATGenerator(["activity=ACTIVE", "activity=POISED", diff --git a/bin/Modules/Ensembl/FTPHandling/VersionChecker.py b/bin/Modules/Ensembl/FTPHandling/VersionChecker.py index 26c284d..9c3500d 100644 --- a/bin/Modules/Ensembl/FTPHandling/VersionChecker.py +++ b/bin/Modules/Ensembl/FTPHandling/VersionChecker.py @@ -32,14 +32,14 @@ def get_current_ftp_version(self): return c_release def check_organism(self, organism, release, wd): - if organism in next(os.walk(os.path.join(wd, "/EnsemblData/"+release+"/")))[1]: + if organism in next(os.walk(os.path.join(wd+"/EnsemblData/"+release+"/")))[1]: return False else: print("No Local Version for "+organism+" installed. Installing...") return True def get_current_local_version(self, wd): - directories = next(os.walk(os.path.join(wd, "/EnsemblData/")))[1] + directories = next(os.walk(os.path.join(wd+"/EnsemblData/")))[1] for dir in directories: if "release" in dir: localversion = sorted(directories, reverse=True)[0] @@ -73,7 +73,7 @@ def download_currentversion_version(self, version, organism, wd): # Download Base File - targetfolder = os.path.join(wd, "/EnsemblData/", version, organism) + targetfolder = os.path.join(wd+"/EnsemblData/", version, organism) os.makedirs(targetfolder) folder_url = "/pub/"+version+"/regulation/"+organism+"/" self.site_ftp.change_dir(folder_url) diff --git a/bin/Modules/Ensembl/GTFGen.py b/bin/Modules/Ensembl/GTFGen.py index 381bef3..cd70f3b 100644 --- a/bin/Modules/Ensembl/GTFGen.py +++ b/bin/Modules/Ensembl/GTFGen.py @@ -12,7 +12,7 @@ def __init__(self, organism, release, wd): def get_organism_as_gff(self, organism, release, wd): - directory = os.path.join(wd, "/EnsemblData/", release, organism) + directory = os.path.join(wd + "/EnsemblData/", release, organism) inputfile = "" for file in os.listdir(directory): if file.endswith("gff.gz"): diff --git a/bin/Modules/SaveResults.py b/bin/Modules/SaveResults.py index 09c4955..a15ffc3 100644 --- a/bin/Modules/SaveResults.py +++ b/bin/Modules/SaveResults.py @@ -9,9 +9,9 @@ def __init__(self, results, organism, tissue, wd): print("Save results to File !") self.path = "" if tissue: - self.path = os.path.join(wd, "/"+organism+"_filtered.gtf") + self.path = os.path.join(wd+"/"+organism+"_filtered.gtf") else: - self.path = os.path.join(wd, "./"+organism+".gtf") + self.path = os.path.join(wd+"/"+organism+".gtf") with open(self.path, "w") as file: write_it = csv.writer(file, delimiter='\t') diff --git a/bin/Modules/ucsc/ucsc.py b/bin/Modules/ucsc/ucsc.py index 1c29337..49e44ad 100644 --- a/bin/Modules/ucsc/ucsc.py +++ b/bin/Modules/ucsc/ucsc.py @@ -10,8 +10,8 @@ class UcscGtf: def __init__(self, org, wd): self.organism_id = self.get_organism_id(org) self.link = "http://hgdownload.soe.ucsc.edu/gbdb/"+self.organism_id+"/ncbiRefSeq/refSeqFuncElems.bb" - self.output = os.path.join(wd, "/UCSCData/"+self.organism_id+".bed") - self.path_to_bin = os.path.join(wd, "/Modules/ucsc/bigBedToBed") + self.output = os.path.join(wd + "/UCSCData/"+self.organism_id+".bed") + self.path_to_bin = os.path.join(wd + "/Modules/ucsc/bigBedToBed") print("Getting UCSC Data") print("Path to Bin: " + self.path_to_bin) self.generate_gff_file() @@ -68,7 +68,7 @@ def get_organism_id(org): @staticmethod def get_activity_categories(organism, wd): - path_to_config = os.path.join(wd, "/config/celltypes_" + organism + ".json") + path_to_config = os.path.join(wd+"/config/celltypes_" + organism + ".json") categories = {} with open(path_to_config) as input_file: data = json.loads(input_file.read()) @@ -78,4 +78,4 @@ def get_activity_categories(organism, wd): return categories def get_gtf(self): - return self.gtf_lines \ No newline at end of file + return self.gtf_lines diff --git a/bin/RegGTFExtractor.py b/bin/RegGTFExtractor.py index 27a6255..0b09b51 100644 --- a/bin/RegGTFExtractor.py +++ b/bin/RegGTFExtractor.py @@ -10,12 +10,12 @@ def check_for_local_folder(wd): - if not os.path.isdir(os.path.join(wd, "/EnsemblData")): + if not os.path.isdir(os.path.join(wd+"/EnsemblData")): - os.mkdir(os.path.join(wd, "/EnsemblData")) + os.mkdir(os.path.join(wd+"/EnsemblData")) - if not os.path.isdir(os.path.join(wd, "/UCSCData" )): - os.mkdir(os.path.join(wd, "/UCSCData" )) + if not os.path.isdir(os.path.join(wd+"/UCSCData" )): + os.mkdir(os.path.join(wd+"/UCSCData" )) def main_script(org, wd, tissuetype=None):