def filter_expr(meth, series_obj_id=None, filtering_method="anova", num_genes=None, p_value="1.0"): """Filter expression table to differentially expressed genes :param series_obj_id:Object id of the expression series data :type series_obj_id:kbtypes.KBaseExpression.ExpressionSeries :param filtering_method: Filtering method ('anova' for ANOVA or 'lor' for log-odd ratio) :type filtering_method: kbtypes.Unicode :param num_genes: Target number of genes (choose this or p-value below) :type num_genes: kbtypes.Unicode :param p_value: p-value cutoff (choose this or num_genes above) :type p_value: kbtypes.Unicode :return: Workspace id :rtype: kbtypes.Unicode :output_widget: ValueListWidget """ meth.stages = 3 meth.advance("Initialize COEX service") cc = CoExpression(URLS.coex, token=meth.token) argsx = {"ws_id" : meth.workspace_id, "inobj_id" : series_obj_id, "outobj_id" : series_obj_id+".fltrd", "p_value" : "0.05", "method" : filtering_method, "num_genes" : num_genes} meth.advance("submit job to select genes") try: jid = cc.filter_genes(argsx) except Exception as err: raise COEXException("submit job failed: {}".format(err)) if not jid: raise COEXException(2, "submit job failed, no job id") AweJob.URL = URLS.awe AweJob(meth, started="Differential expression filter", running="Differential expression filter").run(jid[0]) return _workspace_output(series_obj_id+".fltrd")
def build_net_clust(meth, series_obj_id=None, net_method='simple', clust_method='hclust', cut_off=None, num_module=None): """Construct co-expression network and a set of densely interconnected clusters in co-expression network based on expression table object :param series_obj_id: Object id of the expression Series data :type series_obj_id: kbtypes.KBaseExpression.ExpressionSeries :param net_method : Network construction algorithm ('simple' for Pearson correlation coefficient or 'WGCNA') :type net_method: kbtypes.Unicode :param clust_method : Clustering algorithm ('hclust' for hierachical clustering or 'WGNCA') :type clust_method: kbtypes.Unicode :param cut_off: Lower cutoff to keep edges :type cut_off: kbtypes.Unicode :param num_module: The number of cluster :type num_module: kbtypes.Unicode :return: Workspace id :rtype: kbtypes.Unicode :output_widget: ValueListWidget """ meth.stages = 3 meth.advance("Initialize COEX service") cc = CoExpression(URLS.coex, token=meth.token) argsx = { "ws_id": meth.workspace_id, "inobj_id": series_obj_id, "outobj_id": 'coex_by_' + series_obj_id, "cut_off": cut_off, "net_method": net_method, "clust_method": clust_method, "num_modules": num_module } meth.advance("submit job to construct network and clusters") try: jid = cc.const_coex_net_clust(argsx) except Exception as err: raise COEXException("submit job failed: {}".format(err)) if not jid: raise COEXException(2, "submit job failed, no job id") AweJob.URL = URLS.awe AweJob(meth, started="Construct coex network and clusters", running="Construct coex network and clusters").run(jid[0]) return _workspace_output('coex_by_' + series_obj_id)
def filter_expr(meth, series_obj_id=None, filtering_method="anova", num_genes=None, p_value="1.0"): """Filter expression table to differentially expressed genes :param series_obj_id:Object id of the expression series data :type series_obj_id:kbtypes.KBaseExpression.ExpressionSeries :param filtering_method: Filtering method ('anova' for ANOVA or 'lor' for log-odd ratio) :type filtering_method: kbtypes.Unicode :param num_genes: Target number of genes (choose this or p-value below) :type num_genes: kbtypes.Unicode :param p_value: p-value cutoff (choose this or num_genes above) :type p_value: kbtypes.Unicode :return: Workspace id :rtype: kbtypes.Unicode :output_widget: ValueListWidget """ meth.stages = 3 meth.advance("Initialize COEX service") cc = CoExpression(URLS.coex, token=meth.token) argsx = { "ws_id": meth.workspace_id, "inobj_id": series_obj_id, "outobj_id": series_obj_id + ".fltrd", "p_value": "0.05", "method": filtering_method, "num_genes": num_genes } meth.advance("submit job to select genes") try: jid = cc.filter_genes(argsx) except Exception as err: raise COEXException("submit job failed: {}".format(err)) if not jid: raise COEXException(2, "submit job failed, no job id") AweJob.URL = URLS.awe AweJob(meth, started="Differential expression filter", running="Differential expression filter").run(jid[0]) return _workspace_output(series_obj_id + ".fltrd")
def build_net_clust(meth, series_obj_id=None, net_method='simple', clust_method='hclust', cut_off=None, num_module=None): """Construct co-expression network and a set of densely interconnected clusters in co-expression network based on expression table object :param series_obj_id: Object id of the expression Series data :type series_obj_id: kbtypes.KBaseExpression.ExpressionSeries :param net_method : Network construction algorithm ('simple' for Pearson correlation coefficient or 'WGCNA') :type net_method: kbtypes.Unicode :param clust_method : Clustering algorithm ('hclust' for hierachical clustering or 'WGNCA') :type clust_method: kbtypes.Unicode :param cut_off: Lower cutoff to keep edges :type cut_off: kbtypes.Unicode :param num_module: The number of cluster :type num_module: kbtypes.Unicode :return: Workspace id :rtype: kbtypes.Unicode :output_widget: ValueListWidget """ meth.stages = 3 meth.advance("Initialize COEX service") cc = CoExpression(URLS.coex, token=meth.token) argsx = {"ws_id" : meth.workspace_id, "inobj_id" : series_obj_id, "outobj_id" : 'coex_by_' +series_obj_id, "cut_off" : cut_off, "net_method" : net_method, "clust_method" : clust_method, "num_modules" : num_module} meth.advance("submit job to construct network and clusters") try: jid = cc.const_coex_net_clust(argsx) except Exception as err: raise COEXException("submit job failed: {}".format(err)) if not jid: raise COEXException(2, "submit job failed, no job id") AweJob.URL = URLS.awe AweJob(meth, started="Construct coex network and clusters", running="Construct coex network and clusters").run(jid[0]) return _workspace_output('coex_by_' +series_obj_id)