From 56bb863276b51381236927ead1b78d7764030db8 Mon Sep 17 00:00:00 2001 From: npg2108 Date: Mon, 13 Aug 2018 10:18:26 -0400 Subject: [PATCH] mod --- cohorts/cohort.py | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/cohorts/cohort.py b/cohorts/cohort.py index 0f9f48d..5aec1be 100644 --- a/cohorts/cohort.py +++ b/cohorts/cohort.py @@ -1,5 +1,4 @@ from .utils import * -from .helpers import * import os import numpy as np @@ -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__": """