Skip to content

Commit

Permalink
mod
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiangre committed Aug 13, 2018
1 parent 8bdae67 commit 56bb863
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion cohorts/cohort.py
@@ -1,5 +1,4 @@
from .utils import *
from .helpers import *

import os
import numpy as np
Expand Down Expand Up @@ -1307,6 +1306,40 @@ def integrate_cohorts(self,treat_name="PGD",ref_name="NL",dataset_type='samples_
self.df = multi_df_join(dfs).dropna()
self.df_groups = multi_df_join(df_groups).dropna()

def make_cohorts_dict(names,
file_dirs,
treats,refs,
replicates_files,
sample_groups_files,
data_dir="../../data/",
uniprot_file="uniprot-all_20171124.tab.gz"):
"""
Create cohort objects via dictionaries of attributes where the key of each dfictionary is the name of the cohort object
Parameters:
----------
Returns:
------
objs
Dictionary where keys are each cohort object name and values are the instantiaated cohort object.
"""
if len(names)==0:
return {}
else:
objs = {}
for cohort in names:
obj = Cohort(cohort=cohort,
data_dir=data_dir,file_dir=file_dirs[cohort],
replicates_file=replicates_files[cohort],
sample_groups_file=sample_groups_files[cohort],
uniprot_file=uniprot_file)
obj.set_ref(refs[cohort])
obj.set_treat(treats[cohort])
objs[cohort] = obj
return objs

if __name__=="__main__":
"""
Expand Down

0 comments on commit 56bb863

Please sign in to comment.