From 7575589086d7f30632ba39b84c372c5c9e32d62a Mon Sep 17 00:00:00 2001 From: Wei Ding Date: Sat, 4 Nov 2017 18:38:00 +0100 Subject: [PATCH] update file path for association calculation --- scripts/pangenome_computation.py | 4 ++-- scripts/sf_association.py | 19 ++++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/scripts/pangenome_computation.py b/scripts/pangenome_computation.py index ef305eb..07c263d 100644 --- a/scripts/pangenome_computation.py +++ b/scripts/pangenome_computation.py @@ -215,8 +215,8 @@ def infer_gene_gain_loss_pattern(self): def inferAssociations(self): from sf_association import infer_branch_associations, infer_presence_absence_associations - infer_branch_associations(self.path, self.nstrains, self.min_strain_fraction_branch_association) - infer_presence_absence_associations(self.path, self.nstrains, + infer_branch_associations(self.path, self.metainfo_fpath, self.meta_data_config, self.nstrains, self.min_strain_fraction_branch_association) + infer_presence_absence_associations(self.path, self.metainfo_fpath, self.meta_data_config, self.nstrains, self.min_strain_fraction_presence_association, self.max_strain_fraction_presence_association) # TODO: gain loss associations diff --git a/scripts/sf_association.py b/scripts/sf_association.py index a43e539..9b3cc23 100644 --- a/scripts/sf_association.py +++ b/scripts/sf_association.py @@ -199,15 +199,13 @@ def calc_significance(self): return max_score - - -def infer_branch_associations(path, total_strains_count, strain_fraction_branch_association): +def infer_branch_associations(path, metainfo_fpath, meta_data_config, + total_strains_count, strain_fraction_branch_association): from sf_geneCluster_align_makeTree import load_sorted_clusters from sf_coreTree_json import metadata_load - metaFile= '%s%s'%(path,'metainfo.tsv') - data_description = '%s%s'%(path,'meta_config.tsv') + data_description = meta_data_config association_dict = defaultdict(dict) - metadata = Metadata(metaFile, data_description) + metadata = Metadata(metainfo_fpath, data_description) metadata_dict = metadata.to_dict() sorted_genelist = load_sorted_clusters(path) @@ -236,14 +234,13 @@ def load_gain_loss(path, clusterID): return map(int, list(tmp)) -def infer_presence_absence_associations(path, total_strains_count, - min_strain_fraction_association, max_strain_fraction_association): +def infer_presence_absence_associations(path, metainfo_fpath, meta_data_config, + total_strains_count, min_strain_fraction_association, max_strain_fraction_association): from sf_geneCluster_align_makeTree import load_sorted_clusters from sf_coreTree_json import metadata_load - metaFile= '%s%s'%(path,'metainfo.tsv') - data_description = '%s%s'%(path,'meta_config.tsv') + data_description = meta_data_config association_dict = defaultdict(dict) - metadata = Metadata(metaFile, data_description) + metadata = Metadata(metainfo_fpath, data_description) metadata_dict = metadata.to_dict() min_strains_association = total_strains_count*min_strain_fraction_association max_strains_association = total_strains_count*max_strain_fraction_association