diff --git a/src/exp_analysis/helper.py b/src/exp_analysis/helper.py index 300699194..1c9340fc2 100644 --- a/src/exp_analysis/helper.py +++ b/src/exp_analysis/helper.py @@ -101,35 +101,7 @@ def plot_centrality(self, df, title='',ax=None, xlabel='Degree', ylabel='Gene', if colors is not None: for label, color in zip(ax.get_yticklabels(), colors): label.set_color(color) - def role_analysis(self, top_q=None) -> pd.DataFrame: - ''' - Vester's sensitivity analysis. - - active_sum: active sum. Sum along rows of the influence matrix and it indicates how much does a variable influence all the others. - - passive_sum: passive sum. Its is the sum along columns of the influence matrix and it indicates how sensitive a variable is, how does it react to the influence of others - - Active: +AS, -PS - - Passive: -AS, -PS - - Critical: +AS, +PS - - neutral: -AS, -PS - ------------------------------------------------------ - inputs: net (DataFrame) - top_q: top quantile - output: VSA (DataFrame) -> genename: active_sum, passive_sum, Role - ''' - # active sum and passive sum - net = self.net.copy() - net = net[net.weight>net.weight.quantile(top_q)] - gene_names = np.union1d(net.source.unique(), net.target.unique()) - active_sum = np.asarray([sum(net.query(f"source == '{gene}'")['weight']) for gene in gene_names]) - passive_sum = np.asarray([sum(net.query(f"target == '{gene}'")['weight']) for gene in gene_names]) - - # define the roles ['Buffering', 'Passive', 'Active', 'Critical'] -> [0, 1, 2, 3] - active_sum_threhsold = np.quantile(active_sum, 0.9) - passive_sum_threhsold = np.quantile(passive_sum, 0.9) - # active_sum, passive_sum = standardize_array(active_sum), standardize_array(passive_sum) - roles = [2*as_flag+ps_flag for as_flag, ps_flag in zip(active_sum>active_sum_threhsold, passive_sum>passive_sum_threhsold)] - self.roles = pd.DataFrame(data={'gene_name': gene_names, 'active_sum': active_sum, 'passive_sum': passive_sum, 'role':roles }) - self.roles.set_index('gene_name',inplace=True) - return self.roles + def top_edges(self, quantile=0.95): grn = self.net diff --git a/src/methods/multi_omics/celloracle_ns/main.nf b/src/methods/multi_omics/celloracle_ns/main.nf index 1fd436ef5..a3fd440db 100644 --- a/src/methods/multi_omics/celloracle_ns/main.nf +++ b/src/methods/multi_omics/celloracle_ns/main.nf @@ -8,6 +8,7 @@ workflow run_wf { | celloracle.run( fromState: [multiomics_rna: "multiomics_rna", multiomics_atac: "multiomics_atac", + tf_all: "tf_all", temp_dir: "temp_dir", num_workers: "num_workers", max_n_links: "max_n_links" diff --git a/src/methods/multi_omics/celloracle_ns/run.sh b/src/methods/multi_omics/celloracle_ns/run.sh index bd5b3160a..98a914d6d 100644 --- a/src/methods/multi_omics/celloracle_ns/run.sh +++ b/src/methods/multi_omics/celloracle_ns/run.sh @@ -17,45 +17,26 @@ param_list: - id: ${RUN_ID} multiomics_rna: ${resources_dir}/grn-benchmark/multiomics_rna.h5ad multiomics_atac: ${resources_dir}/grn-benchmark/multiomics_atac.h5ad + tf_all: ${resources_dir}/prior/tf_all.csv num_workers: $num_workers temp_dir: ./tmp/grn output_state: "state.yaml" publish_dir: "$publish_dir" HERE -if [ "$submit" = true ]; then - nextflow run . \ - -main-script target/nextflow/workflows/grn_inference_celloracle/main.nf \ - -profile docker \ - -with-trace \ - -c src/common/nextflow_helpers/labels_ci.config \ - -params-file params/${RUN_ID}.yaml - - - ./tw-windows-x86_64.exe launch ` - https://github.com/openproblems-bio/task_grn_inference.git ` - --revision build/main ` - --pull-latest ` - --main-script target/nextflow/workflows/run_grn_inference/main.nf ` - --workspace 53907369739130 ` - --compute-env 6TeIFgV5OY4pJCk8I0bfOh ` - --params-file ./params/celloracle_test.yaml ` - --config src/common/nextflow_helpers/labels_tw.config -fi - - - -if [ "$read_results" = true ]; then - aws s3 sync s3://openproblems-data/resources/grn/results/${RUN_ID} ./resources/results/${RUN_ID} -fi - - -./tw-windows-x86_64.exe launch ` - https://github.com/openproblems-bio/task_grn_inference.git ` - --revision build/main ` - --pull-latest ` - --main-script target/nextflow/workflows/grn_inference_celloracle/main.nf ` - --workspace 53907369739130 ` - --compute-env 6TeIFgV5OY4pJCk8I0bfOh ` - --params-file ./params/celloracle.yaml ` - --config src/common/nextflow_helpers/labels_tw.config \ No newline at end of file +# nextflow run . \ +# -main-script target/nextflow/workflows/grn_inference_celloracle/main.nf \ +# -profile docker \ +# -with-trace \ +# -c src/common/nextflow_helpers/labels_ci.config \ +# -params-file params/${RUN_ID}.yaml + + +./tw launch https://github.com/openproblems-bio/task_grn_inference \ + --revision build/main \ + --pull-latest \ + --main-script target/nextflow/workflows/grn_inference_celloracle/main.nf \ + --workspace 53907369739130 \ + --compute-env 6TeIFgV5OY4pJCk8I0bfOh \ + --params-file ${param_file} \ + --config src/common/nextflow_helpers/labels_tw.config \ No newline at end of file