Skip to content

Commit

Permalink
Fixed: "Paths" V2
Browse files Browse the repository at this point in the history
  • Loading branch information
basti committed Dec 4, 2018
1 parent 8c843fb commit d22a0e1
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions bin/Modules/Ensembl/ActivityCategorizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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())

Expand Down
2 changes: 1 addition & 1 deletion bin/Modules/Ensembl/ActivityTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions bin/Modules/Ensembl/FTPHandling/VersionChecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion bin/Modules/Ensembl/GTFGen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down
4 changes: 2 additions & 2 deletions bin/Modules/SaveResults.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
8 changes: 4 additions & 4 deletions bin/Modules/ucsc/ucsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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())
Expand All @@ -78,4 +78,4 @@ def get_activity_categories(organism, wd):
return categories

def get_gtf(self):
return self.gtf_lines
return self.gtf_lines
8 changes: 4 additions & 4 deletions bin/RegGTFExtractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit d22a0e1

Please sign in to comment.