Skip to content

Commit

Permalink
update SampleParams to handle all gene annotation files (#195)
Browse files Browse the repository at this point in the history
Co-authored-by: Smith Nicholas <[email protected]>
  • Loading branch information
nickhsmith and Smith Nicholas authored May 25, 2021
1 parent cd10eb0 commit 9069bad
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions drop/config/SampleParams.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class SampleParams:
}


def __init__(self,AE,MAE,annotation,processedDataDir, sampleAnnotation):
def __init__(self,AE,MAE,geneAnnotation,processedDataDir, sampleAnnotation):
"""
AE: object. AberrantExpression object as created in DropConfig.py
MAE: object. MonoallelicExpression object as created in DropConfig.py
Expand All @@ -82,11 +82,8 @@ def __init__(self,AE,MAE,annotation,processedDataDir, sampleAnnotation):
sampleAnnotation: object. SampleAnnotation object as defined by SampleAnnotation.py
"""

#annotation just needs v29 to know where to build the dir
for ann in annotation: #annotation is currently a dictionary that will only have 1 entry for now. Hotfix
self.annotation = ann

moduleList = [AE,MAE]
self.geneAnnotation = geneAnnotation
self.processedDataDir = processedDataDir
self.sampleAnnotation = sampleAnnotation

Expand All @@ -98,24 +95,25 @@ def writeAllSampleParams(self,moduleList):
moduleList: list. list containing module objects to loop through
using the dictionary and helpers defined above, loop through each module and param pair and write the sample param file
"""
for module in moduleList:
paramKeys = self.PARAM_COLS[module.name].keys()
if module.name == "AberrantExpression":
modulePath = self.processedDataDir / self.MODULE_NAMES[module.name] / self.annotation / "params"
elif module.name == "MonoallelicExpression":
modulePath = self.processedDataDir / self.MODULE_NAMES[module.name] / "params"
else: raise(ValueError,"currently only AberrantExpression and MonoallelicExpression are supported")

for paramType in paramKeys:

self.writeSampleParams(
for ann in self.geneAnnotation:
for module in moduleList:
paramKeys = self.PARAM_COLS[module.name].keys()
if module.name == "AberrantExpression":
modulePath = self.processedDataDir / self.MODULE_NAMES[module.name] / ann / "params"
elif module.name == "MonoallelicExpression":
modulePath = self.processedDataDir / self.MODULE_NAMES[module.name] / "params"
else: raise(ValueError,"currently only AberrantExpression and MonoallelicExpression are supported")

for paramType in paramKeys:

self.writeSampleParams(
module,
modulePath / self.PARAM_COLS[module.name][paramType].path,
paramType,
self.PARAM_COLS[module.name][paramType].sampleAnnotationColumns,
self.PARAM_COLS[module.name][paramType].include,
self.PARAM_COLS[module.name][paramType].group
)
)

def writeSampleParams(self,module,path,file_suffix,param_cols,include,group_param):
"""
Expand Down

0 comments on commit 9069bad

Please sign in to comment.