From 27cca4c118cba6a5f8e8b03d152070f83a44a9e5 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 18 Oct 2021 05:47:45 +0300 Subject: Migrate `export_informative` function Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/partial_correlations.py: Implement a mostly, bug-compatible `export_informative` function as part of migrating the partial correlations feature over to GN3 from GN1 * tests/unit/test_partial_correlations.py: Implement tests to ensure the code work in a similar manner as that one in GN1. --- gn3/partial_correlations.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 gn3/partial_correlations.py (limited to 'gn3') diff --git a/gn3/partial_correlations.py b/gn3/partial_correlations.py new file mode 100644 index 0000000..8c37886 --- /dev/null +++ b/gn3/partial_correlations.py @@ -0,0 +1,32 @@ +""" +This module deals with partial correlations. + +It is an attempt to migrate over the partial correlations feature from +GeneNetwork1. +""" + +from functools import reduce + +def export_informative(trait_data: dict, inc_var: bool = False) -> tuple: + """ + Export informative strain + + This is a migration of the `exportInformative` function in + web/webqtl/base/webqtlTrait.py module in GeneNetwork1. + + There is a chance that the original implementation has a bug, especially + dealing with the `inc_var` value. It the `inc_var` value is meant to control + the inclusion of the `variance` value, then the current implementation, and + that one in GN1 have a bug. + """ + def __exporter__(acc, data_item): + if not inc_var or data_item["variance"] is not None: + return ( + acc[0] + (data_item["sample_name"],), + acc[1] + (data_item["value"],), + acc[2] + (data_item["variance"],)) + return acc + return reduce( + __exporter__, + filter(lambda td: td["value"] is not None, trait_data["data"].values()), + (tuple(), tuple(), tuple())) -- cgit v1.2.3 From 157df453cdb84591cb44af9f1d2677cd0b2c0380 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 18 Oct 2021 12:17:11 +0300 Subject: Move 'export_trait_data' to 'gn3.db.traits' module Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/db/traits.py: Move function `export_trait_data` here * gn3/heatmaps.py: Remove function `export_trait_data` * tests/unit/db/test_traits.py: Move function `export_trait_data` tests here * tests/unit/test_heatmaps.py: Remove function `export_trait_data` here Function `export_trait_data` more closely corresponds to the traits and is used in more than just the `gn3.heatmaps` module. This commit moves the relevant code over to the `gn3.db.traits` module and also moves the tests to the corresponding tests modules. --- gn3/db/traits.py | 69 ++++++++++++++++++++++++++++++++++ gn3/heatmaps.py | 67 +-------------------------------- tests/unit/db/test_traits.py | 89 ++++++++++++++++++++++++++++++++++++++++++++ tests/unit/test_heatmaps.py | 87 ------------------------------------------- 4 files changed, 159 insertions(+), 153 deletions(-) (limited to 'gn3') diff --git a/gn3/db/traits.py b/gn3/db/traits.py index f2673c8..1e29aff 100644 --- a/gn3/db/traits.py +++ b/gn3/db/traits.py @@ -1,12 +1,81 @@ """This class contains functions relating to trait data manipulation""" import os +from functools import reduce from typing import Any, Dict, Union, Sequence + from gn3.settings import TMPDIR from gn3.random import random_string from gn3.function_helpers import compose from gn3.db.datasets import retrieve_trait_dataset +def export_trait_data( + trait_data: dict, samplelist: Sequence[str], dtype: str = "val", + var_exists: bool = False, n_exists: bool = False): + """ + Export data according to `samplelist`. Mostly used in calculating + correlations. + + DESCRIPTION: + Migrated from + https://github.com/genenetwork/genenetwork1/blob/master/web/webqtl/base/webqtlTrait.py#L166-L211 + + PARAMETERS + trait: (dict) + The dictionary of key-value pairs representing a trait + samplelist: (list) + A list of sample names + dtype: (str) + ... verify what this is ... + var_exists: (bool) + A flag indicating existence of variance + n_exists: (bool) + A flag indicating existence of ndata + """ + def __export_all_types(tdata, sample): + sample_data = [] + if tdata[sample]["value"]: + sample_data.append(tdata[sample]["value"]) + if var_exists: + if tdata[sample]["variance"]: + sample_data.append(tdata[sample]["variance"]) + else: + sample_data.append(None) + if n_exists: + if tdata[sample]["ndata"]: + sample_data.append(tdata[sample]["ndata"]) + else: + sample_data.append(None) + else: + if var_exists and n_exists: + sample_data += [None, None, None] + elif var_exists or n_exists: + sample_data += [None, None] + else: + sample_data.append(None) + + return tuple(sample_data) + + def __exporter(accumulator, sample): + # pylint: disable=[R0911] + if sample in trait_data["data"]: + if dtype == "val": + return accumulator + (trait_data["data"][sample]["value"], ) + if dtype == "var": + return accumulator + (trait_data["data"][sample]["variance"], ) + if dtype == "N": + return accumulator + (trait_data["data"][sample]["ndata"], ) + if dtype == "all": + return accumulator + __export_all_types(trait_data["data"], sample) + raise KeyError("Type `%s` is incorrect" % dtype) + if var_exists and n_exists: + return accumulator + (None, None, None) + if var_exists or n_exists: + return accumulator + (None, None) + return accumulator + (None,) + + return reduce(__exporter, samplelist, tuple()) + def get_trait_csv_sample_data(conn: Any, trait_name: int, phenotype_id: int): """Fetch a trait and return it as a csv string""" diff --git a/gn3/heatmaps.py b/gn3/heatmaps.py index adbfbc6..3b94e88 100644 --- a/gn3/heatmaps.py +++ b/gn3/heatmaps.py @@ -14,6 +14,7 @@ from plotly.subplots import make_subplots # type: ignore from gn3.settings import TMPDIR from gn3.random import random_string from gn3.computations.slink import slink +from gn3.db.traits import export_trait_data from gn3.computations.correlations2 import compute_correlation from gn3.db.genotypes import ( build_genotype_file, load_genotype_samples) @@ -26,72 +27,6 @@ from gn3.computations.qtlreaper import ( parse_reaper_main_results, organise_reaper_main_results) -def export_trait_data( - trait_data: dict, samplelist: Sequence[str], dtype: str = "val", - var_exists: bool = False, n_exists: bool = False): - """ - Export data according to `samplelist`. Mostly used in calculating - correlations. - - DESCRIPTION: - Migrated from - https://github.com/genenetwork/genenetwork1/blob/master/web/webqtl/base/webqtlTrait.py#L166-L211 - - PARAMETERS - trait: (dict) - The dictionary of key-value pairs representing a trait - samplelist: (list) - A list of sample names - dtype: (str) - ... verify what this is ... - var_exists: (bool) - A flag indicating existence of variance - n_exists: (bool) - A flag indicating existence of ndata - """ - def __export_all_types(tdata, sample): - sample_data = [] - if tdata[sample]["value"]: - sample_data.append(tdata[sample]["value"]) - if var_exists: - if tdata[sample]["variance"]: - sample_data.append(tdata[sample]["variance"]) - else: - sample_data.append(None) - if n_exists: - if tdata[sample]["ndata"]: - sample_data.append(tdata[sample]["ndata"]) - else: - sample_data.append(None) - else: - if var_exists and n_exists: - sample_data += [None, None, None] - elif var_exists or n_exists: - sample_data += [None, None] - else: - sample_data.append(None) - - return tuple(sample_data) - - def __exporter(accumulator, sample): - # pylint: disable=[R0911] - if sample in trait_data["data"]: - if dtype == "val": - return accumulator + (trait_data["data"][sample]["value"], ) - if dtype == "var": - return accumulator + (trait_data["data"][sample]["variance"], ) - if dtype == "N": - return accumulator + (trait_data["data"][sample]["ndata"], ) - if dtype == "all": - return accumulator + __export_all_types(trait_data["data"], sample) - raise KeyError("Type `%s` is incorrect" % dtype) - if var_exists and n_exists: - return accumulator + (None, None, None) - if var_exists or n_exists: - return accumulator + (None, None) - return accumulator + (None,) - - return reduce(__exporter, samplelist, tuple()) def trait_display_name(trait: Dict): """ diff --git a/tests/unit/db/test_traits.py b/tests/unit/db/test_traits.py index 8af8e82..0c4ef78 100644 --- a/tests/unit/db/test_traits.py +++ b/tests/unit/db/test_traits.py @@ -2,6 +2,7 @@ from unittest import mock, TestCase from gn3.db.traits import ( build_trait_name, + export_trait_data, set_haveinfo_field, update_sample_data, retrieve_trait_info, @@ -12,6 +13,38 @@ from gn3.db.traits import ( retrieve_publish_trait_info, retrieve_probeset_trait_info) +samplelist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] +trait_data = { + "mysqlid": 36688172, + "data": { + "B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None, "ndata": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None, "ndata": None}, + "BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None, "ndata": None}, + "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None, "ndata": None}, + "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None, "ndata": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None, "ndata": None}, + "BXD21": {"sample_name": "BXD21", "value": 8.93809, "variance": None, "ndata": None}, + "BXD24": {"sample_name": "BXD24", "value": 7.99415, "variance": None, "ndata": None}, + "BXD27": {"sample_name": "BXD27", "value": 8.12177, "variance": None, "ndata": None}, + "BXD28": {"sample_name": "BXD28", "value": 7.67688, "variance": None, "ndata": None}, + "BXD32": {"sample_name": "BXD32", "value": 7.79062, "variance": None, "ndata": None}, + "BXD39": {"sample_name": "BXD39", "value": 8.27641, "variance": None, "ndata": None}, + "BXD40": {"sample_name": "BXD40", "value": 8.18012, "variance": None, "ndata": None}, + "BXD42": {"sample_name": "BXD42", "value": 7.82433, "variance": None, "ndata": None}, + "BXD6": {"sample_name": "BXD6", "value": 8.09718, "variance": None, "ndata": None}, + "BXH14": {"sample_name": "BXH14", "value": 7.97475, "variance": None, "ndata": None}, + "BXH19": {"sample_name": "BXH19", "value": 7.67223, "variance": None, "ndata": None}, + "BXH2": {"sample_name": "BXH2", "value": 7.93622, "variance": None, "ndata": None}, + "BXH22": {"sample_name": "BXH22", "value": 7.43692, "variance": None, "ndata": None}, + "BXH4": {"sample_name": "BXH4", "value": 7.96336, "variance": None, "ndata": None}, + "BXH6": {"sample_name": "BXH6", "value": 7.75132, "variance": None, "ndata": None}, + "BXH7": {"sample_name": "BXH7", "value": 8.12927, "variance": None, "ndata": None}, + "BXH8": {"sample_name": "BXH8", "value": 6.77338, "variance": None, "ndata": None}, + "BXH9": {"sample_name": "BXH9", "value": 8.03836, "variance": None, "ndata": None}, + "C3H/HeJ": {"sample_name": "C3H/HeJ", "value": 7.42795, "variance": None, "ndata": None}, + "C57BL/6J": {"sample_name": "C57BL/6J", "value": 7.50606, "variance": None, "ndata": None}, + "DBA/2J": {"sample_name": "DBA/2J", "value": 7.72588, "variance": None, "ndata": None}}} + class TestTraitsDBFunctions(TestCase): "Test cases for traits functions" @@ -226,3 +259,59 @@ class TestTraitsDBFunctions(TestCase): with self.subTest(trait_info=trait_info, expected=expected): self.assertEqual( set_confidential_field(trait_type, trait_info), expected) + + def test_export_trait_data_dtype(self): + """ + Test `export_trait_data` with different values for the `dtype` keyword + argument + """ + for dtype, expected in [ + ["val", (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], + ["var", (None, None, None, None, None, None)], + ["N", (None, None, None, None, None, None)], + ["all", (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)]]: + with self.subTest(dtype=dtype): + self.assertEqual( + export_trait_data(trait_data, samplelist, dtype=dtype), + expected) + + def test_export_trait_data_dtype_all_flags(self): + """ + Test `export_trait_data` with different values for the `dtype` keyword + argument and the different flags set up + """ + for dtype, vflag, nflag, expected in [ + ["val", False, False, + (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], + ["val", False, True, + (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], + ["val", True, False, + (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], + ["val", True, True, + (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], + ["var", False, False, (None, None, None, None, None, None)], + ["var", False, True, (None, None, None, None, None, None)], + ["var", True, False, (None, None, None, None, None, None)], + ["var", True, True, (None, None, None, None, None, None)], + ["N", False, False, (None, None, None, None, None, None)], + ["N", False, True, (None, None, None, None, None, None)], + ["N", True, False, (None, None, None, None, None, None)], + ["N", True, True, (None, None, None, None, None, None)], + ["all", False, False, + (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], + ["all", False, True, + (7.51879, None, 7.77141, None, 8.39265, None, 8.17443, None, + 8.30401, None, 7.80944, None)], + ["all", True, False, + (7.51879, None, 7.77141, None, 8.39265, None, 8.17443, None, + 8.30401, None, 7.80944, None)], + ["all", True, True, + (7.51879, None, None, 7.77141, None, None, 8.39265, None, None, + 8.17443, None, None, 8.30401, None, None, 7.80944, None, None)] + ]: + with self.subTest(dtype=dtype, vflag=vflag, nflag=nflag): + self.assertEqual( + export_trait_data( + trait_data, samplelist, dtype=dtype, var_exists=vflag, + n_exists=nflag), + expected) diff --git a/tests/unit/test_heatmaps.py b/tests/unit/test_heatmaps.py index 7b66688..03fd4a6 100644 --- a/tests/unit/test_heatmaps.py +++ b/tests/unit/test_heatmaps.py @@ -4,43 +4,12 @@ from gn3.heatmaps import ( cluster_traits, get_loci_names, get_lrs_from_chr, - export_trait_data, compute_traits_order, retrieve_samples_and_values, process_traits_data_for_heatmap) from tests.unit.sample_test_data import organised_trait_1, organised_trait_2 samplelist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] -trait_data = { - "mysqlid": 36688172, - "data": { - "B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None, "ndata": None}, - "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None, "ndata": None}, - "BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None, "ndata": None}, - "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None, "ndata": None}, - "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None, "ndata": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None, "ndata": None}, - "BXD21": {"sample_name": "BXD21", "value": 8.93809, "variance": None, "ndata": None}, - "BXD24": {"sample_name": "BXD24", "value": 7.99415, "variance": None, "ndata": None}, - "BXD27": {"sample_name": "BXD27", "value": 8.12177, "variance": None, "ndata": None}, - "BXD28": {"sample_name": "BXD28", "value": 7.67688, "variance": None, "ndata": None}, - "BXD32": {"sample_name": "BXD32", "value": 7.79062, "variance": None, "ndata": None}, - "BXD39": {"sample_name": "BXD39", "value": 8.27641, "variance": None, "ndata": None}, - "BXD40": {"sample_name": "BXD40", "value": 8.18012, "variance": None, "ndata": None}, - "BXD42": {"sample_name": "BXD42", "value": 7.82433, "variance": None, "ndata": None}, - "BXD6": {"sample_name": "BXD6", "value": 8.09718, "variance": None, "ndata": None}, - "BXH14": {"sample_name": "BXH14", "value": 7.97475, "variance": None, "ndata": None}, - "BXH19": {"sample_name": "BXH19", "value": 7.67223, "variance": None, "ndata": None}, - "BXH2": {"sample_name": "BXH2", "value": 7.93622, "variance": None, "ndata": None}, - "BXH22": {"sample_name": "BXH22", "value": 7.43692, "variance": None, "ndata": None}, - "BXH4": {"sample_name": "BXH4", "value": 7.96336, "variance": None, "ndata": None}, - "BXH6": {"sample_name": "BXH6", "value": 7.75132, "variance": None, "ndata": None}, - "BXH7": {"sample_name": "BXH7", "value": 8.12927, "variance": None, "ndata": None}, - "BXH8": {"sample_name": "BXH8", "value": 6.77338, "variance": None, "ndata": None}, - "BXH9": {"sample_name": "BXH9", "value": 8.03836, "variance": None, "ndata": None}, - "C3H/HeJ": {"sample_name": "C3H/HeJ", "value": 7.42795, "variance": None, "ndata": None}, - "C57BL/6J": {"sample_name": "C57BL/6J", "value": 7.50606, "variance": None, "ndata": None}, - "DBA/2J": {"sample_name": "DBA/2J", "value": 7.72588, "variance": None, "ndata": None}}} slinked = ( (((0, 2, 0.16381088984330505), @@ -55,62 +24,6 @@ slinked = ( class TestHeatmap(TestCase): """Class for testing heatmap computation functions""" - def test_export_trait_data_dtype(self): - """ - Test `export_trait_data` with different values for the `dtype` keyword - argument - """ - for dtype, expected in [ - ["val", (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], - ["var", (None, None, None, None, None, None)], - ["N", (None, None, None, None, None, None)], - ["all", (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)]]: - with self.subTest(dtype=dtype): - self.assertEqual( - export_trait_data(trait_data, samplelist, dtype=dtype), - expected) - - def test_export_trait_data_dtype_all_flags(self): - """ - Test `export_trait_data` with different values for the `dtype` keyword - argument and the different flags set up - """ - for dtype, vflag, nflag, expected in [ - ["val", False, False, - (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], - ["val", False, True, - (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], - ["val", True, False, - (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], - ["val", True, True, - (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], - ["var", False, False, (None, None, None, None, None, None)], - ["var", False, True, (None, None, None, None, None, None)], - ["var", True, False, (None, None, None, None, None, None)], - ["var", True, True, (None, None, None, None, None, None)], - ["N", False, False, (None, None, None, None, None, None)], - ["N", False, True, (None, None, None, None, None, None)], - ["N", True, False, (None, None, None, None, None, None)], - ["N", True, True, (None, None, None, None, None, None)], - ["all", False, False, - (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], - ["all", False, True, - (7.51879, None, 7.77141, None, 8.39265, None, 8.17443, None, - 8.30401, None, 7.80944, None)], - ["all", True, False, - (7.51879, None, 7.77141, None, 8.39265, None, 8.17443, None, - 8.30401, None, 7.80944, None)], - ["all", True, True, - (7.51879, None, None, 7.77141, None, None, 8.39265, None, None, - 8.17443, None, None, 8.30401, None, None, 7.80944, None, None)] - ]: - with self.subTest(dtype=dtype, vflag=vflag, nflag=nflag): - self.assertEqual( - export_trait_data( - trait_data, samplelist, dtype=dtype, var_exists=vflag, - n_exists=nflag), - expected) - def test_cluster_traits(self): """ Test that the clustering is working as expected. -- cgit v1.2.3 From 94ca79045baf978d6aab964c7c70b84911c1124f Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 18 Oct 2021 12:27:32 +0300 Subject: Move `export_informative` function to `gn3.db.traits` module Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/db/traits.py: Move `export_informative` function here * gn3/partial_correlations.py: Remove `export_informative` function * tests/unit/db/test_traits.py: Move `export_informative` function tests here * tests/unit/test_partial_correlations.py: Remove `export_informative` function tests The `export_informative` function relates more to the traits than to the partial correlations, and could find use in more than just the partial correlations stuff. This commit moves the function to the more traits-specific `gn3.db.traits` module. --- gn3/db/traits.py | 24 +++++++++ gn3/partial_correlations.py | 24 --------- tests/unit/db/test_traits.py | 86 ++++++++++++++++++++++++++++++++ tests/unit/test_partial_correlations.py | 87 +-------------------------------- 4 files changed, 111 insertions(+), 110 deletions(-) (limited to 'gn3') diff --git a/gn3/db/traits.py b/gn3/db/traits.py index 1e29aff..1c6aaa7 100644 --- a/gn3/db/traits.py +++ b/gn3/db/traits.py @@ -743,3 +743,27 @@ def generate_traits_filename(base_path: str = TMPDIR): """Generate a unique filename for use with generated traits files.""" return "{}/traits_test_file_{}.txt".format( os.path.abspath(base_path), random_string(10)) + +def export_informative(trait_data: dict, inc_var: bool = False) -> tuple: + """ + Export informative strain + + This is a migration of the `exportInformative` function in + web/webqtl/base/webqtlTrait.py module in GeneNetwork1. + + There is a chance that the original implementation has a bug, especially + dealing with the `inc_var` value. It the `inc_var` value is meant to control + the inclusion of the `variance` value, then the current implementation, and + that one in GN1 have a bug. + """ + def __exporter__(acc, data_item): + if not inc_var or data_item["variance"] is not None: + return ( + acc[0] + (data_item["sample_name"],), + acc[1] + (data_item["value"],), + acc[2] + (data_item["variance"],)) + return acc + return reduce( + __exporter__, + filter(lambda td: td["value"] is not None, trait_data["data"].values()), + (tuple(), tuple(), tuple())) diff --git a/gn3/partial_correlations.py b/gn3/partial_correlations.py index 8c37886..df390ed 100644 --- a/gn3/partial_correlations.py +++ b/gn3/partial_correlations.py @@ -6,27 +6,3 @@ GeneNetwork1. """ from functools import reduce - -def export_informative(trait_data: dict, inc_var: bool = False) -> tuple: - """ - Export informative strain - - This is a migration of the `exportInformative` function in - web/webqtl/base/webqtlTrait.py module in GeneNetwork1. - - There is a chance that the original implementation has a bug, especially - dealing with the `inc_var` value. It the `inc_var` value is meant to control - the inclusion of the `variance` value, then the current implementation, and - that one in GN1 have a bug. - """ - def __exporter__(acc, data_item): - if not inc_var or data_item["variance"] is not None: - return ( - acc[0] + (data_item["sample_name"],), - acc[1] + (data_item["value"],), - acc[2] + (data_item["variance"],)) - return acc - return reduce( - __exporter__, - filter(lambda td: td["value"] is not None, trait_data["data"].values()), - (tuple(), tuple(), tuple())) diff --git a/tests/unit/db/test_traits.py b/tests/unit/db/test_traits.py index 0c4ef78..67f0c6f 100644 --- a/tests/unit/db/test_traits.py +++ b/tests/unit/db/test_traits.py @@ -3,6 +3,7 @@ from unittest import mock, TestCase from gn3.db.traits import ( build_trait_name, export_trait_data, + export_informative, set_haveinfo_field, update_sample_data, retrieve_trait_info, @@ -315,3 +316,88 @@ class TestTraitsDBFunctions(TestCase): trait_data, samplelist, dtype=dtype, var_exists=vflag, n_exists=nflag), expected) + + def test_export_informative(self): + """Test that the function exports appropriate data.""" + for trait_data, inc_var, expected in [ + [{"data": { + "sample1": { + "sample_name": "sample1", "value": 9, "variance": None, + "ndata": 13 + }, + "sample2": { + "sample_name": "sample2", "value": 8, "variance": None, + "ndata": 13 + }, + "sample3": { + "sample_name": "sample3", "value": 7, "variance": None, + "ndata": 13 + }, + "sample4": { + "sample_name": "sample4", "value": 6, "variance": None, + "ndata": 13 + }, + }}, 0, ( + ("sample1", "sample2", "sample3", "sample4"), (9, 8, 7, 6), + (None, None, None, None))], + [{"data": { + "sample1": { + "sample_name": "sample1", "value": 9, "variance": None, + "ndata": 13 + }, + "sample2": { + "sample_name": "sample2", "value": 8, "variance": None, + "ndata": 13 + }, + "sample3": { + "sample_name": "sample3", "value": None, "variance": None, + "ndata": 13 + }, + "sample4": { + "sample_name": "sample4", "value": 6, "variance": None, + "ndata": 13 + }, + }}, 0, ( + ("sample1", "sample2", "sample4"), (9, 8, 6), + (None, None, None))], + [{"data": { + "sample1": { + "sample_name": "sample1", "value": 9, "variance": None, + "ndata": 13 + }, + "sample2": { + "sample_name": "sample2", "value": 8, "variance": None, + "ndata": 13 + }, + "sample3": { + "sample_name": "sample3", "value": 7, "variance": None, + "ndata": 13 + }, + "sample4": { + "sample_name": "sample4", "value": 6, "variance": None, + "ndata": 13 + }, + }}, True, (tuple(), tuple(), tuple())], + [{"data": { + "sample1": { + "sample_name": "sample1", "value": 9, "variance": None, + "ndata": 13 + }, + "sample2": { + "sample_name": "sample2", "value": 8, "variance": 0.657, + "ndata": 13 + }, + "sample3": { + "sample_name": "sample3", "value": 7, "variance": None, + "ndata": 13 + }, + "sample4": { + "sample_name": "sample4", "value": 6, "variance": None, + "ndata": 13 + }, + }}, 0, ( + ("sample1", "sample2", "sample3", "sample4"), (9, 8, 7, 6), + (None, 0.657, None, None))]]: + with self.subTest(trait_data=trait_data): + self.assertEqual( + export_informative(trait_data, inc_var), expected) diff --git a/tests/unit/test_partial_correlations.py b/tests/unit/test_partial_correlations.py index 6eea078..f204d4f 100644 --- a/tests/unit/test_partial_correlations.py +++ b/tests/unit/test_partial_correlations.py @@ -1,92 +1,7 @@ """Module contains tests for gn3.partial_correlations""" from unittest import TestCase -from gn3.partial_correlations import export_informative + class TestPartialCorrelations(TestCase): """Class for testing partial correlations computation functions""" - - def test_export_informative(self): - """Test that the function exports appropriate data.""" - for trait_data, inc_var, expected in [ - [{"data": { - "sample1": { - "sample_name": "sample1", "value": 9, "variance": None, - "ndata": 13 - }, - "sample2": { - "sample_name": "sample2", "value": 8, "variance": None, - "ndata": 13 - }, - "sample3": { - "sample_name": "sample3", "value": 7, "variance": None, - "ndata": 13 - }, - "sample4": { - "sample_name": "sample4", "value": 6, "variance": None, - "ndata": 13 - }, - }}, 0, ( - ("sample1", "sample2", "sample3", "sample4"), (9, 8, 7, 6), - (None, None, None, None))], - [{"data": { - "sample1": { - "sample_name": "sample1", "value": 9, "variance": None, - "ndata": 13 - }, - "sample2": { - "sample_name": "sample2", "value": 8, "variance": None, - "ndata": 13 - }, - "sample3": { - "sample_name": "sample3", "value": None, "variance": None, - "ndata": 13 - }, - "sample4": { - "sample_name": "sample4", "value": 6, "variance": None, - "ndata": 13 - }, - }}, 0, ( - ("sample1", "sample2", "sample4"), (9, 8, 6), - (None, None, None))], - [{"data": { - "sample1": { - "sample_name": "sample1", "value": 9, "variance": None, - "ndata": 13 - }, - "sample2": { - "sample_name": "sample2", "value": 8, "variance": None, - "ndata": 13 - }, - "sample3": { - "sample_name": "sample3", "value": 7, "variance": None, - "ndata": 13 - }, - "sample4": { - "sample_name": "sample4", "value": 6, "variance": None, - "ndata": 13 - }, - }}, True, (tuple(), tuple(), tuple())], - [{"data": { - "sample1": { - "sample_name": "sample1", "value": 9, "variance": None, - "ndata": 13 - }, - "sample2": { - "sample_name": "sample2", "value": 8, "variance": 0.657, - "ndata": 13 - }, - "sample3": { - "sample_name": "sample3", "value": 7, "variance": None, - "ndata": 13 - }, - "sample4": { - "sample_name": "sample4", "value": 6, "variance": None, - "ndata": 13 - }, - }}, 0, ( - ("sample1", "sample2", "sample3", "sample4"), (9, 8, 7, 6), - (None, 0.657, None, None))]]: - with self.subTest(trait_data=trait_data): - self.assertEqual( - export_informative(trait_data, inc_var), expected) -- cgit v1.2.3 From 1544776b072d7240773cf14d423078841e4c1a07 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 18 Oct 2021 14:14:04 +0300 Subject: Implement `control_samples` function as is in GN1 Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/partial_correlations.py: Implement `control_samples` function * tests/unit/test_partial_correlations.py: add tests for `control_samples` function Implement the function `control_samples` and make it mostly bug-compatible with the `web/webqtl/correlation/correlationFunction.controlStrain` function in GN1. This implementation in GN3 does not do any calls to the database. It will rely on other functions to provide the data from the database to it. --- gn3/partial_correlations.py | 38 ++++++++++++++++ tests/unit/test_partial_correlations.py | 80 +++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+) (limited to 'gn3') diff --git a/gn3/partial_correlations.py b/gn3/partial_correlations.py index df390ed..99521c6 100644 --- a/gn3/partial_correlations.py +++ b/gn3/partial_correlations.py @@ -5,4 +5,42 @@ It is an attempt to migrate over the partial correlations feature from GeneNetwork1. """ +from typing import Sequence from functools import reduce + +def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): + """ + Fetches data for the control traits. + + This migrates `web/webqtl/correlation/correlationFunction.controlStrain` in + GN1, with a few modifications to the arguments passed in. + + PARAMETERS: + controls: A map of sample names to trait data. Equivalent to the `cvals` + value in the corresponding source function in GN1. + sampleslist: A list of samples. Equivalent to `strainlst` in the + corresponding source function in GN1 + """ + def __process_control__(trait_data): + def __process_sample__(acc, sample): + if sample in trait_data["data"].keys(): + sample_item = trait_data["data"][sample] + val = sample_item["value"] + if val is not None: + return ( + acc[0] + (sample,), + acc[1] + (val,), + acc[2] + (sample_item["variance"],)) + return acc + return reduce( + __process_sample__, sampleslist, (tuple(), tuple(), tuple())) + + return reduce( + lambda acc, item: ( + acc[0] + (item[0],), + acc[1] + (item[1],), + acc[2] + (item[2],), + acc[3] + (len(item[0]),), + ), + [__process_control__(trait_data) for trait_data in controls], + (tuple(), tuple(), tuple(), tuple())) diff --git a/tests/unit/test_partial_correlations.py b/tests/unit/test_partial_correlations.py index f204d4f..0083ef7 100644 --- a/tests/unit/test_partial_correlations.py +++ b/tests/unit/test_partial_correlations.py @@ -1,7 +1,87 @@ """Module contains tests for gn3.partial_correlations""" from unittest import TestCase +from gn3.partial_correlations import control_samples +sampleslist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] +control_traits = ( + { + "mysqlid": 36688172, + "data": { + "B6cC3-1": { + "sample_name": "B6cC3-1", "value": 7.51879, "variance": None, + "ndata": None}, + "BXD1": { + "sample_name": "BXD1", "value": 7.77141, "variance": None, + "ndata": None}, + "BXD12": { + "sample_name": "BXD12", "value": 8.39265, "variance": None, + "ndata": None}, + "BXD16": { + "sample_name": "BXD16", "value": 8.17443, "variance": None, + "ndata": None}, + "BXD19": { + "sample_name": "BXD19", "value": 8.30401, "variance": None, + "ndata": None}, + "BXD2": { + "sample_name": "BXD2", "value": 7.80944, "variance": None, + "ndata": None}}}, + { + "mysqlid": 36688172, + "data": { + "B6cC3-21": { + "sample_name": "B6cC3-1", "value": 7.51879, "variance": None, + "ndata": None}, + "BXD21": { + "sample_name": "BXD1", "value": 7.77141, "variance": None, + "ndata": None}, + "BXD12": { + "sample_name": "BXD12", "value": 8.39265, "variance": None, + "ndata": None}, + "BXD16": { + "sample_name": "BXD16", "value": 8.17443, "variance": None, + "ndata": None}, + "BXD19": { + "sample_name": "BXD19", "value": 8.30401, "variance": None, + "ndata": None}, + "BXD2": { + "sample_name": "BXD2", "value": 7.80944, "variance": None, + "ndata": None}}}, + { + "mysqlid": 36688172, + "data": { + "B6cC3-1": { + "sample_name": "B6cC3-1", "value": 7.51879, "variance": None, + "ndata": None}, + "BXD1": { + "sample_name": "BXD1", "value": 7.77141, "variance": None, + "ndata": None}, + "BXD12": { + "sample_name": "BXD12", "value": None, "variance": None, + "ndata": None}, + "BXD16": { + "sample_name": "BXD16", "value": None, "variance": None, + "ndata": None}, + "BXD19": { + "sample_name": "BXD19", "value": None, "variance": None, + "ndata": None}, + "BXD2": { + "sample_name": "BXD2", "value": 7.80944, "variance": None, + "ndata": None}}}) class TestPartialCorrelations(TestCase): """Class for testing partial correlations computation functions""" + + def test_control_samples(self): + """Test that the control_samples works as expected.""" + self.assertEqual( + control_samples(control_traits, sampleslist), + ((("B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"), + ("BXD12", "BXD16", "BXD19", "BXD2"), + ("B6cC3-1", "BXD1", "BXD2")), + ((7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944), + (8.39265, 8.17443, 8.30401, 7.80944), + (7.51879, 7.77141, 7.80944)), + ((None, None, None, None, None, None), (None, None, None, None), + (None, None, None)), + (6, 4, 3))) -- cgit v1.2.3 From 3304fa682924b8f6bff5126ecf2fb58f4201b968 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 19 Oct 2021 09:16:38 +0300 Subject: Implement `dictify_by_samples` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/partial_correlations.py: implement `dictify_by_samples` function * tests/unit/test_partial_correlations.py: implement tests for `dictify_by_samples` function Implement the `dictify_by_samples` function as a partial migration of the `web.webqtl.correlation.correlationFunction.fixStrains` function from GN1. --- gn3/partial_correlations.py | 16 +++++++++++++ tests/unit/test_partial_correlations.py | 42 ++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/partial_correlations.py b/gn3/partial_correlations.py index 99521c6..4db4807 100644 --- a/gn3/partial_correlations.py +++ b/gn3/partial_correlations.py @@ -44,3 +44,19 @@ def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): ), [__process_control__(trait_data) for trait_data in controls], (tuple(), tuple(), tuple(), tuple())) + +def dictify_by_samples(samples_vals_vars: Sequence[Sequence]) -> dict: + """ + Build a sequence of dictionaries from a sequence of separate sequences of + samples, values and variances. + + This is a partial migration of + `web.webqtl.correlation.correlationFunction.fixStrains` function in GN1. + This implementation extracts code that will find common use, and that will + find use in more than one place. + """ + return tuple( + { + sample: {"sample_name": sample, "value": val, "variance": var} + for sample, val, var in zip(*trait_line) + } for trait_line in zip(*(samples_vals_vars[0:3]))) diff --git a/tests/unit/test_partial_correlations.py b/tests/unit/test_partial_correlations.py index 0083ef7..6302f74 100644 --- a/tests/unit/test_partial_correlations.py +++ b/tests/unit/test_partial_correlations.py @@ -1,7 +1,7 @@ """Module contains tests for gn3.partial_correlations""" from unittest import TestCase -from gn3.partial_correlations import control_samples +from gn3.partial_correlations import control_samples, dictify_by_samples sampleslist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] control_traits = ( @@ -85,3 +85,43 @@ class TestPartialCorrelations(TestCase): ((None, None, None, None, None, None), (None, None, None, None), (None, None, None)), (6, 4, 3))) + + def test_dictify_by_samples(self): + """ + Given: + a sequence of sequences with sample names, values and variances, as + in the output of `gn3.partial_correlations.control_samples` or + the output of `gn3.db.traits.export_informative` + When: + the sequence is passed as an argument into the + `gn3.partial_correlations.dictify_by_sample` + Then: + return a sequence of dicts with keys being the values of the sample + names, and each of who's values being sub-dicts with the keys + 'sample_name', 'value' and 'variance' whose values correspond to the + values passed in. + """ + self.assertEqual( + dictify_by_samples( + ((("B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"), + ("BXD12", "BXD16", "BXD19", "BXD2"), + ("B6cC3-1", "BXD1", "BXD2")), + ((7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944), + (8.39265, 8.17443, 8.30401, 7.80944), + (7.51879, 7.77141, 7.80944)), + ((None, None, None, None, None, None), (None, None, None, None), + (None, None, None)), + (6, 4, 3))), + ({"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, + "BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, + "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, + "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, + {"BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, + "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, + "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, + {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}})) -- cgit v1.2.3 From fe39bccc23186d0a0f0b51a792d4577aaca88bd1 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 4 Oct 2021 04:46:14 +0300 Subject: Remove file I/O statements Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/non-clustered-heatmaps-and-flipping.gmi * Remove file I/O from the function. If file I/O is needed, it will be provided outside of this function. --- gn3/heatmaps.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gn3') diff --git a/gn3/heatmaps.py b/gn3/heatmaps.py index adbfbc6..42231bf 100644 --- a/gn3/heatmaps.py +++ b/gn3/heatmaps.py @@ -224,7 +224,6 @@ def build_heatmap(traits_names, conn: Any): process_traits_data_for_heatmap( organised, traits_ids, chromosome_names), clustered, - "single_heatmap_{}".format(random_string(10)), y_axis=tuple( ordered_traits_names[traits_ids[order]] for order in traits_order), @@ -355,6 +354,9 @@ def generate_clustered_heatmap( loci_names: Sequence[Sequence[str]] = tuple(), output_dir: str = TMPDIR, colorscale=((0.0, '#0000FF'), (0.5, '#00FF00'), (1.0, '#FF0000'))): + data, clustering_data, x_axis=None, x_label: str = "", y_axis=None, + y_label: str = "", loci_names: Sequence[Sequence[str]] = tuple(), + colorscale=((0.0, '#0000FF'), (0.5, '#00FF00'), (1.0, '#FF0000'))): """ Generate a dendrogram, and heatmaps for each chromosome, and put them all into one plot. @@ -419,6 +421,4 @@ def generate_clustered_heatmap( showlegend=True, showscale=True, selector={"name": x_axis[-1]}) - image_filename = "{}/{}.html".format(output_dir, image_filename_prefix) - fig.write_html(image_filename) - return image_filename, fig + return fig -- cgit v1.2.3 From 0797e53220046d8f36a45d8b09b395b156d8fde7 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 4 Oct 2021 06:00:11 +0300 Subject: Add typing. Simplify arguments. Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/non-clustered-heatmaps-and-flipping.gmi * Add type-hints to the functions * Merge the axis data and labels to simpler dict arguments to reduce number of parameters to the function. --- gn3/heatmaps.py | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) (limited to 'gn3') diff --git a/gn3/heatmaps.py b/gn3/heatmaps.py index 42231bf..00f4353 100644 --- a/gn3/heatmaps.py +++ b/gn3/heatmaps.py @@ -168,7 +168,7 @@ def get_loci_names( __get_trait_loci, [v[1] for v in organised.items()], {}) return tuple(loci_dict[_chr] for _chr in chromosome_names) -def build_heatmap(traits_names, conn: Any): +def build_heatmap(traits_names: Sequence[str], conn: Any) -> go.Figure: """ heatmap function @@ -220,16 +220,20 @@ def build_heatmap(traits_names, conn: Any): zip(traits_ids, [traits[idx]["trait_fullname"] for idx in traits_order])) - return generate_clustered_heatmap( + return clustered_heatmap( process_traits_data_for_heatmap( organised, traits_ids, chromosome_names), clustered, - y_axis=tuple( - ordered_traits_names[traits_ids[order]] - for order in traits_order), - y_label="Traits", - x_axis=chromosome_names, - x_label="Chromosomes", + x_axis={ + "label": "Chromosomes", + "data": chromosome_names + }, + y_axis={ + "label": "Traits", + "data": tuple( + ordered_traits_names[traits_ids[order]] + for order in traits_order) + }, loci_names=get_loci_names(organised, chromosome_names)) def compute_traits_order(slink_data, neworder: tuple = tuple()): @@ -348,37 +352,37 @@ def process_traits_data_for_heatmap(data, trait_names, chromosome_names): for chr_name in chromosome_names] return hdata -def generate_clustered_heatmap( - data, clustering_data, image_filename_prefix, x_axis=None, - x_label: str = "", y_axis=None, y_label: str = "", +def clustered_heatmap( + data: Sequence[Sequence[float]], clustering_data: Sequence[float], + x_axis,#: Dict[Union[str, int], Union[str, Sequence[str]]], + y_axis: Dict[str, Union[str, Sequence[str]]], loci_names: Sequence[Sequence[str]] = tuple(), - output_dir: str = TMPDIR, - colorscale=((0.0, '#0000FF'), (0.5, '#00FF00'), (1.0, '#FF0000'))): - data, clustering_data, x_axis=None, x_label: str = "", y_axis=None, - y_label: str = "", loci_names: Sequence[Sequence[str]] = tuple(), - colorscale=((0.0, '#0000FF'), (0.5, '#00FF00'), (1.0, '#FF0000'))): + colorscale: Sequence[Sequence[Union[float, str]]] = ( + (0.0, '#0000FF'), (0.5, '#00FF00'), (1.0, '#FF0000'))) -> go.Figure: """ Generate a dendrogram, and heatmaps for each chromosome, and put them all into one plot. """ # pylint: disable=[R0913, R0914] - num_cols = 1 + len(x_axis) + x_axis_data = x_axis["data"] + y_axis_data = y_axis["data"] + num_cols = 1 + len(x_axis_data) fig = make_subplots( rows=1, cols=num_cols, shared_yaxes="rows", horizontal_spacing=0.001, - subplot_titles=["distance"] + x_axis, + subplot_titles=["distance"] + x_axis_data, figure=ff.create_dendrogram( - np.array(clustering_data), orientation="right", labels=y_axis)) + np.array(clustering_data), orientation="right", labels=y_axis_data)) hms = [go.Heatmap( name=chromo, x=loci, - y=y_axis, + y=y_axis_data, z=data_array, showscale=False) for chromo, data_array, loci - in zip(x_axis, data, loci_names)] + in zip(x_axis_data, data, loci_names)] for i, heatmap in enumerate(hms): fig.add_trace(heatmap, row=1, col=(i + 2)) @@ -389,10 +393,10 @@ def generate_clustered_heatmap( "xaxis": { "mirror": False, "showgrid": True, - "title": x_label + "title": x_axis["label"] }, "yaxis": { - "title": y_label + "title": y_axis["label"] } }) @@ -420,5 +424,5 @@ def generate_clustered_heatmap( fig.update_traces( showlegend=True, showscale=True, - selector={"name": x_axis[-1]}) + selector={"name": x_axis_data[-1]}) return fig -- cgit v1.2.3 From f71c0d5b04a2bb504acf306be11705ae0515aa14 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 4 Oct 2021 06:28:25 +0300 Subject: Swap axis labels Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/non-clustered-heatmaps-and-flipping.gmi * Switch the axis labels to make them less confusing for the user. --- gn3/heatmaps.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gn3') diff --git a/gn3/heatmaps.py b/gn3/heatmaps.py index 00f4353..7e7113d 100644 --- a/gn3/heatmaps.py +++ b/gn3/heatmaps.py @@ -372,7 +372,7 @@ def clustered_heatmap( cols=num_cols, shared_yaxes="rows", horizontal_spacing=0.001, - subplot_titles=["distance"] + x_axis_data, + subplot_titles=[x_axis["label"]] + x_axis_data, figure=ff.create_dendrogram( np.array(clustering_data), orientation="right", labels=y_axis_data)) hms = [go.Heatmap( @@ -393,7 +393,7 @@ def clustered_heatmap( "xaxis": { "mirror": False, "showgrid": True, - "title": x_axis["label"] + "title": "Distance" }, "yaxis": { "title": y_axis["label"] -- cgit v1.2.3 From aeefaad0629ca29e81ac3f0dbe882d7bf09b8711 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 4 Oct 2021 12:03:42 +0300 Subject: Enable vertical orientation of heatmaps Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/non-clustered-heatmaps-and-flipping.gmi * Update the code to enable the generation of the heatmap in both the horizontal and vertical orientations. --- gn3/heatmaps.py | 91 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 52 insertions(+), 39 deletions(-) (limited to 'gn3') diff --git a/gn3/heatmaps.py b/gn3/heatmaps.py index 7e7113d..ff65652 100644 --- a/gn3/heatmaps.py +++ b/gn3/heatmaps.py @@ -168,7 +168,9 @@ def get_loci_names( __get_trait_loci, [v[1] for v in organised.items()], {}) return tuple(loci_dict[_chr] for _chr in chromosome_names) -def build_heatmap(traits_names: Sequence[str], conn: Any) -> go.Figure: +def build_heatmap( + traits_names: Sequence[str], conn: Any, + vertical: bool = False) -> go.Figure: """ heatmap function @@ -234,6 +236,7 @@ def build_heatmap(traits_names: Sequence[str], conn: Any) -> go.Figure: ordered_traits_names[traits_ids[order]] for order in traits_order) }, + vertical=vertical, loci_names=get_loci_names(organised, chromosome_names)) def compute_traits_order(slink_data, neworder: tuple = tuple()): @@ -357,6 +360,7 @@ def clustered_heatmap( x_axis,#: Dict[Union[str, int], Union[str, Sequence[str]]], y_axis: Dict[str, Union[str, Sequence[str]]], loci_names: Sequence[Sequence[str]] = tuple(), + vertical: bool = False, colorscale: Sequence[Sequence[Union[float, str]]] = ( (0.0, '#0000FF'), (0.5, '#00FF00'), (1.0, '#FF0000'))) -> go.Figure: """ @@ -366,57 +370,66 @@ def clustered_heatmap( # pylint: disable=[R0913, R0914] x_axis_data = x_axis["data"] y_axis_data = y_axis["data"] - num_cols = 1 + len(x_axis_data) + num_plots = 1 + len(x_axis_data) fig = make_subplots( - rows=1, - cols=num_cols, - shared_yaxes="rows", + rows=num_plots if vertical else 1, + cols=1 if vertical else num_plots, + shared_xaxes = "columns" if vertical else False, + shared_yaxes = False if vertical else "rows", + vertical_spacing=0.010, horizontal_spacing=0.001, - subplot_titles=[x_axis["label"]] + x_axis_data, + subplot_titles=["" if vertical else x_axis["label"]] + [ + "Chromosome: {}".format(chromo) if vertical else chromo + for chromo in x_axis_data],#+ x_axis_data, figure=ff.create_dendrogram( - np.array(clustering_data), orientation="right", labels=y_axis_data)) + np.array(clustering_data), + orientation="bottom" if vertical else "right", + labels=y_axis_data)) hms = [go.Heatmap( name=chromo, - x=loci, - y=y_axis_data, + x=y_axis_data if vertical else loci, + y=loci if vertical else y_axis_data, z=data_array, + transpose=vertical, showscale=False) for chromo, data_array, loci in zip(x_axis_data, data, loci_names)] for i, heatmap in enumerate(hms): - fig.add_trace(heatmap, row=1, col=(i + 2)) - - fig.update_layout( - { - "width": 1500, - "height": 800, - "xaxis": { + fig.add_trace( + heatmap, + row=((i + 2) if vertical else 1), + col=(1 if vertical else (i + 2))) + + axes_layouts = { + "{axis}axis{count}".format( + axis=("y" if vertical else "x"), + count=(i+1 if i > 0 else "")): { "mirror": False, - "showgrid": True, - "title": "Distance" - }, - "yaxis": { - "title": y_axis["label"] - } - }) - - x_axes_layouts = { - "xaxis{}".format(i+1 if i > 0 else ""): { - "mirror": False, - "showticklabels": i == 0, - "ticks": "outside" if i == 0 else "" + "showticklabels": i == 0, + "ticks": "outside" if i == 0 else "" } - for i in range(num_cols)} + for i in range(num_plots)} - fig.update_layout( - { - "width": 4000, - "height": 800, - "yaxis": { - "mirror": False, - "ticks": "" - }, - **x_axes_layouts}) + print("vertical?: {} ==> {}".format("T" if vertical else "F", axes_layouts)) + + fig.update_layout({ + "width": 800 if vertical else 4000, + "height": 4000 if vertical else 800, + "{}axis".format("x" if vertical else "y"): { + "mirror": False, + "ticks": "", + "side": "top" if vertical else "left", + "title": y_axis["label"], + "tickangle": 90 if vertical else 0, + "ticklabelposition": "outside top" if vertical else "outside left" + }, + "{}axis".format("y" if vertical else "x"): { + "mirror": False, + "showgrid": True, + "title": "Distance", + "side": "right" if vertical else "top" + }, + **axes_layouts}) fig.update_traces( showlegend=False, colorscale=colorscale, -- cgit v1.2.3 From 7627378dd1eb52055f4e25047ba53a2d2e4c092f Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 6 Oct 2021 11:25:38 +0300 Subject: Enable vertical and horizontal heatmaps Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/non-clustered-heatmaps-and-flipping.gmi * Update the request endpoint, so that it produces a vertical or horizontal heatmap depending on the user's request. --- gn3/api/heatmaps.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gn3') diff --git a/gn3/api/heatmaps.py b/gn3/api/heatmaps.py index 62ca2ad..633a061 100644 --- a/gn3/api/heatmaps.py +++ b/gn3/api/heatmaps.py @@ -17,7 +17,9 @@ def clustered_heatmaps(): Parses the incoming data and responds with the JSON-serialized plotly figure representing the clustered heatmap. """ - traits_names = request.get_json().get("traits_names", tuple()) + heatmap_request = request.get_json() + traits_names = heatmap_request.get("traits_names", tuple()) + vertical = heatmap_request.get("vertical", False) if len(traits_names) < 2: return jsonify({ "message": "You need to provide at least two trait names." @@ -30,7 +32,7 @@ def clustered_heatmaps(): traits_fullnames = [parse_trait_fullname(trait) for trait in traits_names] with io.StringIO() as io_str: - _filename, figure = build_heatmap(traits_fullnames, conn) + figure = build_heatmap(traits_fullnames, conn, vertical=vertical) figure.write_json(io_str) fig_json = io_str.getvalue() return fig_json, 200 -- cgit v1.2.3 From a7fbce242f6683d66452ff02e541aa9b28908f39 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 14 Oct 2021 07:19:32 +0300 Subject: Allow CORS_ORIGINS to be configurable via the environment Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/non-clustered-heatmaps-and-flipping.gmi * gn3/app.py: setup CORS after all the configuration sources are loaded. * gn3/settings.py: Parse CORS_ORIGINS from the environment variables. Enable the CORS_ORIGINS configuration to be set in the environment variables to give the application some flexibility when launching. --- gn3/app.py | 13 +++++++------ gn3/settings.py | 11 +++++++++-- 2 files changed, 16 insertions(+), 8 deletions(-) (limited to 'gn3') diff --git a/gn3/app.py b/gn3/app.py index a25332c..3d68b3f 100644 --- a/gn3/app.py +++ b/gn3/app.py @@ -21,12 +21,6 @@ def create_app(config: Union[Dict, str, None] = None) -> Flask: # Load default configuration app.config.from_object("gn3.settings") - CORS( - app, - origins=app.config["CORS_ORIGINS"], - allow_headers=app.config["CORS_HEADERS"], - supports_credentials=True, intercept_exceptions=False) - # Load environment configuration if "GN3_CONF" in os.environ: app.config.from_envvar('GN3_CONF') @@ -37,6 +31,13 @@ def create_app(config: Union[Dict, str, None] = None) -> Flask: app.config.update(config) elif config.endswith(".py"): app.config.from_pyfile(config) + + CORS( + app, + origins=app.config["CORS_ORIGINS"], + allow_headers=app.config["CORS_HEADERS"], + supports_credentials=True, intercept_exceptions=False) + app.register_blueprint(general, url_prefix="/api/") app.register_blueprint(gemma, url_prefix="/api/gemma") app.register_blueprint(rqtl, url_prefix="/api/rqtl") diff --git a/gn3/settings.py b/gn3/settings.py index 150d96d..56ddaba 100644 --- a/gn3/settings.py +++ b/gn3/settings.py @@ -35,10 +35,17 @@ GENOTYPE_FILES = os.environ.get( "GENOTYPE_FILES", "{}/genotype_files/genotype".format(os.environ.get("HOME"))) # CROSS-ORIGIN SETUP -CORS_ORIGINS = [ +def parse_env_cors(default): + origins_str = os.environ.get("CORS_ORIGINS", None) + if origins_str: + return [ + origin.strip() for origin in origins_str.split(",") if origin != ""] + return default + +CORS_ORIGINS = parse_env_cors([ "http://localhost:*", "http://127.0.0.1:*" -] +]) CORS_HEADERS = [ "Content-Type", -- cgit v1.2.3 From 546b37e77c11c5268aa9510b9756f2ed4d60241d Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 14 Oct 2021 07:31:41 +0300 Subject: Fix some linting issues --- gn3/heatmaps.py | 6 +++--- gn3/settings.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'gn3') diff --git a/gn3/heatmaps.py b/gn3/heatmaps.py index ff65652..2dd9d07 100644 --- a/gn3/heatmaps.py +++ b/gn3/heatmaps.py @@ -374,8 +374,8 @@ def clustered_heatmap( fig = make_subplots( rows=num_plots if vertical else 1, cols=1 if vertical else num_plots, - shared_xaxes = "columns" if vertical else False, - shared_yaxes = False if vertical else "rows", + shared_xaxes="columns" if vertical else False, + shared_yaxes=False if vertical else "rows", vertical_spacing=0.010, horizontal_spacing=0.001, subplot_titles=["" if vertical else x_axis["label"]] + [ @@ -407,7 +407,7 @@ def clustered_heatmap( "mirror": False, "showticklabels": i == 0, "ticks": "outside" if i == 0 else "" - } + } for i in range(num_plots)} print("vertical?: {} ==> {}".format("T" if vertical else "F", axes_layouts)) diff --git a/gn3/settings.py b/gn3/settings.py index 56ddaba..d5f1d3c 100644 --- a/gn3/settings.py +++ b/gn3/settings.py @@ -36,6 +36,7 @@ GENOTYPE_FILES = os.environ.get( # CROSS-ORIGIN SETUP def parse_env_cors(default): + """Parse comma-separated configuration into list of strings.""" origins_str = os.environ.get("CORS_ORIGINS", None) if origins_str: return [ -- cgit v1.2.3 From efb9896464f969de4fe8fcaee21a19ac1d881fa2 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 19 Oct 2021 10:31:24 +0300 Subject: Implement remaining `fix_samples` functionality Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/partial_correlations.py: implement `fix_samples` function * tests/unit/test_partial_correlations.py: implement tests for `fix_samples` function Implement the remaining partial migration for the `web.webqtl.correlation.correlationFunction.fixStrain` function in GN1. --- gn3/partial_correlations.py | 30 +++++++++++++++++-- tests/unit/test_partial_correlations.py | 52 ++++++++++++++++++++++++--------- 2 files changed, 66 insertions(+), 16 deletions(-) (limited to 'gn3') diff --git a/gn3/partial_correlations.py b/gn3/partial_correlations.py index 4db4807..c556d10 100644 --- a/gn3/partial_correlations.py +++ b/gn3/partial_correlations.py @@ -5,8 +5,8 @@ It is an attempt to migrate over the partial correlations feature from GeneNetwork1. """ -from typing import Sequence from functools import reduce +from typing import Any, Sequence def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): """ @@ -45,7 +45,7 @@ def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): [__process_control__(trait_data) for trait_data in controls], (tuple(), tuple(), tuple(), tuple())) -def dictify_by_samples(samples_vals_vars: Sequence[Sequence]) -> dict: +def dictify_by_samples(samples_vals_vars: Sequence[Sequence]) -> Sequence[dict]: """ Build a sequence of dictionaries from a sequence of separate sequences of samples, values and variances. @@ -60,3 +60,29 @@ def dictify_by_samples(samples_vals_vars: Sequence[Sequence]) -> dict: sample: {"sample_name": sample, "value": val, "variance": var} for sample, val, var in zip(*trait_line) } for trait_line in zip(*(samples_vals_vars[0:3]))) + +def fix_samples(primary_trait: dict, control_traits: Sequence[dict]) -> Sequence[Sequence[Any]]: + """ + Corrects sample_names, values and variance such that they all contain only + those samples that are common to the reference trait and all control traits. + + This is a partial migration of the + `web.webqtl.correlation.correlationFunction.fixStrain` function in GN1. + """ + primary_samples = tuple( + present[0] for present in + ((sample, all(sample in control.keys() for control in control_traits)) + for sample in primary_trait.keys()) + if present[1]) + control_vals_vars: tuple = reduce( + lambda acc, x: (acc[0] + (x[0],), acc[1] + (x[1],)), + ((item["value"], item["variance"]) + for sublist in [tuple(control.values()) for control in control_traits] + for item in sublist), + (tuple(), tuple())) + return ( + primary_samples, + tuple(primary_trait[sample]["value"] for sample in primary_samples), + control_vals_vars[0], + tuple(primary_trait[sample]["variance"] for sample in primary_samples), + control_vals_vars[1]) diff --git a/tests/unit/test_partial_correlations.py b/tests/unit/test_partial_correlations.py index 6302f74..7631a71 100644 --- a/tests/unit/test_partial_correlations.py +++ b/tests/unit/test_partial_correlations.py @@ -1,7 +1,10 @@ """Module contains tests for gn3.partial_correlations""" from unittest import TestCase -from gn3.partial_correlations import control_samples, dictify_by_samples +from gn3.partial_correlations import ( + fix_samples, + control_samples, + dictify_by_samples) sampleslist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] control_traits = ( @@ -69,6 +72,21 @@ control_traits = ( "sample_name": "BXD2", "value": 7.80944, "variance": None, "ndata": None}}}) +dictified_control_samples = ( + {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, + "BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, + "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, + "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, + {"BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, + "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, + "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, + {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}) + class TestPartialCorrelations(TestCase): """Class for testing partial correlations computation functions""" @@ -112,16 +130,22 @@ class TestPartialCorrelations(TestCase): ((None, None, None, None, None, None), (None, None, None, None), (None, None, None)), (6, 4, 3))), - ({"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, - "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, - "BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, - "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, - "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, - {"BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, - "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, - "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, - {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, - "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}})) + dictified_control_samples) + + def test_fix_samples(self): + """Test that fix_samples fixes the values""" + self.assertEqual( + fix_samples( + {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, + "variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, + "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, + "variance": None}}, + dictified_control_samples), + (("BXD2",), (7.80944,), + (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944, 8.39265, + 8.17443, 8.30401, 7.80944, 7.51879, 7.77141, 7.80944), + (None,), + (None, None, None, None, None, None, None, None, None, None, None, + None, None))) -- cgit v1.2.3 From ef7226bc188adf5dfd20e6daea291a3f2b14c156 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 18 Oct 2021 05:47:45 +0300 Subject: Migrate `export_informative` function Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/partial_correlations.py: Implement a mostly, bug-compatible `export_informative` function as part of migrating the partial correlations feature over to GN3 from GN1 * tests/unit/test_partial_correlations.py: Implement tests to ensure the code work in a similar manner as that one in GN1. --- gn3/partial_correlations.py | 32 ++++++++++++ tests/unit/test_partial_correlations.py | 92 +++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 gn3/partial_correlations.py create mode 100644 tests/unit/test_partial_correlations.py (limited to 'gn3') diff --git a/gn3/partial_correlations.py b/gn3/partial_correlations.py new file mode 100644 index 0000000..8c37886 --- /dev/null +++ b/gn3/partial_correlations.py @@ -0,0 +1,32 @@ +""" +This module deals with partial correlations. + +It is an attempt to migrate over the partial correlations feature from +GeneNetwork1. +""" + +from functools import reduce + +def export_informative(trait_data: dict, inc_var: bool = False) -> tuple: + """ + Export informative strain + + This is a migration of the `exportInformative` function in + web/webqtl/base/webqtlTrait.py module in GeneNetwork1. + + There is a chance that the original implementation has a bug, especially + dealing with the `inc_var` value. It the `inc_var` value is meant to control + the inclusion of the `variance` value, then the current implementation, and + that one in GN1 have a bug. + """ + def __exporter__(acc, data_item): + if not inc_var or data_item["variance"] is not None: + return ( + acc[0] + (data_item["sample_name"],), + acc[1] + (data_item["value"],), + acc[2] + (data_item["variance"],)) + return acc + return reduce( + __exporter__, + filter(lambda td: td["value"] is not None, trait_data["data"].values()), + (tuple(), tuple(), tuple())) diff --git a/tests/unit/test_partial_correlations.py b/tests/unit/test_partial_correlations.py new file mode 100644 index 0000000..6eea078 --- /dev/null +++ b/tests/unit/test_partial_correlations.py @@ -0,0 +1,92 @@ +"""Module contains tests for gn3.partial_correlations""" + +from unittest import TestCase +from gn3.partial_correlations import export_informative + +class TestPartialCorrelations(TestCase): + """Class for testing partial correlations computation functions""" + + def test_export_informative(self): + """Test that the function exports appropriate data.""" + for trait_data, inc_var, expected in [ + [{"data": { + "sample1": { + "sample_name": "sample1", "value": 9, "variance": None, + "ndata": 13 + }, + "sample2": { + "sample_name": "sample2", "value": 8, "variance": None, + "ndata": 13 + }, + "sample3": { + "sample_name": "sample3", "value": 7, "variance": None, + "ndata": 13 + }, + "sample4": { + "sample_name": "sample4", "value": 6, "variance": None, + "ndata": 13 + }, + }}, 0, ( + ("sample1", "sample2", "sample3", "sample4"), (9, 8, 7, 6), + (None, None, None, None))], + [{"data": { + "sample1": { + "sample_name": "sample1", "value": 9, "variance": None, + "ndata": 13 + }, + "sample2": { + "sample_name": "sample2", "value": 8, "variance": None, + "ndata": 13 + }, + "sample3": { + "sample_name": "sample3", "value": None, "variance": None, + "ndata": 13 + }, + "sample4": { + "sample_name": "sample4", "value": 6, "variance": None, + "ndata": 13 + }, + }}, 0, ( + ("sample1", "sample2", "sample4"), (9, 8, 6), + (None, None, None))], + [{"data": { + "sample1": { + "sample_name": "sample1", "value": 9, "variance": None, + "ndata": 13 + }, + "sample2": { + "sample_name": "sample2", "value": 8, "variance": None, + "ndata": 13 + }, + "sample3": { + "sample_name": "sample3", "value": 7, "variance": None, + "ndata": 13 + }, + "sample4": { + "sample_name": "sample4", "value": 6, "variance": None, + "ndata": 13 + }, + }}, True, (tuple(), tuple(), tuple())], + [{"data": { + "sample1": { + "sample_name": "sample1", "value": 9, "variance": None, + "ndata": 13 + }, + "sample2": { + "sample_name": "sample2", "value": 8, "variance": 0.657, + "ndata": 13 + }, + "sample3": { + "sample_name": "sample3", "value": 7, "variance": None, + "ndata": 13 + }, + "sample4": { + "sample_name": "sample4", "value": 6, "variance": None, + "ndata": 13 + }, + }}, 0, ( + ("sample1", "sample2", "sample3", "sample4"), (9, 8, 7, 6), + (None, 0.657, None, None))]]: + with self.subTest(trait_data=trait_data): + self.assertEqual( + export_informative(trait_data, inc_var), expected) -- cgit v1.2.3 From 679c3edd08453d2f1ef09b3461fd8d0b038b3adf Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 18 Oct 2021 12:17:11 +0300 Subject: Move 'export_trait_data' to 'gn3.db.traits' module Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/db/traits.py: Move function `export_trait_data` here * gn3/heatmaps.py: Remove function `export_trait_data` * tests/unit/db/test_traits.py: Move function `export_trait_data` tests here * tests/unit/test_heatmaps.py: Remove function `export_trait_data` here Function `export_trait_data` more closely corresponds to the traits and is used in more than just the `gn3.heatmaps` module. This commit moves the relevant code over to the `gn3.db.traits` module and also moves the tests to the corresponding tests modules. --- gn3/db/traits.py | 69 ++++++++++++++++++++++++++++++++++ gn3/heatmaps.py | 67 +-------------------------------- tests/unit/db/test_traits.py | 89 ++++++++++++++++++++++++++++++++++++++++++++ tests/unit/test_heatmaps.py | 87 ------------------------------------------- 4 files changed, 159 insertions(+), 153 deletions(-) (limited to 'gn3') diff --git a/gn3/db/traits.py b/gn3/db/traits.py index f2673c8..1e29aff 100644 --- a/gn3/db/traits.py +++ b/gn3/db/traits.py @@ -1,12 +1,81 @@ """This class contains functions relating to trait data manipulation""" import os +from functools import reduce from typing import Any, Dict, Union, Sequence + from gn3.settings import TMPDIR from gn3.random import random_string from gn3.function_helpers import compose from gn3.db.datasets import retrieve_trait_dataset +def export_trait_data( + trait_data: dict, samplelist: Sequence[str], dtype: str = "val", + var_exists: bool = False, n_exists: bool = False): + """ + Export data according to `samplelist`. Mostly used in calculating + correlations. + + DESCRIPTION: + Migrated from + https://github.com/genenetwork/genenetwork1/blob/master/web/webqtl/base/webqtlTrait.py#L166-L211 + + PARAMETERS + trait: (dict) + The dictionary of key-value pairs representing a trait + samplelist: (list) + A list of sample names + dtype: (str) + ... verify what this is ... + var_exists: (bool) + A flag indicating existence of variance + n_exists: (bool) + A flag indicating existence of ndata + """ + def __export_all_types(tdata, sample): + sample_data = [] + if tdata[sample]["value"]: + sample_data.append(tdata[sample]["value"]) + if var_exists: + if tdata[sample]["variance"]: + sample_data.append(tdata[sample]["variance"]) + else: + sample_data.append(None) + if n_exists: + if tdata[sample]["ndata"]: + sample_data.append(tdata[sample]["ndata"]) + else: + sample_data.append(None) + else: + if var_exists and n_exists: + sample_data += [None, None, None] + elif var_exists or n_exists: + sample_data += [None, None] + else: + sample_data.append(None) + + return tuple(sample_data) + + def __exporter(accumulator, sample): + # pylint: disable=[R0911] + if sample in trait_data["data"]: + if dtype == "val": + return accumulator + (trait_data["data"][sample]["value"], ) + if dtype == "var": + return accumulator + (trait_data["data"][sample]["variance"], ) + if dtype == "N": + return accumulator + (trait_data["data"][sample]["ndata"], ) + if dtype == "all": + return accumulator + __export_all_types(trait_data["data"], sample) + raise KeyError("Type `%s` is incorrect" % dtype) + if var_exists and n_exists: + return accumulator + (None, None, None) + if var_exists or n_exists: + return accumulator + (None, None) + return accumulator + (None,) + + return reduce(__exporter, samplelist, tuple()) + def get_trait_csv_sample_data(conn: Any, trait_name: int, phenotype_id: int): """Fetch a trait and return it as a csv string""" diff --git a/gn3/heatmaps.py b/gn3/heatmaps.py index 2dd9d07..bf9dfd1 100644 --- a/gn3/heatmaps.py +++ b/gn3/heatmaps.py @@ -14,6 +14,7 @@ from plotly.subplots import make_subplots # type: ignore from gn3.settings import TMPDIR from gn3.random import random_string from gn3.computations.slink import slink +from gn3.db.traits import export_trait_data from gn3.computations.correlations2 import compute_correlation from gn3.db.genotypes import ( build_genotype_file, load_genotype_samples) @@ -26,72 +27,6 @@ from gn3.computations.qtlreaper import ( parse_reaper_main_results, organise_reaper_main_results) -def export_trait_data( - trait_data: dict, samplelist: Sequence[str], dtype: str = "val", - var_exists: bool = False, n_exists: bool = False): - """ - Export data according to `samplelist`. Mostly used in calculating - correlations. - - DESCRIPTION: - Migrated from - https://github.com/genenetwork/genenetwork1/blob/master/web/webqtl/base/webqtlTrait.py#L166-L211 - - PARAMETERS - trait: (dict) - The dictionary of key-value pairs representing a trait - samplelist: (list) - A list of sample names - dtype: (str) - ... verify what this is ... - var_exists: (bool) - A flag indicating existence of variance - n_exists: (bool) - A flag indicating existence of ndata - """ - def __export_all_types(tdata, sample): - sample_data = [] - if tdata[sample]["value"]: - sample_data.append(tdata[sample]["value"]) - if var_exists: - if tdata[sample]["variance"]: - sample_data.append(tdata[sample]["variance"]) - else: - sample_data.append(None) - if n_exists: - if tdata[sample]["ndata"]: - sample_data.append(tdata[sample]["ndata"]) - else: - sample_data.append(None) - else: - if var_exists and n_exists: - sample_data += [None, None, None] - elif var_exists or n_exists: - sample_data += [None, None] - else: - sample_data.append(None) - - return tuple(sample_data) - - def __exporter(accumulator, sample): - # pylint: disable=[R0911] - if sample in trait_data["data"]: - if dtype == "val": - return accumulator + (trait_data["data"][sample]["value"], ) - if dtype == "var": - return accumulator + (trait_data["data"][sample]["variance"], ) - if dtype == "N": - return accumulator + (trait_data["data"][sample]["ndata"], ) - if dtype == "all": - return accumulator + __export_all_types(trait_data["data"], sample) - raise KeyError("Type `%s` is incorrect" % dtype) - if var_exists and n_exists: - return accumulator + (None, None, None) - if var_exists or n_exists: - return accumulator + (None, None) - return accumulator + (None,) - - return reduce(__exporter, samplelist, tuple()) def trait_display_name(trait: Dict): """ diff --git a/tests/unit/db/test_traits.py b/tests/unit/db/test_traits.py index 8af8e82..0c4ef78 100644 --- a/tests/unit/db/test_traits.py +++ b/tests/unit/db/test_traits.py @@ -2,6 +2,7 @@ from unittest import mock, TestCase from gn3.db.traits import ( build_trait_name, + export_trait_data, set_haveinfo_field, update_sample_data, retrieve_trait_info, @@ -12,6 +13,38 @@ from gn3.db.traits import ( retrieve_publish_trait_info, retrieve_probeset_trait_info) +samplelist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] +trait_data = { + "mysqlid": 36688172, + "data": { + "B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None, "ndata": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None, "ndata": None}, + "BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None, "ndata": None}, + "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None, "ndata": None}, + "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None, "ndata": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None, "ndata": None}, + "BXD21": {"sample_name": "BXD21", "value": 8.93809, "variance": None, "ndata": None}, + "BXD24": {"sample_name": "BXD24", "value": 7.99415, "variance": None, "ndata": None}, + "BXD27": {"sample_name": "BXD27", "value": 8.12177, "variance": None, "ndata": None}, + "BXD28": {"sample_name": "BXD28", "value": 7.67688, "variance": None, "ndata": None}, + "BXD32": {"sample_name": "BXD32", "value": 7.79062, "variance": None, "ndata": None}, + "BXD39": {"sample_name": "BXD39", "value": 8.27641, "variance": None, "ndata": None}, + "BXD40": {"sample_name": "BXD40", "value": 8.18012, "variance": None, "ndata": None}, + "BXD42": {"sample_name": "BXD42", "value": 7.82433, "variance": None, "ndata": None}, + "BXD6": {"sample_name": "BXD6", "value": 8.09718, "variance": None, "ndata": None}, + "BXH14": {"sample_name": "BXH14", "value": 7.97475, "variance": None, "ndata": None}, + "BXH19": {"sample_name": "BXH19", "value": 7.67223, "variance": None, "ndata": None}, + "BXH2": {"sample_name": "BXH2", "value": 7.93622, "variance": None, "ndata": None}, + "BXH22": {"sample_name": "BXH22", "value": 7.43692, "variance": None, "ndata": None}, + "BXH4": {"sample_name": "BXH4", "value": 7.96336, "variance": None, "ndata": None}, + "BXH6": {"sample_name": "BXH6", "value": 7.75132, "variance": None, "ndata": None}, + "BXH7": {"sample_name": "BXH7", "value": 8.12927, "variance": None, "ndata": None}, + "BXH8": {"sample_name": "BXH8", "value": 6.77338, "variance": None, "ndata": None}, + "BXH9": {"sample_name": "BXH9", "value": 8.03836, "variance": None, "ndata": None}, + "C3H/HeJ": {"sample_name": "C3H/HeJ", "value": 7.42795, "variance": None, "ndata": None}, + "C57BL/6J": {"sample_name": "C57BL/6J", "value": 7.50606, "variance": None, "ndata": None}, + "DBA/2J": {"sample_name": "DBA/2J", "value": 7.72588, "variance": None, "ndata": None}}} + class TestTraitsDBFunctions(TestCase): "Test cases for traits functions" @@ -226,3 +259,59 @@ class TestTraitsDBFunctions(TestCase): with self.subTest(trait_info=trait_info, expected=expected): self.assertEqual( set_confidential_field(trait_type, trait_info), expected) + + def test_export_trait_data_dtype(self): + """ + Test `export_trait_data` with different values for the `dtype` keyword + argument + """ + for dtype, expected in [ + ["val", (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], + ["var", (None, None, None, None, None, None)], + ["N", (None, None, None, None, None, None)], + ["all", (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)]]: + with self.subTest(dtype=dtype): + self.assertEqual( + export_trait_data(trait_data, samplelist, dtype=dtype), + expected) + + def test_export_trait_data_dtype_all_flags(self): + """ + Test `export_trait_data` with different values for the `dtype` keyword + argument and the different flags set up + """ + for dtype, vflag, nflag, expected in [ + ["val", False, False, + (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], + ["val", False, True, + (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], + ["val", True, False, + (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], + ["val", True, True, + (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], + ["var", False, False, (None, None, None, None, None, None)], + ["var", False, True, (None, None, None, None, None, None)], + ["var", True, False, (None, None, None, None, None, None)], + ["var", True, True, (None, None, None, None, None, None)], + ["N", False, False, (None, None, None, None, None, None)], + ["N", False, True, (None, None, None, None, None, None)], + ["N", True, False, (None, None, None, None, None, None)], + ["N", True, True, (None, None, None, None, None, None)], + ["all", False, False, + (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], + ["all", False, True, + (7.51879, None, 7.77141, None, 8.39265, None, 8.17443, None, + 8.30401, None, 7.80944, None)], + ["all", True, False, + (7.51879, None, 7.77141, None, 8.39265, None, 8.17443, None, + 8.30401, None, 7.80944, None)], + ["all", True, True, + (7.51879, None, None, 7.77141, None, None, 8.39265, None, None, + 8.17443, None, None, 8.30401, None, None, 7.80944, None, None)] + ]: + with self.subTest(dtype=dtype, vflag=vflag, nflag=nflag): + self.assertEqual( + export_trait_data( + trait_data, samplelist, dtype=dtype, var_exists=vflag, + n_exists=nflag), + expected) diff --git a/tests/unit/test_heatmaps.py b/tests/unit/test_heatmaps.py index 7b66688..03fd4a6 100644 --- a/tests/unit/test_heatmaps.py +++ b/tests/unit/test_heatmaps.py @@ -4,43 +4,12 @@ from gn3.heatmaps import ( cluster_traits, get_loci_names, get_lrs_from_chr, - export_trait_data, compute_traits_order, retrieve_samples_and_values, process_traits_data_for_heatmap) from tests.unit.sample_test_data import organised_trait_1, organised_trait_2 samplelist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] -trait_data = { - "mysqlid": 36688172, - "data": { - "B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None, "ndata": None}, - "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None, "ndata": None}, - "BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None, "ndata": None}, - "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None, "ndata": None}, - "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None, "ndata": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None, "ndata": None}, - "BXD21": {"sample_name": "BXD21", "value": 8.93809, "variance": None, "ndata": None}, - "BXD24": {"sample_name": "BXD24", "value": 7.99415, "variance": None, "ndata": None}, - "BXD27": {"sample_name": "BXD27", "value": 8.12177, "variance": None, "ndata": None}, - "BXD28": {"sample_name": "BXD28", "value": 7.67688, "variance": None, "ndata": None}, - "BXD32": {"sample_name": "BXD32", "value": 7.79062, "variance": None, "ndata": None}, - "BXD39": {"sample_name": "BXD39", "value": 8.27641, "variance": None, "ndata": None}, - "BXD40": {"sample_name": "BXD40", "value": 8.18012, "variance": None, "ndata": None}, - "BXD42": {"sample_name": "BXD42", "value": 7.82433, "variance": None, "ndata": None}, - "BXD6": {"sample_name": "BXD6", "value": 8.09718, "variance": None, "ndata": None}, - "BXH14": {"sample_name": "BXH14", "value": 7.97475, "variance": None, "ndata": None}, - "BXH19": {"sample_name": "BXH19", "value": 7.67223, "variance": None, "ndata": None}, - "BXH2": {"sample_name": "BXH2", "value": 7.93622, "variance": None, "ndata": None}, - "BXH22": {"sample_name": "BXH22", "value": 7.43692, "variance": None, "ndata": None}, - "BXH4": {"sample_name": "BXH4", "value": 7.96336, "variance": None, "ndata": None}, - "BXH6": {"sample_name": "BXH6", "value": 7.75132, "variance": None, "ndata": None}, - "BXH7": {"sample_name": "BXH7", "value": 8.12927, "variance": None, "ndata": None}, - "BXH8": {"sample_name": "BXH8", "value": 6.77338, "variance": None, "ndata": None}, - "BXH9": {"sample_name": "BXH9", "value": 8.03836, "variance": None, "ndata": None}, - "C3H/HeJ": {"sample_name": "C3H/HeJ", "value": 7.42795, "variance": None, "ndata": None}, - "C57BL/6J": {"sample_name": "C57BL/6J", "value": 7.50606, "variance": None, "ndata": None}, - "DBA/2J": {"sample_name": "DBA/2J", "value": 7.72588, "variance": None, "ndata": None}}} slinked = ( (((0, 2, 0.16381088984330505), @@ -55,62 +24,6 @@ slinked = ( class TestHeatmap(TestCase): """Class for testing heatmap computation functions""" - def test_export_trait_data_dtype(self): - """ - Test `export_trait_data` with different values for the `dtype` keyword - argument - """ - for dtype, expected in [ - ["val", (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], - ["var", (None, None, None, None, None, None)], - ["N", (None, None, None, None, None, None)], - ["all", (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)]]: - with self.subTest(dtype=dtype): - self.assertEqual( - export_trait_data(trait_data, samplelist, dtype=dtype), - expected) - - def test_export_trait_data_dtype_all_flags(self): - """ - Test `export_trait_data` with different values for the `dtype` keyword - argument and the different flags set up - """ - for dtype, vflag, nflag, expected in [ - ["val", False, False, - (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], - ["val", False, True, - (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], - ["val", True, False, - (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], - ["val", True, True, - (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], - ["var", False, False, (None, None, None, None, None, None)], - ["var", False, True, (None, None, None, None, None, None)], - ["var", True, False, (None, None, None, None, None, None)], - ["var", True, True, (None, None, None, None, None, None)], - ["N", False, False, (None, None, None, None, None, None)], - ["N", False, True, (None, None, None, None, None, None)], - ["N", True, False, (None, None, None, None, None, None)], - ["N", True, True, (None, None, None, None, None, None)], - ["all", False, False, - (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944)], - ["all", False, True, - (7.51879, None, 7.77141, None, 8.39265, None, 8.17443, None, - 8.30401, None, 7.80944, None)], - ["all", True, False, - (7.51879, None, 7.77141, None, 8.39265, None, 8.17443, None, - 8.30401, None, 7.80944, None)], - ["all", True, True, - (7.51879, None, None, 7.77141, None, None, 8.39265, None, None, - 8.17443, None, None, 8.30401, None, None, 7.80944, None, None)] - ]: - with self.subTest(dtype=dtype, vflag=vflag, nflag=nflag): - self.assertEqual( - export_trait_data( - trait_data, samplelist, dtype=dtype, var_exists=vflag, - n_exists=nflag), - expected) - def test_cluster_traits(self): """ Test that the clustering is working as expected. -- cgit v1.2.3 From 42c56d330fdb51820c0fdcbb0b4376ff568ea009 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 18 Oct 2021 12:27:32 +0300 Subject: Move `export_informative` function to `gn3.db.traits` module Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/db/traits.py: Move `export_informative` function here * gn3/partial_correlations.py: Remove `export_informative` function * tests/unit/db/test_traits.py: Move `export_informative` function tests here * tests/unit/test_partial_correlations.py: Remove `export_informative` function tests The `export_informative` function relates more to the traits than to the partial correlations, and could find use in more than just the partial correlations stuff. This commit moves the function to the more traits-specific `gn3.db.traits` module. --- gn3/db/traits.py | 24 +++++++++ gn3/partial_correlations.py | 24 --------- tests/unit/db/test_traits.py | 86 ++++++++++++++++++++++++++++++++ tests/unit/test_partial_correlations.py | 87 +-------------------------------- 4 files changed, 111 insertions(+), 110 deletions(-) (limited to 'gn3') diff --git a/gn3/db/traits.py b/gn3/db/traits.py index 1e29aff..1c6aaa7 100644 --- a/gn3/db/traits.py +++ b/gn3/db/traits.py @@ -743,3 +743,27 @@ def generate_traits_filename(base_path: str = TMPDIR): """Generate a unique filename for use with generated traits files.""" return "{}/traits_test_file_{}.txt".format( os.path.abspath(base_path), random_string(10)) + +def export_informative(trait_data: dict, inc_var: bool = False) -> tuple: + """ + Export informative strain + + This is a migration of the `exportInformative` function in + web/webqtl/base/webqtlTrait.py module in GeneNetwork1. + + There is a chance that the original implementation has a bug, especially + dealing with the `inc_var` value. It the `inc_var` value is meant to control + the inclusion of the `variance` value, then the current implementation, and + that one in GN1 have a bug. + """ + def __exporter__(acc, data_item): + if not inc_var or data_item["variance"] is not None: + return ( + acc[0] + (data_item["sample_name"],), + acc[1] + (data_item["value"],), + acc[2] + (data_item["variance"],)) + return acc + return reduce( + __exporter__, + filter(lambda td: td["value"] is not None, trait_data["data"].values()), + (tuple(), tuple(), tuple())) diff --git a/gn3/partial_correlations.py b/gn3/partial_correlations.py index 8c37886..df390ed 100644 --- a/gn3/partial_correlations.py +++ b/gn3/partial_correlations.py @@ -6,27 +6,3 @@ GeneNetwork1. """ from functools import reduce - -def export_informative(trait_data: dict, inc_var: bool = False) -> tuple: - """ - Export informative strain - - This is a migration of the `exportInformative` function in - web/webqtl/base/webqtlTrait.py module in GeneNetwork1. - - There is a chance that the original implementation has a bug, especially - dealing with the `inc_var` value. It the `inc_var` value is meant to control - the inclusion of the `variance` value, then the current implementation, and - that one in GN1 have a bug. - """ - def __exporter__(acc, data_item): - if not inc_var or data_item["variance"] is not None: - return ( - acc[0] + (data_item["sample_name"],), - acc[1] + (data_item["value"],), - acc[2] + (data_item["variance"],)) - return acc - return reduce( - __exporter__, - filter(lambda td: td["value"] is not None, trait_data["data"].values()), - (tuple(), tuple(), tuple())) diff --git a/tests/unit/db/test_traits.py b/tests/unit/db/test_traits.py index 0c4ef78..67f0c6f 100644 --- a/tests/unit/db/test_traits.py +++ b/tests/unit/db/test_traits.py @@ -3,6 +3,7 @@ from unittest import mock, TestCase from gn3.db.traits import ( build_trait_name, export_trait_data, + export_informative, set_haveinfo_field, update_sample_data, retrieve_trait_info, @@ -315,3 +316,88 @@ class TestTraitsDBFunctions(TestCase): trait_data, samplelist, dtype=dtype, var_exists=vflag, n_exists=nflag), expected) + + def test_export_informative(self): + """Test that the function exports appropriate data.""" + for trait_data, inc_var, expected in [ + [{"data": { + "sample1": { + "sample_name": "sample1", "value": 9, "variance": None, + "ndata": 13 + }, + "sample2": { + "sample_name": "sample2", "value": 8, "variance": None, + "ndata": 13 + }, + "sample3": { + "sample_name": "sample3", "value": 7, "variance": None, + "ndata": 13 + }, + "sample4": { + "sample_name": "sample4", "value": 6, "variance": None, + "ndata": 13 + }, + }}, 0, ( + ("sample1", "sample2", "sample3", "sample4"), (9, 8, 7, 6), + (None, None, None, None))], + [{"data": { + "sample1": { + "sample_name": "sample1", "value": 9, "variance": None, + "ndata": 13 + }, + "sample2": { + "sample_name": "sample2", "value": 8, "variance": None, + "ndata": 13 + }, + "sample3": { + "sample_name": "sample3", "value": None, "variance": None, + "ndata": 13 + }, + "sample4": { + "sample_name": "sample4", "value": 6, "variance": None, + "ndata": 13 + }, + }}, 0, ( + ("sample1", "sample2", "sample4"), (9, 8, 6), + (None, None, None))], + [{"data": { + "sample1": { + "sample_name": "sample1", "value": 9, "variance": None, + "ndata": 13 + }, + "sample2": { + "sample_name": "sample2", "value": 8, "variance": None, + "ndata": 13 + }, + "sample3": { + "sample_name": "sample3", "value": 7, "variance": None, + "ndata": 13 + }, + "sample4": { + "sample_name": "sample4", "value": 6, "variance": None, + "ndata": 13 + }, + }}, True, (tuple(), tuple(), tuple())], + [{"data": { + "sample1": { + "sample_name": "sample1", "value": 9, "variance": None, + "ndata": 13 + }, + "sample2": { + "sample_name": "sample2", "value": 8, "variance": 0.657, + "ndata": 13 + }, + "sample3": { + "sample_name": "sample3", "value": 7, "variance": None, + "ndata": 13 + }, + "sample4": { + "sample_name": "sample4", "value": 6, "variance": None, + "ndata": 13 + }, + }}, 0, ( + ("sample1", "sample2", "sample3", "sample4"), (9, 8, 7, 6), + (None, 0.657, None, None))]]: + with self.subTest(trait_data=trait_data): + self.assertEqual( + export_informative(trait_data, inc_var), expected) diff --git a/tests/unit/test_partial_correlations.py b/tests/unit/test_partial_correlations.py index 6eea078..f204d4f 100644 --- a/tests/unit/test_partial_correlations.py +++ b/tests/unit/test_partial_correlations.py @@ -1,92 +1,7 @@ """Module contains tests for gn3.partial_correlations""" from unittest import TestCase -from gn3.partial_correlations import export_informative + class TestPartialCorrelations(TestCase): """Class for testing partial correlations computation functions""" - - def test_export_informative(self): - """Test that the function exports appropriate data.""" - for trait_data, inc_var, expected in [ - [{"data": { - "sample1": { - "sample_name": "sample1", "value": 9, "variance": None, - "ndata": 13 - }, - "sample2": { - "sample_name": "sample2", "value": 8, "variance": None, - "ndata": 13 - }, - "sample3": { - "sample_name": "sample3", "value": 7, "variance": None, - "ndata": 13 - }, - "sample4": { - "sample_name": "sample4", "value": 6, "variance": None, - "ndata": 13 - }, - }}, 0, ( - ("sample1", "sample2", "sample3", "sample4"), (9, 8, 7, 6), - (None, None, None, None))], - [{"data": { - "sample1": { - "sample_name": "sample1", "value": 9, "variance": None, - "ndata": 13 - }, - "sample2": { - "sample_name": "sample2", "value": 8, "variance": None, - "ndata": 13 - }, - "sample3": { - "sample_name": "sample3", "value": None, "variance": None, - "ndata": 13 - }, - "sample4": { - "sample_name": "sample4", "value": 6, "variance": None, - "ndata": 13 - }, - }}, 0, ( - ("sample1", "sample2", "sample4"), (9, 8, 6), - (None, None, None))], - [{"data": { - "sample1": { - "sample_name": "sample1", "value": 9, "variance": None, - "ndata": 13 - }, - "sample2": { - "sample_name": "sample2", "value": 8, "variance": None, - "ndata": 13 - }, - "sample3": { - "sample_name": "sample3", "value": 7, "variance": None, - "ndata": 13 - }, - "sample4": { - "sample_name": "sample4", "value": 6, "variance": None, - "ndata": 13 - }, - }}, True, (tuple(), tuple(), tuple())], - [{"data": { - "sample1": { - "sample_name": "sample1", "value": 9, "variance": None, - "ndata": 13 - }, - "sample2": { - "sample_name": "sample2", "value": 8, "variance": 0.657, - "ndata": 13 - }, - "sample3": { - "sample_name": "sample3", "value": 7, "variance": None, - "ndata": 13 - }, - "sample4": { - "sample_name": "sample4", "value": 6, "variance": None, - "ndata": 13 - }, - }}, 0, ( - ("sample1", "sample2", "sample3", "sample4"), (9, 8, 7, 6), - (None, 0.657, None, None))]]: - with self.subTest(trait_data=trait_data): - self.assertEqual( - export_informative(trait_data, inc_var), expected) -- cgit v1.2.3 From 38a0b65d234c0019ba14814adf69e09493082298 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 18 Oct 2021 14:14:04 +0300 Subject: Implement `control_samples` function as is in GN1 Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/partial_correlations.py: Implement `control_samples` function * tests/unit/test_partial_correlations.py: add tests for `control_samples` function Implement the function `control_samples` and make it mostly bug-compatible with the `web/webqtl/correlation/correlationFunction.controlStrain` function in GN1. This implementation in GN3 does not do any calls to the database. It will rely on other functions to provide the data from the database to it. --- gn3/partial_correlations.py | 38 ++++++++++++++++ tests/unit/test_partial_correlations.py | 80 +++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+) (limited to 'gn3') diff --git a/gn3/partial_correlations.py b/gn3/partial_correlations.py index df390ed..99521c6 100644 --- a/gn3/partial_correlations.py +++ b/gn3/partial_correlations.py @@ -5,4 +5,42 @@ It is an attempt to migrate over the partial correlations feature from GeneNetwork1. """ +from typing import Sequence from functools import reduce + +def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): + """ + Fetches data for the control traits. + + This migrates `web/webqtl/correlation/correlationFunction.controlStrain` in + GN1, with a few modifications to the arguments passed in. + + PARAMETERS: + controls: A map of sample names to trait data. Equivalent to the `cvals` + value in the corresponding source function in GN1. + sampleslist: A list of samples. Equivalent to `strainlst` in the + corresponding source function in GN1 + """ + def __process_control__(trait_data): + def __process_sample__(acc, sample): + if sample in trait_data["data"].keys(): + sample_item = trait_data["data"][sample] + val = sample_item["value"] + if val is not None: + return ( + acc[0] + (sample,), + acc[1] + (val,), + acc[2] + (sample_item["variance"],)) + return acc + return reduce( + __process_sample__, sampleslist, (tuple(), tuple(), tuple())) + + return reduce( + lambda acc, item: ( + acc[0] + (item[0],), + acc[1] + (item[1],), + acc[2] + (item[2],), + acc[3] + (len(item[0]),), + ), + [__process_control__(trait_data) for trait_data in controls], + (tuple(), tuple(), tuple(), tuple())) diff --git a/tests/unit/test_partial_correlations.py b/tests/unit/test_partial_correlations.py index f204d4f..0083ef7 100644 --- a/tests/unit/test_partial_correlations.py +++ b/tests/unit/test_partial_correlations.py @@ -1,7 +1,87 @@ """Module contains tests for gn3.partial_correlations""" from unittest import TestCase +from gn3.partial_correlations import control_samples +sampleslist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] +control_traits = ( + { + "mysqlid": 36688172, + "data": { + "B6cC3-1": { + "sample_name": "B6cC3-1", "value": 7.51879, "variance": None, + "ndata": None}, + "BXD1": { + "sample_name": "BXD1", "value": 7.77141, "variance": None, + "ndata": None}, + "BXD12": { + "sample_name": "BXD12", "value": 8.39265, "variance": None, + "ndata": None}, + "BXD16": { + "sample_name": "BXD16", "value": 8.17443, "variance": None, + "ndata": None}, + "BXD19": { + "sample_name": "BXD19", "value": 8.30401, "variance": None, + "ndata": None}, + "BXD2": { + "sample_name": "BXD2", "value": 7.80944, "variance": None, + "ndata": None}}}, + { + "mysqlid": 36688172, + "data": { + "B6cC3-21": { + "sample_name": "B6cC3-1", "value": 7.51879, "variance": None, + "ndata": None}, + "BXD21": { + "sample_name": "BXD1", "value": 7.77141, "variance": None, + "ndata": None}, + "BXD12": { + "sample_name": "BXD12", "value": 8.39265, "variance": None, + "ndata": None}, + "BXD16": { + "sample_name": "BXD16", "value": 8.17443, "variance": None, + "ndata": None}, + "BXD19": { + "sample_name": "BXD19", "value": 8.30401, "variance": None, + "ndata": None}, + "BXD2": { + "sample_name": "BXD2", "value": 7.80944, "variance": None, + "ndata": None}}}, + { + "mysqlid": 36688172, + "data": { + "B6cC3-1": { + "sample_name": "B6cC3-1", "value": 7.51879, "variance": None, + "ndata": None}, + "BXD1": { + "sample_name": "BXD1", "value": 7.77141, "variance": None, + "ndata": None}, + "BXD12": { + "sample_name": "BXD12", "value": None, "variance": None, + "ndata": None}, + "BXD16": { + "sample_name": "BXD16", "value": None, "variance": None, + "ndata": None}, + "BXD19": { + "sample_name": "BXD19", "value": None, "variance": None, + "ndata": None}, + "BXD2": { + "sample_name": "BXD2", "value": 7.80944, "variance": None, + "ndata": None}}}) class TestPartialCorrelations(TestCase): """Class for testing partial correlations computation functions""" + + def test_control_samples(self): + """Test that the control_samples works as expected.""" + self.assertEqual( + control_samples(control_traits, sampleslist), + ((("B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"), + ("BXD12", "BXD16", "BXD19", "BXD2"), + ("B6cC3-1", "BXD1", "BXD2")), + ((7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944), + (8.39265, 8.17443, 8.30401, 7.80944), + (7.51879, 7.77141, 7.80944)), + ((None, None, None, None, None, None), (None, None, None, None), + (None, None, None)), + (6, 4, 3))) -- cgit v1.2.3 From b829bf6f5a26edaa57acde0c4a21e2c24d695e87 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 19 Oct 2021 09:16:38 +0300 Subject: Implement `dictify_by_samples` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/partial_correlations.py: implement `dictify_by_samples` function * tests/unit/test_partial_correlations.py: implement tests for `dictify_by_samples` function Implement the `dictify_by_samples` function as a partial migration of the `web.webqtl.correlation.correlationFunction.fixStrains` function from GN1. --- gn3/partial_correlations.py | 16 +++++++++++++ tests/unit/test_partial_correlations.py | 42 ++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/partial_correlations.py b/gn3/partial_correlations.py index 99521c6..4db4807 100644 --- a/gn3/partial_correlations.py +++ b/gn3/partial_correlations.py @@ -44,3 +44,19 @@ def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): ), [__process_control__(trait_data) for trait_data in controls], (tuple(), tuple(), tuple(), tuple())) + +def dictify_by_samples(samples_vals_vars: Sequence[Sequence]) -> dict: + """ + Build a sequence of dictionaries from a sequence of separate sequences of + samples, values and variances. + + This is a partial migration of + `web.webqtl.correlation.correlationFunction.fixStrains` function in GN1. + This implementation extracts code that will find common use, and that will + find use in more than one place. + """ + return tuple( + { + sample: {"sample_name": sample, "value": val, "variance": var} + for sample, val, var in zip(*trait_line) + } for trait_line in zip(*(samples_vals_vars[0:3]))) diff --git a/tests/unit/test_partial_correlations.py b/tests/unit/test_partial_correlations.py index 0083ef7..6302f74 100644 --- a/tests/unit/test_partial_correlations.py +++ b/tests/unit/test_partial_correlations.py @@ -1,7 +1,7 @@ """Module contains tests for gn3.partial_correlations""" from unittest import TestCase -from gn3.partial_correlations import control_samples +from gn3.partial_correlations import control_samples, dictify_by_samples sampleslist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] control_traits = ( @@ -85,3 +85,43 @@ class TestPartialCorrelations(TestCase): ((None, None, None, None, None, None), (None, None, None, None), (None, None, None)), (6, 4, 3))) + + def test_dictify_by_samples(self): + """ + Given: + a sequence of sequences with sample names, values and variances, as + in the output of `gn3.partial_correlations.control_samples` or + the output of `gn3.db.traits.export_informative` + When: + the sequence is passed as an argument into the + `gn3.partial_correlations.dictify_by_sample` + Then: + return a sequence of dicts with keys being the values of the sample + names, and each of who's values being sub-dicts with the keys + 'sample_name', 'value' and 'variance' whose values correspond to the + values passed in. + """ + self.assertEqual( + dictify_by_samples( + ((("B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"), + ("BXD12", "BXD16", "BXD19", "BXD2"), + ("B6cC3-1", "BXD1", "BXD2")), + ((7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944), + (8.39265, 8.17443, 8.30401, 7.80944), + (7.51879, 7.77141, 7.80944)), + ((None, None, None, None, None, None), (None, None, None, None), + (None, None, None)), + (6, 4, 3))), + ({"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, + "BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, + "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, + "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, + {"BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, + "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, + "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, + {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}})) -- cgit v1.2.3 From a3d4bc848caa8021e14282bab1a13ca7aadeb82d Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 19 Oct 2021 10:31:24 +0300 Subject: Implement remaining `fix_samples` functionality Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/partial_correlations.py: implement `fix_samples` function * tests/unit/test_partial_correlations.py: implement tests for `fix_samples` function Implement the remaining partial migration for the `web.webqtl.correlation.correlationFunction.fixStrain` function in GN1. --- gn3/partial_correlations.py | 30 +++++++++++++++++-- tests/unit/test_partial_correlations.py | 52 ++++++++++++++++++++++++--------- 2 files changed, 66 insertions(+), 16 deletions(-) (limited to 'gn3') diff --git a/gn3/partial_correlations.py b/gn3/partial_correlations.py index 4db4807..c556d10 100644 --- a/gn3/partial_correlations.py +++ b/gn3/partial_correlations.py @@ -5,8 +5,8 @@ It is an attempt to migrate over the partial correlations feature from GeneNetwork1. """ -from typing import Sequence from functools import reduce +from typing import Any, Sequence def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): """ @@ -45,7 +45,7 @@ def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): [__process_control__(trait_data) for trait_data in controls], (tuple(), tuple(), tuple(), tuple())) -def dictify_by_samples(samples_vals_vars: Sequence[Sequence]) -> dict: +def dictify_by_samples(samples_vals_vars: Sequence[Sequence]) -> Sequence[dict]: """ Build a sequence of dictionaries from a sequence of separate sequences of samples, values and variances. @@ -60,3 +60,29 @@ def dictify_by_samples(samples_vals_vars: Sequence[Sequence]) -> dict: sample: {"sample_name": sample, "value": val, "variance": var} for sample, val, var in zip(*trait_line) } for trait_line in zip(*(samples_vals_vars[0:3]))) + +def fix_samples(primary_trait: dict, control_traits: Sequence[dict]) -> Sequence[Sequence[Any]]: + """ + Corrects sample_names, values and variance such that they all contain only + those samples that are common to the reference trait and all control traits. + + This is a partial migration of the + `web.webqtl.correlation.correlationFunction.fixStrain` function in GN1. + """ + primary_samples = tuple( + present[0] for present in + ((sample, all(sample in control.keys() for control in control_traits)) + for sample in primary_trait.keys()) + if present[1]) + control_vals_vars: tuple = reduce( + lambda acc, x: (acc[0] + (x[0],), acc[1] + (x[1],)), + ((item["value"], item["variance"]) + for sublist in [tuple(control.values()) for control in control_traits] + for item in sublist), + (tuple(), tuple())) + return ( + primary_samples, + tuple(primary_trait[sample]["value"] for sample in primary_samples), + control_vals_vars[0], + tuple(primary_trait[sample]["variance"] for sample in primary_samples), + control_vals_vars[1]) diff --git a/tests/unit/test_partial_correlations.py b/tests/unit/test_partial_correlations.py index 6302f74..7631a71 100644 --- a/tests/unit/test_partial_correlations.py +++ b/tests/unit/test_partial_correlations.py @@ -1,7 +1,10 @@ """Module contains tests for gn3.partial_correlations""" from unittest import TestCase -from gn3.partial_correlations import control_samples, dictify_by_samples +from gn3.partial_correlations import ( + fix_samples, + control_samples, + dictify_by_samples) sampleslist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] control_traits = ( @@ -69,6 +72,21 @@ control_traits = ( "sample_name": "BXD2", "value": 7.80944, "variance": None, "ndata": None}}}) +dictified_control_samples = ( + {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, + "BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, + "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, + "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, + {"BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, + "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, + "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, + {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}) + class TestPartialCorrelations(TestCase): """Class for testing partial correlations computation functions""" @@ -112,16 +130,22 @@ class TestPartialCorrelations(TestCase): ((None, None, None, None, None, None), (None, None, None, None), (None, None, None)), (6, 4, 3))), - ({"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, - "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, - "BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, - "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, - "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, - {"BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, - "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, - "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, - {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, - "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}})) + dictified_control_samples) + + def test_fix_samples(self): + """Test that fix_samples fixes the values""" + self.assertEqual( + fix_samples( + {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, + "variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, + "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, + "variance": None}}, + dictified_control_samples), + (("BXD2",), (7.80944,), + (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944, 8.39265, + 8.17443, 8.30401, 7.80944, 7.51879, 7.77141, 7.80944), + (None,), + (None, None, None, None, None, None, None, None, None, None, None, + None, None))) -- cgit v1.2.3 From cad4649d19001f62ef592dedf09f3ac53744962a Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 21 Oct 2021 09:00:16 +0300 Subject: Implement `find_identical_traits` function Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/partial_correlations.py: implement function `find_identical_traits` * tests/unit/test_partial_correlations.py: implement tests for function `find_identical_traits` Migrate `web.webqtl.correlation.correlationFunction.findIdenticalTraits` function in GN1 to here, adding in tests to ensure the migration works in a bug-compatible version with the original. --- gn3/partial_correlations.py | 38 ++++++++++++++++++++++++++++++++- tests/unit/test_partial_correlations.py | 33 +++++++++++++++++++++++++++- 2 files changed, 69 insertions(+), 2 deletions(-) (limited to 'gn3') diff --git a/gn3/partial_correlations.py b/gn3/partial_correlations.py index c556d10..1fb0ccc 100644 --- a/gn3/partial_correlations.py +++ b/gn3/partial_correlations.py @@ -6,7 +6,7 @@ GeneNetwork1. """ from functools import reduce -from typing import Any, Sequence +from typing import Any, Tuple, Sequence def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): """ @@ -86,3 +86,39 @@ def fix_samples(primary_trait: dict, control_traits: Sequence[dict]) -> Sequence control_vals_vars[0], tuple(primary_trait[sample]["variance"] for sample in primary_samples), control_vals_vars[1]) + +def find_identical_traits( + primary_name: str, primary_value: float, control_names: Tuple[str, ...], + control_values: Tuple[float, ...]) -> Tuple[str, ...]: + """ + Find traits that have the same value when the values are considered to + 3 decimal places. + + This is a migration of the + `web.webqtl.correlation.correlationFunction.findIdenticalTraits` function in + GN1. + """ + def __merge_identicals__( + acc: Tuple[str, ...], + ident: Tuple[str, Tuple[str, ...]]) -> Tuple[str, ...]: + return acc + ident[1] + + def __dictify_controls__(acc, control_item): + ckey = "{:.3f}".format(control_item[0]) + return {**acc, ckey: acc.get(ckey, tuple()) + (control_item[1],)} + + return (reduce(## for identical control traits + __merge_identicals__, + (item for item in reduce(# type: ignore[var-annotated] + __dictify_controls__, zip(control_values, control_names), + {}).items() if len(item[1]) > 1), + tuple()) + or + reduce(## If no identical control traits, try primary and controls + __merge_identicals__, + (item for item in reduce(# type: ignore[var-annotated] + __dictify_controls__, + zip((primary_value,) + control_values, + (primary_name,) + control_names), {}).items() + if len(item[1]) > 1), + tuple())) diff --git a/tests/unit/test_partial_correlations.py b/tests/unit/test_partial_correlations.py index c591c8f..60e54c1 100644 --- a/tests/unit/test_partial_correlations.py +++ b/tests/unit/test_partial_correlations.py @@ -4,7 +4,8 @@ from unittest import TestCase from gn3.partial_correlations import ( fix_samples, control_samples, - dictify_by_samples) + dictify_by_samples, + find_identical_traits) sampleslist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] control_traits = ( @@ -178,3 +179,33 @@ class TestPartialCorrelations(TestCase): (None,), (None, None, None, None, None, None, None, None, None, None, None, None, None))) + + def test_find_identical_traits(self): + """ + Test `gn3.partial_correlations.find_identical_traits`. + + Given: + - the name of a primary trait + - the value of a primary trait + - a sequence of names of control traits + - a sequence of values of control traits + When: + - the arguments above are passed to the `find_identical_traits` + function + Then: + - Return ALL trait names that have the same value when up to three + decimal places are considered + """ + for primn, primv, contn, contv, expected in ( + ("pt", 12.98395, ("ct0", "ct1", "ct2"), + (0.1234, 2.3456, 3.4567), tuple()), + ("pt", 12.98395, ("ct0", "ct1", "ct2"), + (12.98354, 2.3456, 3.4567), ("pt", "ct0")), + ("pt", 12.98395, ("ct0", "ct1", "ct2", "ct3"), + (0.1234, 2.3456, 0.1233, 4.5678), ("ct0", "ct2")) + ): + with self.subTest( + primary_name=primn, primary_value=primv, + control_names=contn, control_values=contv): + self.assertEqual( + find_identical_traits(primn, primv, contn, contv), expected) -- cgit v1.2.3 From 41936d0a486ef54bf4fc049c2b4d85dca43ab761 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 21 Oct 2021 09:36:36 +0300 Subject: Implement `translate_to_mouse_gene_id` function Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Migrate the `web.webqtl.correlation/CorrelationPage.translateToMouseGeneID` function in GN1 to GN3. This is a function that retrieves data from the database, and therefore uses a system outside of our code, therefore, the function does not have a corresponding unit test. This kind of function will probably need to be tested at the integration or system tests level, where we test that our code interacts correcly with any and all external systems that it should. --- gn3/db/species.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'gn3') diff --git a/gn3/db/species.py b/gn3/db/species.py index 0deae4e..1e5015f 100644 --- a/gn3/db/species.py +++ b/gn3/db/species.py @@ -30,3 +30,34 @@ def get_chromosome(name: str, is_species: bool, conn: Any) -> Optional[Tuple]: with conn.cursor() as cursor: cursor.execute(_sql) return cursor.fetchall() + +def translate_to_mouse_gene_id(species: str, geneid: int, conn: Any) -> int: + """ + Translate rat or human geneid to mouse geneid + + This is a migration of the + `web.webqtl.correlation/CorrelationPage.translateToMouseGeneID` function in + GN1 + """ + assert species in ("rat", "mouse", "human"), "Invalid species" + if geneid is None: + return 0 + + if species == "mouse": + return geneid + + with conn.cursor as cursor: + if species == "rat": + cursor.execute( + "SELECT mouse FROM GeneIDXRef WHERE rat = %s", geneid) + rat_geneid = cursor.fetchone() + if rat_geneid: + return rat_geneid[0] + + cursor.execute( + "SELECT mouse FROM GeneIDXRef WHERE human = %s", geneid) + human_geneid = cursor.fetchone() + if human_geneid: + return human_geneid[0] + + return 0 # default if all else fails -- cgit v1.2.3 From df8185078a52c89cc5a75ff9be413a236da29a6e Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 25 Oct 2021 09:31:58 +0300 Subject: Implement `get_filename` for correlations Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Implement `get_filename` for the correlations, to be used to determine whether to do fast or normal correlations. This is a migration of the `web.webqtl.correlation.CorrelationPage.getFileName` function in GN1 --- gn3/db/correlations.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 gn3/db/correlations.py (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py new file mode 100644 index 0000000..fa8e7ca --- /dev/null +++ b/gn3/db/correlations.py @@ -0,0 +1,26 @@ +""" +This module will hold functions that are used in the (partial) correlations +feature to access the database to retrieve data needed for computations. +""" + +from typing import Any +def get_filename(target_db_name: str, conn: Any) -> str: + """ + Retrieve the name of the reference database file with which correlations are + computed. + + This is a migration of the + `web.webqtl.correlation.CorrelationPage.getFileName` function in + GeneNetwork1. + """ + with conn.cursor() as cursor: + cursor.execute( + "SELECT Id, FullName from ProbeSetFreeze WHERE Name-%s", + target_db_name) + result = cursor.fetchone() + if result: + return "ProbeSetFreezeId_{tid}_FullName_{fname}.txt".format( + tid=result[0], + fname=result[1].replace(' ', '_').replace('/', '_')) + + return "" -- cgit v1.2.3 From 0814eea6b57e45d4337424e63c164d204d03b64d Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 25 Oct 2021 12:38:24 +0300 Subject: Implement `fetch_literature_correlations` and depedencies Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Migrate: * `web.webqtl.correlation.CorrelationPage.getTempLiteratureTable` * `web.webqtl.correlation.CorrelationPage.fetchLitCorrelations` from GeneNetwork1. The first function creates and populates a temporary table with the literature correlations data. The second function uses the data in the newly created temporary table to link the trait with the correlation value. --- gn3/db/correlations.py | 113 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index fa8e7ca..67cfef9 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -4,6 +4,10 @@ feature to access the database to retrieve data needed for computations. """ from typing import Any + +from gn3.random import random_string +from gn3.db.species import translate_to_mouse_gene_id + def get_filename(target_db_name: str, conn: Any) -> str: """ Retrieve the name of the reference database file with which correlations are @@ -24,3 +28,112 @@ def get_filename(target_db_name: str, conn: Any) -> str: fname=result[1].replace(' ', '_').replace('/', '_')) return "" + +def build_temporary_literature_table( + species: str, gene_id: int, return_number: int, conn: Any) -> str: + """ + Build and populate a temporary table to hold the literature correlation data + to be used in computations. + + "This is a migration of the + `web.webqtl.correlation.CorrelationPage.getTempLiteratureTable` function in + GeneNetwork1. + """ + def __translated_species_id(row, cursor): + if species == "mouse": + return row[1] + query = { + "rat": "SELECT rat FROM GeneIDXRef WHERE mouse=%s", + "human": "SELECT human FROM GeneIDXRef WHERE mouse=%d"} + if species in query.keys(): + cursor.execute(query[species], row[1]) + record = cursor.fetchone() + if record: + return record[0] + return None + return None + + temp_table_name = f"TOPLITERATURE{random_string(8)}" + with conn.cursor as cursor: + mouse_geneid = translate_to_mouse_gene_id(species, gene_id, conn) + data_query = ( + "SELECT GeneId1, GeneId2, value FROM LCorrRamin3 " + "WHERE GeneId1 = %(mouse_gene_id)s " + "UNION ALL " + "SELECT GeneId2, GeneId1, value FROM LCorrRamin3 " + "WHERE GeneId2 = %(mouse_gene_id)s " + "AND GeneId1 != %(mouse_gene_id)s") + cursor.execute( + (f"CREATE TEMPORARY TABLE {temp_table_name} (" + "GeneId1 int(12) unsigned, " + "GeneId2 int(12) unsigned PRIMARY KEY, " + "value double)")) + cursor.execute(data_query, mouse_gene_id=mouse_geneid) + literature_data = [ + {"GeneId1": row[0], "GeneId2": row[1], "value": row[2]} + for row in cursor.fetchall() + if __translated_species_id(row, cursor)] + + cursor.execute( + (f"INSERT INTO {temp_table_name} " + "VALUES (%(GeneId1)s, %(GeneId2)s, %(value)s)"), + literature_data[0:(2 * return_number)]) + + return temp_table_name + +def fetch_geno_literature_correlations(temp_table: str) -> str: + """ + Helper function for `fetch_literature_correlations` below, to build query + for `Geno*` tables. + """ + return ( + f"SELECT Geno.Name, {temp_table}.value " + "FROM Geno, GenoXRef, GenoFreeze " + f"LEFT JOIN {temp_table} ON {temp_table}.GeneId2=ProbeSet.GeneId " + "WHERE ProbeSet.GeneId IS NOT NULL " + f"AND {temp_table}.value IS NOT NULL " + "AND GenoXRef.GenoFreezeId = GenoFreeze.Id " + "AND GenoFreeze.Name = %(db_name)s " + "AND Geno.Id=GenoXRef.GenoId " + "ORDER BY Geno.Id") + +def fetch_probeset_literature_correlations(temp_table: str) -> str: + """ + Helper function for `fetch_literature_correlations` below, to build query + for `ProbeSet*` tables. + """ + return ( + f"SELECT ProbeSet.Name, {temp_table}.value " + "FROM ProbeSet, ProbeSetXRef, ProbeSetFreeze " + "LEFT JOIN {temp_table} ON {temp_table}.GeneId2=ProbeSet.GeneId " + "WHERE ProbeSet.GeneId IS NOT NULL " + "AND {temp_table}.value IS NOT NULL " + "AND ProbeSetXRef.ProbeSetFreezeId = ProbeSetFreeze.Id " + "AND ProbeSetFreeze.Name = %(db_name)s " + "AND ProbeSet.Id=ProbeSetXRef.ProbeSetId " + "ORDER BY ProbeSet.Id") + +def fetch_literature_correlations( + species: str, gene_id: int, dataset: dict, return_number: int, + conn: Any) -> dict: + """ + Gather the literature correlation data and pair it with trait id string(s). + + This is a migration of the + `web.webqtl.correlation.CorrelationPage.fetchLitCorrelations` function in + GeneNetwork1. + """ + temp_table = build_temporary_literature_table( + species, gene_id, return_number, conn) + query_fns = { + "Geno": fetch_geno_literature_correlations, + # "Temp": fetch_temp_literature_correlations, + # "Publish": fetch_publish_literature_correlations, + "ProbeSet": fetch_probeset_literature_correlations} + with conn.cursor as cursor: + cursor.execute( + query_fns[dataset["dataset_type"]](temp_table), + db_name=dataset["dataset_name"]) + results = cursor.fetchall() + cursor.execute("DROP TEMPORARY TABLE %s", temp_table) + return dict(results) # {trait_name: lit_corr for trait_name, lit_corr in results} -- cgit v1.2.3 From aff6704cdcaea388f14b71cc013b1a224afb87fc Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Tue, 5 Oct 2021 14:30:39 +0300 Subject: add function to capture output in real time --- gn3/computations/wgcna.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/computations/wgcna.py b/gn3/computations/wgcna.py index fd508fa..0fb56e8 100644 --- a/gn3/computations/wgcna.py +++ b/gn3/computations/wgcna.py @@ -3,8 +3,9 @@ import os import json import uuid -from gn3.settings import TMPDIR +import subprocess +from gn3.settings import TMPDIR from gn3.commands import run_cmd @@ -20,6 +21,16 @@ def dump_wgcna_data(request_data: dict): return temp_file_path +def stream_cmd_output(socket, cmd: str): + """function to stream in realtime""" + # xtodo syncing and closing /edge cases + + results = subprocess.Popen( + cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) + for line in iter(results.stdout.readline, b""): + line = line.decode("utf-8").rstrip() + + def compose_wgcna_cmd(rscript_path: str, temp_file_path: str): """function to componse wgcna cmd""" # (todo):issue relative paths to abs paths -- cgit v1.2.3 From f73262a56745de17bdb582474e27726cb19bd95e Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Tue, 5 Oct 2021 15:09:10 +0300 Subject: add function to process images --- gn3/computations/wgcna.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/computations/wgcna.py b/gn3/computations/wgcna.py index 0fb56e8..26040d3 100644 --- a/gn3/computations/wgcna.py +++ b/gn3/computations/wgcna.py @@ -4,6 +4,7 @@ import os import json import uuid import subprocess +import base64 from gn3.settings import TMPDIR from gn3.commands import run_cmd @@ -15,6 +16,8 @@ def dump_wgcna_data(request_data: dict): temp_file_path = os.path.join(TMPDIR, filename) + request_data["TMPDIR"] = TMPDIR + with open(temp_file_path, "w") as output_file: json.dump(request_data, output_file) @@ -31,6 +34,16 @@ def stream_cmd_output(socket, cmd: str): line = line.decode("utf-8").rstrip() +def process_image(image_loc: str) ->bytes: + """encode the image""" + + try: + with open(image_loc, "rb") as image_file: + return base64.b64encode(image_file.read()) + except FileNotFoundError as e: + return b"" + + def compose_wgcna_cmd(rscript_path: str, temp_file_path: str): """function to componse wgcna cmd""" # (todo):issue relative paths to abs paths @@ -47,12 +60,18 @@ def call_wgcna_script(rscript_path: str, request_data: dict): run_cmd_results = run_cmd(cmd) + print(run_cmd_results["output"]) + with open(generated_file, "r") as outputfile: + output_file_data = json.load(outputfile) + output_file_data["image_1"] = process_image( + output_file_data["output"]["imageLoc"]) + if run_cmd_results["code"] != 0: return run_cmd_results return { - "data": json.load(outputfile), + "data": output_file_data, **run_cmd_results } except FileNotFoundError: -- cgit v1.2.3 From 838276a6c4effc6985a888a32d148ef8942b526a Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Tue, 5 Oct 2021 15:13:06 +0300 Subject: rename key to image_data --- gn3/computations/wgcna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/computations/wgcna.py b/gn3/computations/wgcna.py index 26040d3..421e09c 100644 --- a/gn3/computations/wgcna.py +++ b/gn3/computations/wgcna.py @@ -65,7 +65,7 @@ def call_wgcna_script(rscript_path: str, request_data: dict): with open(generated_file, "r") as outputfile: output_file_data = json.load(outputfile) - output_file_data["image_1"] = process_image( + output_file_data["image_data"] = process_image( output_file_data["output"]["imageLoc"]) if run_cmd_results["code"] != 0: -- cgit v1.2.3 From 84f5c8a4384f29dfcb187ac5eed43551860b182b Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Tue, 5 Oct 2021 16:57:13 +0300 Subject: fix issues serializing byte string --- gn3/computations/wgcna.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/wgcna.py b/gn3/computations/wgcna.py index 421e09c..4dd0985 100644 --- a/gn3/computations/wgcna.py +++ b/gn3/computations/wgcna.py @@ -33,8 +33,10 @@ def stream_cmd_output(socket, cmd: str): for line in iter(results.stdout.readline, b""): line = line.decode("utf-8").rstrip() + # xtodo emit the data -def process_image(image_loc: str) ->bytes: + +def process_image(image_loc: str) -> bytes: """encode the image""" try: @@ -65,8 +67,9 @@ def call_wgcna_script(rscript_path: str, request_data: dict): with open(generated_file, "r") as outputfile: output_file_data = json.load(outputfile) - output_file_data["image_data"] = process_image( - output_file_data["output"]["imageLoc"]) + # json format only supports unicode string// to get image data reconvert + output_file_data["output"]["image_data"] = process_image( + output_file_data["output"]["imageLoc"]).decode("ascii") if run_cmd_results["code"] != 0: return run_cmd_results -- cgit v1.2.3 From c6bce638cfac9df0a4f3f380971fde65b1947ad7 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Tue, 5 Oct 2021 17:14:23 +0300 Subject: add socket obj and emit process --- gn3/computations/wgcna.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/wgcna.py b/gn3/computations/wgcna.py index 4dd0985..94e2a40 100644 --- a/gn3/computations/wgcna.py +++ b/gn3/computations/wgcna.py @@ -28,12 +28,18 @@ def stream_cmd_output(socket, cmd: str): """function to stream in realtime""" # xtodo syncing and closing /edge cases + socket.emit("output", {"data", f"calling you script {cmd}"}) + results = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) for line in iter(results.stdout.readline, b""): line = line.decode("utf-8").rstrip() - # xtodo emit the data + socket.emit("output", + {"data": line}) + # close above make sure the process is closed + + socket.emit("output", {"data": "parsing the output results"}) def process_image(image_loc: str) -> bytes: @@ -62,8 +68,6 @@ def call_wgcna_script(rscript_path: str, request_data: dict): run_cmd_results = run_cmd(cmd) - print(run_cmd_results["output"]) - with open(generated_file, "r") as outputfile: output_file_data = json.load(outputfile) -- cgit v1.2.3 From fd8650ca108cf61cd16b264e09568df9ad7bf428 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Tue, 5 Oct 2021 17:34:59 +0300 Subject: pep8 formatting,pylint fixes --- gn3/computations/wgcna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/wgcna.py b/gn3/computations/wgcna.py index 94e2a40..d1d6d39 100644 --- a/gn3/computations/wgcna.py +++ b/gn3/computations/wgcna.py @@ -37,7 +37,7 @@ def stream_cmd_output(socket, cmd: str): socket.emit("output", {"data": line}) - # close above make sure the process is closed + # wait for process to complete code socket.emit("output", {"data": "parsing the output results"}) @@ -48,7 +48,7 @@ def process_image(image_loc: str) -> bytes: try: with open(image_loc, "rb") as image_file: return base64.b64encode(image_file.read()) - except FileNotFoundError as e: + except FileNotFoundError: return b"" -- cgit v1.2.3 From dda47e74d38b76e59f10ac184a0394066f086481 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Wed, 13 Oct 2021 07:21:05 +0300 Subject: minor modification for emitting data:add namespaces --- gn3/computations/wgcna.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/wgcna.py b/gn3/computations/wgcna.py index d1d6d39..f7463c5 100644 --- a/gn3/computations/wgcna.py +++ b/gn3/computations/wgcna.py @@ -6,6 +6,7 @@ import uuid import subprocess import base64 + from gn3.settings import TMPDIR from gn3.commands import run_cmd @@ -24,22 +25,23 @@ def dump_wgcna_data(request_data: dict): return temp_file_path -def stream_cmd_output(socket, cmd: str): +def stream_cmd_output(request_data, cmd: str): """function to stream in realtime""" # xtodo syncing and closing /edge cases - socket.emit("output", {"data", f"calling you script {cmd}"}) - + socketio.emit("output", {"data": f"calling you script {cmd}"}, + namespace="/", room=request_data["socket_id"]) results = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) for line in iter(results.stdout.readline, b""): + line = line.decode("utf-8").rstrip() - socket.emit("output", - {"data": line}) - # wait for process to complete code + socketio.emit("output", + {"data": line}, namespace="/", room=request_data["socket_id"]) - socket.emit("output", {"data": "parsing the output results"}) + socketio.emit( + "output", {"data": "parsing the output results"}, namespace="/", room=request_data["socket_id"]) def process_image(image_loc: str) -> bytes: @@ -64,9 +66,11 @@ def call_wgcna_script(rscript_path: str, request_data: dict): generated_file = dump_wgcna_data(request_data) cmd = compose_wgcna_cmd(rscript_path, generated_file) + stream_cmd_output(request_data, cmd) + try: - run_cmd_results = run_cmd(cmd) + # run_cmd_results = run_cmd(cmd) with open(generated_file, "r") as outputfile: @@ -74,12 +78,14 @@ def call_wgcna_script(rscript_path: str, request_data: dict): # json format only supports unicode string// to get image data reconvert output_file_data["output"]["image_data"] = process_image( output_file_data["output"]["imageLoc"]).decode("ascii") + output_file_data["output"]["image_data2"] = process_image( + output_file_data["output"]["heatMap"]).decode("ascii") - if run_cmd_results["code"] != 0: - return run_cmd_results + # if run_cmd_results["code"] != 0: + # return run_cmd_results return { "data": output_file_data, - **run_cmd_results + "output": "" } except FileNotFoundError: # relook at handling errors gn3 -- cgit v1.2.3 From 4c2cf2aceb044d00fe5e41ac40a07fe614737ef2 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Wed, 13 Oct 2021 08:11:25 +0300 Subject: fix unittests --- gn3/computations/wgcna.py | 15 +++++++-------- tests/unit/computations/test_wgcna.py | 14 ++++++++++---- 2 files changed, 17 insertions(+), 12 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/wgcna.py b/gn3/computations/wgcna.py index f7463c5..90db455 100644 --- a/gn3/computations/wgcna.py +++ b/gn3/computations/wgcna.py @@ -66,26 +66,25 @@ def call_wgcna_script(rscript_path: str, request_data: dict): generated_file = dump_wgcna_data(request_data) cmd = compose_wgcna_cmd(rscript_path, generated_file) - stream_cmd_output(request_data, cmd) + # stream_cmd_output(request_data, cmd) disable streaming of data try: - # run_cmd_results = run_cmd(cmd) + run_cmd_results = run_cmd(cmd) with open(generated_file, "r") as outputfile: + if run_cmd_results["code"] != 0: + return run_cmd_results + output_file_data = json.load(outputfile) - # json format only supports unicode string// to get image data reconvert output_file_data["output"]["image_data"] = process_image( output_file_data["output"]["imageLoc"]).decode("ascii") - output_file_data["output"]["image_data2"] = process_image( - output_file_data["output"]["heatMap"]).decode("ascii") + # json format only supports unicode string// to get image data reconvert - # if run_cmd_results["code"] != 0: - # return run_cmd_results return { "data": output_file_data, - "output": "" + **run_cmd_results } except FileNotFoundError: # relook at handling errors gn3 diff --git a/tests/unit/computations/test_wgcna.py b/tests/unit/computations/test_wgcna.py index ec81d94..5f23a86 100644 --- a/tests/unit/computations/test_wgcna.py +++ b/tests/unit/computations/test_wgcna.py @@ -10,13 +10,16 @@ from gn3.computations.wgcna import call_wgcna_script class TestWgcna(TestCase): """test class for wgcna""" + @mock.patch("gn3.computations.wgcna.process_image") @mock.patch("gn3.computations.wgcna.run_cmd") @mock.patch("gn3.computations.wgcna.compose_wgcna_cmd") @mock.patch("gn3.computations.wgcna.dump_wgcna_data") def test_call_wgcna_script(self, mock_dumping_data, mock_compose_wgcna, - mock_run_cmd): + mock_run_cmd, + mock_img, + ): """test for calling wgcna script""" # pylint: disable = line-too-long @@ -50,7 +53,7 @@ class TestWgcna(TestCase): "output": "Flagging genes and samples with too many missing values...\n ..step 1\nAllowing parallel execution with up to 3 working processes.\npickSoftThreshold: will use block size 7.\n pickSoftThreshold: calculating connectivity for given powers...\n ..working on genes 1 through 7 of 7\n Flagging genes and samples with too many missing values...\n ..step 1\n ..Working on block 1 .\n TOM calculation: adjacency..\n ..will not use multithreading.\nclustering..\n ....detecting modules..\n ....calculating module eigengenes..\n ....checking kME in modules..\n ..merging modules that are too close..\n mergeCloseModules: Merging modules whose distance is less than 0.15\n mergeCloseModules: less than two proper modules.\n ..color levels are turquoise\n ..there is nothing to merge.\n Calculating new MEs...\n" } - json_output = "{\"inputdata\":{\"trait_sample_data \":{},\"minModuleSize\":30,\"TOMtype\":\"unsigned\"},\"outputdata\":{\"eigengenes\":[],\"colors\":[]}}" + json_output = "{\"inputdata\":{\"trait_sample_data \":{},\"minModuleSize\":30,\"TOMtype\":\"unsigned\"},\"output\":{\"eigengenes\":[],\"imageLoc\":[],\"colors\":[]}}" expected_output = { @@ -61,9 +64,11 @@ class TestWgcna(TestCase): "TOMtype": "unsigned" }, - "outputdata": { + "output": { "eigengenes": [], - "colors": [] + "imageLoc": [], + "colors": [], + "image_data": "AFDSFNBSDGJJHH" } }, @@ -74,6 +79,7 @@ class TestWgcna(TestCase): with mock.patch("builtins.open", mock.mock_open(read_data=json_output)): mock_run_cmd.return_value = mock_run_cmd_results + mock_img.return_value = b"AFDSFNBSDGJJHH" results = call_wgcna_script( "Rscript/GUIX_PATH/scripts/r_file.R", request_data) -- cgit v1.2.3 From 7b8efdf2040b0f623d1736e5608338ddcbe4a9da Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Wed, 13 Oct 2021 08:15:49 +0300 Subject: pylint and pep8 formatting --- gn3/computations/wgcna.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/wgcna.py b/gn3/computations/wgcna.py index 90db455..76c71d5 100644 --- a/gn3/computations/wgcna.py +++ b/gn3/computations/wgcna.py @@ -25,7 +25,7 @@ def dump_wgcna_data(request_data: dict): return temp_file_path -def stream_cmd_output(request_data, cmd: str): +def stream_cmd_output(socketio, request_data, cmd: str): """function to stream in realtime""" # xtodo syncing and closing /edge cases @@ -41,7 +41,9 @@ def stream_cmd_output(request_data, cmd: str): {"data": line}, namespace="/", room=request_data["socket_id"]) socketio.emit( - "output", {"data": "parsing the output results"}, namespace="/", room=request_data["socket_id"]) + "output", {"data": + "parsing the output results"}, namespace="/", + room=request_data["socket_id"]) def process_image(image_loc: str) -> bytes: -- cgit v1.2.3 From a016f291176a974e654c9387937057cb8f6aa250 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Wed, 20 Oct 2021 13:17:35 +0300 Subject: mypy fix for none stdout --- gn3/computations/wgcna.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/wgcna.py b/gn3/computations/wgcna.py index 76c71d5..0e49527 100644 --- a/gn3/computations/wgcna.py +++ b/gn3/computations/wgcna.py @@ -33,17 +33,20 @@ def stream_cmd_output(socketio, request_data, cmd: str): namespace="/", room=request_data["socket_id"]) results = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) - for line in iter(results.stdout.readline, b""): - line = line.decode("utf-8").rstrip() + if results.stdout is not None: - socketio.emit("output", - {"data": line}, namespace="/", room=request_data["socket_id"]) + for line in iter(results.stdout.readline, b""): - socketio.emit( - "output", {"data": - "parsing the output results"}, namespace="/", - room=request_data["socket_id"]) + line = line.decode("utf-8").rstrip() + + socketio.emit("output", + {"data": line}, namespace="/", room=request_data["socket_id"]) + + socketio.emit( + "output", {"data": + "parsing the output results"}, namespace="/", + room=request_data["socket_id"]) def process_image(image_loc: str) -> bytes: -- cgit v1.2.3 From 5440bfcd6940db08c4479a39ba66dbc802b2c426 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Wed, 20 Oct 2021 13:26:02 +0300 Subject: mypy:Incompatible types in assignment fix --- gn3/computations/wgcna.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/wgcna.py b/gn3/computations/wgcna.py index 0e49527..ab12fe7 100644 --- a/gn3/computations/wgcna.py +++ b/gn3/computations/wgcna.py @@ -37,11 +37,9 @@ def stream_cmd_output(socketio, request_data, cmd: str): if results.stdout is not None: for line in iter(results.stdout.readline, b""): - - line = line.decode("utf-8").rstrip() - socketio.emit("output", - {"data": line}, namespace="/", room=request_data["socket_id"]) + {"data": line.decode("utf-8").rstrip()}, + namespace="/", room=request_data["socket_id"]) socketio.emit( "output", {"data": -- cgit v1.2.3 From 783f302c5d4729eb0b5fb6ba79180b7cd97764a5 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 25 Oct 2021 19:12:24 +0300 Subject: Implement `partition_all` function Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/data_helpers.py: new function (partition_all) * tests/unit/test_data_helpers.py: tests for function `gn3.data_helpers.partition_all` As part of migrating some functions that access the database, this commit extracts generic processes that can be accomplished on data, and implements the `partition_all` function, that is equivalent to Clojure's `partition-all` function. --- gn3/data_helpers.py | 25 +++++++++++++++++++++++++ tests/unit/test_data_helpers.py | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 gn3/data_helpers.py create mode 100644 tests/unit/test_data_helpers.py (limited to 'gn3') diff --git a/gn3/data_helpers.py b/gn3/data_helpers.py new file mode 100644 index 0000000..f0d971e --- /dev/null +++ b/gn3/data_helpers.py @@ -0,0 +1,25 @@ +""" +This module will hold generic functions that can operate on a wide-array of +data structures. +""" + +from math import ceil +from functools import reduce +from typing import Any, Tuple, Sequence + +def partition_all(num: int, items: Sequence[Any]) -> Tuple[Tuple[Any, ...], ...]: + """ + Given a sequence `items`, return a new sequence of the same type as `items` + with the data partitioned into sections of `n` items per partition. + + This is an approximation of clojure's `partition-all` function. + """ + def __compute_start_stop__(acc, iteration): + start = iteration * num + return acc + ((start, start + num),) + + iterations = range(ceil(len(items) / num)) + return tuple([# type: ignore[misc] + tuple(items[start:stop]) for start, stop # type: ignore[has-type] + in reduce( + __compute_start_stop__, iterations, tuple())]) diff --git a/tests/unit/test_data_helpers.py b/tests/unit/test_data_helpers.py new file mode 100644 index 0000000..1eec3cc --- /dev/null +++ b/tests/unit/test_data_helpers.py @@ -0,0 +1,37 @@ +""" +Test functions in gn3.data_helpers +""" + +from unittest import TestCase + +from gn3.data_helpers import partition_all + +class TestDataHelpers(TestCase): + """ + Test functions in gn3.data_helpers + """ + + def test_partition_all(self): + """ + Test that `gn3.data_helpers.partition_all` partitions sequences as expected. + + Given: + - `num`: The number of items per partition + - `items`: A sequence of items + When: + - The arguments above are passed to the `gn3.data_helpers.partition_all` + Then: + - Return a new sequence with partitions, each of which has `num` + items in the same order as those in `items`, save for the last + partition which might have fewer items than `num`. + """ + for count, items, expected in ( + (1, [0, 1, 2, 3], ((0,), (1,), (2,), (3,))), + (3, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9), + ((0, 1, 2), (3, 4, 5), (6, 7, 8), (9, ))), + (4, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], + ((0, 1, 2, 3), (4, 5, 6, 7), (8, 9))), + (13, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], + ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9), ))): + with self.subTest(n=count, items=items): + self.assertEqual(partition_all(count, items), expected) -- cgit v1.2.3 From c13afb3af166d2b01e4f9fd9b09bb231f0a63cb1 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 25 Oct 2021 19:19:54 +0300 Subject: Start implementation of `fetch_tissue_correlations` and dependencies * compare_tissue_correlation_absolute_values: New function. Complete. Used for sorting of tissue correlation values * fetch_symbol_value_pair_dict: New function. Complete. Maps gene symbols to tissue expression data * fetch_gene_symbol_tissue_value_dict: New function. Complete. Wrapper for `gn3.db.correlations.fetch_symbol_value_pair_dict` function * fetch_tissue_probeset_xref_info: New function. Complete. Retrieves the Probeset XRef information for tissues from the database. * correlations_of_all_tissue_traits: Stub. Dependencies not completed yet. * build_temporary_tissue_correlations_table: Stub. Dependencies not completed yet. * fetch_tissue_correlations: New function. Incomplete. This function calls (a) stub(s) function(s) which is/are under development still. --- gn3/db/correlations.py | 183 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 181 insertions(+), 2 deletions(-) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index 67cfef9..87ab082 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -3,9 +3,11 @@ This module will hold functions that are used in the (partial) correlations feature to access the database to retrieve data needed for computations. """ -from typing import Any +from functools import reduce +from typing import Any, Dict, Tuple from gn3.random import random_string +from gn3.data_helpers import partition_all from gn3.db.species import translate_to_mouse_gene_id def get_filename(target_db_name: str, conn: Any) -> str: @@ -136,4 +138,181 @@ def fetch_literature_correlations( db_name=dataset["dataset_name"]) results = cursor.fetchall() cursor.execute("DROP TEMPORARY TABLE %s", temp_table) - return dict(results) # {trait_name: lit_corr for trait_name, lit_corr in results} + return dict(results) + +def compare_tissue_correlation_absolute_values(val1, val2): + """ + Comparison function for use when sorting tissue correlation values. + + This is a partial migration of the + `web.webqtl.correlation.CorrelationPage.getTempTissueCorrTable` function in + GeneNetwork1.""" + try: + if abs(val1) < abs(val2): + return 1 + if abs(val1) == abs(val2): + return 0 + return -1 + except TypeError: + return 0 + +def fetch_symbol_value_pair_dict( + symbol_list: Tuple[str, ...], data_id_dict: dict, + conn: Any) -> Dict[str, Tuple[float, ...]]: + """ + Map each gene symbols to the corresponding tissue expression data. + + This is a migration of the + `web.webqtl.correlation.correlationFunction.getSymbolValuePairDict` function + in GeneNetwork1. + """ + data_ids = { + symbol: data_id_dict.get(symbol) for symbol in symbol_list + if data_id_dict.get(symbol) is not None + } + query = "SELECT Id, value FROM TissueProbeSetData WHERE Id IN %(data_ids)s" + with conn.cursor() as cursor: + cursor.execute( + query, + data_ids=tuple(data_ids.values())) + value_results = cursor.fetchall() + return { + key: tuple(row[1] for row in value_results if row[0] == key) + for key in data_ids.keys() + } + + return {} + +def fetch_gene_symbol_tissue_value_dict( + symbol_list: Tuple[str, ...], data_id_dict: dict, conn: Any, + limit_num: int = 1000) -> dict:#getGeneSymbolTissueValueDict + """ + Wrapper function for `gn3.db.correlations.fetch_symbol_value_pair_dict`. + + This is a migrations of the + `web.webqtl.correlation.correlationFunction.getGeneSymbolTissueValueDict` in + GeneNetwork1. + """ + count = len(symbol_list) + if count != 0 and count <= limit_num: + return fetch_symbol_value_pair_dict(symbol_list, data_id_dict, conn) + + if count > limit_num: + return { + key: value for dct in [ + fetch_symbol_value_pair_dict(sl, data_id_dict, conn) + for sl in partition_all(limit_num, symbol_list)] + for key, value in dct.items() + } + + return {} + +def fetch_tissue_probeset_xref_info( + gene_name_list: Tuple[str, ...], probeset_freeze_id: int, + conn: Any) -> Tuple[tuple, dict, dict, dict, dict, dict, dict]: + """ + Retrieve the ProbeSet XRef information for tissues. + + This is a migration of the + `web.webqtl.correlation.correlationFunction.getTissueProbeSetXRefInfo` + function in GeneNetwork1.""" + with conn.cursor() as cursor: + if len(gene_name_list) == 0: + query = ( + "SELECT t.Symbol, t.GeneId, t.DataId, t.Chr, t.Mb, " + "t.description, t.Probe_Target_Description " + "FROM " + "(" + " SELECT Symbol, max(Mean) AS maxmean " + " FROM TissueProbeSetXRef " + " WHERE TissueProbeSetFreezeId=%(probeset_freeze_id)s " + " AND Symbol != '' " + " AND Symbol IS NOT NULL " + " GROUP BY Symbol" + ") AS x " + "INNER JOIN TissueProbeSetXRef AS t ON t.Symbol = x.Symbol " + "AND t.Mean = x.maxmean") + cursor.execute(query, probeset_freeze_id=probeset_freeze_id) + else: + query = ( + "SELECT t.Symbol, t.GeneId, t.DataId, t.Chr, t.Mb, " + "t.description, t.Probe_Target_Description " + "FROM " + "(" + " SELECT Symbol, max(Mean) AS maxmean " + " FROM TissueProbeSetXRef " + " WHERE TissueProbeSetFreezeId=%(probeset_freeze_id)s " + " AND Symbol in %(symbols)s " + " GROUP BY Symbol" + ") AS x " + "INNER JOIN TissueProbeSetXRef AS t ON t.Symbol = x.Symbol " + "AND t.Mean = x.maxmean") + cursor.execute( + query, probeset_freeze_id=probeset_freeze_id, + symbols=tuple(gene_name_list)) + + results = cursor.fetchall() + + return reduce( + lambda acc, item: ( + acc[0] + (item[0],), + {**acc[1], item[0].lower(): item[1]}, + {**acc[1], item[0].lower(): item[2]}, + {**acc[1], item[0].lower(): item[3]}, + {**acc[1], item[0].lower(): item[4]}, + {**acc[1], item[0].lower(): item[5]}, + {**acc[1], item[0].lower(): item[6]}), + results or tuple(), + (tuple(), {}, {}, {}, {}, {}, {})) + +def correlations_of_all_tissue_traits() -> Tuple[dict, dict]: + """ + This is a migration of the + `web.webqtl.correlation.CorrelationPage.calculateCorrOfAllTissueTrait` + function in GeneNetwork1. + """ + raise Exception("Unimplemented!!!") + return ({}, {}) + +def build_temporary_tissue_correlations_table( + trait_symbol: str, probeset_freeze_id: int, method: str, + return_number: int, conn: Any) -> str: + """ + Build a temporary table to hold the tissue correlations data. + + This is a migration of the + `web.webqtl.correlation.CorrelationPage.getTempTissueCorrTable` function in + GeneNetwork1.""" + raise Exception("Unimplemented!!!") + return "" + +def fetch_tissue_correlations( + dataset: dict, trait_symbol: str, probeset_freeze_id: int, method: str, + return_number: int, conn: Any) -> dict: + """ + Pair tissue correlations data with a trait id string. + + This is a migration of the + `web.webqtl.correlation.CorrelationPage.fetchTissueCorrelations` function in + GeneNetwork1. + """ + temp_table = build_temporary_tissue_correlations_table( + trait_symbol, probeset_freeze_id, method, return_number, conn) + with conn.cursor() as cursor: + cursor.execute( + ( + f"SELECT ProbeSet.Name, {temp_table}.Correlation, " + f"{temp_table}.PValue " + "FROM (ProbeSet, ProbeSetXRef, ProbeSetFreeze) " + "LEFT JOIN {temp_table} ON {temp_table}.Symbol=ProbeSet.Symbol " + "WHERE ProbeSetFreeze.Name = %(db_name) " + "AND ProbeSetFreeze.Id=ProbeSetXRef.ProbeSetFreezeId " + "AND ProbeSet.Id = ProbeSetXRef.ProbeSetId " + "AND ProbeSet.Symbol IS NOT NULL " + "AND %s.Correlation IS NOT NULL"), + db_name=dataset["dataset_name"]) + results = cursor.fetchall() + cursor.execute("DROP TEMPORARY TABLE %s", temp_table) + return { + trait_name: (tiss_corr, tiss_p_val) + for trait_name, tiss_corr, tiss_p_val in results} -- cgit v1.2.3 From b7c77e2e846a6ddcf308fef5dfb9941f44d6e72a Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 26 Oct 2021 08:59:30 +0300 Subject: Implement `fetch_gene_symbol_tissue_value_dict_for_trait` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Implement `fetch_gene_symbol_tissue_value_dict_for_trait` function which is a migration of the `web.webqtl.correlation.correlationFunction.getGeneSymbolTissueValueDictForTrait` function in GeneNetwork1. --- gn3/db/correlations.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index 87ab082..cae8080 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -266,7 +266,22 @@ def fetch_tissue_probeset_xref_info( (tuple(), {}, {}, {}, {}, {}, {})) def correlations_of_all_tissue_traits() -> Tuple[dict, dict]: +def fetch_gene_symbol_tissue_value_dict_for_trait( + gene_name_list: Tuple[str, ...], probeset_freeze_id: int, + conn: Any) -> dict: + """ + Fetches a map of the gene symbols to the tissue values. + + This is a migration of the + `web.webqtl.correlation.correlationFunction.getGeneSymbolTissueValueDictForTrait` + function in GeneNetwork1. """ + xref_info = fetch_tissue_probeset_xref_info( + gene_name_list, probeset_freeze_id, conn) + if xref_info[0]: + return fetch_gene_symbol_tissue_value_dict(xref_info[0], xref_info[2], conn) + return {} + This is a migration of the `web.webqtl.correlation.CorrelationPage.calculateCorrOfAllTissueTrait` function in GeneNetwork1. -- cgit v1.2.3 From 39493a3e6b381bc94b54b48657b1f2ac829e4bb2 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 26 Oct 2021 09:17:52 +0300 Subject: Complete `correlations_of_all_tissue_traits` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Complete the implementation of the `correlations_of_all_tissue_traits` function by providing a call to a non-implemented function. --- gn3/db/correlations.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index cae8080..f43b8a5 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -265,7 +265,6 @@ def fetch_tissue_probeset_xref_info( results or tuple(), (tuple(), {}, {}, {}, {}, {}, {})) -def correlations_of_all_tissue_traits() -> Tuple[dict, dict]: def fetch_gene_symbol_tissue_value_dict_for_trait( gene_name_list: Tuple[str, ...], probeset_freeze_id: int, conn: Any) -> dict: @@ -282,12 +281,25 @@ def fetch_gene_symbol_tissue_value_dict_for_trait( return fetch_gene_symbol_tissue_value_dict(xref_info[0], xref_info[2], conn) return {} +def correlations_of_all_tissue_traits( + trait_symbol: str, probeset_freeze_id: int, + method: str, conn: Any) -> Tuple[dict, dict]: + """ + Computes and returns the correlation of all tissue traits. + This is a migration of the - `web.webqtl.correlation.CorrelationPage.calculateCorrOfAllTissueTrait` + `web.webqtl.correlation.correlationFunction.calculateCorrOfAllTissueTrait` function in GeneNetwork1. """ - raise Exception("Unimplemented!!!") - return ({}, {}) + primary_trait_symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( + (trait_symbol,), probeset_freeze_id, conn) + primary_trait_value = primary_trait_symbol_value_dict.vlaues()[0] + symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( + tuple(), probeset_freeze_id, conn) + if method == "1": + return batch_computed_tissue_correlation( + primaryTraitValue,SymbolValueDict,method='spearman') + return batch_computed_tissue_correlation(primaryTraitValue,SymbolValueDict) def build_temporary_tissue_correlations_table( trait_symbol: str, probeset_freeze_id: int, method: str, @@ -298,6 +310,8 @@ def build_temporary_tissue_correlations_table( This is a migration of the `web.webqtl.correlation.CorrelationPage.getTempTissueCorrTable` function in GeneNetwork1.""" + symbol_corr_dict, symbol_p_value_dict = correlations_of_all_tissue_traits( + trait_symbol, probeset_freeze_id, method, conn) raise Exception("Unimplemented!!!") return "" -- cgit v1.2.3 From 79c56677d32fb0b7ed05d22df3813def8f14b89a Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 26 Oct 2021 09:23:48 +0300 Subject: Stub out `batch_computed_tissue_correlation` function Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Stub out `batch_computed_tissue_correlation` function to be used in implementing the function down the line. --- gn3/db/correlations.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index f43b8a5..54d3079 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -281,6 +281,14 @@ def fetch_gene_symbol_tissue_value_dict_for_trait( return fetch_gene_symbol_tissue_value_dict(xref_info[0], xref_info[2], conn) return {} +def batch_computed_tissue_correlation( + trait_value: str, symbol_value_dict: dict, + method: str = "pearson") -> Tuple[dict, dict]: + """ + `web.webqtl.correlation.correlationFunction.batchCalTissueCorr`""" + raise Exception("Not implemented!") + return ({}, {}) + def correlations_of_all_tissue_traits( trait_symbol: str, probeset_freeze_id: int, method: str, conn: Any) -> Tuple[dict, dict]: -- cgit v1.2.3 From 151ef8bbe23d85f74cdab690073afd4a9329e78a Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 27 Oct 2021 10:24:28 +0300 Subject: Remove if clauses: replace with dict Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Remove the if clauses to simplify the code flow: use a dictionary of queries and select the appropriate query from the dictionary instead. --- gn3/db/species.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'gn3') diff --git a/gn3/db/species.py b/gn3/db/species.py index 1e5015f..abcbf64 100644 --- a/gn3/db/species.py +++ b/gn3/db/species.py @@ -47,17 +47,13 @@ def translate_to_mouse_gene_id(species: str, geneid: int, conn: Any) -> int: return geneid with conn.cursor as cursor: - if species == "rat": - cursor.execute( - "SELECT mouse FROM GeneIDXRef WHERE rat = %s", geneid) - rat_geneid = cursor.fetchone() - if rat_geneid: - return rat_geneid[0] - - cursor.execute( - "SELECT mouse FROM GeneIDXRef WHERE human = %s", geneid) - human_geneid = cursor.fetchone() - if human_geneid: - return human_geneid[0] + query = { + "rat": "SELECT mouse FROM GeneIDXRef WHERE rat = %s" + "human": "SELECT mouse FROM GeneIDXRef WHERE human = %s" + } + cursor.execute(query[species], geneid) + translated_gene_id = cursor.fetchone() + if translated_gene_id: + return translated_gene_id[0] return 0 # default if all else fails -- cgit v1.2.3 From 5fd3bfe587144a61c66ebf730c4818071b1a9661 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 04:52:02 +0300 Subject: Move the partial_correlations module to gn3.computations * Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Move the partial_correlations.py module to the gn3.computations module, since it contains the computations for partial correlations. --- gn3/computations/partial_correlations.py | 124 +++++++++++++++++++++++++++++++ gn3/partial_correlations.py | 124 ------------------------------- 2 files changed, 124 insertions(+), 124 deletions(-) create mode 100644 gn3/computations/partial_correlations.py delete mode 100644 gn3/partial_correlations.py (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py new file mode 100644 index 0000000..1fb0ccc --- /dev/null +++ b/gn3/computations/partial_correlations.py @@ -0,0 +1,124 @@ +""" +This module deals with partial correlations. + +It is an attempt to migrate over the partial correlations feature from +GeneNetwork1. +""" + +from functools import reduce +from typing import Any, Tuple, Sequence + +def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): + """ + Fetches data for the control traits. + + This migrates `web/webqtl/correlation/correlationFunction.controlStrain` in + GN1, with a few modifications to the arguments passed in. + + PARAMETERS: + controls: A map of sample names to trait data. Equivalent to the `cvals` + value in the corresponding source function in GN1. + sampleslist: A list of samples. Equivalent to `strainlst` in the + corresponding source function in GN1 + """ + def __process_control__(trait_data): + def __process_sample__(acc, sample): + if sample in trait_data["data"].keys(): + sample_item = trait_data["data"][sample] + val = sample_item["value"] + if val is not None: + return ( + acc[0] + (sample,), + acc[1] + (val,), + acc[2] + (sample_item["variance"],)) + return acc + return reduce( + __process_sample__, sampleslist, (tuple(), tuple(), tuple())) + + return reduce( + lambda acc, item: ( + acc[0] + (item[0],), + acc[1] + (item[1],), + acc[2] + (item[2],), + acc[3] + (len(item[0]),), + ), + [__process_control__(trait_data) for trait_data in controls], + (tuple(), tuple(), tuple(), tuple())) + +def dictify_by_samples(samples_vals_vars: Sequence[Sequence]) -> Sequence[dict]: + """ + Build a sequence of dictionaries from a sequence of separate sequences of + samples, values and variances. + + This is a partial migration of + `web.webqtl.correlation.correlationFunction.fixStrains` function in GN1. + This implementation extracts code that will find common use, and that will + find use in more than one place. + """ + return tuple( + { + sample: {"sample_name": sample, "value": val, "variance": var} + for sample, val, var in zip(*trait_line) + } for trait_line in zip(*(samples_vals_vars[0:3]))) + +def fix_samples(primary_trait: dict, control_traits: Sequence[dict]) -> Sequence[Sequence[Any]]: + """ + Corrects sample_names, values and variance such that they all contain only + those samples that are common to the reference trait and all control traits. + + This is a partial migration of the + `web.webqtl.correlation.correlationFunction.fixStrain` function in GN1. + """ + primary_samples = tuple( + present[0] for present in + ((sample, all(sample in control.keys() for control in control_traits)) + for sample in primary_trait.keys()) + if present[1]) + control_vals_vars: tuple = reduce( + lambda acc, x: (acc[0] + (x[0],), acc[1] + (x[1],)), + ((item["value"], item["variance"]) + for sublist in [tuple(control.values()) for control in control_traits] + for item in sublist), + (tuple(), tuple())) + return ( + primary_samples, + tuple(primary_trait[sample]["value"] for sample in primary_samples), + control_vals_vars[0], + tuple(primary_trait[sample]["variance"] for sample in primary_samples), + control_vals_vars[1]) + +def find_identical_traits( + primary_name: str, primary_value: float, control_names: Tuple[str, ...], + control_values: Tuple[float, ...]) -> Tuple[str, ...]: + """ + Find traits that have the same value when the values are considered to + 3 decimal places. + + This is a migration of the + `web.webqtl.correlation.correlationFunction.findIdenticalTraits` function in + GN1. + """ + def __merge_identicals__( + acc: Tuple[str, ...], + ident: Tuple[str, Tuple[str, ...]]) -> Tuple[str, ...]: + return acc + ident[1] + + def __dictify_controls__(acc, control_item): + ckey = "{:.3f}".format(control_item[0]) + return {**acc, ckey: acc.get(ckey, tuple()) + (control_item[1],)} + + return (reduce(## for identical control traits + __merge_identicals__, + (item for item in reduce(# type: ignore[var-annotated] + __dictify_controls__, zip(control_values, control_names), + {}).items() if len(item[1]) > 1), + tuple()) + or + reduce(## If no identical control traits, try primary and controls + __merge_identicals__, + (item for item in reduce(# type: ignore[var-annotated] + __dictify_controls__, + zip((primary_value,) + control_values, + (primary_name,) + control_names), {}).items() + if len(item[1]) > 1), + tuple())) diff --git a/gn3/partial_correlations.py b/gn3/partial_correlations.py deleted file mode 100644 index 1fb0ccc..0000000 --- a/gn3/partial_correlations.py +++ /dev/null @@ -1,124 +0,0 @@ -""" -This module deals with partial correlations. - -It is an attempt to migrate over the partial correlations feature from -GeneNetwork1. -""" - -from functools import reduce -from typing import Any, Tuple, Sequence - -def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): - """ - Fetches data for the control traits. - - This migrates `web/webqtl/correlation/correlationFunction.controlStrain` in - GN1, with a few modifications to the arguments passed in. - - PARAMETERS: - controls: A map of sample names to trait data. Equivalent to the `cvals` - value in the corresponding source function in GN1. - sampleslist: A list of samples. Equivalent to `strainlst` in the - corresponding source function in GN1 - """ - def __process_control__(trait_data): - def __process_sample__(acc, sample): - if sample in trait_data["data"].keys(): - sample_item = trait_data["data"][sample] - val = sample_item["value"] - if val is not None: - return ( - acc[0] + (sample,), - acc[1] + (val,), - acc[2] + (sample_item["variance"],)) - return acc - return reduce( - __process_sample__, sampleslist, (tuple(), tuple(), tuple())) - - return reduce( - lambda acc, item: ( - acc[0] + (item[0],), - acc[1] + (item[1],), - acc[2] + (item[2],), - acc[3] + (len(item[0]),), - ), - [__process_control__(trait_data) for trait_data in controls], - (tuple(), tuple(), tuple(), tuple())) - -def dictify_by_samples(samples_vals_vars: Sequence[Sequence]) -> Sequence[dict]: - """ - Build a sequence of dictionaries from a sequence of separate sequences of - samples, values and variances. - - This is a partial migration of - `web.webqtl.correlation.correlationFunction.fixStrains` function in GN1. - This implementation extracts code that will find common use, and that will - find use in more than one place. - """ - return tuple( - { - sample: {"sample_name": sample, "value": val, "variance": var} - for sample, val, var in zip(*trait_line) - } for trait_line in zip(*(samples_vals_vars[0:3]))) - -def fix_samples(primary_trait: dict, control_traits: Sequence[dict]) -> Sequence[Sequence[Any]]: - """ - Corrects sample_names, values and variance such that they all contain only - those samples that are common to the reference trait and all control traits. - - This is a partial migration of the - `web.webqtl.correlation.correlationFunction.fixStrain` function in GN1. - """ - primary_samples = tuple( - present[0] for present in - ((sample, all(sample in control.keys() for control in control_traits)) - for sample in primary_trait.keys()) - if present[1]) - control_vals_vars: tuple = reduce( - lambda acc, x: (acc[0] + (x[0],), acc[1] + (x[1],)), - ((item["value"], item["variance"]) - for sublist in [tuple(control.values()) for control in control_traits] - for item in sublist), - (tuple(), tuple())) - return ( - primary_samples, - tuple(primary_trait[sample]["value"] for sample in primary_samples), - control_vals_vars[0], - tuple(primary_trait[sample]["variance"] for sample in primary_samples), - control_vals_vars[1]) - -def find_identical_traits( - primary_name: str, primary_value: float, control_names: Tuple[str, ...], - control_values: Tuple[float, ...]) -> Tuple[str, ...]: - """ - Find traits that have the same value when the values are considered to - 3 decimal places. - - This is a migration of the - `web.webqtl.correlation.correlationFunction.findIdenticalTraits` function in - GN1. - """ - def __merge_identicals__( - acc: Tuple[str, ...], - ident: Tuple[str, Tuple[str, ...]]) -> Tuple[str, ...]: - return acc + ident[1] - - def __dictify_controls__(acc, control_item): - ckey = "{:.3f}".format(control_item[0]) - return {**acc, ckey: acc.get(ckey, tuple()) + (control_item[1],)} - - return (reduce(## for identical control traits - __merge_identicals__, - (item for item in reduce(# type: ignore[var-annotated] - __dictify_controls__, zip(control_values, control_names), - {}).items() if len(item[1]) > 1), - tuple()) - or - reduce(## If no identical control traits, try primary and controls - __merge_identicals__, - (item for item in reduce(# type: ignore[var-annotated] - __dictify_controls__, - zip((primary_value,) + control_values, - (primary_name,) + control_names), {}).items() - if len(item[1]) > 1), - tuple())) -- cgit v1.2.3 From 4c73d70d6d844bf2fa3358c71b9e28daff51e69c Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 04:55:30 +0300 Subject: Move the function to computations module Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * The function `batch_computed_tissue_correlation` is a pure computations function with no expressions accessing the database, as far as I can tell, therefore, this commit moves the function over to the gn3.computations.partial_correlations module that holds the pure computation functions. --- gn3/computations/partial_correlations.py | 8 ++++++++ gn3/db/correlations.py | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 1fb0ccc..b3de31c 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -122,3 +122,11 @@ def find_identical_traits( (primary_name,) + control_names), {}).items() if len(item[1]) > 1), tuple())) + +def batch_computed_tissue_correlation( + trait_value: str, symbol_value_dict: dict, + method: str = "pearson") -> Tuple[dict, dict]: + """ + `web.webqtl.correlation.correlationFunction.batchCalTissueCorr`""" + raise Exception("Not implemented!") + return ({}, {}) diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index 54d3079..f43b8a5 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -281,14 +281,6 @@ def fetch_gene_symbol_tissue_value_dict_for_trait( return fetch_gene_symbol_tissue_value_dict(xref_info[0], xref_info[2], conn) return {} -def batch_computed_tissue_correlation( - trait_value: str, symbol_value_dict: dict, - method: str = "pearson") -> Tuple[dict, dict]: - """ - `web.webqtl.correlation.correlationFunction.batchCalTissueCorr`""" - raise Exception("Not implemented!") - return ({}, {}) - def correlations_of_all_tissue_traits( trait_symbol: str, probeset_freeze_id: int, method: str, conn: Any) -> Tuple[dict, dict]: -- cgit v1.2.3 From 0bb51bd78479c05839d7b7f9f878db4b5616cfda Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 06:34:19 +0300 Subject: Implement `tissue_correlation` function Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: New function (tissue_correlation) * tests/unit/test_partial_correlations.py -> tests/unit/computations/test_partial_correlations.py: Move module. Implement tests for new function Migrate the `cal_tissue_corr` function embedded in the `web.webqtl.correlation.correlationFunction.batchCalTissueCorr` function in GN1 and implement tests to ensure it works correctly. --- gn3/computations/partial_correlations.py | 27 +++ .../unit/computations/test_partial_correlations.py | 258 +++++++++++++++++++++ tests/unit/test_partial_correlations.py | 211 ----------------- 3 files changed, 285 insertions(+), 211 deletions(-) create mode 100644 tests/unit/computations/test_partial_correlations.py delete mode 100644 tests/unit/test_partial_correlations.py (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index b3de31c..e73edfd 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -7,6 +7,7 @@ GeneNetwork1. from functools import reduce from typing import Any, Tuple, Sequence +from scipy.stats import pearsonr, spearmanr def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): """ @@ -123,6 +124,32 @@ def find_identical_traits( if len(item[1]) > 1), tuple())) +def tissue_correlation( + primary_trait_values: Tuple[float, ...], + target_trait_values: Tuple[float, ...], + method: str) -> Tuple[float, float]: + """ + Compute the correlation between the primary trait values, and the values of + a single target value. + + This migrates the `cal_tissue_corr` function embedded in the larger + `web.webqtl.correlation.correlationFunction.batchCalTissueCorr` function in + GeneNetwork1. + """ + def spearman_corr(*args): + result = spearmanr(*args) + return (result.correlation, result.pvalue) + + method_fns = {"pearson": pearsonr, "spearman": spearman_corr} + + assert len(primary_trait_values) == len(target_trait_values), ( + "The lengths of the `primary_trait_values` and `target_trait_values` " + "must be equal") + assert method in method_fns.keys(), ( + "Method must be one of: {}".format(",".join(method_fns.keys()))) + + return method_fns[method](primary_trait_values, target_trait_values) + def batch_computed_tissue_correlation( trait_value: str, symbol_value_dict: dict, method: str = "pearson") -> Tuple[dict, dict]: diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py new file mode 100644 index 0000000..7ff8b80 --- /dev/null +++ b/tests/unit/computations/test_partial_correlations.py @@ -0,0 +1,258 @@ +"""Module contains tests for gn3.partial_correlations""" + +from unittest import TestCase +from gn3.computations.partial_correlations import * + +sampleslist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] +control_traits = ( + { + "mysqlid": 36688172, + "data": { + "B6cC3-1": { + "sample_name": "B6cC3-1", "value": 7.51879, "variance": None, + "ndata": None}, + "BXD1": { + "sample_name": "BXD1", "value": 7.77141, "variance": None, + "ndata": None}, + "BXD12": { + "sample_name": "BXD12", "value": 8.39265, "variance": None, + "ndata": None}, + "BXD16": { + "sample_name": "BXD16", "value": 8.17443, "variance": None, + "ndata": None}, + "BXD19": { + "sample_name": "BXD19", "value": 8.30401, "variance": None, + "ndata": None}, + "BXD2": { + "sample_name": "BXD2", "value": 7.80944, "variance": None, + "ndata": None}}}, + { + "mysqlid": 36688172, + "data": { + "B6cC3-21": { + "sample_name": "B6cC3-1", "value": 7.51879, "variance": None, + "ndata": None}, + "BXD21": { + "sample_name": "BXD1", "value": 7.77141, "variance": None, + "ndata": None}, + "BXD12": { + "sample_name": "BXD12", "value": 8.39265, "variance": None, + "ndata": None}, + "BXD16": { + "sample_name": "BXD16", "value": 8.17443, "variance": None, + "ndata": None}, + "BXD19": { + "sample_name": "BXD19", "value": 8.30401, "variance": None, + "ndata": None}, + "BXD2": { + "sample_name": "BXD2", "value": 7.80944, "variance": None, + "ndata": None}}}, + { + "mysqlid": 36688172, + "data": { + "B6cC3-1": { + "sample_name": "B6cC3-1", "value": 7.51879, "variance": None, + "ndata": None}, + "BXD1": { + "sample_name": "BXD1", "value": 7.77141, "variance": None, + "ndata": None}, + "BXD12": { + "sample_name": "BXD12", "value": None, "variance": None, + "ndata": None}, + "BXD16": { + "sample_name": "BXD16", "value": None, "variance": None, + "ndata": None}, + "BXD19": { + "sample_name": "BXD19", "value": None, "variance": None, + "ndata": None}, + "BXD2": { + "sample_name": "BXD2", "value": 7.80944, "variance": None, + "ndata": None}}}) + +dictified_control_samples = ( + {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, + "BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, + "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, + "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, + {"BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, + "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, + "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, + {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}) + +class TestPartialCorrelations(TestCase): + """Class for testing partial correlations computation functions""" + + def test_control_samples(self): + """Test that the control_samples works as expected.""" + self.assertEqual( + control_samples(control_traits, sampleslist), + ((("B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"), + ("BXD12", "BXD16", "BXD19", "BXD2"), + ("B6cC3-1", "BXD1", "BXD2")), + ((7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944), + (8.39265, 8.17443, 8.30401, 7.80944), + (7.51879, 7.77141, 7.80944)), + ((None, None, None, None, None, None), (None, None, None, None), + (None, None, None)), + (6, 4, 3))) + + def test_dictify_by_samples(self): + """ + Test that `dictify_by_samples` generates the appropriate dict + + Given: + a sequence of sequences with sample names, values and variances, as + in the output of `gn3.partial_correlations.control_samples` or + the output of `gn3.db.traits.export_informative` + When: + the sequence is passed as an argument into the + `gn3.partial_correlations.dictify_by_sample` + Then: + return a sequence of dicts with keys being the values of the sample + names, and each of who's values being sub-dicts with the keys + 'sample_name', 'value' and 'variance' whose values correspond to the + values passed in. + """ + self.assertEqual( + dictify_by_samples( + ((("B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"), + ("BXD12", "BXD16", "BXD19", "BXD2"), + ("B6cC3-1", "BXD1", "BXD2")), + ((7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944), + (8.39265, 8.17443, 8.30401, 7.80944), + (7.51879, 7.77141, 7.80944)), + ((None, None, None, None, None, None), (None, None, None, None), + (None, None, None)), + (6, 4, 3))), + dictified_control_samples) + + def test_fix_samples(self): + """ + Test that `fix_samples` returns only the common samples + + Given: + - A primary trait + - A sequence of control samples + When: + - The two arguments are passed to `fix_samples` + Then: + - Only the names of the samples present in the primary trait that + are also present in ALL the control traits are present in the + return value + - Only the values of the samples present in the primary trait that + are also present in ALL the control traits are present in the + return value + - ALL the values for ALL the control traits are present in the + return value + - Only the variances of the samples present in the primary trait + that are also present in ALL the control traits are present in the + return value + - ALL the variances for ALL the control traits are present in the + return value + - The return value is a tuple of the above items, in the following + order: + ((sample_names, ...), (primary_trait_values, ...), + (control_traits_values, ...), (primary_trait_variances, ...) + (control_traits_variances, ...)) + """ + self.assertEqual( + fix_samples( + {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, + "variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, + "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, + "variance": None}}, + dictified_control_samples), + (("BXD2",), (7.80944,), + (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944, 8.39265, + 8.17443, 8.30401, 7.80944, 7.51879, 7.77141, 7.80944), + (None,), + (None, None, None, None, None, None, None, None, None, None, None, + None, None))) + + def test_find_identical_traits(self): + """ + Test `gn3.partial_correlations.find_identical_traits`. + + Given: + - the name of a primary trait + - the value of a primary trait + - a sequence of names of control traits + - a sequence of values of control traits + When: + - the arguments above are passed to the `find_identical_traits` + function + Then: + - Return ALL trait names that have the same value when up to three + decimal places are considered + """ + for primn, primv, contn, contv, expected in ( + ("pt", 12.98395, ("ct0", "ct1", "ct2"), + (0.1234, 2.3456, 3.4567), tuple()), + ("pt", 12.98395, ("ct0", "ct1", "ct2"), + (12.98354, 2.3456, 3.4567), ("pt", "ct0")), + ("pt", 12.98395, ("ct0", "ct1", "ct2", "ct3"), + (0.1234, 2.3456, 0.1233, 4.5678), ("ct0", "ct2")) + ): + with self.subTest( + primary_name=primn, primary_value=primv, + control_names=contn, control_values=contv): + self.assertEqual( + find_identical_traits(primn, primv, contn, contv), expected) + + def test_tissue_correlation_error(self): + """ + Test that `tissue_correlation` raises specific exceptions for particular + error conditions. + """ + for primary, target, method, error, error_msg in ( + ((1,2,3), (4,5,6,7), "pearson", + AssertionError, + ( + "The lengths of the `primary_trait_values` and " + "`target_trait_values` must be equal")), + ((1,2,3), (4,5,6,7), "spearman", + AssertionError, + ( + "The lengths of the `primary_trait_values` and " + "`target_trait_values` must be equal")), + ((1,2,3,4), (5,6,7), "pearson", + AssertionError, + ( + "The lengths of the `primary_trait_values` and " + "`target_trait_values` must be equal")), + ((1,2,3,4), (5,6,7), "spearman", + AssertionError, + ( + "The lengths of the `primary_trait_values` and " + "`target_trait_values` must be equal")), + ((1,2,3), (4,5,6), "nonexistentmethod", + AssertionError, + ( + "Method must be one of: pearson, spearman"))): + with self.subTest(primary=primary, target=target, method=method): + with self.assertRaises(error, msg=error_msg): + tissue_correlation(primary, target, method) + + def test_tissue_correlation(self): + """ + Test that the correct correlation values are computed for the given: + - primary trait + - target trait + - method + """ + for primary, target, method, expected in ( + ((12.34, 18.36, 42.51), (37.25, 46.25, 46.56), "pearson", + (0.6761779252651052, 0.5272701133657985)), + ((1, 2, 3, 4, 5), (5, 6, 7, 8, 7), "spearman", + (0.8207826816681233, 0.08858700531354381)) + ): + with self.subTest(primary=primary, target=target, method=method): + self.assertEqual( + tissue_correlation(primary, target, method), expected) diff --git a/tests/unit/test_partial_correlations.py b/tests/unit/test_partial_correlations.py deleted file mode 100644 index 60e54c1..0000000 --- a/tests/unit/test_partial_correlations.py +++ /dev/null @@ -1,211 +0,0 @@ -"""Module contains tests for gn3.partial_correlations""" - -from unittest import TestCase -from gn3.partial_correlations import ( - fix_samples, - control_samples, - dictify_by_samples, - find_identical_traits) - -sampleslist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] -control_traits = ( - { - "mysqlid": 36688172, - "data": { - "B6cC3-1": { - "sample_name": "B6cC3-1", "value": 7.51879, "variance": None, - "ndata": None}, - "BXD1": { - "sample_name": "BXD1", "value": 7.77141, "variance": None, - "ndata": None}, - "BXD12": { - "sample_name": "BXD12", "value": 8.39265, "variance": None, - "ndata": None}, - "BXD16": { - "sample_name": "BXD16", "value": 8.17443, "variance": None, - "ndata": None}, - "BXD19": { - "sample_name": "BXD19", "value": 8.30401, "variance": None, - "ndata": None}, - "BXD2": { - "sample_name": "BXD2", "value": 7.80944, "variance": None, - "ndata": None}}}, - { - "mysqlid": 36688172, - "data": { - "B6cC3-21": { - "sample_name": "B6cC3-1", "value": 7.51879, "variance": None, - "ndata": None}, - "BXD21": { - "sample_name": "BXD1", "value": 7.77141, "variance": None, - "ndata": None}, - "BXD12": { - "sample_name": "BXD12", "value": 8.39265, "variance": None, - "ndata": None}, - "BXD16": { - "sample_name": "BXD16", "value": 8.17443, "variance": None, - "ndata": None}, - "BXD19": { - "sample_name": "BXD19", "value": 8.30401, "variance": None, - "ndata": None}, - "BXD2": { - "sample_name": "BXD2", "value": 7.80944, "variance": None, - "ndata": None}}}, - { - "mysqlid": 36688172, - "data": { - "B6cC3-1": { - "sample_name": "B6cC3-1", "value": 7.51879, "variance": None, - "ndata": None}, - "BXD1": { - "sample_name": "BXD1", "value": 7.77141, "variance": None, - "ndata": None}, - "BXD12": { - "sample_name": "BXD12", "value": None, "variance": None, - "ndata": None}, - "BXD16": { - "sample_name": "BXD16", "value": None, "variance": None, - "ndata": None}, - "BXD19": { - "sample_name": "BXD19", "value": None, "variance": None, - "ndata": None}, - "BXD2": { - "sample_name": "BXD2", "value": 7.80944, "variance": None, - "ndata": None}}}) - -dictified_control_samples = ( - {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, - "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, - "BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, - "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, - "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, - {"BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, - "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, - "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, - {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, - "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}) - -class TestPartialCorrelations(TestCase): - """Class for testing partial correlations computation functions""" - - def test_control_samples(self): - """Test that the control_samples works as expected.""" - self.assertEqual( - control_samples(control_traits, sampleslist), - ((("B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"), - ("BXD12", "BXD16", "BXD19", "BXD2"), - ("B6cC3-1", "BXD1", "BXD2")), - ((7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944), - (8.39265, 8.17443, 8.30401, 7.80944), - (7.51879, 7.77141, 7.80944)), - ((None, None, None, None, None, None), (None, None, None, None), - (None, None, None)), - (6, 4, 3))) - - def test_dictify_by_samples(self): - """ - Test that `dictify_by_samples` generates the appropriate dict - - Given: - a sequence of sequences with sample names, values and variances, as - in the output of `gn3.partial_correlations.control_samples` or - the output of `gn3.db.traits.export_informative` - When: - the sequence is passed as an argument into the - `gn3.partial_correlations.dictify_by_sample` - Then: - return a sequence of dicts with keys being the values of the sample - names, and each of who's values being sub-dicts with the keys - 'sample_name', 'value' and 'variance' whose values correspond to the - values passed in. - """ - self.assertEqual( - dictify_by_samples( - ((("B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"), - ("BXD12", "BXD16", "BXD19", "BXD2"), - ("B6cC3-1", "BXD1", "BXD2")), - ((7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944), - (8.39265, 8.17443, 8.30401, 7.80944), - (7.51879, 7.77141, 7.80944)), - ((None, None, None, None, None, None), (None, None, None, None), - (None, None, None)), - (6, 4, 3))), - dictified_control_samples) - - def test_fix_samples(self): - """ - Test that `fix_samples` returns only the common samples - - Given: - - A primary trait - - A sequence of control samples - When: - - The two arguments are passed to `fix_samples` - Then: - - Only the names of the samples present in the primary trait that - are also present in ALL the control traits are present in the - return value - - Only the values of the samples present in the primary trait that - are also present in ALL the control traits are present in the - return value - - ALL the values for ALL the control traits are present in the - return value - - Only the variances of the samples present in the primary trait - that are also present in ALL the control traits are present in the - return value - - ALL the variances for ALL the control traits are present in the - return value - - The return value is a tuple of the above items, in the following - order: - ((sample_names, ...), (primary_trait_values, ...), - (control_traits_values, ...), (primary_trait_variances, ...) - (control_traits_variances, ...)) - """ - self.assertEqual( - fix_samples( - {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, - "variance": None}, - "BXD1": {"sample_name": "BXD1", "value": 7.77141, - "variance": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, - "variance": None}}, - dictified_control_samples), - (("BXD2",), (7.80944,), - (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944, 8.39265, - 8.17443, 8.30401, 7.80944, 7.51879, 7.77141, 7.80944), - (None,), - (None, None, None, None, None, None, None, None, None, None, None, - None, None))) - - def test_find_identical_traits(self): - """ - Test `gn3.partial_correlations.find_identical_traits`. - - Given: - - the name of a primary trait - - the value of a primary trait - - a sequence of names of control traits - - a sequence of values of control traits - When: - - the arguments above are passed to the `find_identical_traits` - function - Then: - - Return ALL trait names that have the same value when up to three - decimal places are considered - """ - for primn, primv, contn, contv, expected in ( - ("pt", 12.98395, ("ct0", "ct1", "ct2"), - (0.1234, 2.3456, 3.4567), tuple()), - ("pt", 12.98395, ("ct0", "ct1", "ct2"), - (12.98354, 2.3456, 3.4567), ("pt", "ct0")), - ("pt", 12.98395, ("ct0", "ct1", "ct2", "ct3"), - (0.1234, 2.3456, 0.1233, 4.5678), ("ct0", "ct2")) - ): - with self.subTest( - primary_name=primn, primary_value=primv, - control_names=contn, control_values=contv): - self.assertEqual( - find_identical_traits(primn, primv, contn, contv), expected) -- cgit v1.2.3 From 5b9696169004fef605820d3439ba06b16b578cd0 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 06:37:24 +0300 Subject: Add missing comma Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi --- gn3/db/species.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/db/species.py b/gn3/db/species.py index abcbf64..702a9a8 100644 --- a/gn3/db/species.py +++ b/gn3/db/species.py @@ -48,7 +48,7 @@ def translate_to_mouse_gene_id(species: str, geneid: int, conn: Any) -> int: with conn.cursor as cursor: query = { - "rat": "SELECT mouse FROM GeneIDXRef WHERE rat = %s" + "rat": "SELECT mouse FROM GeneIDXRef WHERE rat = %s", "human": "SELECT mouse FROM GeneIDXRef WHERE human = %s" } cursor.execute(query[species], geneid) -- cgit v1.2.3 From 3609a2d734bfc259ad29b865a9cb45d57124670a Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 06:59:57 +0300 Subject: Move `correlations_of_all_tissue_traits` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: new function (`correlations_of_all_tissue_traits`). * gn3/db/correlations.py: delete function (`correlations_of_all_tissue_traits`). Move the function to `gn3.computations.partial_correlations` module and comment out the db-access code. Rework it to receive, as arguments, the data it previously fetched from the database, and add comments on future rework to get the function working again. --- gn3/computations/partial_correlations.py | 27 +++++++++++++++++++++++++++ gn3/db/correlations.py | 20 -------------------- 2 files changed, 27 insertions(+), 20 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index e73edfd..4ba2ba4 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -157,3 +157,30 @@ def batch_computed_tissue_correlation( `web.webqtl.correlation.correlationFunction.batchCalTissueCorr`""" raise Exception("Not implemented!") return ({}, {}) + +def correlations_of_all_tissue_traits( + primary_trait_symbol_value_dict: dict, symbol_value_dict: dict, + method: str) -> Tuple[dict, dict]: + """ + Computes and returns the correlation of all tissue traits. + + This is a migration of the + `web.webqtl.correlation.correlationFunction.calculateCorrOfAllTissueTrait` + function in GeneNetwork1. + """ + # The section below existed in the original function, but with the migration + # and the proposed rework (in the near future), the values from the database + # should be passed into this function, rather than have the function fetch + # the data for itself. + # --------------------------------------------------- + # primary_trait_symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( + # (trait_symbol,), probeset_freeze_id, conn) + # primary_trait_values = primary_trait_symbol_value_dict.vlaues()[0] + # symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( + # tuple(), probeset_freeze_id, conn) + # --------------------------------------------------- + # We might end up actually getting rid of this function all together as the + # rework is done. + primary_trait_values = primary_trait_symbol_value_dict.values()[0] + return batch_computed_tissue_correlation( + primary_trait_values, symbol_value_dict, method) diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index f43b8a5..39ed499 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -281,26 +281,6 @@ def fetch_gene_symbol_tissue_value_dict_for_trait( return fetch_gene_symbol_tissue_value_dict(xref_info[0], xref_info[2], conn) return {} -def correlations_of_all_tissue_traits( - trait_symbol: str, probeset_freeze_id: int, - method: str, conn: Any) -> Tuple[dict, dict]: - """ - Computes and returns the correlation of all tissue traits. - - This is a migration of the - `web.webqtl.correlation.correlationFunction.calculateCorrOfAllTissueTrait` - function in GeneNetwork1. - """ - primary_trait_symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( - (trait_symbol,), probeset_freeze_id, conn) - primary_trait_value = primary_trait_symbol_value_dict.vlaues()[0] - symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( - tuple(), probeset_freeze_id, conn) - if method == "1": - return batch_computed_tissue_correlation( - primaryTraitValue,SymbolValueDict,method='spearman') - return batch_computed_tissue_correlation(primaryTraitValue,SymbolValueDict) - def build_temporary_tissue_correlations_table( trait_symbol: str, probeset_freeze_id: int, method: str, return_number: int, conn: Any) -> str: -- cgit v1.2.3 From 1b5e448ccecdfa146942bbb3d5b22bbbccd492c9 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 07:50:37 +0300 Subject: Complete implementation of `batch_computed_tissue_correlation` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Complete the implementation of the `batch_computed_tissue_correlation` function --- gn3/computations/partial_correlations.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 4ba2ba4..d095185 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -151,12 +151,17 @@ def tissue_correlation( return method_fns[method](primary_trait_values, target_trait_values) def batch_computed_tissue_correlation( - trait_value: str, symbol_value_dict: dict, - method: str = "pearson") -> Tuple[dict, dict]: + primary_trait_values: Tuple[float, ...], target_traits_dict: dict, + method: str) -> Tuple[dict, dict]: + """ + This is a migration of the + `web.webqtl.correlation.correlationFunction.batchCalTissueCorr` function in + GeneNetwork1 """ - `web.webqtl.correlation.correlationFunction.batchCalTissueCorr`""" - raise Exception("Not implemented!") - return ({}, {}) + def __corr__(acc, target): + corr = tissue_correlation(primary_trait_values, target[1], method) + return ({**acc[0], target[0]: corr[0]}, {**acc[0], target[1]: corr[1]}) + return reduce(__corr__, target_traits_dict.items(), ({}, {})) def correlations_of_all_tissue_traits( primary_trait_symbol_value_dict: dict, symbol_value_dict: dict, -- cgit v1.2.3 From 6bfc0e9e9bce5e2505588372ce55ba892db6bda0 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 08:00:27 +0300 Subject: Complete `build_temporary_tissue_correlations_table` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: Remove comments after updating usage of the function at call point * gn3/db/correlations.py: Complete the implementation of the `build_temporary_tissue_correlations_table` function --- gn3/computations/partial_correlations.py | 13 ------------ gn3/db/correlations.py | 36 +++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 16 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index d095185..5777a0b 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -173,19 +173,6 @@ def correlations_of_all_tissue_traits( `web.webqtl.correlation.correlationFunction.calculateCorrOfAllTissueTrait` function in GeneNetwork1. """ - # The section below existed in the original function, but with the migration - # and the proposed rework (in the near future), the values from the database - # should be passed into this function, rather than have the function fetch - # the data for itself. - # --------------------------------------------------- - # primary_trait_symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( - # (trait_symbol,), probeset_freeze_id, conn) - # primary_trait_values = primary_trait_symbol_value_dict.vlaues()[0] - # symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( - # tuple(), probeset_freeze_id, conn) - # --------------------------------------------------- - # We might end up actually getting rid of this function all together as the - # rework is done. primary_trait_values = primary_trait_symbol_value_dict.values()[0] return batch_computed_tissue_correlation( primary_trait_values, symbol_value_dict, method) diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index 39ed499..28f050a 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -290,10 +290,40 @@ def build_temporary_tissue_correlations_table( This is a migration of the `web.webqtl.correlation.CorrelationPage.getTempTissueCorrTable` function in GeneNetwork1.""" + # We should probably pass the `correlations_of_all_tissue_traits` function + # as an argument to this function and get rid of the two lines immediately + # following this comment. + from gn3.computations.partial_correlations import correlations_of_all_tissue_traits symbol_corr_dict, symbol_p_value_dict = correlations_of_all_tissue_traits( - trait_symbol, probeset_freeze_id, method, conn) - raise Exception("Unimplemented!!!") - return "" + fetch_gene_symbol_tissue_value_dict_for_trait( + (trait_symbol,), probeset_freeze_id, conn), + fetch_gene_symbol_tissue_value_dict_for_trait( + tuple(), probeset_freeze_id, conn), + method) + + symbol_corr_list = sorted( + symbol_corr_dict.items(), + key=compare_tissue_correlation_absolute_values) + + temp_table_name = f"TOPTISSUE{random_string(8)}" + create_query = ( + "CREATE TEMPORARY TABLE {temp_table_name}" + "(Symbol varchar(100) PRIMARY KEY, Correlation float, PValue float)") + insert_query = ( + f"INSERT INTO {temp_table_name}(Symbol, Correlation, PValue) " + " VALUES (%(symbol)s, %(correlation)s, %(pvalue)s)") + + with conn.cursor() as cursor: + cursor.execute(create_query) + cursor.execute( + insert_query, + tuple({ + "symbol": symbol, + "correlation": corr, + "pvalue": symbol_p_value_dict[symbol] + } for symbol, corr in symbol_corr_list[0: 2 * return_number])) + + return temp_table_name def fetch_tissue_correlations( dataset: dict, trait_symbol: str, probeset_freeze_id: int, method: str, -- cgit v1.2.3 From 1394adf862f0f6c7f403301faf4dd7812c2d1ea2 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 08:25:13 +0300 Subject: Rework sorting: remove `compare_tissue_correlation_absolute_values` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/db/correlations.py: Remove the `compare_tissue_correlation_absolute_values` function which is no longer needed. --- gn3/db/correlations.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index 28f050a..d7954e5 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -140,22 +140,6 @@ def fetch_literature_correlations( cursor.execute("DROP TEMPORARY TABLE %s", temp_table) return dict(results) -def compare_tissue_correlation_absolute_values(val1, val2): - """ - Comparison function for use when sorting tissue correlation values. - - This is a partial migration of the - `web.webqtl.correlation.CorrelationPage.getTempTissueCorrTable` function in - GeneNetwork1.""" - try: - if abs(val1) < abs(val2): - return 1 - if abs(val1) == abs(val2): - return 0 - return -1 - except TypeError: - return 0 - def fetch_symbol_value_pair_dict( symbol_list: Tuple[str, ...], data_id_dict: dict, conn: Any) -> Dict[str, Tuple[float, ...]]: @@ -302,8 +286,7 @@ def build_temporary_tissue_correlations_table( method) symbol_corr_list = sorted( - symbol_corr_dict.items(), - key=compare_tissue_correlation_absolute_values) + symbol_corr_dict.items(), key=lambda key_val: key_val[1]) temp_table_name = f"TOPTISSUE{random_string(8)}" create_query = ( -- cgit v1.2.3 From 37f7fee32604e9ae752a33b473dd1abe22b05906 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 08:28:19 +0300 Subject: Fix linting and typing errors Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi --- gn3/computations/partial_correlations.py | 2 +- gn3/db/correlations.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 5777a0b..fce6ad2 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -173,6 +173,6 @@ def correlations_of_all_tissue_traits( `web.webqtl.correlation.correlationFunction.calculateCorrOfAllTissueTrait` function in GeneNetwork1. """ - primary_trait_values = primary_trait_symbol_value_dict.values()[0] + primary_trait_values = tuple(primary_trait_symbol_value_dict.values())[0] return batch_computed_tissue_correlation( primary_trait_values, symbol_value_dict, method) diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index d7954e5..d94759a 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -10,6 +10,8 @@ from gn3.random import random_string from gn3.data_helpers import partition_all from gn3.db.species import translate_to_mouse_gene_id +from gn3.computations.partial_correlations import correlations_of_all_tissue_traits + def get_filename(target_db_name: str, conn: Any) -> str: """ Retrieve the name of the reference database file with which correlations are @@ -275,9 +277,8 @@ def build_temporary_tissue_correlations_table( `web.webqtl.correlation.CorrelationPage.getTempTissueCorrTable` function in GeneNetwork1.""" # We should probably pass the `correlations_of_all_tissue_traits` function - # as an argument to this function and get rid of the two lines immediately + # as an argument to this function and get rid of the one call immediately # following this comment. - from gn3.computations.partial_correlations import correlations_of_all_tissue_traits symbol_corr_dict, symbol_p_value_dict = correlations_of_all_tissue_traits( fetch_gene_symbol_tissue_value_dict_for_trait( (trait_symbol,), probeset_freeze_id, conn), @@ -308,7 +309,7 @@ def build_temporary_tissue_correlations_table( return temp_table_name -def fetch_tissue_correlations( +def fetch_tissue_correlations(# pylint: disable=R0913 dataset: dict, trait_symbol: str, probeset_freeze_id: int, method: str, return_number: int, conn: Any) -> dict: """ -- cgit v1.2.3 From 116006464a61edcfa354b729ea40a7af28c08d61 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 08:38:48 +0300 Subject: Specify ten (10) decimal places Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: specify 10 decimal places * tests/unit/computations/test_partial_correlations.py: update examples Slight differences in python implementations, possibly hardware and operating systems could cause the value of float (double) values to be different in the less significant parts of the decimal places. This commit limits the usable part of the decimals to the first 10 decimal places for now. --- gn3/computations/partial_correlations.py | 4 +++- tests/unit/computations/test_partial_correlations.py | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index fce6ad2..8a00931 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -148,7 +148,9 @@ def tissue_correlation( assert method in method_fns.keys(), ( "Method must be one of: {}".format(",".join(method_fns.keys()))) - return method_fns[method](primary_trait_values, target_trait_values) + return tuple( + round(n, 10) for n in + method_fns[method](primary_trait_values, target_trait_values)) def batch_computed_tissue_correlation( primary_trait_values: Tuple[float, ...], target_traits_dict: dict, diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py index ac5eb20..c4ec79a 100644 --- a/tests/unit/computations/test_partial_correlations.py +++ b/tests/unit/computations/test_partial_correlations.py @@ -254,10 +254,9 @@ class TestPartialCorrelations(TestCase): """ for primary, target, method, expected in ( ((12.34, 18.36, 42.51), (37.25, 46.25, 46.56), "pearson", - (0.6761779252651052, 0.5272701133657985)), + (0.6761779253, 0.5272701134)), ((1, 2, 3, 4, 5), (5, 6, 7, 8, 7), "spearman", - (0.8207826816681233, 0.08858700531354381)) - ): + (0.8207826817, 0.0885870053))): with self.subTest(primary=primary, target=target, method=method): self.assertEqual( tissue_correlation(primary, target, method), expected) -- cgit v1.2.3 From bfe73a913836395fbcebea442e3118e73ac9255f Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 08:48:16 +0300 Subject: Explicitly round the values * Explicitly round the values to prevent issues with the type-checker --- gn3/computations/partial_correlations.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 8a00931..151143a 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -148,9 +148,8 @@ def tissue_correlation( assert method in method_fns.keys(), ( "Method must be one of: {}".format(",".join(method_fns.keys()))) - return tuple( - round(n, 10) for n in - method_fns[method](primary_trait_values, target_trait_values)) + corr, pvalue = method_fns[method](primary_trait_values, target_trait_values) + return (round(corr, 10), round(pvalue, 10)) def batch_computed_tissue_correlation( primary_trait_values: Tuple[float, ...], target_traits_dict: dict, -- cgit v1.2.3 From 8f036415975d6e224e5e94277997329c0f1fa159 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Fri, 29 Oct 2021 09:49:28 +0300 Subject: Feature/biweight reimplementation (#47) * add biweight reimplementation with pingouin * delete biweight scripts and tests * add python-pingouin to guix file * delete biweight paths * mypy fix:pingouin mising imports * pep8 formatting && pylint fixes--- gn3/computations/biweight.py | 27 ------------------ gn3/computations/correlations.py | 11 ++++---- gn3/settings.py | 3 -- guix.scm | 1 + mypy.ini | 3 ++ scripts/calculate_biweight.R | 43 ----------------------------- tests/unit/computations/test_biweight.py | 21 -------------- tests/unit/computations/test_correlation.py | 11 -------- 8 files changed, 9 insertions(+), 111 deletions(-) delete mode 100644 gn3/computations/biweight.py delete mode 100644 scripts/calculate_biweight.R delete mode 100644 tests/unit/computations/test_biweight.py (limited to 'gn3') diff --git a/gn3/computations/biweight.py b/gn3/computations/biweight.py deleted file mode 100644 index 7accd0c..0000000 --- a/gn3/computations/biweight.py +++ /dev/null @@ -1,27 +0,0 @@ -"""module contains script to call biweight midcorrelation in R""" -import subprocess - -from typing import List -from typing import Tuple - -from gn3.settings import BIWEIGHT_RSCRIPT - - -def calculate_biweight_corr(trait_vals: List, - target_vals: List, - path_to_script: str = BIWEIGHT_RSCRIPT, - command: str = "Rscript" - ) -> Tuple[float, float]: - """biweight function""" - - args_1 = ' '.join(str(trait_val) for trait_val in trait_vals) - args_2 = ' '.join(str(target_val) for target_val in target_vals) - cmd = [command, path_to_script] + [args_1] + [args_2] - - results = subprocess.check_output(cmd, universal_newlines=True) - try: - (corr_coeff, p_val) = tuple( - [float(y.strip()) for y in results.split()]) - return (corr_coeff, p_val) - except Exception as error: - raise error diff --git a/gn3/computations/correlations.py b/gn3/computations/correlations.py index bb13ff1..c930df0 100644 --- a/gn3/computations/correlations.py +++ b/gn3/computations/correlations.py @@ -8,7 +8,7 @@ from typing import Optional from typing import Callable import scipy.stats -from gn3.computations.biweight import calculate_biweight_corr +import pingouin as pg def map_shared_keys_to_values(target_sample_keys: List, @@ -102,11 +102,10 @@ package :not packaged in guix """ - try: - results = calculate_biweight_corr(x_val, y_val) - return results - except Exception as error: - raise error + results = pg.corr(x_val, y_val, method="bicor") + corr_coeff = results["r"].values[0] + p_val = results["p-val"].values[0] + return (corr_coeff, p_val) def filter_shared_sample_keys(this_samplelist, diff --git a/gn3/settings.py b/gn3/settings.py index d5f1d3c..e85eeff 100644 --- a/gn3/settings.py +++ b/gn3/settings.py @@ -22,9 +22,6 @@ SQLALCHEMY_TRACK_MODIFICATIONS = False GN2_BASE_URL = "http://www.genenetwork.org/" -# biweight script -BIWEIGHT_RSCRIPT = "~/genenetwork3/scripts/calculate_biweight.R" - # wgcna script WGCNA_RSCRIPT = "wgcna_analysis.R" # qtlreaper command diff --git a/guix.scm b/guix.scm index d8b1596..81e8389 100644 --- a/guix.scm +++ b/guix.scm @@ -110,6 +110,7 @@ ("r-rjson" ,r-rjson) ("python-plotly" ,python-plotly) ("python-pandas" ,python-pandas) + ("python-pingouin" ,python-pingouin) ("rust-qtlreaper" ,rust-qtlreaper) ("python-flask-cors" ,python-flask-cors))) (build-system python-build-system) diff --git a/mypy.ini b/mypy.ini index 5d66812..a507703 100644 --- a/mypy.ini +++ b/mypy.ini @@ -11,3 +11,6 @@ ignore_missing_imports = True [mypy-ipfshttpclient.*] ignore_missing_imports = True + +[mypy-pingouin.*] +ignore_missing_imports = True \ No newline at end of file diff --git a/scripts/calculate_biweight.R b/scripts/calculate_biweight.R deleted file mode 100644 index 8d8366e..0000000 --- a/scripts/calculate_biweight.R +++ /dev/null @@ -1,43 +0,0 @@ - -library(testthat) -library(WGCNA) - -arg_values <- commandArgs(trailingOnly = TRUE) -ParseArgs <- function(args){ - - trait_vals <- as.numeric(unlist(strsplit(args[1], split=" "))) - target_vals <- as.numeric(unlist(strsplit(args[2], split=" "))) - - return(list(trait_vals= c(trait_vals),target_vals = c(target_vals))) - -} -BiweightMidCorrelation <- function(trait_val,target_val){ - - results <-bicorAndPvalue(as.numeric(unlist(trait_val)),as.numeric(unlist(target_val))) - return ((c(c(results$bicor)[1],c(results$p)[1]))) - -} - - - -test_that("biweight results"),{ - vec_1 <- c(1,2,3,4) - vec_2 <- c(1,2,3,4) - - results <- BiweightMidCorrelation(vec_1,vec_2) - expect_equal(c(1.0,0.0),results) -} - - -test_that("parsing args "),{ - my_args <- c("1 2 3 4","5 6 7 8") - results <- ParseArgs(my_args) - - expect_equal(results[1],c(1,2,3,4)) - expect_equal(results[2],c(5,6,7,8)) -} - -parsed_values <- ParseArgs(arg_values) - - -cat(BiweightMidCorrelation(parsed_values[1],parsed_values[2])) \ No newline at end of file diff --git a/tests/unit/computations/test_biweight.py b/tests/unit/computations/test_biweight.py deleted file mode 100644 index ad404f1..0000000 --- a/tests/unit/computations/test_biweight.py +++ /dev/null @@ -1,21 +0,0 @@ -"""test for biweight script""" -from unittest import TestCase -from unittest import mock - -from gn3.computations.biweight import calculate_biweight_corr - - -class TestBiweight(TestCase): - """test class for biweight""" - - @mock.patch("gn3.computations.biweight.subprocess.check_output") - def test_calculate_biweight_corr(self, mock_check_output): - """test for calculate_biweight_corr func""" - mock_check_output.return_value = "0.1 0.5" - results = calculate_biweight_corr(command="Rscript", - path_to_script="./r_script.R", - trait_vals=[ - 1.2, 1.1, 1.9], - target_vals=[1.9, 0.4, 1.1]) - - self.assertEqual(results, (0.1, 0.5)) diff --git a/tests/unit/computations/test_correlation.py b/tests/unit/computations/test_correlation.py index fc52ec1..96d9c6d 100644 --- a/tests/unit/computations/test_correlation.py +++ b/tests/unit/computations/test_correlation.py @@ -5,7 +5,6 @@ from unittest import mock from collections import namedtuple from gn3.computations.correlations import normalize_values -from gn3.computations.correlations import do_bicor from gn3.computations.correlations import compute_sample_r_correlation from gn3.computations.correlations import compute_all_sample_correlation from gn3.computations.correlations import filter_shared_sample_keys @@ -98,16 +97,6 @@ class TestCorrelation(TestCase): self.assertEqual(results, expected_results) - @mock.patch("gn3.computations.correlations.calculate_biweight_corr") - def test_bicor(self, mock_biweight): - """Test for doing biweight mid correlation """ - mock_biweight.return_value = (1.0, 0.0) - - results = do_bicor(x_val=[1, 2, 3], y_val=[4, 5, 6]) - - self.assertEqual(results, (1.0, 0.0) - ) - @mock.patch("gn3.computations.correlations.compute_corr_coeff_p_value") @mock.patch("gn3.computations.correlations.normalize_values") def test_compute_sample_r_correlation(self, norm_vals, compute_corr): -- cgit v1.2.3 From 1a7b59a4d58c21759c265e5b5f413a533c1a2293 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 1 Nov 2021 06:01:58 +0300 Subject: Add some condition checking functions Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Add the `check_for_literature_info` and `check_symbol_for_tissue_correlation` functions to check for the presence of specific data. --- gn3/db/correlations.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index d94759a..06b3310 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -339,3 +339,43 @@ def fetch_tissue_correlations(# pylint: disable=R0913 return { trait_name: (tiss_corr, tiss_p_val) for trait_name, tiss_corr, tiss_p_val in results} + +def check_for_literature_info(conn: Any, geneid: int) -> bool: + """ + Checks the database to find out whether the trait with `geneid` has any + associated literature. + + This is a migration of the + `web.webqtl.correlation.CorrelationPage.checkForLitInfo` function in + GeneNetwork1. + """ + query = "SELECT 1 FROM LCorrRamin3 WHERE GeneId1=%s LIMIT 1" + with conn.cursor() as cursor: + cursor.execute(query, geneid) + result = cursor.fetchone() + if result: + return True + + return False + +def check_symbol_for_tissue_correlation( + conn: Any, tissue_probeset_freeze_id: int, symbol: str = "") -> bool: + """ + Checks whether a symbol has any associated tissue correlations. + + This is a migration of the + `web.webqtl.correlation.CorrelationPage.checkSymbolForTissueCorr` function + in GeneNetwork1. + """ + query = ( + "SELECT 1 FROM TissueProbeSetXRef " + "WHERE TissueProbeSetFreezeId=%(probeset_freeze_id)s " + "AND Symbol=%(symbol)s LIMIT 1") + with conn.cursor() as cursor: + cursor.execute( + query, probeset_freeze_id=tissue_probeset_freeze_id, symbol=symbol) + result = cursor.fetchone() + if result: + return True + + return False -- cgit v1.2.3 From 21c8c341956bb3c9cac427ab5b951976d70f4245 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 1 Nov 2021 07:09:26 +0300 Subject: Parse single line from CSV file Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/data_helpers.py: New function (parse_csv_line) * tests/unit/test_data_helpers.py: Add tests for new function (parse_csv_line) Add a function to parse a single line from a CSV file. --- gn3/data_helpers.py | 13 ++++++++++++- tests/unit/test_data_helpers.py | 26 +++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) (limited to 'gn3') diff --git a/gn3/data_helpers.py b/gn3/data_helpers.py index f0d971e..741a885 100644 --- a/gn3/data_helpers.py +++ b/gn3/data_helpers.py @@ -5,7 +5,7 @@ data structures. from math import ceil from functools import reduce -from typing import Any, Tuple, Sequence +from typing import Any, Tuple, Sequence, Optional def partition_all(num: int, items: Sequence[Any]) -> Tuple[Tuple[Any, ...], ...]: """ @@ -23,3 +23,14 @@ def partition_all(num: int, items: Sequence[Any]) -> Tuple[Tuple[Any, ...], ...] tuple(items[start:stop]) for start, stop # type: ignore[has-type] in reduce( __compute_start_stop__, iterations, tuple())]) + +def parse_csv_line( + line:str, delimiter: str = ",", quoting:Optional[str] = '"') -> Tuple[str, ...]: + """ + Parses a line from a CSV file into a tuple of strings. + + This is a migration of the `web.webqtl.utility.webqtlUtil.readLineCSV` + function in GeneNetwork1. + """ + return tuple( + col.strip("{} \t\n".format(quoting)) for col in line.split(delimiter)) diff --git a/tests/unit/test_data_helpers.py b/tests/unit/test_data_helpers.py index 1eec3cc..39aea45 100644 --- a/tests/unit/test_data_helpers.py +++ b/tests/unit/test_data_helpers.py @@ -4,7 +4,7 @@ Test functions in gn3.data_helpers from unittest import TestCase -from gn3.data_helpers import partition_all +from gn3.data_helpers import partition_all, parse_csv_line class TestDataHelpers(TestCase): """ @@ -35,3 +35,27 @@ class TestDataHelpers(TestCase): ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9), ))): with self.subTest(n=count, items=items): self.assertEqual(partition_all(count, items), expected) + + def test_parse_csv_line(self): + """ + Test parsing a single line from a CSV file + + Given: + - `line`: a line read from a csv file + - `delimiter`: the expected delimiter in the csv file + - `quoting`: the quoting enclosing each column in the csv file + When: + - `line` is parsed with the `parse_csv_file` with the given + parameters + Then: + - return a tuple of the columns in the CSV file, without the + delimiter and quoting + """ + for line, delimiter, quoting, expected in ( + ('"this","is","a","test"', ",", '"', ("this", "is", "a", "test")), + ('"this","is","a","test"', ",", None, ('"this"', '"is"', '"a"', '"test"'))): + with self.subTest(line=line, delimiter=delimiter, quoting=quoting): + self.assertEqual( + parse_csv_line( + line=line, delimiter=delimiter, quoting=quoting), + expected) -- cgit v1.2.3 From d4919b2b59facb79ccad155e1d2826a97119ec28 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 1 Nov 2021 08:17:41 +0300 Subject: Fix some linting errors Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi --- gn3/data_helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/data_helpers.py b/gn3/data_helpers.py index 741a885..d3f942b 100644 --- a/gn3/data_helpers.py +++ b/gn3/data_helpers.py @@ -25,7 +25,8 @@ def partition_all(num: int, items: Sequence[Any]) -> Tuple[Tuple[Any, ...], ...] __compute_start_stop__, iterations, tuple())]) def parse_csv_line( - line:str, delimiter: str = ",", quoting:Optional[str] = '"') -> Tuple[str, ...]: + line: str, delimiter: str = ",", + quoting: Optional[str] = '"') -> Tuple[str, ...]: """ Parses a line from a CSV file into a tuple of strings. -- cgit v1.2.3 From 37cf87e94a44ba2ab26a8e458e0c5a90fe5ecc7a Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 1 Nov 2021 08:18:48 +0300 Subject: Retrieve indices of the selected samples Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: New function (good_dataset_samples_indexes). * tests/unit/computations/test_partial_correlations.py: Tests for new function (good_dataset_samples_indexes) Get the indices of the selected samples. This is a partial migration of the `web.webqtl.correlation.PartialCorrDBPage.getPartialCorrelationsFast` function in GN1. --- gn3/computations/partial_correlations.py | 15 +++++++++++++++ tests/unit/computations/test_partial_correlations.py | 13 ++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 151143a..ba4de9e 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -177,3 +177,18 @@ def correlations_of_all_tissue_traits( primary_trait_values = tuple(primary_trait_symbol_value_dict.values())[0] return batch_computed_tissue_correlation( primary_trait_values, symbol_value_dict, method) + +def good_dataset_samples_indexes( + samples: Tuple[str, ...], + samples_from_file: Tuple[str, ...]) -> Tuple[int, ...]: + """ + Return the indexes of the items in `samples_from_files` that are also found + in `samples`. + + This is a partial migration of the + `web.webqtl.correlation.PartialCorrDBPage.getPartialCorrelationsFast` + function in GeneNetwork1. + """ + return tuple(sorted( + samples_from_file.index(good) for good in + set(samples).intersection(set(samples_from_file)))) diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py index c4ec79a..f7217a9 100644 --- a/tests/unit/computations/test_partial_correlations.py +++ b/tests/unit/computations/test_partial_correlations.py @@ -6,7 +6,8 @@ from gn3.computations.partial_correlations import ( control_samples, dictify_by_samples, tissue_correlation, - find_identical_traits) + find_identical_traits, + good_dataset_samples_indexes) sampleslist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] control_traits = ( @@ -260,3 +261,13 @@ class TestPartialCorrelations(TestCase): with self.subTest(primary=primary, target=target, method=method): self.assertEqual( tissue_correlation(primary, target, method), expected) + + def test_good_dataset_samples_indexes(self): + """ + Test that `good_dataset_samples_indexes` returns correct indices. + """ + self.assertEqual( + good_dataset_samples_indexes( + ("a", "e", "i", "k"), + ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l")), + (0, 4, 8, 10)) -- cgit v1.2.3 From 21bf6af02e33865f00319467ba4670fa3d872961 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Fri, 29 Oct 2021 08:33:37 +0300 Subject: Add auth module --- gn3/authentication.py | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 gn3/authentication.py (limited to 'gn3') diff --git a/gn3/authentication.py b/gn3/authentication.py new file mode 100644 index 0000000..baf2c7a --- /dev/null +++ b/gn3/authentication.py @@ -0,0 +1,94 @@ +import functools +import json +import redis +import requests + +from typing import Dict +from enum import Enum, unique +from urllib.parse import urljoin + + +@functools.total_ordering +class OrderedEnum(Enum): + @classmethod + @functools.lru_cache(None) + def _member_list(cls): + return list(cls) + + def __lt__(self, other): + if self.__class__ is other.__class__: + member_list = self.__class__._member_list() + return member_list.index(self) < member_list.index(other) + return NotImplemented + + +@unique +class DataRole(OrderedEnum): + NO_ACCESS = "no-access" + VIEW = "view" + EDIT = "edit" + + +@unique +class AdminRole(OrderedEnum): + NOT_ADMIN = "not-admin" + EDIT_ACCESS = "edit-access" + EDIT_ADMINS = "edit-admins" + + +def get_user_membership(conn: redis.Redis, user_id: str, + group_id: str) -> Dict: + """Return a dictionary that indicates whether the `user_id` is a + member or admin of `group_id`. + + Args: + - conn: a Redis Connection with the responses decoded. + - user_id: a user's unique id + e.g. '8ad942fe-490d-453e-bd37-56f252e41603' + - group_id: a group's unique id + e.g. '7fa95d07-0e2d-4bc5-b47c-448fdc1260b2' + + Returns: + A dict indicating whether the user is an admin or a member of + the group: {"member": True, "admin": False} + + """ + results = {"member": False, "admin": False} + for key, value in conn.hgetall('groups').items(): + if key == group_id: + group_info = json.loads(value) + if user_id in group_info.get("admins"): + results["admin"] = True + if user_id in group_info.get("members"): + results["member"] = True + break + return results + + +def get_highest_user_access_role( + resource_id: str, + user_id: str, + gn_proxy_url: str = "http://localhost:8080") -> Dict: + """Get the highest access roles for a given user + + Args: + - resource_id: The unique id of a given resource. + - user_id: The unique id of a given user. + - gn_proxy_url: The URL where gn-proxy is running. + + Returns: + A dict indicating the highest access role the user has. + + """ + role_mapping = {} + for x, y in zip(DataRole, AdminRole): + role_mapping.update({x.value: x, }) + role_mapping.update({y.value: y, }) + access_role = {} + for key, value in json.loads( + requests.get(urljoin( + gn_proxy_url, + ("available?resource=" + f"{resource_id}&user={user_id}"))).content).items(): + access_role[key] = max(map(lambda x: role_mapping[x], value)) + return access_role -- cgit v1.2.3 From a74df27eae7481cc8f1f12cc8a0adcc06cd1a984 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Sun, 31 Oct 2021 15:58:18 +0300 Subject: Fix pylint issues in gn3.authentication --- gn3/authentication.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'gn3') diff --git a/gn3/authentication.py b/gn3/authentication.py index baf2c7a..892aa8f 100644 --- a/gn3/authentication.py +++ b/gn3/authentication.py @@ -1,15 +1,17 @@ +"""Methods for interacting with gn-proxy.""" import functools import json +from urllib.parse import urljoin +from enum import Enum, unique +from typing import Dict + import redis import requests -from typing import Dict -from enum import Enum, unique -from urllib.parse import urljoin - @functools.total_ordering class OrderedEnum(Enum): + """A class that ordered Enums in order of position""" @classmethod @functools.lru_cache(None) def _member_list(cls): @@ -24,6 +26,7 @@ class OrderedEnum(Enum): @unique class DataRole(OrderedEnum): + """Enums for Data Access""" NO_ACCESS = "no-access" VIEW = "view" EDIT = "edit" @@ -31,6 +34,7 @@ class DataRole(OrderedEnum): @unique class AdminRole(OrderedEnum): + """Enums for Admin status""" NOT_ADMIN = "not-admin" EDIT_ACCESS = "edit-access" EDIT_ADMINS = "edit-admins" @@ -81,14 +85,13 @@ def get_highest_user_access_role( """ role_mapping = {} - for x, y in zip(DataRole, AdminRole): - role_mapping.update({x.value: x, }) - role_mapping.update({y.value: y, }) + for data_role, admin_role in zip(DataRole, AdminRole): + role_mapping.update({data_role.value: data_role, }) + role_mapping.update({admin_role.value: admin_role, }) access_role = {} - for key, value in json.loads( - requests.get(urljoin( - gn_proxy_url, - ("available?resource=" - f"{resource_id}&user={user_id}"))).content).items(): - access_role[key] = max(map(lambda x: role_mapping[x], value)) + response = requests.get(urljoin(gn_proxy_url, + ("available?resource=" + f"{resource_id}&user={user_id}"))) + for key, value in json.loads(response.content).items(): + access_role[key] = max(map(lambda role: role_mapping[role], value)) return access_role -- cgit v1.2.3 From 8169d8aacd8598730fd2e6eba06052e7502f2cc1 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Mon, 1 Nov 2021 09:05:32 +0300 Subject: Fix mypy issues --- gn3/authentication.py | 8 ++++---- mypy.ini | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'gn3') diff --git a/gn3/authentication.py b/gn3/authentication.py index 892aa8f..7bc7b77 100644 --- a/gn3/authentication.py +++ b/gn3/authentication.py @@ -3,9 +3,9 @@ import functools import json from urllib.parse import urljoin from enum import Enum, unique -from typing import Dict +from typing import Dict, Union -import redis +from redis import Redis import requests @@ -40,7 +40,7 @@ class AdminRole(OrderedEnum): EDIT_ADMINS = "edit-admins" -def get_user_membership(conn: redis.Redis, user_id: str, +def get_user_membership(conn: Redis, user_id: str, group_id: str) -> Dict: """Return a dictionary that indicates whether the `user_id` is a member or admin of `group_id`. @@ -84,7 +84,7 @@ def get_highest_user_access_role( A dict indicating the highest access role the user has. """ - role_mapping = {} + role_mapping: Dict[str, Union[DataRole, AdminRole]] = {} for data_role, admin_role in zip(DataRole, AdminRole): role_mapping.update({data_role.value: data_role, }) role_mapping.update({admin_role.value: admin_role, }) diff --git a/mypy.ini b/mypy.ini index a507703..b0c48df 100644 --- a/mypy.ini +++ b/mypy.ini @@ -13,4 +13,10 @@ ignore_missing_imports = True ignore_missing_imports = True [mypy-pingouin.*] +ignore_missing_imports = True + +[mypy-redis.*] +ignore_missing_imports = True + +[mypy-requests.*] ignore_missing_imports = True \ No newline at end of file -- cgit v1.2.3 From 05740a60d6616f28751f96ca30adeb524f4369ad Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 1 Nov 2021 10:49:35 +0300 Subject: Implement `compute_partial_correlations_fast` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Implement `compute_partial_correlations_fast` that is a partial migration of `web.webqtl.correlation.PartialCorrDBPage.getPartialCorrelationsFast` in GN1. This function will probably be reworked once the dependencies are fully migrated. It also needs tests to be added. --- gn3/computations/partial_correlations.py | 49 ++++++++++++++++++++++++++++++++ gn3/settings.py | 3 ++ 2 files changed, 52 insertions(+) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index ba4de9e..1a6868a 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -9,6 +9,9 @@ from functools import reduce from typing import Any, Tuple, Sequence from scipy.stats import pearsonr, spearmanr +from gn3.settings import TEXTDIR +from gn3.data_helpers import parse_csv_line + def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): """ Fetches data for the control traits. @@ -192,3 +195,49 @@ def good_dataset_samples_indexes( return tuple(sorted( samples_from_file.index(good) for good in set(samples).intersection(set(samples_from_file)))) + +def compute_partial_correlations_fast(# pylint: disable=[R0913, R0914] + samples, primary_vals, control_vals, database_filename, + fetched_correlations, method: str, correlation_type: str) -> Tuple[ + float, Tuple[float, ...]]: + """ + This is a partial migration of the + `web.webqtl.correlation.PartialCorrDBPage.getPartialCorrelationsFast` + function in GeneNetwork1. + """ + assert method in ("spearman", "pearson") + with open(f"{TEXTDIR}/{database_filename}", "r") as dataset_file: + dataset = tuple(dataset_file.readlines()) + + good_dataset_samples = good_dataset_samples_indexes( + samples, parse_csv_line(dataset[0])[1:]) + + def __process_trait_names_and_values__(acc, line): + trait_line = parse_csv_line(line) + trait_name = trait_line[0] + trait_data = trait_line[1:] + if trait_name in fetched_correlations.keys(): + return ( + acc[0] + (trait_name,), + acc[1] + tuple( + trait_data[i] if i in good_dataset_samples else None + for i in range(len(trait_data)))) + return acc + + processed_trait_names_values: tuple = reduce( + __process_trait_names_and_values__, dataset[1:], (tuple(), tuple())) + all_target_trait_names: Tuple[str, ...] = processed_trait_names_values[0] + all_target_trait_values: Tuple[float, ...] = processed_trait_names_values[1] + + all_correlations = determine_partials( + primary_vals, control_vals, all_target_trait_names, + all_target_trait_values, method) + ## Line 772 to 779 in GN1 are the cause of the weird complexity in the + ## return below. Once the surrounding code is successfully migrated and + ## reworked, this complexity might go away, by getting rid of the + ## `correlation_type` parameter + return len(all_correlations), tuple( + corr + ( + (fetched_correlations[corr[0]],) if correlation_type == "literature" + else fetched_correlations[corr[0]][0:2]) + for idx, corr in enumerate(all_correlations)) diff --git a/gn3/settings.py b/gn3/settings.py index e85eeff..57c63df 100644 --- a/gn3/settings.py +++ b/gn3/settings.py @@ -50,3 +50,6 @@ CORS_HEADERS = [ "Authorization", "Access-Control-Allow-Credentials" ] + +GNSHARE = os.environ.get("GNSHARE", "/gnshare/gn/") +TEXTDIR = f"{GNSHARE}/web/ProbeSetFreeze_DataMatrix" -- cgit v1.2.3 From 1ab86d17f49927aab58fa96d776a600ad8fd07df Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 1 Nov 2021 10:52:13 +0300 Subject: Stub `determine_partials` Issue: * Stub out `determine_partials` which is a migration of `web.webqtl.correlation.correlationFunction.determinePartialsByR` in GN1. The function in GN1 has R code from line 188 to line 344. This will need to be converted over to Python. This function will also need tests. --- gn3/computations/partial_correlations.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 1a6868a..fb372a9 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -196,6 +196,22 @@ def good_dataset_samples_indexes( samples_from_file.index(good) for good in set(samples).intersection(set(samples_from_file)))) +def determine_partials( + primary_vals, control_vals, all_target_trait_names, + all_target_trait_values, method): + """ + This **WILL** be a migration of + `web.webqtl.correlation.correlationFunction.determinePartialsByR` function + in GeneNetwork1. + + The function in GeneNetwork1 contains code written in R that is then used to + compute the partial correlations. + """ + ## This function is not implemented at this stage + return tuple( + primary_vals, control_vals, all_target_trait_names, + all_target_trait_values, method) + def compute_partial_correlations_fast(# pylint: disable=[R0913, R0914] samples, primary_vals, control_vals, database_filename, fetched_correlations, method: str, correlation_type: str) -> Tuple[ -- cgit v1.2.3 From 32e6d788ac5b6fa8daf4c26b2ad7bca32d71d828 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 4 Nov 2021 08:51:50 +0300 Subject: Create blackbox tests for some functions migrated from R Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: new stub functions (partial_correlation_matrix, partial_correlation_recursive) * tests/unit/computations/partial_correlations_test_data/pcor_mat_blackbox_test.csv: blackbox sample data and results for variance-covariance matrix method * tests/unit/computations/partial_correlations_test_data/pcor_rec_blackbox_test.csv: blackbox sample data and results for recursive method * tests/unit/computations/test_partial_correlations.py: Tests for new function Provide some blackbox testing sample data for checking the operation of the functions migrated from R. --- gn3/computations/partial_correlations.py | 30 ++++++ .../pcor_mat_blackbox_test.csv | 101 +++++++++++++++++++++ .../pcor_rec_blackbox_test.csv | 101 +++++++++++++++++++++ .../unit/computations/test_partial_correlations.py | 61 ++++++++++++- 4 files changed, 292 insertions(+), 1 deletion(-) create mode 100644 tests/unit/computations/partial_correlations_test_data/pcor_mat_blackbox_test.csv create mode 100644 tests/unit/computations/partial_correlations_test_data/pcor_rec_blackbox_test.csv (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index fb372a9..07dc16d 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -257,3 +257,33 @@ def compute_partial_correlations_fast(# pylint: disable=[R0913, R0914] (fetched_correlations[corr[0]],) if correlation_type == "literature" else fetched_correlations[corr[0]][0:2]) for idx, corr in enumerate(all_correlations)) + +def partial_correlation_matrix( + xdata: Tuple[float, ...], ydata: Tuple[float, ...], + zdata: Tuple[float, ...], method: str = "pearsons", + omit_nones: bool = True) -> float: + """ + Computes the partial correlation coefficient using the + 'variance-covariance matrix' method + + This is a partial migration of the + `web.webqtl.correlation.correlationFunction.determinPartialsByR` function in + GeneNetwork1, specifically the `pcor.mat` function written in the R + programming language. + """ + return 0 + +def partial_correlation_recursive( + xdata: Tuple[float, ...], ydata: Tuple[float, ...], + zdata: Tuple[float, ...], method: str = "pearsons", + omit_nones: bool = True) -> float: + """ + Computes the partial correlation coefficient using the 'recursive formula' + method + + This is a partial migration of the + `web.webqtl.correlation.correlationFunction.determinPartialsByR` function in + GeneNetwork1, specifically the `pcor.rec` function written in the R + programming language. + """ + return 0 diff --git a/tests/unit/computations/partial_correlations_test_data/pcor_mat_blackbox_test.csv b/tests/unit/computations/partial_correlations_test_data/pcor_mat_blackbox_test.csv new file mode 100644 index 0000000..a1558a0 --- /dev/null +++ b/tests/unit/computations/partial_correlations_test_data/pcor_mat_blackbox_test.csv @@ -0,0 +1,101 @@ +"function_name","count","x","y","z","method","rm","result" +"pcor.mat",13,"-89.1427156049758, -70.2603165991604, 52.4590492714196, -57.2846714872867, -26.3361851219088, -0.000567594543099403, 17.9622953757644, -64.1319836024195, 39.2497098539025, 20.8931459579617, 74.1897551808506, -35.3126015048474, -55.9552798978984","47.3745858296752, -68.9209029078484, -31.9765134248883, -45.0486478861421, -85.1716816890985, 65.432888455689, 19.2734406329691, 87.9198614973575, -68.2076670229435, -38.1280574947596, 52.754437038675, -73.271297942847, 67.7760738879442","-78.9239354431629, -85.3030194528401, -20.3673145733774, -22.6184178609401, 16.5013548452407, 18.5637861024588, 96.5889988467097, 36.156284250319, 35.1589790545404, -73.1023930944502, -50.7484216243029, 41.8345319107175, -47.8776978328824","s",TRUE,-0.0325789017360908 +"pcor.mat",18,"64.013504376635, 53.1150240916759, -77.8307237662375, -33.1533540505916, -13.6034480296075, 93.2804300449789, -46.3470680173486, 17.427362408489, -66.663983091712, 4.23776390962303, 77.7521491982043, -3.10332304798067, -61.5989458281547, -13.5284000542015, 7.71856023930013, 89.0885920263827, -35.3556916583329, -95.9261478390545","-35.6941626407206, 41.877265740186, 69.6430462878197, 64.2008605413139, -59.4343301840127, 79.7348674852401, 61.3097242545336, 9.0187989640981, 51.7997904680669, 45.9638734348118, 41.0136769060045, -73.4738738741726, -47.0628185197711, 57.6456079725176, -2.5194660294801, -53.7642545998096, 18.9816055819392, -54.8453160561621","-55.6193302385509, 63.7390994466841, 85.8707739040256, -77.2866525221616, 29.9346832558513, -24.1673247888684, -61.8650471325964, 19.6793714072555, -60.1225732360035, 12.063248641789, -51.2589928694069, -41.5690367575735, -58.2409225869924, 37.0499972254038, -9.5894614700228, 2.70932037383318, 56.0281782411039, -39.5718538668007","s",FALSE,-0.0406099988399257 +"pcor.mat",18,"56.9747474044561, 55.6495593860745, -36.6002877708524, 61.6530403494835, -11.1073412466794, -70.2817751094699, 34.5848673954606, -40.1073589455336, 22.4086964968592, -34.9243235308677, -31.6865964792669, -81.9148152600974, -7.01485783793032, -0.294096721336246, -19.4921953603625, -55.370055232197, 33.2327066455036, -65.3158040251583","-13.8067095074803, -83.5349172819406, -12.6486663240939, -8.66694604046643, 86.2149322871119, 60.7879475224763, -73.3523240312934, 34.5676413737237, -4.87876599654555, 18.5876747593284, 89.8641737177968, -72.3610286135226, -32.7410754282027, 27.3812759667635, -45.791448559612, 80.4758272599429, -76.585627021268, -36.1723904497921","49.7649329714477, -56.3095143996179, 92.719935066998, -17.5905505660921, -34.11227283068, 8.69290293194354, 51.1472036596388, -52.1146316081285, 18.716375855729, 44.0671648364514, -81.5424187108874, 17.9900521878153, 83.1838137004524, -36.2067365087569, 6.58109332434833, 33.7925261352211, 43.0417039897293, -24.2647144943476","s",FALSE,-0.326536819677434 +"pcor.mat",16,"-27.0166050642729, 25.6161904428154, 18.0927545763552, -97.8309890720993, 83.225102070719, 41.1768469493836, 52.531653130427, 90.7089609187096, 45.9316388238221, 44.4865159224719, -65.3349446132779, -63.2685597520322, -63.5370531585068, -20.7488086074591, -21.5636825188994, 70.8061812445521","89.9359612260014, -24.0224461536855, -88.7139027938247, 33.0363452900201, 89.8786358069628, 72.6242340635508, -33.4980245213956, 18.209078675136, -98.510293290019, -45.0928752310574, -56.3632266130298, 36.2233767751604, 24.8566114809364, 41.1938649136573, 98.1815246865153, -31.8091072142124","-83.4077485837042, 67.2828705515712, -46.1948299780488, 44.6621300186962, -68.071247311309, 69.5944227278233, -72.4484366830438, -19.5607443805784, -10.3165994398296, -38.1281117442995, 92.4075163435191, 27.103430358693, 7.35686598345637, -68.8319525215775, -35.345290414989, -22.3868970759213","s",FALSE,-0.265133848612843 +"pcor.mat",16,"62.6007101032883, -31.4669733867049, -1.02701690047979, 89.1588015947491, 89.4676355645061, 72.146376548335, -48.5373890493065, 27.8906877152622, 84.9362426437438, 22.9195747990161, -0.477400049567223, -55.017494270578, 16.0360316745937, -40.5794956721365, -76.5294233337045, 99.2066614329815","32.9774639569223, 99.4476685766131, 19.444046029821, -87.4037025496364, -49.6627463493496, -79.1786927729845, 69.5362528320402, -42.9193137213588, 88.4448691736907, 96.2614195886999, 99.7840614058077, -30.6426415685564, 52.9562290757895, -75.0585582572967, -92.611052794382, 67.6107355859131","99.6344119310379, -43.7020116951317, -14.1780937556177, 29.8982600681484, 67.7026726771146, 12.5789169687778, 5.22102704271674, 47.3305377177894, -10.2066915482283, 44.158894661814, 16.616974119097, 67.5522029399872, 10.2959530893713, 2.26272544823587, -24.1713169030845, -81.4385517500341","k",FALSE,0.00170394349277265 +"pcor.mat",17,"-43.6796560417861, -52.3636834230274, -32.689885282889, 29.6649182215333, 70.8439419511706, -78.822322236374, -7.2787752840668, -37.7680024132133, -9.91778918541968, 45.4824290703982, -1.96461407467723, -10.768158081919, -71.2498663924634, 23.788648378104, 81.2093367334455, -29.8483492340893, 42.7211379166692","54.4582905247808, 2.90980748832226, -49.7587429825217, 90.0067212525755, -62.2195774223655, 49.5222055818886, 64.7147801704705, -30.6467334739864, 43.9336315263063, -24.3989814538509, 93.3036277070642, -5.72181586176157, -51.6447205562145, 71.4890264440328, 35.5837760493159, -39.9753636214882, 64.5502870436758","-86.5306067280471, -2.41111759096384, 17.8865785710514, -66.7758407536894, -45.9109436254948, -99.6982547920197, 9.07599623315036, -49.4003663770854, -50.0817076303065, -52.7716889511794, 9.27476715296507, -1.14214201457798, -14.0225571580231, -46.0782612208277, 97.4677567835897, -70.6407638732344, -99.1432263981551","p",TRUE,0.181498113250831 +"pcor.mat",14,"-4.90339081734419, 72.9479049798101, 46.9192364253104, 92.628131667152, 56.5425228327513, 9.90580045618117, -61.4272825885564, 33.6759516969323, 81.8828757386655, 77.3399218916893, 67.7938031964004, 94.0767949912697, 82.1635375730693, -75.240781577304","21.4586552698165, -36.5642888005823, -38.3646843954921, -49.740192014724, -81.6746165510267, -19.1730958875269, 41.690668836236, -23.3391010668129, -78.1760632060468, 77.431286778301, 70.3289750963449, 39.766847435385, 3.62148815765977, 10.747673548758","17.7063988521695, 90.0697568897158, -93.0447159335017, 85.4728828649968, -18.4118247125298, -9.85785778611898, 70.2666643075645, -97.7391937281936, 54.3527046684176, -51.4394805766642, 39.0205434523523, -25.6685835774988, -14.7992834448814, 81.1236747074872","p",FALSE,-0.21445656018345 +"pcor.mat",15,"-76.8736738711596, -35.8509941026568, -48.1256343889982, -9.57123078405857, -72.2122399602085, -6.98926709592342, -31.3491718843579, 74.3320995010436, 54.9155391287059, -46.5018933173269, 51.3019453268498, 17.0857016462833, -99.9900157097727, -17.3139852005988, -85.5749220587313","-97.7581001352519, -97.2672377247363, -27.3427923209965, -1.21665806509554, -8.05344670079648, 21.0991605184972, -54.0536799002439, 95.0312656350434, 23.7382718361914, -98.728937190026, -80.2528636530042, -59.6354123670608, 20.57563085109, 90.7686199061573, 19.6493336930871","-38.4617018979043, 28.0117013957351, -74.6210919693112, -34.3639187980443, -28.0167740304023, -46.0126685444266, 37.4354778788984, 41.0279822535813, 80.8140107430518, -94.7356107644737, -91.9223290402442, -34.4586562830955, 90.2129443362355, 76.8807396292686, 80.0070276483893","k",FALSE,0.250746493151452 +"pcor.mat",7,"-66.7350410018116, 53.2712059561163, -43.8059563748538, -44.9987557251006, -67.2016165219247, 17.9846523795277, 77.0553316920996","-60.9613332431763, 99.9187499284744, -27.7070741169155, 14.3416102975607, -30.3307291120291, 5.47642167657614, -52.1709493827075","5.97298364154994, 70.3716231975704, -16.247583553195, 92.1821707859635, -80.4653100203723, -7.83197041600943, -66.9684283901006","k",TRUE,0.241209075662211 +"pcor.mat",18,"94.380710972473, -10.0111012812704, 85.1797969080508, -11.4021800924093, -99.7310696635395, -57.7457085251808, -34.8813917022198, 37.1367971878499, -57.5784567277879, 17.9361389484257, -20.6278771162033, -42.8640173282474, -62.0093574281782, 10.7791527640074, -42.4936424475163, 31.2512285541743, -6.26639267429709, 50.0969529151917","-35.3466201107949, 51.2795441318303, -9.26330988295376, 13.2600117940456, -70.25914513506, 24.8688437044621, -95.0622762087733, -78.8527075666934, 12.5830010510981, -40.3181817382574, -62.1690618339926, 65.2437281329185, 45.4263514839113, -20.7038762047887, 19.835890410468, -16.3075220305473, 10.154833085835, 31.5655742771924","-47.5495883729309, 31.0941505245864, -11.7687386460602, 47.550484072417, 19.7334853932261, 59.856044081971, 38.4999468922615, -29.1666014585644, -77.8870329726487, 75.2757792361081, -17.8823099005967, -93.2831089943647, -73.6799968872219, -36.3856283016503, 21.7388028744608, -41.7408903129399, -21.9456392340362, 5.71200731210411","p",TRUE,-0.153597125133576 +"pcor.mat",15,"-83.3593410905451, 33.8860942982137, 17.5660732202232, 44.9482867959887, 3.40795461088419, -98.6972364131361, -57.9294378869236, 49.1425832267851, -81.4089713152498, 22.2765766549855, -15.2078927494586, 64.7270672023296, -77.9068617615849, -13.5009704623371, -41.0612959414721","99.4176274631172, -28.8145580794662, 24.2324681021273, 70.3792416490614, 55.1269176416099, -46.6643883381039, 13.5340544395149, -81.6506992094219, 7.58900847285986, 76.2214359361678, -21.0444819182158, -19.7882746346295, -77.8520357329398, -60.2931962348521, -30.685667693615","-7.22203818149865, -62.021238123998, -34.5286842435598, -67.4230553675443, -62.1439764276147, -99.2042647209018, 7.09792547859251, -88.8404605910182, 79.5403079129755, 68.8092908356339, -87.8009828273207, -11.8701789993793, -40.4039821587503, -50.0366650056094, 61.1679489258677","p",TRUE,0.134662220884382 +"pcor.mat",18,"36.4026268012822, -40.8853712491691, 70.4748715274036, -93.3088712859899, -31.1693381983787, 44.5810994133353, -29.8538233153522, -55.898003000766, -83.1116971559823, 95.2613319735974, -86.9839164428413, -99.6416668407619, -71.7915004119277, 86.375200515613, 73.0707975570112, 9.46915657259524, 30.3790966048837, -32.9175783321261","20.2463141642511, 35.3073101490736, 96.6094605624676, 38.2854318711907, 20.0914516113698, -76.2724542990327, -2.5904384907335, 28.1036204192787, 27.5573522783816, 41.8770257849246, 17.9975534323603, -53.0143345706165, -1.92109285853803, -43.1404768954962, -89.0914923511446, -75.2585290931165, 31.8984744139016, -81.7458927165717","99.058653973043, -73.045432055369, -98.9125271327794, -10.9370147343725, 93.4558239299804, 21.3814281392843, -10.9608757775277, -94.0566421952099, 29.180516814813, 60.7905065640807, -69.4182314909995, 27.9442990664393, 16.5212750900537, -65.4938052408397, -91.3346993271261, -19.3851371761411, 54.6318108215928, 94.2573416978121","s",TRUE,-0.0480625888230071 +"pcor.mat",8,"70.9466312080622, -31.7683406174183, 25.0176505185664, -56.8918467033654, -9.20995227061212, 84.6444204915315, 66.9992076698691, -14.915213920176","-25.2351951319724, 53.1852985266596, 32.9547242727131, -82.4257594533265, -51.8481220584363, 61.490266257897, 16.8974718544632, -71.770367724821","25.6255140993744, 62.6514744479209, 2.26075490936637, -90.3473023790866, -8.56978320516646, 89.0561478678137, 3.07730589993298, 45.6199106760323","p",FALSE,0.307942034203085 +"pcor.mat",18,"23.8564316183329, -16.3905590772629, -12.3555054422468, 78.1761512625962, 49.3263760115951, 13.6127803940326, -35.0881972815841, 18.7167634721845, 47.3916597198695, 6.6052196547389, -47.4990267306566, 36.3517801277339, 77.3957766592503, -70.3038077335805, -28.512022132054, 93.2541827205569, -50.6320198066533, 2.28197425603867","4.66441703028977, 52.664560964331, 64.6692745853215, 64.0807087533176, -42.2254925593734, -28.3238022122532, 84.3502655625343, -22.6033370010555, -63.9537113253027, -82.1724142879248, -47.163494117558, 86.9036048650742, -25.5253764800727, -40.6565339770168, -64.6023235283792, 5.88995609432459, 60.3537472430617, -12.8357082139701","-7.05419671721756, 17.8630999755114, -94.5426801219583, -90.8921510912478, -52.0795451011509, 52.0008019171655, 77.9491205234081, -64.4113312475383, -13.6109072715044, -84.2732723336667, 57.4606000445783, 57.2238144930452, -17.8435018286109, 78.159570787102, -64.3654571380466, 25.7219140883535, 21.2949032895267, -89.99102874659","s",FALSE,0.098864763229466 +"pcor.mat",8,"36.1457616556436, 98.2861819211394, 40.8350063487887, 63.7187578249723, 13.0914898123592, -52.3402118124068, -13.3677611593157, 73.598525673151","79.2985305655748, -71.9141394365579, -0.420988909900188, -90.6284262426198, 72.2033147700131, 79.6287265606225, 20.301692513749, -54.6786930412054","96.6230187565088, -65.8682400360703, 26.0384120512754, -46.9612662214786, 47.5940535310656, -17.1155892312527, -45.7220804877579, -67.2774867620319","s",TRUE,-0.725794650937327 +"pcor.mat",6,"-57.665149634704, 94.4162191357464, -51.1441508308053, -52.6072693057358, -44.1887341905385, -14.2386069521308","-98.8703572191298, -9.2983465641737, -79.2660262435675, 23.2223530765623, 80.3647544234991, -58.0826134420931","81.1863256618381, 64.9427580181509, 45.6761348526925, 64.8033803794533, -40.9290973097086, -92.1668177470565","p",TRUE,0.118780545543647 +"pcor.mat",11,"40.5678772833198, 33.8221173267812, 65.0725501589477, 78.8693956099451, -35.8988873194903, -35.3420054074377, -87.4633281026036, 0.115021411329508, 67.6265092566609, 83.1133821513504, -18.3507286012173","-73.7955948337913, 29.9831629730761, 65.2690784074366, 25.2531439997256, -62.1108427643776, -47.4723324179649, 35.5791020672768, 26.2222751509398, 40.3645094949752, -91.2350233644247, -28.6233199760318","48.7291889730841, 33.8533046189696, 66.3264122325927, -19.7420272510499, -46.8001568224281, -39.1347371973097, 34.7272414714098, 65.1918939314783, 99.5216719806194, -29.0462920907885, 19.8831745423377","s",TRUE,-0.297493089362279 +"pcor.mat",11,"55.8680928312242, -76.9269882235676, -17.3182043712586, 15.2775115799159, -90.3137100860476, -99.032783228904, 13.8755587395281, -24.003914417699, 21.2662550620735, -8.40797564014792, -40.8448379952461","9.94491642341018, 76.8310205079615, -95.3446100465953, -74.8744533862919, -69.8509857058525, 6.55742576345801, 24.8502014670521, 97.212969744578, 29.4545858632773, -77.6854024268687, -80.0981419626623","14.1451966483146, -52.5070706848055, 52.3787314537913, 22.6627501659095, 5.18406489863992, 78.4387116320431, -37.6045362092555, -59.8206405062228, 97.1690027043223, 46.7755769845098, -23.1495135929435","k",FALSE,0.0919698779952353 +"pcor.mat",19,"12.6561464276165, 89.6340752951801, -86.4221294410527, -8.45101773738861, -79.0324212051928, -41.2799602374434, 41.9530363287777, 77.5156316813082, -98.2695916201919, 54.0546870790422, 18.4697377029806, -92.1382030006498, 22.3036497831345, -88.4184999857098, 87.4229540582746, 84.4335915520787, -86.3810521550477, -4.96541885659099, -4.21266416087747","77.7516108006239, 13.0087590776384, -52.281900215894, 46.1203761398792, -7.93849290348589, 30.4574410431087, -4.16998718865216, -76.5136891510338, 65.0717901531607, 41.985437553376, -10.8945969026536, -1.79670625366271, -80.059599224478, -27.9757288750261, -3.81275764666498, -40.5276663135737, -7.72571838460863, -21.2847925722599, -3.90572124160826","-16.1283437628299, -86.2985316198319, 15.8964606467634, 45.3664765227586, -10.7382515911013, -61.8415161035955, 75.2832551952451, 62.1664110571146, 14.5355282817036, 31.9144344422966, 63.7715006712824, 46.5569637250155, 20.0197615195066, 9.47772678919137, -79.8056298401207, -89.03838978149, 96.9052662607282, -3.97900892421603, -68.8863600604236","k",TRUE,-0.0783868693007469 +"pcor.mat",6,"41.7150890920311, 68.0406647268683, -56.6652314271778, -10.3111394215375, 72.7076691575348, 16.4696130901575","55.7349273469299, 33.0129407346249, -92.8235503379256, 67.6610651891679, -28.225592058152, 27.8548604343086","97.3419046029449, 92.7794307935983, 18.738874187693, -50.2989741973579, -31.1240924987942, -47.357566608116","k",FALSE,-0.0545544725589981 +"pcor.mat",7,"76.1037406977266, -51.2855937238783, -51.0953912511468, 61.8452743627131, 27.5623431429267, 32.935436675325, -23.7891209311783","-25.5972837097943, 35.7565317302942, -2.09780340082943, 31.380487093702, -65.0630551856011, -52.5524016004056, -45.8224846515805","35.1819013711065, 55.421924777329, 90.8943614922464, 65.8556955400854, -17.2470153309405, 50.2847956493497, -43.5768135823309","k",TRUE,-0.241209075662211 +"pcor.mat",14,"-86.9700414128602, -96.2525710929185, 13.2297853473574, 48.3323885593563, -42.72451386787, -64.586602896452, 26.2733123730868, -41.4743609726429, -27.5131822098047, -62.4261621385813, -16.2857410497963, 61.4362000953406, -71.6986550018191, 6.73192692920566","-1.76208755001426, 67.4144621472806, 40.1256877463311, 20.0672226957977, 75.7373407483101, -60.1804342586547, -24.0758131723851, -30.328988051042, 98.3264557551593, 18.7257033307105, -74.7150662820786, -66.4480000734329, 83.1373671069741, -83.8592982385308","-8.51446660235524, -33.5672379937023, 23.1306486297399, -71.0971800610423, -76.6779989469796, 17.668380215764, -6.54176617972553, 38.9708994887769, 36.8745916523039, 36.466611456126, -42.6107963547111, -43.292662827298, -34.305056463927, 3.72276022098958","k",FALSE,-0.237726218501727 +"pcor.mat",9,"87.9827535245568, 66.9526648242027, 77.764587290585, -63.0833296570927, 12.8970904741436, 12.7532111946493, -15.7931709196419, 76.1098874267191, -53.3998124301434","61.8036749772727, -53.057945612818, -21.9204508699477, -23.7275714520365, -81.9658347871155, 96.6755392961204, 23.4129578340799, -26.8468076363206, 11.6413829382509","6.22031539678574, -63.707418506965, -68.8293416053057, 51.3240036088973, -89.1044299583882, 96.3014227803797, 84.1399733442813, 3.21415988728404, -64.009400550276","p",TRUE,0.220999575445754 +"pcor.mat",18,"-2.85750310868025, -99.3862376082689, -96.015146560967, 63.2039456162602, -66.0570687614381, -66.0487032029778, -16.3392898160964, 93.4929385315627, -0.228785490617156, -94.138465821743, 89.7544200066477, -39.7632111795247, -60.3579618502408, -34.7465238533914, 49.7126227244735, 56.9427436217666, 69.6163312997669, -16.7142637073994","67.1196629293263, -69.1413426306099, 90.1762881316245, -33.8058187626302, 73.66002057679, 34.5961081795394, -59.5154983922839, 1.26353777013719, 48.2069759164006, -34.2219550162554, 14.3829472362995, 41.6792382951826, 39.1247006133199, -38.8760752510279, -11.6304269526154, -13.3687050547451, -5.31534324400127, -2.51060193404555","-86.3554051145911, 29.0978434961289, -95.5027301795781, 63.6454623192549, -29.499419266358, 73.207819275558, 39.0617064666003, -92.9985575377941, -51.6290077473968, 12.2396486345679, 48.3567856252193, -28.516500396654, -21.0198899265379, 53.046905528754, 44.2176911514252, 0.109824910759926, -99.0703694988042, 74.6371628716588","k",FALSE,-0.0887556361629261 +"pcor.mat",5,"24.8151850420982, -55.3720602765679, -48.1912312563509, 25.3140340093523, 7.37709770910442","27.1002457011491, 51.559735648334, 15.2347642462701, -19.9469642713666, -71.4244599919766","20.2690705657005, 10.2111615706235, 28.9990232791752, -81.5356591250747, 62.7182307653129","p",TRUE,-0.595476592392643 +"pcor.mat",10,"-80.8792762923986, -16.7048441711813, -27.4036565795541, 83.73913182877, -29.9381176009774, 53.5984759684652, -74.8886847868562, -35.0239771883935, -89.2459953203797, 42.7505305968225","55.4137516766787, -70.6881674006581, 32.317240908742, -69.2246387712657, -93.5175380203873, 42.5839690491557, 39.2618721351027, 19.604005292058, 29.0025069378316, 31.9192183203995","-57.4748635292053, -17.7012801170349, 86.0102667473257, -97.6800283882767, -33.8488628156483, -80.713168065995, 1.30178248509765, -82.9571642912924, 20.4808691516519, -23.3784267678857","p",TRUE,-0.247808971782581 +"pcor.mat",7,"-9.81413833796978, -95.0588807463646, -37.4823603779078, 96.0915867704898, 25.3856145311147, -90.2806713245809, 56.4173173159361","-17.8975068964064, -45.0020219665021, -53.689378220588, 13.3858302142471, -95.0690850615501, -45.9697632584721, 5.96692659892142","-74.4352919980884, -79.8946594353765, -36.3220115657896, 71.3168484624475, -32.7676126733422, 74.5314478874207, 47.3017191980034","p",TRUE,0.380658349962746 +"pcor.mat",7,"-12.2942595742643, -46.0883136838675, -21.6881454922259, -19.7250084485859, 54.6898206695914, -67.8715384099633, -98.035113979131","-31.2075863592327, -53.7305776961148, -96.1716986726969, 34.0433329343796, -86.3202335778624, -98.4303006436676, -81.2778456136584","-78.2337430864573, -33.7292415089905, 14.364256337285, 80.8441326953471, 14.6734802983701, -38.598564080894, -16.4908449631184","k",FALSE,0.233736747502114 +"pcor.mat",12,"65.5728437006474, -22.3883016966283, -16.1309017334133, -86.9484126102179, 55.0275014247745, 75.5027377512306, 56.8217232357711, -10.157274780795, -8.05552089586854, -95.0297535397112, 86.99438595213, 56.2756833154708","-50.9940889663994, 31.0440130997449, 55.3901108913124, 0.67323399707675, -93.814965011552, 43.19629650563, 82.1691108867526, 29.7341026831418, 23.4111852012575, -23.9989855792373, -41.8117068242282, -21.0978685878217","-94.9003085959703, 76.4557474758476, 71.228800015524, 1.28989322111011, 56.7563532851636, -74.5477284770459, -40.1864093728364, -62.3711896594614, -63.5766193736345, -34.8390635102987, -34.4627866521478, -60.8579785563052","k",TRUE,-0.0642824346533225 +"pcor.mat",16,"10.3261223994195, -66.3412994239479, -10.04778011702, 90.8491815906018, -16.8091387022287, -1.13998735323548, 8.87222946621478, 62.9582400433719, 51.0545901022851, -42.0804372988641, -72.740743868053, -98.6990892793983, 25.1725806389004, 30.7280816137791, 3.96932810544968, -57.8030949924141","60.728229675442, -74.0803788881749, -73.4922635369003, 21.5669278986752, -2.4874959141016, -42.8831906523556, -8.72258436866105, 41.053393855691, -49.3829999119043, -25.329764559865, -33.0748493783176, 64.0028734691441, -75.2295605372638, -3.0173609033227, -40.6044688075781, -90.4325042851269","-26.9309993833303, -77.9300230089575, -34.1201750095934, 18.6427622102201, -11.5215779747814, 43.2106466032565, 52.0845813211054, -27.0871427375823, 78.9493581280112, -60.0895206909627, 75.2652967814356, -64.8424350190908, 74.5653890538961, 79.290065029636, -83.871082868427, -55.8636627625674","p",TRUE,0.232814351928154 +"pcor.mat",18,"-94.2430725321174, -51.8685480579734, 21.5350433252752, 4.50745574198663, 44.5271090604365, 75.3100082743913, 36.3767127040774, 58.3390053827316, -33.6587901227176, 53.1314761377871, -90.0304151698947, 1.84677322395146, -43.2471524458379, 20.721254684031, -35.7563958037645, 44.6534116752446, 78.0897385440767, 62.626903411001","-86.8268391583115, -67.7875887136906, -20.8753589075059, -28.825512342155, 41.2515165284276, 6.46749134175479, -87.1187134645879, -87.9431148990989, -47.1682616043836, 7.15450858697295, -31.9803619757295, -45.8144799340516, 47.6873302366585, 94.4961855188012, 70.8510945085436, -10.3092920035124, 68.0197277572006, -86.2225097604096","42.146764555946, 35.4582188185304, -74.8004557099193, -69.1695068031549, 9.96355945244431, -1.00409551523626, -56.0459699481726, 57.2666853666306, -75.3820521291345, 61.0693466849625, -80.6058402173221, -28.1722619198263, 29.1725110728294, -84.9811018910259, 52.4267561268061, 3.33783319219947, 57.3508915491402, -16.6291590314358","k",TRUE,0.126881965715119 +"pcor.mat",11,"58.4281201008707, 18.3633047156036, -74.4007679168135, -70.9485304541886, -62.3421670403332, -75.4027212038636, -42.2465549781919, 45.5137318000197, -59.8607284482569, 62.6728146802634, 78.3472507726401","78.8005036301911, -11.6723335813731, 47.760496661067, 72.8375401347876, 44.0390994306654, 49.5243767276406, -49.906044267118, -93.3100801426917, 74.181916937232, 8.72853924520314, 83.0030017532408","-7.40372859872878, 19.830649998039, 32.0547481998801, -24.0255577024072, 15.4005860444158, 13.1488932296634, 8.03853832185268, -78.5669906530529, 80.1699983887374, -99.4674043729901, 40.1027225889266","p",TRUE,0.0557153883247975 +"pcor.mat",8,"-3.19936256855726, 41.1430836189538, -40.9489492420107, 32.8621160238981, -55.2679274696857, -85.6475236825645, -98.9018370397389, 37.6923420932144","-23.4679078217596, -70.4765893053263, -29.5889834873378, 73.5305113717914, 66.7411952745169, 8.31683478318155, 14.5889795385301, 72.6518555544317","78.9658954367042, -43.0149876978248, -8.42135692946613, 0.82630286924541, -0.558331841602921, -30.3489441052079, -19.2593446467072, 59.6474095713347","s",TRUE,-0.211100165460375 +"pcor.mat",12,"-46.8561482150108, 87.6810635440052, -57.6411653775722, -46.4993360452354, -35.9383462462574, -96.4581338688731, 72.101165773347, -92.8533762693405, -24.3875949177891, 81.7434745375067, 95.8580058533698, -39.7297702729702","-14.3783972598612, -62.9489183891565, -88.967556739226, 5.93087510205805, -20.3817227389663, -28.1361578963697, 98.5170270781964, -62.3654518276453, -21.2714700959623, -75.4275092389435, -45.0435093604028, -52.5260332040489","84.6728871576488, 77.3271079175174, -35.2307356428355, -63.2898768875748, -62.9697222262621, 57.5104051735252, -65.9628365654498, -77.7099144645035, -68.1009365711361, 21.6217519715428, 40.7055628951639, -11.8265327066183","p",FALSE,0.240265915193204 +"pcor.mat",14,"-65.2285707648844, 21.9669322483242, 73.5851485282183, 28.0581893399358, 34.4764126464725, -12.0250980835408, 44.0008006524295, 16.8571741785854, -32.5285179540515, 40.1795001234859, 14.344258280471, 42.7343318238854, 33.5459096822888, 17.8732588887215","-17.1958317514509, -31.969396257773, 26.989441877231, 52.442137664184, 42.9547981824726, 32.2006456553936, 80.7050887029618, 7.4744014069438, -56.099244300276, 47.6363920606673, -16.8571050744504, -45.9946841932833, -51.3697457965463, -93.8083261717111","-83.2655881065875, -35.3444519918412, 20.8411808125675, -89.538209233433, -85.8607416506857, -4.87791770137846, 16.466785594821, 71.7880600132048, -90.7291606999934, -47.3672876600176, 28.5109816584736, -6.68758857063949, -37.6607090700418, 78.6420990247279","k",FALSE,0.293285288009136 +"pcor.mat",6,"-46.0385966580361, -99.5740628801286, -29.4129090383649, 97.0183642581105, -37.6902215648443, 80.4221050348133","-88.8656401075423, -39.0352664981037, 37.8500768449157, -3.4251865465194, 16.7551717720926, -64.4463129807264","-85.469913110137, 82.1475684642792, -79.0366449858993, -17.5424363464117, -55.2734784781933, 8.78398092463613","k",FALSE,0.218217890235992 +"pcor.mat",19,"94.6966245770454, 80.9601898305118, -27.9354885220528, 32.8651154879481, -83.5247790906578, 68.0820679292083, 98.2801185455173, -51.8296324182302, 22.2090682946146, -57.0902567822486, -79.9241363536566, 82.232602359727, -31.2431594356894, 47.0965832006186, 45.9447079803795, 83.7373214308172, 43.1115242652595, -15.8762097824365, 24.6083721984178","-30.2270193584263, -18.9653075765818, 32.3881921358407, 62.3213729821146, 48.8383719697595, -64.4200759939849, -34.4498374499381, 74.7035726904869, -80.0148021429777, -72.3529085982591, 97.3054904025048, 81.4842638093978, -75.7931782398373, -36.0045140143484, 52.190304454416, -46.3511400856078, -27.5253375060856, -49.8220588080585, -94.6963192429394","-1.14815644919872, 38.8675629161298, -7.72479912266135, 80.9100962709635, 7.58379022590816, 83.3296971861273, 51.7409536056221, -33.8198636192828, -63.4376135654747, 80.6679456029087, -83.3767011761665, -82.7897766139358, -25.5388389341533, -99.9377169646323, -91.8954541441053, -75.1720157451928, 85.5636859312654, -35.8674420975149, -14.8491851519793","k",TRUE,-0.0612260637897383 +"pcor.mat",11,"43.6715835239738, 83.24592593126, 80.5671546142548, 50.718885473907, 91.4832427166402, -72.9882646352053, 1.08670038171113, 65.7646540552378, 32.857545139268, 98.8540512509644, 57.310037733987","-68.5883652418852, 57.6829582452774, 20.3366491477937, -20.9295519161969, -91.220309631899, 67.5120797473937, -84.0667628217489, -92.758432822302, 73.1769519392401, 31.0191483236849, -59.8639046307653","60.0395560264587, 49.4410765822977, -15.0798926129937, 76.642445102334, 43.1489706039429, -64.028698252514, -73.5862046014518, -11.8118531536311, -14.194271247834, 19.1962173674256, -62.6884501427412","p",TRUE,-0.239620090137985 +"pcor.mat",5,"84.436381328851, 72.004076000303, -40.9433365799487, -11.7642278783023, 36.9735128246248","92.926798760891, -99.3128840345889, -34.4348025508225, -47.6723862346262, 94.1138706635684","2.33245906420052, 59.2558087781072, -17.9977843537927, -79.5293167699128, -57.2229819372296","k",FALSE,0.0890870806374748 +"pcor.mat",13,"-52.8125622309744, 3.65753290243447, -17.9872157517821, 0.687318574637175, 48.9896171726286, -10.9520922414958, -42.2161420341581, -8.33622729405761, -52.7692852541804, 46.2861472740769, -63.7141830287874, 77.9755924828351, 69.3693526089191","-81.1979313846678, -81.2067239545286, 98.1338402722031, 81.5591927152127, 37.056217668578, -30.573401786387, 86.0113869421184, 22.4740816745907, 15.2922587003559, 4.40599746070802, 81.2510290648788, -91.3585484493524, -51.8274602945894","1.68427461758256, 35.6400829739869, 1.32666421122849, 28.9358278736472, 69.9353440199047, 22.5035205483437, 42.7461497485638, -60.8904164750129, 41.2500537466258, 72.3914569243789, -35.3465625550598, 11.877816170454, 41.2654601968825","s",TRUE,-0.432235260027861 +"pcor.mat",6,"36.2520147580653, -45.3618559986353, -3.36455763317645, 27.1406658459455, -32.130736252293, 89.6533737424761","91.0997018683702, -58.0772765446454, -45.8715479355305, -76.4125521760434, -51.5536211896688, -28.4703179262578","-59.4199031591415, 60.7980337925255, 86.4012580364943, 43.8618046697229, 27.8941972646862, -83.8361509144306","s",FALSE,0.361111111111111 +"pcor.mat",15,"-15.8772577065974, 12.7610163297504, -22.9708819650114, -71.8580039218068, -75.8046543691307, 47.7548703551292, -24.9429981224239, -31.5219290088862, -80.9420365840197, -0.135115487501025, 43.7512583099306, 82.602039212361, 32.6054238714278, 52.4210862349719, -25.4571683704853","2.32095182873309, 57.4718285817653, 91.6442870628089, -0.498835230246186, 42.3996091354638, 98.4292598906904, -69.7168925777078, 17.9197568446398, -60.0217215251178, -94.6461838204414, -56.8148406222463, -86.9362941477448, 23.4191815834492, -67.045795917511, -25.982434488833","88.8973289635032, 31.7113435361534, 1.63480490446091, 90.244840271771, 90.7815016340464, 3.64356338977814, -70.6344856880605, 20.8035066723824, 71.0505054797977, -41.0872615408152, 81.8894566036761, 27.3655611090362, -57.8210411127657, 80.1123460754752, 37.0346592739224","s",TRUE,-0.100259767542805 +"pcor.mat",17,"-8.47610384225845, -76.0521722026169, 36.9659481570125, 27.2644958924502, -63.1253079976887, -45.7246268168092, -91.299555497244, 79.9444675445557, 62.6849308609962, 77.2913023363799, -39.3468747846782, -31.9794123992324, -90.5704878270626, 3.36136179976165, 6.36215764097869, 34.7822861280292, -86.7615907918662","38.8797430787235, 87.957543740049, 27.9284121934325, -2.19381097704172, -93.5423448681831, -85.8565270435065, -1.78483547642827, 32.4997876770794, -84.6204502973706, 73.0989838484675, 46.5271977707744, 19.7806170675904, 2.54705562256277, -62.6201322302222, 47.8446535300463, 94.2804395221174, 43.5015312861651","-42.1679470688105, 44.9353978503495, 4.3509088922292, -26.6828402876854, 45.7676482386887, 34.6878333482891, 86.2517770845443, 54.4100513216108, 62.1482897084206, 93.2931664399803, 48.1029566843063, -49.8642263934016, -79.5734560117126, 82.6493532862514, -56.327466852963, 30.9423569124192, -75.3295318223536","k",FALSE,0.173343955251749 +"pcor.mat",15,"-12.115827947855, -23.5690898727626, 89.8483640048653, -76.0832019150257, 54.2692786082625, -31.3360400963575, -87.8199052065611, 62.5256759114563, -85.054659191519, 17.1253859531134, 86.8644420057535, -63.6440661270171, -2.54382686689496, -52.1825547330081, -86.5487120579928","87.855874421075, 11.8729826528579, 58.581341477111, -76.1566527653486, -54.7422365285456, -76.9119961187243, -51.5453061554581, -8.55491124093533, 41.1004772875458, 4.76148361340165, 27.0399220753461, -93.3408699929714, 43.2594683486968, 97.5612652488053, -27.2557357791811","-25.7235449738801, 98.6250419635326, -33.5626783315092, -76.8353697378188, 5.53134111687541, 11.2494019791484, 53.6648289300501, 58.8696902617812, 74.8723800759763, -83.5754144005477, -2.30161873623729, -0.636160280555487, -32.3559941258281, 9.53439651057124, -96.3161264080554","k",TRUE,0.203279781135864 +"pcor.mat",10,"-88.6766928713769, -99.7512009460479, 36.3819673191756, -78.1028961297125, 26.9118153490126, 8.51810127496719, 25.9507332928479, -2.06361203454435, 61.8650326039642, 53.7325612269342","44.7955575305969, -23.4671366401017, 67.7940716035664, -61.1387377139181, -77.4398116860539, -9.6572854090482, 29.9326512031257, -50.3714796155691, -29.1814834810793, 77.4120518472046","53.5698696039617, -33.2331659272313, 29.2508830782026, 30.7888105046004, -75.6014665588737, -21.6426336206496, 49.8834919184446, -31.1990667134523, -49.9284417368472, 52.3363713175058","s",TRUE,0.461061427308285 +"pcor.mat",16,"-83.9224993251264, -98.9909253083169, 41.2098858971149, 40.319947944954, -22.3131684586406, -4.72695007920265, 71.1222126148641, -73.4416379127651, 19.5892326999456, 51.5542230568826, -59.8082218784839, 83.2985554821789, -73.8052498083562, 81.1506273690611, -62.3849936295301, -65.9225380979478","-22.3732136655599, -76.6401294153184, -14.9951294530183, 17.2481925226748, 36.7321326863021, 30.8906201738864, -36.0778030008078, 27.3618204053491, -25.5863894242793, -77.5616424623877, 71.2329083122313, 92.7250783890486, 18.0521029513329, 20.1161385513842, -37.0644447859377, 74.0854462143034","63.1498238537461, 67.5584438722581, -2.90364040993154, 86.5714854560792, 80.625259783119, -83.5466306190938, -89.0106877777725, -11.5085924509913, 95.1227321755141, 26.8994387704879, -36.1149361357093, 13.4227952454239, -22.9821641929448, -81.5770137123764, 99.1007934324443, -24.637895449996","k",TRUE,0.00117273434060522 +"pcor.mat",12,"-30.6264939717948, -51.3202500529587, -91.8923989403993, 71.2572688702494, -50.3101641312242, -43.5825682710856, 68.9194604754448, -62.2129834722728, 74.4652757886797, 10.5425884481519, 39.5969454664737, 43.8930058851838","-3.49326506257057, -40.981019847095, -1.93292065523565, -55.6563400197774, 30.0884651020169, 5.1898842677474, -57.6860777102411, 92.7335068583488, 4.2677782010287, -73.3723870944232, 37.4122668523341, 97.195135615766","0.661881873384118, -77.0722641143948, 80.916742188856, 84.3042341526598, 60.0523283239454, -15.8854037057608, -41.8266508728266, 90.2447595726699, 78.685249062255, -98.4303796198219, 53.0869376845658, 97.2957746591419","s",TRUE,-0.309246046562802 +"pcor.mat",8,"43.6172465793788, -28.597435541451, 49.3047020863742, 23.4949984122068, 55.2344744559377, 50.4013098310679, -61.0196806956083, -13.4925350546837","-28.0354068614542, -58.4258052520454, 91.4929724764079, 5.28197917155921, 6.99444795027375, -37.798970984295, 14.2839945387095, 93.0717419367284","65.1908750180155, -76.971767982468, 78.4851297736168, -27.8413584455848, -14.1628153156489, -37.5672557391226, -58.8539640419185, 51.5223218593746","p",FALSE,-0.457862137278786 +"pcor.mat",5,"7.32707628048956, -97.153510292992, -58.0732712056488, 5.43075683526695, -50.3950014710426","-60.6064203195274, 70.2952838502824, 7.70989404991269, -90.4186028987169, -91.9082495383918","-27.0302977412939, -71.8158513773233, 60.5169426649809, -51.2578745372593, -71.4558880776167","p",FALSE,-0.811742988157054 +"pcor.mat",12,"-31.9100445136428, -15.4961660970002, 15.1833237614483, -96.8389748129994, 34.0211338829249, -26.4210654422641, -74.7212948743254, -73.451091023162, -48.6799724400043, 43.3380767703056, 33.7157489266247, -12.9206308629364","-25.7156142964959, -31.4395876601338, 27.1043297369033, -64.4430394284427, 69.3326181732118, 11.0314972698689, -56.0946275945753, -5.32854660414159, 61.7247725371271, -58.0520442686975, -98.0296685360372, -83.8190475013107","65.2698641642928, 23.0271658394486, -30.5951663292944, 87.3122846707702, -96.8001709319651, 80.7323037646711, 92.8447821643203, -96.3675274513662, -33.6922558955848, 59.8475752864033, -96.7984095681459, 82.4916113168001","k",TRUE,-0.0909090909090909 +"pcor.mat",12,"90.1167266536504, -66.6625558398664, 39.782078191638, -58.8765672873706, -59.9938517436385, -76.4870832674205, -10.5842749588192, -75.7783581502736, 1.28461210988462, -34.5959145110101, 50.9478696621954, -96.5802219230682","38.6262435931712, -94.669465906918, 56.7374847829342, 36.0493461135775, -54.2134216055274, -63.6453815735877, 81.5788346808404, -68.2411943562329, -22.1247639041394, 92.5449587870389, 35.5207106098533, 94.1242534667253","86.8828876875341, -60.6638357974589, -8.42275521717966, -64.6387516520917, -62.6291708089411, 40.5554509721696, 6.27670022659004, 24.3925095535815, 30.6437145452946, 9.16047729551792, -63.2885267492384, -17.5928950775415","s",TRUE,0.261481371449354 +"pcor.mat",18,"80.5951167363673, 90.9240923356265, 70.6974952481687, 68.0134673137218, -44.9470512103289, 25.955663016066, 30.7497585657984, -91.8298844713718, -4.40605725161731, 49.3009329773486, -78.929325286299, -78.4197290893644, 44.3274276796728, -61.9072982110083, 16.9208872597665, 88.0656720604748, -0.423743482679129, -22.9118093848228","31.6178977955133, 6.30270089022815, 87.8026704769582, -79.791863868013, -2.2237554192543, -26.5245907008648, 91.646106634289, -67.9212915245444, 32.4714999180287, 76.9008807372302, 92.0271085575223, 37.951097311452, 55.0852465443313, 81.3659423030913, -61.8186100851744, -34.2142827343196, 3.76891982741654, 9.98605671338737","94.6255694609135, -84.6232280135155, -26.6939069610089, -79.9416828900576, 61.19120195508, 4.79885442182422, -36.1860592849553, 71.0645910352468, -88.2137383334339, -8.42098467983305, 58.1183904316276, -15.7302843872458, -4.05891095288098, 85.9798874240369, 94.7344854008406, 7.95916928909719, 78.0328324530274, -99.0391628816724","k",FALSE,-0.107524911773377 +"pcor.mat",7,"-38.9586756005883, -57.8867371194065, -68.1198546662927, -89.4594067241997, 70.7473307847977, -35.7670163270086, 52.0461404696107","21.6805159114301, -28.8543162867427, -22.0741868950427, -84.8189734853804, -35.3580724913627, 19.6727192029357, 21.0121315903962","66.0285493824631, -4.54495996236801, 64.9962153751403, 74.2479239590466, 59.3966994900256, -13.1802632007748, 10.3553391993046","s",TRUE,0.253320198552449 +"pcor.mat",9,"-6.78211716003716, -79.588529560715, -65.7252383418381, 45.60412671417, 98.0520688928664, -76.6070755198598, -40.7307191286236, -14.1458517406136, -83.4068476222456","-41.9686838053167, 40.0618359446526, -71.2534620892256, -78.1008904334158, 13.2995546329767, 44.5248483214527, -82.3847197927535, -89.4571373704821, -79.4600131455809","-85.7230886816978, -13.998108310625, 66.9168075546622, 29.5824715401977, -86.4490587729961, 90.6398146878928, 32.4118531774729, 27.7746527921408, 80.8882680721581","p",FALSE,-0.28294999490249 +"pcor.mat",13,"-87.399728782475, 40.3655833564699, -3.77177731133997, -0.913261342793703, 84.5598533283919, -57.672530086711, 70.6847531720996, 17.5953175872564, -43.7333907932043, -24.1470513865352, 71.5449669864029, -51.1317191179842, 20.0356021057814","-39.3181677907705, 76.6436085104942, 45.0167378876358, -12.2507677879184, -11.5627334453166, -64.4468226004392, 81.8960891570896, -71.4755731634796, -82.4792180676013, -31.5537444315851, 22.1059046685696, -33.5309320129454, 48.856098158285","-25.2732687629759, -77.4636949412525, -31.5821984782815, -97.6564433425665, -5.07994783110917, -54.0312268771231, -50.5725503899157, 4.37337355688214, -9.34875644743443, 70.4601784236729, 40.7617360819131, 92.1488650143147, -10.1492855232209","k",FALSE,0.494775334448826 +"pcor.mat",5,"-95.295644691214, 85.2518345229328, 70.6566654611379, -15.488860104233, -39.7784407250583","54.2502315249294, 28.1581053044647, -68.6268703080714, -3.80988898687065, 53.7825032602996","-3.1055589672178, 6.64212079718709, 43.7012503389269, 17.2084089368582, -85.3145365137607","s",TRUE,-0.458831467741123 +"pcor.mat",16,"97.809230722487, -14.316190360114, -84.721079049632, -18.7376644462347, -25.5602215882391, 17.7533380687237, 39.1872539184988, -94.0707533620298, 2.72555686533451, 22.7984459139407, 59.4628068618476, -40.8906124997884, -92.1079889405519, 29.8243676312268, -12.0696670375764, -89.7928544320166","26.7640289384872, -96.4622846804559, -40.3722857590765, -80.3130167070776, -68.9347126986831, 98.9100785925984, 31.9554898422211, 64.5670853089541, -50.01574116759, -97.6768167689443, -87.454877840355, -74.6697645168751, -17.0667306985706, -20.0176582206041, 61.2935196608305, -60.0398785434663","42.3937499523163, 46.829612692818, -93.9524796325713, -63.3410033304244, 87.3350779991597, 9.56030515953898, -6.86939819715917, 6.62593231536448, 30.0475670956075, -67.5459566526115, 12.8623825497925, 19.4047554861754, 17.8637056145817, -45.1789702754468, -44.4462891668081, -58.5556023288518","k",FALSE,-0.0864597208956419 +"pcor.mat",13,"77.1156166680157, -4.95218234136701, -0.478975335136056, -88.6164400726557, 79.5374071225524, 64.5803040824831, -2.80681941658258, -79.7279377933592, 99.2951272986829, -97.9579760227352, 30.6757009122521, 1.96241005323827, -16.967974929139","-96.855311980471, -56.1395757365972, -2.78360079973936, -33.6360565852374, -44.3065817002207, -95.199401024729, -27.0363926421851, 75.0894209835678, 4.99337976798415, -7.82306902110577, -81.4332918729633, -56.5008042845875, 19.696054328233","16.2967632059008, -25.3815619740635, 94.3077141884714, 47.4075115751475, 96.9511947128922, -23.1907044071704, 38.797459891066, -97.7688763756305, -28.7548608146608, -83.8516177609563, -7.49311237595975, -26.1195019353181, 48.4767589252442","p",FALSE,-0.477487484222149 +"pcor.mat",9,"-39.2630732618272, -89.935081731528, -46.2339258752763, -89.5339810289443, -4.36198632232845, -14.5440776832402, -95.7827549427748, 93.4488965664059, 81.2002772465348","99.4978452567011, -30.0176431890577, -63.0747328046709, -54.7369061969221, 39.9523709435016, -27.1971534471959, -94.4386278744787, -78.7398369051516, 18.4704976622015","-42.4461417831481, 81.5393285825849, -52.1045574918389, -19.8012057226151, -87.6727635972202, -26.1554778087884, 5.14846704900265, 16.3954760879278, 75.12436225079","k",FALSE,0.20385887657505 +"pcor.mat",15,"60.3103106841445, 71.4415548369288, -98.9705654792488, 7.11592291481793, 10.6087463442236, 42.708487669006, 82.4820324312896, 38.3419292513281, 85.0099918898195, -0.90777650475502, -92.9779385682195, 3.21783553808928, 97.79725340195, -15.0709590874612, -88.6436254251748","59.2901791445911, -3.65023575723171, -0.826246337965131, -92.2944152727723, 4.78945928625762, -35.9777873847634, -4.00528195314109, 14.427507808432, -36.5650984458625, -30.6801207829267, -33.1895301584154, -72.0329152885824, 88.569199340418, -63.0710757337511, 81.6133069805801","-4.55778324976563, 49.8842949513346, -24.1089406423271, 15.2178956661373, 93.4157602954656, -14.0120008029044, 74.634336354211, -76.262500602752, -0.484065152704716, -24.2140971589833, 55.4016582202166, 59.3731869477779, 79.561612335965, -26.1603471823037, -32.2228459641337","p",TRUE,0.111079544613507 +"pcor.mat",12,"-47.1727962139994, -62.7806689590216, 14.7163263522089, 98.5433207359165, -2.45944913476706, -48.7231005448848, 15.0826691649854, -78.9477611426264, -66.5948192588985, 8.53210580535233, 33.7848087307066, -11.1786916386336","-53.4802015405148, -67.8791525308043, 16.3833658210933, 8.16084523685277, -68.3082328177989, 52.1591320168227, -94.9673681054264, -51.7830446828157, 48.8592490553856, 80.6429937947541, 18.254310823977, 21.4851890690625","59.5537723042071, 28.640017285943, -53.3816957380623, 52.5868681725115, 61.431689793244, 38.7933161575347, 63.6210044380277, 74.1345513146371, -31.347640696913, -11.0894621815532, -53.0158845707774, 53.0884329695255","k",FALSE,-0.138443731048635 +"pcor.mat",6,"16.9672078453004, 39.5416527055204, -65.5000091996044, -90.130511764437, 63.6201905552298, -18.7544235493988","-81.3643315806985, 87.5242207664996, -87.3709872830659, -94.47445650585, 80.7427565567195, 97.7012349292636","21.0985390935093, -19.1841311287135, 61.7898017633706, -90.6381107866764, 61.5531626157463, 50.346623826772","s",FALSE,0.58925565098879 +"pcor.mat",7,"-56.6911320667714, 14.7237893659621, 72.7042480837554, 67.854171898216, 54.2756285984069, 87.7428719308227, -62.4983601737767","56.7447266541421, -63.2602260448039, 95.9155341144651, 79.549733037129, -31.7429569549859, -96.1661211680621, 89.6558737382293","17.7951748482883, 52.8001375962049, -17.0254016760737, -0.180792575702071, -69.1782949492335, 5.72048868052661, -73.80879400298","p",TRUE,-0.344955719900739 +"pcor.mat",14,"8.34259777329862, -90.7544204033911, 53.8198739290237, -73.6186733935028, 65.3159111272544, -54.8385083675385, -56.6149288788438, 93.1464713532478, -49.6990147978067, -62.7166502177715, 26.090932963416, 59.4254573341459, -78.5409053321928, 13.1633264012635","71.73405229114, 47.2987382672727, -66.5379968006164, 80.1759538240731, -32.3648356366903, 10.4439327027649, -84.9242614582181, 98.0132193304598, 31.8165130913258, -75.4577403888106, 27.8047663159668, -52.8659251984209, -61.3233786541969, -31.609858199954","92.3250074964017, 41.1538690794259, -70.4804343637079, -33.9494093786925, 67.3102808184922, 30.5022850167006, 14.392489567399, -66.8610816355795, -21.4584674686193, -87.7356766723096, 86.1648599617183, 34.3186971265823, -45.2394630759954, -97.3335643764585","p",TRUE,0.0376321132257061 +"pcor.mat",19,"17.2792347613722, 44.7029660455883, 7.22097363322973, -65.7868965063244, -75.2946712076664, -75.9451765101403, -65.4915338382125, -42.1579808928072, 0.180424936115742, 60.9645693097264, -79.4751405715942, -88.1112538278103, -3.82754770107567, 11.970756854862, -89.807746373117, -75.4269581288099, -83.210919983685, -49.4484897702932, -79.4092588126659","98.0341942049563, -77.4498141836375, 28.0400432180613, -31.759634707123, -8.49162279628217, -77.7130985166878, -44.0454395022243, -40.247108368203, 44.3426605779678, 48.202803870663, 13.207955705002, 27.6490168180317, -3.62952486611903, -15.9190153237432, -34.1904443688691, -1.11497580073774, 10.264601605013, 39.9211245123297, 27.739332895726","88.2835000287741, 33.0788629129529, 66.6329775005579, -58.9400433935225, -67.8360211662948, -23.8581227138638, -64.4136915449053, -71.0973926819861, -6.4570713788271, 5.39726838469505, -64.308940153569, -80.775932315737, 17.806462245062, 64.6042937878519, 25.6625287234783, -53.9103304501623, 10.1242880802602, 31.6518820822239, 71.827148180455","p",TRUE,0.0548011187422948 +"pcor.mat",15,"-48.3876196667552, -26.4751517679542, 86.0122847370803, -2.21008872613311, 88.2522213738412, 36.0168526880443, 53.617551876232, 46.2094876449555, -55.7492116466165, -48.1529265176505, -27.9851477127522, 62.0271205436438, 6.54048435389996, 65.1294771116227, -97.3066220059991","88.3713206741959, 70.3678138088435, -17.6713398192078, 92.8743582218885, 67.6384199876338, -56.5470991190523, 28.6562576889992, -89.9442651774734, 14.1420055180788, -39.6874803584069, -68.7506389338523, -46.1653867270797, 54.8760372679681, 31.6477505024523, -74.1190653759986","-50.7720490451902, 13.1769198458642, 60.0184863433242, 69.6465944871306, -4.16778987273574, 42.1332813799381, 44.0076574683189, 47.2968339920044, 47.09054636769, -90.304255951196, 90.9836431499571, 61.1754382494837, -95.954512199387, 65.8738845027983, 18.4467539191246","p",FALSE,0.155278581425428 +"pcor.mat",12,"66.9760071672499, -10.0718723144382, 98.4006015583873, 49.9737814068794, 93.0611060000956, -30.8278535492718, -49.5318784378469, -74.5468678884208, 53.2779390923679, 45.9250777494162, 7.21664810553193, 98.5868971794844","86.4792299922556, 66.300771990791, -30.303956894204, 99.7657214757055, 21.8715326860547, -0.453599169850349, -49.4858743157238, 95.0286555103958, -75.6651264615357, 61.6245118435472, 50.6951719522476, 73.4736283775419","-76.645670318976, -46.4482659008354, 14.1620874870569, -42.584248399362, -53.2975015696138, 54.3731088284403, 94.7233782615513, 5.24166952818632, 33.9543189387769, -39.5664878189564, -64.9096461012959, 64.3044523429126","k",TRUE,-0.029027606770737 +"pcor.mat",5,"90.8192429691553, 48.4106589574367, -21.8404297251254, 41.0448144190013, -83.0681975465268","-59.1780140064657, -51.5384333673865, -47.804808197543, 12.2319002635777, 15.4189415741712","87.9196766763926, 56.3696804456413, 10.8711638953537, -25.8778809569776, -61.6596679203212","p",FALSE,0.828266806248407 +"pcor.mat",15,"-84.2769027221948, -99.7776164673269, 53.0052073765546, -56.7098737228662, -87.9683969076723, -51.0782906785607, -35.9742659609765, 17.2527201939374, 58.1052905414253, 79.0114177856594, -98.0878078378737, 49.7950758785009, -84.3974281102419, -79.6418719459325, 82.9541291110218","91.2282381206751, 32.1592024061829, -55.6543642189354, -73.2480760663748, 2.29297978803515, 88.1192316766828, 70.9258356131613, 8.78023901022971, -54.8915889114141, -16.0259561147541, -62.4688476789743, 35.7657310552895, -85.5574174318463, -78.2423210795969, 57.0005943533033","68.9237471204251, 97.5910210981965, -70.7898926921189, 78.3896393608302, -26.9685154780746, 31.1476676724851, -7.25077791139483, 4.25968733616173, 71.4906623121351, 99.7103612869978, -70.5109211150557, -29.5995627064258, -89.8151689674705, -61.3775999750942, -23.73201623559","s",TRUE,0.131094606641465 +"pcor.mat",12,"-4.51542986556888, 65.3962709475309, 54.7027637250721, 21.8017288018018, -45.6481758039445, 56.3114468473941, -10.0910985376686, -33.9759476948529, 47.1306453458965, -81.5762444864959, -15.2306498959661, -55.8099669404328","78.4110291860998, 51.8248929642141, -74.8319068457931, -27.2911807522178, 99.4782904628664, 96.8407794833183, 88.3730117697269, 51.7726821359247, 34.6810360439122, 94.3698732182384, -27.2285795770586, 60.5969968717545","-56.935870507732, 35.1825864054263, 46.9766597729176, -0.979113671928644, -0.491952011361718, 2.96344561502337, -53.3740632236004, 63.3763818070292, 98.6882844939828, 32.3614825028926, -9.01708984747529, -89.2050859052688","k",FALSE,-0.238461538461539 +"pcor.mat",16,"-86.2841431982815, -18.3129501063377, 60.0204044952989, 49.4004330597818, 73.2034908607602, 36.0958587378263, -26.9164501689374, 99.3937272578478, 99.4885763153434, -15.9275187179446, -64.6454212721437, -25.9472228586674, 35.9230092726648, 25.0261219218373, 17.5404471345246, 1.84494755230844","96.1923027876765, -42.1271054539829, -8.16392744891346, -97.7614040952176, -10.3897859342396, 63.9586094766855, -50.9310736320913, 82.2031420189887, 72.7375000715256, -22.3871399648488, 57.6591491699219, 90.738725150004, -46.6567573137581, 94.6342563722283, -29.7158366069198, -79.2119293473661","-22.4795233458281, -96.3848259765655, 21.2546060327441, 68.0201687850058, -97.928561642766, -67.2587384004146, 44.8108606506139, 82.0129224099219, 24.2342098616064, -86.4289211574942, -79.5525341294706, 19.2005013581365, -51.4744527172297, -63.8537698891014, 17.4904732964933, -32.1932288818061","p",FALSE,-0.0517037216543802 +"pcor.mat",9,"-12.2494653332978, 81.3471322413534, 15.8859042916447, -40.0486988015473, 52.4177443701774, 19.3593227304518, -47.6214892696589, 98.4649391379207, 73.2301543932408","89.4672878552228, -82.9613993875682, -66.7588278185576, 78.6925439257175, -4.60034948773682, -52.7979515027255, 2.19829431734979, 72.0490128267556, 86.0512541607022","33.8618124369532, 90.739763667807, -55.6767753791064, 39.5474712364376, 83.0445552710444, 34.4050417654216, -59.1911187861115, -8.19138023070991, 99.0859573241323","p",FALSE,-0.198035626518398 +"pcor.mat",10,"47.6879670284688, 16.5959696285427, -63.4765389375389, -27.5170926470309, -22.5022290833294, -43.0537707172334, 70.5259828362614, 59.2826380394399, -88.5750241577625, -1.89512646757066","-61.3072986714542, -26.0851273313165, -8.67939637973905, -27.971677435562, -40.7435014378279, 1.29813449457288, 2.31690336950123, 16.4261620491743, -52.7925265487283, -89.1311551444232","52.5048244278878, 4.67872102744877, -46.2626181542873, -45.9650584962219, -50.2988358028233, 87.9835510160774, 56.6933359019458, 96.3448523078114, 53.302510920912, 1.91744468174875","p",FALSE,0.0988233148075562 +"pcor.mat",9,"14.4472865387797, -47.3339173942804, 88.0170038435608, -31.5219953190535, 46.918716840446, 56.6940610762686, 6.99824644252658, 98.6299303360283, -5.93640897423029","22.6194951217622, -77.684145513922, 75.3283645957708, -40.9434220287949, -38.5339342523366, -91.2029369268566, -63.4814173448831, 10.7932053040713, -49.4684089906514","-33.6434269323945, 73.0934476479888, -23.9013602025807, -76.148905325681, 60.0582375656813, 70.3553961124271, 7.24662998691201, -66.3810072466731, -94.6542747784406","s",TRUE,0.541229427257326 +"pcor.mat",14,"62.3325610999018, 28.3598528243601, 45.8982207346708, -8.46395660191774, -63.4389164857566, 72.4040941335261, 0.539024919271469, 91.1112579517066, 16.1043775267899, 68.5833586845547, -90.9464060328901, -99.2442855145782, 17.0317857526243, -9.96274407953024","-4.58235912956297, 11.521205957979, -75.3375723026693, -5.17353126779199, -40.0790630374104, -70.08021697402, 53.5009195562452, -58.0623977351934, -9.79966381564736, -35.5031280312687, 68.6820048838854, -48.3796393033117, 10.2691211737692, 52.6988474652171","41.5283095557243, -6.18213326670229, -20.2820646576583, -43.5107395984232, 97.0502740703523, 60.2817252743989, 1.80356446653605, 48.0388806201518, 13.3720958605409, -19.7484199889004, 65.0038605555892, 86.6087830625474, 84.9961121100932, -55.2010769490153","p",FALSE,-0.496536277317825 +"pcor.mat",11,"-86.8348072748631, -68.1555027607828, 93.7882163096219, -17.574486322701, -3.01832188852131, 82.4596357531846, -70.7045842893422, -41.0055582877249, 85.1761696860194, -76.0164870880544, 9.26548577845097","78.6481990013272, 33.5281310137361, -46.5702877379954, 13.5015867650509, 11.9400870520622, 28.7497514858842, -32.9607792664319, -34.5967058558017, 46.3658351451159, 53.1044125556946, 88.4551724884659","8.02730321884155, -14.3242678139359, 10.4656010866165, 44.1013956442475, 41.8432073201984, 16.2981065455824, -42.1405011322349, -81.4176644664258, 41.9636760372669, -95.8132732659578, -96.6605862602592","s",FALSE,-0.187531875709659 +"pcor.mat",15,"-8.95890998654068, 87.6476715318859, -82.3296630755067, 54.1639633011073, -56.9908442441374, 32.6043246779591, -85.6081826612353, 77.9518540017307, 26.4017198700458, -99.6459340676665, -2.37713954411447, 57.1259008720517, 15.9859085921198, -21.3041906710714, -88.4612631518394","71.0004774853587, 33.6280925199389, -44.5519751403481, 61.0465653240681, 82.826607953757, -72.3422850482166, -27.0270694512874, -48.9543684292585, -13.1586199160665, -48.2837385963649, 71.7649020254612, 89.9132785387337, -46.7835825867951, -5.76893505640328, 68.2509062811732","-79.8319123219699, 4.72839176654816, -51.0409486014396, -58.6709169205278, 53.0833051074296, -70.3293783590198, 19.1716862842441, -67.5588438753039, 62.886883597821, -96.4109890162945, -34.4456045888364, 45.6756661646068, 47.4764776416123, 7.42012783885002, 38.5514346882701","s",TRUE,0.0110289747628682 +"pcor.mat",16,"31.4061987679452, -74.9066208954901, -64.9867978878319, -5.39299356751144, -53.42126484029, -47.4726263433695, 69.5169975049794, 31.62314100191, -22.9675776790828, -74.656882788986, -1.33912023156881, -98.8822244573385, -35.7455586083233, -33.464961964637, -3.55721861124039, -27.8399859089404","72.7164791896939, -83.5368575528264, 64.1068436671048, 3.18035068921745, 71.0855689365417, -68.9065222628415, 88.6347917374223, 84.7157137468457, -38.3024057373405, 8.57474114745855, -65.9063815139234, 43.8279079273343, -6.10163295641541, 61.0187361482531, 2.19916221685708, -9.51254032552242","56.0140502639115, 56.2448440585285, -48.0950287077576, -38.731576455757, -71.3526351843029, -26.7311075236648, 50.0080749392509, 39.7566744126379, -0.389600452035666, -6.86149629764259, -87.0373306330293, -5.545165669173, -14.8602196481079, -45.7474006805569, 10.8187668025494, 45.559770334512","k",TRUE,0.236643191323985 +"pcor.mat",6,"43.2217205408961, 95.0128023047, -37.1413607615978, -85.5048784054816, -17.2799117863178, 35.998792340979","8.15750281326473, 43.2605781126767, -44.8291454464197, -31.1379416380078, -44.7567201219499, -44.5435838773847","-28.5342446528375, 59.9700956605375, 71.0424310062081, -25.7011258974671, -79.6189298853278, 28.7746171001345","k",TRUE,0.607142857142857 +"pcor.mat",10,"63.2382842712104, -45.6831192597747, -55.7130093686283, -82.2273524012417, -10.8993649948388, -20.6117415335029, -72.7630480192602, -77.4749230127782, 53.6859362386167, 68.9426238182932","30.9459066949785, -80.7866416405886, -47.3474097438157, 49.9985641334206, -84.2809103894979, -56.8257133476436, -13.4179298300296, 60.9060937073082, 48.940838733688, -62.3239307198673","-73.7048507202417, -57.31729445979, 14.9673992302269, -14.3290285952389, -76.3574062846601, -60.4541322682053, -16.2746643647552, -28.6148637533188, 18.4534307103604, -83.0491851549596","s",TRUE,-0.193126854288765 +"pcor.mat",9,"-36.237419815734, -82.6313697267324, -45.2068409416825, 28.2838310115039, -8.59123645350337, 64.9153559468687, -53.2393038272858, 62.8279895056039, 1.16134048439562","-10.1885996758938, -91.6434466373175, -46.7915282119066, 25.4895669408143, -24.0784865338355, 58.5600736085325, -44.0702077001333, -98.0394726619124, 76.2519818730652","33.8238641154021, 7.84905035980046, 36.8167491164058, -17.6727590151131, 9.43915518000722, 5.15828183852136, 92.3964754212648, -85.2526424452662, -63.7069202959538","p",FALSE,0.398179069149688 +"pcor.mat",13,"78.1919818371534, 64.493830408901, 0.710873352363706, -40.3782351408154, 57.4935470242053, 38.2916694041342, -41.3470767438412, 76.0839499533176, 27.3725191596895, 28.8496494758874, 21.4308275841177, -26.0073396842927, 38.606214011088","16.4913782849908, 27.8782834298909, -80.1846226677299, -72.8203158825636, -16.3325851783156, 86.8600406683981, 93.3527871966362, 14.9770261719823, -45.6588900648057, -87.0777580421418, 13.9018434099853, -22.1736597828567, -12.0512451045215","-71.655789623037, 14.8334824945778, -16.8137946166098, -60.0538752041757, 17.0944395940751, 22.4857289344072, -77.132256841287, -55.0677491351962, 2.21382677555084, 69.3236303050071, 39.8013096302748, -39.7288813255727, -63.2540795020759","s",TRUE,0.336736697396128 +"pcor.mat",13,"91.7842994909734, 38.721524970606, 39.1705478075892, 18.6643098015338, -4.83868648298085, 96.8743856530637, -8.04941062815487, 88.7948990333825, -42.6608783658594, 74.295567907393, 20.754674077034, 20.6958107184619, 7.28423306718469","39.8056766949594, -61.7218984756619, -1.59168504178524, 4.02580439113081, 60.1681916043162, -89.8049416486174, -35.8231709338725, 78.1130255199969, -55.8174833655357, 51.9783590454608, -36.2147870473564, 35.5141086038202, -8.96845734678209","4.79736779816449, -56.6321770660579, -76.5336334705353, -22.4140492267907, 77.5082608219236, -61.9375938083977, -6.95173270069063, 19.7686547413468, -30.8583251200616, 47.0094705931842, -54.2295054998249, -98.6059594433755, 87.8028795588762","k",TRUE,0.212316868169448 +"pcor.mat",15,"-3.59630105085671, 86.7999098729342, -17.786830663681, -92.8564656991512, -51.1485965456814, -14.4706445280463, -17.7462406922132, -28.2284520566463, 58.7217133492231, 79.4202568475157, 94.2491712979972, -15.5174071900547, -10.2361090481281, 66.6180044878274, -50.6200913805515","65.4638954438269, 6.78580459207296, -35.6246003415436, 58.6391407065094, 18.2316683232784, 86.3036005757749, 46.5730607975274, -84.4369672238827, -44.6714565623552, 17.6646849140525, 37.9040233790874, 32.2640858590603, 77.358628436923, 55.9946102555841, -33.5247005801648","-19.0743586514145, 82.9343199264258, -8.59537380747497, 14.3348595593125, -41.50315746665, 12.1748448815197, -52.9024983756244, 52.8367889579386, -65.2377155609429, 24.2413009516895, -35.3585127275437, 26.4716796576977, 47.1821424551308, -15.6605173368007, -48.333586147055","p",TRUE,-0.0118283348531814 +"pcor.mat",6,"24.3941873777658, 0.587183143943548, 50.1822246704251, 61.6280217655003, 74.6993770357221, -69.6933365892619","-72.6307827513665, 21.0318620782346, -32.1439458057284, 26.9628962501884, -2.04706066288054, 33.2147478125989","66.891982126981, -18.3136829175055, 88.7454390525818, 78.3952571917325, -97.2121218219399, -20.8632645197213","s",FALSE,-0.303802497166359 +"pcor.mat",14,"-77.750310394913, 86.9882957544178, -85.0523100234568, -36.57017191872, -18.1189219001681, 20.1568298507482, 87.3199927154928, -10.1865636650473, 87.327975500375, -17.7946219686419, 4.59059923887253, 19.7666067630053, -31.7012812476605, 52.6644026394933","-60.2974510286003, 74.7249050065875, 1.42830195836723, -15.9695675596595, -83.7907467503101, 55.462152371183, 41.3278543855995, 89.4937683828175, -57.9569500405341, 74.0428008139133, -79.0337625425309, -49.0267637185752, 97.498970804736, -30.8440355118364","-91.0899322014302, 73.1682816520333, 92.4029916524887, -80.4349666461349, -33.0292509868741, -17.2952547669411, -51.6502045560628, 81.4240960869938, -72.4618446547538, -26.8657810520381, -4.80628688819706, 72.3387493286282, 2.85462928004563, 23.4467320144176","k",TRUE,0.000509880332891465 +"pcor.mat",13,"10.7691071461886, 65.1007527951151, -12.0915657840669, 91.6448481846601, -53.240419505164, -69.8381493799388, 21.602482162416, -34.3285651411861, 43.1247111409903, -37.4003404285759, 94.0640051383525, -65.0122064165771, -7.96503899618983","-85.3995600249618, 67.8450697101653, -56.2912890221924, 58.0509331542999, 36.6984612308443, 87.1452712919563, 49.0658250637352, -52.1726700011641, 94.9811044149101, -53.7899555172771, 39.8667695466429, 98.3075775206089, 63.3846609387547","-46.4738335926086, 37.4508975539356, 44.48222653009, 8.24846290051937, -69.1236611455679, -95.8152562379837, -3.39012276381254, -2.47371718287468, -11.9899280369282, 43.2109453715384, 2.20609768293798, -49.9354481697083, -95.7224021200091","p",FALSE,0.380657823856592 +"pcor.mat",5,"15.9143696073443, 48.3970512636006, 23.7569111865014, 83.6479561869055, -89.9238623213023","-20.0500118546188, 93.1261721998453, -91.0053466912359, -23.429145431146, 45.976064959541","-2.69081904552877, -4.5110234990716, -33.4870064165443, -74.1843503434211, 2.36937236040831","k",FALSE,0.218217890235992 +"pcor.mat",6,"10.1451388094574, -90.6787392683327, -87.4421800021082, 20.2668400015682, 78.3513565082103, 20.7683491986245","-97.6740748155862, 10.7196703087538, -54.752997867763, 80.7648414280266, 12.498453585431, 29.1912749875337","-63.6234064586461, -45.7921910565346, -50.1311025116593, -91.5211007930338, 16.7567258700728, 85.7384174596518","p",FALSE,0.236960037693682 +"pcor.mat",12,"73.2413066085428, -14.7738272324204, 50.0003031920642, 45.0548450928181, -48.7516783643514, -23.1134415604174, -87.6020579133183, 30.5087967775762, 82.4424541555345, 72.7492412086576, 32.3323079384863, 85.7122719287872","-9.44385454058647, -7.42488116957247, 3.06755122728646, 35.4948386084288, 69.3501094356179, -19.1765882074833, 95.9793315734714, 29.2394527699798, 53.3461356069893, 11.7002569604665, -71.7540245968848, 20.5835649278015","66.2635098677129, 48.2205909211189, 81.5142437815666, -31.1989811249077, 5.75581910088658, 93.6992627568543, 72.9302003979683, 30.9292090125382, -55.1979901269078, -78.7769370246679, 14.8034851066768, 37.4370891135186","p",TRUE,-0.48727199671024 +"pcor.mat",10,"52.8255486860871, 34.2574729584157, 44.7404673323035, 52.2620148025453, -69.898310629651, -85.9551533591002, -52.2192012518644, -56.3183640595526, -19.7211066260934, -6.08869907446206","-67.6190298050642, 75.8668028283864, 74.6253774967045, -66.1169764585793, -81.1506592668593, -33.249074826017, -21.2896263692528, -97.763530863449, -54.6630097553134, -96.6868148185313","-35.384417232126, 13.2294847629964, 22.9882229119539, -58.4000170230865, 88.3519669994712, 59.8886359948665, -30.7637225370854, 40.6464832834899, -62.5224160030484, -0.506686419248581","p",TRUE,0.492210961830229 +"pcor.mat",8,"18.1551295798272, -8.32464881241322, -99.8132115229964, 18.6201244592667, -53.1589215621352, 70.2180631458759, -36.3900125026703, 92.1965328045189","6.02451944723725, -68.5814322903752, 70.58563423343, 1.00183109752834, 16.1975951399654, 64.5838780794293, -84.6291496884078, -54.131712205708","80.0181794445962, -12.9483319818974, -3.88606782071292, -48.0255630798638, -3.62709653563797, 31.62224679254, 57.1325340308249, -93.3892488945276","p",TRUE,-0.141482085540883 +"pcor.mat",17,"90.1813358999789, -3.33601352758706, -70.5867488868535, -40.8890372607857, 58.0897845327854, 8.4102772641927, 31.2019024044275, 67.8843731526285, -5.85478777065873, 93.743189284578, -21.4788604527712, 48.0386326089501, -42.5454632379115, -78.037649858743, 5.827397108078, -59.5929707866162, 22.9059528559446","46.3524929713458, -42.5642458721995, -69.567626202479, 91.2107714917511, 80.4405058268458, -83.3648740779608, -5.59279890730977, 67.8364232182503, 9.23628495074809, -45.9923652466387, -2.29323050007224, 92.1013004146516, 34.326039114967, -10.8744602650404, 89.988622488454, -23.287376947701, 72.6627949625254","48.8092821557075, -84.7605162765831, -68.7700709793717, -67.7357694599777, 25.1485624350607, 61.709990631789, 29.2394532822073, 47.8424397762865, 37.0008739177138, -47.5637663155794, -14.6964757237583, -69.9305152054876, -54.4029568322003, 80.0897337496281, 9.39622772857547, -1.27441040240228, 74.3666623719037","s",TRUE,0.270551782409472 +"pcor.mat",13,"-68.030820786953, 48.6679933033884, 51.8114904407412, 78.5725246183574, 18.9902665093541, 25.0479029957205, 56.8353782407939, -4.79650879278779, -87.2707166243345, -64.176924712956, -56.511168833822, 41.7948929592967, 79.8323729075491","87.0083963032812, 12.2851114254445, -48.7783022690564, 2.98262075521052, 61.5149905905128, 72.0769232138991, -33.8758388534188, 19.778781151399, -12.315073935315, -95.3089885413647, -40.8825332764536, -50.1593578606844, -29.2145641520619","82.5196304824203, 86.4081613719463, -63.7102510314435, 82.9122426919639, 86.7011873517185, 1.18320896290243, -7.11194663308561, 31.899410719052, -69.8009483516216, -57.3877718299627, 2.83222463913262, -17.2023222781718, -38.1276280619204","p",FALSE,-0.215982700387935 +"pcor.mat",12,"-36.3307877443731, 74.7712590266019, -79.8354192636907, 93.8916243612766, -50.0289557501674, -54.7662570606917, -38.7290718965232, -84.6648510545492, 71.2978508323431, 88.4917345829308, 32.1320930030197, 76.4375317841768","2.62319510802627, -97.154287295416, 21.7567156534642, 95.8672656677663, -0.763413123786449, -9.49476859532297, 83.9058271143585, -38.3374994620681, -16.9302582275122, -85.5358060449362, -83.2731044851243, -18.7622617464513","-76.2503104750067, 36.5515212062746, 48.5381714068353, 72.03823258169, 36.652302602306, 29.980877507478, 21.0754222236574, -96.8017131090164, -66.5918422862887, -10.5546385981143, 91.4459123276174, -84.6182245295495","k",TRUE,-0.161695275103975 +"pcor.mat",13,"65.4542396776378, 2.08085202611983, -88.9037624932826, 52.2526708897203, -38.4136536624283, -13.373964605853, -48.226101975888, 93.4839099645615, 39.563751546666, 69.0497747156769, -94.8003361001611, 24.9876524321735, 25.2306204754859","82.8150092158467, -9.80691406875849, -84.2437265440822, -48.5185658093542, 93.8153511844575, 76.507264515385, 96.1720596533269, 91.2560781463981, -86.2542728893459, -47.9744947515428, 25.5869822110981, -15.71259717457, 99.3623040616512","64.0070253051817, -90.157330268994, 78.4984151832759, 36.6091389209032, -85.7790939509869, -43.4162854682654, -81.61596711725, -7.2117717936635, 69.8510519228876, 87.7512107603252, 60.0242395885289, -77.6109307538718, 33.9131449349225","s",FALSE,0.0846468464958684 +"pcor.mat",14,"6.42584343440831, 89.4456365611404, -94.9723384808749, -4.63838037103415, 82.1529622189701, -72.2434451803565, 21.8717840965837, 13.9814134221524, -70.8967028185725, 99.243081593886, -67.1596728730947, -69.3361242301762, -52.0885898265988, 54.4663844164461","-6.86167716048658, 63.0930243059993, 62.3814635910094, 42.8769947495311, 12.4187188688666, -55.67507436499, 68.4297569096088, 57.5610874220729, -4.82598571106791, -79.5595136005431, -55.5029585491866, -94.9160863645375, 82.0372765418142, -52.3549461271614","-96.7493511270732, 16.427826648578, 26.2085369322449, 89.924060087651, 64.0857739374042, 65.0612049736083, -50.4840951412916, -27.8882106766105, -37.310868408531, -41.0194541793317, -37.8566451836377, -97.9508240241557, -74.5396174024791, 76.8885430879891","p",FALSE,0.0312670434242096 +"pcor.mat",12,"34.8341395147145, 43.1037290487438, 82.2314764373004, -63.9271955937147, 70.3003748320043, 51.0297972708941, 95.4673350322992, 74.5106549467891, -71.5771752875298, 32.5960139743984, 85.8803272712976, -12.2395237442106","-27.241831831634, -76.5246210154146, 86.3751742523164, 74.9675445724279, 63.8482879847288, 14.7356034722179, -30.9328155592084, 73.2200371101499, 26.5261144377291, 42.3744561616331, -80.7972604874521, 95.1648845802993","30.9194989036769, -29.2449895292521, -75.1953874249011, -97.2041368950158, -63.0337142385542, -96.9185112509876, -72.140100877732, 50.4067888017744, 80.1865959074348, 69.9119384400547, 28.0939280521125, -78.1314740888774","p",FALSE,-0.344081701794653 +"pcor.mat",17,"-32.3364136740565, -74.5505046565086, 64.3489994108677, 95.3302425798029, -47.4365599453449, -99.5640191715211, -81.8646350875497, -10.4291386436671, -46.2970128748566, -66.2438121624291, 3.38349812664092, 46.3537188712507, 50.3833524882793, 76.8161817919463, -35.9225623309612, -30.2367287687957, -15.6686681322753","-85.6091414112598, -74.5855379849672, 31.7983427084982, 12.1914628893137, -76.0027903132141, -25.2544173505157, -53.2312866300344, -66.4824201725423, -35.0571169052273, 25.0753607135266, 57.0668096188456, 97.4866581615061, -34.1166456695646, 70.7655222155154, -25.6891251541674, -99.2252895608544, 30.7619682978839","44.1535466350615, 57.7384070493281, -42.7488908171654, -81.2754278071225, 97.9185460601002, 35.2168054319918, -26.9714017864317, -93.0728284176439, -60.7041460927576, -99.858339689672, -53.829790558666, 85.15021414496, -98.6793769989163, -86.0895386897027, 51.4472865033895, -15.630559111014, -28.9994670078158","k",TRUE,0.261679778734634 +"pcor.mat",10,"89.7360242903233, 47.9975900612772, 36.5392371080816, -51.0348361451179, 7.82818463630974, -6.9301129784435, -75.5731589626521, 47.0917036756873, -58.8109106291085, 33.4785438142717","54.0308193303645, 41.3668432738632, 98.2857145369053, -14.9101806804538, 30.7341996114701, 92.3570320941508, -35.8356348704547, -91.0546428058296, 77.7767921797931, 13.7820704840124","-65.3565419837832, -24.2730437777936, 13.4862332604825, -97.8464429732412, 91.0171907860786, -52.4954450316727, -31.7320866975933, 33.8117491919547, 49.1156910546124, -42.7486607804894","p",FALSE,0.109506018207148 diff --git a/tests/unit/computations/partial_correlations_test_data/pcor_rec_blackbox_test.csv b/tests/unit/computations/partial_correlations_test_data/pcor_rec_blackbox_test.csv new file mode 100644 index 0000000..a1558a0 --- /dev/null +++ b/tests/unit/computations/partial_correlations_test_data/pcor_rec_blackbox_test.csv @@ -0,0 +1,101 @@ +"function_name","count","x","y","z","method","rm","result" +"pcor.mat",13,"-89.1427156049758, -70.2603165991604, 52.4590492714196, -57.2846714872867, -26.3361851219088, -0.000567594543099403, 17.9622953757644, -64.1319836024195, 39.2497098539025, 20.8931459579617, 74.1897551808506, -35.3126015048474, -55.9552798978984","47.3745858296752, -68.9209029078484, -31.9765134248883, -45.0486478861421, -85.1716816890985, 65.432888455689, 19.2734406329691, 87.9198614973575, -68.2076670229435, -38.1280574947596, 52.754437038675, -73.271297942847, 67.7760738879442","-78.9239354431629, -85.3030194528401, -20.3673145733774, -22.6184178609401, 16.5013548452407, 18.5637861024588, 96.5889988467097, 36.156284250319, 35.1589790545404, -73.1023930944502, -50.7484216243029, 41.8345319107175, -47.8776978328824","s",TRUE,-0.0325789017360908 +"pcor.mat",18,"64.013504376635, 53.1150240916759, -77.8307237662375, -33.1533540505916, -13.6034480296075, 93.2804300449789, -46.3470680173486, 17.427362408489, -66.663983091712, 4.23776390962303, 77.7521491982043, -3.10332304798067, -61.5989458281547, -13.5284000542015, 7.71856023930013, 89.0885920263827, -35.3556916583329, -95.9261478390545","-35.6941626407206, 41.877265740186, 69.6430462878197, 64.2008605413139, -59.4343301840127, 79.7348674852401, 61.3097242545336, 9.0187989640981, 51.7997904680669, 45.9638734348118, 41.0136769060045, -73.4738738741726, -47.0628185197711, 57.6456079725176, -2.5194660294801, -53.7642545998096, 18.9816055819392, -54.8453160561621","-55.6193302385509, 63.7390994466841, 85.8707739040256, -77.2866525221616, 29.9346832558513, -24.1673247888684, -61.8650471325964, 19.6793714072555, -60.1225732360035, 12.063248641789, -51.2589928694069, -41.5690367575735, -58.2409225869924, 37.0499972254038, -9.5894614700228, 2.70932037383318, 56.0281782411039, -39.5718538668007","s",FALSE,-0.0406099988399257 +"pcor.mat",18,"56.9747474044561, 55.6495593860745, -36.6002877708524, 61.6530403494835, -11.1073412466794, -70.2817751094699, 34.5848673954606, -40.1073589455336, 22.4086964968592, -34.9243235308677, -31.6865964792669, -81.9148152600974, -7.01485783793032, -0.294096721336246, -19.4921953603625, -55.370055232197, 33.2327066455036, -65.3158040251583","-13.8067095074803, -83.5349172819406, -12.6486663240939, -8.66694604046643, 86.2149322871119, 60.7879475224763, -73.3523240312934, 34.5676413737237, -4.87876599654555, 18.5876747593284, 89.8641737177968, -72.3610286135226, -32.7410754282027, 27.3812759667635, -45.791448559612, 80.4758272599429, -76.585627021268, -36.1723904497921","49.7649329714477, -56.3095143996179, 92.719935066998, -17.5905505660921, -34.11227283068, 8.69290293194354, 51.1472036596388, -52.1146316081285, 18.716375855729, 44.0671648364514, -81.5424187108874, 17.9900521878153, 83.1838137004524, -36.2067365087569, 6.58109332434833, 33.7925261352211, 43.0417039897293, -24.2647144943476","s",FALSE,-0.326536819677434 +"pcor.mat",16,"-27.0166050642729, 25.6161904428154, 18.0927545763552, -97.8309890720993, 83.225102070719, 41.1768469493836, 52.531653130427, 90.7089609187096, 45.9316388238221, 44.4865159224719, -65.3349446132779, -63.2685597520322, -63.5370531585068, -20.7488086074591, -21.5636825188994, 70.8061812445521","89.9359612260014, -24.0224461536855, -88.7139027938247, 33.0363452900201, 89.8786358069628, 72.6242340635508, -33.4980245213956, 18.209078675136, -98.510293290019, -45.0928752310574, -56.3632266130298, 36.2233767751604, 24.8566114809364, 41.1938649136573, 98.1815246865153, -31.8091072142124","-83.4077485837042, 67.2828705515712, -46.1948299780488, 44.6621300186962, -68.071247311309, 69.5944227278233, -72.4484366830438, -19.5607443805784, -10.3165994398296, -38.1281117442995, 92.4075163435191, 27.103430358693, 7.35686598345637, -68.8319525215775, -35.345290414989, -22.3868970759213","s",FALSE,-0.265133848612843 +"pcor.mat",16,"62.6007101032883, -31.4669733867049, -1.02701690047979, 89.1588015947491, 89.4676355645061, 72.146376548335, -48.5373890493065, 27.8906877152622, 84.9362426437438, 22.9195747990161, -0.477400049567223, -55.017494270578, 16.0360316745937, -40.5794956721365, -76.5294233337045, 99.2066614329815","32.9774639569223, 99.4476685766131, 19.444046029821, -87.4037025496364, -49.6627463493496, -79.1786927729845, 69.5362528320402, -42.9193137213588, 88.4448691736907, 96.2614195886999, 99.7840614058077, -30.6426415685564, 52.9562290757895, -75.0585582572967, -92.611052794382, 67.6107355859131","99.6344119310379, -43.7020116951317, -14.1780937556177, 29.8982600681484, 67.7026726771146, 12.5789169687778, 5.22102704271674, 47.3305377177894, -10.2066915482283, 44.158894661814, 16.616974119097, 67.5522029399872, 10.2959530893713, 2.26272544823587, -24.1713169030845, -81.4385517500341","k",FALSE,0.00170394349277265 +"pcor.mat",17,"-43.6796560417861, -52.3636834230274, -32.689885282889, 29.6649182215333, 70.8439419511706, -78.822322236374, -7.2787752840668, -37.7680024132133, -9.91778918541968, 45.4824290703982, -1.96461407467723, -10.768158081919, -71.2498663924634, 23.788648378104, 81.2093367334455, -29.8483492340893, 42.7211379166692","54.4582905247808, 2.90980748832226, -49.7587429825217, 90.0067212525755, -62.2195774223655, 49.5222055818886, 64.7147801704705, -30.6467334739864, 43.9336315263063, -24.3989814538509, 93.3036277070642, -5.72181586176157, -51.6447205562145, 71.4890264440328, 35.5837760493159, -39.9753636214882, 64.5502870436758","-86.5306067280471, -2.41111759096384, 17.8865785710514, -66.7758407536894, -45.9109436254948, -99.6982547920197, 9.07599623315036, -49.4003663770854, -50.0817076303065, -52.7716889511794, 9.27476715296507, -1.14214201457798, -14.0225571580231, -46.0782612208277, 97.4677567835897, -70.6407638732344, -99.1432263981551","p",TRUE,0.181498113250831 +"pcor.mat",14,"-4.90339081734419, 72.9479049798101, 46.9192364253104, 92.628131667152, 56.5425228327513, 9.90580045618117, -61.4272825885564, 33.6759516969323, 81.8828757386655, 77.3399218916893, 67.7938031964004, 94.0767949912697, 82.1635375730693, -75.240781577304","21.4586552698165, -36.5642888005823, -38.3646843954921, -49.740192014724, -81.6746165510267, -19.1730958875269, 41.690668836236, -23.3391010668129, -78.1760632060468, 77.431286778301, 70.3289750963449, 39.766847435385, 3.62148815765977, 10.747673548758","17.7063988521695, 90.0697568897158, -93.0447159335017, 85.4728828649968, -18.4118247125298, -9.85785778611898, 70.2666643075645, -97.7391937281936, 54.3527046684176, -51.4394805766642, 39.0205434523523, -25.6685835774988, -14.7992834448814, 81.1236747074872","p",FALSE,-0.21445656018345 +"pcor.mat",15,"-76.8736738711596, -35.8509941026568, -48.1256343889982, -9.57123078405857, -72.2122399602085, -6.98926709592342, -31.3491718843579, 74.3320995010436, 54.9155391287059, -46.5018933173269, 51.3019453268498, 17.0857016462833, -99.9900157097727, -17.3139852005988, -85.5749220587313","-97.7581001352519, -97.2672377247363, -27.3427923209965, -1.21665806509554, -8.05344670079648, 21.0991605184972, -54.0536799002439, 95.0312656350434, 23.7382718361914, -98.728937190026, -80.2528636530042, -59.6354123670608, 20.57563085109, 90.7686199061573, 19.6493336930871","-38.4617018979043, 28.0117013957351, -74.6210919693112, -34.3639187980443, -28.0167740304023, -46.0126685444266, 37.4354778788984, 41.0279822535813, 80.8140107430518, -94.7356107644737, -91.9223290402442, -34.4586562830955, 90.2129443362355, 76.8807396292686, 80.0070276483893","k",FALSE,0.250746493151452 +"pcor.mat",7,"-66.7350410018116, 53.2712059561163, -43.8059563748538, -44.9987557251006, -67.2016165219247, 17.9846523795277, 77.0553316920996","-60.9613332431763, 99.9187499284744, -27.7070741169155, 14.3416102975607, -30.3307291120291, 5.47642167657614, -52.1709493827075","5.97298364154994, 70.3716231975704, -16.247583553195, 92.1821707859635, -80.4653100203723, -7.83197041600943, -66.9684283901006","k",TRUE,0.241209075662211 +"pcor.mat",18,"94.380710972473, -10.0111012812704, 85.1797969080508, -11.4021800924093, -99.7310696635395, -57.7457085251808, -34.8813917022198, 37.1367971878499, -57.5784567277879, 17.9361389484257, -20.6278771162033, -42.8640173282474, -62.0093574281782, 10.7791527640074, -42.4936424475163, 31.2512285541743, -6.26639267429709, 50.0969529151917","-35.3466201107949, 51.2795441318303, -9.26330988295376, 13.2600117940456, -70.25914513506, 24.8688437044621, -95.0622762087733, -78.8527075666934, 12.5830010510981, -40.3181817382574, -62.1690618339926, 65.2437281329185, 45.4263514839113, -20.7038762047887, 19.835890410468, -16.3075220305473, 10.154833085835, 31.5655742771924","-47.5495883729309, 31.0941505245864, -11.7687386460602, 47.550484072417, 19.7334853932261, 59.856044081971, 38.4999468922615, -29.1666014585644, -77.8870329726487, 75.2757792361081, -17.8823099005967, -93.2831089943647, -73.6799968872219, -36.3856283016503, 21.7388028744608, -41.7408903129399, -21.9456392340362, 5.71200731210411","p",TRUE,-0.153597125133576 +"pcor.mat",15,"-83.3593410905451, 33.8860942982137, 17.5660732202232, 44.9482867959887, 3.40795461088419, -98.6972364131361, -57.9294378869236, 49.1425832267851, -81.4089713152498, 22.2765766549855, -15.2078927494586, 64.7270672023296, -77.9068617615849, -13.5009704623371, -41.0612959414721","99.4176274631172, -28.8145580794662, 24.2324681021273, 70.3792416490614, 55.1269176416099, -46.6643883381039, 13.5340544395149, -81.6506992094219, 7.58900847285986, 76.2214359361678, -21.0444819182158, -19.7882746346295, -77.8520357329398, -60.2931962348521, -30.685667693615","-7.22203818149865, -62.021238123998, -34.5286842435598, -67.4230553675443, -62.1439764276147, -99.2042647209018, 7.09792547859251, -88.8404605910182, 79.5403079129755, 68.8092908356339, -87.8009828273207, -11.8701789993793, -40.4039821587503, -50.0366650056094, 61.1679489258677","p",TRUE,0.134662220884382 +"pcor.mat",18,"36.4026268012822, -40.8853712491691, 70.4748715274036, -93.3088712859899, -31.1693381983787, 44.5810994133353, -29.8538233153522, -55.898003000766, -83.1116971559823, 95.2613319735974, -86.9839164428413, -99.6416668407619, -71.7915004119277, 86.375200515613, 73.0707975570112, 9.46915657259524, 30.3790966048837, -32.9175783321261","20.2463141642511, 35.3073101490736, 96.6094605624676, 38.2854318711907, 20.0914516113698, -76.2724542990327, -2.5904384907335, 28.1036204192787, 27.5573522783816, 41.8770257849246, 17.9975534323603, -53.0143345706165, -1.92109285853803, -43.1404768954962, -89.0914923511446, -75.2585290931165, 31.8984744139016, -81.7458927165717","99.058653973043, -73.045432055369, -98.9125271327794, -10.9370147343725, 93.4558239299804, 21.3814281392843, -10.9608757775277, -94.0566421952099, 29.180516814813, 60.7905065640807, -69.4182314909995, 27.9442990664393, 16.5212750900537, -65.4938052408397, -91.3346993271261, -19.3851371761411, 54.6318108215928, 94.2573416978121","s",TRUE,-0.0480625888230071 +"pcor.mat",8,"70.9466312080622, -31.7683406174183, 25.0176505185664, -56.8918467033654, -9.20995227061212, 84.6444204915315, 66.9992076698691, -14.915213920176","-25.2351951319724, 53.1852985266596, 32.9547242727131, -82.4257594533265, -51.8481220584363, 61.490266257897, 16.8974718544632, -71.770367724821","25.6255140993744, 62.6514744479209, 2.26075490936637, -90.3473023790866, -8.56978320516646, 89.0561478678137, 3.07730589993298, 45.6199106760323","p",FALSE,0.307942034203085 +"pcor.mat",18,"23.8564316183329, -16.3905590772629, -12.3555054422468, 78.1761512625962, 49.3263760115951, 13.6127803940326, -35.0881972815841, 18.7167634721845, 47.3916597198695, 6.6052196547389, -47.4990267306566, 36.3517801277339, 77.3957766592503, -70.3038077335805, -28.512022132054, 93.2541827205569, -50.6320198066533, 2.28197425603867","4.66441703028977, 52.664560964331, 64.6692745853215, 64.0807087533176, -42.2254925593734, -28.3238022122532, 84.3502655625343, -22.6033370010555, -63.9537113253027, -82.1724142879248, -47.163494117558, 86.9036048650742, -25.5253764800727, -40.6565339770168, -64.6023235283792, 5.88995609432459, 60.3537472430617, -12.8357082139701","-7.05419671721756, 17.8630999755114, -94.5426801219583, -90.8921510912478, -52.0795451011509, 52.0008019171655, 77.9491205234081, -64.4113312475383, -13.6109072715044, -84.2732723336667, 57.4606000445783, 57.2238144930452, -17.8435018286109, 78.159570787102, -64.3654571380466, 25.7219140883535, 21.2949032895267, -89.99102874659","s",FALSE,0.098864763229466 +"pcor.mat",8,"36.1457616556436, 98.2861819211394, 40.8350063487887, 63.7187578249723, 13.0914898123592, -52.3402118124068, -13.3677611593157, 73.598525673151","79.2985305655748, -71.9141394365579, -0.420988909900188, -90.6284262426198, 72.2033147700131, 79.6287265606225, 20.301692513749, -54.6786930412054","96.6230187565088, -65.8682400360703, 26.0384120512754, -46.9612662214786, 47.5940535310656, -17.1155892312527, -45.7220804877579, -67.2774867620319","s",TRUE,-0.725794650937327 +"pcor.mat",6,"-57.665149634704, 94.4162191357464, -51.1441508308053, -52.6072693057358, -44.1887341905385, -14.2386069521308","-98.8703572191298, -9.2983465641737, -79.2660262435675, 23.2223530765623, 80.3647544234991, -58.0826134420931","81.1863256618381, 64.9427580181509, 45.6761348526925, 64.8033803794533, -40.9290973097086, -92.1668177470565","p",TRUE,0.118780545543647 +"pcor.mat",11,"40.5678772833198, 33.8221173267812, 65.0725501589477, 78.8693956099451, -35.8988873194903, -35.3420054074377, -87.4633281026036, 0.115021411329508, 67.6265092566609, 83.1133821513504, -18.3507286012173","-73.7955948337913, 29.9831629730761, 65.2690784074366, 25.2531439997256, -62.1108427643776, -47.4723324179649, 35.5791020672768, 26.2222751509398, 40.3645094949752, -91.2350233644247, -28.6233199760318","48.7291889730841, 33.8533046189696, 66.3264122325927, -19.7420272510499, -46.8001568224281, -39.1347371973097, 34.7272414714098, 65.1918939314783, 99.5216719806194, -29.0462920907885, 19.8831745423377","s",TRUE,-0.297493089362279 +"pcor.mat",11,"55.8680928312242, -76.9269882235676, -17.3182043712586, 15.2775115799159, -90.3137100860476, -99.032783228904, 13.8755587395281, -24.003914417699, 21.2662550620735, -8.40797564014792, -40.8448379952461","9.94491642341018, 76.8310205079615, -95.3446100465953, -74.8744533862919, -69.8509857058525, 6.55742576345801, 24.8502014670521, 97.212969744578, 29.4545858632773, -77.6854024268687, -80.0981419626623","14.1451966483146, -52.5070706848055, 52.3787314537913, 22.6627501659095, 5.18406489863992, 78.4387116320431, -37.6045362092555, -59.8206405062228, 97.1690027043223, 46.7755769845098, -23.1495135929435","k",FALSE,0.0919698779952353 +"pcor.mat",19,"12.6561464276165, 89.6340752951801, -86.4221294410527, -8.45101773738861, -79.0324212051928, -41.2799602374434, 41.9530363287777, 77.5156316813082, -98.2695916201919, 54.0546870790422, 18.4697377029806, -92.1382030006498, 22.3036497831345, -88.4184999857098, 87.4229540582746, 84.4335915520787, -86.3810521550477, -4.96541885659099, -4.21266416087747","77.7516108006239, 13.0087590776384, -52.281900215894, 46.1203761398792, -7.93849290348589, 30.4574410431087, -4.16998718865216, -76.5136891510338, 65.0717901531607, 41.985437553376, -10.8945969026536, -1.79670625366271, -80.059599224478, -27.9757288750261, -3.81275764666498, -40.5276663135737, -7.72571838460863, -21.2847925722599, -3.90572124160826","-16.1283437628299, -86.2985316198319, 15.8964606467634, 45.3664765227586, -10.7382515911013, -61.8415161035955, 75.2832551952451, 62.1664110571146, 14.5355282817036, 31.9144344422966, 63.7715006712824, 46.5569637250155, 20.0197615195066, 9.47772678919137, -79.8056298401207, -89.03838978149, 96.9052662607282, -3.97900892421603, -68.8863600604236","k",TRUE,-0.0783868693007469 +"pcor.mat",6,"41.7150890920311, 68.0406647268683, -56.6652314271778, -10.3111394215375, 72.7076691575348, 16.4696130901575","55.7349273469299, 33.0129407346249, -92.8235503379256, 67.6610651891679, -28.225592058152, 27.8548604343086","97.3419046029449, 92.7794307935983, 18.738874187693, -50.2989741973579, -31.1240924987942, -47.357566608116","k",FALSE,-0.0545544725589981 +"pcor.mat",7,"76.1037406977266, -51.2855937238783, -51.0953912511468, 61.8452743627131, 27.5623431429267, 32.935436675325, -23.7891209311783","-25.5972837097943, 35.7565317302942, -2.09780340082943, 31.380487093702, -65.0630551856011, -52.5524016004056, -45.8224846515805","35.1819013711065, 55.421924777329, 90.8943614922464, 65.8556955400854, -17.2470153309405, 50.2847956493497, -43.5768135823309","k",TRUE,-0.241209075662211 +"pcor.mat",14,"-86.9700414128602, -96.2525710929185, 13.2297853473574, 48.3323885593563, -42.72451386787, -64.586602896452, 26.2733123730868, -41.4743609726429, -27.5131822098047, -62.4261621385813, -16.2857410497963, 61.4362000953406, -71.6986550018191, 6.73192692920566","-1.76208755001426, 67.4144621472806, 40.1256877463311, 20.0672226957977, 75.7373407483101, -60.1804342586547, -24.0758131723851, -30.328988051042, 98.3264557551593, 18.7257033307105, -74.7150662820786, -66.4480000734329, 83.1373671069741, -83.8592982385308","-8.51446660235524, -33.5672379937023, 23.1306486297399, -71.0971800610423, -76.6779989469796, 17.668380215764, -6.54176617972553, 38.9708994887769, 36.8745916523039, 36.466611456126, -42.6107963547111, -43.292662827298, -34.305056463927, 3.72276022098958","k",FALSE,-0.237726218501727 +"pcor.mat",9,"87.9827535245568, 66.9526648242027, 77.764587290585, -63.0833296570927, 12.8970904741436, 12.7532111946493, -15.7931709196419, 76.1098874267191, -53.3998124301434","61.8036749772727, -53.057945612818, -21.9204508699477, -23.7275714520365, -81.9658347871155, 96.6755392961204, 23.4129578340799, -26.8468076363206, 11.6413829382509","6.22031539678574, -63.707418506965, -68.8293416053057, 51.3240036088973, -89.1044299583882, 96.3014227803797, 84.1399733442813, 3.21415988728404, -64.009400550276","p",TRUE,0.220999575445754 +"pcor.mat",18,"-2.85750310868025, -99.3862376082689, -96.015146560967, 63.2039456162602, -66.0570687614381, -66.0487032029778, -16.3392898160964, 93.4929385315627, -0.228785490617156, -94.138465821743, 89.7544200066477, -39.7632111795247, -60.3579618502408, -34.7465238533914, 49.7126227244735, 56.9427436217666, 69.6163312997669, -16.7142637073994","67.1196629293263, -69.1413426306099, 90.1762881316245, -33.8058187626302, 73.66002057679, 34.5961081795394, -59.5154983922839, 1.26353777013719, 48.2069759164006, -34.2219550162554, 14.3829472362995, 41.6792382951826, 39.1247006133199, -38.8760752510279, -11.6304269526154, -13.3687050547451, -5.31534324400127, -2.51060193404555","-86.3554051145911, 29.0978434961289, -95.5027301795781, 63.6454623192549, -29.499419266358, 73.207819275558, 39.0617064666003, -92.9985575377941, -51.6290077473968, 12.2396486345679, 48.3567856252193, -28.516500396654, -21.0198899265379, 53.046905528754, 44.2176911514252, 0.109824910759926, -99.0703694988042, 74.6371628716588","k",FALSE,-0.0887556361629261 +"pcor.mat",5,"24.8151850420982, -55.3720602765679, -48.1912312563509, 25.3140340093523, 7.37709770910442","27.1002457011491, 51.559735648334, 15.2347642462701, -19.9469642713666, -71.4244599919766","20.2690705657005, 10.2111615706235, 28.9990232791752, -81.5356591250747, 62.7182307653129","p",TRUE,-0.595476592392643 +"pcor.mat",10,"-80.8792762923986, -16.7048441711813, -27.4036565795541, 83.73913182877, -29.9381176009774, 53.5984759684652, -74.8886847868562, -35.0239771883935, -89.2459953203797, 42.7505305968225","55.4137516766787, -70.6881674006581, 32.317240908742, -69.2246387712657, -93.5175380203873, 42.5839690491557, 39.2618721351027, 19.604005292058, 29.0025069378316, 31.9192183203995","-57.4748635292053, -17.7012801170349, 86.0102667473257, -97.6800283882767, -33.8488628156483, -80.713168065995, 1.30178248509765, -82.9571642912924, 20.4808691516519, -23.3784267678857","p",TRUE,-0.247808971782581 +"pcor.mat",7,"-9.81413833796978, -95.0588807463646, -37.4823603779078, 96.0915867704898, 25.3856145311147, -90.2806713245809, 56.4173173159361","-17.8975068964064, -45.0020219665021, -53.689378220588, 13.3858302142471, -95.0690850615501, -45.9697632584721, 5.96692659892142","-74.4352919980884, -79.8946594353765, -36.3220115657896, 71.3168484624475, -32.7676126733422, 74.5314478874207, 47.3017191980034","p",TRUE,0.380658349962746 +"pcor.mat",7,"-12.2942595742643, -46.0883136838675, -21.6881454922259, -19.7250084485859, 54.6898206695914, -67.8715384099633, -98.035113979131","-31.2075863592327, -53.7305776961148, -96.1716986726969, 34.0433329343796, -86.3202335778624, -98.4303006436676, -81.2778456136584","-78.2337430864573, -33.7292415089905, 14.364256337285, 80.8441326953471, 14.6734802983701, -38.598564080894, -16.4908449631184","k",FALSE,0.233736747502114 +"pcor.mat",12,"65.5728437006474, -22.3883016966283, -16.1309017334133, -86.9484126102179, 55.0275014247745, 75.5027377512306, 56.8217232357711, -10.157274780795, -8.05552089586854, -95.0297535397112, 86.99438595213, 56.2756833154708","-50.9940889663994, 31.0440130997449, 55.3901108913124, 0.67323399707675, -93.814965011552, 43.19629650563, 82.1691108867526, 29.7341026831418, 23.4111852012575, -23.9989855792373, -41.8117068242282, -21.0978685878217","-94.9003085959703, 76.4557474758476, 71.228800015524, 1.28989322111011, 56.7563532851636, -74.5477284770459, -40.1864093728364, -62.3711896594614, -63.5766193736345, -34.8390635102987, -34.4627866521478, -60.8579785563052","k",TRUE,-0.0642824346533225 +"pcor.mat",16,"10.3261223994195, -66.3412994239479, -10.04778011702, 90.8491815906018, -16.8091387022287, -1.13998735323548, 8.87222946621478, 62.9582400433719, 51.0545901022851, -42.0804372988641, -72.740743868053, -98.6990892793983, 25.1725806389004, 30.7280816137791, 3.96932810544968, -57.8030949924141","60.728229675442, -74.0803788881749, -73.4922635369003, 21.5669278986752, -2.4874959141016, -42.8831906523556, -8.72258436866105, 41.053393855691, -49.3829999119043, -25.329764559865, -33.0748493783176, 64.0028734691441, -75.2295605372638, -3.0173609033227, -40.6044688075781, -90.4325042851269","-26.9309993833303, -77.9300230089575, -34.1201750095934, 18.6427622102201, -11.5215779747814, 43.2106466032565, 52.0845813211054, -27.0871427375823, 78.9493581280112, -60.0895206909627, 75.2652967814356, -64.8424350190908, 74.5653890538961, 79.290065029636, -83.871082868427, -55.8636627625674","p",TRUE,0.232814351928154 +"pcor.mat",18,"-94.2430725321174, -51.8685480579734, 21.5350433252752, 4.50745574198663, 44.5271090604365, 75.3100082743913, 36.3767127040774, 58.3390053827316, -33.6587901227176, 53.1314761377871, -90.0304151698947, 1.84677322395146, -43.2471524458379, 20.721254684031, -35.7563958037645, 44.6534116752446, 78.0897385440767, 62.626903411001","-86.8268391583115, -67.7875887136906, -20.8753589075059, -28.825512342155, 41.2515165284276, 6.46749134175479, -87.1187134645879, -87.9431148990989, -47.1682616043836, 7.15450858697295, -31.9803619757295, -45.8144799340516, 47.6873302366585, 94.4961855188012, 70.8510945085436, -10.3092920035124, 68.0197277572006, -86.2225097604096","42.146764555946, 35.4582188185304, -74.8004557099193, -69.1695068031549, 9.96355945244431, -1.00409551523626, -56.0459699481726, 57.2666853666306, -75.3820521291345, 61.0693466849625, -80.6058402173221, -28.1722619198263, 29.1725110728294, -84.9811018910259, 52.4267561268061, 3.33783319219947, 57.3508915491402, -16.6291590314358","k",TRUE,0.126881965715119 +"pcor.mat",11,"58.4281201008707, 18.3633047156036, -74.4007679168135, -70.9485304541886, -62.3421670403332, -75.4027212038636, -42.2465549781919, 45.5137318000197, -59.8607284482569, 62.6728146802634, 78.3472507726401","78.8005036301911, -11.6723335813731, 47.760496661067, 72.8375401347876, 44.0390994306654, 49.5243767276406, -49.906044267118, -93.3100801426917, 74.181916937232, 8.72853924520314, 83.0030017532408","-7.40372859872878, 19.830649998039, 32.0547481998801, -24.0255577024072, 15.4005860444158, 13.1488932296634, 8.03853832185268, -78.5669906530529, 80.1699983887374, -99.4674043729901, 40.1027225889266","p",TRUE,0.0557153883247975 +"pcor.mat",8,"-3.19936256855726, 41.1430836189538, -40.9489492420107, 32.8621160238981, -55.2679274696857, -85.6475236825645, -98.9018370397389, 37.6923420932144","-23.4679078217596, -70.4765893053263, -29.5889834873378, 73.5305113717914, 66.7411952745169, 8.31683478318155, 14.5889795385301, 72.6518555544317","78.9658954367042, -43.0149876978248, -8.42135692946613, 0.82630286924541, -0.558331841602921, -30.3489441052079, -19.2593446467072, 59.6474095713347","s",TRUE,-0.211100165460375 +"pcor.mat",12,"-46.8561482150108, 87.6810635440052, -57.6411653775722, -46.4993360452354, -35.9383462462574, -96.4581338688731, 72.101165773347, -92.8533762693405, -24.3875949177891, 81.7434745375067, 95.8580058533698, -39.7297702729702","-14.3783972598612, -62.9489183891565, -88.967556739226, 5.93087510205805, -20.3817227389663, -28.1361578963697, 98.5170270781964, -62.3654518276453, -21.2714700959623, -75.4275092389435, -45.0435093604028, -52.5260332040489","84.6728871576488, 77.3271079175174, -35.2307356428355, -63.2898768875748, -62.9697222262621, 57.5104051735252, -65.9628365654498, -77.7099144645035, -68.1009365711361, 21.6217519715428, 40.7055628951639, -11.8265327066183","p",FALSE,0.240265915193204 +"pcor.mat",14,"-65.2285707648844, 21.9669322483242, 73.5851485282183, 28.0581893399358, 34.4764126464725, -12.0250980835408, 44.0008006524295, 16.8571741785854, -32.5285179540515, 40.1795001234859, 14.344258280471, 42.7343318238854, 33.5459096822888, 17.8732588887215","-17.1958317514509, -31.969396257773, 26.989441877231, 52.442137664184, 42.9547981824726, 32.2006456553936, 80.7050887029618, 7.4744014069438, -56.099244300276, 47.6363920606673, -16.8571050744504, -45.9946841932833, -51.3697457965463, -93.8083261717111","-83.2655881065875, -35.3444519918412, 20.8411808125675, -89.538209233433, -85.8607416506857, -4.87791770137846, 16.466785594821, 71.7880600132048, -90.7291606999934, -47.3672876600176, 28.5109816584736, -6.68758857063949, -37.6607090700418, 78.6420990247279","k",FALSE,0.293285288009136 +"pcor.mat",6,"-46.0385966580361, -99.5740628801286, -29.4129090383649, 97.0183642581105, -37.6902215648443, 80.4221050348133","-88.8656401075423, -39.0352664981037, 37.8500768449157, -3.4251865465194, 16.7551717720926, -64.4463129807264","-85.469913110137, 82.1475684642792, -79.0366449858993, -17.5424363464117, -55.2734784781933, 8.78398092463613","k",FALSE,0.218217890235992 +"pcor.mat",19,"94.6966245770454, 80.9601898305118, -27.9354885220528, 32.8651154879481, -83.5247790906578, 68.0820679292083, 98.2801185455173, -51.8296324182302, 22.2090682946146, -57.0902567822486, -79.9241363536566, 82.232602359727, -31.2431594356894, 47.0965832006186, 45.9447079803795, 83.7373214308172, 43.1115242652595, -15.8762097824365, 24.6083721984178","-30.2270193584263, -18.9653075765818, 32.3881921358407, 62.3213729821146, 48.8383719697595, -64.4200759939849, -34.4498374499381, 74.7035726904869, -80.0148021429777, -72.3529085982591, 97.3054904025048, 81.4842638093978, -75.7931782398373, -36.0045140143484, 52.190304454416, -46.3511400856078, -27.5253375060856, -49.8220588080585, -94.6963192429394","-1.14815644919872, 38.8675629161298, -7.72479912266135, 80.9100962709635, 7.58379022590816, 83.3296971861273, 51.7409536056221, -33.8198636192828, -63.4376135654747, 80.6679456029087, -83.3767011761665, -82.7897766139358, -25.5388389341533, -99.9377169646323, -91.8954541441053, -75.1720157451928, 85.5636859312654, -35.8674420975149, -14.8491851519793","k",TRUE,-0.0612260637897383 +"pcor.mat",11,"43.6715835239738, 83.24592593126, 80.5671546142548, 50.718885473907, 91.4832427166402, -72.9882646352053, 1.08670038171113, 65.7646540552378, 32.857545139268, 98.8540512509644, 57.310037733987","-68.5883652418852, 57.6829582452774, 20.3366491477937, -20.9295519161969, -91.220309631899, 67.5120797473937, -84.0667628217489, -92.758432822302, 73.1769519392401, 31.0191483236849, -59.8639046307653","60.0395560264587, 49.4410765822977, -15.0798926129937, 76.642445102334, 43.1489706039429, -64.028698252514, -73.5862046014518, -11.8118531536311, -14.194271247834, 19.1962173674256, -62.6884501427412","p",TRUE,-0.239620090137985 +"pcor.mat",5,"84.436381328851, 72.004076000303, -40.9433365799487, -11.7642278783023, 36.9735128246248","92.926798760891, -99.3128840345889, -34.4348025508225, -47.6723862346262, 94.1138706635684","2.33245906420052, 59.2558087781072, -17.9977843537927, -79.5293167699128, -57.2229819372296","k",FALSE,0.0890870806374748 +"pcor.mat",13,"-52.8125622309744, 3.65753290243447, -17.9872157517821, 0.687318574637175, 48.9896171726286, -10.9520922414958, -42.2161420341581, -8.33622729405761, -52.7692852541804, 46.2861472740769, -63.7141830287874, 77.9755924828351, 69.3693526089191","-81.1979313846678, -81.2067239545286, 98.1338402722031, 81.5591927152127, 37.056217668578, -30.573401786387, 86.0113869421184, 22.4740816745907, 15.2922587003559, 4.40599746070802, 81.2510290648788, -91.3585484493524, -51.8274602945894","1.68427461758256, 35.6400829739869, 1.32666421122849, 28.9358278736472, 69.9353440199047, 22.5035205483437, 42.7461497485638, -60.8904164750129, 41.2500537466258, 72.3914569243789, -35.3465625550598, 11.877816170454, 41.2654601968825","s",TRUE,-0.432235260027861 +"pcor.mat",6,"36.2520147580653, -45.3618559986353, -3.36455763317645, 27.1406658459455, -32.130736252293, 89.6533737424761","91.0997018683702, -58.0772765446454, -45.8715479355305, -76.4125521760434, -51.5536211896688, -28.4703179262578","-59.4199031591415, 60.7980337925255, 86.4012580364943, 43.8618046697229, 27.8941972646862, -83.8361509144306","s",FALSE,0.361111111111111 +"pcor.mat",15,"-15.8772577065974, 12.7610163297504, -22.9708819650114, -71.8580039218068, -75.8046543691307, 47.7548703551292, -24.9429981224239, -31.5219290088862, -80.9420365840197, -0.135115487501025, 43.7512583099306, 82.602039212361, 32.6054238714278, 52.4210862349719, -25.4571683704853","2.32095182873309, 57.4718285817653, 91.6442870628089, -0.498835230246186, 42.3996091354638, 98.4292598906904, -69.7168925777078, 17.9197568446398, -60.0217215251178, -94.6461838204414, -56.8148406222463, -86.9362941477448, 23.4191815834492, -67.045795917511, -25.982434488833","88.8973289635032, 31.7113435361534, 1.63480490446091, 90.244840271771, 90.7815016340464, 3.64356338977814, -70.6344856880605, 20.8035066723824, 71.0505054797977, -41.0872615408152, 81.8894566036761, 27.3655611090362, -57.8210411127657, 80.1123460754752, 37.0346592739224","s",TRUE,-0.100259767542805 +"pcor.mat",17,"-8.47610384225845, -76.0521722026169, 36.9659481570125, 27.2644958924502, -63.1253079976887, -45.7246268168092, -91.299555497244, 79.9444675445557, 62.6849308609962, 77.2913023363799, -39.3468747846782, -31.9794123992324, -90.5704878270626, 3.36136179976165, 6.36215764097869, 34.7822861280292, -86.7615907918662","38.8797430787235, 87.957543740049, 27.9284121934325, -2.19381097704172, -93.5423448681831, -85.8565270435065, -1.78483547642827, 32.4997876770794, -84.6204502973706, 73.0989838484675, 46.5271977707744, 19.7806170675904, 2.54705562256277, -62.6201322302222, 47.8446535300463, 94.2804395221174, 43.5015312861651","-42.1679470688105, 44.9353978503495, 4.3509088922292, -26.6828402876854, 45.7676482386887, 34.6878333482891, 86.2517770845443, 54.4100513216108, 62.1482897084206, 93.2931664399803, 48.1029566843063, -49.8642263934016, -79.5734560117126, 82.6493532862514, -56.327466852963, 30.9423569124192, -75.3295318223536","k",FALSE,0.173343955251749 +"pcor.mat",15,"-12.115827947855, -23.5690898727626, 89.8483640048653, -76.0832019150257, 54.2692786082625, -31.3360400963575, -87.8199052065611, 62.5256759114563, -85.054659191519, 17.1253859531134, 86.8644420057535, -63.6440661270171, -2.54382686689496, -52.1825547330081, -86.5487120579928","87.855874421075, 11.8729826528579, 58.581341477111, -76.1566527653486, -54.7422365285456, -76.9119961187243, -51.5453061554581, -8.55491124093533, 41.1004772875458, 4.76148361340165, 27.0399220753461, -93.3408699929714, 43.2594683486968, 97.5612652488053, -27.2557357791811","-25.7235449738801, 98.6250419635326, -33.5626783315092, -76.8353697378188, 5.53134111687541, 11.2494019791484, 53.6648289300501, 58.8696902617812, 74.8723800759763, -83.5754144005477, -2.30161873623729, -0.636160280555487, -32.3559941258281, 9.53439651057124, -96.3161264080554","k",TRUE,0.203279781135864 +"pcor.mat",10,"-88.6766928713769, -99.7512009460479, 36.3819673191756, -78.1028961297125, 26.9118153490126, 8.51810127496719, 25.9507332928479, -2.06361203454435, 61.8650326039642, 53.7325612269342","44.7955575305969, -23.4671366401017, 67.7940716035664, -61.1387377139181, -77.4398116860539, -9.6572854090482, 29.9326512031257, -50.3714796155691, -29.1814834810793, 77.4120518472046","53.5698696039617, -33.2331659272313, 29.2508830782026, 30.7888105046004, -75.6014665588737, -21.6426336206496, 49.8834919184446, -31.1990667134523, -49.9284417368472, 52.3363713175058","s",TRUE,0.461061427308285 +"pcor.mat",16,"-83.9224993251264, -98.9909253083169, 41.2098858971149, 40.319947944954, -22.3131684586406, -4.72695007920265, 71.1222126148641, -73.4416379127651, 19.5892326999456, 51.5542230568826, -59.8082218784839, 83.2985554821789, -73.8052498083562, 81.1506273690611, -62.3849936295301, -65.9225380979478","-22.3732136655599, -76.6401294153184, -14.9951294530183, 17.2481925226748, 36.7321326863021, 30.8906201738864, -36.0778030008078, 27.3618204053491, -25.5863894242793, -77.5616424623877, 71.2329083122313, 92.7250783890486, 18.0521029513329, 20.1161385513842, -37.0644447859377, 74.0854462143034","63.1498238537461, 67.5584438722581, -2.90364040993154, 86.5714854560792, 80.625259783119, -83.5466306190938, -89.0106877777725, -11.5085924509913, 95.1227321755141, 26.8994387704879, -36.1149361357093, 13.4227952454239, -22.9821641929448, -81.5770137123764, 99.1007934324443, -24.637895449996","k",TRUE,0.00117273434060522 +"pcor.mat",12,"-30.6264939717948, -51.3202500529587, -91.8923989403993, 71.2572688702494, -50.3101641312242, -43.5825682710856, 68.9194604754448, -62.2129834722728, 74.4652757886797, 10.5425884481519, 39.5969454664737, 43.8930058851838","-3.49326506257057, -40.981019847095, -1.93292065523565, -55.6563400197774, 30.0884651020169, 5.1898842677474, -57.6860777102411, 92.7335068583488, 4.2677782010287, -73.3723870944232, 37.4122668523341, 97.195135615766","0.661881873384118, -77.0722641143948, 80.916742188856, 84.3042341526598, 60.0523283239454, -15.8854037057608, -41.8266508728266, 90.2447595726699, 78.685249062255, -98.4303796198219, 53.0869376845658, 97.2957746591419","s",TRUE,-0.309246046562802 +"pcor.mat",8,"43.6172465793788, -28.597435541451, 49.3047020863742, 23.4949984122068, 55.2344744559377, 50.4013098310679, -61.0196806956083, -13.4925350546837","-28.0354068614542, -58.4258052520454, 91.4929724764079, 5.28197917155921, 6.99444795027375, -37.798970984295, 14.2839945387095, 93.0717419367284","65.1908750180155, -76.971767982468, 78.4851297736168, -27.8413584455848, -14.1628153156489, -37.5672557391226, -58.8539640419185, 51.5223218593746","p",FALSE,-0.457862137278786 +"pcor.mat",5,"7.32707628048956, -97.153510292992, -58.0732712056488, 5.43075683526695, -50.3950014710426","-60.6064203195274, 70.2952838502824, 7.70989404991269, -90.4186028987169, -91.9082495383918","-27.0302977412939, -71.8158513773233, 60.5169426649809, -51.2578745372593, -71.4558880776167","p",FALSE,-0.811742988157054 +"pcor.mat",12,"-31.9100445136428, -15.4961660970002, 15.1833237614483, -96.8389748129994, 34.0211338829249, -26.4210654422641, -74.7212948743254, -73.451091023162, -48.6799724400043, 43.3380767703056, 33.7157489266247, -12.9206308629364","-25.7156142964959, -31.4395876601338, 27.1043297369033, -64.4430394284427, 69.3326181732118, 11.0314972698689, -56.0946275945753, -5.32854660414159, 61.7247725371271, -58.0520442686975, -98.0296685360372, -83.8190475013107","65.2698641642928, 23.0271658394486, -30.5951663292944, 87.3122846707702, -96.8001709319651, 80.7323037646711, 92.8447821643203, -96.3675274513662, -33.6922558955848, 59.8475752864033, -96.7984095681459, 82.4916113168001","k",TRUE,-0.0909090909090909 +"pcor.mat",12,"90.1167266536504, -66.6625558398664, 39.782078191638, -58.8765672873706, -59.9938517436385, -76.4870832674205, -10.5842749588192, -75.7783581502736, 1.28461210988462, -34.5959145110101, 50.9478696621954, -96.5802219230682","38.6262435931712, -94.669465906918, 56.7374847829342, 36.0493461135775, -54.2134216055274, -63.6453815735877, 81.5788346808404, -68.2411943562329, -22.1247639041394, 92.5449587870389, 35.5207106098533, 94.1242534667253","86.8828876875341, -60.6638357974589, -8.42275521717966, -64.6387516520917, -62.6291708089411, 40.5554509721696, 6.27670022659004, 24.3925095535815, 30.6437145452946, 9.16047729551792, -63.2885267492384, -17.5928950775415","s",TRUE,0.261481371449354 +"pcor.mat",18,"80.5951167363673, 90.9240923356265, 70.6974952481687, 68.0134673137218, -44.9470512103289, 25.955663016066, 30.7497585657984, -91.8298844713718, -4.40605725161731, 49.3009329773486, -78.929325286299, -78.4197290893644, 44.3274276796728, -61.9072982110083, 16.9208872597665, 88.0656720604748, -0.423743482679129, -22.9118093848228","31.6178977955133, 6.30270089022815, 87.8026704769582, -79.791863868013, -2.2237554192543, -26.5245907008648, 91.646106634289, -67.9212915245444, 32.4714999180287, 76.9008807372302, 92.0271085575223, 37.951097311452, 55.0852465443313, 81.3659423030913, -61.8186100851744, -34.2142827343196, 3.76891982741654, 9.98605671338737","94.6255694609135, -84.6232280135155, -26.6939069610089, -79.9416828900576, 61.19120195508, 4.79885442182422, -36.1860592849553, 71.0645910352468, -88.2137383334339, -8.42098467983305, 58.1183904316276, -15.7302843872458, -4.05891095288098, 85.9798874240369, 94.7344854008406, 7.95916928909719, 78.0328324530274, -99.0391628816724","k",FALSE,-0.107524911773377 +"pcor.mat",7,"-38.9586756005883, -57.8867371194065, -68.1198546662927, -89.4594067241997, 70.7473307847977, -35.7670163270086, 52.0461404696107","21.6805159114301, -28.8543162867427, -22.0741868950427, -84.8189734853804, -35.3580724913627, 19.6727192029357, 21.0121315903962","66.0285493824631, -4.54495996236801, 64.9962153751403, 74.2479239590466, 59.3966994900256, -13.1802632007748, 10.3553391993046","s",TRUE,0.253320198552449 +"pcor.mat",9,"-6.78211716003716, -79.588529560715, -65.7252383418381, 45.60412671417, 98.0520688928664, -76.6070755198598, -40.7307191286236, -14.1458517406136, -83.4068476222456","-41.9686838053167, 40.0618359446526, -71.2534620892256, -78.1008904334158, 13.2995546329767, 44.5248483214527, -82.3847197927535, -89.4571373704821, -79.4600131455809","-85.7230886816978, -13.998108310625, 66.9168075546622, 29.5824715401977, -86.4490587729961, 90.6398146878928, 32.4118531774729, 27.7746527921408, 80.8882680721581","p",FALSE,-0.28294999490249 +"pcor.mat",13,"-87.399728782475, 40.3655833564699, -3.77177731133997, -0.913261342793703, 84.5598533283919, -57.672530086711, 70.6847531720996, 17.5953175872564, -43.7333907932043, -24.1470513865352, 71.5449669864029, -51.1317191179842, 20.0356021057814","-39.3181677907705, 76.6436085104942, 45.0167378876358, -12.2507677879184, -11.5627334453166, -64.4468226004392, 81.8960891570896, -71.4755731634796, -82.4792180676013, -31.5537444315851, 22.1059046685696, -33.5309320129454, 48.856098158285","-25.2732687629759, -77.4636949412525, -31.5821984782815, -97.6564433425665, -5.07994783110917, -54.0312268771231, -50.5725503899157, 4.37337355688214, -9.34875644743443, 70.4601784236729, 40.7617360819131, 92.1488650143147, -10.1492855232209","k",FALSE,0.494775334448826 +"pcor.mat",5,"-95.295644691214, 85.2518345229328, 70.6566654611379, -15.488860104233, -39.7784407250583","54.2502315249294, 28.1581053044647, -68.6268703080714, -3.80988898687065, 53.7825032602996","-3.1055589672178, 6.64212079718709, 43.7012503389269, 17.2084089368582, -85.3145365137607","s",TRUE,-0.458831467741123 +"pcor.mat",16,"97.809230722487, -14.316190360114, -84.721079049632, -18.7376644462347, -25.5602215882391, 17.7533380687237, 39.1872539184988, -94.0707533620298, 2.72555686533451, 22.7984459139407, 59.4628068618476, -40.8906124997884, -92.1079889405519, 29.8243676312268, -12.0696670375764, -89.7928544320166","26.7640289384872, -96.4622846804559, -40.3722857590765, -80.3130167070776, -68.9347126986831, 98.9100785925984, 31.9554898422211, 64.5670853089541, -50.01574116759, -97.6768167689443, -87.454877840355, -74.6697645168751, -17.0667306985706, -20.0176582206041, 61.2935196608305, -60.0398785434663","42.3937499523163, 46.829612692818, -93.9524796325713, -63.3410033304244, 87.3350779991597, 9.56030515953898, -6.86939819715917, 6.62593231536448, 30.0475670956075, -67.5459566526115, 12.8623825497925, 19.4047554861754, 17.8637056145817, -45.1789702754468, -44.4462891668081, -58.5556023288518","k",FALSE,-0.0864597208956419 +"pcor.mat",13,"77.1156166680157, -4.95218234136701, -0.478975335136056, -88.6164400726557, 79.5374071225524, 64.5803040824831, -2.80681941658258, -79.7279377933592, 99.2951272986829, -97.9579760227352, 30.6757009122521, 1.96241005323827, -16.967974929139","-96.855311980471, -56.1395757365972, -2.78360079973936, -33.6360565852374, -44.3065817002207, -95.199401024729, -27.0363926421851, 75.0894209835678, 4.99337976798415, -7.82306902110577, -81.4332918729633, -56.5008042845875, 19.696054328233","16.2967632059008, -25.3815619740635, 94.3077141884714, 47.4075115751475, 96.9511947128922, -23.1907044071704, 38.797459891066, -97.7688763756305, -28.7548608146608, -83.8516177609563, -7.49311237595975, -26.1195019353181, 48.4767589252442","p",FALSE,-0.477487484222149 +"pcor.mat",9,"-39.2630732618272, -89.935081731528, -46.2339258752763, -89.5339810289443, -4.36198632232845, -14.5440776832402, -95.7827549427748, 93.4488965664059, 81.2002772465348","99.4978452567011, -30.0176431890577, -63.0747328046709, -54.7369061969221, 39.9523709435016, -27.1971534471959, -94.4386278744787, -78.7398369051516, 18.4704976622015","-42.4461417831481, 81.5393285825849, -52.1045574918389, -19.8012057226151, -87.6727635972202, -26.1554778087884, 5.14846704900265, 16.3954760879278, 75.12436225079","k",FALSE,0.20385887657505 +"pcor.mat",15,"60.3103106841445, 71.4415548369288, -98.9705654792488, 7.11592291481793, 10.6087463442236, 42.708487669006, 82.4820324312896, 38.3419292513281, 85.0099918898195, -0.90777650475502, -92.9779385682195, 3.21783553808928, 97.79725340195, -15.0709590874612, -88.6436254251748","59.2901791445911, -3.65023575723171, -0.826246337965131, -92.2944152727723, 4.78945928625762, -35.9777873847634, -4.00528195314109, 14.427507808432, -36.5650984458625, -30.6801207829267, -33.1895301584154, -72.0329152885824, 88.569199340418, -63.0710757337511, 81.6133069805801","-4.55778324976563, 49.8842949513346, -24.1089406423271, 15.2178956661373, 93.4157602954656, -14.0120008029044, 74.634336354211, -76.262500602752, -0.484065152704716, -24.2140971589833, 55.4016582202166, 59.3731869477779, 79.561612335965, -26.1603471823037, -32.2228459641337","p",TRUE,0.111079544613507 +"pcor.mat",12,"-47.1727962139994, -62.7806689590216, 14.7163263522089, 98.5433207359165, -2.45944913476706, -48.7231005448848, 15.0826691649854, -78.9477611426264, -66.5948192588985, 8.53210580535233, 33.7848087307066, -11.1786916386336","-53.4802015405148, -67.8791525308043, 16.3833658210933, 8.16084523685277, -68.3082328177989, 52.1591320168227, -94.9673681054264, -51.7830446828157, 48.8592490553856, 80.6429937947541, 18.254310823977, 21.4851890690625","59.5537723042071, 28.640017285943, -53.3816957380623, 52.5868681725115, 61.431689793244, 38.7933161575347, 63.6210044380277, 74.1345513146371, -31.347640696913, -11.0894621815532, -53.0158845707774, 53.0884329695255","k",FALSE,-0.138443731048635 +"pcor.mat",6,"16.9672078453004, 39.5416527055204, -65.5000091996044, -90.130511764437, 63.6201905552298, -18.7544235493988","-81.3643315806985, 87.5242207664996, -87.3709872830659, -94.47445650585, 80.7427565567195, 97.7012349292636","21.0985390935093, -19.1841311287135, 61.7898017633706, -90.6381107866764, 61.5531626157463, 50.346623826772","s",FALSE,0.58925565098879 +"pcor.mat",7,"-56.6911320667714, 14.7237893659621, 72.7042480837554, 67.854171898216, 54.2756285984069, 87.7428719308227, -62.4983601737767","56.7447266541421, -63.2602260448039, 95.9155341144651, 79.549733037129, -31.7429569549859, -96.1661211680621, 89.6558737382293","17.7951748482883, 52.8001375962049, -17.0254016760737, -0.180792575702071, -69.1782949492335, 5.72048868052661, -73.80879400298","p",TRUE,-0.344955719900739 +"pcor.mat",14,"8.34259777329862, -90.7544204033911, 53.8198739290237, -73.6186733935028, 65.3159111272544, -54.8385083675385, -56.6149288788438, 93.1464713532478, -49.6990147978067, -62.7166502177715, 26.090932963416, 59.4254573341459, -78.5409053321928, 13.1633264012635","71.73405229114, 47.2987382672727, -66.5379968006164, 80.1759538240731, -32.3648356366903, 10.4439327027649, -84.9242614582181, 98.0132193304598, 31.8165130913258, -75.4577403888106, 27.8047663159668, -52.8659251984209, -61.3233786541969, -31.609858199954","92.3250074964017, 41.1538690794259, -70.4804343637079, -33.9494093786925, 67.3102808184922, 30.5022850167006, 14.392489567399, -66.8610816355795, -21.4584674686193, -87.7356766723096, 86.1648599617183, 34.3186971265823, -45.2394630759954, -97.3335643764585","p",TRUE,0.0376321132257061 +"pcor.mat",19,"17.2792347613722, 44.7029660455883, 7.22097363322973, -65.7868965063244, -75.2946712076664, -75.9451765101403, -65.4915338382125, -42.1579808928072, 0.180424936115742, 60.9645693097264, -79.4751405715942, -88.1112538278103, -3.82754770107567, 11.970756854862, -89.807746373117, -75.4269581288099, -83.210919983685, -49.4484897702932, -79.4092588126659","98.0341942049563, -77.4498141836375, 28.0400432180613, -31.759634707123, -8.49162279628217, -77.7130985166878, -44.0454395022243, -40.247108368203, 44.3426605779678, 48.202803870663, 13.207955705002, 27.6490168180317, -3.62952486611903, -15.9190153237432, -34.1904443688691, -1.11497580073774, 10.264601605013, 39.9211245123297, 27.739332895726","88.2835000287741, 33.0788629129529, 66.6329775005579, -58.9400433935225, -67.8360211662948, -23.8581227138638, -64.4136915449053, -71.0973926819861, -6.4570713788271, 5.39726838469505, -64.308940153569, -80.775932315737, 17.806462245062, 64.6042937878519, 25.6625287234783, -53.9103304501623, 10.1242880802602, 31.6518820822239, 71.827148180455","p",TRUE,0.0548011187422948 +"pcor.mat",15,"-48.3876196667552, -26.4751517679542, 86.0122847370803, -2.21008872613311, 88.2522213738412, 36.0168526880443, 53.617551876232, 46.2094876449555, -55.7492116466165, -48.1529265176505, -27.9851477127522, 62.0271205436438, 6.54048435389996, 65.1294771116227, -97.3066220059991","88.3713206741959, 70.3678138088435, -17.6713398192078, 92.8743582218885, 67.6384199876338, -56.5470991190523, 28.6562576889992, -89.9442651774734, 14.1420055180788, -39.6874803584069, -68.7506389338523, -46.1653867270797, 54.8760372679681, 31.6477505024523, -74.1190653759986","-50.7720490451902, 13.1769198458642, 60.0184863433242, 69.6465944871306, -4.16778987273574, 42.1332813799381, 44.0076574683189, 47.2968339920044, 47.09054636769, -90.304255951196, 90.9836431499571, 61.1754382494837, -95.954512199387, 65.8738845027983, 18.4467539191246","p",FALSE,0.155278581425428 +"pcor.mat",12,"66.9760071672499, -10.0718723144382, 98.4006015583873, 49.9737814068794, 93.0611060000956, -30.8278535492718, -49.5318784378469, -74.5468678884208, 53.2779390923679, 45.9250777494162, 7.21664810553193, 98.5868971794844","86.4792299922556, 66.300771990791, -30.303956894204, 99.7657214757055, 21.8715326860547, -0.453599169850349, -49.4858743157238, 95.0286555103958, -75.6651264615357, 61.6245118435472, 50.6951719522476, 73.4736283775419","-76.645670318976, -46.4482659008354, 14.1620874870569, -42.584248399362, -53.2975015696138, 54.3731088284403, 94.7233782615513, 5.24166952818632, 33.9543189387769, -39.5664878189564, -64.9096461012959, 64.3044523429126","k",TRUE,-0.029027606770737 +"pcor.mat",5,"90.8192429691553, 48.4106589574367, -21.8404297251254, 41.0448144190013, -83.0681975465268","-59.1780140064657, -51.5384333673865, -47.804808197543, 12.2319002635777, 15.4189415741712","87.9196766763926, 56.3696804456413, 10.8711638953537, -25.8778809569776, -61.6596679203212","p",FALSE,0.828266806248407 +"pcor.mat",15,"-84.2769027221948, -99.7776164673269, 53.0052073765546, -56.7098737228662, -87.9683969076723, -51.0782906785607, -35.9742659609765, 17.2527201939374, 58.1052905414253, 79.0114177856594, -98.0878078378737, 49.7950758785009, -84.3974281102419, -79.6418719459325, 82.9541291110218","91.2282381206751, 32.1592024061829, -55.6543642189354, -73.2480760663748, 2.29297978803515, 88.1192316766828, 70.9258356131613, 8.78023901022971, -54.8915889114141, -16.0259561147541, -62.4688476789743, 35.7657310552895, -85.5574174318463, -78.2423210795969, 57.0005943533033","68.9237471204251, 97.5910210981965, -70.7898926921189, 78.3896393608302, -26.9685154780746, 31.1476676724851, -7.25077791139483, 4.25968733616173, 71.4906623121351, 99.7103612869978, -70.5109211150557, -29.5995627064258, -89.8151689674705, -61.3775999750942, -23.73201623559","s",TRUE,0.131094606641465 +"pcor.mat",12,"-4.51542986556888, 65.3962709475309, 54.7027637250721, 21.8017288018018, -45.6481758039445, 56.3114468473941, -10.0910985376686, -33.9759476948529, 47.1306453458965, -81.5762444864959, -15.2306498959661, -55.8099669404328","78.4110291860998, 51.8248929642141, -74.8319068457931, -27.2911807522178, 99.4782904628664, 96.8407794833183, 88.3730117697269, 51.7726821359247, 34.6810360439122, 94.3698732182384, -27.2285795770586, 60.5969968717545","-56.935870507732, 35.1825864054263, 46.9766597729176, -0.979113671928644, -0.491952011361718, 2.96344561502337, -53.3740632236004, 63.3763818070292, 98.6882844939828, 32.3614825028926, -9.01708984747529, -89.2050859052688","k",FALSE,-0.238461538461539 +"pcor.mat",16,"-86.2841431982815, -18.3129501063377, 60.0204044952989, 49.4004330597818, 73.2034908607602, 36.0958587378263, -26.9164501689374, 99.3937272578478, 99.4885763153434, -15.9275187179446, -64.6454212721437, -25.9472228586674, 35.9230092726648, 25.0261219218373, 17.5404471345246, 1.84494755230844","96.1923027876765, -42.1271054539829, -8.16392744891346, -97.7614040952176, -10.3897859342396, 63.9586094766855, -50.9310736320913, 82.2031420189887, 72.7375000715256, -22.3871399648488, 57.6591491699219, 90.738725150004, -46.6567573137581, 94.6342563722283, -29.7158366069198, -79.2119293473661","-22.4795233458281, -96.3848259765655, 21.2546060327441, 68.0201687850058, -97.928561642766, -67.2587384004146, 44.8108606506139, 82.0129224099219, 24.2342098616064, -86.4289211574942, -79.5525341294706, 19.2005013581365, -51.4744527172297, -63.8537698891014, 17.4904732964933, -32.1932288818061","p",FALSE,-0.0517037216543802 +"pcor.mat",9,"-12.2494653332978, 81.3471322413534, 15.8859042916447, -40.0486988015473, 52.4177443701774, 19.3593227304518, -47.6214892696589, 98.4649391379207, 73.2301543932408","89.4672878552228, -82.9613993875682, -66.7588278185576, 78.6925439257175, -4.60034948773682, -52.7979515027255, 2.19829431734979, 72.0490128267556, 86.0512541607022","33.8618124369532, 90.739763667807, -55.6767753791064, 39.5474712364376, 83.0445552710444, 34.4050417654216, -59.1911187861115, -8.19138023070991, 99.0859573241323","p",FALSE,-0.198035626518398 +"pcor.mat",10,"47.6879670284688, 16.5959696285427, -63.4765389375389, -27.5170926470309, -22.5022290833294, -43.0537707172334, 70.5259828362614, 59.2826380394399, -88.5750241577625, -1.89512646757066","-61.3072986714542, -26.0851273313165, -8.67939637973905, -27.971677435562, -40.7435014378279, 1.29813449457288, 2.31690336950123, 16.4261620491743, -52.7925265487283, -89.1311551444232","52.5048244278878, 4.67872102744877, -46.2626181542873, -45.9650584962219, -50.2988358028233, 87.9835510160774, 56.6933359019458, 96.3448523078114, 53.302510920912, 1.91744468174875","p",FALSE,0.0988233148075562 +"pcor.mat",9,"14.4472865387797, -47.3339173942804, 88.0170038435608, -31.5219953190535, 46.918716840446, 56.6940610762686, 6.99824644252658, 98.6299303360283, -5.93640897423029","22.6194951217622, -77.684145513922, 75.3283645957708, -40.9434220287949, -38.5339342523366, -91.2029369268566, -63.4814173448831, 10.7932053040713, -49.4684089906514","-33.6434269323945, 73.0934476479888, -23.9013602025807, -76.148905325681, 60.0582375656813, 70.3553961124271, 7.24662998691201, -66.3810072466731, -94.6542747784406","s",TRUE,0.541229427257326 +"pcor.mat",14,"62.3325610999018, 28.3598528243601, 45.8982207346708, -8.46395660191774, -63.4389164857566, 72.4040941335261, 0.539024919271469, 91.1112579517066, 16.1043775267899, 68.5833586845547, -90.9464060328901, -99.2442855145782, 17.0317857526243, -9.96274407953024","-4.58235912956297, 11.521205957979, -75.3375723026693, -5.17353126779199, -40.0790630374104, -70.08021697402, 53.5009195562452, -58.0623977351934, -9.79966381564736, -35.5031280312687, 68.6820048838854, -48.3796393033117, 10.2691211737692, 52.6988474652171","41.5283095557243, -6.18213326670229, -20.2820646576583, -43.5107395984232, 97.0502740703523, 60.2817252743989, 1.80356446653605, 48.0388806201518, 13.3720958605409, -19.7484199889004, 65.0038605555892, 86.6087830625474, 84.9961121100932, -55.2010769490153","p",FALSE,-0.496536277317825 +"pcor.mat",11,"-86.8348072748631, -68.1555027607828, 93.7882163096219, -17.574486322701, -3.01832188852131, 82.4596357531846, -70.7045842893422, -41.0055582877249, 85.1761696860194, -76.0164870880544, 9.26548577845097","78.6481990013272, 33.5281310137361, -46.5702877379954, 13.5015867650509, 11.9400870520622, 28.7497514858842, -32.9607792664319, -34.5967058558017, 46.3658351451159, 53.1044125556946, 88.4551724884659","8.02730321884155, -14.3242678139359, 10.4656010866165, 44.1013956442475, 41.8432073201984, 16.2981065455824, -42.1405011322349, -81.4176644664258, 41.9636760372669, -95.8132732659578, -96.6605862602592","s",FALSE,-0.187531875709659 +"pcor.mat",15,"-8.95890998654068, 87.6476715318859, -82.3296630755067, 54.1639633011073, -56.9908442441374, 32.6043246779591, -85.6081826612353, 77.9518540017307, 26.4017198700458, -99.6459340676665, -2.37713954411447, 57.1259008720517, 15.9859085921198, -21.3041906710714, -88.4612631518394","71.0004774853587, 33.6280925199389, -44.5519751403481, 61.0465653240681, 82.826607953757, -72.3422850482166, -27.0270694512874, -48.9543684292585, -13.1586199160665, -48.2837385963649, 71.7649020254612, 89.9132785387337, -46.7835825867951, -5.76893505640328, 68.2509062811732","-79.8319123219699, 4.72839176654816, -51.0409486014396, -58.6709169205278, 53.0833051074296, -70.3293783590198, 19.1716862842441, -67.5588438753039, 62.886883597821, -96.4109890162945, -34.4456045888364, 45.6756661646068, 47.4764776416123, 7.42012783885002, 38.5514346882701","s",TRUE,0.0110289747628682 +"pcor.mat",16,"31.4061987679452, -74.9066208954901, -64.9867978878319, -5.39299356751144, -53.42126484029, -47.4726263433695, 69.5169975049794, 31.62314100191, -22.9675776790828, -74.656882788986, -1.33912023156881, -98.8822244573385, -35.7455586083233, -33.464961964637, -3.55721861124039, -27.8399859089404","72.7164791896939, -83.5368575528264, 64.1068436671048, 3.18035068921745, 71.0855689365417, -68.9065222628415, 88.6347917374223, 84.7157137468457, -38.3024057373405, 8.57474114745855, -65.9063815139234, 43.8279079273343, -6.10163295641541, 61.0187361482531, 2.19916221685708, -9.51254032552242","56.0140502639115, 56.2448440585285, -48.0950287077576, -38.731576455757, -71.3526351843029, -26.7311075236648, 50.0080749392509, 39.7566744126379, -0.389600452035666, -6.86149629764259, -87.0373306330293, -5.545165669173, -14.8602196481079, -45.7474006805569, 10.8187668025494, 45.559770334512","k",TRUE,0.236643191323985 +"pcor.mat",6,"43.2217205408961, 95.0128023047, -37.1413607615978, -85.5048784054816, -17.2799117863178, 35.998792340979","8.15750281326473, 43.2605781126767, -44.8291454464197, -31.1379416380078, -44.7567201219499, -44.5435838773847","-28.5342446528375, 59.9700956605375, 71.0424310062081, -25.7011258974671, -79.6189298853278, 28.7746171001345","k",TRUE,0.607142857142857 +"pcor.mat",10,"63.2382842712104, -45.6831192597747, -55.7130093686283, -82.2273524012417, -10.8993649948388, -20.6117415335029, -72.7630480192602, -77.4749230127782, 53.6859362386167, 68.9426238182932","30.9459066949785, -80.7866416405886, -47.3474097438157, 49.9985641334206, -84.2809103894979, -56.8257133476436, -13.4179298300296, 60.9060937073082, 48.940838733688, -62.3239307198673","-73.7048507202417, -57.31729445979, 14.9673992302269, -14.3290285952389, -76.3574062846601, -60.4541322682053, -16.2746643647552, -28.6148637533188, 18.4534307103604, -83.0491851549596","s",TRUE,-0.193126854288765 +"pcor.mat",9,"-36.237419815734, -82.6313697267324, -45.2068409416825, 28.2838310115039, -8.59123645350337, 64.9153559468687, -53.2393038272858, 62.8279895056039, 1.16134048439562","-10.1885996758938, -91.6434466373175, -46.7915282119066, 25.4895669408143, -24.0784865338355, 58.5600736085325, -44.0702077001333, -98.0394726619124, 76.2519818730652","33.8238641154021, 7.84905035980046, 36.8167491164058, -17.6727590151131, 9.43915518000722, 5.15828183852136, 92.3964754212648, -85.2526424452662, -63.7069202959538","p",FALSE,0.398179069149688 +"pcor.mat",13,"78.1919818371534, 64.493830408901, 0.710873352363706, -40.3782351408154, 57.4935470242053, 38.2916694041342, -41.3470767438412, 76.0839499533176, 27.3725191596895, 28.8496494758874, 21.4308275841177, -26.0073396842927, 38.606214011088","16.4913782849908, 27.8782834298909, -80.1846226677299, -72.8203158825636, -16.3325851783156, 86.8600406683981, 93.3527871966362, 14.9770261719823, -45.6588900648057, -87.0777580421418, 13.9018434099853, -22.1736597828567, -12.0512451045215","-71.655789623037, 14.8334824945778, -16.8137946166098, -60.0538752041757, 17.0944395940751, 22.4857289344072, -77.132256841287, -55.0677491351962, 2.21382677555084, 69.3236303050071, 39.8013096302748, -39.7288813255727, -63.2540795020759","s",TRUE,0.336736697396128 +"pcor.mat",13,"91.7842994909734, 38.721524970606, 39.1705478075892, 18.6643098015338, -4.83868648298085, 96.8743856530637, -8.04941062815487, 88.7948990333825, -42.6608783658594, 74.295567907393, 20.754674077034, 20.6958107184619, 7.28423306718469","39.8056766949594, -61.7218984756619, -1.59168504178524, 4.02580439113081, 60.1681916043162, -89.8049416486174, -35.8231709338725, 78.1130255199969, -55.8174833655357, 51.9783590454608, -36.2147870473564, 35.5141086038202, -8.96845734678209","4.79736779816449, -56.6321770660579, -76.5336334705353, -22.4140492267907, 77.5082608219236, -61.9375938083977, -6.95173270069063, 19.7686547413468, -30.8583251200616, 47.0094705931842, -54.2295054998249, -98.6059594433755, 87.8028795588762","k",TRUE,0.212316868169448 +"pcor.mat",15,"-3.59630105085671, 86.7999098729342, -17.786830663681, -92.8564656991512, -51.1485965456814, -14.4706445280463, -17.7462406922132, -28.2284520566463, 58.7217133492231, 79.4202568475157, 94.2491712979972, -15.5174071900547, -10.2361090481281, 66.6180044878274, -50.6200913805515","65.4638954438269, 6.78580459207296, -35.6246003415436, 58.6391407065094, 18.2316683232784, 86.3036005757749, 46.5730607975274, -84.4369672238827, -44.6714565623552, 17.6646849140525, 37.9040233790874, 32.2640858590603, 77.358628436923, 55.9946102555841, -33.5247005801648","-19.0743586514145, 82.9343199264258, -8.59537380747497, 14.3348595593125, -41.50315746665, 12.1748448815197, -52.9024983756244, 52.8367889579386, -65.2377155609429, 24.2413009516895, -35.3585127275437, 26.4716796576977, 47.1821424551308, -15.6605173368007, -48.333586147055","p",TRUE,-0.0118283348531814 +"pcor.mat",6,"24.3941873777658, 0.587183143943548, 50.1822246704251, 61.6280217655003, 74.6993770357221, -69.6933365892619","-72.6307827513665, 21.0318620782346, -32.1439458057284, 26.9628962501884, -2.04706066288054, 33.2147478125989","66.891982126981, -18.3136829175055, 88.7454390525818, 78.3952571917325, -97.2121218219399, -20.8632645197213","s",FALSE,-0.303802497166359 +"pcor.mat",14,"-77.750310394913, 86.9882957544178, -85.0523100234568, -36.57017191872, -18.1189219001681, 20.1568298507482, 87.3199927154928, -10.1865636650473, 87.327975500375, -17.7946219686419, 4.59059923887253, 19.7666067630053, -31.7012812476605, 52.6644026394933","-60.2974510286003, 74.7249050065875, 1.42830195836723, -15.9695675596595, -83.7907467503101, 55.462152371183, 41.3278543855995, 89.4937683828175, -57.9569500405341, 74.0428008139133, -79.0337625425309, -49.0267637185752, 97.498970804736, -30.8440355118364","-91.0899322014302, 73.1682816520333, 92.4029916524887, -80.4349666461349, -33.0292509868741, -17.2952547669411, -51.6502045560628, 81.4240960869938, -72.4618446547538, -26.8657810520381, -4.80628688819706, 72.3387493286282, 2.85462928004563, 23.4467320144176","k",TRUE,0.000509880332891465 +"pcor.mat",13,"10.7691071461886, 65.1007527951151, -12.0915657840669, 91.6448481846601, -53.240419505164, -69.8381493799388, 21.602482162416, -34.3285651411861, 43.1247111409903, -37.4003404285759, 94.0640051383525, -65.0122064165771, -7.96503899618983","-85.3995600249618, 67.8450697101653, -56.2912890221924, 58.0509331542999, 36.6984612308443, 87.1452712919563, 49.0658250637352, -52.1726700011641, 94.9811044149101, -53.7899555172771, 39.8667695466429, 98.3075775206089, 63.3846609387547","-46.4738335926086, 37.4508975539356, 44.48222653009, 8.24846290051937, -69.1236611455679, -95.8152562379837, -3.39012276381254, -2.47371718287468, -11.9899280369282, 43.2109453715384, 2.20609768293798, -49.9354481697083, -95.7224021200091","p",FALSE,0.380657823856592 +"pcor.mat",5,"15.9143696073443, 48.3970512636006, 23.7569111865014, 83.6479561869055, -89.9238623213023","-20.0500118546188, 93.1261721998453, -91.0053466912359, -23.429145431146, 45.976064959541","-2.69081904552877, -4.5110234990716, -33.4870064165443, -74.1843503434211, 2.36937236040831","k",FALSE,0.218217890235992 +"pcor.mat",6,"10.1451388094574, -90.6787392683327, -87.4421800021082, 20.2668400015682, 78.3513565082103, 20.7683491986245","-97.6740748155862, 10.7196703087538, -54.752997867763, 80.7648414280266, 12.498453585431, 29.1912749875337","-63.6234064586461, -45.7921910565346, -50.1311025116593, -91.5211007930338, 16.7567258700728, 85.7384174596518","p",FALSE,0.236960037693682 +"pcor.mat",12,"73.2413066085428, -14.7738272324204, 50.0003031920642, 45.0548450928181, -48.7516783643514, -23.1134415604174, -87.6020579133183, 30.5087967775762, 82.4424541555345, 72.7492412086576, 32.3323079384863, 85.7122719287872","-9.44385454058647, -7.42488116957247, 3.06755122728646, 35.4948386084288, 69.3501094356179, -19.1765882074833, 95.9793315734714, 29.2394527699798, 53.3461356069893, 11.7002569604665, -71.7540245968848, 20.5835649278015","66.2635098677129, 48.2205909211189, 81.5142437815666, -31.1989811249077, 5.75581910088658, 93.6992627568543, 72.9302003979683, 30.9292090125382, -55.1979901269078, -78.7769370246679, 14.8034851066768, 37.4370891135186","p",TRUE,-0.48727199671024 +"pcor.mat",10,"52.8255486860871, 34.2574729584157, 44.7404673323035, 52.2620148025453, -69.898310629651, -85.9551533591002, -52.2192012518644, -56.3183640595526, -19.7211066260934, -6.08869907446206","-67.6190298050642, 75.8668028283864, 74.6253774967045, -66.1169764585793, -81.1506592668593, -33.249074826017, -21.2896263692528, -97.763530863449, -54.6630097553134, -96.6868148185313","-35.384417232126, 13.2294847629964, 22.9882229119539, -58.4000170230865, 88.3519669994712, 59.8886359948665, -30.7637225370854, 40.6464832834899, -62.5224160030484, -0.506686419248581","p",TRUE,0.492210961830229 +"pcor.mat",8,"18.1551295798272, -8.32464881241322, -99.8132115229964, 18.6201244592667, -53.1589215621352, 70.2180631458759, -36.3900125026703, 92.1965328045189","6.02451944723725, -68.5814322903752, 70.58563423343, 1.00183109752834, 16.1975951399654, 64.5838780794293, -84.6291496884078, -54.131712205708","80.0181794445962, -12.9483319818974, -3.88606782071292, -48.0255630798638, -3.62709653563797, 31.62224679254, 57.1325340308249, -93.3892488945276","p",TRUE,-0.141482085540883 +"pcor.mat",17,"90.1813358999789, -3.33601352758706, -70.5867488868535, -40.8890372607857, 58.0897845327854, 8.4102772641927, 31.2019024044275, 67.8843731526285, -5.85478777065873, 93.743189284578, -21.4788604527712, 48.0386326089501, -42.5454632379115, -78.037649858743, 5.827397108078, -59.5929707866162, 22.9059528559446","46.3524929713458, -42.5642458721995, -69.567626202479, 91.2107714917511, 80.4405058268458, -83.3648740779608, -5.59279890730977, 67.8364232182503, 9.23628495074809, -45.9923652466387, -2.29323050007224, 92.1013004146516, 34.326039114967, -10.8744602650404, 89.988622488454, -23.287376947701, 72.6627949625254","48.8092821557075, -84.7605162765831, -68.7700709793717, -67.7357694599777, 25.1485624350607, 61.709990631789, 29.2394532822073, 47.8424397762865, 37.0008739177138, -47.5637663155794, -14.6964757237583, -69.9305152054876, -54.4029568322003, 80.0897337496281, 9.39622772857547, -1.27441040240228, 74.3666623719037","s",TRUE,0.270551782409472 +"pcor.mat",13,"-68.030820786953, 48.6679933033884, 51.8114904407412, 78.5725246183574, 18.9902665093541, 25.0479029957205, 56.8353782407939, -4.79650879278779, -87.2707166243345, -64.176924712956, -56.511168833822, 41.7948929592967, 79.8323729075491","87.0083963032812, 12.2851114254445, -48.7783022690564, 2.98262075521052, 61.5149905905128, 72.0769232138991, -33.8758388534188, 19.778781151399, -12.315073935315, -95.3089885413647, -40.8825332764536, -50.1593578606844, -29.2145641520619","82.5196304824203, 86.4081613719463, -63.7102510314435, 82.9122426919639, 86.7011873517185, 1.18320896290243, -7.11194663308561, 31.899410719052, -69.8009483516216, -57.3877718299627, 2.83222463913262, -17.2023222781718, -38.1276280619204","p",FALSE,-0.215982700387935 +"pcor.mat",12,"-36.3307877443731, 74.7712590266019, -79.8354192636907, 93.8916243612766, -50.0289557501674, -54.7662570606917, -38.7290718965232, -84.6648510545492, 71.2978508323431, 88.4917345829308, 32.1320930030197, 76.4375317841768","2.62319510802627, -97.154287295416, 21.7567156534642, 95.8672656677663, -0.763413123786449, -9.49476859532297, 83.9058271143585, -38.3374994620681, -16.9302582275122, -85.5358060449362, -83.2731044851243, -18.7622617464513","-76.2503104750067, 36.5515212062746, 48.5381714068353, 72.03823258169, 36.652302602306, 29.980877507478, 21.0754222236574, -96.8017131090164, -66.5918422862887, -10.5546385981143, 91.4459123276174, -84.6182245295495","k",TRUE,-0.161695275103975 +"pcor.mat",13,"65.4542396776378, 2.08085202611983, -88.9037624932826, 52.2526708897203, -38.4136536624283, -13.373964605853, -48.226101975888, 93.4839099645615, 39.563751546666, 69.0497747156769, -94.8003361001611, 24.9876524321735, 25.2306204754859","82.8150092158467, -9.80691406875849, -84.2437265440822, -48.5185658093542, 93.8153511844575, 76.507264515385, 96.1720596533269, 91.2560781463981, -86.2542728893459, -47.9744947515428, 25.5869822110981, -15.71259717457, 99.3623040616512","64.0070253051817, -90.157330268994, 78.4984151832759, 36.6091389209032, -85.7790939509869, -43.4162854682654, -81.61596711725, -7.2117717936635, 69.8510519228876, 87.7512107603252, 60.0242395885289, -77.6109307538718, 33.9131449349225","s",FALSE,0.0846468464958684 +"pcor.mat",14,"6.42584343440831, 89.4456365611404, -94.9723384808749, -4.63838037103415, 82.1529622189701, -72.2434451803565, 21.8717840965837, 13.9814134221524, -70.8967028185725, 99.243081593886, -67.1596728730947, -69.3361242301762, -52.0885898265988, 54.4663844164461","-6.86167716048658, 63.0930243059993, 62.3814635910094, 42.8769947495311, 12.4187188688666, -55.67507436499, 68.4297569096088, 57.5610874220729, -4.82598571106791, -79.5595136005431, -55.5029585491866, -94.9160863645375, 82.0372765418142, -52.3549461271614","-96.7493511270732, 16.427826648578, 26.2085369322449, 89.924060087651, 64.0857739374042, 65.0612049736083, -50.4840951412916, -27.8882106766105, -37.310868408531, -41.0194541793317, -37.8566451836377, -97.9508240241557, -74.5396174024791, 76.8885430879891","p",FALSE,0.0312670434242096 +"pcor.mat",12,"34.8341395147145, 43.1037290487438, 82.2314764373004, -63.9271955937147, 70.3003748320043, 51.0297972708941, 95.4673350322992, 74.5106549467891, -71.5771752875298, 32.5960139743984, 85.8803272712976, -12.2395237442106","-27.241831831634, -76.5246210154146, 86.3751742523164, 74.9675445724279, 63.8482879847288, 14.7356034722179, -30.9328155592084, 73.2200371101499, 26.5261144377291, 42.3744561616331, -80.7972604874521, 95.1648845802993","30.9194989036769, -29.2449895292521, -75.1953874249011, -97.2041368950158, -63.0337142385542, -96.9185112509876, -72.140100877732, 50.4067888017744, 80.1865959074348, 69.9119384400547, 28.0939280521125, -78.1314740888774","p",FALSE,-0.344081701794653 +"pcor.mat",17,"-32.3364136740565, -74.5505046565086, 64.3489994108677, 95.3302425798029, -47.4365599453449, -99.5640191715211, -81.8646350875497, -10.4291386436671, -46.2970128748566, -66.2438121624291, 3.38349812664092, 46.3537188712507, 50.3833524882793, 76.8161817919463, -35.9225623309612, -30.2367287687957, -15.6686681322753","-85.6091414112598, -74.5855379849672, 31.7983427084982, 12.1914628893137, -76.0027903132141, -25.2544173505157, -53.2312866300344, -66.4824201725423, -35.0571169052273, 25.0753607135266, 57.0668096188456, 97.4866581615061, -34.1166456695646, 70.7655222155154, -25.6891251541674, -99.2252895608544, 30.7619682978839","44.1535466350615, 57.7384070493281, -42.7488908171654, -81.2754278071225, 97.9185460601002, 35.2168054319918, -26.9714017864317, -93.0728284176439, -60.7041460927576, -99.858339689672, -53.829790558666, 85.15021414496, -98.6793769989163, -86.0895386897027, 51.4472865033895, -15.630559111014, -28.9994670078158","k",TRUE,0.261679778734634 +"pcor.mat",10,"89.7360242903233, 47.9975900612772, 36.5392371080816, -51.0348361451179, 7.82818463630974, -6.9301129784435, -75.5731589626521, 47.0917036756873, -58.8109106291085, 33.4785438142717","54.0308193303645, 41.3668432738632, 98.2857145369053, -14.9101806804538, 30.7341996114701, 92.3570320941508, -35.8356348704547, -91.0546428058296, 77.7767921797931, 13.7820704840124","-65.3565419837832, -24.2730437777936, 13.4862332604825, -97.8464429732412, 91.0171907860786, -52.4954450316727, -31.7320866975933, 33.8117491919547, 49.1156910546124, -42.7486607804894","p",FALSE,0.109506018207148 diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py index f7217a9..c5c35d1 100644 --- a/tests/unit/computations/test_partial_correlations.py +++ b/tests/unit/computations/test_partial_correlations.py @@ -1,5 +1,6 @@ """Module contains tests for gn3.partial_correlations""" +import csv from unittest import TestCase from gn3.computations.partial_correlations import ( fix_samples, @@ -7,7 +8,9 @@ from gn3.computations.partial_correlations import ( dictify_by_samples, tissue_correlation, find_identical_traits, - good_dataset_samples_indexes) + partial_correlation_matrix, + good_dataset_samples_indexes, + partial_correlation_recursive) sampleslist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] control_traits = ( @@ -90,6 +93,28 @@ dictified_control_samples = ( "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}) +def parse_test_data_csv(filename): + """ + Parse test data csv files for R -> Python conversion of some functions. + """ + def __str__to_tuple(line, field): + return tuple(float(s.strip()) for s in line[field].split(",")) + + with open(filename, newline="\n") as csvfile: + reader = csv.DictReader(csvfile, delimiter=",", quotechar='"') + lines = tuple(row for row in reader) + + methods = {"p": "pearson", "s": "spearman", "k": "kendall"} + return tuple({ + **line, + "x": __str__to_tuple(line, "x"), + "y": __str__to_tuple(line, "y"), + "z": __str__to_tuple(line, "z"), + "method": methods[line["method"]], + "rm": line["rm"] == "TRUE", + "result": float(line["result"]) + } for line in lines) + class TestPartialCorrelations(TestCase): """Class for testing partial correlations computation functions""" @@ -271,3 +296,37 @@ class TestPartialCorrelations(TestCase): ("a", "e", "i", "k"), ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l")), (0, 4, 8, 10)) + + def test_partial_correlation_matrix(self): + """ + Test that `partial_correlation_matrix` computes the appropriate + correlation value. + """ + for sample in parse_test_data_csv( + ("tests/unit/computations/partial_correlations_test_data/" + "pcor_mat_blackbox_test.csv")): + with self.subTest( + xdata=sample["x"], ydata=sample["y"], zdata=sample["z"], + method=sample["method"], omit_nones=sample["rm"]): + self.assertEqual( + partial_correlation_matrix( + sample["x"], sample["y"], sample["z"], + method=sample["method"], omit_nones=sample["rm"]), + sample["result"]) + + def test_partial_correlation_recursive(self): + """ + Test that `partial_correlation_recursive` computes the appropriate + correlation value. + """ + for sample in parse_test_data_csv( + ("tests/unit/computations/partial_correlations_test_data/" + "pcor_rec_blackbox_test.csv")): + with self.subTest( + xdata=sample["x"], ydata=sample["y"], zdata=sample["z"], + method=sample["method"], omit_nones=sample["rm"]): + self.assertEqual( + partial_correlation_recursive( + sample["x"], sample["y"], sample["z"], + method=sample["method"], omit_nones=sample["rm"]), + sample["result"]) -- cgit v1.2.3 From 0357f5c5e6eeb146eb259337019c87079363a256 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 4 Nov 2021 12:38:27 +0300 Subject: Implement `build_data_frame` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: new function (`build_data_frame`) * tests/unit/computations/test_partial_correlations.py: Add tests for new function Add a new function to build a pandas DataFrame object from the provided values: - x: a vector of floats (represented with a tuple of floats) - y: a vector of floats (represented with a tuple of floats) - z: a vector OR matrix of floats (represented with a tuple of floats or a tuple of tuples of floats) --- gn3/computations/partial_correlations.py | 16 ++++++++++++++++ .../unit/computations/test_partial_correlations.py | 22 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 07dc16d..ffdf0c5 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -10,6 +10,8 @@ from typing import Any, Tuple, Sequence from scipy.stats import pearsonr, spearmanr from gn3.settings import TEXTDIR +import pandas + from gn3.data_helpers import parse_csv_line def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): @@ -258,6 +260,20 @@ def compute_partial_correlations_fast(# pylint: disable=[R0913, R0914] else fetched_correlations[corr[0]][0:2]) for idx, corr in enumerate(all_correlations)) +def build_data_frame( + xdata: Tuple[float, ...], ydata: Tuple[float, ...], + zdata: Union[ + Tuple[float, ...], + Tuple[Tuple[float, ...], ...]]) -> pandas.DataFrame: + """ + Build a pandas DataFrame object from xdata, ydata and zdata + """ + x_y_df = pandas.DataFrame({"x": xdata, "y": ydata}) + if isinstance(zdata[0], float): + return x_y_df.join(pandas.DataFrame({"z": zdata})) + return x_y_df.join(pandas.DataFrame( + {"z{}".format(i): val for i, val in enumerate(row)} for row in zdata)) + def partial_correlation_matrix( xdata: Tuple[float, ...], ydata: Tuple[float, ...], zdata: Tuple[float, ...], method: str = "pearsons", diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py index c5c35d1..b22bc62 100644 --- a/tests/unit/computations/test_partial_correlations.py +++ b/tests/unit/computations/test_partial_correlations.py @@ -2,9 +2,12 @@ import csv from unittest import TestCase + +import pandas from gn3.computations.partial_correlations import ( fix_samples, control_samples, + build_data_frame, dictify_by_samples, tissue_correlation, find_identical_traits, @@ -297,6 +300,25 @@ class TestPartialCorrelations(TestCase): ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l")), (0, 4, 8, 10)) + def test_build_data_frame(self): + """ + Check that the function builds the correct data frame. + """ + for xdata, ydata, zdata, expected in ( + ((0.1, 1.1, 2.1), (2.1, 3.1, 4.1), (5.1, 6.1 ,7.1), + pandas.DataFrame({ + "x": (0.1, 1.1, 2.1), "y": (2.1, 3.1, 4.1), + "z": (5.1, 6.1 ,7.1)})), + ((0.1, 1.1, 2.1), (2.1, 3.1, 4.1), + ((5.1, 6.1 ,7.1), (5.2, 6.2, 7.2), (5.3, 6.3, 7.3)), + pandas.DataFrame({ + "x": (0.1, 1.1, 2.1), "y": (2.1, 3.1, 4.1), + "z0": (5.1, 5.2 ,5.3), "z1": (6.1, 6.2 ,6.3), + "z2": (7.1, 7.2 ,7.3)}))): + with self.subTest(xdata=xdata, ydata=ydata, zdata=zdata): + self.assertTrue( + build_data_frame(xdata, ydata, zdata).equals(expected)) + def test_partial_correlation_matrix(self): """ Test that `partial_correlation_matrix` computes the appropriate -- cgit v1.2.3 From 9647226ea4c85449581df713c2bb583aeed6940f Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 4 Nov 2021 12:43:28 +0300 Subject: Partially implement `partial_correlation_recursive` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: Implement one path for the `gn3.computations.partial_correlations.partial_correlation_recursive` function. * gn3/settings.py: Add a setting for how many decimal places to round to * tests/unit/computations/test_partial_correlations.py: Update test to take the number of decimal places into consideration Implement a single path (where the z value is a vector and not a matrix) for the `partial_correlation_recursive` function. --- gn3/computations/partial_correlations.py | 41 ++++++++++++++++++---- gn3/settings.py | 2 ++ .../unit/computations/test_partial_correlations.py | 4 ++- 3 files changed, 39 insertions(+), 8 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index ffdf0c5..bd127a7 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -5,13 +5,14 @@ It is an attempt to migrate over the partial correlations feature from GeneNetwork1. """ +import math from functools import reduce -from typing import Any, Tuple, Sequence +from typing import Any, Tuple, Union, Sequence from scipy.stats import pearsonr, spearmanr -from gn3.settings import TEXTDIR import pandas +from gn3.settings import TEXTDIR, ROUND_TO from gn3.data_helpers import parse_csv_line def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): @@ -276,8 +277,8 @@ def build_data_frame( def partial_correlation_matrix( xdata: Tuple[float, ...], ydata: Tuple[float, ...], - zdata: Tuple[float, ...], method: str = "pearsons", - omit_nones: bool = True) -> float: + zdata: Union[Tuple[float, ...], Tuple[Tuple[float, ...], ...]], + method: str = "pearson", omit_nones: bool = True) -> float: """ Computes the partial correlation coefficient using the 'variance-covariance matrix' method @@ -291,8 +292,8 @@ def partial_correlation_matrix( def partial_correlation_recursive( xdata: Tuple[float, ...], ydata: Tuple[float, ...], - zdata: Tuple[float, ...], method: str = "pearsons", - omit_nones: bool = True) -> float: + zdata: Union[Tuple[float, ...], Tuple[Tuple[float, ...], ...]], + method: str = "pearson", omit_nones: bool = True) -> float: """ Computes the partial correlation coefficient using the 'recursive formula' method @@ -302,4 +303,30 @@ def partial_correlation_recursive( GeneNetwork1, specifically the `pcor.rec` function written in the R programming language. """ - return 0 + assert method in ("pearson", "spearman", "kendall") + data = ( + build_data_frame(xdata, ydata, zdata).dropna(axis=0) + if omit_nones else + build_data_frame(xdata, ydata, zdata)) + + if data.shape[1] == 3: # z is a vector, not matrix + fields = { + "rxy": ("x", "y"), + "rxz": ("x", "z"), + "ryz": ("y", "z")} + tdata = { + corr_type: pandas.DataFrame( + {cols[0]: data[cols[0]], + cols[1]: data[cols[1]]}).dropna(axis=0) + for corr_type, cols in fields.items() + } + corrs = { + corr_type: tdata[corr_type][cols[0]].corr( + tdata[corr_type][cols[1]], method=method) + for corr_type, cols in fields.items() + } + return round(( + (corrs["rxy"] - corrs["rxz"] * corrs["ryz"]) / + (math.sqrt(1 - corrs["rxz"]**2) * + math.sqrt(1 - corrs["ryz"]**2))), ROUND_TO) + return round(0, ROUND_TO) diff --git a/gn3/settings.py b/gn3/settings.py index 57c63df..eaf8f23 100644 --- a/gn3/settings.py +++ b/gn3/settings.py @@ -53,3 +53,5 @@ CORS_HEADERS = [ GNSHARE = os.environ.get("GNSHARE", "/gnshare/gn/") TEXTDIR = f"{GNSHARE}/web/ProbeSetFreeze_DataMatrix" + +ROUND_TO = 10 diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py index b22bc62..981801a 100644 --- a/tests/unit/computations/test_partial_correlations.py +++ b/tests/unit/computations/test_partial_correlations.py @@ -4,6 +4,8 @@ import csv from unittest import TestCase import pandas + +from gn3.settings import ROUND_TO from gn3.computations.partial_correlations import ( fix_samples, control_samples, @@ -115,7 +117,7 @@ def parse_test_data_csv(filename): "z": __str__to_tuple(line, "z"), "method": methods[line["method"]], "rm": line["rm"] == "TRUE", - "result": float(line["result"]) + "result": round(float(line["result"]), ROUND_TO) } for line in lines) class TestPartialCorrelations(TestCase): -- cgit v1.2.3 From 42dee16ec8a7d7620367dd31481999bfca9313db Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 26 Oct 2021 08:59:30 +0300 Subject: Implement `fetch_gene_symbol_tissue_value_dict_for_trait` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Implement `fetch_gene_symbol_tissue_value_dict_for_trait` function which is a migration of the `web.webqtl.correlation.correlationFunction.getGeneSymbolTissueValueDictForTrait` function in GeneNetwork1. --- gn3/db/correlations.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index 87ab082..cae8080 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -266,7 +266,22 @@ def fetch_tissue_probeset_xref_info( (tuple(), {}, {}, {}, {}, {}, {})) def correlations_of_all_tissue_traits() -> Tuple[dict, dict]: +def fetch_gene_symbol_tissue_value_dict_for_trait( + gene_name_list: Tuple[str, ...], probeset_freeze_id: int, + conn: Any) -> dict: + """ + Fetches a map of the gene symbols to the tissue values. + + This is a migration of the + `web.webqtl.correlation.correlationFunction.getGeneSymbolTissueValueDictForTrait` + function in GeneNetwork1. """ + xref_info = fetch_tissue_probeset_xref_info( + gene_name_list, probeset_freeze_id, conn) + if xref_info[0]: + return fetch_gene_symbol_tissue_value_dict(xref_info[0], xref_info[2], conn) + return {} + This is a migration of the `web.webqtl.correlation.CorrelationPage.calculateCorrOfAllTissueTrait` function in GeneNetwork1. -- cgit v1.2.3 From d6e392c2488421ae04b4ffd5de26be40ed86a9b3 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 26 Oct 2021 09:17:52 +0300 Subject: Complete `correlations_of_all_tissue_traits` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Complete the implementation of the `correlations_of_all_tissue_traits` function by providing a call to a non-implemented function. --- gn3/db/correlations.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index cae8080..f43b8a5 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -265,7 +265,6 @@ def fetch_tissue_probeset_xref_info( results or tuple(), (tuple(), {}, {}, {}, {}, {}, {})) -def correlations_of_all_tissue_traits() -> Tuple[dict, dict]: def fetch_gene_symbol_tissue_value_dict_for_trait( gene_name_list: Tuple[str, ...], probeset_freeze_id: int, conn: Any) -> dict: @@ -282,12 +281,25 @@ def fetch_gene_symbol_tissue_value_dict_for_trait( return fetch_gene_symbol_tissue_value_dict(xref_info[0], xref_info[2], conn) return {} +def correlations_of_all_tissue_traits( + trait_symbol: str, probeset_freeze_id: int, + method: str, conn: Any) -> Tuple[dict, dict]: + """ + Computes and returns the correlation of all tissue traits. + This is a migration of the - `web.webqtl.correlation.CorrelationPage.calculateCorrOfAllTissueTrait` + `web.webqtl.correlation.correlationFunction.calculateCorrOfAllTissueTrait` function in GeneNetwork1. """ - raise Exception("Unimplemented!!!") - return ({}, {}) + primary_trait_symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( + (trait_symbol,), probeset_freeze_id, conn) + primary_trait_value = primary_trait_symbol_value_dict.vlaues()[0] + symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( + tuple(), probeset_freeze_id, conn) + if method == "1": + return batch_computed_tissue_correlation( + primaryTraitValue,SymbolValueDict,method='spearman') + return batch_computed_tissue_correlation(primaryTraitValue,SymbolValueDict) def build_temporary_tissue_correlations_table( trait_symbol: str, probeset_freeze_id: int, method: str, @@ -298,6 +310,8 @@ def build_temporary_tissue_correlations_table( This is a migration of the `web.webqtl.correlation.CorrelationPage.getTempTissueCorrTable` function in GeneNetwork1.""" + symbol_corr_dict, symbol_p_value_dict = correlations_of_all_tissue_traits( + trait_symbol, probeset_freeze_id, method, conn) raise Exception("Unimplemented!!!") return "" -- cgit v1.2.3 From 5079e5077adafdbfd0b7e7c0ef12431e9aed443d Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 26 Oct 2021 09:23:48 +0300 Subject: Stub out `batch_computed_tissue_correlation` function Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Stub out `batch_computed_tissue_correlation` function to be used in implementing the function down the line. --- gn3/db/correlations.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index f43b8a5..54d3079 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -281,6 +281,14 @@ def fetch_gene_symbol_tissue_value_dict_for_trait( return fetch_gene_symbol_tissue_value_dict(xref_info[0], xref_info[2], conn) return {} +def batch_computed_tissue_correlation( + trait_value: str, symbol_value_dict: dict, + method: str = "pearson") -> Tuple[dict, dict]: + """ + `web.webqtl.correlation.correlationFunction.batchCalTissueCorr`""" + raise Exception("Not implemented!") + return ({}, {}) + def correlations_of_all_tissue_traits( trait_symbol: str, probeset_freeze_id: int, method: str, conn: Any) -> Tuple[dict, dict]: -- cgit v1.2.3 From 84aaf880f32f5293e5e4f1c74a3f284e3c95df2f Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 27 Oct 2021 10:24:28 +0300 Subject: Remove if clauses: replace with dict Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Remove the if clauses to simplify the code flow: use a dictionary of queries and select the appropriate query from the dictionary instead. --- gn3/db/species.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'gn3') diff --git a/gn3/db/species.py b/gn3/db/species.py index 1e5015f..abcbf64 100644 --- a/gn3/db/species.py +++ b/gn3/db/species.py @@ -47,17 +47,13 @@ def translate_to_mouse_gene_id(species: str, geneid: int, conn: Any) -> int: return geneid with conn.cursor as cursor: - if species == "rat": - cursor.execute( - "SELECT mouse FROM GeneIDXRef WHERE rat = %s", geneid) - rat_geneid = cursor.fetchone() - if rat_geneid: - return rat_geneid[0] - - cursor.execute( - "SELECT mouse FROM GeneIDXRef WHERE human = %s", geneid) - human_geneid = cursor.fetchone() - if human_geneid: - return human_geneid[0] + query = { + "rat": "SELECT mouse FROM GeneIDXRef WHERE rat = %s" + "human": "SELECT mouse FROM GeneIDXRef WHERE human = %s" + } + cursor.execute(query[species], geneid) + translated_gene_id = cursor.fetchone() + if translated_gene_id: + return translated_gene_id[0] return 0 # default if all else fails -- cgit v1.2.3 From 14c699094a39ee2b18a26c990c0bf81d811cc93f Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 04:52:02 +0300 Subject: Move the partial_correlations module to gn3.computations * Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Move the partial_correlations.py module to the gn3.computations module, since it contains the computations for partial correlations. --- gn3/computations/partial_correlations.py | 124 +++++++++++++++++++++++++++++++ gn3/partial_correlations.py | 124 ------------------------------- 2 files changed, 124 insertions(+), 124 deletions(-) create mode 100644 gn3/computations/partial_correlations.py delete mode 100644 gn3/partial_correlations.py (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py new file mode 100644 index 0000000..1fb0ccc --- /dev/null +++ b/gn3/computations/partial_correlations.py @@ -0,0 +1,124 @@ +""" +This module deals with partial correlations. + +It is an attempt to migrate over the partial correlations feature from +GeneNetwork1. +""" + +from functools import reduce +from typing import Any, Tuple, Sequence + +def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): + """ + Fetches data for the control traits. + + This migrates `web/webqtl/correlation/correlationFunction.controlStrain` in + GN1, with a few modifications to the arguments passed in. + + PARAMETERS: + controls: A map of sample names to trait data. Equivalent to the `cvals` + value in the corresponding source function in GN1. + sampleslist: A list of samples. Equivalent to `strainlst` in the + corresponding source function in GN1 + """ + def __process_control__(trait_data): + def __process_sample__(acc, sample): + if sample in trait_data["data"].keys(): + sample_item = trait_data["data"][sample] + val = sample_item["value"] + if val is not None: + return ( + acc[0] + (sample,), + acc[1] + (val,), + acc[2] + (sample_item["variance"],)) + return acc + return reduce( + __process_sample__, sampleslist, (tuple(), tuple(), tuple())) + + return reduce( + lambda acc, item: ( + acc[0] + (item[0],), + acc[1] + (item[1],), + acc[2] + (item[2],), + acc[3] + (len(item[0]),), + ), + [__process_control__(trait_data) for trait_data in controls], + (tuple(), tuple(), tuple(), tuple())) + +def dictify_by_samples(samples_vals_vars: Sequence[Sequence]) -> Sequence[dict]: + """ + Build a sequence of dictionaries from a sequence of separate sequences of + samples, values and variances. + + This is a partial migration of + `web.webqtl.correlation.correlationFunction.fixStrains` function in GN1. + This implementation extracts code that will find common use, and that will + find use in more than one place. + """ + return tuple( + { + sample: {"sample_name": sample, "value": val, "variance": var} + for sample, val, var in zip(*trait_line) + } for trait_line in zip(*(samples_vals_vars[0:3]))) + +def fix_samples(primary_trait: dict, control_traits: Sequence[dict]) -> Sequence[Sequence[Any]]: + """ + Corrects sample_names, values and variance such that they all contain only + those samples that are common to the reference trait and all control traits. + + This is a partial migration of the + `web.webqtl.correlation.correlationFunction.fixStrain` function in GN1. + """ + primary_samples = tuple( + present[0] for present in + ((sample, all(sample in control.keys() for control in control_traits)) + for sample in primary_trait.keys()) + if present[1]) + control_vals_vars: tuple = reduce( + lambda acc, x: (acc[0] + (x[0],), acc[1] + (x[1],)), + ((item["value"], item["variance"]) + for sublist in [tuple(control.values()) for control in control_traits] + for item in sublist), + (tuple(), tuple())) + return ( + primary_samples, + tuple(primary_trait[sample]["value"] for sample in primary_samples), + control_vals_vars[0], + tuple(primary_trait[sample]["variance"] for sample in primary_samples), + control_vals_vars[1]) + +def find_identical_traits( + primary_name: str, primary_value: float, control_names: Tuple[str, ...], + control_values: Tuple[float, ...]) -> Tuple[str, ...]: + """ + Find traits that have the same value when the values are considered to + 3 decimal places. + + This is a migration of the + `web.webqtl.correlation.correlationFunction.findIdenticalTraits` function in + GN1. + """ + def __merge_identicals__( + acc: Tuple[str, ...], + ident: Tuple[str, Tuple[str, ...]]) -> Tuple[str, ...]: + return acc + ident[1] + + def __dictify_controls__(acc, control_item): + ckey = "{:.3f}".format(control_item[0]) + return {**acc, ckey: acc.get(ckey, tuple()) + (control_item[1],)} + + return (reduce(## for identical control traits + __merge_identicals__, + (item for item in reduce(# type: ignore[var-annotated] + __dictify_controls__, zip(control_values, control_names), + {}).items() if len(item[1]) > 1), + tuple()) + or + reduce(## If no identical control traits, try primary and controls + __merge_identicals__, + (item for item in reduce(# type: ignore[var-annotated] + __dictify_controls__, + zip((primary_value,) + control_values, + (primary_name,) + control_names), {}).items() + if len(item[1]) > 1), + tuple())) diff --git a/gn3/partial_correlations.py b/gn3/partial_correlations.py deleted file mode 100644 index 1fb0ccc..0000000 --- a/gn3/partial_correlations.py +++ /dev/null @@ -1,124 +0,0 @@ -""" -This module deals with partial correlations. - -It is an attempt to migrate over the partial correlations feature from -GeneNetwork1. -""" - -from functools import reduce -from typing import Any, Tuple, Sequence - -def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): - """ - Fetches data for the control traits. - - This migrates `web/webqtl/correlation/correlationFunction.controlStrain` in - GN1, with a few modifications to the arguments passed in. - - PARAMETERS: - controls: A map of sample names to trait data. Equivalent to the `cvals` - value in the corresponding source function in GN1. - sampleslist: A list of samples. Equivalent to `strainlst` in the - corresponding source function in GN1 - """ - def __process_control__(trait_data): - def __process_sample__(acc, sample): - if sample in trait_data["data"].keys(): - sample_item = trait_data["data"][sample] - val = sample_item["value"] - if val is not None: - return ( - acc[0] + (sample,), - acc[1] + (val,), - acc[2] + (sample_item["variance"],)) - return acc - return reduce( - __process_sample__, sampleslist, (tuple(), tuple(), tuple())) - - return reduce( - lambda acc, item: ( - acc[0] + (item[0],), - acc[1] + (item[1],), - acc[2] + (item[2],), - acc[3] + (len(item[0]),), - ), - [__process_control__(trait_data) for trait_data in controls], - (tuple(), tuple(), tuple(), tuple())) - -def dictify_by_samples(samples_vals_vars: Sequence[Sequence]) -> Sequence[dict]: - """ - Build a sequence of dictionaries from a sequence of separate sequences of - samples, values and variances. - - This is a partial migration of - `web.webqtl.correlation.correlationFunction.fixStrains` function in GN1. - This implementation extracts code that will find common use, and that will - find use in more than one place. - """ - return tuple( - { - sample: {"sample_name": sample, "value": val, "variance": var} - for sample, val, var in zip(*trait_line) - } for trait_line in zip(*(samples_vals_vars[0:3]))) - -def fix_samples(primary_trait: dict, control_traits: Sequence[dict]) -> Sequence[Sequence[Any]]: - """ - Corrects sample_names, values and variance such that they all contain only - those samples that are common to the reference trait and all control traits. - - This is a partial migration of the - `web.webqtl.correlation.correlationFunction.fixStrain` function in GN1. - """ - primary_samples = tuple( - present[0] for present in - ((sample, all(sample in control.keys() for control in control_traits)) - for sample in primary_trait.keys()) - if present[1]) - control_vals_vars: tuple = reduce( - lambda acc, x: (acc[0] + (x[0],), acc[1] + (x[1],)), - ((item["value"], item["variance"]) - for sublist in [tuple(control.values()) for control in control_traits] - for item in sublist), - (tuple(), tuple())) - return ( - primary_samples, - tuple(primary_trait[sample]["value"] for sample in primary_samples), - control_vals_vars[0], - tuple(primary_trait[sample]["variance"] for sample in primary_samples), - control_vals_vars[1]) - -def find_identical_traits( - primary_name: str, primary_value: float, control_names: Tuple[str, ...], - control_values: Tuple[float, ...]) -> Tuple[str, ...]: - """ - Find traits that have the same value when the values are considered to - 3 decimal places. - - This is a migration of the - `web.webqtl.correlation.correlationFunction.findIdenticalTraits` function in - GN1. - """ - def __merge_identicals__( - acc: Tuple[str, ...], - ident: Tuple[str, Tuple[str, ...]]) -> Tuple[str, ...]: - return acc + ident[1] - - def __dictify_controls__(acc, control_item): - ckey = "{:.3f}".format(control_item[0]) - return {**acc, ckey: acc.get(ckey, tuple()) + (control_item[1],)} - - return (reduce(## for identical control traits - __merge_identicals__, - (item for item in reduce(# type: ignore[var-annotated] - __dictify_controls__, zip(control_values, control_names), - {}).items() if len(item[1]) > 1), - tuple()) - or - reduce(## If no identical control traits, try primary and controls - __merge_identicals__, - (item for item in reduce(# type: ignore[var-annotated] - __dictify_controls__, - zip((primary_value,) + control_values, - (primary_name,) + control_names), {}).items() - if len(item[1]) > 1), - tuple())) -- cgit v1.2.3 From 28b0ced4ec13451c5c7323ed5135d126f296836a Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 04:55:30 +0300 Subject: Move the function to computations module Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * The function `batch_computed_tissue_correlation` is a pure computations function with no expressions accessing the database, as far as I can tell, therefore, this commit moves the function over to the gn3.computations.partial_correlations module that holds the pure computation functions. --- gn3/computations/partial_correlations.py | 8 ++++++++ gn3/db/correlations.py | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 1fb0ccc..b3de31c 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -122,3 +122,11 @@ def find_identical_traits( (primary_name,) + control_names), {}).items() if len(item[1]) > 1), tuple())) + +def batch_computed_tissue_correlation( + trait_value: str, symbol_value_dict: dict, + method: str = "pearson") -> Tuple[dict, dict]: + """ + `web.webqtl.correlation.correlationFunction.batchCalTissueCorr`""" + raise Exception("Not implemented!") + return ({}, {}) diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index 54d3079..f43b8a5 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -281,14 +281,6 @@ def fetch_gene_symbol_tissue_value_dict_for_trait( return fetch_gene_symbol_tissue_value_dict(xref_info[0], xref_info[2], conn) return {} -def batch_computed_tissue_correlation( - trait_value: str, symbol_value_dict: dict, - method: str = "pearson") -> Tuple[dict, dict]: - """ - `web.webqtl.correlation.correlationFunction.batchCalTissueCorr`""" - raise Exception("Not implemented!") - return ({}, {}) - def correlations_of_all_tissue_traits( trait_symbol: str, probeset_freeze_id: int, method: str, conn: Any) -> Tuple[dict, dict]: -- cgit v1.2.3 From 847a5e0656ed686a0541e47958a845a0d3725daf Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 06:34:19 +0300 Subject: Implement `tissue_correlation` function Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: New function (tissue_correlation) * tests/unit/test_partial_correlations.py -> tests/unit/computations/test_partial_correlations.py: Move module. Implement tests for new function Migrate the `cal_tissue_corr` function embedded in the `web.webqtl.correlation.correlationFunction.batchCalTissueCorr` function in GN1 and implement tests to ensure it works correctly. --- gn3/computations/partial_correlations.py | 27 +++ .../unit/computations/test_partial_correlations.py | 258 +++++++++++++++++++++ tests/unit/test_partial_correlations.py | 211 ----------------- 3 files changed, 285 insertions(+), 211 deletions(-) create mode 100644 tests/unit/computations/test_partial_correlations.py delete mode 100644 tests/unit/test_partial_correlations.py (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index b3de31c..e73edfd 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -7,6 +7,7 @@ GeneNetwork1. from functools import reduce from typing import Any, Tuple, Sequence +from scipy.stats import pearsonr, spearmanr def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): """ @@ -123,6 +124,32 @@ def find_identical_traits( if len(item[1]) > 1), tuple())) +def tissue_correlation( + primary_trait_values: Tuple[float, ...], + target_trait_values: Tuple[float, ...], + method: str) -> Tuple[float, float]: + """ + Compute the correlation between the primary trait values, and the values of + a single target value. + + This migrates the `cal_tissue_corr` function embedded in the larger + `web.webqtl.correlation.correlationFunction.batchCalTissueCorr` function in + GeneNetwork1. + """ + def spearman_corr(*args): + result = spearmanr(*args) + return (result.correlation, result.pvalue) + + method_fns = {"pearson": pearsonr, "spearman": spearman_corr} + + assert len(primary_trait_values) == len(target_trait_values), ( + "The lengths of the `primary_trait_values` and `target_trait_values` " + "must be equal") + assert method in method_fns.keys(), ( + "Method must be one of: {}".format(",".join(method_fns.keys()))) + + return method_fns[method](primary_trait_values, target_trait_values) + def batch_computed_tissue_correlation( trait_value: str, symbol_value_dict: dict, method: str = "pearson") -> Tuple[dict, dict]: diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py new file mode 100644 index 0000000..7ff8b80 --- /dev/null +++ b/tests/unit/computations/test_partial_correlations.py @@ -0,0 +1,258 @@ +"""Module contains tests for gn3.partial_correlations""" + +from unittest import TestCase +from gn3.computations.partial_correlations import * + +sampleslist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] +control_traits = ( + { + "mysqlid": 36688172, + "data": { + "B6cC3-1": { + "sample_name": "B6cC3-1", "value": 7.51879, "variance": None, + "ndata": None}, + "BXD1": { + "sample_name": "BXD1", "value": 7.77141, "variance": None, + "ndata": None}, + "BXD12": { + "sample_name": "BXD12", "value": 8.39265, "variance": None, + "ndata": None}, + "BXD16": { + "sample_name": "BXD16", "value": 8.17443, "variance": None, + "ndata": None}, + "BXD19": { + "sample_name": "BXD19", "value": 8.30401, "variance": None, + "ndata": None}, + "BXD2": { + "sample_name": "BXD2", "value": 7.80944, "variance": None, + "ndata": None}}}, + { + "mysqlid": 36688172, + "data": { + "B6cC3-21": { + "sample_name": "B6cC3-1", "value": 7.51879, "variance": None, + "ndata": None}, + "BXD21": { + "sample_name": "BXD1", "value": 7.77141, "variance": None, + "ndata": None}, + "BXD12": { + "sample_name": "BXD12", "value": 8.39265, "variance": None, + "ndata": None}, + "BXD16": { + "sample_name": "BXD16", "value": 8.17443, "variance": None, + "ndata": None}, + "BXD19": { + "sample_name": "BXD19", "value": 8.30401, "variance": None, + "ndata": None}, + "BXD2": { + "sample_name": "BXD2", "value": 7.80944, "variance": None, + "ndata": None}}}, + { + "mysqlid": 36688172, + "data": { + "B6cC3-1": { + "sample_name": "B6cC3-1", "value": 7.51879, "variance": None, + "ndata": None}, + "BXD1": { + "sample_name": "BXD1", "value": 7.77141, "variance": None, + "ndata": None}, + "BXD12": { + "sample_name": "BXD12", "value": None, "variance": None, + "ndata": None}, + "BXD16": { + "sample_name": "BXD16", "value": None, "variance": None, + "ndata": None}, + "BXD19": { + "sample_name": "BXD19", "value": None, "variance": None, + "ndata": None}, + "BXD2": { + "sample_name": "BXD2", "value": 7.80944, "variance": None, + "ndata": None}}}) + +dictified_control_samples = ( + {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, + "BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, + "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, + "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, + {"BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, + "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, + "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, + {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}) + +class TestPartialCorrelations(TestCase): + """Class for testing partial correlations computation functions""" + + def test_control_samples(self): + """Test that the control_samples works as expected.""" + self.assertEqual( + control_samples(control_traits, sampleslist), + ((("B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"), + ("BXD12", "BXD16", "BXD19", "BXD2"), + ("B6cC3-1", "BXD1", "BXD2")), + ((7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944), + (8.39265, 8.17443, 8.30401, 7.80944), + (7.51879, 7.77141, 7.80944)), + ((None, None, None, None, None, None), (None, None, None, None), + (None, None, None)), + (6, 4, 3))) + + def test_dictify_by_samples(self): + """ + Test that `dictify_by_samples` generates the appropriate dict + + Given: + a sequence of sequences with sample names, values and variances, as + in the output of `gn3.partial_correlations.control_samples` or + the output of `gn3.db.traits.export_informative` + When: + the sequence is passed as an argument into the + `gn3.partial_correlations.dictify_by_sample` + Then: + return a sequence of dicts with keys being the values of the sample + names, and each of who's values being sub-dicts with the keys + 'sample_name', 'value' and 'variance' whose values correspond to the + values passed in. + """ + self.assertEqual( + dictify_by_samples( + ((("B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"), + ("BXD12", "BXD16", "BXD19", "BXD2"), + ("B6cC3-1", "BXD1", "BXD2")), + ((7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944), + (8.39265, 8.17443, 8.30401, 7.80944), + (7.51879, 7.77141, 7.80944)), + ((None, None, None, None, None, None), (None, None, None, None), + (None, None, None)), + (6, 4, 3))), + dictified_control_samples) + + def test_fix_samples(self): + """ + Test that `fix_samples` returns only the common samples + + Given: + - A primary trait + - A sequence of control samples + When: + - The two arguments are passed to `fix_samples` + Then: + - Only the names of the samples present in the primary trait that + are also present in ALL the control traits are present in the + return value + - Only the values of the samples present in the primary trait that + are also present in ALL the control traits are present in the + return value + - ALL the values for ALL the control traits are present in the + return value + - Only the variances of the samples present in the primary trait + that are also present in ALL the control traits are present in the + return value + - ALL the variances for ALL the control traits are present in the + return value + - The return value is a tuple of the above items, in the following + order: + ((sample_names, ...), (primary_trait_values, ...), + (control_traits_values, ...), (primary_trait_variances, ...) + (control_traits_variances, ...)) + """ + self.assertEqual( + fix_samples( + {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, + "variance": None}, + "BXD1": {"sample_name": "BXD1", "value": 7.77141, + "variance": None}, + "BXD2": {"sample_name": "BXD2", "value": 7.80944, + "variance": None}}, + dictified_control_samples), + (("BXD2",), (7.80944,), + (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944, 8.39265, + 8.17443, 8.30401, 7.80944, 7.51879, 7.77141, 7.80944), + (None,), + (None, None, None, None, None, None, None, None, None, None, None, + None, None))) + + def test_find_identical_traits(self): + """ + Test `gn3.partial_correlations.find_identical_traits`. + + Given: + - the name of a primary trait + - the value of a primary trait + - a sequence of names of control traits + - a sequence of values of control traits + When: + - the arguments above are passed to the `find_identical_traits` + function + Then: + - Return ALL trait names that have the same value when up to three + decimal places are considered + """ + for primn, primv, contn, contv, expected in ( + ("pt", 12.98395, ("ct0", "ct1", "ct2"), + (0.1234, 2.3456, 3.4567), tuple()), + ("pt", 12.98395, ("ct0", "ct1", "ct2"), + (12.98354, 2.3456, 3.4567), ("pt", "ct0")), + ("pt", 12.98395, ("ct0", "ct1", "ct2", "ct3"), + (0.1234, 2.3456, 0.1233, 4.5678), ("ct0", "ct2")) + ): + with self.subTest( + primary_name=primn, primary_value=primv, + control_names=contn, control_values=contv): + self.assertEqual( + find_identical_traits(primn, primv, contn, contv), expected) + + def test_tissue_correlation_error(self): + """ + Test that `tissue_correlation` raises specific exceptions for particular + error conditions. + """ + for primary, target, method, error, error_msg in ( + ((1,2,3), (4,5,6,7), "pearson", + AssertionError, + ( + "The lengths of the `primary_trait_values` and " + "`target_trait_values` must be equal")), + ((1,2,3), (4,5,6,7), "spearman", + AssertionError, + ( + "The lengths of the `primary_trait_values` and " + "`target_trait_values` must be equal")), + ((1,2,3,4), (5,6,7), "pearson", + AssertionError, + ( + "The lengths of the `primary_trait_values` and " + "`target_trait_values` must be equal")), + ((1,2,3,4), (5,6,7), "spearman", + AssertionError, + ( + "The lengths of the `primary_trait_values` and " + "`target_trait_values` must be equal")), + ((1,2,3), (4,5,6), "nonexistentmethod", + AssertionError, + ( + "Method must be one of: pearson, spearman"))): + with self.subTest(primary=primary, target=target, method=method): + with self.assertRaises(error, msg=error_msg): + tissue_correlation(primary, target, method) + + def test_tissue_correlation(self): + """ + Test that the correct correlation values are computed for the given: + - primary trait + - target trait + - method + """ + for primary, target, method, expected in ( + ((12.34, 18.36, 42.51), (37.25, 46.25, 46.56), "pearson", + (0.6761779252651052, 0.5272701133657985)), + ((1, 2, 3, 4, 5), (5, 6, 7, 8, 7), "spearman", + (0.8207826816681233, 0.08858700531354381)) + ): + with self.subTest(primary=primary, target=target, method=method): + self.assertEqual( + tissue_correlation(primary, target, method), expected) diff --git a/tests/unit/test_partial_correlations.py b/tests/unit/test_partial_correlations.py deleted file mode 100644 index 60e54c1..0000000 --- a/tests/unit/test_partial_correlations.py +++ /dev/null @@ -1,211 +0,0 @@ -"""Module contains tests for gn3.partial_correlations""" - -from unittest import TestCase -from gn3.partial_correlations import ( - fix_samples, - control_samples, - dictify_by_samples, - find_identical_traits) - -sampleslist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] -control_traits = ( - { - "mysqlid": 36688172, - "data": { - "B6cC3-1": { - "sample_name": "B6cC3-1", "value": 7.51879, "variance": None, - "ndata": None}, - "BXD1": { - "sample_name": "BXD1", "value": 7.77141, "variance": None, - "ndata": None}, - "BXD12": { - "sample_name": "BXD12", "value": 8.39265, "variance": None, - "ndata": None}, - "BXD16": { - "sample_name": "BXD16", "value": 8.17443, "variance": None, - "ndata": None}, - "BXD19": { - "sample_name": "BXD19", "value": 8.30401, "variance": None, - "ndata": None}, - "BXD2": { - "sample_name": "BXD2", "value": 7.80944, "variance": None, - "ndata": None}}}, - { - "mysqlid": 36688172, - "data": { - "B6cC3-21": { - "sample_name": "B6cC3-1", "value": 7.51879, "variance": None, - "ndata": None}, - "BXD21": { - "sample_name": "BXD1", "value": 7.77141, "variance": None, - "ndata": None}, - "BXD12": { - "sample_name": "BXD12", "value": 8.39265, "variance": None, - "ndata": None}, - "BXD16": { - "sample_name": "BXD16", "value": 8.17443, "variance": None, - "ndata": None}, - "BXD19": { - "sample_name": "BXD19", "value": 8.30401, "variance": None, - "ndata": None}, - "BXD2": { - "sample_name": "BXD2", "value": 7.80944, "variance": None, - "ndata": None}}}, - { - "mysqlid": 36688172, - "data": { - "B6cC3-1": { - "sample_name": "B6cC3-1", "value": 7.51879, "variance": None, - "ndata": None}, - "BXD1": { - "sample_name": "BXD1", "value": 7.77141, "variance": None, - "ndata": None}, - "BXD12": { - "sample_name": "BXD12", "value": None, "variance": None, - "ndata": None}, - "BXD16": { - "sample_name": "BXD16", "value": None, "variance": None, - "ndata": None}, - "BXD19": { - "sample_name": "BXD19", "value": None, "variance": None, - "ndata": None}, - "BXD2": { - "sample_name": "BXD2", "value": 7.80944, "variance": None, - "ndata": None}}}) - -dictified_control_samples = ( - {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, - "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, - "BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, - "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, - "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, - {"BXD12": {"sample_name": "BXD12", "value": 8.39265, "variance": None}, - "BXD16": {"sample_name": "BXD16", "value": 8.17443, "variance": None}, - "BXD19": {"sample_name": "BXD19", "value": 8.30401, "variance": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}, - {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, "variance": None}, - "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}) - -class TestPartialCorrelations(TestCase): - """Class for testing partial correlations computation functions""" - - def test_control_samples(self): - """Test that the control_samples works as expected.""" - self.assertEqual( - control_samples(control_traits, sampleslist), - ((("B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"), - ("BXD12", "BXD16", "BXD19", "BXD2"), - ("B6cC3-1", "BXD1", "BXD2")), - ((7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944), - (8.39265, 8.17443, 8.30401, 7.80944), - (7.51879, 7.77141, 7.80944)), - ((None, None, None, None, None, None), (None, None, None, None), - (None, None, None)), - (6, 4, 3))) - - def test_dictify_by_samples(self): - """ - Test that `dictify_by_samples` generates the appropriate dict - - Given: - a sequence of sequences with sample names, values and variances, as - in the output of `gn3.partial_correlations.control_samples` or - the output of `gn3.db.traits.export_informative` - When: - the sequence is passed as an argument into the - `gn3.partial_correlations.dictify_by_sample` - Then: - return a sequence of dicts with keys being the values of the sample - names, and each of who's values being sub-dicts with the keys - 'sample_name', 'value' and 'variance' whose values correspond to the - values passed in. - """ - self.assertEqual( - dictify_by_samples( - ((("B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"), - ("BXD12", "BXD16", "BXD19", "BXD2"), - ("B6cC3-1", "BXD1", "BXD2")), - ((7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944), - (8.39265, 8.17443, 8.30401, 7.80944), - (7.51879, 7.77141, 7.80944)), - ((None, None, None, None, None, None), (None, None, None, None), - (None, None, None)), - (6, 4, 3))), - dictified_control_samples) - - def test_fix_samples(self): - """ - Test that `fix_samples` returns only the common samples - - Given: - - A primary trait - - A sequence of control samples - When: - - The two arguments are passed to `fix_samples` - Then: - - Only the names of the samples present in the primary trait that - are also present in ALL the control traits are present in the - return value - - Only the values of the samples present in the primary trait that - are also present in ALL the control traits are present in the - return value - - ALL the values for ALL the control traits are present in the - return value - - Only the variances of the samples present in the primary trait - that are also present in ALL the control traits are present in the - return value - - ALL the variances for ALL the control traits are present in the - return value - - The return value is a tuple of the above items, in the following - order: - ((sample_names, ...), (primary_trait_values, ...), - (control_traits_values, ...), (primary_trait_variances, ...) - (control_traits_variances, ...)) - """ - self.assertEqual( - fix_samples( - {"B6cC3-1": {"sample_name": "B6cC3-1", "value": 7.51879, - "variance": None}, - "BXD1": {"sample_name": "BXD1", "value": 7.77141, - "variance": None}, - "BXD2": {"sample_name": "BXD2", "value": 7.80944, - "variance": None}}, - dictified_control_samples), - (("BXD2",), (7.80944,), - (7.51879, 7.77141, 8.39265, 8.17443, 8.30401, 7.80944, 8.39265, - 8.17443, 8.30401, 7.80944, 7.51879, 7.77141, 7.80944), - (None,), - (None, None, None, None, None, None, None, None, None, None, None, - None, None))) - - def test_find_identical_traits(self): - """ - Test `gn3.partial_correlations.find_identical_traits`. - - Given: - - the name of a primary trait - - the value of a primary trait - - a sequence of names of control traits - - a sequence of values of control traits - When: - - the arguments above are passed to the `find_identical_traits` - function - Then: - - Return ALL trait names that have the same value when up to three - decimal places are considered - """ - for primn, primv, contn, contv, expected in ( - ("pt", 12.98395, ("ct0", "ct1", "ct2"), - (0.1234, 2.3456, 3.4567), tuple()), - ("pt", 12.98395, ("ct0", "ct1", "ct2"), - (12.98354, 2.3456, 3.4567), ("pt", "ct0")), - ("pt", 12.98395, ("ct0", "ct1", "ct2", "ct3"), - (0.1234, 2.3456, 0.1233, 4.5678), ("ct0", "ct2")) - ): - with self.subTest( - primary_name=primn, primary_value=primv, - control_names=contn, control_values=contv): - self.assertEqual( - find_identical_traits(primn, primv, contn, contv), expected) -- cgit v1.2.3 From a85db849660a63b09e5c40f7753d861f47eaaaeb Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 06:37:24 +0300 Subject: Add missing comma Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi --- gn3/db/species.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/db/species.py b/gn3/db/species.py index abcbf64..702a9a8 100644 --- a/gn3/db/species.py +++ b/gn3/db/species.py @@ -48,7 +48,7 @@ def translate_to_mouse_gene_id(species: str, geneid: int, conn: Any) -> int: with conn.cursor as cursor: query = { - "rat": "SELECT mouse FROM GeneIDXRef WHERE rat = %s" + "rat": "SELECT mouse FROM GeneIDXRef WHERE rat = %s", "human": "SELECT mouse FROM GeneIDXRef WHERE human = %s" } cursor.execute(query[species], geneid) -- cgit v1.2.3 From 5a9db2162a0a694a76a256996bb296ff06c75126 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 06:59:57 +0300 Subject: Move `correlations_of_all_tissue_traits` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: new function (`correlations_of_all_tissue_traits`). * gn3/db/correlations.py: delete function (`correlations_of_all_tissue_traits`). Move the function to `gn3.computations.partial_correlations` module and comment out the db-access code. Rework it to receive, as arguments, the data it previously fetched from the database, and add comments on future rework to get the function working again. --- gn3/computations/partial_correlations.py | 27 +++++++++++++++++++++++++++ gn3/db/correlations.py | 20 -------------------- 2 files changed, 27 insertions(+), 20 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index e73edfd..4ba2ba4 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -157,3 +157,30 @@ def batch_computed_tissue_correlation( `web.webqtl.correlation.correlationFunction.batchCalTissueCorr`""" raise Exception("Not implemented!") return ({}, {}) + +def correlations_of_all_tissue_traits( + primary_trait_symbol_value_dict: dict, symbol_value_dict: dict, + method: str) -> Tuple[dict, dict]: + """ + Computes and returns the correlation of all tissue traits. + + This is a migration of the + `web.webqtl.correlation.correlationFunction.calculateCorrOfAllTissueTrait` + function in GeneNetwork1. + """ + # The section below existed in the original function, but with the migration + # and the proposed rework (in the near future), the values from the database + # should be passed into this function, rather than have the function fetch + # the data for itself. + # --------------------------------------------------- + # primary_trait_symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( + # (trait_symbol,), probeset_freeze_id, conn) + # primary_trait_values = primary_trait_symbol_value_dict.vlaues()[0] + # symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( + # tuple(), probeset_freeze_id, conn) + # --------------------------------------------------- + # We might end up actually getting rid of this function all together as the + # rework is done. + primary_trait_values = primary_trait_symbol_value_dict.values()[0] + return batch_computed_tissue_correlation( + primary_trait_values, symbol_value_dict, method) diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index f43b8a5..39ed499 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -281,26 +281,6 @@ def fetch_gene_symbol_tissue_value_dict_for_trait( return fetch_gene_symbol_tissue_value_dict(xref_info[0], xref_info[2], conn) return {} -def correlations_of_all_tissue_traits( - trait_symbol: str, probeset_freeze_id: int, - method: str, conn: Any) -> Tuple[dict, dict]: - """ - Computes and returns the correlation of all tissue traits. - - This is a migration of the - `web.webqtl.correlation.correlationFunction.calculateCorrOfAllTissueTrait` - function in GeneNetwork1. - """ - primary_trait_symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( - (trait_symbol,), probeset_freeze_id, conn) - primary_trait_value = primary_trait_symbol_value_dict.vlaues()[0] - symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( - tuple(), probeset_freeze_id, conn) - if method == "1": - return batch_computed_tissue_correlation( - primaryTraitValue,SymbolValueDict,method='spearman') - return batch_computed_tissue_correlation(primaryTraitValue,SymbolValueDict) - def build_temporary_tissue_correlations_table( trait_symbol: str, probeset_freeze_id: int, method: str, return_number: int, conn: Any) -> str: -- cgit v1.2.3 From 8e3628129cdb8b1663dd2d63ce6c012335d73236 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 07:50:37 +0300 Subject: Complete implementation of `batch_computed_tissue_correlation` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Complete the implementation of the `batch_computed_tissue_correlation` function --- gn3/computations/partial_correlations.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 4ba2ba4..d095185 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -151,12 +151,17 @@ def tissue_correlation( return method_fns[method](primary_trait_values, target_trait_values) def batch_computed_tissue_correlation( - trait_value: str, symbol_value_dict: dict, - method: str = "pearson") -> Tuple[dict, dict]: + primary_trait_values: Tuple[float, ...], target_traits_dict: dict, + method: str) -> Tuple[dict, dict]: + """ + This is a migration of the + `web.webqtl.correlation.correlationFunction.batchCalTissueCorr` function in + GeneNetwork1 """ - `web.webqtl.correlation.correlationFunction.batchCalTissueCorr`""" - raise Exception("Not implemented!") - return ({}, {}) + def __corr__(acc, target): + corr = tissue_correlation(primary_trait_values, target[1], method) + return ({**acc[0], target[0]: corr[0]}, {**acc[0], target[1]: corr[1]}) + return reduce(__corr__, target_traits_dict.items(), ({}, {})) def correlations_of_all_tissue_traits( primary_trait_symbol_value_dict: dict, symbol_value_dict: dict, -- cgit v1.2.3 From 773c0896ccbed12170be2b5aed4554ab86d923b5 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 08:00:27 +0300 Subject: Complete `build_temporary_tissue_correlations_table` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: Remove comments after updating usage of the function at call point * gn3/db/correlations.py: Complete the implementation of the `build_temporary_tissue_correlations_table` function --- gn3/computations/partial_correlations.py | 13 ------------ gn3/db/correlations.py | 36 +++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 16 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index d095185..5777a0b 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -173,19 +173,6 @@ def correlations_of_all_tissue_traits( `web.webqtl.correlation.correlationFunction.calculateCorrOfAllTissueTrait` function in GeneNetwork1. """ - # The section below existed in the original function, but with the migration - # and the proposed rework (in the near future), the values from the database - # should be passed into this function, rather than have the function fetch - # the data for itself. - # --------------------------------------------------- - # primary_trait_symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( - # (trait_symbol,), probeset_freeze_id, conn) - # primary_trait_values = primary_trait_symbol_value_dict.vlaues()[0] - # symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( - # tuple(), probeset_freeze_id, conn) - # --------------------------------------------------- - # We might end up actually getting rid of this function all together as the - # rework is done. primary_trait_values = primary_trait_symbol_value_dict.values()[0] return batch_computed_tissue_correlation( primary_trait_values, symbol_value_dict, method) diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index 39ed499..28f050a 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -290,10 +290,40 @@ def build_temporary_tissue_correlations_table( This is a migration of the `web.webqtl.correlation.CorrelationPage.getTempTissueCorrTable` function in GeneNetwork1.""" + # We should probably pass the `correlations_of_all_tissue_traits` function + # as an argument to this function and get rid of the two lines immediately + # following this comment. + from gn3.computations.partial_correlations import correlations_of_all_tissue_traits symbol_corr_dict, symbol_p_value_dict = correlations_of_all_tissue_traits( - trait_symbol, probeset_freeze_id, method, conn) - raise Exception("Unimplemented!!!") - return "" + fetch_gene_symbol_tissue_value_dict_for_trait( + (trait_symbol,), probeset_freeze_id, conn), + fetch_gene_symbol_tissue_value_dict_for_trait( + tuple(), probeset_freeze_id, conn), + method) + + symbol_corr_list = sorted( + symbol_corr_dict.items(), + key=compare_tissue_correlation_absolute_values) + + temp_table_name = f"TOPTISSUE{random_string(8)}" + create_query = ( + "CREATE TEMPORARY TABLE {temp_table_name}" + "(Symbol varchar(100) PRIMARY KEY, Correlation float, PValue float)") + insert_query = ( + f"INSERT INTO {temp_table_name}(Symbol, Correlation, PValue) " + " VALUES (%(symbol)s, %(correlation)s, %(pvalue)s)") + + with conn.cursor() as cursor: + cursor.execute(create_query) + cursor.execute( + insert_query, + tuple({ + "symbol": symbol, + "correlation": corr, + "pvalue": symbol_p_value_dict[symbol] + } for symbol, corr in symbol_corr_list[0: 2 * return_number])) + + return temp_table_name def fetch_tissue_correlations( dataset: dict, trait_symbol: str, probeset_freeze_id: int, method: str, -- cgit v1.2.3 From 307a83b897b9ece7c9dd1af49bdedc9e1320eb61 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 08:25:13 +0300 Subject: Rework sorting: remove `compare_tissue_correlation_absolute_values` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/db/correlations.py: Remove the `compare_tissue_correlation_absolute_values` function which is no longer needed. --- gn3/db/correlations.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index 28f050a..d7954e5 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -140,22 +140,6 @@ def fetch_literature_correlations( cursor.execute("DROP TEMPORARY TABLE %s", temp_table) return dict(results) -def compare_tissue_correlation_absolute_values(val1, val2): - """ - Comparison function for use when sorting tissue correlation values. - - This is a partial migration of the - `web.webqtl.correlation.CorrelationPage.getTempTissueCorrTable` function in - GeneNetwork1.""" - try: - if abs(val1) < abs(val2): - return 1 - if abs(val1) == abs(val2): - return 0 - return -1 - except TypeError: - return 0 - def fetch_symbol_value_pair_dict( symbol_list: Tuple[str, ...], data_id_dict: dict, conn: Any) -> Dict[str, Tuple[float, ...]]: @@ -302,8 +286,7 @@ def build_temporary_tissue_correlations_table( method) symbol_corr_list = sorted( - symbol_corr_dict.items(), - key=compare_tissue_correlation_absolute_values) + symbol_corr_dict.items(), key=lambda key_val: key_val[1]) temp_table_name = f"TOPTISSUE{random_string(8)}" create_query = ( -- cgit v1.2.3 From 9ceb958273b8d86d220fa0d2f040fcb4a8233586 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 08:28:19 +0300 Subject: Fix linting and typing errors Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi --- gn3/computations/partial_correlations.py | 2 +- gn3/db/correlations.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 5777a0b..fce6ad2 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -173,6 +173,6 @@ def correlations_of_all_tissue_traits( `web.webqtl.correlation.correlationFunction.calculateCorrOfAllTissueTrait` function in GeneNetwork1. """ - primary_trait_values = primary_trait_symbol_value_dict.values()[0] + primary_trait_values = tuple(primary_trait_symbol_value_dict.values())[0] return batch_computed_tissue_correlation( primary_trait_values, symbol_value_dict, method) diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index d7954e5..d94759a 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -10,6 +10,8 @@ from gn3.random import random_string from gn3.data_helpers import partition_all from gn3.db.species import translate_to_mouse_gene_id +from gn3.computations.partial_correlations import correlations_of_all_tissue_traits + def get_filename(target_db_name: str, conn: Any) -> str: """ Retrieve the name of the reference database file with which correlations are @@ -275,9 +277,8 @@ def build_temporary_tissue_correlations_table( `web.webqtl.correlation.CorrelationPage.getTempTissueCorrTable` function in GeneNetwork1.""" # We should probably pass the `correlations_of_all_tissue_traits` function - # as an argument to this function and get rid of the two lines immediately + # as an argument to this function and get rid of the one call immediately # following this comment. - from gn3.computations.partial_correlations import correlations_of_all_tissue_traits symbol_corr_dict, symbol_p_value_dict = correlations_of_all_tissue_traits( fetch_gene_symbol_tissue_value_dict_for_trait( (trait_symbol,), probeset_freeze_id, conn), @@ -308,7 +309,7 @@ def build_temporary_tissue_correlations_table( return temp_table_name -def fetch_tissue_correlations( +def fetch_tissue_correlations(# pylint: disable=R0913 dataset: dict, trait_symbol: str, probeset_freeze_id: int, method: str, return_number: int, conn: Any) -> dict: """ -- cgit v1.2.3 From fed4c481eceb0ce464deee6262b96676eb869ad3 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 08:38:48 +0300 Subject: Specify ten (10) decimal places Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: specify 10 decimal places * tests/unit/computations/test_partial_correlations.py: update examples Slight differences in python implementations, possibly hardware and operating systems could cause the value of float (double) values to be different in the less significant parts of the decimal places. This commit limits the usable part of the decimals to the first 10 decimal places for now. --- gn3/computations/partial_correlations.py | 4 +++- tests/unit/computations/test_partial_correlations.py | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index fce6ad2..8a00931 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -148,7 +148,9 @@ def tissue_correlation( assert method in method_fns.keys(), ( "Method must be one of: {}".format(",".join(method_fns.keys()))) - return method_fns[method](primary_trait_values, target_trait_values) + return tuple( + round(n, 10) for n in + method_fns[method](primary_trait_values, target_trait_values)) def batch_computed_tissue_correlation( primary_trait_values: Tuple[float, ...], target_traits_dict: dict, diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py index ac5eb20..c4ec79a 100644 --- a/tests/unit/computations/test_partial_correlations.py +++ b/tests/unit/computations/test_partial_correlations.py @@ -254,10 +254,9 @@ class TestPartialCorrelations(TestCase): """ for primary, target, method, expected in ( ((12.34, 18.36, 42.51), (37.25, 46.25, 46.56), "pearson", - (0.6761779252651052, 0.5272701133657985)), + (0.6761779253, 0.5272701134)), ((1, 2, 3, 4, 5), (5, 6, 7, 8, 7), "spearman", - (0.8207826816681233, 0.08858700531354381)) - ): + (0.8207826817, 0.0885870053))): with self.subTest(primary=primary, target=target, method=method): self.assertEqual( tissue_correlation(primary, target, method), expected) -- cgit v1.2.3 From 5a81b7ae59702d6393e9f74a00d8394131b5192a Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 29 Oct 2021 08:48:16 +0300 Subject: Explicitly round the values * Explicitly round the values to prevent issues with the type-checker --- gn3/computations/partial_correlations.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 8a00931..151143a 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -148,9 +148,8 @@ def tissue_correlation( assert method in method_fns.keys(), ( "Method must be one of: {}".format(",".join(method_fns.keys()))) - return tuple( - round(n, 10) for n in - method_fns[method](primary_trait_values, target_trait_values)) + corr, pvalue = method_fns[method](primary_trait_values, target_trait_values) + return (round(corr, 10), round(pvalue, 10)) def batch_computed_tissue_correlation( primary_trait_values: Tuple[float, ...], target_traits_dict: dict, -- cgit v1.2.3 From 4a6be7e1b6514f3c7db8c672970b27e27ecde305 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 1 Nov 2021 06:01:58 +0300 Subject: Add some condition checking functions Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Add the `check_for_literature_info` and `check_symbol_for_tissue_correlation` functions to check for the presence of specific data. --- gn3/db/correlations.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index d94759a..06b3310 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -339,3 +339,43 @@ def fetch_tissue_correlations(# pylint: disable=R0913 return { trait_name: (tiss_corr, tiss_p_val) for trait_name, tiss_corr, tiss_p_val in results} + +def check_for_literature_info(conn: Any, geneid: int) -> bool: + """ + Checks the database to find out whether the trait with `geneid` has any + associated literature. + + This is a migration of the + `web.webqtl.correlation.CorrelationPage.checkForLitInfo` function in + GeneNetwork1. + """ + query = "SELECT 1 FROM LCorrRamin3 WHERE GeneId1=%s LIMIT 1" + with conn.cursor() as cursor: + cursor.execute(query, geneid) + result = cursor.fetchone() + if result: + return True + + return False + +def check_symbol_for_tissue_correlation( + conn: Any, tissue_probeset_freeze_id: int, symbol: str = "") -> bool: + """ + Checks whether a symbol has any associated tissue correlations. + + This is a migration of the + `web.webqtl.correlation.CorrelationPage.checkSymbolForTissueCorr` function + in GeneNetwork1. + """ + query = ( + "SELECT 1 FROM TissueProbeSetXRef " + "WHERE TissueProbeSetFreezeId=%(probeset_freeze_id)s " + "AND Symbol=%(symbol)s LIMIT 1") + with conn.cursor() as cursor: + cursor.execute( + query, probeset_freeze_id=tissue_probeset_freeze_id, symbol=symbol) + result = cursor.fetchone() + if result: + return True + + return False -- cgit v1.2.3 From ff23701bbfd90799f04fdf21c482f113bb408e34 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 1 Nov 2021 07:09:26 +0300 Subject: Parse single line from CSV file Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/data_helpers.py: New function (parse_csv_line) * tests/unit/test_data_helpers.py: Add tests for new function (parse_csv_line) Add a function to parse a single line from a CSV file. --- gn3/data_helpers.py | 13 ++++++++++++- tests/unit/test_data_helpers.py | 26 +++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) (limited to 'gn3') diff --git a/gn3/data_helpers.py b/gn3/data_helpers.py index f0d971e..741a885 100644 --- a/gn3/data_helpers.py +++ b/gn3/data_helpers.py @@ -5,7 +5,7 @@ data structures. from math import ceil from functools import reduce -from typing import Any, Tuple, Sequence +from typing import Any, Tuple, Sequence, Optional def partition_all(num: int, items: Sequence[Any]) -> Tuple[Tuple[Any, ...], ...]: """ @@ -23,3 +23,14 @@ def partition_all(num: int, items: Sequence[Any]) -> Tuple[Tuple[Any, ...], ...] tuple(items[start:stop]) for start, stop # type: ignore[has-type] in reduce( __compute_start_stop__, iterations, tuple())]) + +def parse_csv_line( + line:str, delimiter: str = ",", quoting:Optional[str] = '"') -> Tuple[str, ...]: + """ + Parses a line from a CSV file into a tuple of strings. + + This is a migration of the `web.webqtl.utility.webqtlUtil.readLineCSV` + function in GeneNetwork1. + """ + return tuple( + col.strip("{} \t\n".format(quoting)) for col in line.split(delimiter)) diff --git a/tests/unit/test_data_helpers.py b/tests/unit/test_data_helpers.py index 1eec3cc..39aea45 100644 --- a/tests/unit/test_data_helpers.py +++ b/tests/unit/test_data_helpers.py @@ -4,7 +4,7 @@ Test functions in gn3.data_helpers from unittest import TestCase -from gn3.data_helpers import partition_all +from gn3.data_helpers import partition_all, parse_csv_line class TestDataHelpers(TestCase): """ @@ -35,3 +35,27 @@ class TestDataHelpers(TestCase): ((0, 1, 2, 3, 4, 5, 6, 7, 8, 9), ))): with self.subTest(n=count, items=items): self.assertEqual(partition_all(count, items), expected) + + def test_parse_csv_line(self): + """ + Test parsing a single line from a CSV file + + Given: + - `line`: a line read from a csv file + - `delimiter`: the expected delimiter in the csv file + - `quoting`: the quoting enclosing each column in the csv file + When: + - `line` is parsed with the `parse_csv_file` with the given + parameters + Then: + - return a tuple of the columns in the CSV file, without the + delimiter and quoting + """ + for line, delimiter, quoting, expected in ( + ('"this","is","a","test"', ",", '"', ("this", "is", "a", "test")), + ('"this","is","a","test"', ",", None, ('"this"', '"is"', '"a"', '"test"'))): + with self.subTest(line=line, delimiter=delimiter, quoting=quoting): + self.assertEqual( + parse_csv_line( + line=line, delimiter=delimiter, quoting=quoting), + expected) -- cgit v1.2.3 From 4ecaae288c78f8c3b4b6b40b56de3ba392ecc1bd Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 1 Nov 2021 08:17:41 +0300 Subject: Fix some linting errors Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi --- gn3/data_helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/data_helpers.py b/gn3/data_helpers.py index 741a885..d3f942b 100644 --- a/gn3/data_helpers.py +++ b/gn3/data_helpers.py @@ -25,7 +25,8 @@ def partition_all(num: int, items: Sequence[Any]) -> Tuple[Tuple[Any, ...], ...] __compute_start_stop__, iterations, tuple())]) def parse_csv_line( - line:str, delimiter: str = ",", quoting:Optional[str] = '"') -> Tuple[str, ...]: + line: str, delimiter: str = ",", + quoting: Optional[str] = '"') -> Tuple[str, ...]: """ Parses a line from a CSV file into a tuple of strings. -- cgit v1.2.3 From 856ee56890f9c10401b717579dc8c0358c7d465d Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 1 Nov 2021 08:18:48 +0300 Subject: Retrieve indices of the selected samples Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: New function (good_dataset_samples_indexes). * tests/unit/computations/test_partial_correlations.py: Tests for new function (good_dataset_samples_indexes) Get the indices of the selected samples. This is a partial migration of the `web.webqtl.correlation.PartialCorrDBPage.getPartialCorrelationsFast` function in GN1. --- gn3/computations/partial_correlations.py | 15 +++++++++++++++ tests/unit/computations/test_partial_correlations.py | 13 ++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 151143a..ba4de9e 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -177,3 +177,18 @@ def correlations_of_all_tissue_traits( primary_trait_values = tuple(primary_trait_symbol_value_dict.values())[0] return batch_computed_tissue_correlation( primary_trait_values, symbol_value_dict, method) + +def good_dataset_samples_indexes( + samples: Tuple[str, ...], + samples_from_file: Tuple[str, ...]) -> Tuple[int, ...]: + """ + Return the indexes of the items in `samples_from_files` that are also found + in `samples`. + + This is a partial migration of the + `web.webqtl.correlation.PartialCorrDBPage.getPartialCorrelationsFast` + function in GeneNetwork1. + """ + return tuple(sorted( + samples_from_file.index(good) for good in + set(samples).intersection(set(samples_from_file)))) diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py index c4ec79a..f7217a9 100644 --- a/tests/unit/computations/test_partial_correlations.py +++ b/tests/unit/computations/test_partial_correlations.py @@ -6,7 +6,8 @@ from gn3.computations.partial_correlations import ( control_samples, dictify_by_samples, tissue_correlation, - find_identical_traits) + find_identical_traits, + good_dataset_samples_indexes) sampleslist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] control_traits = ( @@ -260,3 +261,13 @@ class TestPartialCorrelations(TestCase): with self.subTest(primary=primary, target=target, method=method): self.assertEqual( tissue_correlation(primary, target, method), expected) + + def test_good_dataset_samples_indexes(self): + """ + Test that `good_dataset_samples_indexes` returns correct indices. + """ + self.assertEqual( + good_dataset_samples_indexes( + ("a", "e", "i", "k"), + ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l")), + (0, 4, 8, 10)) -- cgit v1.2.3 From 457f2a8473a1d44dfcb66d0c28aa1c7a3a256c85 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 1 Nov 2021 10:49:35 +0300 Subject: Implement `compute_partial_correlations_fast` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Implement `compute_partial_correlations_fast` that is a partial migration of `web.webqtl.correlation.PartialCorrDBPage.getPartialCorrelationsFast` in GN1. This function will probably be reworked once the dependencies are fully migrated. It also needs tests to be added. --- gn3/computations/partial_correlations.py | 49 ++++++++++++++++++++++++++++++++ gn3/settings.py | 3 ++ 2 files changed, 52 insertions(+) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index ba4de9e..1a6868a 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -9,6 +9,9 @@ from functools import reduce from typing import Any, Tuple, Sequence from scipy.stats import pearsonr, spearmanr +from gn3.settings import TEXTDIR +from gn3.data_helpers import parse_csv_line + def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): """ Fetches data for the control traits. @@ -192,3 +195,49 @@ def good_dataset_samples_indexes( return tuple(sorted( samples_from_file.index(good) for good in set(samples).intersection(set(samples_from_file)))) + +def compute_partial_correlations_fast(# pylint: disable=[R0913, R0914] + samples, primary_vals, control_vals, database_filename, + fetched_correlations, method: str, correlation_type: str) -> Tuple[ + float, Tuple[float, ...]]: + """ + This is a partial migration of the + `web.webqtl.correlation.PartialCorrDBPage.getPartialCorrelationsFast` + function in GeneNetwork1. + """ + assert method in ("spearman", "pearson") + with open(f"{TEXTDIR}/{database_filename}", "r") as dataset_file: + dataset = tuple(dataset_file.readlines()) + + good_dataset_samples = good_dataset_samples_indexes( + samples, parse_csv_line(dataset[0])[1:]) + + def __process_trait_names_and_values__(acc, line): + trait_line = parse_csv_line(line) + trait_name = trait_line[0] + trait_data = trait_line[1:] + if trait_name in fetched_correlations.keys(): + return ( + acc[0] + (trait_name,), + acc[1] + tuple( + trait_data[i] if i in good_dataset_samples else None + for i in range(len(trait_data)))) + return acc + + processed_trait_names_values: tuple = reduce( + __process_trait_names_and_values__, dataset[1:], (tuple(), tuple())) + all_target_trait_names: Tuple[str, ...] = processed_trait_names_values[0] + all_target_trait_values: Tuple[float, ...] = processed_trait_names_values[1] + + all_correlations = determine_partials( + primary_vals, control_vals, all_target_trait_names, + all_target_trait_values, method) + ## Line 772 to 779 in GN1 are the cause of the weird complexity in the + ## return below. Once the surrounding code is successfully migrated and + ## reworked, this complexity might go away, by getting rid of the + ## `correlation_type` parameter + return len(all_correlations), tuple( + corr + ( + (fetched_correlations[corr[0]],) if correlation_type == "literature" + else fetched_correlations[corr[0]][0:2]) + for idx, corr in enumerate(all_correlations)) diff --git a/gn3/settings.py b/gn3/settings.py index e85eeff..57c63df 100644 --- a/gn3/settings.py +++ b/gn3/settings.py @@ -50,3 +50,6 @@ CORS_HEADERS = [ "Authorization", "Access-Control-Allow-Credentials" ] + +GNSHARE = os.environ.get("GNSHARE", "/gnshare/gn/") +TEXTDIR = f"{GNSHARE}/web/ProbeSetFreeze_DataMatrix" -- cgit v1.2.3 From ead4481077922d7f307475e6bc04e617d6594a99 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 1 Nov 2021 10:52:13 +0300 Subject: Stub `determine_partials` Issue: * Stub out `determine_partials` which is a migration of `web.webqtl.correlation.correlationFunction.determinePartialsByR` in GN1. The function in GN1 has R code from line 188 to line 344. This will need to be converted over to Python. This function will also need tests. --- gn3/computations/partial_correlations.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 1a6868a..fb372a9 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -196,6 +196,22 @@ def good_dataset_samples_indexes( samples_from_file.index(good) for good in set(samples).intersection(set(samples_from_file)))) +def determine_partials( + primary_vals, control_vals, all_target_trait_names, + all_target_trait_values, method): + """ + This **WILL** be a migration of + `web.webqtl.correlation.correlationFunction.determinePartialsByR` function + in GeneNetwork1. + + The function in GeneNetwork1 contains code written in R that is then used to + compute the partial correlations. + """ + ## This function is not implemented at this stage + return tuple( + primary_vals, control_vals, all_target_trait_names, + all_target_trait_values, method) + def compute_partial_correlations_fast(# pylint: disable=[R0913, R0914] samples, primary_vals, control_vals, database_filename, fetched_correlations, method: str, correlation_type: str) -> Tuple[ -- cgit v1.2.3 From 78c1d118ca31e2c0d4cd12afe8c8426974ee82e2 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 4 Nov 2021 08:51:50 +0300 Subject: Create blackbox tests for some functions migrated from R Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: new stub functions (partial_correlation_matrix, partial_correlation_recursive) * tests/unit/computations/partial_correlations_test_data/pcor_mat_blackbox_test.csv: blackbox sample data and results for variance-covariance matrix method * tests/unit/computations/partial_correlations_test_data/pcor_rec_blackbox_test.csv: blackbox sample data and results for recursive method * tests/unit/computations/test_partial_correlations.py: Tests for new function Provide some blackbox testing sample data for checking the operation of the functions migrated from R. --- gn3/computations/partial_correlations.py | 30 ++++++ .../pcor_mat_blackbox_test.csv | 101 +++++++++++++++++++++ .../pcor_rec_blackbox_test.csv | 101 +++++++++++++++++++++ .../unit/computations/test_partial_correlations.py | 61 ++++++++++++- 4 files changed, 292 insertions(+), 1 deletion(-) create mode 100644 tests/unit/computations/partial_correlations_test_data/pcor_mat_blackbox_test.csv create mode 100644 tests/unit/computations/partial_correlations_test_data/pcor_rec_blackbox_test.csv (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index fb372a9..07dc16d 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -257,3 +257,33 @@ def compute_partial_correlations_fast(# pylint: disable=[R0913, R0914] (fetched_correlations[corr[0]],) if correlation_type == "literature" else fetched_correlations[corr[0]][0:2]) for idx, corr in enumerate(all_correlations)) + +def partial_correlation_matrix( + xdata: Tuple[float, ...], ydata: Tuple[float, ...], + zdata: Tuple[float, ...], method: str = "pearsons", + omit_nones: bool = True) -> float: + """ + Computes the partial correlation coefficient using the + 'variance-covariance matrix' method + + This is a partial migration of the + `web.webqtl.correlation.correlationFunction.determinPartialsByR` function in + GeneNetwork1, specifically the `pcor.mat` function written in the R + programming language. + """ + return 0 + +def partial_correlation_recursive( + xdata: Tuple[float, ...], ydata: Tuple[float, ...], + zdata: Tuple[float, ...], method: str = "pearsons", + omit_nones: bool = True) -> float: + """ + Computes the partial correlation coefficient using the 'recursive formula' + method + + This is a partial migration of the + `web.webqtl.correlation.correlationFunction.determinPartialsByR` function in + GeneNetwork1, specifically the `pcor.rec` function written in the R + programming language. + """ + return 0 diff --git a/tests/unit/computations/partial_correlations_test_data/pcor_mat_blackbox_test.csv b/tests/unit/computations/partial_correlations_test_data/pcor_mat_blackbox_test.csv new file mode 100644 index 0000000..a1558a0 --- /dev/null +++ b/tests/unit/computations/partial_correlations_test_data/pcor_mat_blackbox_test.csv @@ -0,0 +1,101 @@ +"function_name","count","x","y","z","method","rm","result" +"pcor.mat",13,"-89.1427156049758, -70.2603165991604, 52.4590492714196, -57.2846714872867, -26.3361851219088, -0.000567594543099403, 17.9622953757644, -64.1319836024195, 39.2497098539025, 20.8931459579617, 74.1897551808506, -35.3126015048474, -55.9552798978984","47.3745858296752, -68.9209029078484, -31.9765134248883, -45.0486478861421, -85.1716816890985, 65.432888455689, 19.2734406329691, 87.9198614973575, -68.2076670229435, -38.1280574947596, 52.754437038675, -73.271297942847, 67.7760738879442","-78.9239354431629, -85.3030194528401, -20.3673145733774, -22.6184178609401, 16.5013548452407, 18.5637861024588, 96.5889988467097, 36.156284250319, 35.1589790545404, -73.1023930944502, -50.7484216243029, 41.8345319107175, -47.8776978328824","s",TRUE,-0.0325789017360908 +"pcor.mat",18,"64.013504376635, 53.1150240916759, -77.8307237662375, -33.1533540505916, -13.6034480296075, 93.2804300449789, -46.3470680173486, 17.427362408489, -66.663983091712, 4.23776390962303, 77.7521491982043, -3.10332304798067, -61.5989458281547, -13.5284000542015, 7.71856023930013, 89.0885920263827, -35.3556916583329, -95.9261478390545","-35.6941626407206, 41.877265740186, 69.6430462878197, 64.2008605413139, -59.4343301840127, 79.7348674852401, 61.3097242545336, 9.0187989640981, 51.7997904680669, 45.9638734348118, 41.0136769060045, -73.4738738741726, -47.0628185197711, 57.6456079725176, -2.5194660294801, -53.7642545998096, 18.9816055819392, -54.8453160561621","-55.6193302385509, 63.7390994466841, 85.8707739040256, -77.2866525221616, 29.9346832558513, -24.1673247888684, -61.8650471325964, 19.6793714072555, -60.1225732360035, 12.063248641789, -51.2589928694069, -41.5690367575735, -58.2409225869924, 37.0499972254038, -9.5894614700228, 2.70932037383318, 56.0281782411039, -39.5718538668007","s",FALSE,-0.0406099988399257 +"pcor.mat",18,"56.9747474044561, 55.6495593860745, -36.6002877708524, 61.6530403494835, -11.1073412466794, -70.2817751094699, 34.5848673954606, -40.1073589455336, 22.4086964968592, -34.9243235308677, -31.6865964792669, -81.9148152600974, -7.01485783793032, -0.294096721336246, -19.4921953603625, -55.370055232197, 33.2327066455036, -65.3158040251583","-13.8067095074803, -83.5349172819406, -12.6486663240939, -8.66694604046643, 86.2149322871119, 60.7879475224763, -73.3523240312934, 34.5676413737237, -4.87876599654555, 18.5876747593284, 89.8641737177968, -72.3610286135226, -32.7410754282027, 27.3812759667635, -45.791448559612, 80.4758272599429, -76.585627021268, -36.1723904497921","49.7649329714477, -56.3095143996179, 92.719935066998, -17.5905505660921, -34.11227283068, 8.69290293194354, 51.1472036596388, -52.1146316081285, 18.716375855729, 44.0671648364514, -81.5424187108874, 17.9900521878153, 83.1838137004524, -36.2067365087569, 6.58109332434833, 33.7925261352211, 43.0417039897293, -24.2647144943476","s",FALSE,-0.326536819677434 +"pcor.mat",16,"-27.0166050642729, 25.6161904428154, 18.0927545763552, -97.8309890720993, 83.225102070719, 41.1768469493836, 52.531653130427, 90.7089609187096, 45.9316388238221, 44.4865159224719, -65.3349446132779, -63.2685597520322, -63.5370531585068, -20.7488086074591, -21.5636825188994, 70.8061812445521","89.9359612260014, -24.0224461536855, -88.7139027938247, 33.0363452900201, 89.8786358069628, 72.6242340635508, -33.4980245213956, 18.209078675136, -98.510293290019, -45.0928752310574, -56.3632266130298, 36.2233767751604, 24.8566114809364, 41.1938649136573, 98.1815246865153, -31.8091072142124","-83.4077485837042, 67.2828705515712, -46.1948299780488, 44.6621300186962, -68.071247311309, 69.5944227278233, -72.4484366830438, -19.5607443805784, -10.3165994398296, -38.1281117442995, 92.4075163435191, 27.103430358693, 7.35686598345637, -68.8319525215775, -35.345290414989, -22.3868970759213","s",FALSE,-0.265133848612843 +"pcor.mat",16,"62.6007101032883, -31.4669733867049, -1.02701690047979, 89.1588015947491, 89.4676355645061, 72.146376548335, -48.5373890493065, 27.8906877152622, 84.9362426437438, 22.9195747990161, -0.477400049567223, -55.017494270578, 16.0360316745937, -40.5794956721365, -76.5294233337045, 99.2066614329815","32.9774639569223, 99.4476685766131, 19.444046029821, -87.4037025496364, -49.6627463493496, -79.1786927729845, 69.5362528320402, -42.9193137213588, 88.4448691736907, 96.2614195886999, 99.7840614058077, -30.6426415685564, 52.9562290757895, -75.0585582572967, -92.611052794382, 67.6107355859131","99.6344119310379, -43.7020116951317, -14.1780937556177, 29.8982600681484, 67.7026726771146, 12.5789169687778, 5.22102704271674, 47.3305377177894, -10.2066915482283, 44.158894661814, 16.616974119097, 67.5522029399872, 10.2959530893713, 2.26272544823587, -24.1713169030845, -81.4385517500341","k",FALSE,0.00170394349277265 +"pcor.mat",17,"-43.6796560417861, -52.3636834230274, -32.689885282889, 29.6649182215333, 70.8439419511706, -78.822322236374, -7.2787752840668, -37.7680024132133, -9.91778918541968, 45.4824290703982, -1.96461407467723, -10.768158081919, -71.2498663924634, 23.788648378104, 81.2093367334455, -29.8483492340893, 42.7211379166692","54.4582905247808, 2.90980748832226, -49.7587429825217, 90.0067212525755, -62.2195774223655, 49.5222055818886, 64.7147801704705, -30.6467334739864, 43.9336315263063, -24.3989814538509, 93.3036277070642, -5.72181586176157, -51.6447205562145, 71.4890264440328, 35.5837760493159, -39.9753636214882, 64.5502870436758","-86.5306067280471, -2.41111759096384, 17.8865785710514, -66.7758407536894, -45.9109436254948, -99.6982547920197, 9.07599623315036, -49.4003663770854, -50.0817076303065, -52.7716889511794, 9.27476715296507, -1.14214201457798, -14.0225571580231, -46.0782612208277, 97.4677567835897, -70.6407638732344, -99.1432263981551","p",TRUE,0.181498113250831 +"pcor.mat",14,"-4.90339081734419, 72.9479049798101, 46.9192364253104, 92.628131667152, 56.5425228327513, 9.90580045618117, -61.4272825885564, 33.6759516969323, 81.8828757386655, 77.3399218916893, 67.7938031964004, 94.0767949912697, 82.1635375730693, -75.240781577304","21.4586552698165, -36.5642888005823, -38.3646843954921, -49.740192014724, -81.6746165510267, -19.1730958875269, 41.690668836236, -23.3391010668129, -78.1760632060468, 77.431286778301, 70.3289750963449, 39.766847435385, 3.62148815765977, 10.747673548758","17.7063988521695, 90.0697568897158, -93.0447159335017, 85.4728828649968, -18.4118247125298, -9.85785778611898, 70.2666643075645, -97.7391937281936, 54.3527046684176, -51.4394805766642, 39.0205434523523, -25.6685835774988, -14.7992834448814, 81.1236747074872","p",FALSE,-0.21445656018345 +"pcor.mat",15,"-76.8736738711596, -35.8509941026568, -48.1256343889982, -9.57123078405857, -72.2122399602085, -6.98926709592342, -31.3491718843579, 74.3320995010436, 54.9155391287059, -46.5018933173269, 51.3019453268498, 17.0857016462833, -99.9900157097727, -17.3139852005988, -85.5749220587313","-97.7581001352519, -97.2672377247363, -27.3427923209965, -1.21665806509554, -8.05344670079648, 21.0991605184972, -54.0536799002439, 95.0312656350434, 23.7382718361914, -98.728937190026, -80.2528636530042, -59.6354123670608, 20.57563085109, 90.7686199061573, 19.6493336930871","-38.4617018979043, 28.0117013957351, -74.6210919693112, -34.3639187980443, -28.0167740304023, -46.0126685444266, 37.4354778788984, 41.0279822535813, 80.8140107430518, -94.7356107644737, -91.9223290402442, -34.4586562830955, 90.2129443362355, 76.8807396292686, 80.0070276483893","k",FALSE,0.250746493151452 +"pcor.mat",7,"-66.7350410018116, 53.2712059561163, -43.8059563748538, -44.9987557251006, -67.2016165219247, 17.9846523795277, 77.0553316920996","-60.9613332431763, 99.9187499284744, -27.7070741169155, 14.3416102975607, -30.3307291120291, 5.47642167657614, -52.1709493827075","5.97298364154994, 70.3716231975704, -16.247583553195, 92.1821707859635, -80.4653100203723, -7.83197041600943, -66.9684283901006","k",TRUE,0.241209075662211 +"pcor.mat",18,"94.380710972473, -10.0111012812704, 85.1797969080508, -11.4021800924093, -99.7310696635395, -57.7457085251808, -34.8813917022198, 37.1367971878499, -57.5784567277879, 17.9361389484257, -20.6278771162033, -42.8640173282474, -62.0093574281782, 10.7791527640074, -42.4936424475163, 31.2512285541743, -6.26639267429709, 50.0969529151917","-35.3466201107949, 51.2795441318303, -9.26330988295376, 13.2600117940456, -70.25914513506, 24.8688437044621, -95.0622762087733, -78.8527075666934, 12.5830010510981, -40.3181817382574, -62.1690618339926, 65.2437281329185, 45.4263514839113, -20.7038762047887, 19.835890410468, -16.3075220305473, 10.154833085835, 31.5655742771924","-47.5495883729309, 31.0941505245864, -11.7687386460602, 47.550484072417, 19.7334853932261, 59.856044081971, 38.4999468922615, -29.1666014585644, -77.8870329726487, 75.2757792361081, -17.8823099005967, -93.2831089943647, -73.6799968872219, -36.3856283016503, 21.7388028744608, -41.7408903129399, -21.9456392340362, 5.71200731210411","p",TRUE,-0.153597125133576 +"pcor.mat",15,"-83.3593410905451, 33.8860942982137, 17.5660732202232, 44.9482867959887, 3.40795461088419, -98.6972364131361, -57.9294378869236, 49.1425832267851, -81.4089713152498, 22.2765766549855, -15.2078927494586, 64.7270672023296, -77.9068617615849, -13.5009704623371, -41.0612959414721","99.4176274631172, -28.8145580794662, 24.2324681021273, 70.3792416490614, 55.1269176416099, -46.6643883381039, 13.5340544395149, -81.6506992094219, 7.58900847285986, 76.2214359361678, -21.0444819182158, -19.7882746346295, -77.8520357329398, -60.2931962348521, -30.685667693615","-7.22203818149865, -62.021238123998, -34.5286842435598, -67.4230553675443, -62.1439764276147, -99.2042647209018, 7.09792547859251, -88.8404605910182, 79.5403079129755, 68.8092908356339, -87.8009828273207, -11.8701789993793, -40.4039821587503, -50.0366650056094, 61.1679489258677","p",TRUE,0.134662220884382 +"pcor.mat",18,"36.4026268012822, -40.8853712491691, 70.4748715274036, -93.3088712859899, -31.1693381983787, 44.5810994133353, -29.8538233153522, -55.898003000766, -83.1116971559823, 95.2613319735974, -86.9839164428413, -99.6416668407619, -71.7915004119277, 86.375200515613, 73.0707975570112, 9.46915657259524, 30.3790966048837, -32.9175783321261","20.2463141642511, 35.3073101490736, 96.6094605624676, 38.2854318711907, 20.0914516113698, -76.2724542990327, -2.5904384907335, 28.1036204192787, 27.5573522783816, 41.8770257849246, 17.9975534323603, -53.0143345706165, -1.92109285853803, -43.1404768954962, -89.0914923511446, -75.2585290931165, 31.8984744139016, -81.7458927165717","99.058653973043, -73.045432055369, -98.9125271327794, -10.9370147343725, 93.4558239299804, 21.3814281392843, -10.9608757775277, -94.0566421952099, 29.180516814813, 60.7905065640807, -69.4182314909995, 27.9442990664393, 16.5212750900537, -65.4938052408397, -91.3346993271261, -19.3851371761411, 54.6318108215928, 94.2573416978121","s",TRUE,-0.0480625888230071 +"pcor.mat",8,"70.9466312080622, -31.7683406174183, 25.0176505185664, -56.8918467033654, -9.20995227061212, 84.6444204915315, 66.9992076698691, -14.915213920176","-25.2351951319724, 53.1852985266596, 32.9547242727131, -82.4257594533265, -51.8481220584363, 61.490266257897, 16.8974718544632, -71.770367724821","25.6255140993744, 62.6514744479209, 2.26075490936637, -90.3473023790866, -8.56978320516646, 89.0561478678137, 3.07730589993298, 45.6199106760323","p",FALSE,0.307942034203085 +"pcor.mat",18,"23.8564316183329, -16.3905590772629, -12.3555054422468, 78.1761512625962, 49.3263760115951, 13.6127803940326, -35.0881972815841, 18.7167634721845, 47.3916597198695, 6.6052196547389, -47.4990267306566, 36.3517801277339, 77.3957766592503, -70.3038077335805, -28.512022132054, 93.2541827205569, -50.6320198066533, 2.28197425603867","4.66441703028977, 52.664560964331, 64.6692745853215, 64.0807087533176, -42.2254925593734, -28.3238022122532, 84.3502655625343, -22.6033370010555, -63.9537113253027, -82.1724142879248, -47.163494117558, 86.9036048650742, -25.5253764800727, -40.6565339770168, -64.6023235283792, 5.88995609432459, 60.3537472430617, -12.8357082139701","-7.05419671721756, 17.8630999755114, -94.5426801219583, -90.8921510912478, -52.0795451011509, 52.0008019171655, 77.9491205234081, -64.4113312475383, -13.6109072715044, -84.2732723336667, 57.4606000445783, 57.2238144930452, -17.8435018286109, 78.159570787102, -64.3654571380466, 25.7219140883535, 21.2949032895267, -89.99102874659","s",FALSE,0.098864763229466 +"pcor.mat",8,"36.1457616556436, 98.2861819211394, 40.8350063487887, 63.7187578249723, 13.0914898123592, -52.3402118124068, -13.3677611593157, 73.598525673151","79.2985305655748, -71.9141394365579, -0.420988909900188, -90.6284262426198, 72.2033147700131, 79.6287265606225, 20.301692513749, -54.6786930412054","96.6230187565088, -65.8682400360703, 26.0384120512754, -46.9612662214786, 47.5940535310656, -17.1155892312527, -45.7220804877579, -67.2774867620319","s",TRUE,-0.725794650937327 +"pcor.mat",6,"-57.665149634704, 94.4162191357464, -51.1441508308053, -52.6072693057358, -44.1887341905385, -14.2386069521308","-98.8703572191298, -9.2983465641737, -79.2660262435675, 23.2223530765623, 80.3647544234991, -58.0826134420931","81.1863256618381, 64.9427580181509, 45.6761348526925, 64.8033803794533, -40.9290973097086, -92.1668177470565","p",TRUE,0.118780545543647 +"pcor.mat",11,"40.5678772833198, 33.8221173267812, 65.0725501589477, 78.8693956099451, -35.8988873194903, -35.3420054074377, -87.4633281026036, 0.115021411329508, 67.6265092566609, 83.1133821513504, -18.3507286012173","-73.7955948337913, 29.9831629730761, 65.2690784074366, 25.2531439997256, -62.1108427643776, -47.4723324179649, 35.5791020672768, 26.2222751509398, 40.3645094949752, -91.2350233644247, -28.6233199760318","48.7291889730841, 33.8533046189696, 66.3264122325927, -19.7420272510499, -46.8001568224281, -39.1347371973097, 34.7272414714098, 65.1918939314783, 99.5216719806194, -29.0462920907885, 19.8831745423377","s",TRUE,-0.297493089362279 +"pcor.mat",11,"55.8680928312242, -76.9269882235676, -17.3182043712586, 15.2775115799159, -90.3137100860476, -99.032783228904, 13.8755587395281, -24.003914417699, 21.2662550620735, -8.40797564014792, -40.8448379952461","9.94491642341018, 76.8310205079615, -95.3446100465953, -74.8744533862919, -69.8509857058525, 6.55742576345801, 24.8502014670521, 97.212969744578, 29.4545858632773, -77.6854024268687, -80.0981419626623","14.1451966483146, -52.5070706848055, 52.3787314537913, 22.6627501659095, 5.18406489863992, 78.4387116320431, -37.6045362092555, -59.8206405062228, 97.1690027043223, 46.7755769845098, -23.1495135929435","k",FALSE,0.0919698779952353 +"pcor.mat",19,"12.6561464276165, 89.6340752951801, -86.4221294410527, -8.45101773738861, -79.0324212051928, -41.2799602374434, 41.9530363287777, 77.5156316813082, -98.2695916201919, 54.0546870790422, 18.4697377029806, -92.1382030006498, 22.3036497831345, -88.4184999857098, 87.4229540582746, 84.4335915520787, -86.3810521550477, -4.96541885659099, -4.21266416087747","77.7516108006239, 13.0087590776384, -52.281900215894, 46.1203761398792, -7.93849290348589, 30.4574410431087, -4.16998718865216, -76.5136891510338, 65.0717901531607, 41.985437553376, -10.8945969026536, -1.79670625366271, -80.059599224478, -27.9757288750261, -3.81275764666498, -40.5276663135737, -7.72571838460863, -21.2847925722599, -3.90572124160826","-16.1283437628299, -86.2985316198319, 15.8964606467634, 45.3664765227586, -10.7382515911013, -61.8415161035955, 75.2832551952451, 62.1664110571146, 14.5355282817036, 31.9144344422966, 63.7715006712824, 46.5569637250155, 20.0197615195066, 9.47772678919137, -79.8056298401207, -89.03838978149, 96.9052662607282, -3.97900892421603, -68.8863600604236","k",TRUE,-0.0783868693007469 +"pcor.mat",6,"41.7150890920311, 68.0406647268683, -56.6652314271778, -10.3111394215375, 72.7076691575348, 16.4696130901575","55.7349273469299, 33.0129407346249, -92.8235503379256, 67.6610651891679, -28.225592058152, 27.8548604343086","97.3419046029449, 92.7794307935983, 18.738874187693, -50.2989741973579, -31.1240924987942, -47.357566608116","k",FALSE,-0.0545544725589981 +"pcor.mat",7,"76.1037406977266, -51.2855937238783, -51.0953912511468, 61.8452743627131, 27.5623431429267, 32.935436675325, -23.7891209311783","-25.5972837097943, 35.7565317302942, -2.09780340082943, 31.380487093702, -65.0630551856011, -52.5524016004056, -45.8224846515805","35.1819013711065, 55.421924777329, 90.8943614922464, 65.8556955400854, -17.2470153309405, 50.2847956493497, -43.5768135823309","k",TRUE,-0.241209075662211 +"pcor.mat",14,"-86.9700414128602, -96.2525710929185, 13.2297853473574, 48.3323885593563, -42.72451386787, -64.586602896452, 26.2733123730868, -41.4743609726429, -27.5131822098047, -62.4261621385813, -16.2857410497963, 61.4362000953406, -71.6986550018191, 6.73192692920566","-1.76208755001426, 67.4144621472806, 40.1256877463311, 20.0672226957977, 75.7373407483101, -60.1804342586547, -24.0758131723851, -30.328988051042, 98.3264557551593, 18.7257033307105, -74.7150662820786, -66.4480000734329, 83.1373671069741, -83.8592982385308","-8.51446660235524, -33.5672379937023, 23.1306486297399, -71.0971800610423, -76.6779989469796, 17.668380215764, -6.54176617972553, 38.9708994887769, 36.8745916523039, 36.466611456126, -42.6107963547111, -43.292662827298, -34.305056463927, 3.72276022098958","k",FALSE,-0.237726218501727 +"pcor.mat",9,"87.9827535245568, 66.9526648242027, 77.764587290585, -63.0833296570927, 12.8970904741436, 12.7532111946493, -15.7931709196419, 76.1098874267191, -53.3998124301434","61.8036749772727, -53.057945612818, -21.9204508699477, -23.7275714520365, -81.9658347871155, 96.6755392961204, 23.4129578340799, -26.8468076363206, 11.6413829382509","6.22031539678574, -63.707418506965, -68.8293416053057, 51.3240036088973, -89.1044299583882, 96.3014227803797, 84.1399733442813, 3.21415988728404, -64.009400550276","p",TRUE,0.220999575445754 +"pcor.mat",18,"-2.85750310868025, -99.3862376082689, -96.015146560967, 63.2039456162602, -66.0570687614381, -66.0487032029778, -16.3392898160964, 93.4929385315627, -0.228785490617156, -94.138465821743, 89.7544200066477, -39.7632111795247, -60.3579618502408, -34.7465238533914, 49.7126227244735, 56.9427436217666, 69.6163312997669, -16.7142637073994","67.1196629293263, -69.1413426306099, 90.1762881316245, -33.8058187626302, 73.66002057679, 34.5961081795394, -59.5154983922839, 1.26353777013719, 48.2069759164006, -34.2219550162554, 14.3829472362995, 41.6792382951826, 39.1247006133199, -38.8760752510279, -11.6304269526154, -13.3687050547451, -5.31534324400127, -2.51060193404555","-86.3554051145911, 29.0978434961289, -95.5027301795781, 63.6454623192549, -29.499419266358, 73.207819275558, 39.0617064666003, -92.9985575377941, -51.6290077473968, 12.2396486345679, 48.3567856252193, -28.516500396654, -21.0198899265379, 53.046905528754, 44.2176911514252, 0.109824910759926, -99.0703694988042, 74.6371628716588","k",FALSE,-0.0887556361629261 +"pcor.mat",5,"24.8151850420982, -55.3720602765679, -48.1912312563509, 25.3140340093523, 7.37709770910442","27.1002457011491, 51.559735648334, 15.2347642462701, -19.9469642713666, -71.4244599919766","20.2690705657005, 10.2111615706235, 28.9990232791752, -81.5356591250747, 62.7182307653129","p",TRUE,-0.595476592392643 +"pcor.mat",10,"-80.8792762923986, -16.7048441711813, -27.4036565795541, 83.73913182877, -29.9381176009774, 53.5984759684652, -74.8886847868562, -35.0239771883935, -89.2459953203797, 42.7505305968225","55.4137516766787, -70.6881674006581, 32.317240908742, -69.2246387712657, -93.5175380203873, 42.5839690491557, 39.2618721351027, 19.604005292058, 29.0025069378316, 31.9192183203995","-57.4748635292053, -17.7012801170349, 86.0102667473257, -97.6800283882767, -33.8488628156483, -80.713168065995, 1.30178248509765, -82.9571642912924, 20.4808691516519, -23.3784267678857","p",TRUE,-0.247808971782581 +"pcor.mat",7,"-9.81413833796978, -95.0588807463646, -37.4823603779078, 96.0915867704898, 25.3856145311147, -90.2806713245809, 56.4173173159361","-17.8975068964064, -45.0020219665021, -53.689378220588, 13.3858302142471, -95.0690850615501, -45.9697632584721, 5.96692659892142","-74.4352919980884, -79.8946594353765, -36.3220115657896, 71.3168484624475, -32.7676126733422, 74.5314478874207, 47.3017191980034","p",TRUE,0.380658349962746 +"pcor.mat",7,"-12.2942595742643, -46.0883136838675, -21.6881454922259, -19.7250084485859, 54.6898206695914, -67.8715384099633, -98.035113979131","-31.2075863592327, -53.7305776961148, -96.1716986726969, 34.0433329343796, -86.3202335778624, -98.4303006436676, -81.2778456136584","-78.2337430864573, -33.7292415089905, 14.364256337285, 80.8441326953471, 14.6734802983701, -38.598564080894, -16.4908449631184","k",FALSE,0.233736747502114 +"pcor.mat",12,"65.5728437006474, -22.3883016966283, -16.1309017334133, -86.9484126102179, 55.0275014247745, 75.5027377512306, 56.8217232357711, -10.157274780795, -8.05552089586854, -95.0297535397112, 86.99438595213, 56.2756833154708","-50.9940889663994, 31.0440130997449, 55.3901108913124, 0.67323399707675, -93.814965011552, 43.19629650563, 82.1691108867526, 29.7341026831418, 23.4111852012575, -23.9989855792373, -41.8117068242282, -21.0978685878217","-94.9003085959703, 76.4557474758476, 71.228800015524, 1.28989322111011, 56.7563532851636, -74.5477284770459, -40.1864093728364, -62.3711896594614, -63.5766193736345, -34.8390635102987, -34.4627866521478, -60.8579785563052","k",TRUE,-0.0642824346533225 +"pcor.mat",16,"10.3261223994195, -66.3412994239479, -10.04778011702, 90.8491815906018, -16.8091387022287, -1.13998735323548, 8.87222946621478, 62.9582400433719, 51.0545901022851, -42.0804372988641, -72.740743868053, -98.6990892793983, 25.1725806389004, 30.7280816137791, 3.96932810544968, -57.8030949924141","60.728229675442, -74.0803788881749, -73.4922635369003, 21.5669278986752, -2.4874959141016, -42.8831906523556, -8.72258436866105, 41.053393855691, -49.3829999119043, -25.329764559865, -33.0748493783176, 64.0028734691441, -75.2295605372638, -3.0173609033227, -40.6044688075781, -90.4325042851269","-26.9309993833303, -77.9300230089575, -34.1201750095934, 18.6427622102201, -11.5215779747814, 43.2106466032565, 52.0845813211054, -27.0871427375823, 78.9493581280112, -60.0895206909627, 75.2652967814356, -64.8424350190908, 74.5653890538961, 79.290065029636, -83.871082868427, -55.8636627625674","p",TRUE,0.232814351928154 +"pcor.mat",18,"-94.2430725321174, -51.8685480579734, 21.5350433252752, 4.50745574198663, 44.5271090604365, 75.3100082743913, 36.3767127040774, 58.3390053827316, -33.6587901227176, 53.1314761377871, -90.0304151698947, 1.84677322395146, -43.2471524458379, 20.721254684031, -35.7563958037645, 44.6534116752446, 78.0897385440767, 62.626903411001","-86.8268391583115, -67.7875887136906, -20.8753589075059, -28.825512342155, 41.2515165284276, 6.46749134175479, -87.1187134645879, -87.9431148990989, -47.1682616043836, 7.15450858697295, -31.9803619757295, -45.8144799340516, 47.6873302366585, 94.4961855188012, 70.8510945085436, -10.3092920035124, 68.0197277572006, -86.2225097604096","42.146764555946, 35.4582188185304, -74.8004557099193, -69.1695068031549, 9.96355945244431, -1.00409551523626, -56.0459699481726, 57.2666853666306, -75.3820521291345, 61.0693466849625, -80.6058402173221, -28.1722619198263, 29.1725110728294, -84.9811018910259, 52.4267561268061, 3.33783319219947, 57.3508915491402, -16.6291590314358","k",TRUE,0.126881965715119 +"pcor.mat",11,"58.4281201008707, 18.3633047156036, -74.4007679168135, -70.9485304541886, -62.3421670403332, -75.4027212038636, -42.2465549781919, 45.5137318000197, -59.8607284482569, 62.6728146802634, 78.3472507726401","78.8005036301911, -11.6723335813731, 47.760496661067, 72.8375401347876, 44.0390994306654, 49.5243767276406, -49.906044267118, -93.3100801426917, 74.181916937232, 8.72853924520314, 83.0030017532408","-7.40372859872878, 19.830649998039, 32.0547481998801, -24.0255577024072, 15.4005860444158, 13.1488932296634, 8.03853832185268, -78.5669906530529, 80.1699983887374, -99.4674043729901, 40.1027225889266","p",TRUE,0.0557153883247975 +"pcor.mat",8,"-3.19936256855726, 41.1430836189538, -40.9489492420107, 32.8621160238981, -55.2679274696857, -85.6475236825645, -98.9018370397389, 37.6923420932144","-23.4679078217596, -70.4765893053263, -29.5889834873378, 73.5305113717914, 66.7411952745169, 8.31683478318155, 14.5889795385301, 72.6518555544317","78.9658954367042, -43.0149876978248, -8.42135692946613, 0.82630286924541, -0.558331841602921, -30.3489441052079, -19.2593446467072, 59.6474095713347","s",TRUE,-0.211100165460375 +"pcor.mat",12,"-46.8561482150108, 87.6810635440052, -57.6411653775722, -46.4993360452354, -35.9383462462574, -96.4581338688731, 72.101165773347, -92.8533762693405, -24.3875949177891, 81.7434745375067, 95.8580058533698, -39.7297702729702","-14.3783972598612, -62.9489183891565, -88.967556739226, 5.93087510205805, -20.3817227389663, -28.1361578963697, 98.5170270781964, -62.3654518276453, -21.2714700959623, -75.4275092389435, -45.0435093604028, -52.5260332040489","84.6728871576488, 77.3271079175174, -35.2307356428355, -63.2898768875748, -62.9697222262621, 57.5104051735252, -65.9628365654498, -77.7099144645035, -68.1009365711361, 21.6217519715428, 40.7055628951639, -11.8265327066183","p",FALSE,0.240265915193204 +"pcor.mat",14,"-65.2285707648844, 21.9669322483242, 73.5851485282183, 28.0581893399358, 34.4764126464725, -12.0250980835408, 44.0008006524295, 16.8571741785854, -32.5285179540515, 40.1795001234859, 14.344258280471, 42.7343318238854, 33.5459096822888, 17.8732588887215","-17.1958317514509, -31.969396257773, 26.989441877231, 52.442137664184, 42.9547981824726, 32.2006456553936, 80.7050887029618, 7.4744014069438, -56.099244300276, 47.6363920606673, -16.8571050744504, -45.9946841932833, -51.3697457965463, -93.8083261717111","-83.2655881065875, -35.3444519918412, 20.8411808125675, -89.538209233433, -85.8607416506857, -4.87791770137846, 16.466785594821, 71.7880600132048, -90.7291606999934, -47.3672876600176, 28.5109816584736, -6.68758857063949, -37.6607090700418, 78.6420990247279","k",FALSE,0.293285288009136 +"pcor.mat",6,"-46.0385966580361, -99.5740628801286, -29.4129090383649, 97.0183642581105, -37.6902215648443, 80.4221050348133","-88.8656401075423, -39.0352664981037, 37.8500768449157, -3.4251865465194, 16.7551717720926, -64.4463129807264","-85.469913110137, 82.1475684642792, -79.0366449858993, -17.5424363464117, -55.2734784781933, 8.78398092463613","k",FALSE,0.218217890235992 +"pcor.mat",19,"94.6966245770454, 80.9601898305118, -27.9354885220528, 32.8651154879481, -83.5247790906578, 68.0820679292083, 98.2801185455173, -51.8296324182302, 22.2090682946146, -57.0902567822486, -79.9241363536566, 82.232602359727, -31.2431594356894, 47.0965832006186, 45.9447079803795, 83.7373214308172, 43.1115242652595, -15.8762097824365, 24.6083721984178","-30.2270193584263, -18.9653075765818, 32.3881921358407, 62.3213729821146, 48.8383719697595, -64.4200759939849, -34.4498374499381, 74.7035726904869, -80.0148021429777, -72.3529085982591, 97.3054904025048, 81.4842638093978, -75.7931782398373, -36.0045140143484, 52.190304454416, -46.3511400856078, -27.5253375060856, -49.8220588080585, -94.6963192429394","-1.14815644919872, 38.8675629161298, -7.72479912266135, 80.9100962709635, 7.58379022590816, 83.3296971861273, 51.7409536056221, -33.8198636192828, -63.4376135654747, 80.6679456029087, -83.3767011761665, -82.7897766139358, -25.5388389341533, -99.9377169646323, -91.8954541441053, -75.1720157451928, 85.5636859312654, -35.8674420975149, -14.8491851519793","k",TRUE,-0.0612260637897383 +"pcor.mat",11,"43.6715835239738, 83.24592593126, 80.5671546142548, 50.718885473907, 91.4832427166402, -72.9882646352053, 1.08670038171113, 65.7646540552378, 32.857545139268, 98.8540512509644, 57.310037733987","-68.5883652418852, 57.6829582452774, 20.3366491477937, -20.9295519161969, -91.220309631899, 67.5120797473937, -84.0667628217489, -92.758432822302, 73.1769519392401, 31.0191483236849, -59.8639046307653","60.0395560264587, 49.4410765822977, -15.0798926129937, 76.642445102334, 43.1489706039429, -64.028698252514, -73.5862046014518, -11.8118531536311, -14.194271247834, 19.1962173674256, -62.6884501427412","p",TRUE,-0.239620090137985 +"pcor.mat",5,"84.436381328851, 72.004076000303, -40.9433365799487, -11.7642278783023, 36.9735128246248","92.926798760891, -99.3128840345889, -34.4348025508225, -47.6723862346262, 94.1138706635684","2.33245906420052, 59.2558087781072, -17.9977843537927, -79.5293167699128, -57.2229819372296","k",FALSE,0.0890870806374748 +"pcor.mat",13,"-52.8125622309744, 3.65753290243447, -17.9872157517821, 0.687318574637175, 48.9896171726286, -10.9520922414958, -42.2161420341581, -8.33622729405761, -52.7692852541804, 46.2861472740769, -63.7141830287874, 77.9755924828351, 69.3693526089191","-81.1979313846678, -81.2067239545286, 98.1338402722031, 81.5591927152127, 37.056217668578, -30.573401786387, 86.0113869421184, 22.4740816745907, 15.2922587003559, 4.40599746070802, 81.2510290648788, -91.3585484493524, -51.8274602945894","1.68427461758256, 35.6400829739869, 1.32666421122849, 28.9358278736472, 69.9353440199047, 22.5035205483437, 42.7461497485638, -60.8904164750129, 41.2500537466258, 72.3914569243789, -35.3465625550598, 11.877816170454, 41.2654601968825","s",TRUE,-0.432235260027861 +"pcor.mat",6,"36.2520147580653, -45.3618559986353, -3.36455763317645, 27.1406658459455, -32.130736252293, 89.6533737424761","91.0997018683702, -58.0772765446454, -45.8715479355305, -76.4125521760434, -51.5536211896688, -28.4703179262578","-59.4199031591415, 60.7980337925255, 86.4012580364943, 43.8618046697229, 27.8941972646862, -83.8361509144306","s",FALSE,0.361111111111111 +"pcor.mat",15,"-15.8772577065974, 12.7610163297504, -22.9708819650114, -71.8580039218068, -75.8046543691307, 47.7548703551292, -24.9429981224239, -31.5219290088862, -80.9420365840197, -0.135115487501025, 43.7512583099306, 82.602039212361, 32.6054238714278, 52.4210862349719, -25.4571683704853","2.32095182873309, 57.4718285817653, 91.6442870628089, -0.498835230246186, 42.3996091354638, 98.4292598906904, -69.7168925777078, 17.9197568446398, -60.0217215251178, -94.6461838204414, -56.8148406222463, -86.9362941477448, 23.4191815834492, -67.045795917511, -25.982434488833","88.8973289635032, 31.7113435361534, 1.63480490446091, 90.244840271771, 90.7815016340464, 3.64356338977814, -70.6344856880605, 20.8035066723824, 71.0505054797977, -41.0872615408152, 81.8894566036761, 27.3655611090362, -57.8210411127657, 80.1123460754752, 37.0346592739224","s",TRUE,-0.100259767542805 +"pcor.mat",17,"-8.47610384225845, -76.0521722026169, 36.9659481570125, 27.2644958924502, -63.1253079976887, -45.7246268168092, -91.299555497244, 79.9444675445557, 62.6849308609962, 77.2913023363799, -39.3468747846782, -31.9794123992324, -90.5704878270626, 3.36136179976165, 6.36215764097869, 34.7822861280292, -86.7615907918662","38.8797430787235, 87.957543740049, 27.9284121934325, -2.19381097704172, -93.5423448681831, -85.8565270435065, -1.78483547642827, 32.4997876770794, -84.6204502973706, 73.0989838484675, 46.5271977707744, 19.7806170675904, 2.54705562256277, -62.6201322302222, 47.8446535300463, 94.2804395221174, 43.5015312861651","-42.1679470688105, 44.9353978503495, 4.3509088922292, -26.6828402876854, 45.7676482386887, 34.6878333482891, 86.2517770845443, 54.4100513216108, 62.1482897084206, 93.2931664399803, 48.1029566843063, -49.8642263934016, -79.5734560117126, 82.6493532862514, -56.327466852963, 30.9423569124192, -75.3295318223536","k",FALSE,0.173343955251749 +"pcor.mat",15,"-12.115827947855, -23.5690898727626, 89.8483640048653, -76.0832019150257, 54.2692786082625, -31.3360400963575, -87.8199052065611, 62.5256759114563, -85.054659191519, 17.1253859531134, 86.8644420057535, -63.6440661270171, -2.54382686689496, -52.1825547330081, -86.5487120579928","87.855874421075, 11.8729826528579, 58.581341477111, -76.1566527653486, -54.7422365285456, -76.9119961187243, -51.5453061554581, -8.55491124093533, 41.1004772875458, 4.76148361340165, 27.0399220753461, -93.3408699929714, 43.2594683486968, 97.5612652488053, -27.2557357791811","-25.7235449738801, 98.6250419635326, -33.5626783315092, -76.8353697378188, 5.53134111687541, 11.2494019791484, 53.6648289300501, 58.8696902617812, 74.8723800759763, -83.5754144005477, -2.30161873623729, -0.636160280555487, -32.3559941258281, 9.53439651057124, -96.3161264080554","k",TRUE,0.203279781135864 +"pcor.mat",10,"-88.6766928713769, -99.7512009460479, 36.3819673191756, -78.1028961297125, 26.9118153490126, 8.51810127496719, 25.9507332928479, -2.06361203454435, 61.8650326039642, 53.7325612269342","44.7955575305969, -23.4671366401017, 67.7940716035664, -61.1387377139181, -77.4398116860539, -9.6572854090482, 29.9326512031257, -50.3714796155691, -29.1814834810793, 77.4120518472046","53.5698696039617, -33.2331659272313, 29.2508830782026, 30.7888105046004, -75.6014665588737, -21.6426336206496, 49.8834919184446, -31.1990667134523, -49.9284417368472, 52.3363713175058","s",TRUE,0.461061427308285 +"pcor.mat",16,"-83.9224993251264, -98.9909253083169, 41.2098858971149, 40.319947944954, -22.3131684586406, -4.72695007920265, 71.1222126148641, -73.4416379127651, 19.5892326999456, 51.5542230568826, -59.8082218784839, 83.2985554821789, -73.8052498083562, 81.1506273690611, -62.3849936295301, -65.9225380979478","-22.3732136655599, -76.6401294153184, -14.9951294530183, 17.2481925226748, 36.7321326863021, 30.8906201738864, -36.0778030008078, 27.3618204053491, -25.5863894242793, -77.5616424623877, 71.2329083122313, 92.7250783890486, 18.0521029513329, 20.1161385513842, -37.0644447859377, 74.0854462143034","63.1498238537461, 67.5584438722581, -2.90364040993154, 86.5714854560792, 80.625259783119, -83.5466306190938, -89.0106877777725, -11.5085924509913, 95.1227321755141, 26.8994387704879, -36.1149361357093, 13.4227952454239, -22.9821641929448, -81.5770137123764, 99.1007934324443, -24.637895449996","k",TRUE,0.00117273434060522 +"pcor.mat",12,"-30.6264939717948, -51.3202500529587, -91.8923989403993, 71.2572688702494, -50.3101641312242, -43.5825682710856, 68.9194604754448, -62.2129834722728, 74.4652757886797, 10.5425884481519, 39.5969454664737, 43.8930058851838","-3.49326506257057, -40.981019847095, -1.93292065523565, -55.6563400197774, 30.0884651020169, 5.1898842677474, -57.6860777102411, 92.7335068583488, 4.2677782010287, -73.3723870944232, 37.4122668523341, 97.195135615766","0.661881873384118, -77.0722641143948, 80.916742188856, 84.3042341526598, 60.0523283239454, -15.8854037057608, -41.8266508728266, 90.2447595726699, 78.685249062255, -98.4303796198219, 53.0869376845658, 97.2957746591419","s",TRUE,-0.309246046562802 +"pcor.mat",8,"43.6172465793788, -28.597435541451, 49.3047020863742, 23.4949984122068, 55.2344744559377, 50.4013098310679, -61.0196806956083, -13.4925350546837","-28.0354068614542, -58.4258052520454, 91.4929724764079, 5.28197917155921, 6.99444795027375, -37.798970984295, 14.2839945387095, 93.0717419367284","65.1908750180155, -76.971767982468, 78.4851297736168, -27.8413584455848, -14.1628153156489, -37.5672557391226, -58.8539640419185, 51.5223218593746","p",FALSE,-0.457862137278786 +"pcor.mat",5,"7.32707628048956, -97.153510292992, -58.0732712056488, 5.43075683526695, -50.3950014710426","-60.6064203195274, 70.2952838502824, 7.70989404991269, -90.4186028987169, -91.9082495383918","-27.0302977412939, -71.8158513773233, 60.5169426649809, -51.2578745372593, -71.4558880776167","p",FALSE,-0.811742988157054 +"pcor.mat",12,"-31.9100445136428, -15.4961660970002, 15.1833237614483, -96.8389748129994, 34.0211338829249, -26.4210654422641, -74.7212948743254, -73.451091023162, -48.6799724400043, 43.3380767703056, 33.7157489266247, -12.9206308629364","-25.7156142964959, -31.4395876601338, 27.1043297369033, -64.4430394284427, 69.3326181732118, 11.0314972698689, -56.0946275945753, -5.32854660414159, 61.7247725371271, -58.0520442686975, -98.0296685360372, -83.8190475013107","65.2698641642928, 23.0271658394486, -30.5951663292944, 87.3122846707702, -96.8001709319651, 80.7323037646711, 92.8447821643203, -96.3675274513662, -33.6922558955848, 59.8475752864033, -96.7984095681459, 82.4916113168001","k",TRUE,-0.0909090909090909 +"pcor.mat",12,"90.1167266536504, -66.6625558398664, 39.782078191638, -58.8765672873706, -59.9938517436385, -76.4870832674205, -10.5842749588192, -75.7783581502736, 1.28461210988462, -34.5959145110101, 50.9478696621954, -96.5802219230682","38.6262435931712, -94.669465906918, 56.7374847829342, 36.0493461135775, -54.2134216055274, -63.6453815735877, 81.5788346808404, -68.2411943562329, -22.1247639041394, 92.5449587870389, 35.5207106098533, 94.1242534667253","86.8828876875341, -60.6638357974589, -8.42275521717966, -64.6387516520917, -62.6291708089411, 40.5554509721696, 6.27670022659004, 24.3925095535815, 30.6437145452946, 9.16047729551792, -63.2885267492384, -17.5928950775415","s",TRUE,0.261481371449354 +"pcor.mat",18,"80.5951167363673, 90.9240923356265, 70.6974952481687, 68.0134673137218, -44.9470512103289, 25.955663016066, 30.7497585657984, -91.8298844713718, -4.40605725161731, 49.3009329773486, -78.929325286299, -78.4197290893644, 44.3274276796728, -61.9072982110083, 16.9208872597665, 88.0656720604748, -0.423743482679129, -22.9118093848228","31.6178977955133, 6.30270089022815, 87.8026704769582, -79.791863868013, -2.2237554192543, -26.5245907008648, 91.646106634289, -67.9212915245444, 32.4714999180287, 76.9008807372302, 92.0271085575223, 37.951097311452, 55.0852465443313, 81.3659423030913, -61.8186100851744, -34.2142827343196, 3.76891982741654, 9.98605671338737","94.6255694609135, -84.6232280135155, -26.6939069610089, -79.9416828900576, 61.19120195508, 4.79885442182422, -36.1860592849553, 71.0645910352468, -88.2137383334339, -8.42098467983305, 58.1183904316276, -15.7302843872458, -4.05891095288098, 85.9798874240369, 94.7344854008406, 7.95916928909719, 78.0328324530274, -99.0391628816724","k",FALSE,-0.107524911773377 +"pcor.mat",7,"-38.9586756005883, -57.8867371194065, -68.1198546662927, -89.4594067241997, 70.7473307847977, -35.7670163270086, 52.0461404696107","21.6805159114301, -28.8543162867427, -22.0741868950427, -84.8189734853804, -35.3580724913627, 19.6727192029357, 21.0121315903962","66.0285493824631, -4.54495996236801, 64.9962153751403, 74.2479239590466, 59.3966994900256, -13.1802632007748, 10.3553391993046","s",TRUE,0.253320198552449 +"pcor.mat",9,"-6.78211716003716, -79.588529560715, -65.7252383418381, 45.60412671417, 98.0520688928664, -76.6070755198598, -40.7307191286236, -14.1458517406136, -83.4068476222456","-41.9686838053167, 40.0618359446526, -71.2534620892256, -78.1008904334158, 13.2995546329767, 44.5248483214527, -82.3847197927535, -89.4571373704821, -79.4600131455809","-85.7230886816978, -13.998108310625, 66.9168075546622, 29.5824715401977, -86.4490587729961, 90.6398146878928, 32.4118531774729, 27.7746527921408, 80.8882680721581","p",FALSE,-0.28294999490249 +"pcor.mat",13,"-87.399728782475, 40.3655833564699, -3.77177731133997, -0.913261342793703, 84.5598533283919, -57.672530086711, 70.6847531720996, 17.5953175872564, -43.7333907932043, -24.1470513865352, 71.5449669864029, -51.1317191179842, 20.0356021057814","-39.3181677907705, 76.6436085104942, 45.0167378876358, -12.2507677879184, -11.5627334453166, -64.4468226004392, 81.8960891570896, -71.4755731634796, -82.4792180676013, -31.5537444315851, 22.1059046685696, -33.5309320129454, 48.856098158285","-25.2732687629759, -77.4636949412525, -31.5821984782815, -97.6564433425665, -5.07994783110917, -54.0312268771231, -50.5725503899157, 4.37337355688214, -9.34875644743443, 70.4601784236729, 40.7617360819131, 92.1488650143147, -10.1492855232209","k",FALSE,0.494775334448826 +"pcor.mat",5,"-95.295644691214, 85.2518345229328, 70.6566654611379, -15.488860104233, -39.7784407250583","54.2502315249294, 28.1581053044647, -68.6268703080714, -3.80988898687065, 53.7825032602996","-3.1055589672178, 6.64212079718709, 43.7012503389269, 17.2084089368582, -85.3145365137607","s",TRUE,-0.458831467741123 +"pcor.mat",16,"97.809230722487, -14.316190360114, -84.721079049632, -18.7376644462347, -25.5602215882391, 17.7533380687237, 39.1872539184988, -94.0707533620298, 2.72555686533451, 22.7984459139407, 59.4628068618476, -40.8906124997884, -92.1079889405519, 29.8243676312268, -12.0696670375764, -89.7928544320166","26.7640289384872, -96.4622846804559, -40.3722857590765, -80.3130167070776, -68.9347126986831, 98.9100785925984, 31.9554898422211, 64.5670853089541, -50.01574116759, -97.6768167689443, -87.454877840355, -74.6697645168751, -17.0667306985706, -20.0176582206041, 61.2935196608305, -60.0398785434663","42.3937499523163, 46.829612692818, -93.9524796325713, -63.3410033304244, 87.3350779991597, 9.56030515953898, -6.86939819715917, 6.62593231536448, 30.0475670956075, -67.5459566526115, 12.8623825497925, 19.4047554861754, 17.8637056145817, -45.1789702754468, -44.4462891668081, -58.5556023288518","k",FALSE,-0.0864597208956419 +"pcor.mat",13,"77.1156166680157, -4.95218234136701, -0.478975335136056, -88.6164400726557, 79.5374071225524, 64.5803040824831, -2.80681941658258, -79.7279377933592, 99.2951272986829, -97.9579760227352, 30.6757009122521, 1.96241005323827, -16.967974929139","-96.855311980471, -56.1395757365972, -2.78360079973936, -33.6360565852374, -44.3065817002207, -95.199401024729, -27.0363926421851, 75.0894209835678, 4.99337976798415, -7.82306902110577, -81.4332918729633, -56.5008042845875, 19.696054328233","16.2967632059008, -25.3815619740635, 94.3077141884714, 47.4075115751475, 96.9511947128922, -23.1907044071704, 38.797459891066, -97.7688763756305, -28.7548608146608, -83.8516177609563, -7.49311237595975, -26.1195019353181, 48.4767589252442","p",FALSE,-0.477487484222149 +"pcor.mat",9,"-39.2630732618272, -89.935081731528, -46.2339258752763, -89.5339810289443, -4.36198632232845, -14.5440776832402, -95.7827549427748, 93.4488965664059, 81.2002772465348","99.4978452567011, -30.0176431890577, -63.0747328046709, -54.7369061969221, 39.9523709435016, -27.1971534471959, -94.4386278744787, -78.7398369051516, 18.4704976622015","-42.4461417831481, 81.5393285825849, -52.1045574918389, -19.8012057226151, -87.6727635972202, -26.1554778087884, 5.14846704900265, 16.3954760879278, 75.12436225079","k",FALSE,0.20385887657505 +"pcor.mat",15,"60.3103106841445, 71.4415548369288, -98.9705654792488, 7.11592291481793, 10.6087463442236, 42.708487669006, 82.4820324312896, 38.3419292513281, 85.0099918898195, -0.90777650475502, -92.9779385682195, 3.21783553808928, 97.79725340195, -15.0709590874612, -88.6436254251748","59.2901791445911, -3.65023575723171, -0.826246337965131, -92.2944152727723, 4.78945928625762, -35.9777873847634, -4.00528195314109, 14.427507808432, -36.5650984458625, -30.6801207829267, -33.1895301584154, -72.0329152885824, 88.569199340418, -63.0710757337511, 81.6133069805801","-4.55778324976563, 49.8842949513346, -24.1089406423271, 15.2178956661373, 93.4157602954656, -14.0120008029044, 74.634336354211, -76.262500602752, -0.484065152704716, -24.2140971589833, 55.4016582202166, 59.3731869477779, 79.561612335965, -26.1603471823037, -32.2228459641337","p",TRUE,0.111079544613507 +"pcor.mat",12,"-47.1727962139994, -62.7806689590216, 14.7163263522089, 98.5433207359165, -2.45944913476706, -48.7231005448848, 15.0826691649854, -78.9477611426264, -66.5948192588985, 8.53210580535233, 33.7848087307066, -11.1786916386336","-53.4802015405148, -67.8791525308043, 16.3833658210933, 8.16084523685277, -68.3082328177989, 52.1591320168227, -94.9673681054264, -51.7830446828157, 48.8592490553856, 80.6429937947541, 18.254310823977, 21.4851890690625","59.5537723042071, 28.640017285943, -53.3816957380623, 52.5868681725115, 61.431689793244, 38.7933161575347, 63.6210044380277, 74.1345513146371, -31.347640696913, -11.0894621815532, -53.0158845707774, 53.0884329695255","k",FALSE,-0.138443731048635 +"pcor.mat",6,"16.9672078453004, 39.5416527055204, -65.5000091996044, -90.130511764437, 63.6201905552298, -18.7544235493988","-81.3643315806985, 87.5242207664996, -87.3709872830659, -94.47445650585, 80.7427565567195, 97.7012349292636","21.0985390935093, -19.1841311287135, 61.7898017633706, -90.6381107866764, 61.5531626157463, 50.346623826772","s",FALSE,0.58925565098879 +"pcor.mat",7,"-56.6911320667714, 14.7237893659621, 72.7042480837554, 67.854171898216, 54.2756285984069, 87.7428719308227, -62.4983601737767","56.7447266541421, -63.2602260448039, 95.9155341144651, 79.549733037129, -31.7429569549859, -96.1661211680621, 89.6558737382293","17.7951748482883, 52.8001375962049, -17.0254016760737, -0.180792575702071, -69.1782949492335, 5.72048868052661, -73.80879400298","p",TRUE,-0.344955719900739 +"pcor.mat",14,"8.34259777329862, -90.7544204033911, 53.8198739290237, -73.6186733935028, 65.3159111272544, -54.8385083675385, -56.6149288788438, 93.1464713532478, -49.6990147978067, -62.7166502177715, 26.090932963416, 59.4254573341459, -78.5409053321928, 13.1633264012635","71.73405229114, 47.2987382672727, -66.5379968006164, 80.1759538240731, -32.3648356366903, 10.4439327027649, -84.9242614582181, 98.0132193304598, 31.8165130913258, -75.4577403888106, 27.8047663159668, -52.8659251984209, -61.3233786541969, -31.609858199954","92.3250074964017, 41.1538690794259, -70.4804343637079, -33.9494093786925, 67.3102808184922, 30.5022850167006, 14.392489567399, -66.8610816355795, -21.4584674686193, -87.7356766723096, 86.1648599617183, 34.3186971265823, -45.2394630759954, -97.3335643764585","p",TRUE,0.0376321132257061 +"pcor.mat",19,"17.2792347613722, 44.7029660455883, 7.22097363322973, -65.7868965063244, -75.2946712076664, -75.9451765101403, -65.4915338382125, -42.1579808928072, 0.180424936115742, 60.9645693097264, -79.4751405715942, -88.1112538278103, -3.82754770107567, 11.970756854862, -89.807746373117, -75.4269581288099, -83.210919983685, -49.4484897702932, -79.4092588126659","98.0341942049563, -77.4498141836375, 28.0400432180613, -31.759634707123, -8.49162279628217, -77.7130985166878, -44.0454395022243, -40.247108368203, 44.3426605779678, 48.202803870663, 13.207955705002, 27.6490168180317, -3.62952486611903, -15.9190153237432, -34.1904443688691, -1.11497580073774, 10.264601605013, 39.9211245123297, 27.739332895726","88.2835000287741, 33.0788629129529, 66.6329775005579, -58.9400433935225, -67.8360211662948, -23.8581227138638, -64.4136915449053, -71.0973926819861, -6.4570713788271, 5.39726838469505, -64.308940153569, -80.775932315737, 17.806462245062, 64.6042937878519, 25.6625287234783, -53.9103304501623, 10.1242880802602, 31.6518820822239, 71.827148180455","p",TRUE,0.0548011187422948 +"pcor.mat",15,"-48.3876196667552, -26.4751517679542, 86.0122847370803, -2.21008872613311, 88.2522213738412, 36.0168526880443, 53.617551876232, 46.2094876449555, -55.7492116466165, -48.1529265176505, -27.9851477127522, 62.0271205436438, 6.54048435389996, 65.1294771116227, -97.3066220059991","88.3713206741959, 70.3678138088435, -17.6713398192078, 92.8743582218885, 67.6384199876338, -56.5470991190523, 28.6562576889992, -89.9442651774734, 14.1420055180788, -39.6874803584069, -68.7506389338523, -46.1653867270797, 54.8760372679681, 31.6477505024523, -74.1190653759986","-50.7720490451902, 13.1769198458642, 60.0184863433242, 69.6465944871306, -4.16778987273574, 42.1332813799381, 44.0076574683189, 47.2968339920044, 47.09054636769, -90.304255951196, 90.9836431499571, 61.1754382494837, -95.954512199387, 65.8738845027983, 18.4467539191246","p",FALSE,0.155278581425428 +"pcor.mat",12,"66.9760071672499, -10.0718723144382, 98.4006015583873, 49.9737814068794, 93.0611060000956, -30.8278535492718, -49.5318784378469, -74.5468678884208, 53.2779390923679, 45.9250777494162, 7.21664810553193, 98.5868971794844","86.4792299922556, 66.300771990791, -30.303956894204, 99.7657214757055, 21.8715326860547, -0.453599169850349, -49.4858743157238, 95.0286555103958, -75.6651264615357, 61.6245118435472, 50.6951719522476, 73.4736283775419","-76.645670318976, -46.4482659008354, 14.1620874870569, -42.584248399362, -53.2975015696138, 54.3731088284403, 94.7233782615513, 5.24166952818632, 33.9543189387769, -39.5664878189564, -64.9096461012959, 64.3044523429126","k",TRUE,-0.029027606770737 +"pcor.mat",5,"90.8192429691553, 48.4106589574367, -21.8404297251254, 41.0448144190013, -83.0681975465268","-59.1780140064657, -51.5384333673865, -47.804808197543, 12.2319002635777, 15.4189415741712","87.9196766763926, 56.3696804456413, 10.8711638953537, -25.8778809569776, -61.6596679203212","p",FALSE,0.828266806248407 +"pcor.mat",15,"-84.2769027221948, -99.7776164673269, 53.0052073765546, -56.7098737228662, -87.9683969076723, -51.0782906785607, -35.9742659609765, 17.2527201939374, 58.1052905414253, 79.0114177856594, -98.0878078378737, 49.7950758785009, -84.3974281102419, -79.6418719459325, 82.9541291110218","91.2282381206751, 32.1592024061829, -55.6543642189354, -73.2480760663748, 2.29297978803515, 88.1192316766828, 70.9258356131613, 8.78023901022971, -54.8915889114141, -16.0259561147541, -62.4688476789743, 35.7657310552895, -85.5574174318463, -78.2423210795969, 57.0005943533033","68.9237471204251, 97.5910210981965, -70.7898926921189, 78.3896393608302, -26.9685154780746, 31.1476676724851, -7.25077791139483, 4.25968733616173, 71.4906623121351, 99.7103612869978, -70.5109211150557, -29.5995627064258, -89.8151689674705, -61.3775999750942, -23.73201623559","s",TRUE,0.131094606641465 +"pcor.mat",12,"-4.51542986556888, 65.3962709475309, 54.7027637250721, 21.8017288018018, -45.6481758039445, 56.3114468473941, -10.0910985376686, -33.9759476948529, 47.1306453458965, -81.5762444864959, -15.2306498959661, -55.8099669404328","78.4110291860998, 51.8248929642141, -74.8319068457931, -27.2911807522178, 99.4782904628664, 96.8407794833183, 88.3730117697269, 51.7726821359247, 34.6810360439122, 94.3698732182384, -27.2285795770586, 60.5969968717545","-56.935870507732, 35.1825864054263, 46.9766597729176, -0.979113671928644, -0.491952011361718, 2.96344561502337, -53.3740632236004, 63.3763818070292, 98.6882844939828, 32.3614825028926, -9.01708984747529, -89.2050859052688","k",FALSE,-0.238461538461539 +"pcor.mat",16,"-86.2841431982815, -18.3129501063377, 60.0204044952989, 49.4004330597818, 73.2034908607602, 36.0958587378263, -26.9164501689374, 99.3937272578478, 99.4885763153434, -15.9275187179446, -64.6454212721437, -25.9472228586674, 35.9230092726648, 25.0261219218373, 17.5404471345246, 1.84494755230844","96.1923027876765, -42.1271054539829, -8.16392744891346, -97.7614040952176, -10.3897859342396, 63.9586094766855, -50.9310736320913, 82.2031420189887, 72.7375000715256, -22.3871399648488, 57.6591491699219, 90.738725150004, -46.6567573137581, 94.6342563722283, -29.7158366069198, -79.2119293473661","-22.4795233458281, -96.3848259765655, 21.2546060327441, 68.0201687850058, -97.928561642766, -67.2587384004146, 44.8108606506139, 82.0129224099219, 24.2342098616064, -86.4289211574942, -79.5525341294706, 19.2005013581365, -51.4744527172297, -63.8537698891014, 17.4904732964933, -32.1932288818061","p",FALSE,-0.0517037216543802 +"pcor.mat",9,"-12.2494653332978, 81.3471322413534, 15.8859042916447, -40.0486988015473, 52.4177443701774, 19.3593227304518, -47.6214892696589, 98.4649391379207, 73.2301543932408","89.4672878552228, -82.9613993875682, -66.7588278185576, 78.6925439257175, -4.60034948773682, -52.7979515027255, 2.19829431734979, 72.0490128267556, 86.0512541607022","33.8618124369532, 90.739763667807, -55.6767753791064, 39.5474712364376, 83.0445552710444, 34.4050417654216, -59.1911187861115, -8.19138023070991, 99.0859573241323","p",FALSE,-0.198035626518398 +"pcor.mat",10,"47.6879670284688, 16.5959696285427, -63.4765389375389, -27.5170926470309, -22.5022290833294, -43.0537707172334, 70.5259828362614, 59.2826380394399, -88.5750241577625, -1.89512646757066","-61.3072986714542, -26.0851273313165, -8.67939637973905, -27.971677435562, -40.7435014378279, 1.29813449457288, 2.31690336950123, 16.4261620491743, -52.7925265487283, -89.1311551444232","52.5048244278878, 4.67872102744877, -46.2626181542873, -45.9650584962219, -50.2988358028233, 87.9835510160774, 56.6933359019458, 96.3448523078114, 53.302510920912, 1.91744468174875","p",FALSE,0.0988233148075562 +"pcor.mat",9,"14.4472865387797, -47.3339173942804, 88.0170038435608, -31.5219953190535, 46.918716840446, 56.6940610762686, 6.99824644252658, 98.6299303360283, -5.93640897423029","22.6194951217622, -77.684145513922, 75.3283645957708, -40.9434220287949, -38.5339342523366, -91.2029369268566, -63.4814173448831, 10.7932053040713, -49.4684089906514","-33.6434269323945, 73.0934476479888, -23.9013602025807, -76.148905325681, 60.0582375656813, 70.3553961124271, 7.24662998691201, -66.3810072466731, -94.6542747784406","s",TRUE,0.541229427257326 +"pcor.mat",14,"62.3325610999018, 28.3598528243601, 45.8982207346708, -8.46395660191774, -63.4389164857566, 72.4040941335261, 0.539024919271469, 91.1112579517066, 16.1043775267899, 68.5833586845547, -90.9464060328901, -99.2442855145782, 17.0317857526243, -9.96274407953024","-4.58235912956297, 11.521205957979, -75.3375723026693, -5.17353126779199, -40.0790630374104, -70.08021697402, 53.5009195562452, -58.0623977351934, -9.79966381564736, -35.5031280312687, 68.6820048838854, -48.3796393033117, 10.2691211737692, 52.6988474652171","41.5283095557243, -6.18213326670229, -20.2820646576583, -43.5107395984232, 97.0502740703523, 60.2817252743989, 1.80356446653605, 48.0388806201518, 13.3720958605409, -19.7484199889004, 65.0038605555892, 86.6087830625474, 84.9961121100932, -55.2010769490153","p",FALSE,-0.496536277317825 +"pcor.mat",11,"-86.8348072748631, -68.1555027607828, 93.7882163096219, -17.574486322701, -3.01832188852131, 82.4596357531846, -70.7045842893422, -41.0055582877249, 85.1761696860194, -76.0164870880544, 9.26548577845097","78.6481990013272, 33.5281310137361, -46.5702877379954, 13.5015867650509, 11.9400870520622, 28.7497514858842, -32.9607792664319, -34.5967058558017, 46.3658351451159, 53.1044125556946, 88.4551724884659","8.02730321884155, -14.3242678139359, 10.4656010866165, 44.1013956442475, 41.8432073201984, 16.2981065455824, -42.1405011322349, -81.4176644664258, 41.9636760372669, -95.8132732659578, -96.6605862602592","s",FALSE,-0.187531875709659 +"pcor.mat",15,"-8.95890998654068, 87.6476715318859, -82.3296630755067, 54.1639633011073, -56.9908442441374, 32.6043246779591, -85.6081826612353, 77.9518540017307, 26.4017198700458, -99.6459340676665, -2.37713954411447, 57.1259008720517, 15.9859085921198, -21.3041906710714, -88.4612631518394","71.0004774853587, 33.6280925199389, -44.5519751403481, 61.0465653240681, 82.826607953757, -72.3422850482166, -27.0270694512874, -48.9543684292585, -13.1586199160665, -48.2837385963649, 71.7649020254612, 89.9132785387337, -46.7835825867951, -5.76893505640328, 68.2509062811732","-79.8319123219699, 4.72839176654816, -51.0409486014396, -58.6709169205278, 53.0833051074296, -70.3293783590198, 19.1716862842441, -67.5588438753039, 62.886883597821, -96.4109890162945, -34.4456045888364, 45.6756661646068, 47.4764776416123, 7.42012783885002, 38.5514346882701","s",TRUE,0.0110289747628682 +"pcor.mat",16,"31.4061987679452, -74.9066208954901, -64.9867978878319, -5.39299356751144, -53.42126484029, -47.4726263433695, 69.5169975049794, 31.62314100191, -22.9675776790828, -74.656882788986, -1.33912023156881, -98.8822244573385, -35.7455586083233, -33.464961964637, -3.55721861124039, -27.8399859089404","72.7164791896939, -83.5368575528264, 64.1068436671048, 3.18035068921745, 71.0855689365417, -68.9065222628415, 88.6347917374223, 84.7157137468457, -38.3024057373405, 8.57474114745855, -65.9063815139234, 43.8279079273343, -6.10163295641541, 61.0187361482531, 2.19916221685708, -9.51254032552242","56.0140502639115, 56.2448440585285, -48.0950287077576, -38.731576455757, -71.3526351843029, -26.7311075236648, 50.0080749392509, 39.7566744126379, -0.389600452035666, -6.86149629764259, -87.0373306330293, -5.545165669173, -14.8602196481079, -45.7474006805569, 10.8187668025494, 45.559770334512","k",TRUE,0.236643191323985 +"pcor.mat",6,"43.2217205408961, 95.0128023047, -37.1413607615978, -85.5048784054816, -17.2799117863178, 35.998792340979","8.15750281326473, 43.2605781126767, -44.8291454464197, -31.1379416380078, -44.7567201219499, -44.5435838773847","-28.5342446528375, 59.9700956605375, 71.0424310062081, -25.7011258974671, -79.6189298853278, 28.7746171001345","k",TRUE,0.607142857142857 +"pcor.mat",10,"63.2382842712104, -45.6831192597747, -55.7130093686283, -82.2273524012417, -10.8993649948388, -20.6117415335029, -72.7630480192602, -77.4749230127782, 53.6859362386167, 68.9426238182932","30.9459066949785, -80.7866416405886, -47.3474097438157, 49.9985641334206, -84.2809103894979, -56.8257133476436, -13.4179298300296, 60.9060937073082, 48.940838733688, -62.3239307198673","-73.7048507202417, -57.31729445979, 14.9673992302269, -14.3290285952389, -76.3574062846601, -60.4541322682053, -16.2746643647552, -28.6148637533188, 18.4534307103604, -83.0491851549596","s",TRUE,-0.193126854288765 +"pcor.mat",9,"-36.237419815734, -82.6313697267324, -45.2068409416825, 28.2838310115039, -8.59123645350337, 64.9153559468687, -53.2393038272858, 62.8279895056039, 1.16134048439562","-10.1885996758938, -91.6434466373175, -46.7915282119066, 25.4895669408143, -24.0784865338355, 58.5600736085325, -44.0702077001333, -98.0394726619124, 76.2519818730652","33.8238641154021, 7.84905035980046, 36.8167491164058, -17.6727590151131, 9.43915518000722, 5.15828183852136, 92.3964754212648, -85.2526424452662, -63.7069202959538","p",FALSE,0.398179069149688 +"pcor.mat",13,"78.1919818371534, 64.493830408901, 0.710873352363706, -40.3782351408154, 57.4935470242053, 38.2916694041342, -41.3470767438412, 76.0839499533176, 27.3725191596895, 28.8496494758874, 21.4308275841177, -26.0073396842927, 38.606214011088","16.4913782849908, 27.8782834298909, -80.1846226677299, -72.8203158825636, -16.3325851783156, 86.8600406683981, 93.3527871966362, 14.9770261719823, -45.6588900648057, -87.0777580421418, 13.9018434099853, -22.1736597828567, -12.0512451045215","-71.655789623037, 14.8334824945778, -16.8137946166098, -60.0538752041757, 17.0944395940751, 22.4857289344072, -77.132256841287, -55.0677491351962, 2.21382677555084, 69.3236303050071, 39.8013096302748, -39.7288813255727, -63.2540795020759","s",TRUE,0.336736697396128 +"pcor.mat",13,"91.7842994909734, 38.721524970606, 39.1705478075892, 18.6643098015338, -4.83868648298085, 96.8743856530637, -8.04941062815487, 88.7948990333825, -42.6608783658594, 74.295567907393, 20.754674077034, 20.6958107184619, 7.28423306718469","39.8056766949594, -61.7218984756619, -1.59168504178524, 4.02580439113081, 60.1681916043162, -89.8049416486174, -35.8231709338725, 78.1130255199969, -55.8174833655357, 51.9783590454608, -36.2147870473564, 35.5141086038202, -8.96845734678209","4.79736779816449, -56.6321770660579, -76.5336334705353, -22.4140492267907, 77.5082608219236, -61.9375938083977, -6.95173270069063, 19.7686547413468, -30.8583251200616, 47.0094705931842, -54.2295054998249, -98.6059594433755, 87.8028795588762","k",TRUE,0.212316868169448 +"pcor.mat",15,"-3.59630105085671, 86.7999098729342, -17.786830663681, -92.8564656991512, -51.1485965456814, -14.4706445280463, -17.7462406922132, -28.2284520566463, 58.7217133492231, 79.4202568475157, 94.2491712979972, -15.5174071900547, -10.2361090481281, 66.6180044878274, -50.6200913805515","65.4638954438269, 6.78580459207296, -35.6246003415436, 58.6391407065094, 18.2316683232784, 86.3036005757749, 46.5730607975274, -84.4369672238827, -44.6714565623552, 17.6646849140525, 37.9040233790874, 32.2640858590603, 77.358628436923, 55.9946102555841, -33.5247005801648","-19.0743586514145, 82.9343199264258, -8.59537380747497, 14.3348595593125, -41.50315746665, 12.1748448815197, -52.9024983756244, 52.8367889579386, -65.2377155609429, 24.2413009516895, -35.3585127275437, 26.4716796576977, 47.1821424551308, -15.6605173368007, -48.333586147055","p",TRUE,-0.0118283348531814 +"pcor.mat",6,"24.3941873777658, 0.587183143943548, 50.1822246704251, 61.6280217655003, 74.6993770357221, -69.6933365892619","-72.6307827513665, 21.0318620782346, -32.1439458057284, 26.9628962501884, -2.04706066288054, 33.2147478125989","66.891982126981, -18.3136829175055, 88.7454390525818, 78.3952571917325, -97.2121218219399, -20.8632645197213","s",FALSE,-0.303802497166359 +"pcor.mat",14,"-77.750310394913, 86.9882957544178, -85.0523100234568, -36.57017191872, -18.1189219001681, 20.1568298507482, 87.3199927154928, -10.1865636650473, 87.327975500375, -17.7946219686419, 4.59059923887253, 19.7666067630053, -31.7012812476605, 52.6644026394933","-60.2974510286003, 74.7249050065875, 1.42830195836723, -15.9695675596595, -83.7907467503101, 55.462152371183, 41.3278543855995, 89.4937683828175, -57.9569500405341, 74.0428008139133, -79.0337625425309, -49.0267637185752, 97.498970804736, -30.8440355118364","-91.0899322014302, 73.1682816520333, 92.4029916524887, -80.4349666461349, -33.0292509868741, -17.2952547669411, -51.6502045560628, 81.4240960869938, -72.4618446547538, -26.8657810520381, -4.80628688819706, 72.3387493286282, 2.85462928004563, 23.4467320144176","k",TRUE,0.000509880332891465 +"pcor.mat",13,"10.7691071461886, 65.1007527951151, -12.0915657840669, 91.6448481846601, -53.240419505164, -69.8381493799388, 21.602482162416, -34.3285651411861, 43.1247111409903, -37.4003404285759, 94.0640051383525, -65.0122064165771, -7.96503899618983","-85.3995600249618, 67.8450697101653, -56.2912890221924, 58.0509331542999, 36.6984612308443, 87.1452712919563, 49.0658250637352, -52.1726700011641, 94.9811044149101, -53.7899555172771, 39.8667695466429, 98.3075775206089, 63.3846609387547","-46.4738335926086, 37.4508975539356, 44.48222653009, 8.24846290051937, -69.1236611455679, -95.8152562379837, -3.39012276381254, -2.47371718287468, -11.9899280369282, 43.2109453715384, 2.20609768293798, -49.9354481697083, -95.7224021200091","p",FALSE,0.380657823856592 +"pcor.mat",5,"15.9143696073443, 48.3970512636006, 23.7569111865014, 83.6479561869055, -89.9238623213023","-20.0500118546188, 93.1261721998453, -91.0053466912359, -23.429145431146, 45.976064959541","-2.69081904552877, -4.5110234990716, -33.4870064165443, -74.1843503434211, 2.36937236040831","k",FALSE,0.218217890235992 +"pcor.mat",6,"10.1451388094574, -90.6787392683327, -87.4421800021082, 20.2668400015682, 78.3513565082103, 20.7683491986245","-97.6740748155862, 10.7196703087538, -54.752997867763, 80.7648414280266, 12.498453585431, 29.1912749875337","-63.6234064586461, -45.7921910565346, -50.1311025116593, -91.5211007930338, 16.7567258700728, 85.7384174596518","p",FALSE,0.236960037693682 +"pcor.mat",12,"73.2413066085428, -14.7738272324204, 50.0003031920642, 45.0548450928181, -48.7516783643514, -23.1134415604174, -87.6020579133183, 30.5087967775762, 82.4424541555345, 72.7492412086576, 32.3323079384863, 85.7122719287872","-9.44385454058647, -7.42488116957247, 3.06755122728646, 35.4948386084288, 69.3501094356179, -19.1765882074833, 95.9793315734714, 29.2394527699798, 53.3461356069893, 11.7002569604665, -71.7540245968848, 20.5835649278015","66.2635098677129, 48.2205909211189, 81.5142437815666, -31.1989811249077, 5.75581910088658, 93.6992627568543, 72.9302003979683, 30.9292090125382, -55.1979901269078, -78.7769370246679, 14.8034851066768, 37.4370891135186","p",TRUE,-0.48727199671024 +"pcor.mat",10,"52.8255486860871, 34.2574729584157, 44.7404673323035, 52.2620148025453, -69.898310629651, -85.9551533591002, -52.2192012518644, -56.3183640595526, -19.7211066260934, -6.08869907446206","-67.6190298050642, 75.8668028283864, 74.6253774967045, -66.1169764585793, -81.1506592668593, -33.249074826017, -21.2896263692528, -97.763530863449, -54.6630097553134, -96.6868148185313","-35.384417232126, 13.2294847629964, 22.9882229119539, -58.4000170230865, 88.3519669994712, 59.8886359948665, -30.7637225370854, 40.6464832834899, -62.5224160030484, -0.506686419248581","p",TRUE,0.492210961830229 +"pcor.mat",8,"18.1551295798272, -8.32464881241322, -99.8132115229964, 18.6201244592667, -53.1589215621352, 70.2180631458759, -36.3900125026703, 92.1965328045189","6.02451944723725, -68.5814322903752, 70.58563423343, 1.00183109752834, 16.1975951399654, 64.5838780794293, -84.6291496884078, -54.131712205708","80.0181794445962, -12.9483319818974, -3.88606782071292, -48.0255630798638, -3.62709653563797, 31.62224679254, 57.1325340308249, -93.3892488945276","p",TRUE,-0.141482085540883 +"pcor.mat",17,"90.1813358999789, -3.33601352758706, -70.5867488868535, -40.8890372607857, 58.0897845327854, 8.4102772641927, 31.2019024044275, 67.8843731526285, -5.85478777065873, 93.743189284578, -21.4788604527712, 48.0386326089501, -42.5454632379115, -78.037649858743, 5.827397108078, -59.5929707866162, 22.9059528559446","46.3524929713458, -42.5642458721995, -69.567626202479, 91.2107714917511, 80.4405058268458, -83.3648740779608, -5.59279890730977, 67.8364232182503, 9.23628495074809, -45.9923652466387, -2.29323050007224, 92.1013004146516, 34.326039114967, -10.8744602650404, 89.988622488454, -23.287376947701, 72.6627949625254","48.8092821557075, -84.7605162765831, -68.7700709793717, -67.7357694599777, 25.1485624350607, 61.709990631789, 29.2394532822073, 47.8424397762865, 37.0008739177138, -47.5637663155794, -14.6964757237583, -69.9305152054876, -54.4029568322003, 80.0897337496281, 9.39622772857547, -1.27441040240228, 74.3666623719037","s",TRUE,0.270551782409472 +"pcor.mat",13,"-68.030820786953, 48.6679933033884, 51.8114904407412, 78.5725246183574, 18.9902665093541, 25.0479029957205, 56.8353782407939, -4.79650879278779, -87.2707166243345, -64.176924712956, -56.511168833822, 41.7948929592967, 79.8323729075491","87.0083963032812, 12.2851114254445, -48.7783022690564, 2.98262075521052, 61.5149905905128, 72.0769232138991, -33.8758388534188, 19.778781151399, -12.315073935315, -95.3089885413647, -40.8825332764536, -50.1593578606844, -29.2145641520619","82.5196304824203, 86.4081613719463, -63.7102510314435, 82.9122426919639, 86.7011873517185, 1.18320896290243, -7.11194663308561, 31.899410719052, -69.8009483516216, -57.3877718299627, 2.83222463913262, -17.2023222781718, -38.1276280619204","p",FALSE,-0.215982700387935 +"pcor.mat",12,"-36.3307877443731, 74.7712590266019, -79.8354192636907, 93.8916243612766, -50.0289557501674, -54.7662570606917, -38.7290718965232, -84.6648510545492, 71.2978508323431, 88.4917345829308, 32.1320930030197, 76.4375317841768","2.62319510802627, -97.154287295416, 21.7567156534642, 95.8672656677663, -0.763413123786449, -9.49476859532297, 83.9058271143585, -38.3374994620681, -16.9302582275122, -85.5358060449362, -83.2731044851243, -18.7622617464513","-76.2503104750067, 36.5515212062746, 48.5381714068353, 72.03823258169, 36.652302602306, 29.980877507478, 21.0754222236574, -96.8017131090164, -66.5918422862887, -10.5546385981143, 91.4459123276174, -84.6182245295495","k",TRUE,-0.161695275103975 +"pcor.mat",13,"65.4542396776378, 2.08085202611983, -88.9037624932826, 52.2526708897203, -38.4136536624283, -13.373964605853, -48.226101975888, 93.4839099645615, 39.563751546666, 69.0497747156769, -94.8003361001611, 24.9876524321735, 25.2306204754859","82.8150092158467, -9.80691406875849, -84.2437265440822, -48.5185658093542, 93.8153511844575, 76.507264515385, 96.1720596533269, 91.2560781463981, -86.2542728893459, -47.9744947515428, 25.5869822110981, -15.71259717457, 99.3623040616512","64.0070253051817, -90.157330268994, 78.4984151832759, 36.6091389209032, -85.7790939509869, -43.4162854682654, -81.61596711725, -7.2117717936635, 69.8510519228876, 87.7512107603252, 60.0242395885289, -77.6109307538718, 33.9131449349225","s",FALSE,0.0846468464958684 +"pcor.mat",14,"6.42584343440831, 89.4456365611404, -94.9723384808749, -4.63838037103415, 82.1529622189701, -72.2434451803565, 21.8717840965837, 13.9814134221524, -70.8967028185725, 99.243081593886, -67.1596728730947, -69.3361242301762, -52.0885898265988, 54.4663844164461","-6.86167716048658, 63.0930243059993, 62.3814635910094, 42.8769947495311, 12.4187188688666, -55.67507436499, 68.4297569096088, 57.5610874220729, -4.82598571106791, -79.5595136005431, -55.5029585491866, -94.9160863645375, 82.0372765418142, -52.3549461271614","-96.7493511270732, 16.427826648578, 26.2085369322449, 89.924060087651, 64.0857739374042, 65.0612049736083, -50.4840951412916, -27.8882106766105, -37.310868408531, -41.0194541793317, -37.8566451836377, -97.9508240241557, -74.5396174024791, 76.8885430879891","p",FALSE,0.0312670434242096 +"pcor.mat",12,"34.8341395147145, 43.1037290487438, 82.2314764373004, -63.9271955937147, 70.3003748320043, 51.0297972708941, 95.4673350322992, 74.5106549467891, -71.5771752875298, 32.5960139743984, 85.8803272712976, -12.2395237442106","-27.241831831634, -76.5246210154146, 86.3751742523164, 74.9675445724279, 63.8482879847288, 14.7356034722179, -30.9328155592084, 73.2200371101499, 26.5261144377291, 42.3744561616331, -80.7972604874521, 95.1648845802993","30.9194989036769, -29.2449895292521, -75.1953874249011, -97.2041368950158, -63.0337142385542, -96.9185112509876, -72.140100877732, 50.4067888017744, 80.1865959074348, 69.9119384400547, 28.0939280521125, -78.1314740888774","p",FALSE,-0.344081701794653 +"pcor.mat",17,"-32.3364136740565, -74.5505046565086, 64.3489994108677, 95.3302425798029, -47.4365599453449, -99.5640191715211, -81.8646350875497, -10.4291386436671, -46.2970128748566, -66.2438121624291, 3.38349812664092, 46.3537188712507, 50.3833524882793, 76.8161817919463, -35.9225623309612, -30.2367287687957, -15.6686681322753","-85.6091414112598, -74.5855379849672, 31.7983427084982, 12.1914628893137, -76.0027903132141, -25.2544173505157, -53.2312866300344, -66.4824201725423, -35.0571169052273, 25.0753607135266, 57.0668096188456, 97.4866581615061, -34.1166456695646, 70.7655222155154, -25.6891251541674, -99.2252895608544, 30.7619682978839","44.1535466350615, 57.7384070493281, -42.7488908171654, -81.2754278071225, 97.9185460601002, 35.2168054319918, -26.9714017864317, -93.0728284176439, -60.7041460927576, -99.858339689672, -53.829790558666, 85.15021414496, -98.6793769989163, -86.0895386897027, 51.4472865033895, -15.630559111014, -28.9994670078158","k",TRUE,0.261679778734634 +"pcor.mat",10,"89.7360242903233, 47.9975900612772, 36.5392371080816, -51.0348361451179, 7.82818463630974, -6.9301129784435, -75.5731589626521, 47.0917036756873, -58.8109106291085, 33.4785438142717","54.0308193303645, 41.3668432738632, 98.2857145369053, -14.9101806804538, 30.7341996114701, 92.3570320941508, -35.8356348704547, -91.0546428058296, 77.7767921797931, 13.7820704840124","-65.3565419837832, -24.2730437777936, 13.4862332604825, -97.8464429732412, 91.0171907860786, -52.4954450316727, -31.7320866975933, 33.8117491919547, 49.1156910546124, -42.7486607804894","p",FALSE,0.109506018207148 diff --git a/tests/unit/computations/partial_correlations_test_data/pcor_rec_blackbox_test.csv b/tests/unit/computations/partial_correlations_test_data/pcor_rec_blackbox_test.csv new file mode 100644 index 0000000..a1558a0 --- /dev/null +++ b/tests/unit/computations/partial_correlations_test_data/pcor_rec_blackbox_test.csv @@ -0,0 +1,101 @@ +"function_name","count","x","y","z","method","rm","result" +"pcor.mat",13,"-89.1427156049758, -70.2603165991604, 52.4590492714196, -57.2846714872867, -26.3361851219088, -0.000567594543099403, 17.9622953757644, -64.1319836024195, 39.2497098539025, 20.8931459579617, 74.1897551808506, -35.3126015048474, -55.9552798978984","47.3745858296752, -68.9209029078484, -31.9765134248883, -45.0486478861421, -85.1716816890985, 65.432888455689, 19.2734406329691, 87.9198614973575, -68.2076670229435, -38.1280574947596, 52.754437038675, -73.271297942847, 67.7760738879442","-78.9239354431629, -85.3030194528401, -20.3673145733774, -22.6184178609401, 16.5013548452407, 18.5637861024588, 96.5889988467097, 36.156284250319, 35.1589790545404, -73.1023930944502, -50.7484216243029, 41.8345319107175, -47.8776978328824","s",TRUE,-0.0325789017360908 +"pcor.mat",18,"64.013504376635, 53.1150240916759, -77.8307237662375, -33.1533540505916, -13.6034480296075, 93.2804300449789, -46.3470680173486, 17.427362408489, -66.663983091712, 4.23776390962303, 77.7521491982043, -3.10332304798067, -61.5989458281547, -13.5284000542015, 7.71856023930013, 89.0885920263827, -35.3556916583329, -95.9261478390545","-35.6941626407206, 41.877265740186, 69.6430462878197, 64.2008605413139, -59.4343301840127, 79.7348674852401, 61.3097242545336, 9.0187989640981, 51.7997904680669, 45.9638734348118, 41.0136769060045, -73.4738738741726, -47.0628185197711, 57.6456079725176, -2.5194660294801, -53.7642545998096, 18.9816055819392, -54.8453160561621","-55.6193302385509, 63.7390994466841, 85.8707739040256, -77.2866525221616, 29.9346832558513, -24.1673247888684, -61.8650471325964, 19.6793714072555, -60.1225732360035, 12.063248641789, -51.2589928694069, -41.5690367575735, -58.2409225869924, 37.0499972254038, -9.5894614700228, 2.70932037383318, 56.0281782411039, -39.5718538668007","s",FALSE,-0.0406099988399257 +"pcor.mat",18,"56.9747474044561, 55.6495593860745, -36.6002877708524, 61.6530403494835, -11.1073412466794, -70.2817751094699, 34.5848673954606, -40.1073589455336, 22.4086964968592, -34.9243235308677, -31.6865964792669, -81.9148152600974, -7.01485783793032, -0.294096721336246, -19.4921953603625, -55.370055232197, 33.2327066455036, -65.3158040251583","-13.8067095074803, -83.5349172819406, -12.6486663240939, -8.66694604046643, 86.2149322871119, 60.7879475224763, -73.3523240312934, 34.5676413737237, -4.87876599654555, 18.5876747593284, 89.8641737177968, -72.3610286135226, -32.7410754282027, 27.3812759667635, -45.791448559612, 80.4758272599429, -76.585627021268, -36.1723904497921","49.7649329714477, -56.3095143996179, 92.719935066998, -17.5905505660921, -34.11227283068, 8.69290293194354, 51.1472036596388, -52.1146316081285, 18.716375855729, 44.0671648364514, -81.5424187108874, 17.9900521878153, 83.1838137004524, -36.2067365087569, 6.58109332434833, 33.7925261352211, 43.0417039897293, -24.2647144943476","s",FALSE,-0.326536819677434 +"pcor.mat",16,"-27.0166050642729, 25.6161904428154, 18.0927545763552, -97.8309890720993, 83.225102070719, 41.1768469493836, 52.531653130427, 90.7089609187096, 45.9316388238221, 44.4865159224719, -65.3349446132779, -63.2685597520322, -63.5370531585068, -20.7488086074591, -21.5636825188994, 70.8061812445521","89.9359612260014, -24.0224461536855, -88.7139027938247, 33.0363452900201, 89.8786358069628, 72.6242340635508, -33.4980245213956, 18.209078675136, -98.510293290019, -45.0928752310574, -56.3632266130298, 36.2233767751604, 24.8566114809364, 41.1938649136573, 98.1815246865153, -31.8091072142124","-83.4077485837042, 67.2828705515712, -46.1948299780488, 44.6621300186962, -68.071247311309, 69.5944227278233, -72.4484366830438, -19.5607443805784, -10.3165994398296, -38.1281117442995, 92.4075163435191, 27.103430358693, 7.35686598345637, -68.8319525215775, -35.345290414989, -22.3868970759213","s",FALSE,-0.265133848612843 +"pcor.mat",16,"62.6007101032883, -31.4669733867049, -1.02701690047979, 89.1588015947491, 89.4676355645061, 72.146376548335, -48.5373890493065, 27.8906877152622, 84.9362426437438, 22.9195747990161, -0.477400049567223, -55.017494270578, 16.0360316745937, -40.5794956721365, -76.5294233337045, 99.2066614329815","32.9774639569223, 99.4476685766131, 19.444046029821, -87.4037025496364, -49.6627463493496, -79.1786927729845, 69.5362528320402, -42.9193137213588, 88.4448691736907, 96.2614195886999, 99.7840614058077, -30.6426415685564, 52.9562290757895, -75.0585582572967, -92.611052794382, 67.6107355859131","99.6344119310379, -43.7020116951317, -14.1780937556177, 29.8982600681484, 67.7026726771146, 12.5789169687778, 5.22102704271674, 47.3305377177894, -10.2066915482283, 44.158894661814, 16.616974119097, 67.5522029399872, 10.2959530893713, 2.26272544823587, -24.1713169030845, -81.4385517500341","k",FALSE,0.00170394349277265 +"pcor.mat",17,"-43.6796560417861, -52.3636834230274, -32.689885282889, 29.6649182215333, 70.8439419511706, -78.822322236374, -7.2787752840668, -37.7680024132133, -9.91778918541968, 45.4824290703982, -1.96461407467723, -10.768158081919, -71.2498663924634, 23.788648378104, 81.2093367334455, -29.8483492340893, 42.7211379166692","54.4582905247808, 2.90980748832226, -49.7587429825217, 90.0067212525755, -62.2195774223655, 49.5222055818886, 64.7147801704705, -30.6467334739864, 43.9336315263063, -24.3989814538509, 93.3036277070642, -5.72181586176157, -51.6447205562145, 71.4890264440328, 35.5837760493159, -39.9753636214882, 64.5502870436758","-86.5306067280471, -2.41111759096384, 17.8865785710514, -66.7758407536894, -45.9109436254948, -99.6982547920197, 9.07599623315036, -49.4003663770854, -50.0817076303065, -52.7716889511794, 9.27476715296507, -1.14214201457798, -14.0225571580231, -46.0782612208277, 97.4677567835897, -70.6407638732344, -99.1432263981551","p",TRUE,0.181498113250831 +"pcor.mat",14,"-4.90339081734419, 72.9479049798101, 46.9192364253104, 92.628131667152, 56.5425228327513, 9.90580045618117, -61.4272825885564, 33.6759516969323, 81.8828757386655, 77.3399218916893, 67.7938031964004, 94.0767949912697, 82.1635375730693, -75.240781577304","21.4586552698165, -36.5642888005823, -38.3646843954921, -49.740192014724, -81.6746165510267, -19.1730958875269, 41.690668836236, -23.3391010668129, -78.1760632060468, 77.431286778301, 70.3289750963449, 39.766847435385, 3.62148815765977, 10.747673548758","17.7063988521695, 90.0697568897158, -93.0447159335017, 85.4728828649968, -18.4118247125298, -9.85785778611898, 70.2666643075645, -97.7391937281936, 54.3527046684176, -51.4394805766642, 39.0205434523523, -25.6685835774988, -14.7992834448814, 81.1236747074872","p",FALSE,-0.21445656018345 +"pcor.mat",15,"-76.8736738711596, -35.8509941026568, -48.1256343889982, -9.57123078405857, -72.2122399602085, -6.98926709592342, -31.3491718843579, 74.3320995010436, 54.9155391287059, -46.5018933173269, 51.3019453268498, 17.0857016462833, -99.9900157097727, -17.3139852005988, -85.5749220587313","-97.7581001352519, -97.2672377247363, -27.3427923209965, -1.21665806509554, -8.05344670079648, 21.0991605184972, -54.0536799002439, 95.0312656350434, 23.7382718361914, -98.728937190026, -80.2528636530042, -59.6354123670608, 20.57563085109, 90.7686199061573, 19.6493336930871","-38.4617018979043, 28.0117013957351, -74.6210919693112, -34.3639187980443, -28.0167740304023, -46.0126685444266, 37.4354778788984, 41.0279822535813, 80.8140107430518, -94.7356107644737, -91.9223290402442, -34.4586562830955, 90.2129443362355, 76.8807396292686, 80.0070276483893","k",FALSE,0.250746493151452 +"pcor.mat",7,"-66.7350410018116, 53.2712059561163, -43.8059563748538, -44.9987557251006, -67.2016165219247, 17.9846523795277, 77.0553316920996","-60.9613332431763, 99.9187499284744, -27.7070741169155, 14.3416102975607, -30.3307291120291, 5.47642167657614, -52.1709493827075","5.97298364154994, 70.3716231975704, -16.247583553195, 92.1821707859635, -80.4653100203723, -7.83197041600943, -66.9684283901006","k",TRUE,0.241209075662211 +"pcor.mat",18,"94.380710972473, -10.0111012812704, 85.1797969080508, -11.4021800924093, -99.7310696635395, -57.7457085251808, -34.8813917022198, 37.1367971878499, -57.5784567277879, 17.9361389484257, -20.6278771162033, -42.8640173282474, -62.0093574281782, 10.7791527640074, -42.4936424475163, 31.2512285541743, -6.26639267429709, 50.0969529151917","-35.3466201107949, 51.2795441318303, -9.26330988295376, 13.2600117940456, -70.25914513506, 24.8688437044621, -95.0622762087733, -78.8527075666934, 12.5830010510981, -40.3181817382574, -62.1690618339926, 65.2437281329185, 45.4263514839113, -20.7038762047887, 19.835890410468, -16.3075220305473, 10.154833085835, 31.5655742771924","-47.5495883729309, 31.0941505245864, -11.7687386460602, 47.550484072417, 19.7334853932261, 59.856044081971, 38.4999468922615, -29.1666014585644, -77.8870329726487, 75.2757792361081, -17.8823099005967, -93.2831089943647, -73.6799968872219, -36.3856283016503, 21.7388028744608, -41.7408903129399, -21.9456392340362, 5.71200731210411","p",TRUE,-0.153597125133576 +"pcor.mat",15,"-83.3593410905451, 33.8860942982137, 17.5660732202232, 44.9482867959887, 3.40795461088419, -98.6972364131361, -57.9294378869236, 49.1425832267851, -81.4089713152498, 22.2765766549855, -15.2078927494586, 64.7270672023296, -77.9068617615849, -13.5009704623371, -41.0612959414721","99.4176274631172, -28.8145580794662, 24.2324681021273, 70.3792416490614, 55.1269176416099, -46.6643883381039, 13.5340544395149, -81.6506992094219, 7.58900847285986, 76.2214359361678, -21.0444819182158, -19.7882746346295, -77.8520357329398, -60.2931962348521, -30.685667693615","-7.22203818149865, -62.021238123998, -34.5286842435598, -67.4230553675443, -62.1439764276147, -99.2042647209018, 7.09792547859251, -88.8404605910182, 79.5403079129755, 68.8092908356339, -87.8009828273207, -11.8701789993793, -40.4039821587503, -50.0366650056094, 61.1679489258677","p",TRUE,0.134662220884382 +"pcor.mat",18,"36.4026268012822, -40.8853712491691, 70.4748715274036, -93.3088712859899, -31.1693381983787, 44.5810994133353, -29.8538233153522, -55.898003000766, -83.1116971559823, 95.2613319735974, -86.9839164428413, -99.6416668407619, -71.7915004119277, 86.375200515613, 73.0707975570112, 9.46915657259524, 30.3790966048837, -32.9175783321261","20.2463141642511, 35.3073101490736, 96.6094605624676, 38.2854318711907, 20.0914516113698, -76.2724542990327, -2.5904384907335, 28.1036204192787, 27.5573522783816, 41.8770257849246, 17.9975534323603, -53.0143345706165, -1.92109285853803, -43.1404768954962, -89.0914923511446, -75.2585290931165, 31.8984744139016, -81.7458927165717","99.058653973043, -73.045432055369, -98.9125271327794, -10.9370147343725, 93.4558239299804, 21.3814281392843, -10.9608757775277, -94.0566421952099, 29.180516814813, 60.7905065640807, -69.4182314909995, 27.9442990664393, 16.5212750900537, -65.4938052408397, -91.3346993271261, -19.3851371761411, 54.6318108215928, 94.2573416978121","s",TRUE,-0.0480625888230071 +"pcor.mat",8,"70.9466312080622, -31.7683406174183, 25.0176505185664, -56.8918467033654, -9.20995227061212, 84.6444204915315, 66.9992076698691, -14.915213920176","-25.2351951319724, 53.1852985266596, 32.9547242727131, -82.4257594533265, -51.8481220584363, 61.490266257897, 16.8974718544632, -71.770367724821","25.6255140993744, 62.6514744479209, 2.26075490936637, -90.3473023790866, -8.56978320516646, 89.0561478678137, 3.07730589993298, 45.6199106760323","p",FALSE,0.307942034203085 +"pcor.mat",18,"23.8564316183329, -16.3905590772629, -12.3555054422468, 78.1761512625962, 49.3263760115951, 13.6127803940326, -35.0881972815841, 18.7167634721845, 47.3916597198695, 6.6052196547389, -47.4990267306566, 36.3517801277339, 77.3957766592503, -70.3038077335805, -28.512022132054, 93.2541827205569, -50.6320198066533, 2.28197425603867","4.66441703028977, 52.664560964331, 64.6692745853215, 64.0807087533176, -42.2254925593734, -28.3238022122532, 84.3502655625343, -22.6033370010555, -63.9537113253027, -82.1724142879248, -47.163494117558, 86.9036048650742, -25.5253764800727, -40.6565339770168, -64.6023235283792, 5.88995609432459, 60.3537472430617, -12.8357082139701","-7.05419671721756, 17.8630999755114, -94.5426801219583, -90.8921510912478, -52.0795451011509, 52.0008019171655, 77.9491205234081, -64.4113312475383, -13.6109072715044, -84.2732723336667, 57.4606000445783, 57.2238144930452, -17.8435018286109, 78.159570787102, -64.3654571380466, 25.7219140883535, 21.2949032895267, -89.99102874659","s",FALSE,0.098864763229466 +"pcor.mat",8,"36.1457616556436, 98.2861819211394, 40.8350063487887, 63.7187578249723, 13.0914898123592, -52.3402118124068, -13.3677611593157, 73.598525673151","79.2985305655748, -71.9141394365579, -0.420988909900188, -90.6284262426198, 72.2033147700131, 79.6287265606225, 20.301692513749, -54.6786930412054","96.6230187565088, -65.8682400360703, 26.0384120512754, -46.9612662214786, 47.5940535310656, -17.1155892312527, -45.7220804877579, -67.2774867620319","s",TRUE,-0.725794650937327 +"pcor.mat",6,"-57.665149634704, 94.4162191357464, -51.1441508308053, -52.6072693057358, -44.1887341905385, -14.2386069521308","-98.8703572191298, -9.2983465641737, -79.2660262435675, 23.2223530765623, 80.3647544234991, -58.0826134420931","81.1863256618381, 64.9427580181509, 45.6761348526925, 64.8033803794533, -40.9290973097086, -92.1668177470565","p",TRUE,0.118780545543647 +"pcor.mat",11,"40.5678772833198, 33.8221173267812, 65.0725501589477, 78.8693956099451, -35.8988873194903, -35.3420054074377, -87.4633281026036, 0.115021411329508, 67.6265092566609, 83.1133821513504, -18.3507286012173","-73.7955948337913, 29.9831629730761, 65.2690784074366, 25.2531439997256, -62.1108427643776, -47.4723324179649, 35.5791020672768, 26.2222751509398, 40.3645094949752, -91.2350233644247, -28.6233199760318","48.7291889730841, 33.8533046189696, 66.3264122325927, -19.7420272510499, -46.8001568224281, -39.1347371973097, 34.7272414714098, 65.1918939314783, 99.5216719806194, -29.0462920907885, 19.8831745423377","s",TRUE,-0.297493089362279 +"pcor.mat",11,"55.8680928312242, -76.9269882235676, -17.3182043712586, 15.2775115799159, -90.3137100860476, -99.032783228904, 13.8755587395281, -24.003914417699, 21.2662550620735, -8.40797564014792, -40.8448379952461","9.94491642341018, 76.8310205079615, -95.3446100465953, -74.8744533862919, -69.8509857058525, 6.55742576345801, 24.8502014670521, 97.212969744578, 29.4545858632773, -77.6854024268687, -80.0981419626623","14.1451966483146, -52.5070706848055, 52.3787314537913, 22.6627501659095, 5.18406489863992, 78.4387116320431, -37.6045362092555, -59.8206405062228, 97.1690027043223, 46.7755769845098, -23.1495135929435","k",FALSE,0.0919698779952353 +"pcor.mat",19,"12.6561464276165, 89.6340752951801, -86.4221294410527, -8.45101773738861, -79.0324212051928, -41.2799602374434, 41.9530363287777, 77.5156316813082, -98.2695916201919, 54.0546870790422, 18.4697377029806, -92.1382030006498, 22.3036497831345, -88.4184999857098, 87.4229540582746, 84.4335915520787, -86.3810521550477, -4.96541885659099, -4.21266416087747","77.7516108006239, 13.0087590776384, -52.281900215894, 46.1203761398792, -7.93849290348589, 30.4574410431087, -4.16998718865216, -76.5136891510338, 65.0717901531607, 41.985437553376, -10.8945969026536, -1.79670625366271, -80.059599224478, -27.9757288750261, -3.81275764666498, -40.5276663135737, -7.72571838460863, -21.2847925722599, -3.90572124160826","-16.1283437628299, -86.2985316198319, 15.8964606467634, 45.3664765227586, -10.7382515911013, -61.8415161035955, 75.2832551952451, 62.1664110571146, 14.5355282817036, 31.9144344422966, 63.7715006712824, 46.5569637250155, 20.0197615195066, 9.47772678919137, -79.8056298401207, -89.03838978149, 96.9052662607282, -3.97900892421603, -68.8863600604236","k",TRUE,-0.0783868693007469 +"pcor.mat",6,"41.7150890920311, 68.0406647268683, -56.6652314271778, -10.3111394215375, 72.7076691575348, 16.4696130901575","55.7349273469299, 33.0129407346249, -92.8235503379256, 67.6610651891679, -28.225592058152, 27.8548604343086","97.3419046029449, 92.7794307935983, 18.738874187693, -50.2989741973579, -31.1240924987942, -47.357566608116","k",FALSE,-0.0545544725589981 +"pcor.mat",7,"76.1037406977266, -51.2855937238783, -51.0953912511468, 61.8452743627131, 27.5623431429267, 32.935436675325, -23.7891209311783","-25.5972837097943, 35.7565317302942, -2.09780340082943, 31.380487093702, -65.0630551856011, -52.5524016004056, -45.8224846515805","35.1819013711065, 55.421924777329, 90.8943614922464, 65.8556955400854, -17.2470153309405, 50.2847956493497, -43.5768135823309","k",TRUE,-0.241209075662211 +"pcor.mat",14,"-86.9700414128602, -96.2525710929185, 13.2297853473574, 48.3323885593563, -42.72451386787, -64.586602896452, 26.2733123730868, -41.4743609726429, -27.5131822098047, -62.4261621385813, -16.2857410497963, 61.4362000953406, -71.6986550018191, 6.73192692920566","-1.76208755001426, 67.4144621472806, 40.1256877463311, 20.0672226957977, 75.7373407483101, -60.1804342586547, -24.0758131723851, -30.328988051042, 98.3264557551593, 18.7257033307105, -74.7150662820786, -66.4480000734329, 83.1373671069741, -83.8592982385308","-8.51446660235524, -33.5672379937023, 23.1306486297399, -71.0971800610423, -76.6779989469796, 17.668380215764, -6.54176617972553, 38.9708994887769, 36.8745916523039, 36.466611456126, -42.6107963547111, -43.292662827298, -34.305056463927, 3.72276022098958","k",FALSE,-0.237726218501727 +"pcor.mat",9,"87.9827535245568, 66.9526648242027, 77.764587290585, -63.0833296570927, 12.8970904741436, 12.7532111946493, -15.7931709196419, 76.1098874267191, -53.3998124301434","61.8036749772727, -53.057945612818, -21.9204508699477, -23.7275714520365, -81.9658347871155, 96.6755392961204, 23.4129578340799, -26.8468076363206, 11.6413829382509","6.22031539678574, -63.707418506965, -68.8293416053057, 51.3240036088973, -89.1044299583882, 96.3014227803797, 84.1399733442813, 3.21415988728404, -64.009400550276","p",TRUE,0.220999575445754 +"pcor.mat",18,"-2.85750310868025, -99.3862376082689, -96.015146560967, 63.2039456162602, -66.0570687614381, -66.0487032029778, -16.3392898160964, 93.4929385315627, -0.228785490617156, -94.138465821743, 89.7544200066477, -39.7632111795247, -60.3579618502408, -34.7465238533914, 49.7126227244735, 56.9427436217666, 69.6163312997669, -16.7142637073994","67.1196629293263, -69.1413426306099, 90.1762881316245, -33.8058187626302, 73.66002057679, 34.5961081795394, -59.5154983922839, 1.26353777013719, 48.2069759164006, -34.2219550162554, 14.3829472362995, 41.6792382951826, 39.1247006133199, -38.8760752510279, -11.6304269526154, -13.3687050547451, -5.31534324400127, -2.51060193404555","-86.3554051145911, 29.0978434961289, -95.5027301795781, 63.6454623192549, -29.499419266358, 73.207819275558, 39.0617064666003, -92.9985575377941, -51.6290077473968, 12.2396486345679, 48.3567856252193, -28.516500396654, -21.0198899265379, 53.046905528754, 44.2176911514252, 0.109824910759926, -99.0703694988042, 74.6371628716588","k",FALSE,-0.0887556361629261 +"pcor.mat",5,"24.8151850420982, -55.3720602765679, -48.1912312563509, 25.3140340093523, 7.37709770910442","27.1002457011491, 51.559735648334, 15.2347642462701, -19.9469642713666, -71.4244599919766","20.2690705657005, 10.2111615706235, 28.9990232791752, -81.5356591250747, 62.7182307653129","p",TRUE,-0.595476592392643 +"pcor.mat",10,"-80.8792762923986, -16.7048441711813, -27.4036565795541, 83.73913182877, -29.9381176009774, 53.5984759684652, -74.8886847868562, -35.0239771883935, -89.2459953203797, 42.7505305968225","55.4137516766787, -70.6881674006581, 32.317240908742, -69.2246387712657, -93.5175380203873, 42.5839690491557, 39.2618721351027, 19.604005292058, 29.0025069378316, 31.9192183203995","-57.4748635292053, -17.7012801170349, 86.0102667473257, -97.6800283882767, -33.8488628156483, -80.713168065995, 1.30178248509765, -82.9571642912924, 20.4808691516519, -23.3784267678857","p",TRUE,-0.247808971782581 +"pcor.mat",7,"-9.81413833796978, -95.0588807463646, -37.4823603779078, 96.0915867704898, 25.3856145311147, -90.2806713245809, 56.4173173159361","-17.8975068964064, -45.0020219665021, -53.689378220588, 13.3858302142471, -95.0690850615501, -45.9697632584721, 5.96692659892142","-74.4352919980884, -79.8946594353765, -36.3220115657896, 71.3168484624475, -32.7676126733422, 74.5314478874207, 47.3017191980034","p",TRUE,0.380658349962746 +"pcor.mat",7,"-12.2942595742643, -46.0883136838675, -21.6881454922259, -19.7250084485859, 54.6898206695914, -67.8715384099633, -98.035113979131","-31.2075863592327, -53.7305776961148, -96.1716986726969, 34.0433329343796, -86.3202335778624, -98.4303006436676, -81.2778456136584","-78.2337430864573, -33.7292415089905, 14.364256337285, 80.8441326953471, 14.6734802983701, -38.598564080894, -16.4908449631184","k",FALSE,0.233736747502114 +"pcor.mat",12,"65.5728437006474, -22.3883016966283, -16.1309017334133, -86.9484126102179, 55.0275014247745, 75.5027377512306, 56.8217232357711, -10.157274780795, -8.05552089586854, -95.0297535397112, 86.99438595213, 56.2756833154708","-50.9940889663994, 31.0440130997449, 55.3901108913124, 0.67323399707675, -93.814965011552, 43.19629650563, 82.1691108867526, 29.7341026831418, 23.4111852012575, -23.9989855792373, -41.8117068242282, -21.0978685878217","-94.9003085959703, 76.4557474758476, 71.228800015524, 1.28989322111011, 56.7563532851636, -74.5477284770459, -40.1864093728364, -62.3711896594614, -63.5766193736345, -34.8390635102987, -34.4627866521478, -60.8579785563052","k",TRUE,-0.0642824346533225 +"pcor.mat",16,"10.3261223994195, -66.3412994239479, -10.04778011702, 90.8491815906018, -16.8091387022287, -1.13998735323548, 8.87222946621478, 62.9582400433719, 51.0545901022851, -42.0804372988641, -72.740743868053, -98.6990892793983, 25.1725806389004, 30.7280816137791, 3.96932810544968, -57.8030949924141","60.728229675442, -74.0803788881749, -73.4922635369003, 21.5669278986752, -2.4874959141016, -42.8831906523556, -8.72258436866105, 41.053393855691, -49.3829999119043, -25.329764559865, -33.0748493783176, 64.0028734691441, -75.2295605372638, -3.0173609033227, -40.6044688075781, -90.4325042851269","-26.9309993833303, -77.9300230089575, -34.1201750095934, 18.6427622102201, -11.5215779747814, 43.2106466032565, 52.0845813211054, -27.0871427375823, 78.9493581280112, -60.0895206909627, 75.2652967814356, -64.8424350190908, 74.5653890538961, 79.290065029636, -83.871082868427, -55.8636627625674","p",TRUE,0.232814351928154 +"pcor.mat",18,"-94.2430725321174, -51.8685480579734, 21.5350433252752, 4.50745574198663, 44.5271090604365, 75.3100082743913, 36.3767127040774, 58.3390053827316, -33.6587901227176, 53.1314761377871, -90.0304151698947, 1.84677322395146, -43.2471524458379, 20.721254684031, -35.7563958037645, 44.6534116752446, 78.0897385440767, 62.626903411001","-86.8268391583115, -67.7875887136906, -20.8753589075059, -28.825512342155, 41.2515165284276, 6.46749134175479, -87.1187134645879, -87.9431148990989, -47.1682616043836, 7.15450858697295, -31.9803619757295, -45.8144799340516, 47.6873302366585, 94.4961855188012, 70.8510945085436, -10.3092920035124, 68.0197277572006, -86.2225097604096","42.146764555946, 35.4582188185304, -74.8004557099193, -69.1695068031549, 9.96355945244431, -1.00409551523626, -56.0459699481726, 57.2666853666306, -75.3820521291345, 61.0693466849625, -80.6058402173221, -28.1722619198263, 29.1725110728294, -84.9811018910259, 52.4267561268061, 3.33783319219947, 57.3508915491402, -16.6291590314358","k",TRUE,0.126881965715119 +"pcor.mat",11,"58.4281201008707, 18.3633047156036, -74.4007679168135, -70.9485304541886, -62.3421670403332, -75.4027212038636, -42.2465549781919, 45.5137318000197, -59.8607284482569, 62.6728146802634, 78.3472507726401","78.8005036301911, -11.6723335813731, 47.760496661067, 72.8375401347876, 44.0390994306654, 49.5243767276406, -49.906044267118, -93.3100801426917, 74.181916937232, 8.72853924520314, 83.0030017532408","-7.40372859872878, 19.830649998039, 32.0547481998801, -24.0255577024072, 15.4005860444158, 13.1488932296634, 8.03853832185268, -78.5669906530529, 80.1699983887374, -99.4674043729901, 40.1027225889266","p",TRUE,0.0557153883247975 +"pcor.mat",8,"-3.19936256855726, 41.1430836189538, -40.9489492420107, 32.8621160238981, -55.2679274696857, -85.6475236825645, -98.9018370397389, 37.6923420932144","-23.4679078217596, -70.4765893053263, -29.5889834873378, 73.5305113717914, 66.7411952745169, 8.31683478318155, 14.5889795385301, 72.6518555544317","78.9658954367042, -43.0149876978248, -8.42135692946613, 0.82630286924541, -0.558331841602921, -30.3489441052079, -19.2593446467072, 59.6474095713347","s",TRUE,-0.211100165460375 +"pcor.mat",12,"-46.8561482150108, 87.6810635440052, -57.6411653775722, -46.4993360452354, -35.9383462462574, -96.4581338688731, 72.101165773347, -92.8533762693405, -24.3875949177891, 81.7434745375067, 95.8580058533698, -39.7297702729702","-14.3783972598612, -62.9489183891565, -88.967556739226, 5.93087510205805, -20.3817227389663, -28.1361578963697, 98.5170270781964, -62.3654518276453, -21.2714700959623, -75.4275092389435, -45.0435093604028, -52.5260332040489","84.6728871576488, 77.3271079175174, -35.2307356428355, -63.2898768875748, -62.9697222262621, 57.5104051735252, -65.9628365654498, -77.7099144645035, -68.1009365711361, 21.6217519715428, 40.7055628951639, -11.8265327066183","p",FALSE,0.240265915193204 +"pcor.mat",14,"-65.2285707648844, 21.9669322483242, 73.5851485282183, 28.0581893399358, 34.4764126464725, -12.0250980835408, 44.0008006524295, 16.8571741785854, -32.5285179540515, 40.1795001234859, 14.344258280471, 42.7343318238854, 33.5459096822888, 17.8732588887215","-17.1958317514509, -31.969396257773, 26.989441877231, 52.442137664184, 42.9547981824726, 32.2006456553936, 80.7050887029618, 7.4744014069438, -56.099244300276, 47.6363920606673, -16.8571050744504, -45.9946841932833, -51.3697457965463, -93.8083261717111","-83.2655881065875, -35.3444519918412, 20.8411808125675, -89.538209233433, -85.8607416506857, -4.87791770137846, 16.466785594821, 71.7880600132048, -90.7291606999934, -47.3672876600176, 28.5109816584736, -6.68758857063949, -37.6607090700418, 78.6420990247279","k",FALSE,0.293285288009136 +"pcor.mat",6,"-46.0385966580361, -99.5740628801286, -29.4129090383649, 97.0183642581105, -37.6902215648443, 80.4221050348133","-88.8656401075423, -39.0352664981037, 37.8500768449157, -3.4251865465194, 16.7551717720926, -64.4463129807264","-85.469913110137, 82.1475684642792, -79.0366449858993, -17.5424363464117, -55.2734784781933, 8.78398092463613","k",FALSE,0.218217890235992 +"pcor.mat",19,"94.6966245770454, 80.9601898305118, -27.9354885220528, 32.8651154879481, -83.5247790906578, 68.0820679292083, 98.2801185455173, -51.8296324182302, 22.2090682946146, -57.0902567822486, -79.9241363536566, 82.232602359727, -31.2431594356894, 47.0965832006186, 45.9447079803795, 83.7373214308172, 43.1115242652595, -15.8762097824365, 24.6083721984178","-30.2270193584263, -18.9653075765818, 32.3881921358407, 62.3213729821146, 48.8383719697595, -64.4200759939849, -34.4498374499381, 74.7035726904869, -80.0148021429777, -72.3529085982591, 97.3054904025048, 81.4842638093978, -75.7931782398373, -36.0045140143484, 52.190304454416, -46.3511400856078, -27.5253375060856, -49.8220588080585, -94.6963192429394","-1.14815644919872, 38.8675629161298, -7.72479912266135, 80.9100962709635, 7.58379022590816, 83.3296971861273, 51.7409536056221, -33.8198636192828, -63.4376135654747, 80.6679456029087, -83.3767011761665, -82.7897766139358, -25.5388389341533, -99.9377169646323, -91.8954541441053, -75.1720157451928, 85.5636859312654, -35.8674420975149, -14.8491851519793","k",TRUE,-0.0612260637897383 +"pcor.mat",11,"43.6715835239738, 83.24592593126, 80.5671546142548, 50.718885473907, 91.4832427166402, -72.9882646352053, 1.08670038171113, 65.7646540552378, 32.857545139268, 98.8540512509644, 57.310037733987","-68.5883652418852, 57.6829582452774, 20.3366491477937, -20.9295519161969, -91.220309631899, 67.5120797473937, -84.0667628217489, -92.758432822302, 73.1769519392401, 31.0191483236849, -59.8639046307653","60.0395560264587, 49.4410765822977, -15.0798926129937, 76.642445102334, 43.1489706039429, -64.028698252514, -73.5862046014518, -11.8118531536311, -14.194271247834, 19.1962173674256, -62.6884501427412","p",TRUE,-0.239620090137985 +"pcor.mat",5,"84.436381328851, 72.004076000303, -40.9433365799487, -11.7642278783023, 36.9735128246248","92.926798760891, -99.3128840345889, -34.4348025508225, -47.6723862346262, 94.1138706635684","2.33245906420052, 59.2558087781072, -17.9977843537927, -79.5293167699128, -57.2229819372296","k",FALSE,0.0890870806374748 +"pcor.mat",13,"-52.8125622309744, 3.65753290243447, -17.9872157517821, 0.687318574637175, 48.9896171726286, -10.9520922414958, -42.2161420341581, -8.33622729405761, -52.7692852541804, 46.2861472740769, -63.7141830287874, 77.9755924828351, 69.3693526089191","-81.1979313846678, -81.2067239545286, 98.1338402722031, 81.5591927152127, 37.056217668578, -30.573401786387, 86.0113869421184, 22.4740816745907, 15.2922587003559, 4.40599746070802, 81.2510290648788, -91.3585484493524, -51.8274602945894","1.68427461758256, 35.6400829739869, 1.32666421122849, 28.9358278736472, 69.9353440199047, 22.5035205483437, 42.7461497485638, -60.8904164750129, 41.2500537466258, 72.3914569243789, -35.3465625550598, 11.877816170454, 41.2654601968825","s",TRUE,-0.432235260027861 +"pcor.mat",6,"36.2520147580653, -45.3618559986353, -3.36455763317645, 27.1406658459455, -32.130736252293, 89.6533737424761","91.0997018683702, -58.0772765446454, -45.8715479355305, -76.4125521760434, -51.5536211896688, -28.4703179262578","-59.4199031591415, 60.7980337925255, 86.4012580364943, 43.8618046697229, 27.8941972646862, -83.8361509144306","s",FALSE,0.361111111111111 +"pcor.mat",15,"-15.8772577065974, 12.7610163297504, -22.9708819650114, -71.8580039218068, -75.8046543691307, 47.7548703551292, -24.9429981224239, -31.5219290088862, -80.9420365840197, -0.135115487501025, 43.7512583099306, 82.602039212361, 32.6054238714278, 52.4210862349719, -25.4571683704853","2.32095182873309, 57.4718285817653, 91.6442870628089, -0.498835230246186, 42.3996091354638, 98.4292598906904, -69.7168925777078, 17.9197568446398, -60.0217215251178, -94.6461838204414, -56.8148406222463, -86.9362941477448, 23.4191815834492, -67.045795917511, -25.982434488833","88.8973289635032, 31.7113435361534, 1.63480490446091, 90.244840271771, 90.7815016340464, 3.64356338977814, -70.6344856880605, 20.8035066723824, 71.0505054797977, -41.0872615408152, 81.8894566036761, 27.3655611090362, -57.8210411127657, 80.1123460754752, 37.0346592739224","s",TRUE,-0.100259767542805 +"pcor.mat",17,"-8.47610384225845, -76.0521722026169, 36.9659481570125, 27.2644958924502, -63.1253079976887, -45.7246268168092, -91.299555497244, 79.9444675445557, 62.6849308609962, 77.2913023363799, -39.3468747846782, -31.9794123992324, -90.5704878270626, 3.36136179976165, 6.36215764097869, 34.7822861280292, -86.7615907918662","38.8797430787235, 87.957543740049, 27.9284121934325, -2.19381097704172, -93.5423448681831, -85.8565270435065, -1.78483547642827, 32.4997876770794, -84.6204502973706, 73.0989838484675, 46.5271977707744, 19.7806170675904, 2.54705562256277, -62.6201322302222, 47.8446535300463, 94.2804395221174, 43.5015312861651","-42.1679470688105, 44.9353978503495, 4.3509088922292, -26.6828402876854, 45.7676482386887, 34.6878333482891, 86.2517770845443, 54.4100513216108, 62.1482897084206, 93.2931664399803, 48.1029566843063, -49.8642263934016, -79.5734560117126, 82.6493532862514, -56.327466852963, 30.9423569124192, -75.3295318223536","k",FALSE,0.173343955251749 +"pcor.mat",15,"-12.115827947855, -23.5690898727626, 89.8483640048653, -76.0832019150257, 54.2692786082625, -31.3360400963575, -87.8199052065611, 62.5256759114563, -85.054659191519, 17.1253859531134, 86.8644420057535, -63.6440661270171, -2.54382686689496, -52.1825547330081, -86.5487120579928","87.855874421075, 11.8729826528579, 58.581341477111, -76.1566527653486, -54.7422365285456, -76.9119961187243, -51.5453061554581, -8.55491124093533, 41.1004772875458, 4.76148361340165, 27.0399220753461, -93.3408699929714, 43.2594683486968, 97.5612652488053, -27.2557357791811","-25.7235449738801, 98.6250419635326, -33.5626783315092, -76.8353697378188, 5.53134111687541, 11.2494019791484, 53.6648289300501, 58.8696902617812, 74.8723800759763, -83.5754144005477, -2.30161873623729, -0.636160280555487, -32.3559941258281, 9.53439651057124, -96.3161264080554","k",TRUE,0.203279781135864 +"pcor.mat",10,"-88.6766928713769, -99.7512009460479, 36.3819673191756, -78.1028961297125, 26.9118153490126, 8.51810127496719, 25.9507332928479, -2.06361203454435, 61.8650326039642, 53.7325612269342","44.7955575305969, -23.4671366401017, 67.7940716035664, -61.1387377139181, -77.4398116860539, -9.6572854090482, 29.9326512031257, -50.3714796155691, -29.1814834810793, 77.4120518472046","53.5698696039617, -33.2331659272313, 29.2508830782026, 30.7888105046004, -75.6014665588737, -21.6426336206496, 49.8834919184446, -31.1990667134523, -49.9284417368472, 52.3363713175058","s",TRUE,0.461061427308285 +"pcor.mat",16,"-83.9224993251264, -98.9909253083169, 41.2098858971149, 40.319947944954, -22.3131684586406, -4.72695007920265, 71.1222126148641, -73.4416379127651, 19.5892326999456, 51.5542230568826, -59.8082218784839, 83.2985554821789, -73.8052498083562, 81.1506273690611, -62.3849936295301, -65.9225380979478","-22.3732136655599, -76.6401294153184, -14.9951294530183, 17.2481925226748, 36.7321326863021, 30.8906201738864, -36.0778030008078, 27.3618204053491, -25.5863894242793, -77.5616424623877, 71.2329083122313, 92.7250783890486, 18.0521029513329, 20.1161385513842, -37.0644447859377, 74.0854462143034","63.1498238537461, 67.5584438722581, -2.90364040993154, 86.5714854560792, 80.625259783119, -83.5466306190938, -89.0106877777725, -11.5085924509913, 95.1227321755141, 26.8994387704879, -36.1149361357093, 13.4227952454239, -22.9821641929448, -81.5770137123764, 99.1007934324443, -24.637895449996","k",TRUE,0.00117273434060522 +"pcor.mat",12,"-30.6264939717948, -51.3202500529587, -91.8923989403993, 71.2572688702494, -50.3101641312242, -43.5825682710856, 68.9194604754448, -62.2129834722728, 74.4652757886797, 10.5425884481519, 39.5969454664737, 43.8930058851838","-3.49326506257057, -40.981019847095, -1.93292065523565, -55.6563400197774, 30.0884651020169, 5.1898842677474, -57.6860777102411, 92.7335068583488, 4.2677782010287, -73.3723870944232, 37.4122668523341, 97.195135615766","0.661881873384118, -77.0722641143948, 80.916742188856, 84.3042341526598, 60.0523283239454, -15.8854037057608, -41.8266508728266, 90.2447595726699, 78.685249062255, -98.4303796198219, 53.0869376845658, 97.2957746591419","s",TRUE,-0.309246046562802 +"pcor.mat",8,"43.6172465793788, -28.597435541451, 49.3047020863742, 23.4949984122068, 55.2344744559377, 50.4013098310679, -61.0196806956083, -13.4925350546837","-28.0354068614542, -58.4258052520454, 91.4929724764079, 5.28197917155921, 6.99444795027375, -37.798970984295, 14.2839945387095, 93.0717419367284","65.1908750180155, -76.971767982468, 78.4851297736168, -27.8413584455848, -14.1628153156489, -37.5672557391226, -58.8539640419185, 51.5223218593746","p",FALSE,-0.457862137278786 +"pcor.mat",5,"7.32707628048956, -97.153510292992, -58.0732712056488, 5.43075683526695, -50.3950014710426","-60.6064203195274, 70.2952838502824, 7.70989404991269, -90.4186028987169, -91.9082495383918","-27.0302977412939, -71.8158513773233, 60.5169426649809, -51.2578745372593, -71.4558880776167","p",FALSE,-0.811742988157054 +"pcor.mat",12,"-31.9100445136428, -15.4961660970002, 15.1833237614483, -96.8389748129994, 34.0211338829249, -26.4210654422641, -74.7212948743254, -73.451091023162, -48.6799724400043, 43.3380767703056, 33.7157489266247, -12.9206308629364","-25.7156142964959, -31.4395876601338, 27.1043297369033, -64.4430394284427, 69.3326181732118, 11.0314972698689, -56.0946275945753, -5.32854660414159, 61.7247725371271, -58.0520442686975, -98.0296685360372, -83.8190475013107","65.2698641642928, 23.0271658394486, -30.5951663292944, 87.3122846707702, -96.8001709319651, 80.7323037646711, 92.8447821643203, -96.3675274513662, -33.6922558955848, 59.8475752864033, -96.7984095681459, 82.4916113168001","k",TRUE,-0.0909090909090909 +"pcor.mat",12,"90.1167266536504, -66.6625558398664, 39.782078191638, -58.8765672873706, -59.9938517436385, -76.4870832674205, -10.5842749588192, -75.7783581502736, 1.28461210988462, -34.5959145110101, 50.9478696621954, -96.5802219230682","38.6262435931712, -94.669465906918, 56.7374847829342, 36.0493461135775, -54.2134216055274, -63.6453815735877, 81.5788346808404, -68.2411943562329, -22.1247639041394, 92.5449587870389, 35.5207106098533, 94.1242534667253","86.8828876875341, -60.6638357974589, -8.42275521717966, -64.6387516520917, -62.6291708089411, 40.5554509721696, 6.27670022659004, 24.3925095535815, 30.6437145452946, 9.16047729551792, -63.2885267492384, -17.5928950775415","s",TRUE,0.261481371449354 +"pcor.mat",18,"80.5951167363673, 90.9240923356265, 70.6974952481687, 68.0134673137218, -44.9470512103289, 25.955663016066, 30.7497585657984, -91.8298844713718, -4.40605725161731, 49.3009329773486, -78.929325286299, -78.4197290893644, 44.3274276796728, -61.9072982110083, 16.9208872597665, 88.0656720604748, -0.423743482679129, -22.9118093848228","31.6178977955133, 6.30270089022815, 87.8026704769582, -79.791863868013, -2.2237554192543, -26.5245907008648, 91.646106634289, -67.9212915245444, 32.4714999180287, 76.9008807372302, 92.0271085575223, 37.951097311452, 55.0852465443313, 81.3659423030913, -61.8186100851744, -34.2142827343196, 3.76891982741654, 9.98605671338737","94.6255694609135, -84.6232280135155, -26.6939069610089, -79.9416828900576, 61.19120195508, 4.79885442182422, -36.1860592849553, 71.0645910352468, -88.2137383334339, -8.42098467983305, 58.1183904316276, -15.7302843872458, -4.05891095288098, 85.9798874240369, 94.7344854008406, 7.95916928909719, 78.0328324530274, -99.0391628816724","k",FALSE,-0.107524911773377 +"pcor.mat",7,"-38.9586756005883, -57.8867371194065, -68.1198546662927, -89.4594067241997, 70.7473307847977, -35.7670163270086, 52.0461404696107","21.6805159114301, -28.8543162867427, -22.0741868950427, -84.8189734853804, -35.3580724913627, 19.6727192029357, 21.0121315903962","66.0285493824631, -4.54495996236801, 64.9962153751403, 74.2479239590466, 59.3966994900256, -13.1802632007748, 10.3553391993046","s",TRUE,0.253320198552449 +"pcor.mat",9,"-6.78211716003716, -79.588529560715, -65.7252383418381, 45.60412671417, 98.0520688928664, -76.6070755198598, -40.7307191286236, -14.1458517406136, -83.4068476222456","-41.9686838053167, 40.0618359446526, -71.2534620892256, -78.1008904334158, 13.2995546329767, 44.5248483214527, -82.3847197927535, -89.4571373704821, -79.4600131455809","-85.7230886816978, -13.998108310625, 66.9168075546622, 29.5824715401977, -86.4490587729961, 90.6398146878928, 32.4118531774729, 27.7746527921408, 80.8882680721581","p",FALSE,-0.28294999490249 +"pcor.mat",13,"-87.399728782475, 40.3655833564699, -3.77177731133997, -0.913261342793703, 84.5598533283919, -57.672530086711, 70.6847531720996, 17.5953175872564, -43.7333907932043, -24.1470513865352, 71.5449669864029, -51.1317191179842, 20.0356021057814","-39.3181677907705, 76.6436085104942, 45.0167378876358, -12.2507677879184, -11.5627334453166, -64.4468226004392, 81.8960891570896, -71.4755731634796, -82.4792180676013, -31.5537444315851, 22.1059046685696, -33.5309320129454, 48.856098158285","-25.2732687629759, -77.4636949412525, -31.5821984782815, -97.6564433425665, -5.07994783110917, -54.0312268771231, -50.5725503899157, 4.37337355688214, -9.34875644743443, 70.4601784236729, 40.7617360819131, 92.1488650143147, -10.1492855232209","k",FALSE,0.494775334448826 +"pcor.mat",5,"-95.295644691214, 85.2518345229328, 70.6566654611379, -15.488860104233, -39.7784407250583","54.2502315249294, 28.1581053044647, -68.6268703080714, -3.80988898687065, 53.7825032602996","-3.1055589672178, 6.64212079718709, 43.7012503389269, 17.2084089368582, -85.3145365137607","s",TRUE,-0.458831467741123 +"pcor.mat",16,"97.809230722487, -14.316190360114, -84.721079049632, -18.7376644462347, -25.5602215882391, 17.7533380687237, 39.1872539184988, -94.0707533620298, 2.72555686533451, 22.7984459139407, 59.4628068618476, -40.8906124997884, -92.1079889405519, 29.8243676312268, -12.0696670375764, -89.7928544320166","26.7640289384872, -96.4622846804559, -40.3722857590765, -80.3130167070776, -68.9347126986831, 98.9100785925984, 31.9554898422211, 64.5670853089541, -50.01574116759, -97.6768167689443, -87.454877840355, -74.6697645168751, -17.0667306985706, -20.0176582206041, 61.2935196608305, -60.0398785434663","42.3937499523163, 46.829612692818, -93.9524796325713, -63.3410033304244, 87.3350779991597, 9.56030515953898, -6.86939819715917, 6.62593231536448, 30.0475670956075, -67.5459566526115, 12.8623825497925, 19.4047554861754, 17.8637056145817, -45.1789702754468, -44.4462891668081, -58.5556023288518","k",FALSE,-0.0864597208956419 +"pcor.mat",13,"77.1156166680157, -4.95218234136701, -0.478975335136056, -88.6164400726557, 79.5374071225524, 64.5803040824831, -2.80681941658258, -79.7279377933592, 99.2951272986829, -97.9579760227352, 30.6757009122521, 1.96241005323827, -16.967974929139","-96.855311980471, -56.1395757365972, -2.78360079973936, -33.6360565852374, -44.3065817002207, -95.199401024729, -27.0363926421851, 75.0894209835678, 4.99337976798415, -7.82306902110577, -81.4332918729633, -56.5008042845875, 19.696054328233","16.2967632059008, -25.3815619740635, 94.3077141884714, 47.4075115751475, 96.9511947128922, -23.1907044071704, 38.797459891066, -97.7688763756305, -28.7548608146608, -83.8516177609563, -7.49311237595975, -26.1195019353181, 48.4767589252442","p",FALSE,-0.477487484222149 +"pcor.mat",9,"-39.2630732618272, -89.935081731528, -46.2339258752763, -89.5339810289443, -4.36198632232845, -14.5440776832402, -95.7827549427748, 93.4488965664059, 81.2002772465348","99.4978452567011, -30.0176431890577, -63.0747328046709, -54.7369061969221, 39.9523709435016, -27.1971534471959, -94.4386278744787, -78.7398369051516, 18.4704976622015","-42.4461417831481, 81.5393285825849, -52.1045574918389, -19.8012057226151, -87.6727635972202, -26.1554778087884, 5.14846704900265, 16.3954760879278, 75.12436225079","k",FALSE,0.20385887657505 +"pcor.mat",15,"60.3103106841445, 71.4415548369288, -98.9705654792488, 7.11592291481793, 10.6087463442236, 42.708487669006, 82.4820324312896, 38.3419292513281, 85.0099918898195, -0.90777650475502, -92.9779385682195, 3.21783553808928, 97.79725340195, -15.0709590874612, -88.6436254251748","59.2901791445911, -3.65023575723171, -0.826246337965131, -92.2944152727723, 4.78945928625762, -35.9777873847634, -4.00528195314109, 14.427507808432, -36.5650984458625, -30.6801207829267, -33.1895301584154, -72.0329152885824, 88.569199340418, -63.0710757337511, 81.6133069805801","-4.55778324976563, 49.8842949513346, -24.1089406423271, 15.2178956661373, 93.4157602954656, -14.0120008029044, 74.634336354211, -76.262500602752, -0.484065152704716, -24.2140971589833, 55.4016582202166, 59.3731869477779, 79.561612335965, -26.1603471823037, -32.2228459641337","p",TRUE,0.111079544613507 +"pcor.mat",12,"-47.1727962139994, -62.7806689590216, 14.7163263522089, 98.5433207359165, -2.45944913476706, -48.7231005448848, 15.0826691649854, -78.9477611426264, -66.5948192588985, 8.53210580535233, 33.7848087307066, -11.1786916386336","-53.4802015405148, -67.8791525308043, 16.3833658210933, 8.16084523685277, -68.3082328177989, 52.1591320168227, -94.9673681054264, -51.7830446828157, 48.8592490553856, 80.6429937947541, 18.254310823977, 21.4851890690625","59.5537723042071, 28.640017285943, -53.3816957380623, 52.5868681725115, 61.431689793244, 38.7933161575347, 63.6210044380277, 74.1345513146371, -31.347640696913, -11.0894621815532, -53.0158845707774, 53.0884329695255","k",FALSE,-0.138443731048635 +"pcor.mat",6,"16.9672078453004, 39.5416527055204, -65.5000091996044, -90.130511764437, 63.6201905552298, -18.7544235493988","-81.3643315806985, 87.5242207664996, -87.3709872830659, -94.47445650585, 80.7427565567195, 97.7012349292636","21.0985390935093, -19.1841311287135, 61.7898017633706, -90.6381107866764, 61.5531626157463, 50.346623826772","s",FALSE,0.58925565098879 +"pcor.mat",7,"-56.6911320667714, 14.7237893659621, 72.7042480837554, 67.854171898216, 54.2756285984069, 87.7428719308227, -62.4983601737767","56.7447266541421, -63.2602260448039, 95.9155341144651, 79.549733037129, -31.7429569549859, -96.1661211680621, 89.6558737382293","17.7951748482883, 52.8001375962049, -17.0254016760737, -0.180792575702071, -69.1782949492335, 5.72048868052661, -73.80879400298","p",TRUE,-0.344955719900739 +"pcor.mat",14,"8.34259777329862, -90.7544204033911, 53.8198739290237, -73.6186733935028, 65.3159111272544, -54.8385083675385, -56.6149288788438, 93.1464713532478, -49.6990147978067, -62.7166502177715, 26.090932963416, 59.4254573341459, -78.5409053321928, 13.1633264012635","71.73405229114, 47.2987382672727, -66.5379968006164, 80.1759538240731, -32.3648356366903, 10.4439327027649, -84.9242614582181, 98.0132193304598, 31.8165130913258, -75.4577403888106, 27.8047663159668, -52.8659251984209, -61.3233786541969, -31.609858199954","92.3250074964017, 41.1538690794259, -70.4804343637079, -33.9494093786925, 67.3102808184922, 30.5022850167006, 14.392489567399, -66.8610816355795, -21.4584674686193, -87.7356766723096, 86.1648599617183, 34.3186971265823, -45.2394630759954, -97.3335643764585","p",TRUE,0.0376321132257061 +"pcor.mat",19,"17.2792347613722, 44.7029660455883, 7.22097363322973, -65.7868965063244, -75.2946712076664, -75.9451765101403, -65.4915338382125, -42.1579808928072, 0.180424936115742, 60.9645693097264, -79.4751405715942, -88.1112538278103, -3.82754770107567, 11.970756854862, -89.807746373117, -75.4269581288099, -83.210919983685, -49.4484897702932, -79.4092588126659","98.0341942049563, -77.4498141836375, 28.0400432180613, -31.759634707123, -8.49162279628217, -77.7130985166878, -44.0454395022243, -40.247108368203, 44.3426605779678, 48.202803870663, 13.207955705002, 27.6490168180317, -3.62952486611903, -15.9190153237432, -34.1904443688691, -1.11497580073774, 10.264601605013, 39.9211245123297, 27.739332895726","88.2835000287741, 33.0788629129529, 66.6329775005579, -58.9400433935225, -67.8360211662948, -23.8581227138638, -64.4136915449053, -71.0973926819861, -6.4570713788271, 5.39726838469505, -64.308940153569, -80.775932315737, 17.806462245062, 64.6042937878519, 25.6625287234783, -53.9103304501623, 10.1242880802602, 31.6518820822239, 71.827148180455","p",TRUE,0.0548011187422948 +"pcor.mat",15,"-48.3876196667552, -26.4751517679542, 86.0122847370803, -2.21008872613311, 88.2522213738412, 36.0168526880443, 53.617551876232, 46.2094876449555, -55.7492116466165, -48.1529265176505, -27.9851477127522, 62.0271205436438, 6.54048435389996, 65.1294771116227, -97.3066220059991","88.3713206741959, 70.3678138088435, -17.6713398192078, 92.8743582218885, 67.6384199876338, -56.5470991190523, 28.6562576889992, -89.9442651774734, 14.1420055180788, -39.6874803584069, -68.7506389338523, -46.1653867270797, 54.8760372679681, 31.6477505024523, -74.1190653759986","-50.7720490451902, 13.1769198458642, 60.0184863433242, 69.6465944871306, -4.16778987273574, 42.1332813799381, 44.0076574683189, 47.2968339920044, 47.09054636769, -90.304255951196, 90.9836431499571, 61.1754382494837, -95.954512199387, 65.8738845027983, 18.4467539191246","p",FALSE,0.155278581425428 +"pcor.mat",12,"66.9760071672499, -10.0718723144382, 98.4006015583873, 49.9737814068794, 93.0611060000956, -30.8278535492718, -49.5318784378469, -74.5468678884208, 53.2779390923679, 45.9250777494162, 7.21664810553193, 98.5868971794844","86.4792299922556, 66.300771990791, -30.303956894204, 99.7657214757055, 21.8715326860547, -0.453599169850349, -49.4858743157238, 95.0286555103958, -75.6651264615357, 61.6245118435472, 50.6951719522476, 73.4736283775419","-76.645670318976, -46.4482659008354, 14.1620874870569, -42.584248399362, -53.2975015696138, 54.3731088284403, 94.7233782615513, 5.24166952818632, 33.9543189387769, -39.5664878189564, -64.9096461012959, 64.3044523429126","k",TRUE,-0.029027606770737 +"pcor.mat",5,"90.8192429691553, 48.4106589574367, -21.8404297251254, 41.0448144190013, -83.0681975465268","-59.1780140064657, -51.5384333673865, -47.804808197543, 12.2319002635777, 15.4189415741712","87.9196766763926, 56.3696804456413, 10.8711638953537, -25.8778809569776, -61.6596679203212","p",FALSE,0.828266806248407 +"pcor.mat",15,"-84.2769027221948, -99.7776164673269, 53.0052073765546, -56.7098737228662, -87.9683969076723, -51.0782906785607, -35.9742659609765, 17.2527201939374, 58.1052905414253, 79.0114177856594, -98.0878078378737, 49.7950758785009, -84.3974281102419, -79.6418719459325, 82.9541291110218","91.2282381206751, 32.1592024061829, -55.6543642189354, -73.2480760663748, 2.29297978803515, 88.1192316766828, 70.9258356131613, 8.78023901022971, -54.8915889114141, -16.0259561147541, -62.4688476789743, 35.7657310552895, -85.5574174318463, -78.2423210795969, 57.0005943533033","68.9237471204251, 97.5910210981965, -70.7898926921189, 78.3896393608302, -26.9685154780746, 31.1476676724851, -7.25077791139483, 4.25968733616173, 71.4906623121351, 99.7103612869978, -70.5109211150557, -29.5995627064258, -89.8151689674705, -61.3775999750942, -23.73201623559","s",TRUE,0.131094606641465 +"pcor.mat",12,"-4.51542986556888, 65.3962709475309, 54.7027637250721, 21.8017288018018, -45.6481758039445, 56.3114468473941, -10.0910985376686, -33.9759476948529, 47.1306453458965, -81.5762444864959, -15.2306498959661, -55.8099669404328","78.4110291860998, 51.8248929642141, -74.8319068457931, -27.2911807522178, 99.4782904628664, 96.8407794833183, 88.3730117697269, 51.7726821359247, 34.6810360439122, 94.3698732182384, -27.2285795770586, 60.5969968717545","-56.935870507732, 35.1825864054263, 46.9766597729176, -0.979113671928644, -0.491952011361718, 2.96344561502337, -53.3740632236004, 63.3763818070292, 98.6882844939828, 32.3614825028926, -9.01708984747529, -89.2050859052688","k",FALSE,-0.238461538461539 +"pcor.mat",16,"-86.2841431982815, -18.3129501063377, 60.0204044952989, 49.4004330597818, 73.2034908607602, 36.0958587378263, -26.9164501689374, 99.3937272578478, 99.4885763153434, -15.9275187179446, -64.6454212721437, -25.9472228586674, 35.9230092726648, 25.0261219218373, 17.5404471345246, 1.84494755230844","96.1923027876765, -42.1271054539829, -8.16392744891346, -97.7614040952176, -10.3897859342396, 63.9586094766855, -50.9310736320913, 82.2031420189887, 72.7375000715256, -22.3871399648488, 57.6591491699219, 90.738725150004, -46.6567573137581, 94.6342563722283, -29.7158366069198, -79.2119293473661","-22.4795233458281, -96.3848259765655, 21.2546060327441, 68.0201687850058, -97.928561642766, -67.2587384004146, 44.8108606506139, 82.0129224099219, 24.2342098616064, -86.4289211574942, -79.5525341294706, 19.2005013581365, -51.4744527172297, -63.8537698891014, 17.4904732964933, -32.1932288818061","p",FALSE,-0.0517037216543802 +"pcor.mat",9,"-12.2494653332978, 81.3471322413534, 15.8859042916447, -40.0486988015473, 52.4177443701774, 19.3593227304518, -47.6214892696589, 98.4649391379207, 73.2301543932408","89.4672878552228, -82.9613993875682, -66.7588278185576, 78.6925439257175, -4.60034948773682, -52.7979515027255, 2.19829431734979, 72.0490128267556, 86.0512541607022","33.8618124369532, 90.739763667807, -55.6767753791064, 39.5474712364376, 83.0445552710444, 34.4050417654216, -59.1911187861115, -8.19138023070991, 99.0859573241323","p",FALSE,-0.198035626518398 +"pcor.mat",10,"47.6879670284688, 16.5959696285427, -63.4765389375389, -27.5170926470309, -22.5022290833294, -43.0537707172334, 70.5259828362614, 59.2826380394399, -88.5750241577625, -1.89512646757066","-61.3072986714542, -26.0851273313165, -8.67939637973905, -27.971677435562, -40.7435014378279, 1.29813449457288, 2.31690336950123, 16.4261620491743, -52.7925265487283, -89.1311551444232","52.5048244278878, 4.67872102744877, -46.2626181542873, -45.9650584962219, -50.2988358028233, 87.9835510160774, 56.6933359019458, 96.3448523078114, 53.302510920912, 1.91744468174875","p",FALSE,0.0988233148075562 +"pcor.mat",9,"14.4472865387797, -47.3339173942804, 88.0170038435608, -31.5219953190535, 46.918716840446, 56.6940610762686, 6.99824644252658, 98.6299303360283, -5.93640897423029","22.6194951217622, -77.684145513922, 75.3283645957708, -40.9434220287949, -38.5339342523366, -91.2029369268566, -63.4814173448831, 10.7932053040713, -49.4684089906514","-33.6434269323945, 73.0934476479888, -23.9013602025807, -76.148905325681, 60.0582375656813, 70.3553961124271, 7.24662998691201, -66.3810072466731, -94.6542747784406","s",TRUE,0.541229427257326 +"pcor.mat",14,"62.3325610999018, 28.3598528243601, 45.8982207346708, -8.46395660191774, -63.4389164857566, 72.4040941335261, 0.539024919271469, 91.1112579517066, 16.1043775267899, 68.5833586845547, -90.9464060328901, -99.2442855145782, 17.0317857526243, -9.96274407953024","-4.58235912956297, 11.521205957979, -75.3375723026693, -5.17353126779199, -40.0790630374104, -70.08021697402, 53.5009195562452, -58.0623977351934, -9.79966381564736, -35.5031280312687, 68.6820048838854, -48.3796393033117, 10.2691211737692, 52.6988474652171","41.5283095557243, -6.18213326670229, -20.2820646576583, -43.5107395984232, 97.0502740703523, 60.2817252743989, 1.80356446653605, 48.0388806201518, 13.3720958605409, -19.7484199889004, 65.0038605555892, 86.6087830625474, 84.9961121100932, -55.2010769490153","p",FALSE,-0.496536277317825 +"pcor.mat",11,"-86.8348072748631, -68.1555027607828, 93.7882163096219, -17.574486322701, -3.01832188852131, 82.4596357531846, -70.7045842893422, -41.0055582877249, 85.1761696860194, -76.0164870880544, 9.26548577845097","78.6481990013272, 33.5281310137361, -46.5702877379954, 13.5015867650509, 11.9400870520622, 28.7497514858842, -32.9607792664319, -34.5967058558017, 46.3658351451159, 53.1044125556946, 88.4551724884659","8.02730321884155, -14.3242678139359, 10.4656010866165, 44.1013956442475, 41.8432073201984, 16.2981065455824, -42.1405011322349, -81.4176644664258, 41.9636760372669, -95.8132732659578, -96.6605862602592","s",FALSE,-0.187531875709659 +"pcor.mat",15,"-8.95890998654068, 87.6476715318859, -82.3296630755067, 54.1639633011073, -56.9908442441374, 32.6043246779591, -85.6081826612353, 77.9518540017307, 26.4017198700458, -99.6459340676665, -2.37713954411447, 57.1259008720517, 15.9859085921198, -21.3041906710714, -88.4612631518394","71.0004774853587, 33.6280925199389, -44.5519751403481, 61.0465653240681, 82.826607953757, -72.3422850482166, -27.0270694512874, -48.9543684292585, -13.1586199160665, -48.2837385963649, 71.7649020254612, 89.9132785387337, -46.7835825867951, -5.76893505640328, 68.2509062811732","-79.8319123219699, 4.72839176654816, -51.0409486014396, -58.6709169205278, 53.0833051074296, -70.3293783590198, 19.1716862842441, -67.5588438753039, 62.886883597821, -96.4109890162945, -34.4456045888364, 45.6756661646068, 47.4764776416123, 7.42012783885002, 38.5514346882701","s",TRUE,0.0110289747628682 +"pcor.mat",16,"31.4061987679452, -74.9066208954901, -64.9867978878319, -5.39299356751144, -53.42126484029, -47.4726263433695, 69.5169975049794, 31.62314100191, -22.9675776790828, -74.656882788986, -1.33912023156881, -98.8822244573385, -35.7455586083233, -33.464961964637, -3.55721861124039, -27.8399859089404","72.7164791896939, -83.5368575528264, 64.1068436671048, 3.18035068921745, 71.0855689365417, -68.9065222628415, 88.6347917374223, 84.7157137468457, -38.3024057373405, 8.57474114745855, -65.9063815139234, 43.8279079273343, -6.10163295641541, 61.0187361482531, 2.19916221685708, -9.51254032552242","56.0140502639115, 56.2448440585285, -48.0950287077576, -38.731576455757, -71.3526351843029, -26.7311075236648, 50.0080749392509, 39.7566744126379, -0.389600452035666, -6.86149629764259, -87.0373306330293, -5.545165669173, -14.8602196481079, -45.7474006805569, 10.8187668025494, 45.559770334512","k",TRUE,0.236643191323985 +"pcor.mat",6,"43.2217205408961, 95.0128023047, -37.1413607615978, -85.5048784054816, -17.2799117863178, 35.998792340979","8.15750281326473, 43.2605781126767, -44.8291454464197, -31.1379416380078, -44.7567201219499, -44.5435838773847","-28.5342446528375, 59.9700956605375, 71.0424310062081, -25.7011258974671, -79.6189298853278, 28.7746171001345","k",TRUE,0.607142857142857 +"pcor.mat",10,"63.2382842712104, -45.6831192597747, -55.7130093686283, -82.2273524012417, -10.8993649948388, -20.6117415335029, -72.7630480192602, -77.4749230127782, 53.6859362386167, 68.9426238182932","30.9459066949785, -80.7866416405886, -47.3474097438157, 49.9985641334206, -84.2809103894979, -56.8257133476436, -13.4179298300296, 60.9060937073082, 48.940838733688, -62.3239307198673","-73.7048507202417, -57.31729445979, 14.9673992302269, -14.3290285952389, -76.3574062846601, -60.4541322682053, -16.2746643647552, -28.6148637533188, 18.4534307103604, -83.0491851549596","s",TRUE,-0.193126854288765 +"pcor.mat",9,"-36.237419815734, -82.6313697267324, -45.2068409416825, 28.2838310115039, -8.59123645350337, 64.9153559468687, -53.2393038272858, 62.8279895056039, 1.16134048439562","-10.1885996758938, -91.6434466373175, -46.7915282119066, 25.4895669408143, -24.0784865338355, 58.5600736085325, -44.0702077001333, -98.0394726619124, 76.2519818730652","33.8238641154021, 7.84905035980046, 36.8167491164058, -17.6727590151131, 9.43915518000722, 5.15828183852136, 92.3964754212648, -85.2526424452662, -63.7069202959538","p",FALSE,0.398179069149688 +"pcor.mat",13,"78.1919818371534, 64.493830408901, 0.710873352363706, -40.3782351408154, 57.4935470242053, 38.2916694041342, -41.3470767438412, 76.0839499533176, 27.3725191596895, 28.8496494758874, 21.4308275841177, -26.0073396842927, 38.606214011088","16.4913782849908, 27.8782834298909, -80.1846226677299, -72.8203158825636, -16.3325851783156, 86.8600406683981, 93.3527871966362, 14.9770261719823, -45.6588900648057, -87.0777580421418, 13.9018434099853, -22.1736597828567, -12.0512451045215","-71.655789623037, 14.8334824945778, -16.8137946166098, -60.0538752041757, 17.0944395940751, 22.4857289344072, -77.132256841287, -55.0677491351962, 2.21382677555084, 69.3236303050071, 39.8013096302748, -39.7288813255727, -63.2540795020759","s",TRUE,0.336736697396128 +"pcor.mat",13,"91.7842994909734, 38.721524970606, 39.1705478075892, 18.6643098015338, -4.83868648298085, 96.8743856530637, -8.04941062815487, 88.7948990333825, -42.6608783658594, 74.295567907393, 20.754674077034, 20.6958107184619, 7.28423306718469","39.8056766949594, -61.7218984756619, -1.59168504178524, 4.02580439113081, 60.1681916043162, -89.8049416486174, -35.8231709338725, 78.1130255199969, -55.8174833655357, 51.9783590454608, -36.2147870473564, 35.5141086038202, -8.96845734678209","4.79736779816449, -56.6321770660579, -76.5336334705353, -22.4140492267907, 77.5082608219236, -61.9375938083977, -6.95173270069063, 19.7686547413468, -30.8583251200616, 47.0094705931842, -54.2295054998249, -98.6059594433755, 87.8028795588762","k",TRUE,0.212316868169448 +"pcor.mat",15,"-3.59630105085671, 86.7999098729342, -17.786830663681, -92.8564656991512, -51.1485965456814, -14.4706445280463, -17.7462406922132, -28.2284520566463, 58.7217133492231, 79.4202568475157, 94.2491712979972, -15.5174071900547, -10.2361090481281, 66.6180044878274, -50.6200913805515","65.4638954438269, 6.78580459207296, -35.6246003415436, 58.6391407065094, 18.2316683232784, 86.3036005757749, 46.5730607975274, -84.4369672238827, -44.6714565623552, 17.6646849140525, 37.9040233790874, 32.2640858590603, 77.358628436923, 55.9946102555841, -33.5247005801648","-19.0743586514145, 82.9343199264258, -8.59537380747497, 14.3348595593125, -41.50315746665, 12.1748448815197, -52.9024983756244, 52.8367889579386, -65.2377155609429, 24.2413009516895, -35.3585127275437, 26.4716796576977, 47.1821424551308, -15.6605173368007, -48.333586147055","p",TRUE,-0.0118283348531814 +"pcor.mat",6,"24.3941873777658, 0.587183143943548, 50.1822246704251, 61.6280217655003, 74.6993770357221, -69.6933365892619","-72.6307827513665, 21.0318620782346, -32.1439458057284, 26.9628962501884, -2.04706066288054, 33.2147478125989","66.891982126981, -18.3136829175055, 88.7454390525818, 78.3952571917325, -97.2121218219399, -20.8632645197213","s",FALSE,-0.303802497166359 +"pcor.mat",14,"-77.750310394913, 86.9882957544178, -85.0523100234568, -36.57017191872, -18.1189219001681, 20.1568298507482, 87.3199927154928, -10.1865636650473, 87.327975500375, -17.7946219686419, 4.59059923887253, 19.7666067630053, -31.7012812476605, 52.6644026394933","-60.2974510286003, 74.7249050065875, 1.42830195836723, -15.9695675596595, -83.7907467503101, 55.462152371183, 41.3278543855995, 89.4937683828175, -57.9569500405341, 74.0428008139133, -79.0337625425309, -49.0267637185752, 97.498970804736, -30.8440355118364","-91.0899322014302, 73.1682816520333, 92.4029916524887, -80.4349666461349, -33.0292509868741, -17.2952547669411, -51.6502045560628, 81.4240960869938, -72.4618446547538, -26.8657810520381, -4.80628688819706, 72.3387493286282, 2.85462928004563, 23.4467320144176","k",TRUE,0.000509880332891465 +"pcor.mat",13,"10.7691071461886, 65.1007527951151, -12.0915657840669, 91.6448481846601, -53.240419505164, -69.8381493799388, 21.602482162416, -34.3285651411861, 43.1247111409903, -37.4003404285759, 94.0640051383525, -65.0122064165771, -7.96503899618983","-85.3995600249618, 67.8450697101653, -56.2912890221924, 58.0509331542999, 36.6984612308443, 87.1452712919563, 49.0658250637352, -52.1726700011641, 94.9811044149101, -53.7899555172771, 39.8667695466429, 98.3075775206089, 63.3846609387547","-46.4738335926086, 37.4508975539356, 44.48222653009, 8.24846290051937, -69.1236611455679, -95.8152562379837, -3.39012276381254, -2.47371718287468, -11.9899280369282, 43.2109453715384, 2.20609768293798, -49.9354481697083, -95.7224021200091","p",FALSE,0.380657823856592 +"pcor.mat",5,"15.9143696073443, 48.3970512636006, 23.7569111865014, 83.6479561869055, -89.9238623213023","-20.0500118546188, 93.1261721998453, -91.0053466912359, -23.429145431146, 45.976064959541","-2.69081904552877, -4.5110234990716, -33.4870064165443, -74.1843503434211, 2.36937236040831","k",FALSE,0.218217890235992 +"pcor.mat",6,"10.1451388094574, -90.6787392683327, -87.4421800021082, 20.2668400015682, 78.3513565082103, 20.7683491986245","-97.6740748155862, 10.7196703087538, -54.752997867763, 80.7648414280266, 12.498453585431, 29.1912749875337","-63.6234064586461, -45.7921910565346, -50.1311025116593, -91.5211007930338, 16.7567258700728, 85.7384174596518","p",FALSE,0.236960037693682 +"pcor.mat",12,"73.2413066085428, -14.7738272324204, 50.0003031920642, 45.0548450928181, -48.7516783643514, -23.1134415604174, -87.6020579133183, 30.5087967775762, 82.4424541555345, 72.7492412086576, 32.3323079384863, 85.7122719287872","-9.44385454058647, -7.42488116957247, 3.06755122728646, 35.4948386084288, 69.3501094356179, -19.1765882074833, 95.9793315734714, 29.2394527699798, 53.3461356069893, 11.7002569604665, -71.7540245968848, 20.5835649278015","66.2635098677129, 48.2205909211189, 81.5142437815666, -31.1989811249077, 5.75581910088658, 93.6992627568543, 72.9302003979683, 30.9292090125382, -55.1979901269078, -78.7769370246679, 14.8034851066768, 37.4370891135186","p",TRUE,-0.48727199671024 +"pcor.mat",10,"52.8255486860871, 34.2574729584157, 44.7404673323035, 52.2620148025453, -69.898310629651, -85.9551533591002, -52.2192012518644, -56.3183640595526, -19.7211066260934, -6.08869907446206","-67.6190298050642, 75.8668028283864, 74.6253774967045, -66.1169764585793, -81.1506592668593, -33.249074826017, -21.2896263692528, -97.763530863449, -54.6630097553134, -96.6868148185313","-35.384417232126, 13.2294847629964, 22.9882229119539, -58.4000170230865, 88.3519669994712, 59.8886359948665, -30.7637225370854, 40.6464832834899, -62.5224160030484, -0.506686419248581","p",TRUE,0.492210961830229 +"pcor.mat",8,"18.1551295798272, -8.32464881241322, -99.8132115229964, 18.6201244592667, -53.1589215621352, 70.2180631458759, -36.3900125026703, 92.1965328045189","6.02451944723725, -68.5814322903752, 70.58563423343, 1.00183109752834, 16.1975951399654, 64.5838780794293, -84.6291496884078, -54.131712205708","80.0181794445962, -12.9483319818974, -3.88606782071292, -48.0255630798638, -3.62709653563797, 31.62224679254, 57.1325340308249, -93.3892488945276","p",TRUE,-0.141482085540883 +"pcor.mat",17,"90.1813358999789, -3.33601352758706, -70.5867488868535, -40.8890372607857, 58.0897845327854, 8.4102772641927, 31.2019024044275, 67.8843731526285, -5.85478777065873, 93.743189284578, -21.4788604527712, 48.0386326089501, -42.5454632379115, -78.037649858743, 5.827397108078, -59.5929707866162, 22.9059528559446","46.3524929713458, -42.5642458721995, -69.567626202479, 91.2107714917511, 80.4405058268458, -83.3648740779608, -5.59279890730977, 67.8364232182503, 9.23628495074809, -45.9923652466387, -2.29323050007224, 92.1013004146516, 34.326039114967, -10.8744602650404, 89.988622488454, -23.287376947701, 72.6627949625254","48.8092821557075, -84.7605162765831, -68.7700709793717, -67.7357694599777, 25.1485624350607, 61.709990631789, 29.2394532822073, 47.8424397762865, 37.0008739177138, -47.5637663155794, -14.6964757237583, -69.9305152054876, -54.4029568322003, 80.0897337496281, 9.39622772857547, -1.27441040240228, 74.3666623719037","s",TRUE,0.270551782409472 +"pcor.mat",13,"-68.030820786953, 48.6679933033884, 51.8114904407412, 78.5725246183574, 18.9902665093541, 25.0479029957205, 56.8353782407939, -4.79650879278779, -87.2707166243345, -64.176924712956, -56.511168833822, 41.7948929592967, 79.8323729075491","87.0083963032812, 12.2851114254445, -48.7783022690564, 2.98262075521052, 61.5149905905128, 72.0769232138991, -33.8758388534188, 19.778781151399, -12.315073935315, -95.3089885413647, -40.8825332764536, -50.1593578606844, -29.2145641520619","82.5196304824203, 86.4081613719463, -63.7102510314435, 82.9122426919639, 86.7011873517185, 1.18320896290243, -7.11194663308561, 31.899410719052, -69.8009483516216, -57.3877718299627, 2.83222463913262, -17.2023222781718, -38.1276280619204","p",FALSE,-0.215982700387935 +"pcor.mat",12,"-36.3307877443731, 74.7712590266019, -79.8354192636907, 93.8916243612766, -50.0289557501674, -54.7662570606917, -38.7290718965232, -84.6648510545492, 71.2978508323431, 88.4917345829308, 32.1320930030197, 76.4375317841768","2.62319510802627, -97.154287295416, 21.7567156534642, 95.8672656677663, -0.763413123786449, -9.49476859532297, 83.9058271143585, -38.3374994620681, -16.9302582275122, -85.5358060449362, -83.2731044851243, -18.7622617464513","-76.2503104750067, 36.5515212062746, 48.5381714068353, 72.03823258169, 36.652302602306, 29.980877507478, 21.0754222236574, -96.8017131090164, -66.5918422862887, -10.5546385981143, 91.4459123276174, -84.6182245295495","k",TRUE,-0.161695275103975 +"pcor.mat",13,"65.4542396776378, 2.08085202611983, -88.9037624932826, 52.2526708897203, -38.4136536624283, -13.373964605853, -48.226101975888, 93.4839099645615, 39.563751546666, 69.0497747156769, -94.8003361001611, 24.9876524321735, 25.2306204754859","82.8150092158467, -9.80691406875849, -84.2437265440822, -48.5185658093542, 93.8153511844575, 76.507264515385, 96.1720596533269, 91.2560781463981, -86.2542728893459, -47.9744947515428, 25.5869822110981, -15.71259717457, 99.3623040616512","64.0070253051817, -90.157330268994, 78.4984151832759, 36.6091389209032, -85.7790939509869, -43.4162854682654, -81.61596711725, -7.2117717936635, 69.8510519228876, 87.7512107603252, 60.0242395885289, -77.6109307538718, 33.9131449349225","s",FALSE,0.0846468464958684 +"pcor.mat",14,"6.42584343440831, 89.4456365611404, -94.9723384808749, -4.63838037103415, 82.1529622189701, -72.2434451803565, 21.8717840965837, 13.9814134221524, -70.8967028185725, 99.243081593886, -67.1596728730947, -69.3361242301762, -52.0885898265988, 54.4663844164461","-6.86167716048658, 63.0930243059993, 62.3814635910094, 42.8769947495311, 12.4187188688666, -55.67507436499, 68.4297569096088, 57.5610874220729, -4.82598571106791, -79.5595136005431, -55.5029585491866, -94.9160863645375, 82.0372765418142, -52.3549461271614","-96.7493511270732, 16.427826648578, 26.2085369322449, 89.924060087651, 64.0857739374042, 65.0612049736083, -50.4840951412916, -27.8882106766105, -37.310868408531, -41.0194541793317, -37.8566451836377, -97.9508240241557, -74.5396174024791, 76.8885430879891","p",FALSE,0.0312670434242096 +"pcor.mat",12,"34.8341395147145, 43.1037290487438, 82.2314764373004, -63.9271955937147, 70.3003748320043, 51.0297972708941, 95.4673350322992, 74.5106549467891, -71.5771752875298, 32.5960139743984, 85.8803272712976, -12.2395237442106","-27.241831831634, -76.5246210154146, 86.3751742523164, 74.9675445724279, 63.8482879847288, 14.7356034722179, -30.9328155592084, 73.2200371101499, 26.5261144377291, 42.3744561616331, -80.7972604874521, 95.1648845802993","30.9194989036769, -29.2449895292521, -75.1953874249011, -97.2041368950158, -63.0337142385542, -96.9185112509876, -72.140100877732, 50.4067888017744, 80.1865959074348, 69.9119384400547, 28.0939280521125, -78.1314740888774","p",FALSE,-0.344081701794653 +"pcor.mat",17,"-32.3364136740565, -74.5505046565086, 64.3489994108677, 95.3302425798029, -47.4365599453449, -99.5640191715211, -81.8646350875497, -10.4291386436671, -46.2970128748566, -66.2438121624291, 3.38349812664092, 46.3537188712507, 50.3833524882793, 76.8161817919463, -35.9225623309612, -30.2367287687957, -15.6686681322753","-85.6091414112598, -74.5855379849672, 31.7983427084982, 12.1914628893137, -76.0027903132141, -25.2544173505157, -53.2312866300344, -66.4824201725423, -35.0571169052273, 25.0753607135266, 57.0668096188456, 97.4866581615061, -34.1166456695646, 70.7655222155154, -25.6891251541674, -99.2252895608544, 30.7619682978839","44.1535466350615, 57.7384070493281, -42.7488908171654, -81.2754278071225, 97.9185460601002, 35.2168054319918, -26.9714017864317, -93.0728284176439, -60.7041460927576, -99.858339689672, -53.829790558666, 85.15021414496, -98.6793769989163, -86.0895386897027, 51.4472865033895, -15.630559111014, -28.9994670078158","k",TRUE,0.261679778734634 +"pcor.mat",10,"89.7360242903233, 47.9975900612772, 36.5392371080816, -51.0348361451179, 7.82818463630974, -6.9301129784435, -75.5731589626521, 47.0917036756873, -58.8109106291085, 33.4785438142717","54.0308193303645, 41.3668432738632, 98.2857145369053, -14.9101806804538, 30.7341996114701, 92.3570320941508, -35.8356348704547, -91.0546428058296, 77.7767921797931, 13.7820704840124","-65.3565419837832, -24.2730437777936, 13.4862332604825, -97.8464429732412, 91.0171907860786, -52.4954450316727, -31.7320866975933, 33.8117491919547, 49.1156910546124, -42.7486607804894","p",FALSE,0.109506018207148 diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py index f7217a9..c5c35d1 100644 --- a/tests/unit/computations/test_partial_correlations.py +++ b/tests/unit/computations/test_partial_correlations.py @@ -1,5 +1,6 @@ """Module contains tests for gn3.partial_correlations""" +import csv from unittest import TestCase from gn3.computations.partial_correlations import ( fix_samples, @@ -7,7 +8,9 @@ from gn3.computations.partial_correlations import ( dictify_by_samples, tissue_correlation, find_identical_traits, - good_dataset_samples_indexes) + partial_correlation_matrix, + good_dataset_samples_indexes, + partial_correlation_recursive) sampleslist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] control_traits = ( @@ -90,6 +93,28 @@ dictified_control_samples = ( "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}) +def parse_test_data_csv(filename): + """ + Parse test data csv files for R -> Python conversion of some functions. + """ + def __str__to_tuple(line, field): + return tuple(float(s.strip()) for s in line[field].split(",")) + + with open(filename, newline="\n") as csvfile: + reader = csv.DictReader(csvfile, delimiter=",", quotechar='"') + lines = tuple(row for row in reader) + + methods = {"p": "pearson", "s": "spearman", "k": "kendall"} + return tuple({ + **line, + "x": __str__to_tuple(line, "x"), + "y": __str__to_tuple(line, "y"), + "z": __str__to_tuple(line, "z"), + "method": methods[line["method"]], + "rm": line["rm"] == "TRUE", + "result": float(line["result"]) + } for line in lines) + class TestPartialCorrelations(TestCase): """Class for testing partial correlations computation functions""" @@ -271,3 +296,37 @@ class TestPartialCorrelations(TestCase): ("a", "e", "i", "k"), ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l")), (0, 4, 8, 10)) + + def test_partial_correlation_matrix(self): + """ + Test that `partial_correlation_matrix` computes the appropriate + correlation value. + """ + for sample in parse_test_data_csv( + ("tests/unit/computations/partial_correlations_test_data/" + "pcor_mat_blackbox_test.csv")): + with self.subTest( + xdata=sample["x"], ydata=sample["y"], zdata=sample["z"], + method=sample["method"], omit_nones=sample["rm"]): + self.assertEqual( + partial_correlation_matrix( + sample["x"], sample["y"], sample["z"], + method=sample["method"], omit_nones=sample["rm"]), + sample["result"]) + + def test_partial_correlation_recursive(self): + """ + Test that `partial_correlation_recursive` computes the appropriate + correlation value. + """ + for sample in parse_test_data_csv( + ("tests/unit/computations/partial_correlations_test_data/" + "pcor_rec_blackbox_test.csv")): + with self.subTest( + xdata=sample["x"], ydata=sample["y"], zdata=sample["z"], + method=sample["method"], omit_nones=sample["rm"]): + self.assertEqual( + partial_correlation_recursive( + sample["x"], sample["y"], sample["z"], + method=sample["method"], omit_nones=sample["rm"]), + sample["result"]) -- cgit v1.2.3 From 9b590d894f1e68ca5d7d00cb6d268f7fb6e6730c Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 9 Nov 2021 09:56:41 +0300 Subject: Fix bug: if three columns, ensure last is "z" Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Fix a bug, caught when the function is called in a recursive form, with the "z*" columns reducing for each cycle through the recursive form. As it was, the last cycle through the recursive form would end up with a DataFrame with the columns "x", "y", and "z0" rather than the columns "x", "y", "z". This commit handles that edge case to ensure that the column name is changed from "z0" to simply "z". --- gn3/computations/partial_correlations.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index bd127a7..9d73197 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -272,8 +272,11 @@ def build_data_frame( x_y_df = pandas.DataFrame({"x": xdata, "y": ydata}) if isinstance(zdata[0], float): return x_y_df.join(pandas.DataFrame({"z": zdata})) - return x_y_df.join(pandas.DataFrame( + interm_df = x_y_df.join(pandas.DataFrame( {"z{}".format(i): val for i, val in enumerate(row)} for row in zdata)) + if interm_df.shape[1] == 3: + return interm_df.rename(columns={"z0": "z"}) + return interm_df def partial_correlation_matrix( xdata: Tuple[float, ...], ydata: Tuple[float, ...], -- cgit v1.2.3 From d9ea8744e04d891d1d13c710e24a0a7c85127140 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 9 Nov 2021 10:06:01 +0300 Subject: Add new data processing utility Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/data_helpers.py: New function (`partition_by`) * tests/unit/test_data_helpers.py: Tests for new function Add a function that approximates Clojure's `partition-by` function, to help with processing the data in a more functional way. --- gn3/data_helpers.py | 15 +++++++++++++++ tests/unit/test_data_helpers.py | 15 ++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/data_helpers.py b/gn3/data_helpers.py index d3f942b..b72fbc5 100644 --- a/gn3/data_helpers.py +++ b/gn3/data_helpers.py @@ -24,6 +24,21 @@ def partition_all(num: int, items: Sequence[Any]) -> Tuple[Tuple[Any, ...], ...] in reduce( __compute_start_stop__, iterations, tuple())]) +def partition_by(partition_fn, items): + """ + Given a sequence `items`, return a tuple of tuples, each of which contain + the values in `items` partitioned such that the first item in each internal + tuple, when passed to `partition_function` returns True. + + This is an approximation of Clojure's `partition-by` function. + """ + def __partitioner__(accumulator, item): + if partition_fn(item): + return accumulator + ((item,),) + return accumulator[:-1] + (accumulator[-1] + (item,),) + + return reduce(__partitioner__, items, tuple()) + def parse_csv_line( line: str, delimiter: str = ",", quoting: Optional[str] = '"') -> Tuple[str, ...]: diff --git a/tests/unit/test_data_helpers.py b/tests/unit/test_data_helpers.py index 39aea45..3f76344 100644 --- a/tests/unit/test_data_helpers.py +++ b/tests/unit/test_data_helpers.py @@ -4,7 +4,7 @@ Test functions in gn3.data_helpers from unittest import TestCase -from gn3.data_helpers import partition_all, parse_csv_line +from gn3.data_helpers import partition_by, partition_all, parse_csv_line class TestDataHelpers(TestCase): """ @@ -59,3 +59,16 @@ class TestDataHelpers(TestCase): parse_csv_line( line=line, delimiter=delimiter, quoting=quoting), expected) + + def test_partition_by(self): + for part_fn, items, expected in ( + (lambda s: s.startswith("----"), + ("------", "a", "b", "-----", "c", "----", "d", "e", "---", + "f"), + (("------", "a", "b"), ("-----", "c"), + ("----", "d", "e", "---", "f"))), + (lambda x: (x % 2) == 0, + (0, 1, 3, 2, 4, 5, 7, 6, 9, 1), + ((0, 1, 3), (2,), (4, 5, 7), (6, 9, 1))),): + with self.subTest(items=items): + self.assertEqual(partition_by(part_fn, items), expected) -- cgit v1.2.3 From 89691df0d7ba096fb7a154aca3adf40f8dfaa8ae Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 9 Nov 2021 10:16:50 +0300 Subject: Implement remaining part of `partial_correlation_recursive` function Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: implement remaining portion of `partial_correlation_recursive` function. * tests/unit/computations/test_partial_correlations.py: add parsing for new data format and update tests --- gn3/computations/partial_correlations.py | 27 ++++++- .../unit/computations/test_partial_correlations.py | 82 +++++++++++++++++++++- 2 files changed, 105 insertions(+), 4 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 9d73197..07a67be 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -332,4 +332,29 @@ def partial_correlation_recursive( (corrs["rxy"] - corrs["rxz"] * corrs["ryz"]) / (math.sqrt(1 - corrs["rxz"]**2) * math.sqrt(1 - corrs["ryz"]**2))), ROUND_TO) - return round(0, ROUND_TO) + + remaining_cols = [ + colname for colname, series in data.items() + if colname not in ("x", "y", "z0") + ] + + new_xdata = tuple(data["x"]) + new_ydata = tuple(data["y"]) + zc = tuple( + tuple(row_series[1]) + for row_series in data[remaining_cols].iterrows()) + + rxy_zc = partial_correlation_recursive( + new_xdata, new_ydata, zc, method=method, + omit_nones=omit_nones) + rxz0_zc = partial_correlation_recursive( + new_xdata, tuple(data["z0"]), zc, method=method, + omit_nones=omit_nones) + ryz0_zc = partial_correlation_recursive( + new_ydata, tuple(data["z0"]), zc, method=method, + omit_nones=omit_nones) + + return round( + ((rxy_zc - rxz0_zc * ryz0_zc) /( + math.sqrt(1 - rxz0_zc**2) * math.sqrt(1 - ryz0_zc**2))), + ROUND_TO) diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py index 981801a..28c9548 100644 --- a/tests/unit/computations/test_partial_correlations.py +++ b/tests/unit/computations/test_partial_correlations.py @@ -6,6 +6,8 @@ from unittest import TestCase import pandas from gn3.settings import ROUND_TO +from gn3.function_helpers import compose +from gn3.data_helpers import partition_by from gn3.computations.partial_correlations import ( fix_samples, control_samples, @@ -120,6 +122,80 @@ def parse_test_data_csv(filename): "result": round(float(line["result"]), ROUND_TO) } for line in lines) +def parse_method(key_value): + """Parse the partial correlation method""" + key, value = key_value + if key == "method": + methods_dict = {"p": "pearson", "k": "kendall", "s": "spearman"} + return (key, methods_dict[value]) + return key_value + +def parse_count(key_value): + """Parse the value of count into an integer""" + key, value = key_value + if key == "count": + return (key, int(value)) + return key_value + +def parse_xyz(key_value): + """Parse the values of x, y, and z* items into sequences of floats""" + key, value = key_value + if (key in ("x", "y", "z")) or key.startswith("input.z"): + return ( + key.replace("input", "").replace(".", ""), + tuple(float(val.strip("\n\t ")) for val in value.split(","))) + return key_value + +def parse_rm(key_value): + """Parse the rm value into a python True/False value.""" + key, value = key_value + if key == "rm": + return (key, value == "TRUE") + return key_value + +def parse_result(key_value): + """Parse the result into a float value.""" + key, value = key_value + if key == "result": + return (key, float(value)) + return key_value + +parser_function = compose( + parse_result, + parse_rm, + parse_xyz, + parse_count, + parse_method, + lambda k_v: tuple(item.strip("\n\t ") for item in k_v), + lambda s: s.split(":")) + +def parse_input_line(line): + return tuple( + parser_function(item) for item in line if not item.startswith("------")) + +def merge_z(item): + without_z = { + key: val for key, val in item.items() if not key.startswith("z")} + return { + **without_z, + "z": item.get( + "z", + tuple(val for key, val in item.items() if key.startswith("z")))} + +def parse_input(lines): + return tuple( + merge_z(dict(item)) + for item in (parse_input_line(line) for line in lines) + if len(item) != 0) + +def parse_test_data(filename): + with open("pcor_rec_blackbox_attempt.txt", newline="\n") as fl: + input_lines = partition_by( + lambda s: s.startswith("------"), + (line.strip("\n\t ") for line in fl.readlines())) + + return parse_input(input_lines) + class TestPartialCorrelations(TestCase): """Class for testing partial correlations computation functions""" @@ -343,9 +419,9 @@ class TestPartialCorrelations(TestCase): Test that `partial_correlation_recursive` computes the appropriate correlation value. """ - for sample in parse_test_data_csv( + for sample in parse_test_data( ("tests/unit/computations/partial_correlations_test_data/" - "pcor_rec_blackbox_test.csv")): + "pcor_rec_blackbox_test.txt")): with self.subTest( xdata=sample["x"], ydata=sample["y"], zdata=sample["z"], method=sample["method"], omit_nones=sample["rm"]): @@ -353,4 +429,4 @@ class TestPartialCorrelations(TestCase): partial_correlation_recursive( sample["x"], sample["y"], sample["z"], method=sample["method"], omit_nones=sample["rm"]), - sample["result"]) + round(sample["result"], ROUND_TO)) -- cgit v1.2.3 From d28b823527b1eec1a99344da51abd139f97bfb64 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Tue, 9 Nov 2021 11:05:56 +0300 Subject: Add functions for updating groups --- gn3/authentication.py | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/authentication.py b/gn3/authentication.py index 7bc7b77..6719631 100644 --- a/gn3/authentication.py +++ b/gn3/authentication.py @@ -1,9 +1,12 @@ """Methods for interacting with gn-proxy.""" import functools import json +import uuid +import datetime + from urllib.parse import urljoin from enum import Enum, unique -from typing import Dict, Union +from typing import Dict, List, Optional, Union from redis import Redis import requests @@ -95,3 +98,65 @@ def get_highest_user_access_role( for key, value in json.loads(response.content).items(): access_role[key] = max(map(lambda role: role_mapping[role], value)) return access_role + + +def get_groups_by_user_uid(user_uid: str, conn: Redis) -> Dict: + """Given a user uid, get the groups in which they are a member or admin of. + + Args: + - user_uid: A user's unique id + - conn: A redis connection + + Returns: + - A dictionary containing the list of groups the user is part of e.g.: + {"admin": [], "member": ["ce0dddd1-6c50-4587-9eec-6c687a54ad86"]} + """ + admin = [] + member = [] + for uuid, group_info in conn.hgetall("groups").items(): + group_info = json.loads(group_info) + group_info["uuid"] = uuid + if user_uid in group_info.get('admins'): + admin.append(group_info) + if user_uid in group_info.get('members'): + member.append(group_info) + return { + "admin": admin, + "member": member, + } + + +def get_user_info_by_key(key: str, value: str, + conn: Redis) -> Optional[Dict]: + """Given a key, get a user's information if value is matched""" + if key != "user_id": + for uuid, user_info in conn.hgetall("users").items(): + user_info = json.loads(user_info) + if (key in user_info and + user_info.get(key) == value): + user_info["user_id"] = uuid + return user_info + elif key == "user_id": + if user_info := conn.hget("users", value): + user_info = json.loads(user_info) + user_info["user_id"] = value + return user_info + return None + + +def create_group(conn: Redis, group_name: Optional[str], + admin_user_uids: List = [], + member_user_uids: List = []) -> Optional[Dict]: + """Create a group given the group name, members and admins of that group.""" + if group_name and bool(admin_user_uids + member_user_uids): + timestamp = datetime.datetime.utcnow().strftime('%b %d %Y %I:%M%p') + group = { + "id": (group_id := str(uuid.uuid4())), + "admins": admin_user_uids, + "members": member_user_uids, + "name": group_name, + "created_timestamp": timestamp, + "changed_timestamp": timestamp, + } + conn.hset("groups", group_id, json.dumps(group)) + return group -- cgit v1.2.3 From 905626a2a27332f2fab74195bbcf615bf5c5b6bf Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Tue, 9 Nov 2021 16:41:48 +0300 Subject: replace list with generators --- gn3/computations/correlations.py | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/correlations.py b/gn3/computations/correlations.py index c930df0..8eaa523 100644 --- a/gn3/computations/correlations.py +++ b/gn3/computations/correlations.py @@ -49,13 +49,9 @@ def normalize_values(a_values: List, ([2.3, 4.1, 5], [3.4, 6.2, 4.1], 3) """ - a_new = [] - b_new = [] for a_val, b_val in zip(a_values, b_values): if (a_val and b_val is not None): - a_new.append(a_val) - b_new.append(b_val) - return a_new, b_new, len(a_new) + yield a_val, b_val def compute_corr_coeff_p_value(primary_values: List, target_values: List, @@ -81,8 +77,10 @@ def compute_sample_r_correlation(trait_name, corr_method, trait_vals, correlation coeff and p value """ - (sanitized_traits_vals, sanitized_target_vals, - num_overlap) = normalize_values(trait_vals, target_samples_vals) + + sanitized_traits_vals, sanitized_target_vals = list( + zip(*list(normalize_values(trait_vals, target_samples_vals)))) + num_overlap = len(sanitized_traits_vals) if num_overlap > 5: @@ -114,13 +112,9 @@ def filter_shared_sample_keys(this_samplelist, filter the values using the shared keys """ - this_vals = [] - target_vals = [] for key, value in target_samplelist.items(): if key in this_samplelist: - target_vals.append(value) - this_vals.append(this_samplelist[key]) - return (this_vals, target_vals) + yield value, this_samplelist[key] def fast_compute_all_sample_correlation(this_trait, @@ -139,9 +133,10 @@ def fast_compute_all_sample_correlation(this_trait, for target_trait in target_dataset: trait_name = target_trait.get("trait_id") target_trait_data = target_trait["trait_sample_data"] - processed_values.append((trait_name, corr_method, *filter_shared_sample_keys( - this_trait_samples, target_trait_data))) - with multiprocessing.Pool(4) as pool: + processed_values.append((trait_name, corr_method, *list(zip(*list(filter_shared_sample_keys( + this_trait_samples, target_trait_data)))) + )) + with multiprocessing.Pool() as pool: results = pool.starmap(compute_sample_r_correlation, processed_values) for sample_correlation in results: @@ -172,8 +167,10 @@ def compute_all_sample_correlation(this_trait, for target_trait in target_dataset: trait_name = target_trait.get("trait_id") target_trait_data = target_trait["trait_sample_data"] - this_vals, target_vals = filter_shared_sample_keys( - this_trait_samples, target_trait_data) + this_vals, target_vals = list(zip(*list(filter_shared_sample_keys( + this_trait_samples, target_trait_data)))) + # this_vals, target_vals = filter_shared_sample_keys( + # this_trait_samples, target_trait_data) sample_correlation = compute_sample_r_correlation( trait_name=trait_name, -- cgit v1.2.3 From 01ddb7300b451108983327ae11f69e265a2ec2e0 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Wed, 10 Nov 2021 11:38:35 +0300 Subject: fix:spawned processes memory issues --- gn3/computations/correlations.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/computations/correlations.py b/gn3/computations/correlations.py index 8eaa523..8302afc 100644 --- a/gn3/computations/correlations.py +++ b/gn3/computations/correlations.py @@ -1,6 +1,7 @@ """module contains code for correlations""" import math import multiprocessing +from contextlib import closing from typing import List from typing import Tuple @@ -136,7 +137,7 @@ def fast_compute_all_sample_correlation(this_trait, processed_values.append((trait_name, corr_method, *list(zip(*list(filter_shared_sample_keys( this_trait_samples, target_trait_data)))) )) - with multiprocessing.Pool() as pool: + with closing(multiprocessing.Pool()) as pool: results = pool.starmap(compute_sample_r_correlation, processed_values) for sample_correlation in results: -- cgit v1.2.3 From e9fb78b5bc43bd8c63b8b790f0f3fe826051fbe7 Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Thu, 11 Nov 2021 00:23:55 +0300 Subject: fix target and base sample data order --- gn3/computations/correlations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/computations/correlations.py b/gn3/computations/correlations.py index 8302afc..4987571 100644 --- a/gn3/computations/correlations.py +++ b/gn3/computations/correlations.py @@ -115,7 +115,7 @@ def filter_shared_sample_keys(this_samplelist, """ for key, value in target_samplelist.items(): if key in this_samplelist: - yield value, this_samplelist[key] + yield this_samplelist[key], value def fast_compute_all_sample_correlation(this_trait, -- cgit v1.2.3 From fa1af0daa093e80a2c235f0294d7fe61a5b65b4b Mon Sep 17 00:00:00 2001 From: Alexander Kabui Date: Thu, 11 Nov 2021 00:31:48 +0300 Subject: pylint fixes and pep8 formatting --- gn3/computations/correlations.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/correlations.py b/gn3/computations/correlations.py index 4987571..c5c56db 100644 --- a/gn3/computations/correlations.py +++ b/gn3/computations/correlations.py @@ -134,9 +134,9 @@ def fast_compute_all_sample_correlation(this_trait, for target_trait in target_dataset: trait_name = target_trait.get("trait_id") target_trait_data = target_trait["trait_sample_data"] - processed_values.append((trait_name, corr_method, *list(zip(*list(filter_shared_sample_keys( - this_trait_samples, target_trait_data)))) - )) + processed_values.append((trait_name, corr_method, + list(zip(*list(filter_shared_sample_keys( + this_trait_samples, target_trait_data)))))) with closing(multiprocessing.Pool()) as pool: results = pool.starmap(compute_sample_r_correlation, processed_values) @@ -170,8 +170,6 @@ def compute_all_sample_correlation(this_trait, target_trait_data = target_trait["trait_sample_data"] this_vals, target_vals = list(zip(*list(filter_shared_sample_keys( this_trait_samples, target_trait_data)))) - # this_vals, target_vals = filter_shared_sample_keys( - # this_trait_samples, target_trait_data) sample_correlation = compute_sample_r_correlation( trait_name=trait_name, -- cgit v1.2.3 From 4e790f08000825931cb5edec1738d2b7d073f73e Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 11 Nov 2021 15:45:22 +0530 Subject: Reimplement __items_with_values using list comprehension. * gn3/computations/correlations2.py: Remove import of reduce from functools. (__items_with_values): Reimplement using list comprehension. --- gn3/computations/correlations2.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/correlations2.py b/gn3/computations/correlations2.py index 93db3fa..69921b1 100644 --- a/gn3/computations/correlations2.py +++ b/gn3/computations/correlations2.py @@ -7,24 +7,13 @@ compute_correlation: TODO: Describe what the function does...""" from math import sqrt -from functools import reduce ## From GN1: mostly for clustering and heatmap generation def __items_with_values(dbdata, userdata): """Retains only corresponding items in the data items that are not `None` values. This should probably be renamed to something sensible""" - def both_not_none(item1, item2): - """Check that both items are not the value `None`.""" - if (item1 is not None) and (item2 is not None): - return (item1, item2) - return None - def split_lists(accumulator, item): - """Separate the 'x' and 'y' items.""" - return [accumulator[0] + [item[0]], accumulator[1] + [item[1]]] - return reduce( - split_lists, - filter(lambda x: x is not None, map(both_not_none, dbdata, userdata)), - [[], []]) + filtered = [x for x in zip(dbdata, userdata) if x[0] is not None and x[1] is not None] + return tuple(zip(*filtered)) if filtered else ([], []) def compute_correlation(dbdata, userdata): """Compute some form of correlation. -- cgit v1.2.3 From ec1d2180d99e0cde1dc181ee9ed79e86cf1a5675 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 11 Nov 2021 16:10:35 +0530 Subject: Reimplement correlations2.compute_correlation using pearsonr. correlations2.compute_correlation computes the Pearson correlation coefficient. Outsource this computation to scipy.stats.pearsonr. When the inputs are constant, the Pearson correlation coefficient does not exist and is represented by NaN. Update the tests to reflect this. * gn3/computations/correlations2.py: Remove import of sqrt from math. (compute_correlation): Reimplement using scipy.stats.pearsonr. * tests/unit/computations/test_correlation.py: Import math. (TestCorrelation.test_compute_correlation): When inputs are constant, set expected correlation coefficient to NaN. --- gn3/computations/correlations2.py | 21 ++++----------------- tests/unit/computations/test_correlation.py | 5 +++-- 2 files changed, 7 insertions(+), 19 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/correlations2.py b/gn3/computations/correlations2.py index 69921b1..d0222ae 100644 --- a/gn3/computations/correlations2.py +++ b/gn3/computations/correlations2.py @@ -6,7 +6,7 @@ FUNCTIONS: compute_correlation: TODO: Describe what the function does...""" -from math import sqrt +from scipy import stats ## From GN1: mostly for clustering and heatmap generation def __items_with_values(dbdata, userdata): @@ -16,24 +16,11 @@ def __items_with_values(dbdata, userdata): return tuple(zip(*filtered)) if filtered else ([], []) def compute_correlation(dbdata, userdata): - """Compute some form of correlation. + """Compute the Pearson correlation coefficient. This is extracted from https://github.com/genenetwork/genenetwork1/blob/master/web/webqtl/utility/webqtlUtil.py#L622-L647 """ x_items, y_items = __items_with_values(dbdata, userdata) - if len(x_items) < 6: - return (0.0, len(x_items)) - meanx = sum(x_items)/len(x_items) - meany = sum(y_items)/len(y_items) - def cal_corr_vals(acc, item): - xitem, yitem = item - return [ - acc[0] + ((xitem - meanx) * (yitem - meany)), - acc[1] + ((xitem - meanx) * (xitem - meanx)), - acc[2] + ((yitem - meany) * (yitem - meany))] - xyd, sxd, syd = reduce(cal_corr_vals, zip(x_items, y_items), [0.0, 0.0, 0.0]) - try: - return ((xyd/(sqrt(sxd)*sqrt(syd))), len(x_items)) - except ZeroDivisionError: - return(0, len(x_items)) + correlation = stats.pearsonr(x_items, y_items)[0] if len(x_items) >= 6 else 0 + return (correlation, len(x_items)) diff --git a/tests/unit/computations/test_correlation.py b/tests/unit/computations/test_correlation.py index e6cf198..d60dd62 100644 --- a/tests/unit/computations/test_correlation.py +++ b/tests/unit/computations/test_correlation.py @@ -4,6 +4,7 @@ from unittest import mock import unittest from collections import namedtuple +import math from numpy.testing import assert_almost_equal from gn3.computations.correlations import normalize_values @@ -471,10 +472,10 @@ class TestCorrelation(TestCase): [None, None, None, None, None, None, None, None, None, 0], (0.0, 1)], [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - (0, 10)], + (math.nan, 10)], [[9.87, 9.87, 9.87, 9.87, 9.87, 9.87, 9.87, 9.87, 9.87, 9.87], [9.87, 9.87, 9.87, 9.87, 9.87, 9.87, 9.87, 9.87, 9.87, 9.87], - (0.9999999999999998, 10)], + (math.nan, 10)], [[9.3, 2.2, 5.4, 7.2, 6.4, 7.6, 3.8, 1.8, 8.4, 0.2], [0.6, 3.97, 5.82, 8.21, 1.65, 4.55, 6.72, 9.5, 7.33, 2.34], (-0.12720361919462056, 10)], -- cgit v1.2.3 From 85405fe6875358d3bb98b03621271d5909dd393f Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 11 Nov 2021 16:15:28 +0530 Subject: Remove redundant check on the Pearson correlation coefficient. The Pearson correlation coefficient always has a value between -1 and 1. So, this check is redundant. * gn3/heatmaps.py (cluster_traits.__compute_corr): Remove redundant check on the Pearson correlation coefficient. --- gn3/heatmaps.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'gn3') diff --git a/gn3/heatmaps.py b/gn3/heatmaps.py index bf9dfd1..f0af409 100644 --- a/gn3/heatmaps.py +++ b/gn3/heatmaps.py @@ -64,11 +64,7 @@ def cluster_traits(traits_data_list: Sequence[Dict]): def __compute_corr(tdata_i, tdata_j): if tdata_i[0] == tdata_j[0]: return 0.0 - corr_vals = compute_correlation(tdata_i[1], tdata_j[1]) - corr = corr_vals[0] - if (1 - corr) < 0: - return 0.0 - return 1 - corr + return 1 - compute_correlation(tdata_i[1], tdata_j[1])[0] def __cluster(tdata_i): return tuple( -- cgit v1.2.3 From 0059de6c028996c9b21a833f186ba7df4899fa2d Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 10 Nov 2021 15:47:20 +0530 Subject: Do not use dangerous default argument []. Default arguments get evaluated only once when the function is defined, and are then shared across all instances of the function. If the argument is then mutated, this can cause hard to find bugs. See https://docs.python.org/3/tutorial/controlflow.html#default-argument-values * gn3/authentication.py (create_group): Do not use [] as the default argument. --- gn3/authentication.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gn3') diff --git a/gn3/authentication.py b/gn3/authentication.py index 6719631..1ccffcc 100644 --- a/gn3/authentication.py +++ b/gn3/authentication.py @@ -145,9 +145,13 @@ def get_user_info_by_key(key: str, value: str, def create_group(conn: Redis, group_name: Optional[str], - admin_user_uids: List = [], - member_user_uids: List = []) -> Optional[Dict]: + admin_user_uids: List = None, + member_user_uids: List = None) -> Optional[Dict]: """Create a group given the group name, members and admins of that group.""" + if admin_user_uids is None: + admin_user_uids = [] + if member_user_uids is None: + member_user_uids = [] if group_name and bool(admin_user_uids + member_user_uids): timestamp = datetime.datetime.utcnow().strftime('%b %d %Y %I:%M%p') group = { -- cgit v1.2.3 From 83f0e5c2955595de195a6de4a9aa7feeb94df9bb Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 10 Nov 2021 15:55:45 +0530 Subject: Reformat condition on a single line. * gn3/authentication.py (get_user_info_by_key): Reformat so that condition is on a single line. --- gn3/authentication.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gn3') diff --git a/gn3/authentication.py b/gn3/authentication.py index 1ccffcc..7384df0 100644 --- a/gn3/authentication.py +++ b/gn3/authentication.py @@ -132,8 +132,7 @@ def get_user_info_by_key(key: str, value: str, if key != "user_id": for uuid, user_info in conn.hgetall("users").items(): user_info = json.loads(user_info) - if (key in user_info and - user_info.get(key) == value): + if (key in user_info and user_info.get(key) == value): user_info["user_id"] = uuid return user_info elif key == "user_id": -- cgit v1.2.3 From f566d9eb1d4e12d7e7a6ef319c39760f5726578e Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 10 Nov 2021 15:56:59 +0530 Subject: Do not shadow global symbol uuid. * gn3/authentication.py (get_groups_by_user_uid): Rename local symbol uuid to group_uuid. (get_user_info_by_key): Rename local symbol uuid to user_uuid. --- gn3/authentication.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gn3') diff --git a/gn3/authentication.py b/gn3/authentication.py index 7384df0..a6372c1 100644 --- a/gn3/authentication.py +++ b/gn3/authentication.py @@ -113,9 +113,9 @@ def get_groups_by_user_uid(user_uid: str, conn: Redis) -> Dict: """ admin = [] member = [] - for uuid, group_info in conn.hgetall("groups").items(): + for group_uuid, group_info in conn.hgetall("groups").items(): group_info = json.loads(group_info) - group_info["uuid"] = uuid + group_info["uuid"] = group_uuid if user_uid in group_info.get('admins'): admin.append(group_info) if user_uid in group_info.get('members'): @@ -130,10 +130,10 @@ def get_user_info_by_key(key: str, value: str, conn: Redis) -> Optional[Dict]: """Given a key, get a user's information if value is matched""" if key != "user_id": - for uuid, user_info in conn.hgetall("users").items(): + for user_uuid, user_info in conn.hgetall("users").items(): user_info = json.loads(user_info) if (key in user_info and user_info.get(key) == value): - user_info["user_id"] = uuid + user_info["user_id"] = user_uuid return user_info elif key == "user_id": if user_info := conn.hget("users", value): -- cgit v1.2.3 From 63b70daaffd2c3e095fde3ed59a07bb9ee894c4f Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 15 Nov 2021 07:06:58 +0300 Subject: Fix the columns in built data frame Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * When the z value is a Sequence of sequences of values, each of the internal sequences should form a column of its own, and not a row, as it was originally set up to do. --- gn3/computations/partial_correlations.py | 2 +- tests/unit/computations/test_partial_correlations.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 07a67be..156e74c 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -273,7 +273,7 @@ def build_data_frame( if isinstance(zdata[0], float): return x_y_df.join(pandas.DataFrame({"z": zdata})) interm_df = x_y_df.join(pandas.DataFrame( - {"z{}".format(i): val for i, val in enumerate(row)} for row in zdata)) + {"z{}".format(i): val for i, val in enumerate(zdata)})) if interm_df.shape[1] == 3: return interm_df.rename(columns={"z0": "z"}) return interm_df diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py index 7cf8cd8..f25145c 100644 --- a/tests/unit/computations/test_partial_correlations.py +++ b/tests/unit/computations/test_partial_correlations.py @@ -392,8 +392,8 @@ class TestPartialCorrelations(TestCase): ((5.1, 6.1 ,7.1), (5.2, 6.2, 7.2), (5.3, 6.3, 7.3)), pandas.DataFrame({ "x": (0.1, 1.1, 2.1), "y": (2.1, 3.1, 4.1), - "z0": (5.1, 5.2 ,5.3), "z1": (6.1, 6.2 ,6.3), - "z2": (7.1, 7.2 ,7.3)}))): + "z0": (5.1, 6.1, 7.1), "z1": (5.2, 6.2 ,7.2), + "z2": (5.3, 6.3 ,7.3)}))): with self.subTest(xdata=xdata, ydata=ydata, zdata=zdata): self.assertTrue( build_data_frame(xdata, ydata, zdata).equals(expected)) -- cgit v1.2.3 From 29fc003070b45f61e7ab1048a818201b5beb9298 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 15 Nov 2021 07:58:10 +0300 Subject: Fix bugs in recursive partial correlations * gn3/computations/partial_correlations.py: Remove rounding. Fix computation of remaining covariates * tests/unit/computations/partial_correlations_test_data/pcor_rec_blackbox_test.txt: reduce the number of covariates to between one (1) and three (3) * tests/unit/computations/test_partial_correlations.py: fix some minor bugs It turns out that the computation complexity increases exponentially, with the number of covariates. Therefore, to get a somewhat sensible test time, while retaining a large-ish number of tests, this commit reduces the number of covariates to between 1 and 3. --- gn3/computations/partial_correlations.py | 16 +- .../pcor_rec_blackbox_test.txt | 1034 ++++++++++++++++++-- .../unit/computations/test_partial_correlations.py | 17 +- 3 files changed, 974 insertions(+), 93 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 156e74c..519dce9 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -12,7 +12,7 @@ from scipy.stats import pearsonr, spearmanr import pandas -from gn3.settings import TEXTDIR, ROUND_TO +from gn3.settings import TEXTDIR from gn3.data_helpers import parse_csv_line def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): @@ -328,10 +328,10 @@ def partial_correlation_recursive( tdata[corr_type][cols[1]], method=method) for corr_type, cols in fields.items() } - return round(( + return ( (corrs["rxy"] - corrs["rxz"] * corrs["ryz"]) / (math.sqrt(1 - corrs["rxz"]**2) * - math.sqrt(1 - corrs["ryz"]**2))), ROUND_TO) + math.sqrt(1 - corrs["ryz"]**2))) remaining_cols = [ colname for colname, series in data.items() @@ -340,9 +340,7 @@ def partial_correlation_recursive( new_xdata = tuple(data["x"]) new_ydata = tuple(data["y"]) - zc = tuple( - tuple(row_series[1]) - for row_series in data[remaining_cols].iterrows()) + zc = tuple(tuple(data[colname]) for colname in data[remaining_cols].columns) rxy_zc = partial_correlation_recursive( new_xdata, new_ydata, zc, method=method, @@ -354,7 +352,5 @@ def partial_correlation_recursive( new_ydata, tuple(data["z0"]), zc, method=method, omit_nones=omit_nones) - return round( - ((rxy_zc - rxz0_zc * ryz0_zc) /( - math.sqrt(1 - rxz0_zc**2) * math.sqrt(1 - ryz0_zc**2))), - ROUND_TO) + return ((rxy_zc - rxz0_zc * ryz0_zc) /( + math.sqrt(1 - rxz0_zc**2) * math.sqrt(1 - ryz0_zc**2))) diff --git a/tests/unit/computations/partial_correlations_test_data/pcor_rec_blackbox_test.txt b/tests/unit/computations/partial_correlations_test_data/pcor_rec_blackbox_test.txt index 4b9f68a..6254902 100644 --- a/tests/unit/computations/partial_correlations_test_data/pcor_rec_blackbox_test.txt +++ b/tests/unit/computations/partial_correlations_test_data/pcor_rec_blackbox_test.txt @@ -1,127 +1,1009 @@ ------------------------------------------------------------ function_name: pcor.rec count: 18 -x: 39.43254314363, 71.7503248248249, -25.9237891994417, -71.4318438898772, 5.86411766707897, 20.5873795319349, -55.2685840055346, -8.46728710457683, -92.6864624489099, -93.9637628849596, 63.8542262371629, -57.1248637512326, -57.3486962355673, -15.5142558738589, -81.5054637845606, -52.3766598664224, 64.1838387586176, 59.4040210358799 -y: 1.37278931215405, 17.6336284726858, -81.062437640503, -71.6937384102494, 3.27541613951325, -61.2097083125263, -89.2936512362212, 58.8778289500624, -45.9098653402179, 1.99255612678826, -1.74913080409169, -13.9142457395792, 4.65260092169046, 12.5304204411805, 76.9336444325745, -28.4501533955336, -88.7515506241471, 48.6711137462407 -z: -32.2106098290533, 68.8010563142598, 71.8754313886166, 55.6917862966657, -81.8915933836251, 54.5552121941, -28.4821664914489, 84.0448261238635, -73.2388113159686, 57.5857586227357, 35.7404014561325, 80.0396463833749, 5.09524783119559, -91.1972944624722, -32.7593921218067, 73.9581868518144, 64.0648300759494, 45.4317939002067 +x: 27.0465861540288, 85.84661539644, 23.6260315869004, -6.64654695428908, 66.0871273837984, -74.3310157675296, -7.09130000323057, -11.6802562493831, 24.9050020240247, -22.3750857636333, 68.0144839920104, 16.7857648339123, -26.3561313506216, 57.9470653086901, -9.12516843527555, -36.0829488374293, 68.283180333674, -83.6802623700351 +y: 12.4649536795914, -20.5139847937971, -33.6048585828394, 19.9723906349391, 35.5448212940246, 31.2940447591245, -14.5105968695134, 79.1401757858694, -13.6585284024477, -57.8275624662638, -81.5757951233536, -34.5542138442397, 99.8554266057909, 31.5982210449874, 36.1663243733346, 7.66049646772444, -49.2159572429955, 87.6347878947854 +z: -45.889978017658, 50.1325799152255, -25.5673226900399, 87.3435476794839, -98.9604395348579, -45.4698990099132, 13.7257359456271, -81.9015400484204, 53.4290503710508, 9.70146018080413, 80.2283481229097, 76.1991834267974, 73.4845123719424, 28.7944686599076, -57.0716312620789, -62.2007157187909, -95.3627366572618, -57.3240759316832 method: s rm: FALSE -result: 0.0933987255899925 +result: -0.458362369707244 +------------------------------------------------------------ +function_name: pcor.rec +count: 11 +x: 21.083299908787, -98.2076421380043, -45.41100054048, 33.6558640468866, 33.8769129477441, 90.4809392523021, -83.2292538136244, -53.039117064327, -26.2141453567892, -40.8924567047507, -13.2970791775733 +y: -71.2343545164913, -33.0757538322359, -30.886987876147, -62.0309396646917, -46.2347051594406, -45.9761362057179, 16.1026658024639, -30.2154338918626, 10.4190110228956, -6.23724199831486, -19.9442820157856 +method: k +rm: TRUE +result: -0.158592651153528 +input.z.1: -69.6558590978384, 76.5958794392645, -74.462781380862, -55.6329038925469, -34.0182736050338, -81.8313004914671, 80.8752333279699, 73.2946038711816, -49.8568836599588, 12.4631694052368, 71.3077447377145 +input.z.2: -55.6238626595587, 71.5313264168799, 49.0649917162955, -96.4836423750967, 31.4231107011437, 98.5001483000815, -60.020112991333, 5.04361470229924, -21.7608422972262, 3.66116226650774, 37.4486085027456 +input.z.3: -9.95428394526243, -51.5089114196599, -84.7546851728112, 90.5390536878258, -12.833157973364, 21.4086377061903, 59.5765900798142, -57.5253647286445, 35.5521977413446, -55.1964603364468, -82.078071590513 +------------------------------------------------------------ +function_name: pcor.rec +count: 19 +x: -25.1664641778916, -56.7158963531256, 98.2197014149278, -39.1562284901738, 69.8500068392605, -98.8793865777552, 64.3333005718887, 2.49145850539207, -13.4482780471444, 15.8296941313893, -14.4610319286585, 8.14920198172331, 26.8839774187654, -94.38610766083, 73.5400937031955, -41.284476686269, -72.5798789411783, -45.4698437359184, -94.7900563944131 +y: 73.5157749149948, 69.8058058042079, 38.3851455990225, -15.4582026414573, 39.7315986920148, 27.1629291586578, 66.9298667926341, 26.3044673483819, -62.2310540173203, 28.8334564771503, 4.62915268726647, -17.3412421252578, -62.9840137436986, 24.5139833539724, -64.8512890096754, 53.5849830601364, 84.3197864014655, 62.4854291789234, -33.11452944763 +z: -14.3098634667695, 66.4927227422595, 16.3307644892484, 6.14525671117008, -68.4833894949406, -96.6041945386678, 46.0874481592327, 64.1859616152942, 45.0831798370928, -51.5323319006711, 81.7438598722219, 57.8951288480312, 82.2177275083959, -95.4358763061464, -99.8694028239697, 66.1022247746587, -37.5455300789326, 57.4841354973614, 2.12362264283001 +method: s +rm: FALSE +result: -0.204204149462281 +------------------------------------------------------------ +function_name: pcor.rec +count: 11 +x: 42.9641991853714, -33.6526750586927, 64.5110571291298, -3.50967179983854, -62.1003251988441, 75.9439217858016, -40.5138825066388, 61.7869598791003, 65.514537319541, -32.6844135764986, 98.1214119587094 +y: -87.1564343106002, -31.8151163868606, -98.0668175034225, -48.0268982239068, -65.0074473116547, 29.7599448822439, -78.1958315055817, -98.9310230594128, -37.0073825120926, 99.8306283261627, -65.8631965983659 +method: k +rm: FALSE +result: -0.143621272076104 +input.z.1: -27.1912457421422, -84.1915388125926, -86.4654324017465, 0.588246434926987, 19.5371210109442, -89.7052477579564, -69.2373412195593, 37.7897844649851, 52.10354286246, 86.67849637568, -26.65113247931 +input.z.2: -6.18069735355675, -45.4417984467, 71.68323029764, 40.7072803471237, 30.662393476814, -58.0406312830746, 11.6332073230296, 83.1229616422206, -79.0208636317402, -44.603179441765, -41.5212479420006 +input.z.3: -5.77356708236039, 71.4390681125224, -48.5977551434189, -33.8404927402735, 46.5380611363798, -93.3157123159617, -0.389049109071493, -38.7082135304809, -4.53768568113446, -70.9879754111171, 68.8483240548521 ------------------------------------------------------------ function_name: pcor.rec count: 16 -x: -54.4209572486579, -45.8115526009351, 33.5523693822324, 1.22122392058372, 3.21844927966595, -60.7970183715224, -83.0410700291395, 50.8907133247703, -22.4564190022647, -34.4268564134836, 63.6943627148867, 49.2209523916245, -17.8922688122839, -36.6935533937067, 52.1462481003255, -64.0409931540489 -y: -68.8048375304788, -35.6251731514931, -89.7739315405488, 43.3957693167031, -75.1052091363817, 95.1878732535988, 26.5241817105561, -3.53294685482979, -39.4754795823246, -24.8853640630841, -38.7773368973285, -21.1217492353171, 91.2531037349254, -65.4770888388157, -31.2665332108736, 93.3961927425116 +x: 60.9317239839584, -31.2905447091907, 53.948915284127, -95.7576057408005, 35.007868334651, -85.5168207548559, 73.7568661570549, -20.455909660086, 10.8152956236154, 39.7627064492553, -44.756277743727, -71.251277718693, 99.0610776469111, 29.1336865630001, 53.8847446907312, 54.8433600459248 +y: -69.0110558643937, 74.3098065257072, -93.1558133102953, -48.1973732821643, 3.78763284534216, -45.7135255914181, 14.0458890702575, 57.1197693236172, -63.5192428249866, -80.8886671904474, -54.2279600631446, 79.5978177338839, -13.394229626283, -2.99848061986268, -82.9510015901178, -27.8741750866175 +z: -68.4228350874037, -11.2382180523127, -74.2924707010388, -91.1819029133767, -58.1376497633755, -70.0835255905986, -58.3644146099687, -73.0489106848836, 68.5998952481896, 60.6510613579303, 61.4266434684396, 40.6665476504713, 49.3221402168274, 56.9117167964578, -5.39970770478249, -69.6209676098078 +method: k +rm: TRUE +result: -0.200111203789521 +------------------------------------------------------------ +function_name: pcor.rec +count: 10 +x: 40.2440257836133, -46.3242933154106, 72.7708220481873, -36.3226366229355, -92.5043274182826, -13.0487341899425, -46.8136807903647, 55.9087499044836, 11.1851918045431, -41.1343066487461 +y: 44.3925043102354, 79.2225563433021, 12.92391307652, -94.4711372256279, 8.49277810193598, -37.1448263991624, 77.1530977915972, 67.4801368732005, -41.9478724244982, 72.7613130584359 +z: -2.98054488375783, -41.6941301431507, 65.8284252975136, 80.405295919627, 56.1443844810128, -67.8014985751361, -96.869227103889, -59.2089117504656, 45.6999542657286, 16.634497186169 +method: s +rm: FALSE +result: -0.20778140910639 +------------------------------------------------------------ +function_name: pcor.rec +count: 11 +x: -93.3505594264716, -2.47896937653422, -97.1759914420545, -38.2430272176862, 99.4149339385331, 0.428299093618989, 90.4291214887053, -60.8191690873355, -17.9825736675411, -87.1595453470945, -36.4918932318687 +y: -5.86937200278044, 40.7252304255962, -82.1171450894326, 80.3501662798226, -27.133903093636, 40.9038231242448, 64.1522381454706, -94.5180553942919, -79.7904842533171, 49.5809083338827, -67.2030501067638 +method: k +rm: FALSE +result: -0.00415066820058267 +input.z.1: 54.7301535494626, 31.2304168008268, 92.258932441473, -77.6000469457358, -95.9519237745553, -67.8663256578147, 45.4026754945517, 76.5307268127799, -9.65234781615436, -50.799378240481, 19.5994042325765 +input.z.2: 89.8357455153018, -50.7813970558345, -44.0238927956671, 82.4097864795476, -35.6187962926924, -82.3095034342259, -57.0411204826087, 55.669168708846, 37.2431641444564, -7.40567096509039, -74.2486072704196 +input.z.3: -21.2622028309852, 2.9518733266741, 76.1393244378269, -73.8079617731273, -71.1744130123407, 37.7846655901521, -8.74427421949804, -4.20535416342318, 39.9581101723015, 8.55288412421942, 79.2008865159005 +------------------------------------------------------------ +function_name: pcor.rec +count: 13 +x: 55.8748798910528, 51.0572876781225, 82.5137235689908, 14.2397709656507, 2.99776284955442, 65.2987132780254, -59.7197342664003, -12.6050740480423, -46.4378262404352, 55.494225025177, 41.8674737215042, 82.1887638885528, -2.28542112745345 +y: 88.4641766548157, 27.435901388526, -79.5164803043008, -9.17457146570086, -38.7884174473584, -42.7281686104834, 29.9447605852038, 42.1490131877363, 6.86571071855724, -10.5507157277316, 34.6828168723732, -11.884824372828, -11.3106375560164 +z: -8.47988268360496, -62.9638673271984, 76.2596300803125, 72.5790326483548, -89.2584360204637, -62.1974066831172, -19.7280053514987, 25.6929714698344, -76.6775759402663, 28.7336804438382, 60.828927019611, -95.1663577463478, -59.2235392890871 +method: s +rm: TRUE +result: -0.486706898961164 +------------------------------------------------------------ +function_name: pcor.rec +count: 14 +x: -0.0649684108793736, -9.12190317176282, -97.854143474251, -13.7245919555426, -98.3851981814951, -52.1242694463581, -80.3953207563609, -1.50988507084548, -67.9019027389586, 53.890549344942, 76.6144499648362, 94.333418738097, 42.1835497952998, -82.3511867318302 +y: -51.941104978323, 29.7715055756271, 96.8885408248752, -93.3864999562502, 71.9892789144069, 33.8113908655941, -73.2613898813725, -80.6048061698675, 74.224327551201, 57.013650611043, 9.70671167597175, 79.8423840198666, -69.2205078434199, 89.1150287352502 +z: 23.4675401821733, 84.267854411155, -51.1970835737884, -98.0038798414171, 47.583898389712, -48.8845239859074, -0.850127916783094, 7.31711369007826, 13.4415757842362, -57.4014388024807, -17.8407940082252, -40.6244638841599, -13.1918888073415, -63.6225790716708 +method: k +rm: TRUE +result: -0.202860566215319 +------------------------------------------------------------ +function_name: pcor.rec +count: 15 +x: -61.3124287221581, 18.1583377532661, -58.751318231225, 14.6944977343082, 74.491372751072, 64.7918365430087, 88.5010475292802, 46.6877995524555, 32.0965091697872, 98.7485934048891, 22.8932307101786, -79.3458161875606, 29.175332095474, 85.9066780656576, 32.5589253101498 +y: 74.3193860165775, -1.54028623364866, 14.3234346993268, 22.6996371522546, 34.6773494500667, 68.9461726229638, -70.669891545549, 6.67718132026494, -70.8217049948871, -96.8078156001866, 98.5030621755868, 35.5320736765862, 1.35495862923563, -66.8200423009694, 87.3174419160932 +method: k +rm: TRUE +result: -0.403444240007549 +input.z.1: 63.1398477125913, -93.6047930736095, -82.9460870008916, 17.1801930759102, -56.8764031399041, 14.5227553322911, 67.7316694986075, -36.5888524800539, -6.70271222479641, -87.9417958203703, 96.0809137206525, -18.8335922546685, 13.2128197699785, -32.5581130571663, -90.6071182340384 +input.z.2: 88.5960716288537, -13.0231159739196, 66.9877568725497, 57.8428873792291, -19.4016022607684, -33.0764503218234, 68.1236225645989, -33.8005813304335, -32.7262029517442, 90.8223036210984, 58.4868327714503, -76.5773380175233, -0.575498351827264, 42.7307121455669, -62.9820253234357 +input.z.3: -65.5557164456695, 34.7501182928681, -11.9676230940968, -55.2262251731008, -36.8215633556247, -68.8912406563759, -60.3880607523024, -8.90412745065987, 76.2590947095305, -98.0812083929777, -22.7019656449556, 54.0401803329587, -31.2883075326681, -94.085031747818, 26.6006113030016 +------------------------------------------------------------ +function_name: pcor.rec +count: 15 +x: -66.0635123960674, -67.4732076469809, 42.8204931784421, 83.9072343893349, 64.1622506547719, -31.2235444784164, 45.2104966156185, -77.7350789867342, -41.6209270711988, 77.8038220480084, 4.94705736637115, -47.8676947765052, -40.3655698057264, 87.1949778869748, 59.282084601 +y: -44.0877958200872, 43.1024875491858, 29.3431533966213, 54.0742883924395, 30.3691518027335, -71.8555608764291, 62.1317124925554, 8.58862511813641, 7.24410070106387, 83.5120551753789, -63.7099585030228, -96.2103466968983, -49.2979577742517, 83.7898887228221, 35.5132043361664 +method: k +rm: TRUE +result: 0.384008728398402 +input.z.1: -4.6655245590955, 70.4251590184867, -80.6666431482881, 85.5599484872073, -4.1441548615694, 77.3068489506841, 65.8226968720555, 94.5305422879755, -63.2336198817939, 86.3333691377193, 79.903667466715, 51.2524782679975, 99.025963479653, -75.7371618878096, -61.1681820824742 +input.z.2: -2.65423716045916, -78.2148709055036, 98.3434916473925, -22.4563017021865, 12.9930391907692, 53.0512262135744, -38.8523698784411, -54.1274403687567, 57.2192461229861, -85.3108969051391, 36.1713513266295, 52.4544527288526, 62.3474055435508, -82.7991028316319, -48.1557835824788 +input.z.3: 71.8588098417968, -7.05220480449498, 69.235354475677, -38.4673862252384, 53.1879930756986, 74.1162660066038, -33.3680822513998, 66.3322701584548, -36.8293787818402, -77.0495353732258, -31.3548975624144, -38.8354785274714, -59.7352970857173, -33.5001980420202, -52.4871282279491 +------------------------------------------------------------ +function_name: pcor.rec +count: 13 +x: -78.5274708177894, 54.6583318617195, -10.7358992099762, -45.4171522054821, 25.4497814457864, -64.0730748418719, 68.9721046481282, -49.2593355942518, -29.5779021456838, -52.45715030469, 16.8660826049745, 97.6588599383831, -60.2859176229686 +y: 48.7125545274466, -86.9950996246189, -88.7554660905153, 91.8915181886405, -77.034616516903, 88.2693362422287, 58.6634032428265, 14.3693041522056, -41.9572623912245, -49.6693043969572, 97.597514744848, -14.9741226341575, 99.4055413641036 +method: s +rm: TRUE +result: -0.22769505950471 +input.z.1: -71.1109426803887, 15.6759196892381, 94.438049569726, -37.2807722073048, 39.3087625037879, 15.7282522879541, 79.2091070208699, -16.5951025206596, 56.8437909707427, -48.6758518964052, -93.334536626935, 41.8724854942411, 89.190365979448 +input.z.2: -0.60031795874238, 44.824774377048, -81.4030232839286, -95.4328638501465, -5.63060604035854, -11.984769301489, 71.3819028344005, 82.8589734155685, -12.7086061518639, -16.8309166561812, -26.7068251501769, 43.9979130867869, -56.4366859849542 +input.z.3: -16.3842175621539, -8.85082990862429, -95.985221164301, -73.4366697724909, -28.4655119758099, -52.8220290318131, -61.4263267721981, 64.5336702931672, -39.0190409030765, -1.5689545776695, 11.0946391709149, 56.4090613275766, -60.4540335014462 +------------------------------------------------------------ +function_name: pcor.rec +count: 16 +x: -65.7591099850833, 80.7566788513213, 88.1564508192241, -48.9770147949457, -55.7247276883572, -57.5253066141158, -83.2564804237336, 57.4012059252709, 35.2928108070046, -72.2103993408382, -63.602004526183, -56.8528092466295, -36.7954559158534, -51.8933654297143, 62.31161900796, 39.0559389255941 +y: -29.5054595451802, 78.5674630198628, 57.8101953491569, -23.3210172038525, 68.2822681497782, -56.1916985549033, 69.3101673386991, -23.5763778910041, 42.4868553876877, -80.7561526075006, 53.3658074680716, -46.6725745704025, -48.636918887496, 77.6377590373158, -98.6770060379058, 69.6450849529356 +method: p +rm: FALSE +result: 0.286445562770149 +input.z.1: -80.6849138811231, -90.7679206226021, 7.13438023813069, -86.4396455232054, -16.7458149138838, -51.5618403907865, 46.1916353553534, 63.4878667071462, -98.7970676738769, -86.5430972073227, -52.745211077854, -87.5790499150753, 4.79577607475221, 2.6803994551301, 10.9007480088621, -45.8506872877479 +input.z.2: 8.42293403111398, -80.3381159901619, -15.9135971218348, 89.8643282707781, 90.3070626314729, 12.7958082128316, 97.4500481039286, -59.7645458299667, -50.2175740431994, -33.6365795694292, -37.7593765966594, -59.8080027848482, 14.1750884708017, 84.0673042926937, 2.86107184365392, -15.2980412356555 +input.z.3: 18.416645983234, 8.72256266884506, -27.135418029502, 66.9198032002896, 11.7570180911571, -81.8186190910637, 55.6397127918899, -42.1071819029748, -27.3977108299732, 87.2775603551418, -31.7873003892601, -0.830735079944134, 14.7588836960495, 24.6488864067942, -4.1443657130003, -22.5756781641394 +------------------------------------------------------------ +function_name: pcor.rec +count: 19 +x: 72.941006347537, 88.5350834578276, -61.3946152850986, -94.1264885943383, -59.6083014272153, 0.0383354723453522, 38.962951535359, -33.1267971079797, -14.1101143322885, 11.0402037389576, 66.5075759869069, -39.2349756322801, 1.62258669734001, 63.6307552922517, -53.3561239019036, -57.0986500941217, 63.9509742613882, 69.1873391158879, 92.4651104025543 +y: 68.2863459456712, 32.8301987610757, -12.0631097815931, -77.5489529129118, -9.26943984813988, -53.196216467768, 99.207640811801, 45.8405578043312, 70.8663184195757, 2.17023831792176, -30.1671982742846, -87.5547814648598, 53.4424650482833, 91.9836340006441, 14.094074908644, -81.96129957214, -66.6266257409006, 26.5053286217153, 88.7426108587533 +z: 26.3681552372873, 45.7198408432305, 68.2894596364349, -66.7965121567249, -8.64458661526442, 40.5387890059501, 24.7470463160425, -55.4631956387311, 43.0947626940906, 40.5702913645655, -94.7409357409924, 80.7332515716553, 98.3253448270261, 38.5890654288232, -92.7877118811011, -41.1318491213024, 68.1029357016087, 81.3247045036405, -64.87777819857 +method: k +rm: TRUE +result: 0.370885040886946 +------------------------------------------------------------ +function_name: pcor.rec +count: 17 +x: 47.7815555874258, 0.757466396316886, -78.5694096237421, -10.5338782072067, 6.84339161962271, -12.5417194329202, -79.6884837560356, -50.4556390456855, -18.0644971318543, -43.5523690190166, -31.3758133444935, -64.514737483114, -35.6566301546991, 24.6359940152615, -52.1337051875889, -81.0267004650086, 9.79939419776201 +y: 9.00454632937908, -92.5409240182489, 82.6424018014222, 37.390052061528, 39.1525054816157, -32.2375071700662, 33.1057799514383, 60.8027548994869, 49.1245619021356, -1.29677709192038, 59.6215286292136, -5.71877667680383, -64.2789027653635, 7.67776034772396, -85.6839925516397, 87.0561090763658, 53.9691422134638 +z: 94.1489060875028, 5.35360146313906, -45.0954835861921, 13.4744525421411, 70.4065824393183, -37.5215549487621, -53.9351030252874, -95.9617306943983, 95.8626475185156, 56.3450652174652, -78.2765238545835, 49.8751151841134, -40.399710368365, 70.9471312351525, 67.7706296090037, -44.7566135320812, 18.9933343790472 +method: s +rm: TRUE +result: -0.0307253503097024 +------------------------------------------------------------ +function_name: pcor.rec +count: 15 +x: 77.0224547944963, -7.21212634816766, 94.6494690608233, -19.8536953888834, 60.6895769014955, -18.8230661675334, 46.6576409060508, 20.9713363554329, 29.2338462080806, 81.9798021577299, -46.1181710008532, 57.9514958895743, -10.7711394317448, 47.9182483628392, 60.8951596543193 +y: 71.0176297463477, -19.332714471966, 3.20451441220939, 63.0101921502501, 18.177311681211, 18.1690010707825, 12.173681287095, 10.6716933194548, -85.9119288157672, -7.69144585356116, -95.4866513609886, 53.3560248091817, -56.3376172445714, 98.2990854419768, 34.0318501461297 +method: k +rm: TRUE +result: 0.215514678797688 +input.z.1: 75.5163984373212, 97.6738740224391, -16.5575933642685, -35.9448304865509, 30.2785072475672, -4.58882753737271, 19.8265417013317, -68.4901964850724, 84.9371602758765, -71.9693731982261, -56.5736060962081, -36.8734282441437, 19.3909254390746, 86.3937048241496, -90.9074582159519 +input.z.2: -82.2815494611859, -62.3412929475307, -75.7495530415326, -85.9084845986217, 38.5769664309919, -14.2082320991904, 51.2620362918824, -27.3738067597151, -52.3408399429172, -0.0353863462805748, 52.8306930325925, 47.6732281967998, 40.0251228827983, 10.1307895034552, 81.8184955511242 +input.z.3: -24.4488768745214, 88.5539114940912, -76.0014849714935, -20.0668734498322, -17.3311269376427, 53.2966234721243, 28.3089226577431, -10.4635909199715, 3.67960454896092, 54.5719591900706, -79.4869703240693, -76.6309262719005, 41.3653851021081, -68.3333130553365, 86.5088677499443 +------------------------------------------------------------ +function_name: pcor.rec +count: 15 +x: -17.6799289416522, 49.4767578784376, 69.4365380797535, 62.0824650395662, -14.5133852958679, 92.8273646626621, -35.5502421967685, 26.3818026985973, -47.6345511619002, -81.7291165236384, 90.68892756477, 87.9910979419947, -96.1814912967384, 34.966702433303, 44.7223367169499 +y: 77.5102899409831, 71.6682025231421, 30.0063323695213, 30.9808460995555, 16.6262952145189, 80.4908129386604, -92.2186760231853, 54.273960320279, 7.27685410529375, -20.4685146920383, -50.272509874776, 27.1341995336115, 15.8458969090134, -98.8356848247349, -37.4736201483756 +method: p +rm: TRUE +result: -0.0604063399963708 +input.z.1: 62.3108414001763, -12.2461723163724, -45.8216614555568, 91.8788344599307, 91.6252538561821, -0.413994630798697, 90.2596836909652, 56.2185476068407, 91.5859371889383, -15.2596113737673, -43.3501244522631, -68.923271773383, -19.7409045416862, -86.2786957528442, -89.9489548057318 +input.z.2: -22.556777484715, -5.61479208990932, -47.4028566852212, 30.8866687119007, -16.6167206130922, 0.758961960673332, -97.7107268758118, 49.8969595879316, 5.41947395540774, 76.3401997741312, 38.9869387727231, -69.9544305447489, -62.7304617781192, -28.9641594514251, -98.7272569909692 +input.z.3: 96.6044981963933, 1.57265784218907, 45.9907903335989, -3.32801463082433, 96.9419070053846, 54.3271706439555, -27.2647544741631, 68.1218984071165, -35.9079149086028, -80.5656238924712, 19.4677114021033, 61.2382191233337, -17.1889714431018, -66.9516512192786, -77.3835943546146 +------------------------------------------------------------ +function_name: pcor.rec +count: 10 +x: -71.562309935689, 61.2971490249038, -67.2613488975912, -67.605738947168, -44.75500555709, -27.0675545092672, 6.42645112238824, 34.9141472950578, -70.4944793600589, -65.8430821727961 +y: -97.3966186866164, 30.0345255527645, 1.98479322716594, 35.255804983899, 97.4348559975624, 51.2336597312242, 37.0358873624355, -43.8290268182755, 73.1889605987817, -83.4334774874151 +method: k +rm: FALSE +result: 0.101975707913878 +input.z.1: 96.5124187991023, 59.7589443437755, -28.1401800457388, -48.1452223844826, -69.1250930074602, -1.13946236670017, -33.8115575257689, 92.0685294549912, -65.9486766438931, -50.8275568950921 +input.z.2: 0.635389657691121, -48.1256590690464, -73.9453377667814, 36.4519818220288, 14.4354915246367, -30.946854641661, 75.4334991797805, -78.7696894258261, -84.3629696406424, -68.5122138820589 +input.z.3: -42.2178110573441, -84.9118709564209, 10.6240403372794, 47.0018105581403, 76.3429581187665, -98.3215926680714, 23.1543749570847, -66.7542746756226, 51.0812507942319, 51.7371312715113 +------------------------------------------------------------ +function_name: pcor.rec +count: 15 +x: 37.3612422030419, -62.2976862825453, -20.3225356992334, 35.1625409442931, 7.00941164977849, 10.8022364787757, 85.6041926890612, 2.7432450093329, 55.2531471475959, -46.698701241985, -32.8795406967402, 56.1582171358168, -53.7892970722169, -29.8783036880195, 5.5769944563508 +y: 84.9823753815144, 20.0704097282141, -57.9668726306409, 80.5891362018883, -93.7707980629057, 82.1314251981676, 30.4476763121784, 64.8252506740391, 2.73968982510269, 56.2543767504394, -51.3445142190903, 1.49674671702087, 76.8511690199375, -92.6638629753143, 9.00869187898934 +z: 35.5673008598387, 21.8645379412919, -19.9136686045676, 17.4843213986605, -32.0220090914518, -98.673325125128, -53.7705447990447, -30.4427234455943, -88.6013784445822, 49.2624955251813, 47.7439268957824, -80.527631752193, -21.2106753140688, 95.8693802822381, 55.6788475718349 +method: k +rm: FALSE +result: 0.0376521663149937 +------------------------------------------------------------ +function_name: pcor.rec +count: 11 +x: -12.6099046785384, 62.9503787495196, -41.7074305936694, 57.2416189592332, -14.5429391879588, -21.0340389516205, -75.441445922479, -53.8398617412895, 50.1939499285072, 80.4451046511531, 7.77875101193786 +y: -91.1863091867417, -45.6564084161073, 18.2509679812938, 12.5384614802897, -87.7081437502056, -59.8072885535657, 38.1740126293153, -90.6736130360514, -80.6179660372436, 67.7958796266466, -48.2190220616758 +method: k +rm: FALSE +result: 0.00487774919045338 +input.z.1: 82.2277778759599, -71.9359886832535, -81.6467982716858, 87.6012657303363, 66.7304196860641, 15.4578864574432, 82.6261980924755, 79.0331508498639, 11.5147780161351, -38.4340744931251, -51.4472227077931 +input.z.2: 61.85322124511, -16.4658469613642, -17.9835374001414, 36.6121453233063, -53.3555198460817, 95.8382083568722, 87.7777935471386, 31.6483219154179, 8.8566864375025, -72.558317007497, 6.72606155276299 +input.z.3: 1.57859744504094, 96.2870470248163, 78.9755351375788, -5.87459797970951, -89.8536934517324, 99.9234729912132, -11.5885237697512, -94.2207021638751, -19.373999722302, 74.6413060463965, -58.9515981264412 +------------------------------------------------------------ +function_name: pcor.rec +count: 10 +x: -26.585637498647, 76.3977353926748, 22.9591794777662, -57.9062177799642, -97.8634255006909, 9.66014945879579, 94.0443340688944, 76.1497691739351, -19.7134216316044, 2.45499121956527 +y: -18.0846814997494, -19.364173989743, -96.0522200912237, 87.5091985799372, -64.7892713081092, -90.5939534306526, -65.4118294361979, 17.4070830456913, -31.0635536443442, 4.03321231715381 +z: 80.9113253839314, -81.8780994042754, -10.1767265703529, 12.6185321249068, 31.2433938495815, 40.1075961999595, -88.4132706094533, -0.259516015648842, -67.1224204823375, 4.2356951162219 +method: p +rm: FALSE +result: -0.133460373384683 +------------------------------------------------------------ +function_name: pcor.rec +count: 15 +x: 69.5500911679119, 85.6129388790578, -59.8321632482111, -16.6489555500448, -23.689411021769, 7.28359869681299, 11.7851179093122, 0.971409818157554, 14.6698507014662, 12.5228200107813, -82.5623630546033, 10.7475840020925, 64.5495726261288, 33.6947743780911, 17.5113253761083 +y: -23.2205286622047, 79.4048092793673, -25.0229370314628, 93.0385292042047, 85.515082301572, -71.9814633019269, -32.8320536762476, 4.79555446654558, 11.8861138820648, 35.2179647423327, 53.5490271635354, -38.2638583891094, 47.7496858686209, -81.6408428829163, -51.109107490629 +z: -51.3139498885721, 91.0043549723923, -29.6979720238596, 64.7927256301045, 24.9896527733654, -49.5973426382989, -61.108489241451, -79.4058836530894, 56.8568713963032, -31.4483558293432, -81.7292190622538, 99.1093489807099, -31.6041610203683, 51.2187057640404, -1.86318131163716 +method: s +rm: TRUE +result: -0.220132277259967 +------------------------------------------------------------ +function_name: pcor.rec +count: 17 +x: 90.7971289940178, 64.8458667099476, -26.1766018811613, -21.0994517896324, -99.1302272770554, -50.7842414081097, -3.6383499391377, 27.4873042944819, -38.7462536804378, 68.3057898655534, 98.1881877873093, -45.7978362683207, -17.603207891807, 25.2952293958515, -22.7400164585561, 60.9401299152523, 62.4521202407777 +y: 29.2903814464808, -65.5612081754953, -78.4191365353763, -4.56041805446148, -30.2704517263919, -21.605000179261, 1.48401004262269, -44.5922049693763, 84.3162531964481, -4.89589110948145, -26.2383857276291, -76.1553710792214, 5.88274369947612, -78.4085688181221, 36.7778526153415, -39.9336752016097, -28.1932056415826 +z: -17.2037285752594, 13.8319098390639, 34.7095286007971, -27.703050384298, 9.93002681061625, 44.7098897304386, 54.4988644309342, 1.10581130720675, 42.3894800245762, -23.5900762956589, 83.1359798554331, -3.49259204231203, 37.7722999081016, 66.1500211339444, 51.4814839698374, -78.5076813772321, 24.2365219630301 +method: s +rm: FALSE +result: 0.0274828394860458 +------------------------------------------------------------ +function_name: pcor.rec +count: 13 +x: -80.7853449136019, -38.3992948569357, -22.2798614297062, 75.4607704933733, 33.0631603021175, -73.7780206371099, 5.96331777051091, -50.5084481555969, -31.7969931289554, 19.0575924701989, 85.3613562881947, -30.7409678120166, -73.8598890602589 +y: -19.4839437957853, -90.817145537585, 89.9142569396645, -7.78982224874198, -80.0989099312574, -58.8081724476069, -77.3309513460845, -16.1730996333063, -87.9085985478014, -17.9587779100984, -0.581334996968508, -42.1605377923697, 21.935287443921 +method: k +rm: FALSE +result: 0.229681482630548 +input.z.1: -63.2329418789595, 50.4205111879855, 1.37699875049293, 31.9463331252337, 90.1739185210317, -49.1128060501069, -6.9747703615576, -59.983176458627, -86.428006272763, -11.0352266114205, -48.7479498144239, 34.5943303313106, -78.9999180007726 +input.z.2: -40.928622148931, 97.1864043734968, -52.0364633761346, 65.8855800982565, -22.5181400310248, -12.0427423156798, 8.44123368151486, -70.3309573233128, -48.4425970353186, -76.6650391276926, 60.1132703013718, -98.2566928025335, 40.263629052788 +input.z.3: -45.1057865284383, 16.6654115542769, -58.5233464371413, 61.7927123326808, -47.9555701836944, -22.6161092054099, 28.3364725764841, -68.6806954909116, 54.0026980917901, 27.6144355069846, -17.2973237466067, 64.1560755204409, -59.8855725023896 +------------------------------------------------------------ +function_name: pcor.rec +count: 13 +x: 92.2603438608348, -56.4207409042865, 83.6725204717368, -80.7003829162568, 67.8985660895705, -75.0979449599981, -32.0562332868576, 56.0634645167738, -85.5500471778214, 33.3249835297465, 47.6551554165781, 66.1726305726916, 48.9350370597094 +y: 71.4295863639563, -18.2109759189188, 91.2296816706657, 93.7020284123719, -38.427047431469, -5.06591922603548, -71.242788201198, -43.5830219183117, -50.5092308390886, -32.3183794040233, -48.7796126864851, -84.1315757483244, -79.6182266902179 +method: k +rm: TRUE +result: 0.00477210789686704 +input.z.1: -4.25235852599144, 30.4247013293207, 22.6726256776601, 88.1398701108992, -14.9512176867574, -22.8902320377529, 15.2597426902503, 90.1389559265226, -87.9985238891095, 79.24031810835, 48.9382231608033, -63.0733355879784, 81.9164112210274 +input.z.2: 15.7161565031856, -86.386077105999, -11.9819261599332, 12.0433977805078, -84.1572615318, -88.4014238603413, -78.5426302812994, 6.74741943366826, 17.4219592940062, 42.3801865894347, 57.2220828849822, 18.5213928110898, 13.8206535484642 +input.z.3: -25.2769957762212, -79.8697541002184, 47.9512831196189, -40.2225833386183, 61.2570276018232, -89.5395552739501, 57.2230133228004, -6.20145709253848, -81.831949763, 37.4231112189591, 3.57026224955916, -6.8920056335628, 15.1464655529708 +------------------------------------------------------------ +function_name: pcor.rec +count: 13 +x: 60.5032597202808, -55.3992924746126, -57.1532733272761, 39.3540678545833, 41.2322402000427, 94.9976013973355, -25.1228974200785, 69.2301294766366, -62.8194462973624, 83.1489353906363, 64.4181499723345, 27.0436024758965, 54.5952781569213 +y: 50.8026732131839, -59.9888855125755, -26.8583768047392, 95.3958404250443, 71.0329591296613, -5.07162217982113, -57.6757784001529, 5.96255329437554, -26.5671603847295, 74.9519627541304, 55.9876888524741, -56.6113821230829, -65.2430968359113 +method: p +rm: TRUE +result: 0.564561996864683 +input.z.1: 25.9787803515792, -20.9894978906959, 42.6014113239944, 2.97193983569741, 31.9062470458448, -48.1516422238201, 75.1286832150072, 11.4769574254751, -55.0779395271093, -5.5713998619467, -42.5516823772341, -73.3385164290667, 61.5631113294512 +input.z.2: 52.3108799010515, -13.4730744641274, -26.2112704571337, -94.4241392426193, -87.1290047187358, 44.8173874057829, 16.0077110864222, -88.8399564195424, 32.9815314617008, 92.6361351739615, 64.8398043587804, -30.7204295415431, 84.6931307576597 +input.z.3: -77.9948043171316, -66.0049752797931, 62.4562206678092, 77.8233026154339, 42.9607164580375, 57.5163295958191, -70.2494252007455, 31.4489458687603, 10.7635230291635, 30.1841662731022, -80.0336173269898, -22.9067022912204, 67.9993652738631 +------------------------------------------------------------ +function_name: pcor.rec +count: 10 +x: 37.9142162390053, -8.26726146042347, -61.9123779702932, -57.8167630825192, 23.4680826310068, -99.7927295975387, 33.9280273765326, 79.8843482043594, -43.2324070017785, 56.6228452604264 +y: -62.526094680652, 61.9219188578427, -75.2686517313123, -74.1751136723906, -96.7679353430867, 1.48558439686894, 76.4188889879733, -61.2491626292467, 80.3087358362973, -45.7866244483739 +method: k +rm: FALSE +result: 0.0164627901375515 +input.z.1: 35.9344144817442, 98.7220860086381, -36.6842451039702, 48.8638223614544, -52.5896870996803, 23.3808947727084, -10.3175325319171, -89.9521626532078, -39.3597731832415, -21.7722129542381 +input.z.2: 40.9232123754919, 25.3107699099928, 31.3104595988989, 29.8185504972935, -80.9525416232646, 5.50809823907912, 57.8906395006925, -22.5699768867344, -12.0202441699803, 4.25414703786373 +input.z.3: 9.19963982887566, -56.4450024627149, -81.8353800103068, -71.7948751524091, -8.96710567176342, -0.098739517852664, -49.8610728420317, 68.7743380665779, 7.88735868409276, -84.7688094712794 +------------------------------------------------------------ +function_name: pcor.rec +count: 19 +x: -56.1894082464278, -12.6557477749884, -63.4441782720387, 0.33514741808176, 60.3243499062955, -64.7020475938916, 50.4497223068029, -2.1715194452554, 9.01610897853971, 76.9646459724754, -47.7160341106355, -41.9100993778557, -15.766973933205, 27.5259118992835, -35.4518753942102, -85.60910099186, 24.0823043975979, 93.0186438839883, 93.6028228607029 +y: -20.745520433411, -9.38104907982051, -74.1150409914553, -4.49656955897808, 69.9145309627056, -31.7319374531507, -59.7572867292911, -15.8576601184905, -12.6222641207278, -80.7064605411142, -55.2672634832561, 99.9313631560653, -6.02937843650579, -9.62814935483038, 48.0359378270805, -78.4953159280121, 99.3151890579611, -46.1329385638237, 48.141875769943 +method: p +rm: TRUE +result: 0.211991511824896 +input.z.1: 1.58806922845542, 86.8181970436126, 31.5542962402105, 55.2137501072139, -39.5924519281834, 33.013613242656, 14.7862681187689, -74.0772366523743, 58.9972470421344, -7.06596486270428, -21.0627525113523, 99.2032013833523, 56.6067849751562, -98.3875119592994, 41.2923750467598, -30.0579020753503, 4.85188476741314, 10.3777845390141, -27.4298328906298 +input.z.2: 34.8385723307729, 20.5119372811168, 77.690208144486, 44.7117544244975, 92.1282112132758, -90.9193224273622, 27.3936607409269, 44.8808068875223, -86.0024070832878, 92.0378822367638, -10.629472322762, 55.4692803882062, -25.0772546976805, 41.4051091298461, 6.33945902809501, 10.3499594610184, 54.4835149776191, 7.99261094070971, 89.524426497519 +input.z.3: 70.5266479868442, 56.8428464233875, 79.8325890209526, 48.6981757450849, 20.3497425187379, 14.0441357623786, -51.5891078859568, -7.34991990029812, 32.2692793328315, 68.6593409627676, 4.454291658476, 84.4771948643029, -73.7373711075634, 8.70008966885507, 71.2375602219254, -45.4772807657719, 35.3090388700366, -77.8953650034964, 56.713536940515 +------------------------------------------------------------ +function_name: pcor.rec +count: 11 +x: -73.061874229461, -13.9738537371159, 64.2177643720061, 15.2220948133618, -66.5882191620767, -6.66814856231213, 95.0206854380667, 53.7092166487128, 79.339360864833, -73.5059819649905, 26.2280288618058 +y: -17.2816875390708, 95.8707445301116, -79.8597431275994, 23.603032855317, 1.01680792868137, 27.7978147845715, -46.8073261901736, 60.1170611102134, -14.4904991146177, 80.4983365815133, 35.0678949151188 +method: s +rm: FALSE +result: -0.533103656117009 +input.z.1: 24.0054220892489, -38.2218769751489, -36.391848186031, 39.4758492242545, 82.74105344899, -14.3297997768968, -85.4651961009949, -86.8203293066472, -44.1936294082552, -47.1563939470798, 45.3097125981003 +input.z.2: -57.668925030157, -99.2560090962797, 73.3224391471595, 74.1201536729932, 81.7828055471182, -9.52679859474301, 14.1464875079691, 37.1397321112454, 31.4963829703629, 19.5132269058377, 54.907073546201 +input.z.3: 5.39321177639067, 51.5115650836378, -48.5234751366079, 59.8083338700235, 20.2424349728972, 7.82965249381959, -62.3213066253811, -52.3974419105798, -46.1440681945533, -96.0028395056725, -92.1209430787712 +------------------------------------------------------------ +function_name: pcor.rec +count: 11 +x: -75.8598148822784, -57.8679403290153, -70.5489284358919, 79.6496780589223, 83.6893404368311, -3.89578277245164, 30.8455263730139, 43.4356688987464, -93.7735083512962, 64.8750048596412, -27.4969315156341 +y: 10.6346141081303, 97.3708054516464, 77.6781819760799, 32.1429692208767, 44.3270593881607, -51.0296199470758, 53.1075953040272, -56.6818379797041, 82.5988807249814, 76.4641304500401, 67.2767641022801 +method: k +rm: FALSE +result: -0.372011732403109 +input.z.1: -30.0938377622515, 88.116044877097, -9.76424408145249, 89.2513517756015, 77.7156874071807, -77.6198823004961, -66.8529264628887, 74.9286437407136, 79.5354966074228, 39.1315433662385, 8.71772766113281 +input.z.2: -26.1263587512076, -62.1837942395359, 38.3388991933316, -42.6557110622525, -5.76013564132154, -60.0944366771728, 63.1011837162077, -62.5058522913605, 48.8114280160517, 1.21210310608149, -50.4604283254594 +input.z.3: -17.3055913764983, -79.3155479244888, 28.9295102003962, -18.9371800981462, 74.2997703608125, -40.0637871120125, -94.551969319582, -62.8503665328026, -7.13514289818704, 49.9038027599454, -51.9183388911188 +------------------------------------------------------------ +function_name: pcor.rec +count: 10 +x: -54.107921756804, 42.0997333712876, -6.38097845949233, 9.82502051629126, -28.6193792242557, -34.3836144544184, -3.67244216613472, 22.6311068516225, 13.8194078113884, -22.9492321144789 +y: 60.5207195039839, -81.0600532218814, 49.1948895156384, 64.3602961674333, -23.8067456521094, 48.5145658254623, -19.1302789840847, -57.330949883908, -92.603252409026, -34.9809643812478 +method: s +rm: FALSE +result: -0.522505562585742 +input.z.1: 73.3824520371854, -81.4419587142766, 59.7223955206573, -1.82209219783545, 84.9416411016136, -54.7515032812953, 2.77886907570064, -14.5639284979552, -18.736483482644, 56.108499923721 +input.z.2: 67.43677794002, -99.9857230111957, -97.4766474217176, -52.3709758650512, 65.8947822172195, -71.7632448300719, -15.8094623591751, 82.0473594591022, -14.198503177613, -16.3246036507189 +input.z.3: 62.8384766634554, 19.0266913268715, 35.5061936192214, -95.0661971699446, 28.3454976044595, -89.0745501965284, -14.7294794674963, -76.8557195086032, -18.2478179223835, 86.78869898431 +------------------------------------------------------------ +function_name: pcor.rec +count: 11 +x: -1.2142707593739, 1.14291775971651, -7.26283476687968, -61.8523230310529, 78.1381260138005, 28.326230077073, 88.5825785808265, 91.083605773747, 21.5207824483514, -8.56816032901406, -25.5072731059045 +y: 14.1181503422558, -36.2708885222673, -35.4297156445682, -1.67753333225846, -34.6098212525249, -62.3401450458914, -56.7325585987419, -19.2465652711689, 72.2250512335449, -30.4523368366063, 37.1804839931428 +method: s +rm: TRUE +result: -0.375187368938524 +input.z.1: 68.2266510091722, 26.6301542986184, 25.1655354164541, 95.4604937694967, -14.2991234082729, 12.1803054586053, 80.9723742306232, 74.5170688722283, -9.39638176932931, 13.0635335110128, 6.38360045850277 +input.z.2: 14.1705195885152, -74.5514953974634, 27.798350667581, 34.9743040278554, -4.05116858892143, -91.3039809092879, 8.21988149546087, 80.3523061797023, 30.8039418887347, -55.6892755441368, 88.9822357334197 +input.z.3: 45.2729779761285, -96.8037121929228, -1.97316566482186, 18.6038000043482, 98.2673170976341, 33.5015752818435, 63.8064842671156, -14.044907130301, -52.3745216429234, 21.3815015740693, -63.2074198685586 +------------------------------------------------------------ +function_name: pcor.rec +count: 19 +x: 94.328890228644, 5.75797557830811, 25.441690068692, 88.1982096005231, 45.7035119645298, 16.9675328303128, -87.1538819279522, -98.0717894155532, -91.5767922997475, -6.85307481326163, -9.82285114005208, 67.6100679673254, 58.5152864456177, -97.2691165748984, 91.1229528021067, -32.0776640437543, -69.0255750901997, -7.09530152380466, -6.81365500204265 +y: -80.5371531285346, -10.2979036048055, -38.8368986546993, -61.8645419366658, -83.1780408043414, 79.711103765294, 21.272880397737, -54.3522239662707, -86.3086901139468, -38.0223195534199, 52.8202678076923, -84.461157117039, 47.7731225080788, 7.32796876691282, 77.0558503456414, 31.592853507027, -87.3366552405059, 31.9443213287741, -37.1386748738587 +method: k +rm: TRUE +result: 0.0980405314826719 +input.z.1: 23.2567406725138, 21.890681842342, -89.1896610148251, 96.3604890275747, 49.5936496648937, -63.1400676444173, 14.4897532183677, -67.2666956204921, 49.4363921228796, 62.1179447509348, 47.1755699720234, 44.8309970088303, -12.7215121872723, 19.4518850184977, 17.0972461346537, -80.8160409796983, 88.3082031738013, -12.9626977723092, -81.6842820961028 +input.z.2: -55.4383310489357, 47.4879994057119, -0.869575794786215, 45.0101721100509, 3.4380410797894, 73.0201048310846, -25.7476052735001, 86.2380142789334, -52.0658289082348, 45.1091858092695, -55.0217658746988, 74.9276738613844, 92.2757615335286, 90.0036279112101, 74.9076794832945, 83.3363148383796, -64.1434239689261, 57.4586546048522, 25.7639687042683 +input.z.3: 6.6876329947263, 40.4029506258667, 94.9899430852383, 4.70264269970357, 17.7098400890827, 79.6689927112311, -46.7597783543169, -29.3036337476224, -9.24668917432427, -87.3026769608259, -67.9541712626815, 99.6626032050699, 33.7271203286946, -6.46288637071848, 1.44459712319076, -66.6438368149102, 26.0329113807529, 90.9082849510014, -29.0545757859945 +------------------------------------------------------------ +function_name: pcor.rec +count: 11 +x: -39.9631946347654, -38.9883862808347, -50.3526273649186, -9.96270119212568, -48.5522696282715, -11.14162793383, -24.0112878382206, 9.39341643825173, -80.0630148500204, -59.9971971008927, 69.5586620829999 +y: 52.67443805933, -48.463183036074, 90.0137397460639, 95.1239809859544, -98.6111979465932, -70.7381737418473, -97.7023174054921, -4.86181387677789, -99.9695376493037, -84.6450063865632, 35.2110210806131 +method: k +rm: FALSE +result: 0.288504241332419 +input.z.1: 80.2214500959963, -16.4790869224817, 14.9447090923786, -76.3074616901577, -95.7911690697074, -42.1649531461298, -10.7618189882487, -37.5353710725904, 75.4259538371116, 0.160726672038436, -84.0096296742558 +input.z.2: 79.9426295794547, -98.1330295559019, 20.2024064492434, -83.4212276618928, 81.9087484385818, 15.698215784505, -59.1874286532402, 2.41743079386652, -56.4012502320111, -29.0360070765018, -61.3683750387281 +input.z.3: 31.0607691761106, -70.0570112094283, -50.5196814890951, 81.6438420210034, -50.414383225143, -7.72223989479244, -13.9937483239919, 98.8766676280648, -96.4582050219178, 44.9282119981945, -58.7133090011775 +------------------------------------------------------------ +function_name: pcor.rec +count: 11 +x: 54.5031766872853, -48.0435361154377, -48.2549458742142, 13.5190900415182, -99.9459353275597, -43.1967475451529, -51.7230877652764, 85.8822505921125, 98.8075927365571, -23.5670748632401, 95.2128172852099 +y: -33.1321520730853, 75.4384634085, 41.4772017393261, 68.0324987508357, 96.748707164079, 36.6900125518441, 47.0263858791441, -6.55903057195246, 70.0058882124722, 1.28378001973033, 9.69074643217027 +z: -61.9628706481308, -42.8054075222462, -81.5592133905739, 48.7764513585716, -8.34423061460257, -73.7232564948499, 51.6754065640271, -52.4331694003195, -32.1930185891688, -79.7134197782725, -7.73797025904059 +method: s +rm: FALSE +result: -0.506675300750236 +------------------------------------------------------------ +function_name: pcor.rec +count: 17 +x: -79.6152154449373, 78.4319852013141, 49.7870131861418, 40.9128565341234, -38.9413299970329, 57.6212736777961, 95.6886244937778, -13.8690806459635, -14.3649831879884, -40.1887675281614, -35.8756079338491, -88.0116830579937, -76.4377722982317, -38.2442264817655, 22.5824641063809, 83.3017565310001, -18.2699847500771 +y: -56.8321019876748, -6.38408325612545, -6.54365173541009, 25.2405792940408, 77.7101498097181, 81.7850700579584, -23.5927077010274, 70.0163369532675, 13.4725551586598, -93.8025828450918, 82.9350834712386, -19.1807002294809, -96.641027694568, -13.9271743129939, 24.2437047883868, -33.1552400719374, -93.8347009476274 +z: -8.44970187172294, 9.03076659888029, -18.9505951944739, 60.2045745123178, 56.0176801867783, -57.2494097519666, 51.5992518980056, -28.4653120208532, -67.6779610104859, -84.3946997541934, -16.2014594767243, 97.8818096686155, -62.7145827747881, -66.8768094852567, 42.6931785885245, -18.1804189458489, -58.9151185937226 +method: s +rm: TRUE +result: 0.245647438689431 +------------------------------------------------------------ +function_name: pcor.rec +count: 14 +x: -8.95535191521049, 83.1295024137944, 26.2705389875919, 67.8139599040151, -69.8907925281674, -67.5867159385234, 59.5211905892938, -61.4588709548116, 20.9577512461692, -88.4819873142987, 21.290334360674, 43.7073293607682, 61.680910969153, 62.1506804600358 +y: 86.6269668098539, -32.5135345570743, 59.5476369839162, -55.8229512535036, 52.6881521567702, -83.0401647370309, -92.1478198841214, 54.4313754420727, -83.3293351810426, -62.313958723098, 60.8884260989726, 61.8840378709137, 57.433863170445, 18.0313312448561 +z: -69.2746695596725, -54.081470426172, 21.0898623801768, 18.5468762181699, 0.908048637211323, -63.3753003552556, 91.7176062241197, 0.488004460930824, 79.7440263442695, 4.30610617622733, -34.7610086202621, 22.1601004712284, 89.4652825780213, 48.7705412320793 method: k rm: FALSE -result: -0.197321176233531 -input.z.1: -73.6856204457581, -72.1338029019535, -8.49423431791365, 96.4111450593919, 69.9088138528168, -79.6609855722636, 53.6274126265198, 90.9375778865069, -3.22364578023553, 29.0517455432564, -14.7842853330076, 13.1408505141735, -81.6047978587449, -56.5155825112015, 84.1243132483214, 73.0853107757866 -input.z.2: -19.4999775383621, 47.0977590885013, -2.12466698139906, -37.686708336696, 65.1993685867637, -28.32176303491, -7.70075893960893, -90.5746295116842, -36.2292127218097, -9.05124093405902, -11.9998707436025, 49.7369820252061, 58.8602422736585, 30.8995170984417, 96.1009593680501, 66.8684390839189 -input.z.3: -46.8380375299603, -52.8264682274312, -97.0825299620628, 41.9147129170597, 23.6995006911457, -82.9784338828176, -77.9325462412089, -7.79568557627499, 29.9582084640861, 9.06890500336885, -40.2380415704101, 21.167817665264, -86.7719978559762, 39.0303079970181, 63.6500052642077, 97.9667663108557 -input.z.4: 86.9204596150666, -25.8097658865154, -1.28133394755423, 61.1777768004686, 15.653800778091, 11.6941955406219, -93.9451756421477, 78.9077403023839, -46.1673066485673, 96.1867772508413, 26.0938669089228, 60.3195236530155, -32.911190437153, -34.5624244306237, -74.3599003646523, 14.8807656019926 -input.z.5: 98.9267870783806, 36.2660525832325, -68.6460936442018, 86.7504182737321, -88.3716467302293, -29.2315890546888, 44.0522667020559, 21.4357518590987, 76.6611814498901, -42.3452171962708, 76.589828170836, 98.7857358530164, 35.6640399899334, 50.846758717671, -59.3500204384327, -0.00509298406541348 -input.z.6: -57.6999995857477, -82.2626783046871, 46.3180988095701, -24.4982566218823, 34.0653191320598, -77.0602269563824, -17.6961224991828, 80.3584903944284, 81.4667600672692, -61.6284600459039, -66.4861890021712, 6.89575211144984, -41.4117193315178, 30.7175636291504, 28.5187983885407, -13.7681076768786 -input.z.7: -41.7436920106411, 10.0865331478417, -2.38809078000486, -30.7737228926271, -81.4597308635712, 87.8097877837718, -16.6090088896453, 69.4210984744132, -68.126902077347, 41.2628519814461, 66.3250613957644, -4.5269432477653, -41.7136794887483, -18.0790721438825, 83.7037453427911, -53.3618018496782 -input.z.8: 59.7387420479208, -23.4883698634803, 37.5736472196877, -78.1687255483121, -77.1213553380221, -96.9213201664388, -30.2102203480899, -34.6717041451484, -88.6850557755679, 57.2000164538622, -30.3203931543976, -49.4191915728152, 77.6859395205975, -99.9760767444968, 30.1298272795975, -18.8501961529255 +result: 0.0111111111111111 +------------------------------------------------------------ +function_name: pcor.rec +count: 14 +x: -50.7522673346102, -73.3074016869068, 14.5340465009212, -66.5852255187929, 2.34679142013192, 73.8169429823756, -64.9932525586337, 46.2075220886618, -18.173229880631, 12.1496684849262, -71.3544078636914, -47.5662395823747, -21.4743808377534, -4.69422470778227 +y: -13.8064284808934, -12.5385803636163, -65.9088707063347, 44.2371282726526, -82.2711412794888, -51.4188673347235, 95.4864253755659, -31.0616248752922, -23.6471280455589, -74.6061203535646, 66.8357694987208, -22.5880632176995, 21.1619397625327, 13.0164582282305 +z: 77.0700187422335, -88.5332877282053, 6.34226612746716, 27.1646889857948, -0.0974785536527634, -26.363241719082, 60.9230055008084, -31.0812496580184, 5.27547332458198, 9.03973975218832, -88.1527445744723, -48.2249503489584, -81.6687730140984, -53.646367136389 +method: p +rm: FALSE +result: -0.670943883857255 ------------------------------------------------------------ function_name: pcor.rec count: 12 -x: -67.8204851225019, -67.8738070186228, -50.9799968916923, -56.6631073132157, -97.7544205728918, 97.7393067907542, -96.9981655012816, -77.3418115451932, 56.8798351567239, 20.4237798694521, -64.5462201908231, 98.7875565420836 -y: 42.6409022882581, -91.7236181441694, -17.9849655367434, 37.4724933411926, -41.5671722963452, 77.3905807174742, 56.6901307553053, 6.92465561442077, 56.1498492956161, -28.8950334768742, 47.1627758815885, 16.8313813861459 -z: 25.840808916837, -51.1974649038166, -93.5578513890505, 70.4190298449248, -34.2187709640712, -31.2343313824385, 14.4085955806077, 79.3285765685141, 17.1590864192694, -27.2897508461028, -72.3316723946482, 52.0868620369583 +x: 85.8026267029345, -88.8567392714322, 71.1906284093857, -42.287467001006, -87.2793929185718, 89.4890809431672, 43.1974852457643, -9.35818273574114, -17.5565235316753, -0.453179562464356, 43.4112564660609, 23.7805525306612 +y: -62.8617578186095, -89.3592846114188, -95.8116262685508, -41.6362321935594, -35.4687537997961, -28.9752063341439, 15.1240817271173, -81.4014834351838, 25.7772642653435, -83.8245145976543, -74.7226158156991, 63.2226870860904 +method: p +rm: FALSE +result: -0.0154314221847857 +input.z.1: -8.85584801435471, -76.0518108960241, -90.1860152371228, -27.0599717739969, -93.4562219306827, -93.58797124587, -23.47795618698, -94.6772815193981, -22.2225652541965, 41.5394491516054, -80.6787559762597, 86.2606703769416 +input.z.2: -38.7689351569861, -40.2000843081623, -99.1867681965232, 80.4073409643024, -44.9677177704871, 93.8172904308885, 59.8454762250185, 94.3912515882403, 34.1965254861861, 16.6013369802386, 67.8427397739142, -38.8580628670752 +input.z.3: 83.9653053786606, 95.5453366506845, 31.6075063310564, -49.3629164528102, 39.3006291706115, 58.262199210003, 36.9852046016604, -51.8655603285879, 14.8231557570398, 65.4056573286653, -76.6185896005481, -9.75128882564604 +------------------------------------------------------------ +function_name: pcor.rec +count: 17 +x: 42.2951359767467, -98.0670476797968, 72.95155916363, -97.5872188806534, 29.4609900098294, 53.7210481241345, -33.2761470228434, 18.8987899105996, -66.2275532726198, -79.557922296226, 29.3099474161863, 9.5911558251828, 95.1384756248444, -33.7378962431103, -10.1655352395028, -44.7425982914865, -50.7976255379617 +y: 33.169471565634, -84.5846886280924, 62.4898296315223, 75.4857927095145, 68.9234993886203, -54.5816842000932, 91.2322744727135, 1.25600299797952, -54.1735134553164, -12.8964414354414, 80.9569772332907, 82.643111422658, -64.9629856459796, 71.2960900738835, -58.9118956122547, 34.2774460092187, 79.9432563595474 +method: k +rm: FALSE +result: -0.0840388092297653 +input.z.1: 24.8670800123364, 96.9902894925326, 18.2047539856285, 29.9416149966419, -67.6683164667338, -94.5415789727122, -94.464895548299, -89.070585463196, -93.1418780237436, 7.63960015028715, -27.3726081941277, -20.9940173197538, -40.1839104946703, 22.9435044806451, 79.4069023337215, 82.1736453101039, -1.15302046760917 +input.z.2: 81.2827946152538, 18.1390372104943, 42.039096634835, 3.42075540684164, -88.2026459556073, 26.7978167627007, -13.1311344914138, -82.1488615125418, -74.8239930719137, 19.9365015141666, 30.6700795423239, -12.6407288946211, 25.2683679107577, 80.5456896778196, 3.72873861342669, 61.0932228621095, 94.7194188367575 +input.z.3: 18.1032594759017, 81.0059050098062, 0.533604482188821, -31.8593421019614, -82.4320225045085, 59.2174014076591, 12.148222932592, 32.3002810589969, 15.2615524362773, -20.450661983341, 83.4245914593339, -59.7416742704809, -37.4349432997406, -35.7613458298147, 45.3094141557813, -48.7132341135293, -60.4963214602321 +------------------------------------------------------------ +function_name: pcor.rec +count: 15 +x: 39.8641279432923, 36.6818822920322, -40.780941862613, -87.3267628718168, -28.2410716172308, 42.4047458916903, 0.0225101597607136, -8.9056434109807, -2.91150966659188, 39.6428920328617, -75.8707294706255, -73.5319286584854, 63.4615595918149, 22.4617537111044, -41.1442595068365 +y: -55.4940924514085, -64.180206740275, -80.1653628237545, 3.60332592390478, -41.3710146211088, -47.208951972425, 50.7955606561154, 68.0279347579926, 24.1804163902998, -58.5063801147044, 53.4048205241561, -62.6482892315835, 74.8165004421026, -35.8001246582717, -16.7477594222873 +z: 57.1126049384475, 13.7041463050991, 92.6308101508766, -98.5024768393487, -2.28023235686123, -23.9749090280384, 59.5866456627846, 37.3168694321066, -49.8011747840792, -61.9211140088737, 35.5470598209649, 27.0186287350953, 84.0462429448962, -53.7428881041706, -20.3638930339366 +method: p +rm: FALSE +result: -0.0698817922106879 +------------------------------------------------------------ +function_name: pcor.rec +count: 11 +x: 90.9256948158145, -42.5652571022511, -67.079691728577, -44.3737761117518, 39.7340807132423, -60.089198499918, 35.8762004878372, 22.369765676558, 82.5496308971196, 54.5133300125599, 85.3771304246038 +y: -83.5164808668196, -2.3147423285991, 54.9748376943171, 58.0427039414644, -64.0521888621151, -2.81249335967004, 98.0928914155811, 73.602551035583, 51.3121796306223, -34.7387288231403, -72.9273286648095 method: s rm: TRUE -result: 0.286086890994449 +result: -0.523042743416072 +input.z.1: 85.7249903026968, 83.893974032253, 35.4516032617539, -28.1841973308474, 17.7539859898388, 28.1705584842712, 62.0195430703461, 6.89598307944834, -43.7137708067894, -6.51348838582635, 64.4391702953726 +input.z.2: -77.2161093074828, -34.4602860976011, -31.7707217298448, 69.7988425847143, 24.0384986624122, 2.52298396080732, 67.1068411786109, -59.9436047486961, -6.02900786325336, 14.7358069196343, -39.7780386731029 +input.z.3: 27.5480494368821, 80.7176610920578, 45.4240935388952, -25.5288687068969, -8.32626689225435, 18.6241313349456, 56.0617660637945, -99.768823524937, -32.49516421929, 57.5501822866499, 84.3718754593283 +------------------------------------------------------------ +function_name: pcor.rec +count: 14 +x: 45.8342797122896, -77.0667779725045, -64.2237342894077, 4.22732839360833, -46.0417157970369, -47.2304744645953, 29.3592920526862, 63.4333388879895, -71.0418430157006, 70.1868168544024, -6.70211175456643, 88.2698916830122, -16.8335956986994, -10.7731471769512 +y: -66.40481101349, 46.3921690359712, 20.5301644280553, 2.09054443985224, -38.9518717769533, -82.9474763479084, 33.7044085841626, 96.5075950138271, -63.3534894324839, -20.2410046011209, -43.0850372184068, 92.0669205486774, 47.347361408174, 66.1714978050441 +z: 85.8965543098748, -37.6489527057856, -4.43430640734732, -76.9130968954414, 73.8492679782212, -9.16740805841982, -69.2597345914692, -95.8653298206627, -12.3851452954113, -1.94358341395855, 95.0880268588662, 13.8634593226016, 64.1506760846823, -61.8146073073149 +method: p +rm: FALSE +result: 0.362686685201407 +------------------------------------------------------------ +function_name: pcor.rec +count: 18 +x: 4.83486847952008, -33.575087832287, 5.45295123010874, -7.36544406972826, -51.7337966710329, -76.9358182325959, -35.6409954372793, 76.3785248622298, -39.3296065274626, 49.9114766716957, -54.7522674780339, 45.3345373272896, 44.5223123300821, -3.24754253961146, -81.5377961844206, 86.3679833710194, 36.4841728005558, -98.1516223866493 +y: -62.7916551660746, -98.1929061934352, -95.5918425694108, 85.3282696101815, 45.650498336181, 91.1865540314466, 18.8234640751034, -35.8555696438998, -78.9908673148602, -93.5970240272582, 61.6506161633879, -19.7622532490641, 20.6596003379673, -13.2536272518337, -34.9431619979441, -77.814610209316, -96.883852686733, -87.7667313441634 +method: p +rm: TRUE +result: -0.166800709155144 +input.z.1: 0.114683574065566, 76.4428338501602, 55.6030308827758, -12.6116141211241, 22.8804398793727, 28.3099383115768, 70.0053324922919, 8.81802220828831, -76.2668633367866, 51.8301085103303, -11.9479915592819, 58.2237378694117, 49.3079916574061, 61.2620721571147, -8.63581006415188, 44.7254316415638, -27.6764208450913, 97.5463242735714 +input.z.2: 73.784694634378, 99.4395392481238, -50.6187239196151, -32.5045205187052, -47.0645889639854, -29.0419731289148, 46.5196094475687, -26.6453473828733, 73.8187781535089, -14.7704138420522, -5.36934426054358, -84.8333730362356, -71.3679736480117, -72.7307432331145, -39.5870515611023, -47.0888705458492, -41.963919159025, -77.1274531260133 +input.z.3: 43.4523142874241, 39.5262993406504, -99.5481145102531, 43.935475917533, 90.169087331742, -1.52269233949482, 57.9886345658451, -58.3146122284234, 96.0287448484451, -77.5498211849481, 82.5941725168377, -6.65150554850698, -80.9493550099432, -73.9797147922218, -67.7011332008988, -17.1580271329731, -43.8098904676735, 44.4789375178516 +------------------------------------------------------------ +function_name: pcor.rec +count: 12 +x: 75.4411236383021, -19.5394861511886, 54.8095060512424, -92.0215208083391, -21.294112643227, 26.4304304961115, 95.5353437922895, 25.3490419127047, 37.6811063848436, 22.0898760482669, 51.9865156151354, -0.527428183704615 +y: -2.90723177604377, -99.8164829332381, 86.0683097504079, -96.8761240597814, 97.06368483603, 14.7922529838979, -77.4926966521889, 86.5167673677206, 60.2897321805358, -38.285131752491, 10.3472337592393, -51.6168985515833 +method: p +rm: FALSE +result: 0.275501840529125 +input.z.1: -93.3178124949336, 63.9247000217438, 52.2618164308369, 52.2421864327043, 7.9075523186475, 29.9971995875239, -1.57735198736191, -43.6246140860021, 33.8648134842515, 23.0104923713952, 96.1260831449181, -43.5764740686864 +input.z.2: -42.9460354615003, 72.2460472024977, 9.14394510909915, 41.6251530405134, -12.9338803701103, 60.1190572604537, 69.2696672864258, 53.0324925202876, 2.6995662599802, 78.4068618901074, 78.4405670128763, 91.7038987390697 +input.z.3: -48.3382353559136, -20.7997158169746, -82.1640026755631, -54.2279165703803, 50.1300446689129, -71.9413852319121, 46.1742796003819, 86.1585101578385, 36.9840029627085, 72.7105645928532, -3.33922882564366, 27.4154386017472 ------------------------------------------------------------ function_name: pcor.rec count: 10 -x: -29.0385090280324, -3.96912447176874, -47.6545965764672, 21.2344757281244, -75.0501185189933, -65.4063744004816, 56.9108343217522, 94.6856036316603, -61.1419711727649, -21.2616088334471 -y: -87.6347944606096, -25.0790369231254, 38.3246153593063, 36.459594219923, 15.7592192292213, -23.3778812456876, 70.4604929778725, -84.8090231884271, 34.0032887645066, -88.9591474086046 -z: 48.4383501578122, -8.53351750411093, -31.6805249545723, 69.0797030925751, -19.9694957118481, 78.5090744029731, 23.8751287106425, -88.1592587567866, -14.9336404167116, -23.2747808098793 +x: -28.5778240300715, 44.3743884563446, 33.4759910590947, -60.2454300504178, -41.7592494748533, 50.522102182731, -85.6955510564148, -66.6345450095832, -89.569599321112, 47.7078658994287 +y: -67.8200133610517, 27.5062628090382, 71.7565322294831, 67.6066937856376, -74.0544877480716, 17.2822214663029, 36.4111427217722, -46.7251748312265, 82.4704122263938, 41.7229991871864 method: p rm: FALSE -result: -0.067405367029641 +result: -0.604998498254511 +input.z.1: -58.7718021590263, -96.4335916098207, 32.5497580226511, -70.9680902771652, -47.4293766077608, 78.2334991265088, 59.4156378414482, -34.6753363031894, -34.3722300603986, 65.5848338268697 +input.z.2: 23.9919899962842, -38.0485058296472, 47.6243172306567, -77.3341711610556, -41.7488056235015, -20.8688801620156, -69.1063681617379, 60.9236182179302, -64.5143582485616, -26.092412089929 +input.z.3: -32.6844338327646, -59.2932476196438, -68.7602701596916, 2.40732813253999, 27.1003542467952, 14.0520400833338, 84.4277138821781, -70.8949789404869, -9.41576450131834, 20.9310320671648 +------------------------------------------------------------ +function_name: pcor.rec +count: 15 +x: -69.387745950371, -49.2386457044631, 78.5358119290322, -84.7651823423803, -6.51485347189009, 39.3126453272998, -72.8123931214213, -61.9186998344958, -18.6902535147965, -88.9804591890424, -91.7242038995028, 86.5591046400368, -34.7955056931823, 33.6816429160535, 64.656486036256 +y: -54.2493806686252, -62.5815090723336, -53.7531255278736, -48.4718740917742, 10.1653558667749, -3.61327603459358, 98.8740086555481, 78.1578201800585, 29.4536428991705, -72.3204976413399, -61.3744611851871, -58.5085956379771, 34.6117965877056, 18.9841146115214, 90.7721454277635 +method: p +rm: TRUE +result: 0.152489072601148 +input.z.1: -17.8637297824025, -29.0924018714577, 12.0219393633306, 89.730524783954, 20.4635892994702, -40.1110864710063, 97.1969441976398, 24.2813416291028, -7.22711877897382, -6.58672391436994, 85.9623525757343, 13.9038019813597, -1.48428776301444, 70.1985373161733, 99.4452722370625 +input.z.2: -24.2749121971428, 11.0093058086932, 1.79093312472105, 34.6534831449389, 77.1981728728861, -47.0347272697836, -38.3209746796638, 14.4402433186769, 25.9882995393127, -37.2800651006401, 33.4694077260792, -54.7662175260484, -18.9552983269095, 24.5075556915253, 77.4359260685742 +input.z.3: -54.5507300645113, -58.4174287971109, 3.50196729414165, 70.3624501358718, -85.4037730023265, 16.6389497928321, 46.1369656492025, -26.1817390564829, 27.9330456629395, 19.4141190964729, -51.5585941262543, -81.4289728645235, 52.6618564967066, 88.6152235791087, -3.4073153976351 +------------------------------------------------------------ +function_name: pcor.rec +count: 16 +x: -52.5501887779683, 76.0798906907439, -6.81492239236832, 51.8030108883977, -86.934806779027, -98.4599460382015, -38.9213243033737, -4.49495259672403, -87.9419339820743, -30.7407310698181, -20.1296131126583, -84.7388334106654, 95.9355524275452, 37.6330619677901, 11.805298179388, 71.3551525957882 +y: -35.7584306504577, -27.3668797221035, -72.6249604485929, -57.6672877185047, 89.3170366995037, 38.8797192834318, 66.2799593992531, -96.7583430930972, 71.8599527608603, 3.1670056283474, 6.21368275023997, 97.4829965736717, -74.2258692160249, -85.100900195539, 93.3626578655094, -6.60710437223315 +z: 68.3757029939443, -93.1859899777919, 73.9776723086834, 63.8459702953696, 4.1983631439507, 92.5801522098482, 58.4410866722465, -54.9838863313198, -18.4496367815882, 52.0247212145478, 41.2156102247536, 1.31171490065753, -86.6873883642256, -3.71779990382493, 53.2298434525728, -49.8276673723012 +method: k +rm: TRUE +result: -0.390867979985286 +------------------------------------------------------------ +function_name: pcor.rec +count: 10 +x: -75.3095431718975, 77.2476399783045, -30.7190073654056, -76.5569956507534, -38.3892927318811, -97.640515351668, 40.7633638009429, 80.9929232578725, 69.9184333905578, 37.5527075491846 +y: 83.5916271433234, -26.9137156195939, 97.4208392202854, 7.80353010632098, 0.348421139642596, -91.0831026732922, -46.7444436624646, -29.6432333532721, 73.4219971578568, -78.7570051383227 +z: 34.0024248231202, 31.6505118273199, -34.0259387623519, -88.8631666544825, 34.7183919977397, -9.8018751014024, 19.560739537701, -16.2760076113045, -64.0254020690918, 91.1820934619755 +method: s +rm: FALSE +result: -0.0560875688519553 +------------------------------------------------------------ +function_name: pcor.rec +count: 17 +x: -38.3992325514555, 32.8475083690137, 79.121769266203, 21.0495824925601, 44.6178534068167, 4.39555062912405, -51.3640556950122, -55.6133981328458, 79.1281075682491, -95.4117084853351, -35.9894464723766, 91.6743733920157, 7.56984488107264, 73.7063893117011, -94.4896949455142, -69.728662725538, 34.1863818001002 +y: -1.27204842865467, 15.5883238650858, 52.7721991296858, 35.2760184090585, 50.1832047477365, -34.9931715521961, -60.3594477288425, 53.8173413835466, 82.5948101934046, 97.0483394339681, 55.829929606989, 2.9106458183378, 1.44075509160757, -25.6358910351992, -89.6978388074785, -55.6567288935184, -13.0775235593319 +z: -48.5710377339274, 64.2419253010303, 41.1617243662477, 70.234408415854, -10.9620631206781, 95.1862500514835, -40.9594263415784, 45.6709728576243, 56.5230576787144, -32.0230093318969, -73.3659269753844, -57.5494988355786, -26.7636676784605, 68.3923695702106, -4.33183843269944, 28.4814916085452, -7.51618449576199 +method: p +rm: TRUE +result: 0.262299008214051 +------------------------------------------------------------ +function_name: pcor.rec +count: 16 +x: 63.9999500010163, 6.35658605024219, -61.2774891313165, -55.0585428252816, 87.6808669418097, 30.6727230083197, 25.9130414575338, -88.0746370647103, -32.165707834065, -21.940717799589, 14.2026159446687, -23.0245357844979, -52.1892547141761, -12.0932789519429, -79.3347698170692, -98.9265380427241 +y: 97.3826597910374, -99.0675398614258, 73.9090912975371, 34.971971809864, 25.0468590762466, 18.0295334663242, 17.503083543852, -87.189973378554, -39.5246281754225, 30.6683254428208, 92.4373132176697, 62.0077466126531, 86.7115816101432, 10.9139364678413, 78.7267089821398, -20.369843300432 +method: s +rm: TRUE +result: 0.152631744587296 +input.z.1: 95.2498456928879, 10.1988882757723, 82.5301209464669, -63.0169591400772, -80.2177854347974, -92.172612156719, 81.9323406554759, -98.8836394157261, -55.1519786007702, -9.92068941704929, 69.03902948834, -64.8831372149289, -59.4855682458729, -43.2437205221504, 32.601273059845, 51.8672341480851 +input.z.2: 98.8599751610309, 61.2078364472836, -79.2565326672047, -91.2782166618854, 4.95080463588238, -74.4587088469416, -58.5738305002451, -11.1764627043158, -42.7475158125162, -19.5871444884688, 15.3298336546868, -76.2663461267948, 35.0223543122411, -17.0931177213788, -53.7032708991319, 39.0595389995724 +input.z.3: -82.2170123457909, -61.1209249123931, 75.4895146936178, 24.8059226665646, 2.35008695162833, 20.5680044833571, 22.843256406486, -54.538040002808, 53.478835709393, -32.7691012993455, 73.4401112888008, -48.4993967227638, -32.6875764410943, 16.6579740121961, -35.9389083925635, 48.6933783162385 +------------------------------------------------------------ +function_name: pcor.rec +count: 14 +x: -38.0344086326659, -69.9757680296898, -96.0218561347574, 69.8170815128833, 84.4397103879601, -59.2046371195465, -25.6243887357414, -34.0098573360592, -18.5869125649333, 20.9443704690784, -17.8864942863584, 71.729579847306, -10.980512201786, 19.9342513456941 +y: 13.3373680990189, -28.0795010738075, 60.10332996957, -18.4444782789797, -98.1782922986895, 24.3794317822903, -76.4999823644757, 55.177218047902, 63.7693482451141, -21.0158154368401, 46.3093394879252, 38.5526302736253, -20.9319279063493, 43.4511065948755 +z: 91.1088630091399, -80.6348104495555, 14.3109522294253, -30.541270179674, -45.445510186255, -70.923288539052, -42.259228695184, -32.2218311950564, 26.1644289363176, 72.1342351287603, 58.3190027624369, 37.6866820268333, -47.4517594091594, 9.29418164305389 +method: k +rm: FALSE +result: -0.283731050383254 +------------------------------------------------------------ +function_name: pcor.rec +count: 12 +x: 95.6271091010422, 3.03470036014915, 16.5275795850903, 39.0536304097623, 64.3952058628201, 60.8842697460204, 77.1877882070839, 7.39374337717891, -35.8326355461031, -96.9841248355806, -2.37456695176661, -66.4348848164082 +y: 52.346898894757, -0.568210193887353, -57.0029267109931, -55.1746561657637, 41.1318924743682, -48.4784295782447, -11.867310013622, 58.9504377450794, 49.1472533904016, -48.130969516933, 87.50881687738, 95.0276869349182 +z: -27.8131592553109, -58.7517556268722, -79.0835770312697, -62.2862636577338, -40.9212727565318, 40.4043748509139, 60.9704895410687, 80.6037961505353, -29.821108514443, -72.1863387618214, 73.8867315929383, -71.3265169877559 +method: s +rm: FALSE +result: -0.498847227000007 +------------------------------------------------------------ +function_name: pcor.rec +count: 16 +x: -17.7215591538697, 33.0656519625336, 73.2753658201545, 66.6529010981321, 55.8624967001379, -18.1828083004802, -56.0154461767524, -80.258708121255, 74.527901597321, 22.4931557662785, 87.0472464710474, -68.2707403320819, -57.8954718075693, -55.7025399059057, 1.64373158477247, 89.0081748832017 +y: -11.6898256354034, -31.8874595686793, -27.6948968414217, -93.0535418447107, 94.3694983609021, -15.3473258949816, -30.3451092448086, 47.9080203920603, -12.34792903997, 70.1379578560591, 28.4610396251082, 82.0771362166852, -52.1409922279418, 73.4910554252565, 70.6270689610392, 29.6015367377549 +z: -3.16192414611578, 91.681189648807, -8.44467529095709, 61.7250246461481, -39.3754992168397, 10.0268266629428, -80.2241073921323, -30.7949334383011, 38.7846238911152, 99.9698612838984, -10.4493941180408, -79.5240023173392, 84.4389423727989, -90.3318281285465, -0.888433260843158, -9.30486363358796 +method: s +rm: TRUE +result: 0.00723744241918376 +------------------------------------------------------------ +function_name: pcor.rec +count: 10 +x: 34.7738367971033, 79.1716305539012, 76.4990594238043, -81.775622535497, -27.1493992302567, 10.8191972598433, -30.871396837756, -0.714902393519878, 61.4628181327134, -36.771080410108 +y: 53.3137893304229, -50.2570678945631, -41.6580128017813, -7.47664775699377, -88.6360401753336, -91.5539033245295, 12.6738691702485, 40.7443516887724, 83.883469318971, 49.5867451652884 +method: s +rm: FALSE +result: -0.282719593431579 +input.z.1: -84.4675720669329, -67.0466589275748, -18.3911125641316, 98.2628283090889, 51.9808443728834, -30.4428660310805, 21.8935457058251, -90.0795019697398, -70.4285278450698, 5.32920747064054 +input.z.2: 45.5949940253049, -83.0156840384007, -35.4019852355123, -30.4982414469123, 24.3814556859434, -71.7630771454424, -88.9764131512493, -57.2371034882963, 70.5831084866077, 35.4439703281969 +input.z.3: -14.7715406492352, -59.8912607412785, -99.6177072636783, -28.8444213569164, 59.2899556737393, 12.0164824649692, 99.4955199304968, 24.3026872631162, 19.8734523262829, 86.9021194986999 +------------------------------------------------------------ +function_name: pcor.rec +count: 15 +x: -56.3390923663974, -93.8485420309007, -76.1460797395557, 87.2354988474399, -9.28768664598465, -31.4640353433788, 43.1042958050966, -79.2129376437515, 69.6591412648559, 50.0667770393193, 51.4706159941852, 48.2311789412051, -87.6915453933179, 41.4921804331243, 46.0590915754437 +y: -30.0428883638233, 23.8112844526768, -66.162470029667, -58.4669277537614, -13.7554917950183, 40.0350350420922, 80.381247960031, 76.8449954222888, 8.20867097936571, -2.99584232270718, -27.960628317669, -8.26242859475315, -77.6679917704314, 37.3565788380802, -14.3165319226682 +method: s +rm: TRUE +result: 0.0255435017969936 +input.z.1: 15.6856134068221, 44.3085910752416, 60.8353640884161, 80.8151323813945, -93.5956147965044, -54.3712676037103, -1.6567571554333, 90.8884244039655, -21.2625379674137, 81.0105908196419, -93.1311052292585, -8.25112308375537, -19.440022809431, 98.4774097334594, -18.0913300719112 +input.z.2: 82.7684669289738, -12.4109126627445, 53.7559506483376, 83.7132328189909, 99.6508095413446, 71.7520699370652, -92.9998741485178, 56.0302780009806, -51.0383900720626, 21.5518812183291, -18.6573163140565, 36.7927459068596, -84.7163817845285, 55.2210496272892, -70.2050358057022 +input.z.3: -98.7551828846335, 19.49746995233, -17.9139976389706, -35.7827616389841, -75.590154202655, 29.1891138069332, -27.3778593633324, -23.2670258264989, -71.2701795622706, -35.3796728886664, -53.1982235610485, -72.0516404602677, -0.0638416036963463, -60.8670709189028, 10.7043496333063 +------------------------------------------------------------ +function_name: pcor.rec +count: 18 +x: -41.4313202258199, 45.9841891657561, 73.0351263191551, 14.5961822941899, 74.4030376896262, 0.350432144477963, 80.5028904695064, -86.0359017271549, -39.5940739195794, 17.8364073392004, -95.8692795597017, 23.454642156139, 63.9558572787791, 16.6738138534129, -14.6638540551066, -12.6493938267231, -47.084568021819, -49.758878769353 +y: -78.1604333780706, 39.5707542076707, -12.7265444491059, -38.0420819856226, -55.3764114156365, -7.27670988999307, 58.9023143518716, -13.7581620831043, 22.982121957466, -91.5119064040482, -72.0678606536239, 90.5886249616742, -51.7078758683056, 26.0097248945385, -23.915150295943, 68.5918164905161, -81.5348560921848, -15.0977482553571 +method: p +rm: FALSE +result: 0.188671955029874 +input.z.1: 80.1465837750584, -10.501228319481, 89.6407624240965, -39.7226133849472, 16.4567670319229, -71.1080288980156, -88.0229809321463, -75.8985460270196, 52.3780675604939, 34.3009188305587, 6.18860609829426, 97.8012350853533, 75.5968149285764, -61.0649057663977, 48.5446393955499, 18.231154140085, 1.47281852550805, -22.2872096579522 +input.z.2: 46.3825967162848, -82.8961354214698, -35.6839893851429, -25.5692901555449, 99.5609007310122, -31.00421926938, -14.7553088143468, -46.3190216105431, -89.3388437107205, -88.630617922172, 4.92621585726738, 89.5269899163395, -18.8370112795383, -40.9037253819406, -33.2164043094963, 74.5714424178004, 88.6978259775788, 61.7720224894583 +input.z.3: 81.4619556535035, -94.0986347850412, 98.9308916497976, 70.2591719571501, 39.478223817423, -88.385613868013, 9.04444772750139, 91.7586042545736, -47.6329161785543, 59.0545888524503, 70.1687247492373, -63.067327439785, -78.9021805860102, -49.9975389800966, 66.2716360297054, -55.5166335310787, -31.9789612665772, 51.4375566504896 +------------------------------------------------------------ +function_name: pcor.rec +count: 16 +x: 10.40073283948, -13.6921347118914, 84.5260130241513, -25.3665409516543, -78.2397591974586, 26.9345681648701, -58.5972013417631, 88.9882248360664, 45.4503744374961, -65.1228747330606, -27.4899946060032, 18.1972809601575, 11.3279470708221, -10.4332664050162, -60.4957120958716, -72.7518951985985 +y: -71.9699081033468, -99.9155370518565, 27.7240531984717, 85.3693515062332, 35.6472678948194, -23.4722698107362, 44.0854747779667, 95.8298934157938, -64.2083233222365, -29.3003208469599, -59.2611992266029, -29.7768235672265, 72.6343247108161, 49.7656984720379, 20.3026765026152, 17.2155754175037 +method: p +rm: FALSE +result: 0.0493694878245429 +input.z.1: 35.6308063026518, 4.66748662292957, 30.0429651513696, 76.2124869506806, 41.5056325495243, -30.4092030506581, -40.1510936673731, 91.4136198814958, 54.569678613916, -38.229710329324, 17.4495459534228, 42.4616932403296, -83.6061837617308, -96.9037922099233, 9.05879577621818, -81.1989603098482 +input.z.2: -13.610919052735, -2.48283445835114, 43.406359385699, -1.01326643489301, -71.5403430629522, 42.3702582251281, -57.7236965764314, -98.0018012225628, -2.94910599477589, -99.2285002022982, -30.1409310661256, -15.3791854158044, 63.2841229904443, -59.3148066196591, 89.0598343685269, 50.3705789800733 +input.z.3: 65.1514234952629, -52.134693833068, 37.3474742751569, -34.9965825211257, 29.8068393021822, -37.6201854553074, 28.4822612535208, 58.1028845626861, -71.3396343402565, 6.92787766456604, -81.047579832375, 6.40434417873621, -3.12588470987976, -85.8339602127671, -89.5489359740168, 36.9031661655754 +------------------------------------------------------------ +function_name: pcor.rec +count: 14 +x: -97.1265674103051, -30.6887221056968, -58.1901613157243, 41.3434299640357, -44.8513293173164, -47.3897785879672, -11.2351455260068, 4.53527974896133, -53.9899244904518, -34.4885903876275, 84.1011397540569, 98.0846612714231, -97.2742294892669, -30.2832910791039 +y: 50.7123678456992, -41.0642932634801, 59.7222890239209, -87.1463846880943, 88.5209604166448, 76.3058924581856, -78.5172951407731, 23.3256267383695, -33.4639381617308, 67.8117078728974, -34.5261936541647, 13.6419337242842, 71.4485326316208, 29.9240712542087 +method: k +rm: TRUE +result: -0.414455855539734 +input.z.1: 95.3356681857258, -82.6237799599767, 61.6875410079956, -55.9806656092405, -98.3273911755532, -27.0171985961497, 45.6566241104156, -60.7003193348646, 39.0095799230039, -4.835369810462, -82.758112763986, -63.1046458613127, 22.5925303529948, -27.5266251526773 +input.z.2: 40.2346897870302, -80.8139885775745, 79.8951716627926, -99.673797795549, -11.8247658014297, -4.43669916130602, 21.9069521874189, -96.3469043839723, -12.5659705139697, 5.28370542451739, -2.05569667741656, -46.0224835202098, 37.0902071706951, 13.7604320421815 +input.z.3: -75.4078052937984, 53.1730110291392, 32.1218248456717, -3.36327841505408, -64.6848318167031, 46.9770870171487, 56.2149090692401, 77.8601902537048, -99.6458038687706, 17.093415139243, 30.976364063099, -21.0922583937645, 64.4309076480567, 28.8166706915945 +------------------------------------------------------------ +function_name: pcor.rec +count: 11 +x: -21.7418022919446, -19.7270201519132, -51.0829096194357, 95.4731678124517, 63.3456526324153, 10.2449305355549, -30.8713216334581, 56.4763959497213, 97.5144575815648, -99.8349095229059, -36.944431765005 +y: 41.1633080337197, 71.5601967647672, -32.7024550177157, 95.0067212339491, -41.5371483657509, 76.2717307079583, 64.7539126221091, -59.7191719803959, 38.3289860095829, -5.68816638551652, 46.9167932402343 +method: k +rm: TRUE +result: 0.2560174270761 +input.z.1: -13.6582542210817, -54.4519340153784, 60.2084300015122, -22.9066342581064, -1.08100399374962, -39.2812125850469, -59.9119843449444, -89.6116081625223, -93.6755935661495, -30.0237529911101, 63.4646773803979 +input.z.2: 5.04081835970283, -7.67772262915969, 64.7993986494839, 10.6604609638453, 29.0101025719196, -11.9249556213617, -69.8554737027735, -2.71794814616442, 34.5893805380911, 52.1268622484058, -87.2946038842201 +input.z.3: 96.479544788599, 73.5420207027346, -65.0878861546516, -57.7022604178637, 81.0698586516082, -82.7021759469062, 21.458005765453, -53.0339238233864, -43.9016601070762, 60.7445098459721, 50.4766744561493 +------------------------------------------------------------ +function_name: pcor.rec +count: 10 +x: -34.2646942008287, -78.1300825066864, 6.60557821393013, -57.4746059719473, 5.91994277201593, -58.6971938144416, 81.2527935951948, 58.9401760604233, -13.9615070074797, 84.4087808858603 +y: -84.765654662624, 30.2333278115839, -10.119401384145, -17.8130576852709, 14.3761526793242, -21.2025688029826, 59.4600023236126, 22.4814132321626, 43.6779118143022, 10.5381097644567 +z: -67.6395879592746, -63.1648739799857, 25.9779758285731, 68.5387071222067, 95.8367916755378, -11.1885727383196, 89.5199802704155, 29.4853665400296, 40.4386383015662, -79.2295292485505 +method: s +rm: FALSE +result: 0.31648230729558 +------------------------------------------------------------ +function_name: pcor.rec +count: 17 +x: 65.2889241464436, -25.8309810422361, 41.5279346518219, 33.3778714761138, -78.418835811317, -86.3514642696828, -57.550333160907, -88.9864289667457, 83.8500074576586, 86.0779710579664, -72.9724165517837, 62.1391572058201, 35.1193575654179, -83.0525180790573, 27.2962907794863, -75.9986287914217, -59.743734030053 +y: -79.1268857661635, 21.6799827292562, -86.7284807842225, 76.4053526800126, 93.5399503912777, -7.59860742837191, 42.910123243928, -64.9026639293879, -39.5152932032943, 32.3382542468607, 79.3962649535388, 22.9047404136509, -17.6881920080632, 48.4937213361263, 51.0530607774854, 88.3627690374851, 36.3776166923344 +method: s +rm: TRUE +result: -0.50973498058253 +input.z.1: -90.2783849742264, 67.8969173692167, 81.9336336571723, 23.094120528549, 45.3741174656898, -61.7810368537903, -40.4937511309981, 65.4344111215323, -88.5476648341864, -64.6377388387918, -44.140517571941, 1.47411120124161, 79.240211751312, -60.1765193045139, 55.3837953601032, 43.3551961556077, -66.288702422753 +input.z.2: -36.9666110258549, -19.9583745095879, 17.8784884046763, 13.4679388720542, 4.24224487505853, 75.965761533007, 77.3604078684002, 14.5181270781904, 96.6304958797991, -90.3991216327995, 23.3897795435041, 87.7320431172848, 44.0418939571828, 98.0463651940227, -0.360229099169374, 33.0039616208524, 31.0656359884888 +input.z.3: -19.3495023064315, -2.21126056276262, 63.4957967326045, -92.3508635722101, 3.20365112274885, 89.5428656134754, -92.3482635524124, -38.769258139655, -49.6236519422382, -46.3103124406189, -85.6290648691356, -92.7534214686602, 7.33050634153187, -3.93257569521666, -19.6759086567909, -99.842318193987, -74.6654002927244 +------------------------------------------------------------ +function_name: pcor.rec +count: 15 +x: -79.5160966925323, -74.9874663539231, -78.7817076314241, -77.2851656656712, -70.8517644088715, -33.5970929358155, -43.6421300284564, -41.397284111008, -92.8962790872902, 70.4068915918469, 47.7719811256975, -92.2868068795651, 28.4771746024489, 79.5827704947442, -28.5637738183141 +y: -37.4145726673305, -0.288628088310361, 47.6206338498741, -88.7128345202655, 30.3396196104586, 25.5081232637167, -72.0780373550951, -73.6024056561291, -57.554987911135, 81.4102350268513, -87.255728431046, 42.0090320520103, -5.66472639329731, -5.92177757062018, -14.2655706964433 +z: -23.3767181169242, 31.2546348199248, 56.052082311362, -27.3735378868878, 3.64539204165339, 64.6297093015164, -93.1361247785389, 99.8736266978085, -36.8254229426384, 86.4495293237269, -95.7299213390797, -50.8483925368637, -78.292038384825, -36.2992297858, -24.5581880677491 +method: k +rm: FALSE +result: -0.0134693114610091 +------------------------------------------------------------ +function_name: pcor.rec +count: 17 +x: -43.5266146436334, 18.0117554031312, 58.6101210676134, -41.2745150737464, 32.3130699340254, 54.0322658605874, 24.1791611537337, 73.3054053038359, 42.0464181806892, -96.5218428522348, 29.9439492635429, -12.5784670002759, -44.0562542993575, -25.4333753138781, 94.4393996614963, 98.0722198262811, 55.4907775018364 +y: -9.93549497798085, -45.8743677474558, -93.3299192227423, 79.5469779986888, 8.02246518433094, -14.3250429537147, 70.3237357083708, -99.5543221011758, -87.8637499641627, -86.2719914410263, -61.0736012924463, 24.7784069273621, -37.3273107688874, -28.9717409294099, 93.1313112843782, -25.6219055503607, -49.4559060782194 +z: -64.1072164289653, 87.7694536466151, -37.9586412105709, -22.3177924286574, 40.3714318294078, -63.5947197675705, -22.0420437864959, 33.9729850180447, 5.00115477479994, 10.3678717743605, 35.4822291061282, -45.7916335668415, -18.1938569061458, 15.615754853934, 19.5150196552277, 23.4867738094181, -95.2608565799892 +method: s +rm: FALSE +result: -0.112611956543292 +------------------------------------------------------------ +function_name: pcor.rec +count: 16 +x: -92.1721640042961, -44.6145492140204, 86.8770225439221, -17.2698491252959, -40.4595222324133, -81.152014946565, 76.5948620159179, 14.66314336285, -43.7089977785945, 74.8940746765584, -20.9608427714556, 60.4101787786931, 92.6798572763801, -13.8263172935694, -15.3552802279592, 30.9063795022666 +y: 34.0978310443461, -93.5446070507169, -52.1205889526755, -60.0228164810687, 40.2410709764808, 68.5365847777575, -20.6536095123738, 96.2824455928057, 94.9520392809063, 38.3727887645364, 5.11064333841205, -42.3503454308957, 7.87821393460035, -15.5445182230324, 55.9228281490505, -54.4300060719252 +z: 72.2797598224133, -36.7589842528105, -31.7109297960997, 14.8865082301199, 14.2975315917283, -33.6676219012588, 73.4386292751878, 42.6696452777833, -49.9572122935206, -16.0288103390485, 91.8950178194791, -22.2982299048454, 43.716481141746, -83.7867478840053, -26.7168609891087, -40.8360068220645 +method: k +rm: TRUE +result: -0.152451910661407 +------------------------------------------------------------ +function_name: pcor.rec +count: 13 +x: -73.5700607765466, -27.4823492858559, -18.4957931749523, 75.0972531735897, -84.0701918583363, -73.6900016199797, -80.8014692272991, 1.56031367368996, 53.5824096295983, -15.8273342996836, 27.9865844640881, 71.9814067240804, 16.1229219753295 +y: 61.8587560020387, -54.1709136217833, -85.5680546723306, 11.5867487620562, 8.42031557112932, -19.0553280990571, 53.1157708261162, -6.55828071758151, -57.5449388939887, 60.9522576443851, 14.8441521450877, 21.0842114407569, 98.9267005119473 +z: -77.1422278601676, 71.9358698930591, 30.8435730170459, -37.9183823242784, -2.70509789697826, 11.3845904357731, 98.1391918379813, 59.1201251372695, 16.70933207497, 83.35813540034, -73.9252686966211, -44.1968939267099, 35.4018601123244 +method: s +rm: TRUE +result: 0.0029677519984588 +------------------------------------------------------------ +function_name: pcor.rec +count: 12 +x: 66.390974028036, -16.8352647218853, -53.4644976258278, 75.3752870019525, -57.9270939808339, 54.5454489067197, -96.0464406758547, 33.1332623958588, 86.3947817590088, -18.4396516531706, 35.6390007771552, -6.8594797514379 +y: 66.0928500816226, -76.8080259207636, -82.475224789232, -87.0922611560673, -90.1318115647882, -71.2204404175282, 46.6621011029929, 10.2849024347961, 71.9189416617155, 68.8622513320297, -65.4017291031778, 3.43264965340495 +z: 13.3069343399256, -62.5784140080214, -27.0972901489586, -74.1631664801389, -57.5879731215537, 70.6120911519974, 77.241751877591, -38.2255645468831, -2.94962706975639, -86.2344280350953, 56.0441972222179, -88.6967639438808 +method: p +rm: TRUE +result: 0.110920134285541 +------------------------------------------------------------ +function_name: pcor.rec +count: 11 +x: -8.54161819443107, 28.0718581750989, -32.8153485432267, -41.8009532149881, -83.3797766361386, 93.1131374556571, 80.5043308064342, -62.7610028255731, -15.2504758443683, 48.5718804877251, 17.7535368595272 +y: 42.7155940327793, -65.7041405327618, 69.3401046097279, 41.7508821003139, -67.2856659628451, -72.5374098867178, 6.22773463837802, 29.1457378771156, -41.368066938594, -95.4474326688796, -37.1582591440529 +z: -14.5949687808752, 82.971200812608, -59.7984070889652, -99.9608739744872, 97.1308692358434, -19.0055053215474, 88.3440440520644, 31.6497736144811, -24.3022648151964, -35.1213763467968, 14.9526675231755 +method: p +rm: TRUE +result: -0.401692765812538 +------------------------------------------------------------ +function_name: pcor.rec +count: 14 +x: 80.8533196337521, -18.1722048204392, -75.5538297817111, -67.8516203071922, -22.7996712550521, 57.1183586027473, -69.1113813780248, -62.8999908920377, 22.4695996847004, -0.333229219540954, 48.4565405640751, -92.8434989415109, 29.1625312995166, -83.2451142836362 +y: -38.2450382225215, 67.0644144061953, 38.6723168659955, 24.438568437472, 69.5456247311085, -84.6855477429926, -58.3137557841837, -94.6218158118427, 8.89068827964365, 15.1739988476038, -96.3306906633079, 96.3657117914408, 69.1964435856789, 0.972708594053984 +method: k +rm: FALSE +result: -0.243926934409628 +input.z.1: -93.7178533058614, -0.183204282075167, -37.0745961554348, -74.5082440320402, 28.1698084902018, -21.653729910031, 61.0449272207916, -63.0486940033734, -3.97970410995185, -26.7391014844179, 79.7092916909605, -75.7014720700681, -69.53080361709, -82.0775283966213 +input.z.2: -48.5075518488884, 1.95450144819915, -3.33806169219315, -92.2314285300672, 22.3729324061424, -89.7453350014985, -53.7487217225134, -54.0849874261767, 17.1049350406975, -86.7313547525555, 75.2309385687113, -21.8698643147945, 80.9956186451018, 89.605490071699 +input.z.3: -90.0013716425747, 85.5859903153032, -27.047320175916, 46.6997304465622, 21.4192960876971, 77.8831989970058, -8.81227441132069, -6.12898389808834, -87.6430103555322, -61.6656949743629, -82.8727319370955, -7.43764750659466, 69.1672470420599, 87.8232514485717 +------------------------------------------------------------ +function_name: pcor.rec +count: 16 +x: -31.3715231604874, 78.4395510796458, 37.7813975326717, 90.9998905379325, 4.0892272721976, 23.3491680119187, -44.3821705877781, -37.741759326309, -32.6842260081321, -95.3462653793395, 83.2728854846209, 30.0052943173796, 73.2703904621303, 32.3609015904367, 88.8722232542932, 68.1857937481254 +y: 40.6233130022883, -30.0252608954906, -74.1636462509632, -92.0489497948438, 27.8864013496786, -99.424716597423, -20.6159302499145, 25.279173720628, 7.00154760852456, -95.5817312467843, 48.8055042922497, 56.2402768526226, -77.4240196682513, 44.1807419992983, 20.404072990641, -1.18401693180203 +z: 66.9464991427958, 6.30434169434011, -39.6972810849547, -52.4486493319273, -56.4930079970509, 52.421877393499, 55.8516921009868, -4.39011608250439, -74.2396947927773, -25.1450017560273, 42.0996841508895, 16.1958371754736, -22.8619898669422, 90.4492018744349, -74.1765698883682, 39.9869302753359 +method: k +rm: TRUE +result: 0.0357828133482257 +------------------------------------------------------------ +function_name: pcor.rec +count: 14 +x: -94.1282887943089, 0.863795494660735, -54.5142192859203, -14.0683484263718, 10.5734667275101, -55.2807766478509, -71.1918077431619, -88.842673227191, 71.1261768825352, 19.2098991014063, -29.3649735860527, -96.3000339921564, 20.0530176516622, -48.131195968017 +y: 46.0645425599068, -97.9253031779081, 70.4843280371279, 80.5193558335304, 23.0555126443505, -97.9770058766007, 84.8336459603161, -77.9917985666543, 35.5348350480199, -46.9889497384429, 84.9599295295775, 33.0589215271175, 32.9579345881939, 24.89710515365 +z: 42.9362330120057, 42.9295230191201, -64.6692109759897, 38.3608576841652, -17.3026880249381, -25.5683950148523, 90.6109735369682, -16.0139869432896, -38.463629456237, -59.1028479859233, 87.1063947211951, -6.00760709494352, 12.1647471096367, -52.6431480888277 +method: p +rm: TRUE +result: 0.0366450176631751 +------------------------------------------------------------ +function_name: pcor.rec +count: 15 +x: -84.5445530954748, 32.1405971888453, -23.0592608451843, -92.6854473073035, 58.4254698362201, -84.7419968340546, -22.7555541787297, 63.9643139205873, 76.1275416240096, -73.178022634238, -3.98154174908996, 26.802809163928, 50.5906715523452, 52.159122005105, 80.1790326368064 +y: -18.9386786427349, -84.6106726676226, 48.5546028707176, -44.6534102782607, 20.7739837002009, 4.48967423290014, -37.7230455633253, -80.9451036620885, 29.9852483905852, 23.2817359268665, -16.882407432422, -53.8926647044718, -97.029253654182, -26.2379488907754, -15.1613433845341 +z: -99.1309873294085, -72.4603479262441, 66.8711055070162, -75.8488883730024, 39.4639032427222, 43.4117903932929, 62.2310574632138, -2.13857642374933, -6.8422191310674, -14.0866828151047, -62.183153629303, -49.4522110093385, -16.3348558358848, 64.6755408030003, -61.5349486470222 +method: p +rm: FALSE +result: -0.291819029638886 +------------------------------------------------------------ +function_name: pcor.rec +count: 10 +x: -89.2644015140831, -42.963656084612, 87.6042891759425, -15.7976613845676, -57.8714273869991, 61.3913614768535, 73.5168375074863, -4.00514821521938, 77.7676994912326, -54.8066982533783 +y: 32.5989249162376, 82.6726690400392, 23.7537688110024, -63.3400282356888, 29.2318671010435, -96.3339688256383, 5.10485065169632, -74.1683969274163, 27.5063658133149, -20.300987130031 +method: k +rm: TRUE +result: -0.357889493427411 +input.z.1: 53.2483558636159, -62.8594945184886, 69.805056694895, -91.7430310044438, 3.41492984443903, 67.3900785390288, -98.4968071337789, -0.730537809431553, -72.1466899383813, 87.7064510248601 +input.z.2: -89.8748981766403, 15.6837180722505, 14.6945471409708, -73.451646277681, 36.8902978952974, 22.0203426666558, 87.802790151909, -19.431734085083, -43.2061756029725, -2.11614053696394 +input.z.3: -36.9409368839115, 2.75738257914782, 97.5110043305904, 17.5617986824363, -32.737740688026, -28.1387409660965, 58.5559561382979, 41.4380328729749, 63.8094739057124, -65.0269193574786 +------------------------------------------------------------ +function_name: pcor.rec +count: 13 +x: -42.7785499952734, 87.383286235854, 25.6565656047314, 62.4534173868597, 54.393582046032, -88.4201749227941, -95.5750266090035, 66.1459297407418, -16.2288751453161, -20.9175069350749, -13.3836749475449, 18.3453384786844, 47.9472403414547 +y: -22.8746916633099, -98.0151399970055, -19.1907866857946, -59.1198869049549, -82.8722677659243, 78.9457001723349, 63.5891283862293, 91.796372551471, -77.384944120422, 77.7682485058904, 49.4990679901093, -59.758533583954, 34.0949323493987 +z: 31.6309703979641, 11.225744150579, -23.2299293857068, -64.9821206461638, 44.5281345862895, 29.6854661777616, 26.658301660791, -77.0363720599562, 14.9900930933654, -43.017488764599, -84.5935768913478, -86.2529832404107, 68.9730571582913 +method: k +rm: FALSE +result: -0.324337486570401 +------------------------------------------------------------ +function_name: pcor.rec +count: 16 +x: 20.6052641384304, -34.7386178560555, 64.5274777896702, 48.2837058603764, 32.1162473410368, -61.5267707034945, 18.7145279254764, -96.3212412316352, -9.05703571625054, -72.3377135582268, -36.9318156503141, 48.5457048285753, 16.1100664176047, -99.9019818846136, -6.93311747163534, 42.5408709794283 +y: -68.1519189383835, -21.3783976621926, 83.5196397732943, -21.0456018336117, -65.211294637993, -4.57787401974201, -72.63866760768, 21.234114235267, -97.2475761082023, -79.9188132863492, 79.5116892550141, -38.4806913789362, 19.9322822969407, 94.5325861684978, -42.9837487637997, 22.1684457268566 +z: -39.7361300420016, 99.3054033722728, 29.9724598415196, 95.9335449617356, 81.9420096464455, 94.5490169804543, 45.2891474124044, -18.8411912880838, 21.6612101066858, -46.4374198112637, 57.1713132318109, -16.4783576037735, -28.1885820906609, 94.3112654611468, -75.3233570605516, 86.627834988758 +method: p +rm: TRUE +result: -0.197035364225789 ------------------------------------------------------------ function_name: pcor.rec count: 19 -x: -73.2341736555099, -22.6851521991193, 73.2446681708097, -15.1385780889541, 32.3975902982056, -28.8684471510351, 0.588919408619404, 11.535478848964, 25.0071287155151, 12.3059609439224, -75.7648941129446, 98.2133234385401, -97.0771756023169, 27.9895041603595, 52.5587898679078, 7.36836437135935, -56.7817625124007, 69.9889135081321, 87.2643577400595 -y: 8.29132283106446, -76.8334563821554, 91.4037824142724, -51.617310475558, 86.0677725635469, 72.0950326882303, -7.40185175091028, -95.9184793289751, -59.8128827754408, -86.7349065840244, 98.207059269771, 27.2509966976941, -87.9419495817274, 21.4868438895792, -22.3735796753317, -74.0092439111322, -9.10649765282869, 59.1995907947421, 53.423271374777 +x: 68.7338494230062, -90.181301580742, 10.1553022861481, 88.3507196325809, -85.4962442070246, 26.208075415343, -51.701020821929, -30.7254826184362, 10.9224076382816, 96.7410780023783, -39.8431303910911, 65.5343361198902, 41.4392391685396, -88.4308515582234, -52.8691418003291, 66.4409405551851, -55.0576376728714, -38.1625887006521, -48.4449471812695 +y: -86.0378950368613, 46.4772601611912, 68.4132843278348, -11.8289707694203, -30.7506918441504, 36.8791323155165, 91.6302738245577, -46.0631328169256, 10.5568787548691, 60.4254566133022, -35.1412182673812, 92.5516024231911, 41.4456882048398, 10.1779696531594, 76.3081361539662, 81.4410069491714, -23.1231520418078, 11.1144263762981, -66.3827836513519 method: s +rm: TRUE +result: 0.201921490839196 +input.z.1: 66.5893373545259, -94.5090161636472, -32.1443051565439, -26.2381840497255, -67.3655487131327, -45.237745763734, 15.975698409602, 56.1301979236305, -72.355697536841, -1.03531731292605, 51.5078302007169, -34.9794320762157, 7.16000627726316, -69.1763840615749, -29.5579122379422, 77.2579966578633, -2.20924792811275, 22.5620280019939, -25.0138834584504 +input.z.2: 18.2577608153224, -72.2484740428627, 4.15805950760841, 33.5841840598732, -38.4825916495174, -59.1983853839338, -23.3986431267112, -93.8368917442858, -65.0328462012112, 77.1746356505901, 8.98702275007963, -45.9206078201532, -11.1201015301049, -6.38252813369036, -16.0341050941497, 38.0308180116117, 45.4919638112187, -53.2359473407269, 42.4233398400247 +input.z.3: -80.4229929577559, 72.5026939529926, -64.9018800351769, 19.9812149628997, -86.3108912948519, -53.0842928215861, 66.3097468670458, -54.4293747283518, 84.6861940808594, 52.5425457395613, -58.5939683020115, 56.8557804916054, 44.3008310161531, 38.0050702951849, 60.04942744039, 3.64885800518095, -1.5428779181093, -5.60614042915404, -2.5199462659657 +------------------------------------------------------------ +function_name: pcor.rec +count: 18 +x: -79.1204867418855, -95.156848942861, -58.1009825225919, 1.4517383184284, 5.50476736389101, -62.5133258290589, 38.2517375983298, 96.7142606619745, 47.5910087116063, -65.3327509295195, 76.1547356843948, -0.804628105834126, 75.1669812947512, -96.6471124906093, 59.5920866820961, -17.1567432116717, 84.0993498452008, 77.0434119738638 +y: -7.90872192010283, 69.3680602591485, -10.8002967666835, 72.9388284031302, -59.5035542268306, 32.4369426351041, 27.8420885559171, -8.3828354254365, -34.5960255712271, 94.1054672468454, 90.5859648250043, 54.2748330626637, 77.9608488548547, 26.6538372728974, -84.3118285760283, -61.4382669329643, -36.6503063589334, -97.6180238183588 +z: -41.9485231861472, 16.5158891119063, 94.3834115285426, -48.5038497019559, -72.4178664851934, -12.9061355721205, -45.3039852436632, -22.6247455924749, -81.2429226003587, 21.1907632183284, 60.5692085344344, 45.7070804666728, 49.69632467255, -67.7394894417375, 7.82280783168972, -73.2445613015443, -38.9073747675866, -44.2419451661408 +method: k +rm: TRUE +result: -0.226172401437073 +------------------------------------------------------------ +function_name: pcor.rec +count: 10 +x: -18.5641910415143, -20.0593877583742, 25.6991996429861, -19.6434530429542, -49.3258328642696, 74.0071775857359, -14.2312118317932, -98.484157724306, 26.4571780338883, 24.9734192620963 +y: 63.7182058766484, -21.0957065224648, -13.5498566087335, 80.4991848766804, -59.0782665647566, 48.8544872496277, 21.7224644031376, 65.6007543206215, -89.8360439110547, 30.1321961451322 +method: p rm: FALSE -result: 0.814251360213814 -input.z.1: -86.7573534138501, -78.3108811359853, -90.7141804695129, 20.8892675116658, -91.2731793243438, 12.4221083242446, -48.4068923164159, 73.3695236034691, 50.0449348706752, -35.9727113973349, 26.3153513427824, -82.5342622119933, -96.8505010008812, -34.9071862176061, 27.9058467131108, 42.9564985912293, -45.2088835183531, 62.9711722023785, 74.5247499551624 -input.z.2: -79.6970147173852, 67.8865933325142, -92.2662578523159, 25.5234225187451, 50.5748279858381, 86.7062113247812, 75.1391254365444, -43.7841295730323, 66.8446023017168, 55.0580637063831, -65.2654378209263, 23.6318178009242, 93.2108672801405, -68.0372172966599, 79.0532948914915, -94.364460837096, -16.6068505961448, -61.8612750899047, 96.0427426267415 -input.z.3: 40.9217507578433, 83.3804386667907, -62.5007103662938, -7.85297965630889, -76.5989664942026, -22.2986672539264, -45.4036694485694, -21.4061794336885, 69.5465714670718, -25.5713499616832, 36.4734465721995, 36.9375838432461, 32.6723072677851, 70.6644219346344, 49.876768887043, -74.5363045018166, -33.0244093667716, 10.4065840598196, -1.73172312788665 -input.z.4: -10.7907691039145, -17.38386224024, 43.5880040284246, 16.086917091161, -16.9488569255918, -14.011207735166, 45.4824588261545, 60.7187359593809, -5.2096379455179, 85.9155170619488, 72.9566072579473, -9.66432858258486, -6.13841973245144, -79.1190144140273, 91.5309552568942, 98.9748722407967, -50.1585202291608, 91.2043817806989, 66.6650855448097 -input.z.5: -96.3273600675166, -69.5332479197532, -82.4410750996321, -97.9709683917463, 39.1531039960682, -43.9597781281918, -59.7700778860599, 43.593360343948, 20.8425134420395, 80.6880735326558, -29.0332242380828, 69.8170928284526, -87.8374603576958, 58.8284231256694, 16.4075888693333, 25.2064376138151, -14.7603216115385, -76.6239028889686, -6.44092066213489 -input.z.6: 9.45433415472507, -15.5354761518538, -12.1865042485297, -37.5650288071483, -64.8326196707785, -85.5531277600676, 71.388221764937, 69.2387981340289, -35.1823683828115, -53.9007833693177, -58.2558114547282, 99.7826437931508, -65.5693722888827, 17.514361301437, -5.62593601644039, -67.5470025744289, 34.4595825299621, -7.97500484623015, -8.5614780895412 -input.z.7: -7.37124560400844, -63.2605917751789, -42.9963525850326, 93.0190080311149, -44.6478553116322, -17.311972938478, -4.46714116260409, -27.6207268238068, -45.3168144449592, 53.9484368637204, 68.1760023348033, -75.7576355710626, -17.4947005696595, -63.5428718291223, -88.4344877209514, -80.6289754342288, -73.8872450776398, 0.910355197265744, 52.926555974409 -input.z.8: 19.0888123121113, 40.6167997512966, -46.38990778476, -70.8545834757388, -36.2336438614875, -40.9333631396294, -56.2934595625848, 73.1570843607187, -60.2570091374218, -5.13700363226235, -34.0326094534248, 23.2543344609439, 20.66769907251, 53.0113300774246, -72.2416108474135, -4.46344027295709, 21.0111503489316, -35.0955804809928, 91.8279080186039 -input.z.9: 28.0409298837185, 56.3033602200449, 59.1395729221404, -34.2144967522472, 94.9237512424588, 45.0175272766501, -53.4253435675055, -4.01845825836062, -57.4233544059098, -68.6469163745642, 71.3221471291035, -24.5776301715523, -38.2390833459795, 41.3620623759925, -71.5135616715997, -88.0712532903999, 70.1913930010051, -28.7702376022935, -63.8502344489098 -input.z.10: -21.9328049104661, 17.6567534916103, 14.6377096418291, 84.4626953359693, 22.6560408715159, -17.2372563742101, -22.671253234148, 86.8056834675372, -39.7697510197759, -62.9925069399178, 30.6044021155685, 82.5929053127766, 25.9118379559368, -49.5282203890383, 82.6023631729186, 80.466779274866, 66.4673592895269, 75.8482501842082, 27.1312859840691 -input.z.11: 31.2323299236596, 79.6605288051069, 91.6790826246142, 55.398157518357, 3.95502164028585, -37.2159007005394, -8.49848613142967, 48.5803676769137, -23.2938712928444, -26.5643768478185, -79.5425849035382, -7.04444167204201, -23.03784978576, -99.916556943208, 32.1567460894585, -45.6349844578654, -47.5025039631873, -21.7059692367911, -4.12281164899468 -input.z.12: 66.0603046417236, 82.6507363468409, 7.85638866946101, -94.7555633727461, 88.32175033167, -78.9715636055917, 89.9744458962232, 84.1503497678787, 48.0024141259491, 49.9335964210331, 41.1366487853229, 28.8708603475243, 97.2897793632001, -2.92221619747579, 43.6754964292049, -80.5523125454783, -6.66788783855736, -39.199779368937, 5.29502532444894 -input.z.13: 92.9124710150063, -66.4420946501195, 97.3967826925218, -5.97171736881137, 96.4472725521773, 85.0369708612561, -76.7937204800546, 30.6782084517181, -36.8599112611264, 33.9056268334389, 44.4440166000277, -4.0401806589216, -61.0703659243882, 75.8796263951808, -38.2074842229486, -46.0064077749848, -13.9765918254852, -8.38187239132822, -74.8116604983807 -input.z.14: -85.5263015255332, -5.4057159461081, -19.4283518008888, 86.0516140703112, -36.5200987551361, 30.0780310761184, -29.0378153789788, -78.5522460471839, 97.8414277546108, -5.13621103018522, 93.8663412816823, 2.06638658419251, 43.4202517382801, -91.4164004381746, 71.6018950566649, 28.6870362237096, -35.0583405699581, -93.1831272318959, 58.4984787739813 -input.z.15: -94.9607445392758, -82.2086645755917, -16.0494496114552, 27.903659036383, -7.8359093517065, -55.5805193260312, 41.416268190369, 50.9919991251081, -94.1964072175324, -7.3187300004065, -83.2794434390962, -49.7139678802341, 74.39328096807, -55.0389611162245, 97.8410188574344, 20.435424009338, 19.3925447762012, 89.979507541284, 25.4206706769764 +result: -0.208651612863199 +input.z.1: -54.182271566242, -81.6743851173669, -47.1539053600281, 92.6043943036348, -78.3327240496874, 26.2651245109737, -93.9263246953487, -87.8016094211489, -16.633188771084, -78.5125374794006 +input.z.2: 18.6473812907934, -54.5641149859875, -94.9858000036329, -80.5813108570874, 67.0117434114218, -18.388499552384, -90.0589608587325, 79.7222523484379, -29.4443475548178, -2.07264893688262 +input.z.3: -32.8892857767642, 57.8148124739528, -57.9109583515674, 77.5278323795646, -67.0391498599201, -8.65513472817838, 81.3078344333917, 28.577094245702, 39.4989902153611, 74.875748809427 ------------------------------------------------------------ function_name: pcor.rec count: 15 -x: 19.1210152581334, -90.7481685746461, 94.6057046763599, -61.290800338611, -37.1947812382132, 54.4369328767061, 55.7387878187001, 17.9015715140849, 31.0679465532303, 63.1330410018563, 52.1574283950031, 65.4397922568023, 91.4413943421096, 99.5237410068512, -74.9028561171144 -y: -81.3996239565313, -13.6488320305943, -5.80292693339288, -67.2151657752693, -36.4809868391603, 99.4002115912735, 1.03691508993506, 43.7332965899259, 0.0288900453597307, 85.2870703209192, -66.8704317882657, -25.5248280707747, -81.3251432962716, -23.7031722441316, -93.2608364615589 -z: 12.8577758558095, -22.8082065470517, -48.3178524300456, -83.7297586258501, 42.5842776428908, 32.5472959317267, 55.6511440314353, 3.36264544166625, 12.7249016426504, 9.32536264881492, -36.669804668054, 46.4725097641349, 0.145619735121727, -43.9962794072926, -13.7548735830933 +x: -11.7029183078557, 20.6746962387115, -6.4186317846179, -65.7957127317786, -53.4551188349724, -95.6971417646855, 8.08795387856662, -82.9692668747157, 65.0797595269978, -40.0556065142155, 22.845498425886, 1.03095825761557, -14.8108241148293, -78.0993150081486, 30.944905616343 +y: 82.0563825778663, -93.5029713902622, -33.4759468212724, 34.7522557713091, -40.9242569468915, 12.8855560906231, 87.9595287609845, -29.6215635724366, 86.1932807136327, 14.4459169823676, -32.873512012884, -95.2299362048507, -49.8739655595273, 36.8796242401004, -65.0861688889563 method: p rm: FALSE -result: 0.252991642308749 +result: -0.104743080690118 +input.z.1: 65.66839707084, 92.6697647199035, 38.6834030039608, -1.27137661911547, -28.2877578865737, -84.7902995534241, 27.4061929434538, -27.7048649732023, -63.9012438245118, 28.058318933472, -20.2759954612702, 22.2938399296254, 77.1114971488714, 70.4757141880691, -76.6643046401441 +input.z.2: -39.5549254957587, -19.5246502757072, 18.0171636864543, -57.7165036462247, 95.6821781117469, 33.9750271290541, 71.6323775239289, -66.8427237775177, 10.4952494148165, -29.4743011239916, 71.6373374685645, 40.0875151157379, -42.4196716863662, -1.66454841382802, -60.522589366883 +input.z.3: 98.3820408582687, 25.1781207975, -82.4520411435515, -78.9945350494236, -60.6463038828224, 38.1571523845196, -2.5337272323668, 51.339119952172, 28.5604369360954, -55.1758613903075, -4.05583186075091, -33.9473246596754, 25.7808249443769, -45.2997167594731, -18.1844201404601 +------------------------------------------------------------ +function_name: pcor.rec +count: 18 +x: -19.9252225458622, -52.1368729881942, 47.0799256581813, 4.0996206458658, -47.799872700125, -30.0670292694122, 99.486964661628, -60.6471673119813, 87.9351426847279, -87.2190349269658, -14.3205997534096, -65.2433201204985, -91.2750414572656, 57.8982046339661, -58.4296739194542, 75.9663732722402, -39.1042973380536, 81.5513394307345 +y: -90.2006414718926, -16.2967856507748, -79.3194455094635, 84.4338634051383, 89.2368617933244, -12.7161718904972, 75.4535779356956, 37.1095749549568, 49.1659552324563, -26.1069383472204, 45.5694596283138, 38.4463460184634, 33.344994019717, -1.42435110174119, 47.1649888902903, -99.7756907250732, 46.394665306434, 15.2081664185971 +method: s +rm: TRUE +result: -0.181282481020533 +input.z.1: -50.1517540775239, -67.6142763812095, 48.4815247356892, 8.75700111500919, 31.7483810242265, -90.2583417017013, -67.3944258131087, 9.49530829675496, 90.4742771759629, -84.6624474041164, 91.2189200520515, 97.8029098827392, 68.2472475804389, 37.4118328094482, -83.8537451345474, 69.1915712784976, 19.8050633072853, 33.8238943368196 +input.z.2: 55.8937823399901, -13.7481592129916, -2.85266265273094, -92.6436629146338, -8.95788944326341, 35.6726922094822, -52.2164586465806, 41.2114669103175, -82.6304302550852, 99.3652961216867, 2.97346808947623, -24.6266740374267, 55.9584220405668, 27.8859186451882, -78.0235532671213, 92.6008366048336, -46.0081057623029, 46.4334186166525 +input.z.3: 75.9668093174696, 48.5109059140086, -24.6230148244649, 47.1537347882986, -52.6724417228252, -0.0623919069766998, 60.068893712014, -47.2048899624497, -31.3584079500288, -30.8376907836646, 72.9500978253782, -4.89845988340676, 8.7826278526336, 55.5695308372378, 89.7840007673949, -20.1651885174215, 54.3830844108015, 82.4272679630667 ------------------------------------------------------------ function_name: pcor.rec count: 16 -x: -2.87382756359875, -30.5810853838921, -85.2656959090382, -57.8431877773255, 41.8040546122938, -4.51440489850938, -77.4139664601535, -78.0852025840431, 76.9753176253289, -39.8538885638118, 61.5029000211507, 25.2118390519172, -91.6211612056941, -13.2199198473245, -29.4821108691394, -16.201650025323 -y: 28.135217865929, -35.8999697491527, 65.1573278941214, 77.1730968728662, -62.5566221773624, 72.1754947211593, 65.3400977142155, 56.2912649475038, -4.19798144139349, 42.1437229495496, 40.1672286447138, 32.6568186283112, -14.3435334321111, -90.3321508318186, 86.114533431828, 12.6757733058184 +x: -89.2206337768584, -93.6034481041133, -92.6505226641893, -27.2543139755726, -68.1821953039616, -21.7996491119266, 71.5557252522558, 43.2489835191518, -90.4781390912831, 7.11716823279858, -82.050916319713, -26.397502142936, 55.4946079850197, 64.7005498874933, -25.9218308143318, -16.6726984549314 +y: -35.1899597793818, -21.6532570309937, 18.4573667123914, 62.4437351245433, -68.842231342569, -73.8841473590583, -11.0737474635243, -20.1630857773125, -50.4398448392749, 35.7471308205277, -27.5834964122623, -26.5524230897427, 56.0133414808661, -27.9868010431528, -10.7581190299243, -61.9544327724725 +method: k +rm: TRUE +result: 0.1802927896232 +input.z.1: -40.1324992999434, 9.90798645652831, -6.51583895087242, -81.11083349213, 84.9643123336136, -87.4527308158576, -60.1582251954824, 77.6400165166706, -42.5469139125198, -82.8197461552918, -48.6188884824514, -13.3140456862748, 88.9097800478339, -57.9036547336727, 65.818764641881, -16.4653040003031 +input.z.2: -84.256647573784, 12.2872774954885, -66.00108044222, 56.7613907624036, 48.1513442005962, 77.6724391616881, -62.4357144348323, -36.4606843795627, -25.3354148473591, -14.6164451725781, -82.1608787402511, 63.0101605318487, -43.4699194505811, 62.6883119344711, 60.930627817288, -4.78333029896021 +input.z.3: 74.4455846492201, 21.936039859429, 57.6761968899518, 89.8042913526297, 63.5838260874152, 38.8069860637188, -54.178605042398, -76.1459093540907, -22.7403795812279, 68.8472212292254, 84.6168057061732, 11.0940378624946, 85.7618093956262, -15.3427021112293, 1.49911385960877, 20.5723023507744 +------------------------------------------------------------ +function_name: pcor.rec +count: 10 +x: 24.9564551748335, 18.5923957265913, -46.4656071271747, 86.6394772194326, 65.5116721056402, -98.461588146165, 53.3600708469748, -78.3477867487818, 76.5432852786034, 54.6317078173161 +y: -41.7801002506167, 0.232810061424971, 87.8145711030811, 74.0377931389958, 24.6370416134596, 77.2726675961167, 0.525932526215911, 71.0617937613279, 1.96412657387555, -1.88834308646619 +z: -79.2718555312604, -16.1210845690221, 29.8867321573198, 24.5947330724448, -84.9225256126374, 11.1365122720599, -72.2685813438147, 60.749769769609, 8.51291613653302, -13.8399054761976 +method: s +rm: FALSE +result: -0.0470490565729547 +------------------------------------------------------------ +function_name: pcor.rec +count: 16 +x: -85.2682391647249, -25.1930296886712, 36.2195362802595, 11.7865398991853, 68.5172120574862, -83.3658806513995, -75.6855964194983, -20.0753760524094, -19.762350525707, 35.1225445978343, 30.2758548408747, 1.45033104345202, -14.6772135049105, 14.2147125676274, 49.1841867566109, -35.2573278360069 +y: -20.5554758664221, -97.0802981872112, -26.0747340507805, 71.6280955821276, -85.3886511176825, -55.2334129810333, 43.0862717330456, 28.4769951831549, 78.5121974069625, -81.3196417409927, 39.5874671638012, -1.8134135287255, 85.9221469610929, -95.360365929082, 19.3586761597544, -66.9956528581679 +method: p +rm: TRUE +result: -0.0236982307617225 +input.z.1: 3.02675268612802, 29.488014569506, -90.2211040258408, 18.5702975373715, 81.4835339784622, -81.491480441764, -81.4419069793075, 49.6095394250005, 15.8508184831589, 55.1565334200859, 93.1393330916762, -18.7935738358647, -27.2714839782566, 28.1014911364764, 7.63522856868804, 86.4262473303825 +input.z.2: 15.2697853278369, 21.544589381665, -42.2709172591567, 66.4516931399703, -80.4499278310686, 7.60396728292108, -66.5740209631622, 42.6155330613256, -25.6430941168219, 98.4072601888329, 50.5805794615299, -68.1811819784343, 73.6316103953868, 79.5231841970235, 76.5872830990702, 44.7566782590002 +input.z.3: 6.84692151844501, -56.8186898250133, -52.9168414417654, 38.5583185125142, -1.00095826201141, -6.59536058083177, 55.0686245784163, -76.6531312838197, 56.9502690341324, 5.48669574782252, 98.175480728969, -63.4856688790023, 85.1667809765786, -59.0522172860801, 79.1193772573024, 9.27014825865626 +------------------------------------------------------------ +function_name: pcor.rec +count: 15 +x: -91.3233927916735, -15.5439792200923, 43.0199227761477, 39.7756622638553, -9.58535838872194, -32.0357569493353, -48.6907037906349, 4.63044187054038, -2.5522580370307, 73.4696492087096, 58.3276907913387, 43.7473264522851, -2.46611316688359, -30.3629717323929, -17.4933492671698 +y: -5.91190569102764, -82.0860084611923, -99.643186153844, 16.0177246667445, 19.4741931278259, -7.10836984217167, 47.0438427757472, -83.1305775791407, 78.383247833699, 79.6709012705833, 86.369459098205, 70.2751192264259, -15.8207864966244, -29.9358425661922, 60.3160366881639 +z: 26.2397599872202, -59.9476198200136, 95.269483095035, -0.995413586497307, -45.5644907429814, 24.1255348082632, 54.9571478739381, 6.70850914902985, 83.7543970439583, -42.7414426580071, -30.6731200776994, 86.6206298582256, -21.0456729866564, 20.3609951306134, -51.160212373361 method: k rm: FALSE -result: -0.253803690496807 -input.z.1: -4.89483792334795, 73.1407755985856, 98.5393163748085, 73.0779736768454, -28.1159524340183, 54.082156997174, 86.8587783072144, -79.4726002961397, -73.4560188837349, 27.0900287199765, -86.8956328835338, 96.6792982537299, 35.2100874297321, -60.1671026088297, -72.4173011258245, 4.11061025224626 -input.z.2: -34.0709479991347, 76.5315871220082, 43.3915213681757, 43.4308610390872, 76.321689831093, 46.0346157196909, -0.73040034621954, -41.1897071637213, 47.0153306610882, 30.9888483956456, 80.7444188278168, -52.3551567457616, -14.2577795311809, -72.9259013198316, 75.1937944442034, 88.6314859613776 -input.z.3: 30.184931633994, 25.1940117683262, 43.8190793152899, 44.0422522835433, -87.6267918385565, -33.915796270594, 78.6654303781688, -24.5026275049895, -8.16088672727346, 70.0028923340142, 41.1979887168854, 82.3699820786715, 6.11956720240414, 80.0185721367598, -91.9803010765463, -24.4723544921726 -input.z.4: 5.89864449575543, 83.7068512570113, 15.6911447178572, -2.80351233668625, -65.6391194555908, 14.5310245454311, 68.1848946027458, -16.2310080137104, 83.4109206683934, 99.3864068761468, 78.5966154187918, 92.34071765095, -6.43716314807534, -2.70818201825023, 1.35397682897747, 79.0387979708612 -input.z.5: -19.5283096283674, 33.9582368265837, -74.1643586196005, -33.1158923916519, -78.7567632738501, -95.0876677874476, -33.7155544664711, -76.497556315735, -45.8616196643561, 41.3556576240808, 28.7840550299734, -33.4265344310552, 61.1726825591177, 59.0956036001444, -79.8228676896542, -57.7531451825052 -input.z.6: 53.0482107773423, -14.0646053478122, 52.7205745689571, 41.7561090085655, 92.3762793187052, 76.5466017182916, -69.4168658461422, 23.8598483614624, 19.6098514366895, 73.5599991399795, 87.6351232174784, -6.20425450615585, 32.7709008008242, -1.08212679624557, 6.18844078853726, -63.7467356864363 -input.z.7: -48.3841958455741, -50.1150219701231, -15.5646015889943, -79.2570824734867, -19.6070665959269, -49.5304220821708, 53.2172558829188, 25.2054167445749, 18.3721250854433, -68.8817646354437, 18.6557998415083, 57.3686588555574, 28.6675109528005, -43.0730409454554, -4.50756121426821, -70.1776389963925 -input.z.8: -10.7248624786735, 76.593514252454, 28.891241364181, -0.018490431830287, -28.4583521541208, -33.1800576299429, -1.8756405916065, -75.8051007986069, 49.2299810517579, -1.69429946690798, -25.1867124810815, 69.2886833101511, -99.62286981754, 89.9874444585294, 30.4199578706175, -97.7524971589446 +result: 0.160422236979937 ------------------------------------------------------------ function_name: pcor.rec count: 12 -x: 15.6129707582295, -54.5765130314976, -62.1533300727606, -83.7492469232529, -75.3303173929453, -2.68199793063104, 60.322671988979, -22.6404232904315, 90.9686226863414, 75.999130262062, -84.101656684652, 97.3987545352429 -y: -40.038321306929, -38.4067192208022, -54.87005636096, -32.2858245577663, 86.0376148484647, -90.7305406406522, -19.5302437990904, 43.8807010184973, -33.8322110939771, 12.6573502551764, 17.2774605453014, -27.0399304572493 -z: 54.1844798717648, 76.2015995569527, -19.2299467977136, -96.2915348820388, -98.1550739146769, 4.9422649666667, 2.88800583221018, -21.8325999099761, -20.0546327978373, 50.5448115523905, -42.4167810473591, 44.39243148081 +x: -54.2834484484047, -99.5062152389437, 11.2263063900173, 4.25140345469117, -6.57475399784744, -47.9635813273489, 13.5771594475955, -17.8992413450032, 44.7320376522839, 10.5947217904031, -95.9636783692986, 78.552111517638 +y: 25.7135692518204, 65.7770814839751, -47.1805317793041, 86.2048698589206, 84.3483364675194, 52.1802646573633, 38.1061236839741, -24.7705412562937, 70.3330162912607, 70.1622222550213, -19.1713237203658, 66.428263951093 method: p +rm: TRUE +result: 0.329071793149575 +input.z.1: -41.6167279239744, 30.5627764668316, -46.9200180843472, 70.171003555879, 14.7832777816802, 66.5134385228157, 90.0630659423769, 50.129773048684, 99.1226064972579, 20.8656733389944, 93.0510560981929, -58.9669019449502 +input.z.2: -28.3709186594933, 67.1317570377141, -65.2744254097342, 84.8623389843851, 43.1941722985357, -2.67433333210647, 73.5897833947092, 45.3403359744698, -82.2376867290586, -16.9432976283133, 51.7834584228694, 73.2923530042171 +input.z.3: 88.4447504300624, 29.8185252584517, 70.2338655479252, 96.2983122095466, -7.37721398472786, -47.8313674218953, 50.365524366498, 45.9664605092257, -55.9734042268246, 21.4261449407786, 40.0185635779053, 55.8912822511047 +------------------------------------------------------------ +function_name: pcor.rec +count: 16 +x: -57.1398223750293, -23.3540481887758, -22.2071134019643, 96.7134712729603, -57.6335528399795, -49.1604723967612, -78.7016066256911, -84.9242495838553, 65.3399391565472, -31.4437021967024, -9.51485671103001, 70.0565829873085, -71.0057987365872, 91.0863234195858, 72.5100541952997, 58.0725823994726 +y: 18.8888671807945, -22.8483431972563, 24.8971822671592, 4.40226024948061, -48.3475063927472, 50.9493664372712, 92.7150129340589, 63.0087484139949, 43.2604452129453, -33.4913415834308, -35.9951756428927, -87.5060506630689, 15.4649335425347, 88.3686876855791, -25.8083974011242, 0.085412198677659 +z: 81.5011800732464, -99.7660262044519, -93.3500723913312, -79.0094709955156, -71.6781900729984, 1.03125544264913, 11.5347918123007, 86.6896205116063, 34.3875902239233, 7.78482472524047, 85.7462510932237, -45.7913243677467, 22.8047444485128, 4.74429242312908, -16.1633410025388, -13.6797955725342 +method: k rm: FALSE -result: 0.0258928698851513 +result: -0.0899565056297501 +------------------------------------------------------------ +function_name: pcor.rec +count: 15 +x: -75.1803813036531, 32.6554085128009, 46.5199385304004, 10.0931627675891, -84.9136417731643, 99.0708300843835, 43.4466718696058, -27.9581206385046, 52.7613752521574, 0.147021608427167, 11.5825299639255, -29.0862209163606, 85.5328780598938, -23.4052004758269, 13.3759755641222 +y: 28.4078094642609, -40.5093076638877, -3.29849710687995, -45.7378671970218, 4.03570998460054, 0.237223505973816, 23.7162163015455, 49.5277442503721, -6.30603078752756, -22.8287412319332, 94.9057441670448, -63.0924633704126, -42.9297237191349, -78.4588639158756, -39.1431424301118 +z: 49.7008972335607, -69.9944775551558, 34.2155236750841, -53.7857625633478, 40.5958297196776, 52.6141790673137, -80.8522994164377, -3.425587201491, -66.6255864314735, 47.9161818511784, -5.30791841447353, -65.1415256317705, -46.0642572958022, 43.2463189586997, 92.9539552424103 +method: s +rm: FALSE +result: -0.0445130955220816 +------------------------------------------------------------ +function_name: pcor.rec +count: 16 +x: -51.6405268572271, -71.7918659094721, -73.2296792324632, -31.7894198000431, -20.4344088677317, 6.17863591760397, 67.1885369811207, 26.0930087417364, 77.9443024657667, -59.804061613977, 66.2859657779336, -92.9702171590179, -48.0025853030384, 75.9013353381306, -0.952996592968702, -45.6366574391723 +y: -66.1892560776323, 40.1626775972545, -78.6765556782484, 3.59122948721051, 54.1154608596116, -33.2301977556199, -51.3999274931848, -36.8912567384541, -16.5293656755239, -39.3365318421274, 7.12325950153172, -8.90163774602115, -26.7156166490167, -38.0113017745316, 96.5745037887245, -93.0887303315103 +method: s +rm: TRUE +result: 0.00646891417813344 +input.z.1: -71.3289998471737, -89.4274845253676, 80.2009513135999, -96.6635977383703, 1.58105902373791, 44.5951706264168, -22.3852779716253, 97.8820891585201, -66.1968573462218, -6.31989082321525, 23.1592249590904, -83.3515228237957, 57.0112504996359, 31.7412199452519, 68.0809809826314, -37.4492235481739 +input.z.2: -67.5689687952399, 79.3258271180093, 97.4323255009949, -68.1801676284522, 58.8779048528522, -95.3483588527888, -66.6574165225029, -66.7481596115977, -43.544950382784, 13.8981956988573, -96.2374809663743, 30.4743104148656, -20.3307262156159, 58.3140489179641, 83.9318192563951, 18.8910231459886 +input.z.3: 61.8831608444452, -13.0282598547637, -9.60066677071154, 64.577030390501, -36.6879174951464, -47.287135059014, -49.6693975757807, -20.8232561592013, -56.3352135941386, 77.1996547002345, -68.4678519610316, -52.4340079631656, -43.0555366910994, -27.0189959555864, -47.0933285541832, 11.8024677969515 +------------------------------------------------------------ +function_name: pcor.rec +count: 16 +x: 6.02917508222163, 27.8621552977711, 92.6266786642373, -67.0329743530601, 80.2830060012639, -55.2314624190331, -57.516923872754, -20.3406107611954, -88.6821561027318, -74.7315115761012, 22.0172420144081, -99.7548290062696, 63.5964724700898, -92.0153565239161, 10.2219923399389, 19.8053610976785 +y: 31.9939563982189, -15.3352430090308, -48.4936602413654, 18.2333611883223, -33.8946952484548, 41.1579161882401, -8.68082982487977, 31.8826792296022, -32.7911721542478, -56.1658204998821, -55.476590571925, -76.0229810606688, -28.4876780118793, 46.7708960175514, 26.4549767132849, 21.7337732668966 +z: -61.3926334772259, -8.43798192217946, 49.4600793812424, 12.1881818864495, 4.04470223002136, -0.887329550459981, -14.2089146189392, -69.8127029463649, -23.6053369939327, 37.6661356538534, 28.68687286973, -40.214622952044, -28.2490330282599, -30.1233724225312, 16.7358654085547, -60.9078065026551 +method: s +rm: TRUE +result: 0.0109861740383809 +------------------------------------------------------------ +function_name: pcor.rec +count: 19 +x: -22.6301351562142, -0.401159888133407, -51.0836260858923, 52.9926339164376, -31.112408824265, 7.74280959740281, 57.6454367488623, -58.9728377293795, -55.3409872576594, 93.505600746721, -39.4296121783555, 98.1291733682156, 95.6328963395208, -47.2205543890595, -91.3154749665409, -46.4315792080015, -55.1306743174791, -83.6544279474765, 25.9763963054866 +y: 10.233701299876, -34.3406205065548, -44.1589217633009, 18.0708408355713, -33.9899700134993, -92.1382100787014, -31.3480507116765, 34.7450574394315, -26.1664397548884, -10.6908304151148, -56.8871490191668, 42.0222526416183, -38.5681716259569, -50.3884779289365, 62.0742606930435, 18.8085388857871, -98.4062366187572, -42.258721170947, -78.7414902821183 +method: s +rm: TRUE +result: 0.260997031943953 +input.z.1: 93.6964779626578, 97.6941250264645, 84.2403077054769, -21.0036048665643, 30.8375779073685, -66.1338172387332, 5.2408910356462, 61.1676721367985, 60.5456584133208, 0.74210693128407, -37.1678366325796, 29.5855506323278, 27.7806338854134, -5.75614403933287, 67.2522669658065, 76.9101575016975, -26.9960866309702, 77.3400701582432, 27.4017762858421 +input.z.2: 59.9046770483255, 75.6403599400073, 95.9070024080575, -53.2769947312772, 50.6330458912998, 23.7067949026823, 35.1966741029173, 89.4811980891973, 35.9289538580924, 20.3873679041862, 34.1469102073461, 94.6420239284635, 53.1159293837845, -12.1292291209102, 15.0359552353621, 9.68966633081436, 78.1882911454886, 66.8827974237502, 2.47473819181323 +input.z.3: 19.4207503460348, 51.5944085083902, 66.9528753962368, -48.429446760565, -93.2403178419918, -87.8670411650091, -56.8921292200685, -65.7475048676133, 19.9255768209696, 4.57514231093228, -10.249630920589, 69.709189189598, -64.6382919047028, 17.4305737949908, -67.6548017188907, -12.9575524479151, 61.2475155852735, -36.1469886265695, 87.6915104687214 ------------------------------------------------------------ function_name: pcor.rec count: 17 -x: -96.0152605548501, -2.73632658645511, 20.4153073020279, 27.1719563752413, 8.59699491411448, -14.5893115084618, -33.9465518947691, 39.2609817907214, -99.0190614480525, 62.5098573975265, 35.9342403709888, -30.6088973302394, 44.7166417259723, -93.9578357152641, 32.6512531843036, -70.8288522902876, 73.4201280400157 -y: -46.9669208861887, -36.2372543197125, 4.4616396073252, 38.7583258096129, 44.8999984189868, -31.204593880102, 35.038438020274, 95.6365440040827, -45.6151684280485, -56.2252663075924, -21.9110350590199, -38.5250215418637, 10.3221551980823, 1.9145913887769, -47.8505118750036, -54.9174412619323, 23.1537543702871 +x: 9.37572391703725, 31.7226287443191, 43.1954346597195, -60.2317395154387, 57.4296472128481, 33.2106852438301, 30.182341625914, 16.8947563041002, 8.45923842862248, 39.1486890614033, -21.3120787870139, 5.00677810050547, 42.3083784524351, 52.4043606128544, 78.8675017654896, 34.8648357205093, 95.3381980303675 +y: 73.7328485585749, -65.1126708835363, -50.9216074366122, -12.8152929246426, -98.8350537605584, -20.3600559849292, 98.9452924579382, 3.61747466959059, 35.8806551899761, 65.8439641352743, -16.7892712634057, 93.2440320961177, -63.617469696328, -95.0687137432396, 37.9251030739397, -75.4912422038615, -6.28811488859355 +method: s +rm: TRUE +result: -0.391668812877604 +input.z.1: 84.7690727096051, 35.6805397663265, 2.92688133195043, -2.66396179795265, 59.4639756251127, 63.7523754499853, 18.2699968107045, -82.0927425753325, 15.0487997569144, -88.0888516549021, -27.5004559662193, -25.4689407534897, -42.007040977478, 93.5237852390856, 47.0437038689852, 61.5355266258121, 54.8702186439186 +input.z.2: -87.6829659100622, 47.0985118299723, 12.1185038704425, -46.7640890274197, -69.5790245663375, 5.30735715292394, -4.46678730659187, 93.2893170509487, 50.3495833836496, -34.9353915080428, 18.0263666901737, 58.3935454953462, 87.4742162879556, 30.3390501532704, -73.5950434580445, -74.5545803103596, 38.0712570156902 +input.z.3: -61.2569669261575, -96.3447272777557, -29.3482882902026, -19.3482856731862, 13.6697378009558, 40.6999397091568, 41.9870645273477, 62.1129790320992, 30.4264964070171, 73.9961228799075, -55.8274395298213, -70.7107780966908, 39.5272477529943, 39.4379249308258, 71.6056514065713, -89.4290968310088, -71.2074970826507 +------------------------------------------------------------ +function_name: pcor.rec +count: 12 +x: 23.9549969322979, -94.3478518631309, 53.8556181825697, -63.9131240081042, -33.5065440740436, -27.5726289022714, -36.9144127704203, 9.75463544018567, 80.6153140030801, -69.4012255873531, 99.9501515645534, 16.0135179758072 +y: -41.6901842225343, 71.2601354811341, 94.5316863711923, -76.7564448993653, 67.3882042057812, 79.135302407667, 85.5548634659499, 98.4304254874587, -25.5130287259817, -22.0055079087615, -95.5722292885184, -19.1982574760914 +z: 31.5045582596213, -61.6609159391373, -53.6041364073753, -54.1261918842793, 55.5201834533364, -70.761605957523, -37.8632005769759, -5.51536502316594, 22.109322855249, -5.48479808494449, 62.8399562090635, 66.7187201790512 +method: k +rm: TRUE +result: -0.046547725411756 +------------------------------------------------------------ +function_name: pcor.rec +count: 19 +x: -86.8803692981601, -36.0070365015417, -70.1002893038094, -86.1806470900774, 66.3614605087787, -94.7579635307193, -49.5362688787282, 39.0053760726005, 28.0300771817565, 65.3048079926521, -78.614980308339, -99.5677480939776, 37.4129545409232, 57.5423365924507, -25.4214689135551, -67.64843207784, -25.7995640393347, -59.050830733031, -49.872957682237 +y: -97.1362472046167, -90.4611896723509, 67.4148492049426, 38.2251622155309, 71.9721779692918, -18.9910460263491, 69.1500102169812, 51.959238294512, -38.5041401255876, -68.6116041615605, 24.4872363749892, -88.0486444570124, 59.0363015886396, 24.4759861845523, -39.4574940670282, 46.4638626202941, 69.4575124420226, 83.6080874316394, -21.5877468697727 +method: p +rm: TRUE +result: 0.222856530894645 +input.z.1: 60.3581060189754, 36.6046156268567, -80.6256499607116, 67.3364251852036, 20.8286061882973, 90.5355037655681, 34.4946308527142, 72.2939557861537, 24.818326253444, -73.8570734858513, 60.6789906043559, -78.2595306634903, 31.5215276554227, 88.7460107449442, 47.5978660862893, 37.7674763090909, 14.174500759691, 23.2667552307248, -44.4074565544724 +input.z.2: -71.1571972351521, 67.5592693034559, 32.7134820166975, 50.4700905177742, -5.32517521642148, -9.73571254871786, 62.8018686547875, -33.77331267111, 82.4934613425285, -82.5158701743931, 23.7224648240954, -12.2990741860121, -32.6325906906277, -60.1869959384203, 15.1140324771404, -47.5414104759693, 39.1125004738569, 34.8343822639436, -41.0773036535829 +input.z.3: -83.8173258583993, -41.9550708029419, 94.7827941272408, 44.7238489985466, 7.73765784688294, -76.5092555899173, -70.8226544782519, -20.9283753763884, 30.5160601157695, 8.20419332012534, -23.4743303153664, 1.33969597518444, -45.6315482035279, -20.0630795676261, -55.0699974875897, 76.2154544703662, 90.7609693706036, 49.0804013330489, 24.8603868298233 +------------------------------------------------------------ +function_name: pcor.rec +count: 15 +x: -95.6984742544591, -17.0751072466373, -74.351422348991, 97.9444544762373, -78.9809799753129, -91.6577459778637, 47.7074146270752, -16.9179151300341, -39.3213587347418, 65.5904557090253, 60.0742573849857, 87.3231331352144, -78.467915719375, 28.0999443493783, 89.8317760322243 +y: 38.1394040770829, -79.9139173235744, -11.8167380336672, -27.1410693414509, 0.926599558442831, -76.7347189597785, -78.9869936183095, -44.4243895355612, -84.7858403343707, -42.7895428147167, 95.1523006428033, -37.1474313084036, -20.4304214566946, -45.007686316967, 53.1755958218127 +z: 10.8393523376435, -5.54150752723217, 6.67336750775576, 94.895927561447, 28.04304221645, 8.71308073401451, -63.6728871613741, 25.6648155860603, 94.4418403320014, 65.6681419815868, 14.3071625847369, -18.7641613651067, 47.0834728330374, -34.1443062759936, 41.7607615236193 method: k rm: TRUE -result: 0.227414201271952 -input.z.1: -91.8689756188542, -18.8268605154008, 59.9834852851927, 39.8389992304146, -80.8505142573267, -18.3535169810057, -2.34811864793301, 24.1830998566002, -22.6586456876248, 68.8272529747337, -13.866110611707, 43.5314364265651, -67.6513452082872, -97.7143038064241, 32.9879198689014, -24.4230728130788, 31.1623202171177 -input.z.2: 39.7535849362612, 26.8228638451546, -5.83359580487013, 75.0341654755175, 75.1568455714732, -19.646413391456, -38.4626689366996, -52.5916866026819, 92.6454027183354, -6.59558856859803, 15.2207531500608, -59.9319984205067, 67.6257754210383, 62.5032463110983, -13.8798008672893, -74.1318658925593, 57.3057317174971 -input.z.3: -50.2737354487181, 67.5364006776363, -24.2570764385164, 48.7902171444148, 11.5434463135898, 67.6300485618412, 52.8123706579208, -10.3952446486801, -55.1109313499182, 2.81554046086967, 3.11438394710422, 24.7719271574169, 12.2765214182436, -18.9550118986517, -43.5645492281765, 76.3299115467817, 72.8231159504503 -input.z.4: 79.1319472249597, -64.6508545149118, -25.6458255462348, -67.6172162871808, -1.9231891259551, -87.36885599792, -51.9834969658405, 81.4505566377193, 90.3312657494098, -83.9177244342864, -56.4620361663401, -66.6789827868342, 87.5367146451026, 18.9934492576867, -81.9155515171587, 71.6108248569071, -58.1476961728185 -input.z.5: 96.9413920771331, 47.8810616768897, -0.438442826271057, 3.20979873649776, 20.6230421550572, 89.096216019243, -82.9677095636725, 91.9871860649437, 74.0136182866991, 38.2246119901538, -10.429418226704, 89.3207651097327, -13.5560743510723, 4.01417766697705, -34.4030613079667, 95.2031007036567, -43.0174002423882 -input.z.6: 80.8942574542016, -39.6212201565504, 14.2572369426489, -78.1328707933426, -96.1618753615767, 61.9455046951771, -42.8125618491322, 45.2630438376218, -26.2891847174615, -37.7531661652029, 71.7649383936077, -76.2287222314626, 86.0407523345202, 83.4333196282387, 11.858429107815, 90.0938509497792, 27.1023083478212 -input.z.7: -68.578722840175, -72.2220734227449, 83.0359090585262, 44.5527241565287, 19.0210536122322, 19.7943818289787, 42.1044544316828, -10.6518527492881, 85.2387520018965, -89.5295495167375, -14.2881830222905, 15.0138720404357, 73.6910053994507, 95.9490245208144, 29.4783721212298, -32.2806132957339, 98.4265907201916 -input.z.8: -63.3846850600094, -75.9456290863454, 98.109992640093, -8.30751904286444, -65.3464913833886, 57.9990320838988, -97.9716447182, 48.3666017185897, -11.2887284718454, 38.4293566923589, -4.15021106600761, -6.2844387255609, -20.7505342550576, -56.9003260694444, 96.397353708744, -90.6195733696222, -40.7526909839362 -input.z.9: 81.5076497849077, 13.3879841770977, -66.9347247574478, -4.78587108664215, 30.7318323291838, -55.0735270604491, 9.40470518544316, 66.8840528000146, -31.3702027779073, 69.8431192431599, -86.8119182996452, 37.1748886071146, -39.0971344895661, -6.33791824802756, -4.74258312024176, -37.5578073319048, 16.0260049626231 +result: 0.0567462819506484 ------------------------------------------------------------ function_name: pcor.rec count: 15 -x: 13.3217854890972, 3.74524784274399, 42.3860765993595, 70.1574267819524, -36.6772301495075, 43.096883688122, 11.656632553786, 49.6097341645509, 35.055069392547, -34.170615952462, -12.3891159426421, 95.595167670399, 27.9552156571299, 60.3556469082832, -64.5174876786768 -y: 93.0693128611892, 94.2700367886573, -59.7466928884387, 75.3644049633294, 38.714852463454, -25.7440742570907, -26.9153070170432, -39.7653248626739, -2.73380884900689, -51.2801296077669, 55.7282803580165, 9.4015384092927, -56.5411465242505, -14.9695897940546, -58.2891712896526 -z: 48.0578206945211, -49.0533413831145, -62.5287163536996, 77.8333532158285, 70.9992234129459, -80.4808055050671, 63.4501236490905, 1.48282377049327, -52.8766040224582, -60.6905648484826, 75.8240396622568, -26.8130346667022, -66.6958931367844, -14.8776702582836, 57.7621683478355 +x: 18.4970577247441, 78.3253606874496, 79.4621794950217, -44.2970278672874, 49.8550353106111, 96.2965226732194, -91.7066268622875, -10.6500246096402, 83.8136198464781, 82.6252206228673, -75.066755246371, 41.5468964725733, 23.8436101470143, -14.4322760403156, 84.5842578914016 +y: -34.6368032041937, -88.1088628899306, 63.0725324619561, -2.26956433616579, 3.40624032542109, 33.9189363643527, -34.2757223173976, -10.0570505019277, -72.027294524014, 89.8351664654911, -98.8331866916269, 73.1307323090732, -50.5687814205885, -23.6362583935261, -91.3148396648467 +z: 79.7483292408288, -81.3085496425629, -7.89254033006728, 11.9726373814046, -15.717267151922, -22.2710655536503, 70.8750586956739, -90.9301116131246, 91.3467094767839, 75.1269446220249, 36.3692390266806, 4.92376713082194, -42.952916584909, 59.6110574901104, 37.576672853902 +method: p +rm: TRUE +result: 0.268386356974156 +------------------------------------------------------------ +function_name: pcor.rec +count: 15 +x: 76.5814383048564, 57.0448996499181, -62.4477106612176, 60.2575681172311, -25.0475298147649, -15.6559887807816, -75.9389230050147, -65.7562242820859, -39.8771365173161, -8.23787515982985, 79.7387945000082, -91.5918366517872, 22.8263909928501, -71.058910060674, 84.923558216542 +y: 28.6601890809834, -36.4405090454966, -5.37604507990181, -37.0503096841276, 65.667122695595, -50.3413951955736, 34.6017302479595, 89.4681378733367, -57.4270334560424, 9.56006632186472, -49.7303061187267, 18.1288056541234, 86.5119753405452, 30.3892049472779, -58.9283072855324 +method: p +rm: FALSE +result: -0.581327155629278 +input.z.1: -30.6997185107321, 3.00485193729401, -19.0188682172447, -62.2001667506993, 58.9584777131677, -93.9231510274112, 49.4996389839798, -19.6634422056377, -97.4878797773272, -94.901405647397, 79.1410635225475, -90.6966128386557, -94.0285502001643, 82.7198777813464, -98.452693875879 +input.z.2: -49.3249548599124, 11.3597484305501, 40.297681838274, 56.4172050915658, 41.8464520014822, -4.97913383878767, 69.742794893682, -10.7891221065074, -78.006159607321, -78.0675538815558, -28.415847895667, -91.1122145596892, 74.2001689970493, -99.0127950441092, 5.19012762233615 +input.z.3: -84.0839372947812, 10.4595458135009, 65.0016738567501, -53.3911125268787, -55.4832744412124, 97.5152499508113, 97.4566194228828, 4.70035099424422, -47.3684732802212, 60.6352349743247, -14.0548746567219, 98.1940933503211, -17.8199341520667, -37.4515796545893, 0.333152059465647 +------------------------------------------------------------ +function_name: pcor.rec +count: 12 +x: -8.38315580040216, 62.577842688188, 49.0786945447326, -23.4214183874428, -50.7951765786856, 63.7958682142198, 18.6142495833337, -65.1562116574496, 9.13515938445926, -13.0318598821759, -14.7402583155781, 43.8437720295042 +y: -95.1547249685973, 65.3086547274143, 64.0893495641649, 41.7833789717406, 79.1582422330976, 77.25128098391, -49.0278182085603, -83.4303252864629, -39.6045518573374, 99.8193635139614, 75.6284608971328, 48.1379889883101 +z: 43.6136350035667, -27.2865650709718, 46.6717171482742, -32.6379572506994, 46.3561374694109, 46.1588426493108, -10.5283190496266, 99.1817278321832, -19.9576248880476, -8.7395085953176, 78.7625784985721, -9.77536281570792 +method: k +rm: TRUE +result: 0.1995741655921 +------------------------------------------------------------ +function_name: pcor.rec +count: 19 +x: 47.2569864243269, -54.1419552639127, 4.58478815853596, -46.2462868075818, 91.8153540231287, 92.8692331537604, -62.5648601911962, 73.8267461303622, 41.3589684758335, -97.9034782387316, 98.4798386693001, -68.1963364593685, 72.0308075658977, 45.4933300614357, -9.36734918504953, -95.2568708453327, 33.6745547596365, -43.6154155991971, -41.3312709424645 +y: -29.2843889445066, -53.1314035411924, -87.0913468301296, 37.3094552196562, -77.3197258356959, 70.0469268020242, -42.8911098279059, 41.4748248644173, 12.3367053456604, 57.5248312205076, -80.0365700386465, 98.4118913300335, 61.524490872398, 65.7054962124676, -65.2169495355338, 14.661518856883, -85.6023627799004, 75.6984632462263, 78.1068930402398 method: p +rm: TRUE +result: -0.135855608847657 +input.z.1: -74.9636400956661, -50.4529112484306, 20.7700976636261, -80.2104050759226, -71.0900575388223, 50.9530781302601, -23.8234671298414, -71.7071319930255, -7.94364735484123, -20.3485743142664, -9.50398133136332, 82.8783791512251, 10.5230217799544, -51.2824773322791, 47.7249845862389, 39.2762039788067, 9.9144400563091, -20.7925260532647, 13.0731736309826 +input.z.2: -94.6578295435756, -64.8527128156275, -58.4413472097367, -85.668760119006, 7.32597187161446, 95.7994839642197, -44.0633145626634, 55.6779716163874, 99.0699136164039, -30.3195034619421, 49.2766278330237, -58.7089132983238, 67.0478899031878, -90.4275255743414, 15.3474381193519, 85.5800486635417, 78.1179318670183, -51.7158948816359, -65.5134835746139 +input.z.3: 45.1672998256981, -82.2150366380811, 60.7568521052599, 59.0756023768336, 6.37573790736496, 85.7110049575567, -48.6619451083243, -57.3790710419416, -43.1352959014475, 90.6157708261162, -64.2348555382341, -62.1769628021866, 99.3770319968462, 37.6210938673466, -57.459226064384, 93.9496335107833, 65.8080945257097, -91.4751033298671, 98.6923529300839 +------------------------------------------------------------ +function_name: pcor.rec +count: 17 +x: 37.2042017057538, 99.8944859951735, -2.07033073529601, 90.3329219669104, 5.66258640028536, -75.7469927892089, 77.5577671360224, 73.5588663257658, -13.3695781696588, 44.1321019083261, 87.7224891912192, 76.8428465351462, -61.9186359457672, -29.1462487541139, 91.7470158077776, 18.7315174844116, -49.4004189968109 +y: 34.0684679802507, -9.32011008262634, -14.0058151446283, 62.1845297981054, 49.7096230275929, -21.9136434141546, -14.504536613822, -16.5688768029213, -21.3160504121333, -75.6585834547877, -23.5258265398443, 55.5550341960043, 81.8944736849517, -10.6297532562166, -45.3006814233959, -80.5884425528347, -66.3937121629715 +method: k +rm: FALSE +result: 0.010709211073504 +input.z.1: -18.9110844396055, -90.7871477305889, -43.4062168933451, 37.5648979563266, 85.6148176360875, 88.7003752402961, 51.7822846770287, -90.8645707648247, 23.4855143819004, 30.8463104069233, -34.2037714086473, -88.5380632244051, -10.789051419124, 48.4769470058382, 97.4002870731056, 25.5868528038263, 77.5939787738025 +input.z.2: -49.3421413935721, -79.5107122976333, -69.2758508492261, 70.2953652944416, -26.0492874309421, -20.896744215861, -75.7518227212131, -0.518101826310158, 46.2639306206256, 70.5356315709651, -40.9173401538283, 92.4795118160546, 55.0997568294406, 16.338200122118, 44.9827799107879, -39.441972784698, 48.6015120055526 +input.z.3: -73.5004779882729, 87.9872216377407, 92.7410830743611, -13.9436025172472, 64.5655245985836, -42.4590483307838, 36.8305039592087, -82.2956138756126, -6.28325091674924, -18.8072303775698, -80.3971918765455, -1.98830938898027, 35.4344930965453, -68.9127727877349, 34.085252834484, 42.8761828225106, -8.14059982076287 +------------------------------------------------------------ +function_name: pcor.rec +count: 12 +x: 22.8633187245578, 98.9057261962444, 24.6264463290572, -67.5152567680925, -14.0114265028387, -23.4609092120081, -16.0529976245016, -74.1293652914464, -38.613182771951, 21.516504464671, -63.1570098455995, 3.43058109283447 +y: 66.3851822260767, 15.0869043543935, 34.2552722897381, -47.5028248038143, -18.82304972969, 7.55783263593912, 87.5256262719631, -45.0442485976964, 22.7592587005347, 15.5071972869337, 6.64250506088138, -61.0094598028809 +method: k rm: FALSE -result: 0.223987436768198 +result: 0.380642612922639 +input.z.1: -43.5355789028108, 3.15432427451015, 42.3869500402361, -85.9040122944862, -91.3019767962396, -4.38300650566816, -36.0976214520633, 82.1006664074957, -86.6311294957995, -17.1651322394609, 45.6184559967369, 78.0932303052396 +input.z.2: -50.4019991960377, 53.8435474969447, 46.2169490288943, 57.7160312794149, -80.6737503968179, 4.29811356589198, -8.02055508829653, -29.807900544256, -26.4149129390717, 54.7383895143867, -1.05271721258759, 2.92500704526901 +input.z.3: 82.1892600506544, 1.68216228485107, -81.9020131602883, 21.994966128841, -25.5232597701252, 56.1190348584205, -62.1999088674784, -84.2725639231503, -35.7946417294443, -20.4277000855654, -81.0949407052249, 48.0415523983538 ------------------------------------------------------------ diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py index f25145c..39e6e8e 100644 --- a/tests/unit/computations/test_partial_correlations.py +++ b/tests/unit/computations/test_partial_correlations.py @@ -189,13 +189,13 @@ def parse_input(lines, parser_function): for item in (parse_input_line(line, parser_function) for line in lines) if len(item) != 0) -def parse_test_data(filename): - with open("pcor_rec_blackbox_attempt.txt", newline="\n") as fl: +def parse_test_data(filename, parser_function): + with open(filename, newline="\n") as fl: input_lines = partition_by( lambda s: s.startswith("------"), (line.strip("\n\t ") for line in fl.readlines())) - return parse_input(input_lines, parse_for_rec) + return parse_input(input_lines, parser_function) class TestPartialCorrelations(TestCase): """Class for testing partial correlations computation functions""" @@ -422,12 +422,15 @@ class TestPartialCorrelations(TestCase): """ for sample in parse_test_data( ("tests/unit/computations/partial_correlations_test_data/" - "pcor_rec_blackbox_test.txt")): + "pcor_rec_blackbox_test.txt"), + parse_for_rec): with self.subTest( xdata=sample["x"], ydata=sample["y"], zdata=sample["z"], method=sample["method"], omit_nones=sample["rm"]): self.assertEqual( - partial_correlation_recursive( - sample["x"], sample["y"], sample["z"], - method=sample["method"], omit_nones=sample["rm"]), + round( + partial_correlation_recursive( + sample["x"], sample["y"], sample["z"], + method=sample["method"], omit_nones=sample["rm"]), + ROUND_TO), round(sample["result"], ROUND_TO)) -- cgit v1.2.3 From 8c72fa0cfdccb55e22b98b5f242f07d530e7c573 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 16 Nov 2021 12:44:22 +0530 Subject: Remove sqlalchemy. * gn3/settings.py (SQLALCHEMY_TRACK_MODIFICATIONS): Delete variable. * guix.scm (genenetwork3)[propagated-inputs]: Remove python-sqlalchemy-stubs. * setup.py: Remove sqlalchemy-stubs from install_requires. --- gn3/settings.py | 1 - guix.scm | 2 -- setup.py | 1 - 3 files changed, 4 deletions(-) (limited to 'gn3') diff --git a/gn3/settings.py b/gn3/settings.py index 57c63df..0a6d03b 100644 --- a/gn3/settings.py +++ b/gn3/settings.py @@ -17,7 +17,6 @@ RQTL_WRAPPER = "rqtl_wrapper.R" SQL_URI = os.environ.get( "SQL_URI", "mysql://webqtlout:webqtlout@localhost/db_webqtl") SECRET_KEY = "password" -SQLALCHEMY_TRACK_MODIFICATIONS = False # gn2 results only used in fetching dataset info GN2_BASE_URL = "http://www.genenetwork.org/" diff --git a/guix.scm b/guix.scm index a48b05a..faf353f 100644 --- a/guix.scm +++ b/guix.scm @@ -79,8 +79,6 @@ ("python-requests" ,python-requests) ("python-scipy" ,python-scipy) ("python-flask-socketio" ,python-flask-socketio) - ("python-sqlalchemy-stubs" - ,python-sqlalchemy-stubs) ("r-optparse" ,r-optparse) ("r-qtl" ,r-qtl) ("r-stringi" ,r-stringi) diff --git a/setup.py b/setup.py index 98a076f..55b4be2 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,6 @@ setup(author='Bonface M. K.', "redis==3.5.3" "requests==2.25.1" "scipy==1.6.0" - "sqlalchemy-stubs==0.4" "plotly==4.14.3" "flask-cors==3.0.9" ], -- cgit v1.2.3 From 21fbbfd599c841f082d88ddfc5f4cb362e1eb869 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 18 Nov 2021 10:58:34 +0300 Subject: Replace code migrated from R with pingouin functions Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Replace the code that was in the process of being migrated from R in GeneNetwork1 with calls to pingouin functions that achieve the same thing. Since the functions in this case are computing correlations and partial correlations, rather than having home-rolled functions to do that, this commit makes use of the tried and tested pingouin functions. This avoids complicating our code with edge-case checks, and leverages the performance optimisations done in pingouin. --- gn3/computations/partial_correlations.py | 114 ++++++++------------- .../unit/computations/test_partial_correlations.py | 41 +------- 2 files changed, 44 insertions(+), 111 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 519dce9..4b0cf30 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -11,6 +11,7 @@ from typing import Any, Tuple, Union, Sequence from scipy.stats import pearsonr, spearmanr import pandas +import pingouin from gn3.settings import TEXTDIR from gn3.data_helpers import parse_csv_line @@ -248,7 +249,7 @@ def compute_partial_correlations_fast(# pylint: disable=[R0913, R0914] all_target_trait_names: Tuple[str, ...] = processed_trait_names_values[0] all_target_trait_values: Tuple[float, ...] = processed_trait_names_values[1] - all_correlations = determine_partials( + all_correlations = compute_partial( primary_vals, control_vals, all_target_trait_names, all_target_trait_values, method) ## Line 772 to 779 in GN1 are the cause of the weird complexity in the @@ -278,79 +279,50 @@ def build_data_frame( return interm_df.rename(columns={"z0": "z"}) return interm_df -def partial_correlation_matrix( - xdata: Tuple[float, ...], ydata: Tuple[float, ...], - zdata: Union[Tuple[float, ...], Tuple[Tuple[float, ...], ...]], - method: str = "pearson", omit_nones: bool = True) -> float: +def compute_partial( + primary_val, control_vals, target_vals, target_names, + method: str) -> Tuple[ + Union[ + Tuple[str, int, float, float, float, float], None], + ...]: """ - Computes the partial correlation coefficient using the - 'variance-covariance matrix' method + Compute the partial correlations. - This is a partial migration of the - `web.webqtl.correlation.correlationFunction.determinPartialsByR` function in - GeneNetwork1, specifically the `pcor.mat` function written in the R - programming language. - """ - return 0 + This is a re-implementation of the + `web.webqtl.correlation.correlationFunction.determinePartialsByR` function + in GeneNetwork1. -def partial_correlation_recursive( - xdata: Tuple[float, ...], ydata: Tuple[float, ...], - zdata: Union[Tuple[float, ...], Tuple[Tuple[float, ...], ...]], - method: str = "pearson", omit_nones: bool = True) -> float: - """ - Computes the partial correlation coefficient using the 'recursive formula' - method + This implementation reworks the child function `compute_partial` which will + then be used in the place of `determinPartialsByR`. - This is a partial migration of the - `web.webqtl.correlation.correlationFunction.determinPartialsByR` function in - GeneNetwork1, specifically the `pcor.rec` function written in the R - programming language. + TODO: moving forward, we might need to use the multiprocessing library to + speed up the computations, in case they are found to be slow. """ - assert method in ("pearson", "spearman", "kendall") - data = ( - build_data_frame(xdata, ydata, zdata).dropna(axis=0) - if omit_nones else - build_data_frame(xdata, ydata, zdata)) - - if data.shape[1] == 3: # z is a vector, not matrix - fields = { - "rxy": ("x", "y"), - "rxz": ("x", "z"), - "ryz": ("y", "z")} - tdata = { - corr_type: pandas.DataFrame( - {cols[0]: data[cols[0]], - cols[1]: data[cols[1]]}).dropna(axis=0) - for corr_type, cols in fields.items() - } - corrs = { - corr_type: tdata[corr_type][cols[0]].corr( - tdata[corr_type][cols[1]], method=method) - for corr_type, cols in fields.items() - } + # replace the R code with `pingouin.partial_corr` + def __compute_trait_info__(target): + df = build_data_frame( + [prim for targ, prim in zip(target, primary_vals) + if targ is not None], + [targ for targ in target if targ is not None], + [cont for i, cont in enumerate(control) if target[i] is not None]) + covariates = "z" if df.shape[1] == 3 else [ + col for col in df.columns if col not in ("x", "y")] + ppc = pingouin.partial_corr( + data=df, x="x", y="y", covar=covariates, method=method) + pc_coeff = ppc["r"] + + zero_order_corr = pingouin.corr(df["x"], df["y"], method=method) + + if math.isnan(pc_coeff): + return ( + target[1], len(primary), pc_coeff, 1, zero_order_corr["r"], + zero_order_corr["p-val"]) return ( - (corrs["rxy"] - corrs["rxz"] * corrs["ryz"]) / - (math.sqrt(1 - corrs["rxz"]**2) * - math.sqrt(1 - corrs["ryz"]**2))) - - remaining_cols = [ - colname for colname, series in data.items() - if colname not in ("x", "y", "z0") - ] - - new_xdata = tuple(data["x"]) - new_ydata = tuple(data["y"]) - zc = tuple(tuple(data[colname]) for colname in data[remaining_cols].columns) - - rxy_zc = partial_correlation_recursive( - new_xdata, new_ydata, zc, method=method, - omit_nones=omit_nones) - rxz0_zc = partial_correlation_recursive( - new_xdata, tuple(data["z0"]), zc, method=method, - omit_nones=omit_nones) - ryz0_zc = partial_correlation_recursive( - new_ydata, tuple(data["z0"]), zc, method=method, - omit_nones=omit_nones) - - return ((rxy_zc - rxz0_zc * ryz0_zc) /( - math.sqrt(1 - rxz0_zc**2) * math.sqrt(1 - ryz0_zc**2))) + target[1], len(primary), pc_coeff, + (ppc["p-val"] if not math.isnan(ppc["p-val"]) else ( + 0 if (abs(pc_coeff - 1) < 0.0000001) else 1)), + zero_order_corr["r"], zero_order_corr["p-val"]) + + return tuple( + __compute_trait_info__(target) + for target in zip(target_vals, target_names)) diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py index 39e6e8e..138155d 100644 --- a/tests/unit/computations/test_partial_correlations.py +++ b/tests/unit/computations/test_partial_correlations.py @@ -16,9 +16,7 @@ from gn3.computations.partial_correlations import ( dictify_by_samples, tissue_correlation, find_identical_traits, - partial_correlation_matrix, - good_dataset_samples_indexes, - partial_correlation_recursive) + good_dataset_samples_indexes) sampleslist = ["B6cC3-1", "BXD1", "BXD12", "BXD16", "BXD19", "BXD2"] control_traits = ( @@ -397,40 +395,3 @@ class TestPartialCorrelations(TestCase): with self.subTest(xdata=xdata, ydata=ydata, zdata=zdata): self.assertTrue( build_data_frame(xdata, ydata, zdata).equals(expected)) - - def test_partial_correlation_matrix(self): - """ - Test that `partial_correlation_matrix` computes the appropriate - correlation value. - """ - for sample in parse_test_data_csv( - ("tests/unit/computations/partial_correlations_test_data/" - "pcor_mat_blackbox_test.csv")): - with self.subTest( - xdata=sample["x"], ydata=sample["y"], zdata=sample["z"], - method=sample["method"], omit_nones=sample["rm"]): - self.assertEqual( - partial_correlation_matrix( - sample["x"], sample["y"], sample["z"], - method=sample["method"], omit_nones=sample["rm"]), - sample["result"]) - - def test_partial_correlation_recursive(self): - """ - Test that `partial_correlation_recursive` computes the appropriate - correlation value. - """ - for sample in parse_test_data( - ("tests/unit/computations/partial_correlations_test_data/" - "pcor_rec_blackbox_test.txt"), - parse_for_rec): - with self.subTest( - xdata=sample["x"], ydata=sample["y"], zdata=sample["z"], - method=sample["method"], omit_nones=sample["rm"]): - self.assertEqual( - round( - partial_correlation_recursive( - sample["x"], sample["y"], sample["z"], - method=sample["method"], omit_nones=sample["rm"]), - ROUND_TO), - round(sample["result"], ROUND_TO)) -- cgit v1.2.3 From 3dd5fbda7e08999b6470cfe1fbbd19d767adea9b Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 18 Nov 2021 11:59:53 +0300 Subject: Fix some linting errors Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Fix some obvious linting errors and remove obsolete code --- gn3/computations/partial_correlations.py | 22 ++-- .../unit/computations/test_partial_correlations.py | 111 +-------------------- tests/unit/test_data_helpers.py | 15 +++ tests/unit/test_heatmaps.py | 8 +- 4 files changed, 38 insertions(+), 118 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 4b0cf30..ee47290 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -280,7 +280,7 @@ def build_data_frame( return interm_df def compute_partial( - primary_val, control_vals, target_vals, target_names, + primary_vals, control_vals, target_vals, target_names, method: str) -> Tuple[ Union[ Tuple[str, int, float, float, float, float], None], @@ -300,18 +300,22 @@ def compute_partial( """ # replace the R code with `pingouin.partial_corr` def __compute_trait_info__(target): - df = build_data_frame( - [prim for targ, prim in zip(target, primary_vals) - if targ is not None], + primary = [ + prim for targ, prim in zip(target, primary_vals) + if targ is not None] + datafrm = build_data_frame( + primary, [targ for targ in target if targ is not None], - [cont for i, cont in enumerate(control) if target[i] is not None]) - covariates = "z" if df.shape[1] == 3 else [ - col for col in df.columns if col not in ("x", "y")] + [cont for i, cont in enumerate(control_vals) + if target[i] is not None]) + covariates = "z" if datafrm.shape[1] == 3 else [ + col for col in datafrm.columns if col not in ("x", "y")] ppc = pingouin.partial_corr( - data=df, x="x", y="y", covar=covariates, method=method) + data=datafrm, x="x", y="y", covar=covariates, method=method) pc_coeff = ppc["r"] - zero_order_corr = pingouin.corr(df["x"], df["y"], method=method) + zero_order_corr = pingouin.corr( + datafrm["x"], datafrm["y"], method=method) if math.isnan(pc_coeff): return ( diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py index 138155d..f77a066 100644 --- a/tests/unit/computations/test_partial_correlations.py +++ b/tests/unit/computations/test_partial_correlations.py @@ -1,14 +1,9 @@ """Module contains tests for gn3.partial_correlations""" -import csv from unittest import TestCase import pandas -from gn3.settings import ROUND_TO -from gn3.function_helpers import compose -from gn3.data_helpers import partition_by - from gn3.computations.partial_correlations import ( fix_samples, control_samples, @@ -99,102 +94,6 @@ dictified_control_samples = ( "BXD1": {"sample_name": "BXD1", "value": 7.77141, "variance": None}, "BXD2": {"sample_name": "BXD2", "value": 7.80944, "variance": None}}) -def parse_test_data_csv(filename): - """ - Parse test data csv files for R -> Python conversion of some functions. - """ - def __str__to_tuple(line, field): - return tuple(float(s.strip()) for s in line[field].split(",")) - - with open(filename, newline="\n") as csvfile: - reader = csv.DictReader(csvfile, delimiter=",", quotechar='"') - lines = tuple(row for row in reader) - - methods = {"p": "pearson", "s": "spearman", "k": "kendall"} - return tuple({ - **line, - "x": __str__to_tuple(line, "x"), - "y": __str__to_tuple(line, "y"), - "z": __str__to_tuple(line, "z"), - "method": methods[line["method"]], - "rm": line["rm"] == "TRUE", - "result": round(float(line["result"]), ROUND_TO) - } for line in lines) - -def parse_method(key_value): - """Parse the partial correlation method""" - key, value = key_value - if key == "method": - methods_dict = {"p": "pearson", "k": "kendall", "s": "spearman"} - return (key, methods_dict[value]) - return key_value - -def parse_count(key_value): - """Parse the value of count into an integer""" - key, value = key_value - if key == "count": - return (key, int(value)) - return key_value - -def parse_xyz(key_value): - """Parse the values of x, y, and z* items into sequences of floats""" - key, value = key_value - if (key in ("x", "y", "z")) or key.startswith("input.z"): - return ( - key.replace("input", "").replace(".", ""), - tuple(float(val.strip("\n\t ")) for val in value.split(","))) - return key_value - -def parse_rm(key_value): - """Parse the rm value into a python True/False value.""" - key, value = key_value - if key == "rm": - return (key, value == "TRUE") - return key_value - -def parse_result(key_value): - """Parse the result into a float value.""" - key, value = key_value - if key == "result": - return (key, float(value)) - return key_value - -parse_for_rec = compose( - parse_result, - parse_rm, - parse_xyz, - parse_count, - parse_method, - lambda k_v: tuple(item.strip("\n\t ") for item in k_v), - lambda s: s.split(":")) - -def parse_input_line(line, parser_function): - return tuple( - parser_function(item) for item in line if not item.startswith("------")) - -def merge_z(item): - without_z = { - key: val for key, val in item.items() if not key.startswith("z")} - return { - **without_z, - "z": item.get( - "z", - tuple(val for key, val in item.items() if key.startswith("z")))} - -def parse_input(lines, parser_function): - return tuple( - merge_z(dict(item)) - for item in (parse_input_line(line, parser_function) for line in lines) - if len(item) != 0) - -def parse_test_data(filename, parser_function): - with open(filename, newline="\n") as fl: - input_lines = partition_by( - lambda s: s.startswith("------"), - (line.strip("\n\t ") for line in fl.readlines())) - - return parse_input(input_lines, parser_function) - class TestPartialCorrelations(TestCase): """Class for testing partial correlations computation functions""" @@ -382,16 +281,16 @@ class TestPartialCorrelations(TestCase): Check that the function builds the correct data frame. """ for xdata, ydata, zdata, expected in ( - ((0.1, 1.1, 2.1), (2.1, 3.1, 4.1), (5.1, 6.1 ,7.1), + ((0.1, 1.1, 2.1), (2.1, 3.1, 4.1), (5.1, 6.1, 7.1), pandas.DataFrame({ "x": (0.1, 1.1, 2.1), "y": (2.1, 3.1, 4.1), - "z": (5.1, 6.1 ,7.1)})), + "z": (5.1, 6.1, 7.1)})), ((0.1, 1.1, 2.1), (2.1, 3.1, 4.1), - ((5.1, 6.1 ,7.1), (5.2, 6.2, 7.2), (5.3, 6.3, 7.3)), + ((5.1, 6.1, 7.1), (5.2, 6.2, 7.2), (5.3, 6.3, 7.3)), pandas.DataFrame({ "x": (0.1, 1.1, 2.1), "y": (2.1, 3.1, 4.1), - "z0": (5.1, 6.1, 7.1), "z1": (5.2, 6.2 ,7.2), - "z2": (5.3, 6.3 ,7.3)}))): + "z0": (5.1, 6.1, 7.1), "z1": (5.2, 6.2, 7.2), + "z2": (5.3, 6.3, 7.3)}))): with self.subTest(xdata=xdata, ydata=ydata, zdata=zdata): self.assertTrue( build_data_frame(xdata, ydata, zdata).equals(expected)) diff --git a/tests/unit/test_data_helpers.py b/tests/unit/test_data_helpers.py index 3f76344..88ea469 100644 --- a/tests/unit/test_data_helpers.py +++ b/tests/unit/test_data_helpers.py @@ -61,6 +61,21 @@ class TestDataHelpers(TestCase): expected) def test_partition_by(self): + """ + Test that `partition_by` groups the data using the given predicate + + Given: + - `part_fn`: a predicate funtion that return boolean True/False + - `items`: a sequence of items + When: + - the partitioning predicate function and the sequence of items are + passed to the `partition_by` function + Then: + - the result is a tuple, with sub-tuples containing the data in the + original sequence. Each sub-tuple is a partition, ending as soon as + the next value in the sequence, when passed to `part_fn`, returns + boolean `True`. + """ for part_fn, items, expected in ( (lambda s: s.startswith("----"), ("------", "a", "b", "-----", "c", "----", "d", "e", "---", diff --git a/tests/unit/test_heatmaps.py b/tests/unit/test_heatmaps.py index e4c929d..69e1c3c 100644 --- a/tests/unit/test_heatmaps.py +++ b/tests/unit/test_heatmaps.py @@ -1,6 +1,8 @@ """Module contains tests for gn3.heatmaps.heatmaps""" from unittest import TestCase -from numpy.testing import assert_allclose + +from numpy import allclose + from gn3.heatmaps import ( cluster_traits, get_loci_names, @@ -40,7 +42,7 @@ class TestHeatmap(TestCase): (6.84118, 7.08432, 7.59844, 7.08229, 7.26774, 7.24991), (9.45215, 10.6943, 8.64719, 10.1592, 7.75044, 8.78615), (7.04737, 6.87185, 7.58586, 6.92456, 6.84243, 7.36913)] - assert_allclose( + self.assertTrue(allclose( cluster_traits(traits_data_list), ((0.0, 0.20337048635536847, 0.16381088984330505, 1.7388553629398245, 1.5025235756329178, 0.6952839500255574, 1.271661230252733, @@ -72,7 +74,7 @@ class TestHeatmap(TestCase): (0.7934461515867415, 0.4497104244247795, 0.7127042590637039, 0.9313185954797953, 1.1683723389247052, 0.23451785425383564, 1.7413442197913358, 0.33370067057028485, 1.3256191648260216, - 0.0))) + 0.0)))) def test_compute_heatmap_order(self): """Test the orders.""" -- cgit v1.2.3 From 08c81b8892060353bb7fb15555875f03bbdcb46e Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 19 Nov 2021 10:56:35 +0300 Subject: Avoid rounding: compare floats approximately Notes: https://github.com/genenetwork/genenetwork3/pull/56#issuecomment-973798918 * As mentioned in the notes, rather than rounding to an arbitrary number of decimal places, it is a much better practice to use approximate comparisons of floats for the tests. --- gn3/computations/partial_correlations.py | 2 +- tests/unit/computations/test_partial_correlations.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index ee47290..4f45159 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -156,7 +156,7 @@ def tissue_correlation( "Method must be one of: {}".format(",".join(method_fns.keys()))) corr, pvalue = method_fns[method](primary_trait_values, target_trait_values) - return (round(corr, 10), round(pvalue, 10)) + return (corr, pvalue) def batch_computed_tissue_correlation( primary_trait_values: Tuple[float, ...], target_traits_dict: dict, diff --git a/tests/unit/computations/test_partial_correlations.py b/tests/unit/computations/test_partial_correlations.py index f77a066..3e1b6e1 100644 --- a/tests/unit/computations/test_partial_correlations.py +++ b/tests/unit/computations/test_partial_correlations.py @@ -3,6 +3,7 @@ from unittest import TestCase import pandas +from numpy.testing import assert_allclose from gn3.computations.partial_correlations import ( fix_samples, @@ -250,7 +251,7 @@ class TestPartialCorrelations(TestCase): with self.assertRaises(error, msg=error_msg): tissue_correlation(primary, target, method) - def test_tissue_correlation(self): + def test_tissue_correlation(self): # pylint: disable=R0201 """ Test that the correct correlation values are computed for the given: - primary trait @@ -259,11 +260,11 @@ class TestPartialCorrelations(TestCase): """ for primary, target, method, expected in ( ((12.34, 18.36, 42.51), (37.25, 46.25, 46.56), "pearson", - (0.6761779253, 0.5272701134)), + (0.6761779252651052, 0.5272701133657985)), ((1, 2, 3, 4, 5), (5, 6, 7, 8, 7), "spearman", - (0.8207826817, 0.0885870053))): + (0.8207826816681233, 0.08858700531354381))): with self.subTest(primary=primary, target=target, method=method): - self.assertEqual( + assert_allclose( tissue_correlation(primary, target, method), expected) def test_good_dataset_samples_indexes(self): -- cgit v1.2.3 From 854416ba850b7793aa9aa95528b89bc69df26888 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 22 Nov 2021 09:06:52 +0300 Subject: Make the DB connection argument the first Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * To make the code more composable down the line, make the database connection argument the first argument for functions that access the database, since they will always require the connection. --- gn3/db/correlations.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index 06b3310..f327dc3 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -34,7 +34,7 @@ def get_filename(target_db_name: str, conn: Any) -> str: return "" def build_temporary_literature_table( - species: str, gene_id: int, return_number: int, conn: Any) -> str: + conn: Any, species: str, gene_id: int, return_number: int) -> str: """ Build and populate a temporary table to hold the literature correlation data to be used in computations. @@ -128,7 +128,7 @@ def fetch_literature_correlations( GeneNetwork1. """ temp_table = build_temporary_literature_table( - species, gene_id, return_number, conn) + conn, species, gene_id, return_number) query_fns = { "Geno": fetch_geno_literature_correlations, # "Temp": fetch_temp_literature_correlations, @@ -268,8 +268,8 @@ def fetch_gene_symbol_tissue_value_dict_for_trait( return {} def build_temporary_tissue_correlations_table( - trait_symbol: str, probeset_freeze_id: int, method: str, - return_number: int, conn: Any) -> str: + conn: Any, trait_symbol: str, probeset_freeze_id: int, method: str, + return_number: int) -> str: """ Build a temporary table to hold the tissue correlations data. @@ -320,7 +320,7 @@ def fetch_tissue_correlations(# pylint: disable=R0913 GeneNetwork1. """ temp_table = build_temporary_tissue_correlations_table( - trait_symbol, probeset_freeze_id, method, return_number, conn) + conn, trait_symbol, probeset_freeze_id, method, return_number) with conn.cursor() as cursor: cursor.execute( ( -- cgit v1.2.3 From 55d698b1fb07afe74bf1dd570f9f495aefea1086 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 22 Nov 2021 12:03:21 +0300 Subject: Migrate `web.webqtl.correlation.CorrelationPage.fetchAllDatabaseData` function Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Migrate the `web.webqtl.correlation.CorrelationPage.fetchAllDatabaseData` function from GN1 to GN3. --- gn3/db/correlations.py | 147 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index f327dc3..ff570b4 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -379,3 +379,150 @@ def check_symbol_for_tissue_correlation( return True return False + +def fetch_sample_ids( + conn: Any, sample_names: Tuple[str, ...], species_name: str) -> Tuple[ + int, ...]: + """ + Given a sequence of sample names, and a species name, return the sample ids + that correspond to both. + + This is a partial migration of the + `web.webqtl.correlation.CorrelationPage.fetchAllDatabaseData` function in + GeneNetwork1. + """ + query = ( + "SELECT Strain.Id FROM Strain, Species " + "WHERE Strain.Name IN %(samples_names)s " + "AND Strain.SpeciesId=Species.Id " + "AND Species.name=%(species_name)s") + with conn.cursor() as cursor: + cursor.execute( + query, samples_names=tuple(samples), + species_name=species) + return cursor.fetchall() + +def fetch_all_database_data( + conn: Any, species: str, gene_id: int, gene_symbol: str, + samples: Tuple[str, ...], db_type: str, db_name: str, method: str, + returnNumber: int, tissueProbeSetFreezeId: int) -> Tuple[Any, Any]: + """ + This is a migration of the + `web.webqtl.correlation.CorrelationPage.fetchAllDatabaseData` function in + GeneNetwork1. + """ + def __build_query_sgo_lit__(temp_table, sample_id_columns, joins): + return ( + (f"SELECT {db_type}.Name, {temp_table}.value " + + sample_id_columns + + f" FROM ({db_type}, {db_type}XRef, {db_type}Freeze) " + + f"LEFT JOIN {temp_table} ON {temp_table}.GeneId2=ProbeSet.GeneId " + + " ".join(joins) + + f" WHERE ProbeSet.GeneId IS NOT NULL " + + f"AND {temp_table}.value IS NOT NULL " + + f"AND {db_type}XRef.{db_type}FreezeId = {db_type}Freeze.Id " + + f"AND {db_type}Freeze.Name = %(db_name)s " + + f"AND {db_type}.Id = {db_type}XRef.{db_type}Id " + + f"ORDER BY {db_type}.Id"), + 2) + + def __build_query_tissue_corr__(temp_table, sample_id_columns, joins): + return ( + (f"SELECT {db_type}.Name, {temp_table}.Correlation, " + + f"{temp_table}.PValue, " + + sample_id_columns + + f" FROM ({db_type}, {db_type}XRef, {db_type}Freeze) " + + f"LEFT JOIN {temp_table} ON {temp_table}.Symbol=ProbeSet.Symbol " + + " ".join(joins) + + f" WHERE ProbeSet.Symbol IS NOT NULL " + + f"AND {temp_table}.Correlation IS NOT NULL " + + f"AND {db_type}XRef.{db_type}FreezeId = {db_type}Freeze.Id " + + f"AND {db_type}Freeze.Name = %(db_name)s " + + f"AND {db_type}.Id = {db_type}XRef.%sId " + f"ORDER BY {db_type}.Id"), + 3) + + def __build_query__(sample_ids, temp_table): + sample_id_columns = ", ".join(f"T{smpl}.value" for smpl in samples_ids) + if db_type == "Publish": + joins = tuple( + ("LEFT JOIN PublishData AS T{item} " + "ON T{item}.Id = PublishXRef.DataId " + "AND T{item}.StrainId = %(T{item}_sample_id)s") + for item in sample_ids) + return ( + ("SELECT PublishXRef.Id, " + + sample_id_columns + + "FROM (PublishXRef, PublishFreeze) " + + " ".join(joins) + + " WHERE PublishXRef.InbredSetId = PublishFreeze.InbredSetId " + "AND PublishFreeze.Name = %(db_name)s"), + 1) + if temp_table is not None: + joins = tuple( + ("LEFT JOIN {db_type}Data AS T{item} " + "ON T{item}.Id = {db_type}XRef.DataId " + "AND T{item}.StrainId=%(T{item}_sample_id)s") + for item in sample_ids) + if method.lower() == "sgo literature correlation": + return __build_query_sgo_lit__( + sample_ids, temp_table, sample_id_columns) + if method.lower() in ( + "tissue correlation, pearson's r", + "tissue correlation, spearman's rho"): + return __build_query_tissue_corr__( + sample_ids, temp_table, sample_id_columns) + joins = tuple( + (f"LEFT JOIN {db_type}Data AS T{item} " + f"ON T{item}.Id = {db_type}XRef.DataId " + f"AND T{item}.StrainId = %(T{item}_sample_id)s") + for item in sample_ids) + return ( + ( + f"SELECT {db_type}.Name, " + + sample_id_columns + + f" FROM ({db_type}, {db_type}XRef, {db_type}Freeze) " + + " ".join(joins) + + f" WHERE {db_type}XRef.{db_type}FreezeId = {db_type}Freeze.Id " + + f"AND {db_type}Freeze.Name = %(db_name)s " + + f"AND {db_type}.Id = {db_type}XRef.{db_type}Id " + + f"ORDER BY {db_type}.Id"), + 1) + + def __fetch_data__(sample_ids, temp_table): + query, data_start_pos = __build_query__(sample_ids, temp_table) + with conn.cursor() as cursor: + cursor.execute( + query, db_name=db_name, + **{f"T{item}_sample_id": item for item in sample_ids}) + return cursor.fetchall() + + sample_ids = tuple( + # look into graduating this to an argument and removing the `samples` + # and `species` argument: function currying and compositions might help + # with this + f"{sample_id}" for sample_id in + fetch_sample_ids(conn, samples, species)) + + temp_table = None + if gene_id and db_type == "probeset": + if method.lower() == "sgo literature correlation": + temp_table = build_temporary_literature_table( + conn, species, gene_id, return_number) + if method.lower() in ( + "tissue correlation, pearson's r", + "tissue correlation, spearman's rho"): + temp_table = build_temporary_tissue_correlations_table( + conn, trait_symbol, probeset_freeze_id, method, return_number) + + trait_database = tuple( + item for sublist in + (__fetch_data__(ssample_ids, temp_table) + for ssample_ids in partition_all(25, sample_ids)) + for item in sublist) + + if temp_table: + with conn.cursor() as cursor: + cursor.execute(f"DROP TEMPORARY TABLE {temp_table}") + + return trait_database, data_start_pos -- cgit v1.2.3 From 575da0baf4468d27782c73b19995b3adb934ba70 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 22 Nov 2021 13:56:03 +0300 Subject: Add test to query builders Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Add some tests for the query builders to ensure that the queries are built up correctly. --- gn3/db/correlations.py | 78 +++++++++++++++++---------------- tests/unit/db/test_correlation.py | 90 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+), 36 deletions(-) create mode 100644 tests/unit/db/test_correlation.py (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index ff570b4..7daff87 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -402,6 +402,43 @@ def fetch_sample_ids( species_name=species) return cursor.fetchall() +def build_query_sgo_lit_corr( + db_type: str, temp_table: str, sample_id_columns: str, + joins: Tuple[str, ...]) -> str: + """ + Build query for `SGO Literature Correlation` data, when querying the given + `temp_table` temporary table. + """ + return ( + (f"SELECT {db_type}.Name, {temp_table}.value, " + + sample_id_columns + + f" FROM ({db_type}, {db_type}XRef, {db_type}Freeze) " + + f"LEFT JOIN {temp_table} ON {temp_table}.GeneId2=ProbeSet.GeneId " + + " ".join(joins) + + f" WHERE ProbeSet.GeneId IS NOT NULL " + + f"AND {temp_table}.value IS NOT NULL " + + f"AND {db_type}XRef.{db_type}FreezeId = {db_type}Freeze.Id " + + f"AND {db_type}Freeze.Name = %(db_name)s " + + f"AND {db_type}.Id = {db_type}XRef.{db_type}Id " + + f"ORDER BY {db_type}.Id"), + 2) + +def build_query_tissue_corr(db_type, temp_table, sample_id_columns, joins): + return ( + (f"SELECT {db_type}.Name, {temp_table}.Correlation, " + + f"{temp_table}.PValue, " + + sample_id_columns + + f" FROM ({db_type}, {db_type}XRef, {db_type}Freeze) " + + f"LEFT JOIN {temp_table} ON {temp_table}.Symbol=ProbeSet.Symbol " + + " ".join(joins) + + f" WHERE ProbeSet.Symbol IS NOT NULL " + + f"AND {temp_table}.Correlation IS NOT NULL " + + f"AND {db_type}XRef.{db_type}FreezeId = {db_type}Freeze.Id " + + f"AND {db_type}Freeze.Name = %(db_name)s " + + f"AND {db_type}.Id = {db_type}XRef.{db_type}Id " + f"ORDER BY {db_type}.Id"), + 3) + def fetch_all_database_data( conn: Any, species: str, gene_id: int, gene_symbol: str, samples: Tuple[str, ...], db_type: str, db_name: str, method: str, @@ -411,37 +448,6 @@ def fetch_all_database_data( `web.webqtl.correlation.CorrelationPage.fetchAllDatabaseData` function in GeneNetwork1. """ - def __build_query_sgo_lit__(temp_table, sample_id_columns, joins): - return ( - (f"SELECT {db_type}.Name, {temp_table}.value " + - sample_id_columns + - f" FROM ({db_type}, {db_type}XRef, {db_type}Freeze) " + - f"LEFT JOIN {temp_table} ON {temp_table}.GeneId2=ProbeSet.GeneId " + - " ".join(joins) + - f" WHERE ProbeSet.GeneId IS NOT NULL " + - f"AND {temp_table}.value IS NOT NULL " + - f"AND {db_type}XRef.{db_type}FreezeId = {db_type}Freeze.Id " + - f"AND {db_type}Freeze.Name = %(db_name)s " + - f"AND {db_type}.Id = {db_type}XRef.{db_type}Id " + - f"ORDER BY {db_type}.Id"), - 2) - - def __build_query_tissue_corr__(temp_table, sample_id_columns, joins): - return ( - (f"SELECT {db_type}.Name, {temp_table}.Correlation, " + - f"{temp_table}.PValue, " + - sample_id_columns + - f" FROM ({db_type}, {db_type}XRef, {db_type}Freeze) " + - f"LEFT JOIN {temp_table} ON {temp_table}.Symbol=ProbeSet.Symbol " + - " ".join(joins) + - f" WHERE ProbeSet.Symbol IS NOT NULL " + - f"AND {temp_table}.Correlation IS NOT NULL " + - f"AND {db_type}XRef.{db_type}FreezeId = {db_type}Freeze.Id " + - f"AND {db_type}Freeze.Name = %(db_name)s " + - f"AND {db_type}.Id = {db_type}XRef.%sId " - f"ORDER BY {db_type}.Id"), - 3) - def __build_query__(sample_ids, temp_table): sample_id_columns = ", ".join(f"T{smpl}.value" for smpl in samples_ids) if db_type == "Publish": @@ -460,17 +466,17 @@ def fetch_all_database_data( 1) if temp_table is not None: joins = tuple( - ("LEFT JOIN {db_type}Data AS T{item} " - "ON T{item}.Id = {db_type}XRef.DataId " - "AND T{item}.StrainId=%(T{item}_sample_id)s") + (f"LEFT JOIN {db_type}Data AS T{item} " + f"ON T{item}.Id = {db_type}XRef.DataId " + f"AND T{item}.StrainId=%(T{item}_sample_id)s") for item in sample_ids) if method.lower() == "sgo literature correlation": - return __build_query_sgo_lit__( + return build_query_sgo_lit_corr( sample_ids, temp_table, sample_id_columns) if method.lower() in ( "tissue correlation, pearson's r", "tissue correlation, spearman's rho"): - return __build_query_tissue_corr__( + return build_query_tissue_corr( sample_ids, temp_table, sample_id_columns) joins = tuple( (f"LEFT JOIN {db_type}Data AS T{item} " diff --git a/tests/unit/db/test_correlation.py b/tests/unit/db/test_correlation.py new file mode 100644 index 0000000..866d28d --- /dev/null +++ b/tests/unit/db/test_correlation.py @@ -0,0 +1,90 @@ +""" +Tests for the gn3.db.correlations module +""" + +from unittest import TestCase + +from gn3.db.correlations import ( + build_query_sgo_lit_corr, + build_query_tissue_corr) + +class TestCorrelation(TestCase): + """Test cases for correlation data fetching functions""" + maxDiff = None + + def test_build_query_sgo_lit_corr(self): + self.assertEqual( + build_query_sgo_lit_corr( + "Probeset", + "temp_table_xy45i7wd", + "T1.value, T2.value, T3.value", + (("LEFT JOIN ProbesetData AS T1 " + "ON T1.Id = ProbesetXRef.DataId " + "AND T1.StrainId=%(T1_sample_id)s"), + ( + "LEFT JOIN ProbesetData AS T2 " + "ON T2.Id = ProbesetXRef.DataId " + "AND T2.StrainId=%(T2_sample_id)s"), + ( + "LEFT JOIN ProbesetData AS T3 " + "ON T3.Id = ProbesetXRef.DataId " + "AND T3.StrainId=%(T3_sample_id)s"))), + (("SELECT Probeset.Name, temp_table_xy45i7wd.value, " + "T1.value, T2.value, T3.value " + "FROM (Probeset, ProbesetXRef, ProbesetFreeze) " + "LEFT JOIN temp_table_xy45i7wd ON temp_table_xy45i7wd.GeneId2=ProbeSet.GeneId " + "LEFT JOIN ProbesetData AS T1 " + "ON T1.Id = ProbesetXRef.DataId " + "AND T1.StrainId=%(T1_sample_id)s " + "LEFT JOIN ProbesetData AS T2 " + "ON T2.Id = ProbesetXRef.DataId " + "AND T2.StrainId=%(T2_sample_id)s " + "LEFT JOIN ProbesetData AS T3 " + "ON T3.Id = ProbesetXRef.DataId " + "AND T3.StrainId=%(T3_sample_id)s " + "WHERE ProbeSet.GeneId IS NOT NULL " + "AND temp_table_xy45i7wd.value IS NOT NULL " + "AND ProbesetXRef.ProbesetFreezeId = ProbesetFreeze.Id " + "AND ProbesetFreeze.Name = %(db_name)s " + "AND Probeset.Id = ProbesetXRef.ProbesetId " + "ORDER BY Probeset.Id"), + 2)) + + def test_build_query_tissue_corr(self): + self.assertEqual( + build_query_tissue_corr( + "Probeset", + "temp_table_xy45i7wd", + "T1.value, T2.value, T3.value", + (("LEFT JOIN ProbesetData AS T1 " + "ON T1.Id = ProbesetXRef.DataId " + "AND T1.StrainId=%(T1_sample_id)s"), + ( + "LEFT JOIN ProbesetData AS T2 " + "ON T2.Id = ProbesetXRef.DataId " + "AND T2.StrainId=%(T2_sample_id)s"), + ( + "LEFT JOIN ProbesetData AS T3 " + "ON T3.Id = ProbesetXRef.DataId " + "AND T3.StrainId=%(T3_sample_id)s"))), + (("SELECT Probeset.Name, temp_table_xy45i7wd.Correlation, " + "temp_table_xy45i7wd.PValue, " + "T1.value, T2.value, T3.value " + "FROM (Probeset, ProbesetXRef, ProbesetFreeze) " + "LEFT JOIN temp_table_xy45i7wd ON temp_table_xy45i7wd.Symbol=ProbeSet.Symbol " + "LEFT JOIN ProbesetData AS T1 " + "ON T1.Id = ProbesetXRef.DataId " + "AND T1.StrainId=%(T1_sample_id)s " + "LEFT JOIN ProbesetData AS T2 " + "ON T2.Id = ProbesetXRef.DataId " + "AND T2.StrainId=%(T2_sample_id)s " + "LEFT JOIN ProbesetData AS T3 " + "ON T3.Id = ProbesetXRef.DataId " + "AND T3.StrainId=%(T3_sample_id)s " + "WHERE ProbeSet.Symbol IS NOT NULL " + "AND temp_table_xy45i7wd.Correlation IS NOT NULL " + "AND ProbesetXRef.ProbesetFreezeId = ProbesetFreeze.Id " + "AND ProbesetFreeze.Name = %(db_name)s " + "AND Probeset.Id = ProbesetXRef.ProbesetId " + "ORDER BY Probeset.Id"), + 3)) -- cgit v1.2.3 From e1fb18b9d4a3b4ab9783f58d78ff384141567a42 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 23 Nov 2021 11:49:32 +0300 Subject: Update documentation for functions Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Document functions for posterity. --- gn3/db/correlations.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index 7daff87..5c3e7b8 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -408,6 +408,10 @@ def build_query_sgo_lit_corr( """ Build query for `SGO Literature Correlation` data, when querying the given `temp_table` temporary table. + + This is a partial migration of the + `web.webqtl.correlation.CorrelationPage.fetchAllDatabaseData` function in + GeneNetwork1. """ return ( (f"SELECT {db_type}.Name, {temp_table}.value, " + @@ -424,6 +428,14 @@ def build_query_sgo_lit_corr( 2) def build_query_tissue_corr(db_type, temp_table, sample_id_columns, joins): + """ + Build query for `Tissue Correlation` data, when querying the given + `temp_table` temporary table. + + This is a partial migration of the + `web.webqtl.correlation.CorrelationPage.fetchAllDatabaseData` function in + GeneNetwork1. + """ return ( (f"SELECT {db_type}.Name, {temp_table}.Correlation, " + f"{temp_table}.PValue, " + -- cgit v1.2.3 From 845ab7696cdd7c7b2cdbd9b2b7f6b0a537d81117 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 23 Nov 2021 12:31:42 +0300 Subject: Migrate `getPartialCorrelationsNormal` Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Migrate the `web.webqtl.correlation.PartialCorrDBPage.getPartialCorrelationsNormal` function in GN1. * Remove function obsoleted by newer implementation of the code --- gn3/computations/partial_correlations.py | 60 +++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 16 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 4f45159..4bd26a2 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -200,22 +200,6 @@ def good_dataset_samples_indexes( samples_from_file.index(good) for good in set(samples).intersection(set(samples_from_file)))) -def determine_partials( - primary_vals, control_vals, all_target_trait_names, - all_target_trait_values, method): - """ - This **WILL** be a migration of - `web.webqtl.correlation.correlationFunction.determinePartialsByR` function - in GeneNetwork1. - - The function in GeneNetwork1 contains code written in R that is then used to - compute the partial correlations. - """ - ## This function is not implemented at this stage - return tuple( - primary_vals, control_vals, all_target_trait_names, - all_target_trait_values, method) - def compute_partial_correlations_fast(# pylint: disable=[R0913, R0914] samples, primary_vals, control_vals, database_filename, fetched_correlations, method: str, correlation_type: str) -> Tuple[ @@ -330,3 +314,47 @@ def compute_partial( return tuple( __compute_trait_info__(target) for target in zip(target_vals, target_names)) + +def partial_correlations_normal(# pylint: disable=R0913 + primary_vals, control_vals, input_trait_gene_id, trait_database, + data_start_pos: int, db_type: str, method: str) -> Tuple[ + float, Tuple[float, ...]]: + """ + Computes the correlation coefficients. + + This is a migration of the + `web.webqtl.correlation.PartialCorrDBPage.getPartialCorrelationsNormal` + function in GeneNetwork1. + """ + def __add_lit_and_tiss_corr__(item): + if method.lower() == "sgo literature correlation": + # if method is 'SGO Literature Correlation', `compute_partial` + # would give us LitCorr in the [1] position + return tuple(item) + trait_database[1] + if method.lower() in ( + "tissue correlation, pearson's r", + "tissue correlation, spearman's rho"): + # if method is 'Tissue Correlation, *', `compute_partial` would give + # us Tissue Corr in the [1] position and Tissue Corr P Value in the + # [2] position + return tuple(item) + (trait_database[1], trait_database[2]) + return item + + target_trait_names, target_trait_vals = reduce( + lambda acc, item: (acc[0]+(item[0],), acc[1]+(item[data_start_pos:],)), + trait_database, (tuple(), tuple())) + + all_correlations = compute_partial( + primary_vals, control_vals, target_trait_vals, target_trait_names, + method) + + if (input_trait_gene_id and db_type == "ProbeSet" and method.lower() in ( + "sgo literature correlation", "tissue correlation, pearson's r", + "tissue correlation, spearman's rho")): + return ( + len(trait_database), + tuple( + __add_lit_and_tiss_corr__(item) + for idx, item in enumerate(all_correlations))) + + return len(trait_database), all_correlations -- cgit v1.2.3 From df4ed9183f3efd89d54bba1a144c48475f4b8169 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 23 Nov 2021 12:34:44 +0300 Subject: Fix a myriad of linting errors * Fix linting errors like: - Unused variables - Undeclared variable errors (mostly caused by typos, and wrong names) - Missing documentation strings for functions etc. --- gn3/computations/partial_correlations.py | 4 +++- gn3/db/correlations.py | 24 ++++++++++++------------ tests/unit/db/test_correlation.py | 6 ++++++ 3 files changed, 21 insertions(+), 13 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 4bd26a2..f43c4d4 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -200,11 +200,13 @@ def good_dataset_samples_indexes( samples_from_file.index(good) for good in set(samples).intersection(set(samples_from_file)))) -def compute_partial_correlations_fast(# pylint: disable=[R0913, R0914] +def partial_correlations_fast(# pylint: disable=[R0913, R0914] samples, primary_vals, control_vals, database_filename, fetched_correlations, method: str, correlation_type: str) -> Tuple[ float, Tuple[float, ...]]: """ + Computes partial correlation coefficients using data from a CSV file. + This is a partial migration of the `web.webqtl.correlation.PartialCorrDBPage.getPartialCorrelationsFast` function in GeneNetwork1. diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index 5c3e7b8..a1daa3c 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -398,8 +398,8 @@ def fetch_sample_ids( "AND Species.name=%(species_name)s") with conn.cursor() as cursor: cursor.execute( - query, samples_names=tuple(samples), - species_name=species) + query, samples_names=tuple(sample_names), + species_name=species_name) return cursor.fetchall() def build_query_sgo_lit_corr( @@ -419,7 +419,7 @@ def build_query_sgo_lit_corr( f" FROM ({db_type}, {db_type}XRef, {db_type}Freeze) " + f"LEFT JOIN {temp_table} ON {temp_table}.GeneId2=ProbeSet.GeneId " + " ".join(joins) + - f" WHERE ProbeSet.GeneId IS NOT NULL " + + " WHERE ProbeSet.GeneId IS NOT NULL " + f"AND {temp_table}.value IS NOT NULL " + f"AND {db_type}XRef.{db_type}FreezeId = {db_type}Freeze.Id " + f"AND {db_type}Freeze.Name = %(db_name)s " + @@ -443,7 +443,7 @@ def build_query_tissue_corr(db_type, temp_table, sample_id_columns, joins): f" FROM ({db_type}, {db_type}XRef, {db_type}Freeze) " + f"LEFT JOIN {temp_table} ON {temp_table}.Symbol=ProbeSet.Symbol " + " ".join(joins) + - f" WHERE ProbeSet.Symbol IS NOT NULL " + + " WHERE ProbeSet.Symbol IS NOT NULL " + f"AND {temp_table}.Correlation IS NOT NULL " + f"AND {db_type}XRef.{db_type}FreezeId = {db_type}Freeze.Id " + f"AND {db_type}Freeze.Name = %(db_name)s " + @@ -451,17 +451,17 @@ def build_query_tissue_corr(db_type, temp_table, sample_id_columns, joins): f"ORDER BY {db_type}.Id"), 3) -def fetch_all_database_data( - conn: Any, species: str, gene_id: int, gene_symbol: str, +def fetch_all_database_data(# pylint: disable=[R0913, R0914] + conn: Any, species: str, gene_id: int, trait_symbol: str, samples: Tuple[str, ...], db_type: str, db_name: str, method: str, - returnNumber: int, tissueProbeSetFreezeId: int) -> Tuple[Any, Any]: + return_number: int, probeset_freeze_id: int) -> Tuple[Any, Any]: """ This is a migration of the `web.webqtl.correlation.CorrelationPage.fetchAllDatabaseData` function in GeneNetwork1. """ def __build_query__(sample_ids, temp_table): - sample_id_columns = ", ".join(f"T{smpl}.value" for smpl in samples_ids) + sample_id_columns = ", ".join(f"T{smpl}.value" for smpl in sample_ids) if db_type == "Publish": joins = tuple( ("LEFT JOIN PublishData AS T{item} " @@ -484,12 +484,12 @@ def fetch_all_database_data( for item in sample_ids) if method.lower() == "sgo literature correlation": return build_query_sgo_lit_corr( - sample_ids, temp_table, sample_id_columns) + sample_ids, temp_table, sample_id_columns, joins) if method.lower() in ( "tissue correlation, pearson's r", "tissue correlation, spearman's rho"): return build_query_tissue_corr( - sample_ids, temp_table, sample_id_columns) + sample_ids, temp_table, sample_id_columns, joins) joins = tuple( (f"LEFT JOIN {db_type}Data AS T{item} " f"ON T{item}.Id = {db_type}XRef.DataId " @@ -513,7 +513,7 @@ def fetch_all_database_data( cursor.execute( query, db_name=db_name, **{f"T{item}_sample_id": item for item in sample_ids}) - return cursor.fetchall() + return (cursor.fetchall(), data_start_pos) sample_ids = tuple( # look into graduating this to an argument and removing the `samples` @@ -543,4 +543,4 @@ def fetch_all_database_data( with conn.cursor() as cursor: cursor.execute(f"DROP TEMPORARY TABLE {temp_table}") - return trait_database, data_start_pos + return (tuple(item[0] for item in trait_database), trait_database[0][1]) diff --git a/tests/unit/db/test_correlation.py b/tests/unit/db/test_correlation.py index 866d28d..3f940b2 100644 --- a/tests/unit/db/test_correlation.py +++ b/tests/unit/db/test_correlation.py @@ -13,6 +13,9 @@ class TestCorrelation(TestCase): maxDiff = None def test_build_query_sgo_lit_corr(self): + """ + Test that the literature correlation query is built correctly. + """ self.assertEqual( build_query_sgo_lit_corr( "Probeset", @@ -51,6 +54,9 @@ class TestCorrelation(TestCase): 2)) def test_build_query_tissue_corr(self): + """ + Test that the tissue correlation query is built correctly. + """ self.assertEqual( build_query_tissue_corr( "Probeset", -- cgit v1.2.3 From a6d61f58dc07ba307698c90befab28bcaf691966 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Tue, 23 Nov 2021 17:32:41 +0300 Subject: db: traits: Remove "\n\n" when generating csv file In excel, "\n\n" is replaced with ",,,," during upload. --- gn3/db/traits.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/db/traits.py b/gn3/db/traits.py index 1c6aaa7..56258e2 100644 --- a/gn3/db/traits.py +++ b/gn3/db/traits.py @@ -103,7 +103,7 @@ def get_trait_csv_sample_data(conn: Any, ",".join([str(val) if val else "x" for val in (strain_id, strain_name, value, error, count)])) - return f"# Publish Data Id: {publishdata_id}\n\n" + "\n".join(csv_data) + return f"# Publish Data Id: {publishdata_id}\n" + "\n".join(csv_data) def update_sample_data(conn: Any, -- cgit v1.2.3 From 6675388cfee2fb85b78f9310dd72f2c95c8ea41b Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 24 Nov 2021 11:32:49 +0300 Subject: db: traits: Remove trailing ".0" in int values --- gn3/db/traits.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/db/traits.py b/gn3/db/traits.py index 56258e2..ebb7e3c 100644 --- a/gn3/db/traits.py +++ b/gn3/db/traits.py @@ -79,6 +79,11 @@ def export_trait_data( def get_trait_csv_sample_data(conn: Any, trait_name: int, phenotype_id: int): """Fetch a trait and return it as a csv string""" + + def __float_strip(n): + if str(n)[-2:] == ".0": + return str(int(n)) + return str(n) sql = ("SELECT DISTINCT Strain.Id, PublishData.Id, Strain.Name, " "PublishData.value, " "PublishSE.error, NStrain.count FROM " @@ -100,7 +105,7 @@ def get_trait_csv_sample_data(conn: Any, (strain_id, publishdata_id, strain_name, value, error, count) = record csv_data.append( - ",".join([str(val) if val else "x" + ",".join([__float_strip(val) if val else "x" for val in (strain_id, strain_name, value, error, count)])) return f"# Publish Data Id: {publishdata_id}\n" + "\n".join(csv_data) -- cgit v1.2.3 From a1516993c7f6dc608f75ba42cb27b983e0c5c330 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 25 Nov 2021 20:52:14 +0300 Subject: db: traits: Support additions and deletions from csv file --- gn3/db/traits.py | 238 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 193 insertions(+), 45 deletions(-) (limited to 'gn3') diff --git a/gn3/db/traits.py b/gn3/db/traits.py index ebb7e3c..75de4f4 100644 --- a/gn3/db/traits.py +++ b/gn3/db/traits.py @@ -1,5 +1,6 @@ """This class contains functions relating to trait data manipulation""" import os +import MySQLdb from functools import reduce from typing import Any, Dict, Union, Sequence @@ -76,16 +77,15 @@ def export_trait_data( return reduce(__exporter, samplelist, tuple()) + def get_trait_csv_sample_data(conn: Any, trait_name: int, phenotype_id: int): """Fetch a trait and return it as a csv string""" - def __float_strip(n): if str(n)[-2:] == ".0": return str(int(n)) return str(n) - sql = ("SELECT DISTINCT Strain.Id, PublishData.Id, Strain.Name, " - "PublishData.value, " + sql = ("SELECT DISTINCT Strain.Name, PublishData.value, " "PublishSE.error, NStrain.count FROM " "(PublishData, Strain, PublishXRef, PublishFreeze) " "LEFT JOIN PublishSE ON " @@ -97,65 +97,188 @@ def get_trait_csv_sample_data(conn: Any, "PublishData.Id = PublishXRef.DataId AND " "PublishXRef.Id = %s AND PublishXRef.PhenotypeId = %s " "AND PublishData.StrainId = Strain.Id Order BY Strain.Name") - csv_data = ["Strain Id,Strain Name,Value,SE,Count"] - publishdata_id = "" + csv_data = ["Strain Name,Value,SE,Count"] with conn.cursor() as cursor: cursor.execute(sql, (trait_name, phenotype_id,)) for record in cursor.fetchall(): - (strain_id, publishdata_id, - strain_name, value, error, count) = record + (strain_name, value, error, count) = record csv_data.append( ",".join([__float_strip(val) if val else "x" - for val in (strain_id, strain_name, - value, error, count)])) - return f"# Publish Data Id: {publishdata_id}\n" + "\n".join(csv_data) + for val in (strain_name, value, error, count)])) + return "\n".join(csv_data) def update_sample_data(conn: Any, + trait_name: str, strain_name: str, - strain_id: int, - publish_data_id: int, + phenotype_id: int, value: Union[int, float, str], error: Union[int, float, str], count: Union[int, str]): """Given the right parameters, update sample-data from the relevant table.""" - # pylint: disable=[R0913, R0914, C0103] - STRAIN_ID_SQL: str = "UPDATE Strain SET Name = %s WHERE Id = %s" - PUBLISH_DATA_SQL: str = ("UPDATE PublishData SET value = %s " - "WHERE StrainId = %s AND Id = %s") - PUBLISH_SE_SQL: str = ("UPDATE PublishSE SET error = %s " - "WHERE StrainId = %s AND DataId = %s") - N_STRAIN_SQL: str = ("UPDATE NStrain SET count = %s " - "WHERE StrainId = %s AND DataId = %s") - - updated_strains: int = 0 + strain_id, data_id = "", "" + + with conn.cursor() as cursor: + cursor.execute( + ("SELECT Strain.Id, PublishData.Id FROM " + "(PublishData, Strain, PublishXRef, PublishFreeze) " + "LEFT JOIN PublishSE ON " + "(PublishSE.DataId = PublishData.Id AND " + "PublishSE.StrainId = PublishData.StrainId) " + "LEFT JOIN NStrain ON " + "(NStrain.DataId = PublishData.Id AND " + "NStrain.StrainId = PublishData.StrainId) " + "WHERE PublishXRef.InbredSetId = " + "PublishFreeze.InbredSetId AND " + "PublishData.Id = PublishXRef.DataId AND " + "PublishXRef.Id = %s AND " + "PublishXRef.PhenotypeId = %s " + "AND PublishData.StrainId = Strain.Id " + "AND Strain.Name = \"%s\"") % (trait_name, + phenotype_id, + str(strain_name))) + strain_id, data_id = cursor.fetchone() updated_published_data: int = 0 updated_se_data: int = 0 updated_n_strains: int = 0 with conn.cursor() as cursor: - # Update the Strains table - cursor.execute(STRAIN_ID_SQL, (strain_name, strain_id)) - updated_strains = cursor.rowcount # Update the PublishData table - cursor.execute(PUBLISH_DATA_SQL, + cursor.execute(("UPDATE PublishData SET value = %s " + "WHERE StrainId = %s AND Id = %s"), (None if value == "x" else value, - strain_id, publish_data_id)) + strain_id, data_id)) updated_published_data = cursor.rowcount + # Update the PublishSE table - cursor.execute(PUBLISH_SE_SQL, + cursor.execute(("UPDATE PublishSE SET error = %s " + "WHERE StrainId = %s AND DataId = %s"), (None if error == "x" else error, - strain_id, publish_data_id)) + strain_id, data_id)) updated_se_data = cursor.rowcount + # Update the NStrain table - cursor.execute(N_STRAIN_SQL, + cursor.execute(("UPDATE NStrain SET count = %s " + "WHERE StrainId = %s AND DataId = %s"), (None if count == "x" else count, - strain_id, publish_data_id)) + strain_id, data_id)) updated_n_strains = cursor.rowcount - return (updated_strains, updated_published_data, + return (updated_published_data, updated_se_data, updated_n_strains) + +def delete_sample_data(conn: Any, + trait_name: str, + strain_name: str, + phenotype_id: int): + """Given the right parameters, delete sample-data from the relevant + table.""" + strain_id, data_id = "", "" + + deleted_published_data: int = 0 + deleted_se_data: int = 0 + deleted_n_strains: int = 0 + + with conn.cursor() as cursor: + # Delete the PublishData table + try: + cursor.execute( + ("SELECT Strain.Id, PublishData.Id FROM " + "(PublishData, Strain, PublishXRef, PublishFreeze) " + "LEFT JOIN PublishSE ON " + "(PublishSE.DataId = PublishData.Id AND " + "PublishSE.StrainId = PublishData.StrainId) " + "LEFT JOIN NStrain ON " + "(NStrain.DataId = PublishData.Id AND " + "NStrain.StrainId = PublishData.StrainId) " + "WHERE PublishXRef.InbredSetId = " + "PublishFreeze.InbredSetId AND " + "PublishData.Id = PublishXRef.DataId AND " + "PublishXRef.Id = %s AND " + "PublishXRef.PhenotypeId = %s " + "AND PublishData.StrainId = Strain.Id " + "AND Strain.Name = \"%s\"") % (trait_name, + phenotype_id, + str(strain_name))) + strain_id, data_id = cursor.fetchone() + + cursor.execute(("DELETE FROM PublishData " + "WHERE StrainId = %s AND Id = %s") + % (strain_id, data_id)) + deleted_published_data = cursor.rowcount + + # Delete the PublishSE table + cursor.execute(("DELETE FROM PublishSE " + "WHERE StrainId = %s AND DataId = %s") % + (strain_id, data_id)) + deleted_se_data = cursor.rowcount + + # Delete the NStrain table + cursor.execute(("DELETE FROM NStrain " + "WHERE StrainId = %s AND DataId = %s" % + (strain_id, data_id))) + deleted_n_strains = cursor.rowcount + except Exception as e: + conn.rollback() + raise MySQLdb.Error + conn.commit() + cursor.close() + cursor.close() + + return (deleted_published_data, + deleted_se_data, deleted_n_strains) + + +def insert_sample_data(conn: Any, + trait_name: str, + strain_name: str, + phenotype_id: int, + value: Union[int, float, str], + error: Union[int, float, str], + count: Union[int, str]): + """Given the right parameters, insert sample-data to the relevant table. + + """ + + inserted_published_data, inserted_se_data, inserted_n_strains = 0, 0, 0 + with conn.cursor() as cursor: + try: + cursor.execute("SELECT DataId FROM PublishXRef WHERE Id = %s AND " + "PhenotypeId = %s", (trait_name, phenotype_id)) + data_id = cursor.fetchone() + + cursor.execute("SELECT Id FROM Strain WHERE Name = %s", + (strain_name,)) + strain_id = cursor.fetchone() + + # Insert the PublishData table + cursor.execute(("INSERT INTO PublishData (Id, StrainId, value)" + "VALUES (%s, %s, %s)"), + (data_id, strain_id, value)) + inserted_published_data = cursor.rowcount + + # Insert into the PublishSE table if error is specified + if error and error != "x": + cursor.execute(("INSERT INTO PublishSE (StrainId, DataId, " + " error) VALUES (%s, %s, %s)") % + (strain_id, data_id, error)) + inserted_se_data = cursor.rowcount + + # Insert into the NStrain table + if count and count != "x": + cursor.execute(("INSERT INTO NStrain " + "(StrainId, DataId, error) " + "VALUES (%s, %s, %s)") % + (strain_id, data_id, count)) + inserted_n_strains = cursor.rowcount + except Exception as e: + conn.rollback() + raise MySQLdb.Error + return (inserted_published_data, + inserted_se_data, inserted_n_strains) + + def retrieve_publish_trait_info(trait_data_source: Dict[str, Any], conn: Any): """Retrieve trait information for type `Publish` traits. @@ -195,11 +318,12 @@ def retrieve_publish_trait_info(trait_data_source: Dict[str, Any], conn: Any): cursor.execute( query, { - k:v for k, v in trait_data_source.items() + k: v for k, v in trait_data_source.items() if k in ["trait_name", "trait_dataset_id"] }) return dict(zip([k.lower() for k in keys], cursor.fetchone())) + def set_confidential_field(trait_type, trait_info): """Post processing function for 'Publish' trait types. @@ -212,6 +336,7 @@ def set_confidential_field(trait_type, trait_info): and not trait_info.get("pubmed_id", None)) else 0} return trait_info + def retrieve_probeset_trait_info(trait_data_source: Dict[str, Any], conn: Any): """Retrieve trait information for type `ProbeSet` traits. @@ -239,11 +364,12 @@ def retrieve_probeset_trait_info(trait_data_source: Dict[str, Any], conn: Any): cursor.execute( query, { - k:v for k, v in trait_data_source.items() + k: v for k, v in trait_data_source.items() if k in ["trait_name", "trait_dataset_name"] }) return dict(zip(keys, cursor.fetchone())) + def retrieve_geno_trait_info(trait_data_source: Dict[str, Any], conn: Any): """Retrieve trait information for type `Geno` traits. @@ -263,11 +389,12 @@ def retrieve_geno_trait_info(trait_data_source: Dict[str, Any], conn: Any): cursor.execute( query, { - k:v for k, v in trait_data_source.items() + k: v for k, v in trait_data_source.items() if k in ["trait_name", "trait_dataset_name"] }) return dict(zip(keys, cursor.fetchone())) + def retrieve_temp_trait_info(trait_data_source: Dict[str, Any], conn: Any): """Retrieve trait information for type `Temp` traits. @@ -280,11 +407,12 @@ def retrieve_temp_trait_info(trait_data_source: Dict[str, Any], conn: Any): cursor.execute( query, { - k:v for k, v in trait_data_source.items() + k: v for k, v in trait_data_source.items() if k in ["trait_name"] }) return dict(zip(keys, cursor.fetchone())) + def set_haveinfo_field(trait_info): """ Common postprocessing function for all trait types. @@ -292,6 +420,7 @@ def set_haveinfo_field(trait_info): Sets the value for the 'haveinfo' field.""" return {**trait_info, "haveinfo": 1 if trait_info else 0} + def set_homologene_id_field_probeset(trait_info, conn): """ Postprocessing function for 'ProbeSet' traits. @@ -307,7 +436,7 @@ def set_homologene_id_field_probeset(trait_info, conn): cursor.execute( query, { - k:v for k, v in trait_info.items() + k: v for k, v in trait_info.items() if k in ["geneid", "group"] }) res = cursor.fetchone() @@ -315,12 +444,13 @@ def set_homologene_id_field_probeset(trait_info, conn): return {**trait_info, "homologeneid": res[0]} return {**trait_info, "homologeneid": None} + def set_homologene_id_field(trait_type, trait_info, conn): """ Common postprocessing function for all trait types. Sets the value for the 'homologene' key.""" - set_to_null = lambda ti: {**ti, "homologeneid": None} + def set_to_null(ti): return {**ti, "homologeneid": None} functions_table = { "Temp": set_to_null, "Geno": set_to_null, @@ -329,6 +459,7 @@ def set_homologene_id_field(trait_type, trait_info, conn): } return functions_table[trait_type](trait_info) + def load_publish_qtl_info(trait_info, conn): """ Load extra QTL information for `Publish` traits @@ -349,6 +480,7 @@ def load_publish_qtl_info(trait_info, conn): return dict(zip(["locus", "lrs", "additive"], cursor.fetchone())) return {"locus": "", "lrs": "", "additive": ""} + def load_probeset_qtl_info(trait_info, conn): """ Load extra QTL information for `ProbeSet` traits @@ -371,6 +503,7 @@ def load_probeset_qtl_info(trait_info, conn): ["locus", "lrs", "pvalue", "mean", "additive"], cursor.fetchone())) return {"locus": "", "lrs": "", "pvalue": "", "mean": "", "additive": ""} + def load_qtl_info(qtl, trait_type, trait_info, conn): """ Load extra QTL information for traits @@ -399,6 +532,7 @@ def load_qtl_info(qtl, trait_type, trait_info, conn): return qtl_info_functions[trait_type](trait_info, conn) + def build_trait_name(trait_fullname): """ Initialises the trait's name, and other values from the search data provided @@ -425,6 +559,7 @@ def build_trait_name(trait_fullname): "cellid": name_parts[2] if len(name_parts) == 3 else "" } + def retrieve_probeset_sequence(trait, conn): """ Retrieve a 'ProbeSet' trait's sequence information @@ -446,6 +581,7 @@ def retrieve_probeset_sequence(trait, conn): seq = cursor.fetchone() return {**trait, "sequence": seq[0] if seq else ""} + def retrieve_trait_info( threshold: int, trait_full_name: str, conn: Any, qtl=None): @@ -501,6 +637,7 @@ def retrieve_trait_info( } return trait_info + def retrieve_temp_trait_data(trait_info: dict, conn: Any): """ Retrieve trait data for `Temp` traits. @@ -520,9 +657,10 @@ def retrieve_temp_trait_data(trait_info: dict, conn: Any): {"trait_name": trait_info["trait_name"]}) return [dict(zip( ["sample_name", "value", "se_error", "nstrain", "id"], row)) - for row in cursor.fetchall()] + for row in cursor.fetchall()] return [] + def retrieve_species_id(group, conn: Any): """ Retrieve a species id given the Group value @@ -534,6 +672,7 @@ def retrieve_species_id(group, conn: Any): return cursor.fetchone()[0] return None + def retrieve_geno_trait_data(trait_info: Dict, conn: Any): """ Retrieve trait data for `Geno` traits. @@ -559,9 +698,10 @@ def retrieve_geno_trait_data(trait_info: Dict, conn: Any): trait_info["db"]["group"], conn)}) return [dict(zip( ["sample_name", "value", "se_error", "id"], row)) - for row in cursor.fetchall()] + for row in cursor.fetchall()] return [] + def retrieve_publish_trait_data(trait_info: Dict, conn: Any): """ Retrieve trait data for `Publish` traits. @@ -590,9 +730,10 @@ def retrieve_publish_trait_data(trait_info: Dict, conn: Any): "dataset_id": trait_info["db"]["dataset_id"]}) return [dict(zip( ["sample_name", "value", "se_error", "nstrain", "id"], row)) - for row in cursor.fetchall()] + for row in cursor.fetchall()] return [] + def retrieve_cellid_trait_data(trait_info: Dict, conn: Any): """ Retrieve trait data for `Probe Data` types. @@ -623,9 +764,10 @@ def retrieve_cellid_trait_data(trait_info: Dict, conn: Any): "dataset_id": trait_info["db"]["dataset_id"]}) return [dict(zip( ["sample_name", "value", "se_error", "id"], row)) - for row in cursor.fetchall()] + for row in cursor.fetchall()] return [] + def retrieve_probeset_trait_data(trait_info: Dict, conn: Any): """ Retrieve trait data for `ProbeSet` traits. @@ -652,9 +794,10 @@ def retrieve_probeset_trait_data(trait_info: Dict, conn: Any): "dataset_name": trait_info["db"]["dataset_name"]}) return [dict(zip( ["sample_name", "value", "se_error", "id"], row)) - for row in cursor.fetchall()] + for row in cursor.fetchall()] return [] + def with_samplelist_data_setup(samplelist: Sequence[str]): """ Build function that computes the trait data from provided list of samples. @@ -681,6 +824,7 @@ def with_samplelist_data_setup(samplelist: Sequence[str]): return None return setup_fn + def without_samplelist_data_setup(): """ Build function that computes the trait data. @@ -701,6 +845,7 @@ def without_samplelist_data_setup(): return None return setup_fn + def retrieve_trait_data(trait: dict, conn: Any, samplelist: Sequence[str] = tuple()): """ Retrieve trait data @@ -740,15 +885,17 @@ def retrieve_trait_data(trait: dict, conn: Any, samplelist: Sequence[str] = tupl "data": dict(map( lambda x: ( x["sample_name"], - {k:v for k, v in x.items() if x != "sample_name"}), + {k: v for k, v in x.items() if x != "sample_name"}), data))} return {} + def generate_traits_filename(base_path: str = TMPDIR): """Generate a unique filename for use with generated traits files.""" return "{}/traits_test_file_{}.txt".format( os.path.abspath(base_path), random_string(10)) + def export_informative(trait_data: dict, inc_var: bool = False) -> tuple: """ Export informative strain @@ -770,5 +917,6 @@ def export_informative(trait_data: dict, inc_var: bool = False) -> tuple: return acc return reduce( __exporter__, - filter(lambda td: td["value"] is not None, trait_data["data"].values()), + filter(lambda td: td["value"] is not None, + trait_data["data"].values()), (tuple(), tuple(), tuple())) -- cgit v1.2.3 From b8067b3a5e4c6891d0a0a99e23e03ac12d68d649 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Tue, 23 Nov 2021 17:32:41 +0300 Subject: db: traits: Remove "\n\n" when generating csv file In excel, "\n\n" is replaced with ",,,," during upload. --- gn3/db/traits.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/db/traits.py b/gn3/db/traits.py index 1c6aaa7..56258e2 100644 --- a/gn3/db/traits.py +++ b/gn3/db/traits.py @@ -103,7 +103,7 @@ def get_trait_csv_sample_data(conn: Any, ",".join([str(val) if val else "x" for val in (strain_id, strain_name, value, error, count)])) - return f"# Publish Data Id: {publishdata_id}\n\n" + "\n".join(csv_data) + return f"# Publish Data Id: {publishdata_id}\n" + "\n".join(csv_data) def update_sample_data(conn: Any, -- cgit v1.2.3 From 8210007122c26daffcfbbb159ff846b928dfb18d Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 24 Nov 2021 11:32:49 +0300 Subject: db: traits: Remove trailing ".0" in int values --- gn3/db/traits.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/db/traits.py b/gn3/db/traits.py index 56258e2..ebb7e3c 100644 --- a/gn3/db/traits.py +++ b/gn3/db/traits.py @@ -79,6 +79,11 @@ def export_trait_data( def get_trait_csv_sample_data(conn: Any, trait_name: int, phenotype_id: int): """Fetch a trait and return it as a csv string""" + + def __float_strip(n): + if str(n)[-2:] == ".0": + return str(int(n)) + return str(n) sql = ("SELECT DISTINCT Strain.Id, PublishData.Id, Strain.Name, " "PublishData.value, " "PublishSE.error, NStrain.count FROM " @@ -100,7 +105,7 @@ def get_trait_csv_sample_data(conn: Any, (strain_id, publishdata_id, strain_name, value, error, count) = record csv_data.append( - ",".join([str(val) if val else "x" + ",".join([__float_strip(val) if val else "x" for val in (strain_id, strain_name, value, error, count)])) return f"# Publish Data Id: {publishdata_id}\n" + "\n".join(csv_data) -- cgit v1.2.3 From 6a3ee25e241bd4984c6959e2ccc1e569b53d6486 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 25 Nov 2021 20:52:14 +0300 Subject: db: traits: Support additions and deletions from csv file --- gn3/db/traits.py | 238 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 193 insertions(+), 45 deletions(-) (limited to 'gn3') diff --git a/gn3/db/traits.py b/gn3/db/traits.py index ebb7e3c..75de4f4 100644 --- a/gn3/db/traits.py +++ b/gn3/db/traits.py @@ -1,5 +1,6 @@ """This class contains functions relating to trait data manipulation""" import os +import MySQLdb from functools import reduce from typing import Any, Dict, Union, Sequence @@ -76,16 +77,15 @@ def export_trait_data( return reduce(__exporter, samplelist, tuple()) + def get_trait_csv_sample_data(conn: Any, trait_name: int, phenotype_id: int): """Fetch a trait and return it as a csv string""" - def __float_strip(n): if str(n)[-2:] == ".0": return str(int(n)) return str(n) - sql = ("SELECT DISTINCT Strain.Id, PublishData.Id, Strain.Name, " - "PublishData.value, " + sql = ("SELECT DISTINCT Strain.Name, PublishData.value, " "PublishSE.error, NStrain.count FROM " "(PublishData, Strain, PublishXRef, PublishFreeze) " "LEFT JOIN PublishSE ON " @@ -97,65 +97,188 @@ def get_trait_csv_sample_data(conn: Any, "PublishData.Id = PublishXRef.DataId AND " "PublishXRef.Id = %s AND PublishXRef.PhenotypeId = %s " "AND PublishData.StrainId = Strain.Id Order BY Strain.Name") - csv_data = ["Strain Id,Strain Name,Value,SE,Count"] - publishdata_id = "" + csv_data = ["Strain Name,Value,SE,Count"] with conn.cursor() as cursor: cursor.execute(sql, (trait_name, phenotype_id,)) for record in cursor.fetchall(): - (strain_id, publishdata_id, - strain_name, value, error, count) = record + (strain_name, value, error, count) = record csv_data.append( ",".join([__float_strip(val) if val else "x" - for val in (strain_id, strain_name, - value, error, count)])) - return f"# Publish Data Id: {publishdata_id}\n" + "\n".join(csv_data) + for val in (strain_name, value, error, count)])) + return "\n".join(csv_data) def update_sample_data(conn: Any, + trait_name: str, strain_name: str, - strain_id: int, - publish_data_id: int, + phenotype_id: int, value: Union[int, float, str], error: Union[int, float, str], count: Union[int, str]): """Given the right parameters, update sample-data from the relevant table.""" - # pylint: disable=[R0913, R0914, C0103] - STRAIN_ID_SQL: str = "UPDATE Strain SET Name = %s WHERE Id = %s" - PUBLISH_DATA_SQL: str = ("UPDATE PublishData SET value = %s " - "WHERE StrainId = %s AND Id = %s") - PUBLISH_SE_SQL: str = ("UPDATE PublishSE SET error = %s " - "WHERE StrainId = %s AND DataId = %s") - N_STRAIN_SQL: str = ("UPDATE NStrain SET count = %s " - "WHERE StrainId = %s AND DataId = %s") - - updated_strains: int = 0 + strain_id, data_id = "", "" + + with conn.cursor() as cursor: + cursor.execute( + ("SELECT Strain.Id, PublishData.Id FROM " + "(PublishData, Strain, PublishXRef, PublishFreeze) " + "LEFT JOIN PublishSE ON " + "(PublishSE.DataId = PublishData.Id AND " + "PublishSE.StrainId = PublishData.StrainId) " + "LEFT JOIN NStrain ON " + "(NStrain.DataId = PublishData.Id AND " + "NStrain.StrainId = PublishData.StrainId) " + "WHERE PublishXRef.InbredSetId = " + "PublishFreeze.InbredSetId AND " + "PublishData.Id = PublishXRef.DataId AND " + "PublishXRef.Id = %s AND " + "PublishXRef.PhenotypeId = %s " + "AND PublishData.StrainId = Strain.Id " + "AND Strain.Name = \"%s\"") % (trait_name, + phenotype_id, + str(strain_name))) + strain_id, data_id = cursor.fetchone() updated_published_data: int = 0 updated_se_data: int = 0 updated_n_strains: int = 0 with conn.cursor() as cursor: - # Update the Strains table - cursor.execute(STRAIN_ID_SQL, (strain_name, strain_id)) - updated_strains = cursor.rowcount # Update the PublishData table - cursor.execute(PUBLISH_DATA_SQL, + cursor.execute(("UPDATE PublishData SET value = %s " + "WHERE StrainId = %s AND Id = %s"), (None if value == "x" else value, - strain_id, publish_data_id)) + strain_id, data_id)) updated_published_data = cursor.rowcount + # Update the PublishSE table - cursor.execute(PUBLISH_SE_SQL, + cursor.execute(("UPDATE PublishSE SET error = %s " + "WHERE StrainId = %s AND DataId = %s"), (None if error == "x" else error, - strain_id, publish_data_id)) + strain_id, data_id)) updated_se_data = cursor.rowcount + # Update the NStrain table - cursor.execute(N_STRAIN_SQL, + cursor.execute(("UPDATE NStrain SET count = %s " + "WHERE StrainId = %s AND DataId = %s"), (None if count == "x" else count, - strain_id, publish_data_id)) + strain_id, data_id)) updated_n_strains = cursor.rowcount - return (updated_strains, updated_published_data, + return (updated_published_data, updated_se_data, updated_n_strains) + +def delete_sample_data(conn: Any, + trait_name: str, + strain_name: str, + phenotype_id: int): + """Given the right parameters, delete sample-data from the relevant + table.""" + strain_id, data_id = "", "" + + deleted_published_data: int = 0 + deleted_se_data: int = 0 + deleted_n_strains: int = 0 + + with conn.cursor() as cursor: + # Delete the PublishData table + try: + cursor.execute( + ("SELECT Strain.Id, PublishData.Id FROM " + "(PublishData, Strain, PublishXRef, PublishFreeze) " + "LEFT JOIN PublishSE ON " + "(PublishSE.DataId = PublishData.Id AND " + "PublishSE.StrainId = PublishData.StrainId) " + "LEFT JOIN NStrain ON " + "(NStrain.DataId = PublishData.Id AND " + "NStrain.StrainId = PublishData.StrainId) " + "WHERE PublishXRef.InbredSetId = " + "PublishFreeze.InbredSetId AND " + "PublishData.Id = PublishXRef.DataId AND " + "PublishXRef.Id = %s AND " + "PublishXRef.PhenotypeId = %s " + "AND PublishData.StrainId = Strain.Id " + "AND Strain.Name = \"%s\"") % (trait_name, + phenotype_id, + str(strain_name))) + strain_id, data_id = cursor.fetchone() + + cursor.execute(("DELETE FROM PublishData " + "WHERE StrainId = %s AND Id = %s") + % (strain_id, data_id)) + deleted_published_data = cursor.rowcount + + # Delete the PublishSE table + cursor.execute(("DELETE FROM PublishSE " + "WHERE StrainId = %s AND DataId = %s") % + (strain_id, data_id)) + deleted_se_data = cursor.rowcount + + # Delete the NStrain table + cursor.execute(("DELETE FROM NStrain " + "WHERE StrainId = %s AND DataId = %s" % + (strain_id, data_id))) + deleted_n_strains = cursor.rowcount + except Exception as e: + conn.rollback() + raise MySQLdb.Error + conn.commit() + cursor.close() + cursor.close() + + return (deleted_published_data, + deleted_se_data, deleted_n_strains) + + +def insert_sample_data(conn: Any, + trait_name: str, + strain_name: str, + phenotype_id: int, + value: Union[int, float, str], + error: Union[int, float, str], + count: Union[int, str]): + """Given the right parameters, insert sample-data to the relevant table. + + """ + + inserted_published_data, inserted_se_data, inserted_n_strains = 0, 0, 0 + with conn.cursor() as cursor: + try: + cursor.execute("SELECT DataId FROM PublishXRef WHERE Id = %s AND " + "PhenotypeId = %s", (trait_name, phenotype_id)) + data_id = cursor.fetchone() + + cursor.execute("SELECT Id FROM Strain WHERE Name = %s", + (strain_name,)) + strain_id = cursor.fetchone() + + # Insert the PublishData table + cursor.execute(("INSERT INTO PublishData (Id, StrainId, value)" + "VALUES (%s, %s, %s)"), + (data_id, strain_id, value)) + inserted_published_data = cursor.rowcount + + # Insert into the PublishSE table if error is specified + if error and error != "x": + cursor.execute(("INSERT INTO PublishSE (StrainId, DataId, " + " error) VALUES (%s, %s, %s)") % + (strain_id, data_id, error)) + inserted_se_data = cursor.rowcount + + # Insert into the NStrain table + if count and count != "x": + cursor.execute(("INSERT INTO NStrain " + "(StrainId, DataId, error) " + "VALUES (%s, %s, %s)") % + (strain_id, data_id, count)) + inserted_n_strains = cursor.rowcount + except Exception as e: + conn.rollback() + raise MySQLdb.Error + return (inserted_published_data, + inserted_se_data, inserted_n_strains) + + def retrieve_publish_trait_info(trait_data_source: Dict[str, Any], conn: Any): """Retrieve trait information for type `Publish` traits. @@ -195,11 +318,12 @@ def retrieve_publish_trait_info(trait_data_source: Dict[str, Any], conn: Any): cursor.execute( query, { - k:v for k, v in trait_data_source.items() + k: v for k, v in trait_data_source.items() if k in ["trait_name", "trait_dataset_id"] }) return dict(zip([k.lower() for k in keys], cursor.fetchone())) + def set_confidential_field(trait_type, trait_info): """Post processing function for 'Publish' trait types. @@ -212,6 +336,7 @@ def set_confidential_field(trait_type, trait_info): and not trait_info.get("pubmed_id", None)) else 0} return trait_info + def retrieve_probeset_trait_info(trait_data_source: Dict[str, Any], conn: Any): """Retrieve trait information for type `ProbeSet` traits. @@ -239,11 +364,12 @@ def retrieve_probeset_trait_info(trait_data_source: Dict[str, Any], conn: Any): cursor.execute( query, { - k:v for k, v in trait_data_source.items() + k: v for k, v in trait_data_source.items() if k in ["trait_name", "trait_dataset_name"] }) return dict(zip(keys, cursor.fetchone())) + def retrieve_geno_trait_info(trait_data_source: Dict[str, Any], conn: Any): """Retrieve trait information for type `Geno` traits. @@ -263,11 +389,12 @@ def retrieve_geno_trait_info(trait_data_source: Dict[str, Any], conn: Any): cursor.execute( query, { - k:v for k, v in trait_data_source.items() + k: v for k, v in trait_data_source.items() if k in ["trait_name", "trait_dataset_name"] }) return dict(zip(keys, cursor.fetchone())) + def retrieve_temp_trait_info(trait_data_source: Dict[str, Any], conn: Any): """Retrieve trait information for type `Temp` traits. @@ -280,11 +407,12 @@ def retrieve_temp_trait_info(trait_data_source: Dict[str, Any], conn: Any): cursor.execute( query, { - k:v for k, v in trait_data_source.items() + k: v for k, v in trait_data_source.items() if k in ["trait_name"] }) return dict(zip(keys, cursor.fetchone())) + def set_haveinfo_field(trait_info): """ Common postprocessing function for all trait types. @@ -292,6 +420,7 @@ def set_haveinfo_field(trait_info): Sets the value for the 'haveinfo' field.""" return {**trait_info, "haveinfo": 1 if trait_info else 0} + def set_homologene_id_field_probeset(trait_info, conn): """ Postprocessing function for 'ProbeSet' traits. @@ -307,7 +436,7 @@ def set_homologene_id_field_probeset(trait_info, conn): cursor.execute( query, { - k:v for k, v in trait_info.items() + k: v for k, v in trait_info.items() if k in ["geneid", "group"] }) res = cursor.fetchone() @@ -315,12 +444,13 @@ def set_homologene_id_field_probeset(trait_info, conn): return {**trait_info, "homologeneid": res[0]} return {**trait_info, "homologeneid": None} + def set_homologene_id_field(trait_type, trait_info, conn): """ Common postprocessing function for all trait types. Sets the value for the 'homologene' key.""" - set_to_null = lambda ti: {**ti, "homologeneid": None} + def set_to_null(ti): return {**ti, "homologeneid": None} functions_table = { "Temp": set_to_null, "Geno": set_to_null, @@ -329,6 +459,7 @@ def set_homologene_id_field(trait_type, trait_info, conn): } return functions_table[trait_type](trait_info) + def load_publish_qtl_info(trait_info, conn): """ Load extra QTL information for `Publish` traits @@ -349,6 +480,7 @@ def load_publish_qtl_info(trait_info, conn): return dict(zip(["locus", "lrs", "additive"], cursor.fetchone())) return {"locus": "", "lrs": "", "additive": ""} + def load_probeset_qtl_info(trait_info, conn): """ Load extra QTL information for `ProbeSet` traits @@ -371,6 +503,7 @@ def load_probeset_qtl_info(trait_info, conn): ["locus", "lrs", "pvalue", "mean", "additive"], cursor.fetchone())) return {"locus": "", "lrs": "", "pvalue": "", "mean": "", "additive": ""} + def load_qtl_info(qtl, trait_type, trait_info, conn): """ Load extra QTL information for traits @@ -399,6 +532,7 @@ def load_qtl_info(qtl, trait_type, trait_info, conn): return qtl_info_functions[trait_type](trait_info, conn) + def build_trait_name(trait_fullname): """ Initialises the trait's name, and other values from the search data provided @@ -425,6 +559,7 @@ def build_trait_name(trait_fullname): "cellid": name_parts[2] if len(name_parts) == 3 else "" } + def retrieve_probeset_sequence(trait, conn): """ Retrieve a 'ProbeSet' trait's sequence information @@ -446,6 +581,7 @@ def retrieve_probeset_sequence(trait, conn): seq = cursor.fetchone() return {**trait, "sequence": seq[0] if seq else ""} + def retrieve_trait_info( threshold: int, trait_full_name: str, conn: Any, qtl=None): @@ -501,6 +637,7 @@ def retrieve_trait_info( } return trait_info + def retrieve_temp_trait_data(trait_info: dict, conn: Any): """ Retrieve trait data for `Temp` traits. @@ -520,9 +657,10 @@ def retrieve_temp_trait_data(trait_info: dict, conn: Any): {"trait_name": trait_info["trait_name"]}) return [dict(zip( ["sample_name", "value", "se_error", "nstrain", "id"], row)) - for row in cursor.fetchall()] + for row in cursor.fetchall()] return [] + def retrieve_species_id(group, conn: Any): """ Retrieve a species id given the Group value @@ -534,6 +672,7 @@ def retrieve_species_id(group, conn: Any): return cursor.fetchone()[0] return None + def retrieve_geno_trait_data(trait_info: Dict, conn: Any): """ Retrieve trait data for `Geno` traits. @@ -559,9 +698,10 @@ def retrieve_geno_trait_data(trait_info: Dict, conn: Any): trait_info["db"]["group"], conn)}) return [dict(zip( ["sample_name", "value", "se_error", "id"], row)) - for row in cursor.fetchall()] + for row in cursor.fetchall()] return [] + def retrieve_publish_trait_data(trait_info: Dict, conn: Any): """ Retrieve trait data for `Publish` traits. @@ -590,9 +730,10 @@ def retrieve_publish_trait_data(trait_info: Dict, conn: Any): "dataset_id": trait_info["db"]["dataset_id"]}) return [dict(zip( ["sample_name", "value", "se_error", "nstrain", "id"], row)) - for row in cursor.fetchall()] + for row in cursor.fetchall()] return [] + def retrieve_cellid_trait_data(trait_info: Dict, conn: Any): """ Retrieve trait data for `Probe Data` types. @@ -623,9 +764,10 @@ def retrieve_cellid_trait_data(trait_info: Dict, conn: Any): "dataset_id": trait_info["db"]["dataset_id"]}) return [dict(zip( ["sample_name", "value", "se_error", "id"], row)) - for row in cursor.fetchall()] + for row in cursor.fetchall()] return [] + def retrieve_probeset_trait_data(trait_info: Dict, conn: Any): """ Retrieve trait data for `ProbeSet` traits. @@ -652,9 +794,10 @@ def retrieve_probeset_trait_data(trait_info: Dict, conn: Any): "dataset_name": trait_info["db"]["dataset_name"]}) return [dict(zip( ["sample_name", "value", "se_error", "id"], row)) - for row in cursor.fetchall()] + for row in cursor.fetchall()] return [] + def with_samplelist_data_setup(samplelist: Sequence[str]): """ Build function that computes the trait data from provided list of samples. @@ -681,6 +824,7 @@ def with_samplelist_data_setup(samplelist: Sequence[str]): return None return setup_fn + def without_samplelist_data_setup(): """ Build function that computes the trait data. @@ -701,6 +845,7 @@ def without_samplelist_data_setup(): return None return setup_fn + def retrieve_trait_data(trait: dict, conn: Any, samplelist: Sequence[str] = tuple()): """ Retrieve trait data @@ -740,15 +885,17 @@ def retrieve_trait_data(trait: dict, conn: Any, samplelist: Sequence[str] = tupl "data": dict(map( lambda x: ( x["sample_name"], - {k:v for k, v in x.items() if x != "sample_name"}), + {k: v for k, v in x.items() if x != "sample_name"}), data))} return {} + def generate_traits_filename(base_path: str = TMPDIR): """Generate a unique filename for use with generated traits files.""" return "{}/traits_test_file_{}.txt".format( os.path.abspath(base_path), random_string(10)) + def export_informative(trait_data: dict, inc_var: bool = False) -> tuple: """ Export informative strain @@ -770,5 +917,6 @@ def export_informative(trait_data: dict, inc_var: bool = False) -> tuple: return acc return reduce( __exporter__, - filter(lambda td: td["value"] is not None, trait_data["data"].values()), + filter(lambda td: td["value"] is not None, + trait_data["data"].values()), (tuple(), tuple(), tuple())) -- cgit v1.2.3 From 40f264876f2309fcccfcd3d04a2999bdf3fa5d98 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 24 Nov 2021 05:46:43 +0300 Subject: Retrieve the species name given the group Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Migrate the `web.webqtl.dbFunction.webqtlDatabaseFunction.retrieveSpecies` in GeneNetwork1 to `gn3.db.species.species_name` in GeneNetwork3 to enable the retrieval of the species name, given the group name (formerly RISet). --- gn3/db/species.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gn3') diff --git a/gn3/db/species.py b/gn3/db/species.py index 702a9a8..20170ba 100644 --- a/gn3/db/species.py +++ b/gn3/db/species.py @@ -57,3 +57,20 @@ def translate_to_mouse_gene_id(species: str, geneid: int, conn: Any) -> int: return translated_gene_id[0] return 0 # default if all else fails + +def species_name(conn: Any, group: str) -> str: + """ + Retrieve the name of the species, given the group (RISet). + + This is a migration of the + `web.webqtl.dbFunction.webqtlDatabaseFunction.retrieveSpecies` function in + GeneNetwork1. + """ + with conn.cursor() as cursor: + cursor.execute( + ("SELECT Species.Name FROM Species, InbredSet " + "WHERE InbredSet.Name = %(group_name)s " + "AND InbredSet.SpeciesId = Species.Id"), + group_name=group_name) + return cursor.fetchone()[0] + return None -- cgit v1.2.3 From f88d8e4446c8c9d6693197a452669e0e9c8ea812 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 26 Nov 2021 11:44:53 +0300 Subject: Fix query parametrisation Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Pass parameters to the query the way the MySQL driver expects. --- gn3/db/correlations.py | 16 ++++++++++------ gn3/db/species.py | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index a1daa3c..c838597 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -23,8 +23,8 @@ def get_filename(target_db_name: str, conn: Any) -> str: """ with conn.cursor() as cursor: cursor.execute( - "SELECT Id, FullName from ProbeSetFreeze WHERE Name-%s", - target_db_name) + "SELECT Id, FullName from ProbeSetFreeze WHERE Name=%s", + (target_db_name,)) result = cursor.fetchone() if result: return "ProbeSetFreezeId_{tid}_FullName_{fname}.txt".format( @@ -398,9 +398,12 @@ def fetch_sample_ids( "AND Species.name=%(species_name)s") with conn.cursor() as cursor: cursor.execute( - query, samples_names=tuple(sample_names), - species_name=species_name) return cursor.fetchall() + query, + { + "samples_names": tuple(sample_names), + "species_name": species_name + }) def build_query_sgo_lit_corr( db_type: str, temp_table: str, sample_id_columns: str, @@ -511,8 +514,9 @@ def fetch_all_database_data(# pylint: disable=[R0913, R0914] query, data_start_pos = __build_query__(sample_ids, temp_table) with conn.cursor() as cursor: cursor.execute( - query, db_name=db_name, - **{f"T{item}_sample_id": item for item in sample_ids}) + query, + {"db_name": db_name, + **{f"T{item}_sample_id": item for item in sample_ids}}) return (cursor.fetchall(), data_start_pos) sample_ids = tuple( diff --git a/gn3/db/species.py b/gn3/db/species.py index 20170ba..5b8e096 100644 --- a/gn3/db/species.py +++ b/gn3/db/species.py @@ -71,6 +71,6 @@ def species_name(conn: Any, group: str) -> str: ("SELECT Species.Name FROM Species, InbredSet " "WHERE InbredSet.Name = %(group_name)s " "AND InbredSet.SpeciesId = Species.Id"), - group_name=group_name) + {"group_name": group}) return cursor.fetchone()[0] return None -- cgit v1.2.3 From d29ef85d44fff9414932d64850f65cb268b1cddd Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 26 Nov 2021 11:48:26 +0300 Subject: Update typing notations on functions Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi --- gn3/db/correlations.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index c838597..898de75 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -4,7 +4,7 @@ feature to access the database to retrieve data needed for computations. """ from functools import reduce -from typing import Any, Dict, Tuple +from typing import Any, Dict, Tuple, Union from gn3.random import random_string from gn3.data_helpers import partition_all @@ -12,7 +12,8 @@ from gn3.db.species import translate_to_mouse_gene_id from gn3.computations.partial_correlations import correlations_of_all_tissue_traits -def get_filename(target_db_name: str, conn: Any) -> str: +def get_filename(conn: Any, target_db_name: str, text_files_dir: str) -> Union[ + str, bool]: """ Retrieve the name of the reference database file with which correlations are computed. @@ -456,8 +457,9 @@ def build_query_tissue_corr(db_type, temp_table, sample_id_columns, joins): def fetch_all_database_data(# pylint: disable=[R0913, R0914] conn: Any, species: str, gene_id: int, trait_symbol: str, - samples: Tuple[str, ...], db_type: str, db_name: str, method: str, - return_number: int, probeset_freeze_id: int) -> Tuple[Any, Any]: + samples: Tuple[str, ...], dataset: dict, method: str, + return_number: int, probeset_freeze_id: int) -> Tuple[ + Tuple[float], int]: """ This is a migration of the `web.webqtl.correlation.CorrelationPage.fetchAllDatabaseData` function in -- cgit v1.2.3 From ee200d60bd3065c4c9e69bcbb756715211b711d2 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 26 Nov 2021 11:50:33 +0300 Subject: Return only values Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Return the values from the database, not the tuples. --- gn3/db/correlations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index 898de75..05c0809 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -399,12 +399,12 @@ def fetch_sample_ids( "AND Species.name=%(species_name)s") with conn.cursor() as cursor: cursor.execute( - return cursor.fetchall() query, { "samples_names": tuple(sample_names), "species_name": species_name }) + return tuple(row[0] for row in cursor.fetchall()) def build_query_sgo_lit_corr( db_type: str, temp_table: str, sample_id_columns: str, -- cgit v1.2.3 From 0f9247fffc7127bdb3c35492a37706a2db01a26c Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 26 Nov 2021 11:52:37 +0300 Subject: Update return type Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Return the complete filename when found, or the boolean value False, when it is not found. --- gn3/db/correlations.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index 05c0809..ab4dc2c 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -2,7 +2,7 @@ This module will hold functions that are used in the (partial) correlations feature to access the database to retrieve data needed for computations. """ - +import os from functools import reduce from typing import Any, Dict, Tuple, Union @@ -28,11 +28,13 @@ def get_filename(conn: Any, target_db_name: str, text_files_dir: str) -> Union[ (target_db_name,)) result = cursor.fetchone() if result: - return "ProbeSetFreezeId_{tid}_FullName_{fname}.txt".format( + filename = "ProbeSetFreezeId_{tid}_FullName_{fname}.txt".format( tid=result[0], fname=result[1].replace(' ', '_').replace('/', '_')) + return ((filename in os.listdir(text_file_dir)) + and f"{text_files_dir}/{filename}") - return "" + return False def build_temporary_literature_table( conn: Any, species: str, gene_id: int, return_number: int) -> str: -- cgit v1.2.3 From 109b233f698a2ce41bb5634f12e966ad02798819 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 26 Nov 2021 11:54:17 +0300 Subject: Fix bugs in data Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Process the db_name and db_type values. * Return data correctly --- gn3/db/correlations.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index ab4dc2c..401fd91 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -467,6 +467,8 @@ def fetch_all_database_data(# pylint: disable=[R0913, R0914] `web.webqtl.correlation.CorrelationPage.fetchAllDatabaseData` function in GeneNetwork1. """ + db_type = dataset["dataset_type"] + db_name = dataset["dataset_name"] def __build_query__(sample_ids, temp_table): sample_id_columns = ", ".join(f"T{smpl}.value" for smpl in sample_ids) if db_type == "Publish": @@ -551,4 +553,4 @@ def fetch_all_database_data(# pylint: disable=[R0913, R0914] with conn.cursor() as cursor: cursor.execute(f"DROP TEMPORARY TABLE {temp_table}") - return (tuple(item[0] for item in trait_database), trait_database[0][1]) + return (trait_database[0], trait_database[1]) -- cgit v1.2.3 From 6b147173d514093ec4e461f5843170c968290e5e Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 29 Nov 2021 11:52:26 +0300 Subject: Provide entry-point function for the partial correlations Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Provide the entry-point function to the partial correlation feature. This is the function that ochestrates the fetching of the data, and processing it for output by the API endpoint (to be implemented). --- gn3/computations/partial_correlations.py | 357 +++++++++++++++++++++++++++++-- gn3/db/correlations.py | 11 +- 2 files changed, 350 insertions(+), 18 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index f43c4d4..869bee4 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -6,15 +6,20 @@ GeneNetwork1. """ import math -from functools import reduce +from functools import reduce, partial from typing import Any, Tuple, Union, Sequence -from scipy.stats import pearsonr, spearmanr import pandas import pingouin +from scipy.stats import pearsonr, spearmanr from gn3.settings import TEXTDIR +from gn3.function_helpers import compose from gn3.data_helpers import parse_csv_line +from gn3.db.traits import export_informative +from gn3.db.traits import retrieve_trait_info, retrieve_trait_data +from gn3.db.species import species_name, translate_to_mouse_gene_id +from gn3.db.correlations import get_filename, fetch_all_database_data def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): """ @@ -112,7 +117,7 @@ def find_identical_traits( return acc + ident[1] def __dictify_controls__(acc, control_item): - ckey = "{:.3f}".format(control_item[0]) + ckey = tuple("{:.3f}".format(item) for item in control_item[0]) return {**acc, ckey: acc.get(ckey, tuple()) + (control_item[1],)} return (reduce(## for identical control traits @@ -212,7 +217,7 @@ def partial_correlations_fast(# pylint: disable=[R0913, R0914] function in GeneNetwork1. """ assert method in ("spearman", "pearson") - with open(f"{TEXTDIR}/{database_filename}", "r") as dataset_file: + with open(database_filename, "r") as dataset_file: dataset = tuple(dataset_file.readlines()) good_dataset_samples = good_dataset_samples_indexes( @@ -286,32 +291,37 @@ def compute_partial( """ # replace the R code with `pingouin.partial_corr` def __compute_trait_info__(target): + targ_vals = target[0] + targ_name = target[1] primary = [ - prim for targ, prim in zip(target, primary_vals) + prim for targ, prim in zip(targ_vals, primary_vals) if targ is not None] + datafrm = build_data_frame( primary, - [targ for targ in target if targ is not None], - [cont for i, cont in enumerate(control_vals) - if target[i] is not None]) + tuple(targ for targ in targ_vals if targ is not None), + tuple(cont for i, cont in enumerate(control_vals) + if target[i] is not None)) covariates = "z" if datafrm.shape[1] == 3 else [ col for col in datafrm.columns if col not in ("x", "y")] ppc = pingouin.partial_corr( - data=datafrm, x="x", y="y", covar=covariates, method=method) - pc_coeff = ppc["r"] + data=datafrm, x="x", y="y", covar=covariates, method=( + "pearson" if "pearson" in method.lower() else "spearman")) + pc_coeff = ppc["r"][0] zero_order_corr = pingouin.corr( - datafrm["x"], datafrm["y"], method=method) + datafrm["x"], datafrm["y"], method=( + "pearson" if "pearson" in method.lower() else "spearman")) if math.isnan(pc_coeff): return ( - target[1], len(primary), pc_coeff, 1, zero_order_corr["r"], - zero_order_corr["p-val"]) + targ_name, len(primary), pc_coeff, 1, zero_order_corr["r"][0], + zero_order_corr["p-val"][0]) return ( - target[1], len(primary), pc_coeff, - (ppc["p-val"] if not math.isnan(ppc["p-val"]) else ( + targ_name, len(primary), pc_coeff, + (ppc["p-val"][0] if not math.isnan(ppc["p-val"][0]) else ( 0 if (abs(pc_coeff - 1) < 0.0000001) else 1)), - zero_order_corr["r"], zero_order_corr["p-val"]) + zero_order_corr["r"][0], zero_order_corr["p-val"][0]) return tuple( __compute_trait_info__(target) @@ -360,3 +370,318 @@ def partial_correlations_normal(# pylint: disable=R0913 for idx, item in enumerate(all_correlations))) return len(trait_database), all_correlations + +def partial_corrs( + conn, samples , primary_vals, control_vals, return_number, species, input_trait_geneid, + input_trait_symbol, tissue_probeset_freeze_id, method, dataset, database_filename): + """ + Compute the partial correlations, selecting the fast or normal method + depending on the existence of the database text file. + + This is a partial migration of the + `web.webqtl.correlation.PartialCorrDBPage.__init__` function in + GeneNetwork1. + """ + if database_filename: + return partial_correlations_fast( + samples, primary_vals, control_vals, database_filename, + ( + fetch_literature_correlations( + species, input_trait_geneid, dataset, return_number, conn) + if "literature" in method.lower() else + fetch_tissue_correlations( + dataset, input_trait_symbol, tissue_probeset_freeze_id, + method, return_number, conn)), + method, + ("literature" if method.lower() == "sgo literature correlation" + else ("tissue" if "tissue" in method.lower() else "genetic"))) + + trait_database, data_start_pos = fetch_all_database_data( + conn, species, input_trait_geneid, input_trait_symbol, samples, dataset, + method, return_number, tissue_probeset_freeze_id) + return partial_correlations_normal( + primary_vals, control_vals, input_trait_geneid, trait_database, + data_start_pos, dataset, method) + +def literature_correlation_by_list( + conn: Any, input_trait_mouse_geneid: int, species: str, + trait_list: Tuple[dict]) -> Tuple[dict]: + """ + This is a migration of the + `web.webqtl.correlation.CorrelationPage.getLiteratureCorrelationByList` + function in GeneNetwork1. + """ + if any((lambda t: ( + bool(t.get("tissue_corr")) and + bool(t.get("tissue_p_value"))))(trait) + for trait in trait_list): + temp_table_name = f"LITERATURE{random_string(8)}" + q1 = ( + f"CREATE TEMPORARY TABLE {temporary_table_name} " + "(GeneId1 INT(12) UNSIGNED, GeneId2 INT(12) UNSIGNED PRIMARY KEY, " + "value DOUBLE)") + q2 = ( + f"INSERT INTO {temporary_table_name}(GeneId1, GeneId2, value) " + "SELECT GeneId1, GeneId2, value FROM LCorrRamin3 " + "WHERE GeneId1=%(geneid)s") + q3 = ( + "INSERT INTO {temporary_table_name}(GeneId1, GeneId2, value) " + "SELECT GeneId2, GeneId1, value FROM LCorrRamin3 " + "WHERE GeneId2=%s AND GeneId1 != %(geneid)s") + + def __set_mouse_geneid__(trait): + if trait.get("geneid"): + return { + **trait, + "mouse_geneid": translate_to_mouse_gene_id(trait.get("geneid")) + } + return {**trait, "mouse_geneid": 0} + + def __retrieve_lcorr__(cursor, geneids): + cursor.execute( + f"SELECT GeneId2, value FROM {temporary_table_name} " + "WHERE GeneId2 IN %(geneids)s", + geneids = geneids) + return {geneid: value for geneid, value in cursor.fetchall()} + + with conn.cursor() as cursor: + cursor.execute(q1) + cursor.execute(q2) + cursor.execute(q3) + + traits = tuple(__set_mouse_geneid__(trait) for trait in trait_list) + lcorrs = __retrieve_lcorr__( + cursor, ( + trait["mouse_geneid"] for trait in traits + if (trait["mouse_geneid"] != 0 and + trait["mouse_geneid"].find(";") < 0))) + return tuple( + {**trait, "l_corr": lcorrs.get(trait["mouse_geneid"], None)} + for trait in traits) + + return trait_list + return trait_list + +def tissue_correlation_by_list( + conn: Any, primary_trait_symbol: str, tissue_probeset_freeze_id: int, + method: str, trait_list: Tuple[dict]) -> Tuple[dict]: + """ + This is a migration of the + `web.webqtl.correlation.CorrelationPage.getTissueCorrelationByList` + function in GeneNetwork1. + """ + def __add_tissue_corr__(trait, primary_trait_value, trait_value): + result = pingouin.corr( + primary_trait_values, target_trait_values, + method=("spearman" if "spearman" in method.lower() else "pearson")) + return { + **trait, + "tissue_corr": result["r"], + "tissue_p_value": result["p-val"] + } + + if any((lambda t: bool(t.get("l_corr")))(trait) for trait in trait_list): + prim_trait_symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( + (primary_trait_symbol,), tissue_probeset_freeze_id, conn) + if primary_trait_symbol.lower() in prim_trait_symbol_value_dict: + primary_trait_value = prim_trait_symbol_value_dict[prim_trait_symbol.lower()] + gene_symbol_list = tuple( + trait for trait in trait_list if "symbol" in trait.keys()) + symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( + gene_symbol_list, tissue_probeset_freeze_id, conn) + return tuple( + __add_tissue_corr__( + trait, primary_trait_value, + symbol_value_dict[trait["symbol"].lower()]) + for trait in trait_list + if ("symbol" in trait and + bool(trait["symbol"]) and + trait["symbol"].lower() in symbol_value_dict)) + return tuple({ + **trait, + "tissue_corr": None, + "tissue_p_value": None + } for trait in trait_list) + return trait_list + +def partial_correlations_entry( + conn: Any, primary_trait_name: str, + control_trait_names: Tuple[str, ...], method: str, + criteria: int, group: str, target_db_name: str) -> dict: + """ + This is the 'ochestration' function for the partial-correlation feature. + + This function will dispatch the functions doing data fetches from the + database (and various other places) and feed that data to the functions + doing the conversions and computations. It will then return the results of + all of that work. + + This function is doing way too much. Look into splitting out the + functionality into smaller functions that do fewer things. + """ + threshold = 0 + corr_min_informative = 4 + + primary_trait = retrieve_trait_info(threshold, primary_trait_name, conn) + primary_trait_data = retrieve_trait_data(primary_trait, conn) + primary_samples, primary_values, primary_variances = export_informative( + primary_trait_data) + + cntrl_traits = tuple( + retrieve_trait_info(threshold, trait_full_name, conn) + for trait_full_name in control_trait_names) + cntrl_traits_data = tuple( + retrieve_trait_data(cntrl_trait, conn) + for cntrl_trait in cntrl_traits) + species = species_name(conn, group) + + (cntrl_samples, + cntrl_values, + cntrl_variances, + cntrl_ns) = control_samples(cntrl_traits_data, primary_samples) + + common_primary_control_samples = primary_samples + fixed_primary_vals = primary_values + fixed_control_vals = cntrl_values + if not all(cnt_smp == primary_samples for cnt_smp in cntrl_samples): + (common_primary_control_samples, + fixed_primary_vals, + fixed_control_vals, + primary_variances, + cntrl_variances) = fix_samples(primary_trait, cntrl_traits) + + if len(common_primary_control_samples) < corr_min_informative: + return { + "status": "error", + "message": ( + f"Fewer than {corr_min_informative} samples data entered for " + f"{group} dataset. No calculation of correlation has been " + "attempted."), + "error_type": "Inadequate Samples"} + + identical_traits_names = find_identical_traits( + primary_trait_name, primary_values, control_trait_names, cntrl_values) + if len(identical_traits_names) > 0: + return { + "status": "error", + "message": ( + f"{identical_traits_names[0]} and {identical_traits_names[1]} " + "have the same values for the {len(fixed_primary_vals)} " + "samples that will be used to compute the partial correlation " + "(common for all primary and control traits). In such cases, " + "partial correlation cannot be computed. Please re-select your " + "traits."), + "error_type": "Identical Traits"} + + input_trait_geneid = primary_trait.get("geneid") + input_trait_symbol = primary_trait.get("symbol") + input_trait_mouse_geneid = translate_to_mouse_gene_id( + species, input_trait_geneid, conn) + + tissue_probeset_freeze_id = 1 + db_type = primary_trait["db"]["dataset_type"] + db_name = primary_trait["db"]["dataset_name"] + + if db_type == "ProbeSet" and method.lower() in ( + "sgo literature correlation", + "tissue correlation, pearson's r", + "tissue correlation, spearman's rho"): + return { + "status": "error", + "message": ( + "Wrong correlation type: It is not possible to compute the " + f"{method} between your trait and data in the {target_db_name} " + "database. Please try again after selecting another type of " + "correlation."), + "error_type": "Correlation Type"} + + if (method.lower() == "sgo literature correlation" and ( + input_trait_geneid is None or + check_for_literature_info(conn, input_trait_mouse_geneid))): + return { + "status": "error", + "message": ( + "No Literature Information: This gene does not have any " + "associated Literature Information."), + "error_type": "Literature Correlation"} + + if (method.lower() in ( + "tissue correlation, pearson's r", + "tissue correlation, spearman's rho") + and input_trait_symbol is None): + return { + "status": "error", + "message": ( + "No Tissue Correlation Information: This gene does not have " + "any associated Tissue Correlation Information."), + "error_type": "Tissue Correlation"} + + if (method.lower() in ( + "tissue correlation, pearson's r", + "tissue correlation, spearman's rho") + and check_symbol_for_tissue_correlation( + conn, tissue_probeset_freeze_id, input_trait_symbol)): + return { + "status": "error", + "message": ( + "No Tissue Correlation Information: This gene does not have " + "any associated Tissue Correlation Information."), + "error_type": "Tissue Correlation"} + + database_filename = get_filename(conn, target_db_name, TEXTDIR) + total_traits, all_correlations = partial_corrs( + conn, common_primary_control_samples, fixed_primary_vals, + fixed_control_vals, len(fixed_primary_vals), species, + input_trait_geneid, input_trait_symbol, tissue_probeset_freeze_id, + method, primary_trait["db"], database_filename) + + + def __make_sorter__(method): + def __sort_6__(x): + return x[6] + + def __sort_3__(x): + return x[3] + + if "literature" in method.lower(): + return __sort_6__ + + if "tissue" in method.lower(): + return __sort_6__ + + return __sort_3__ + + sorted_correlations = sorted( + all_correlations, key=__make_sorter__(method)) + + add_lit_corr_and_tiss_corr = compose( + partial( + literature_correlation_by_list, conn, input_trait_mouse_geneid, + species), + partial( + tissue_correlation_by_list, conn, input_trait_symbol, + tissue_probeset_freeze_id, method)) + + trait_list = add_lit_corr_and_tiss_corr(tuple( + { + **retrieve_trait_info( + threshold, + f"{primary_trait['db']['dataset_name']}::{item[0]}", + conn), + "noverlap": item[1], + "partial_corr": item[2], + "partial_corr_p_value": item[3], + "corr": item[4], + "corr_p_value": item[5], + "rank_order": (1 if "spearman" in method.lower() else 0), + **({ + "tissue_corr": item[6], + "tissue_p_value": item[7]} + if len(item) == 8 else {}), + **({"l_corr": item[6]} + if len(item) == 7 else {}) + } + for item in + sorted_correlations[:min(criteria, len(all_correlations))])) + + return trait_list diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index 401fd91..2a38bae 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -10,8 +10,6 @@ from gn3.random import random_string from gn3.data_helpers import partition_all from gn3.db.species import translate_to_mouse_gene_id -from gn3.computations.partial_correlations import correlations_of_all_tissue_traits - def get_filename(conn: Any, target_db_name: str, text_files_dir: str) -> Union[ str, bool]: """ @@ -282,6 +280,15 @@ def build_temporary_tissue_correlations_table( # We should probably pass the `correlations_of_all_tissue_traits` function # as an argument to this function and get rid of the one call immediately # following this comment. + from gn3.computations.partial_correlations import correlations_of_all_tissue_traits + # This import above is necessary within the function to avoid + # circular-imports. + # + # + # This import above is indicative of convoluted code, with the computation + # being interwoven with the data retrieval. This needs to be changed, such + # that the function being imported here is no longer necessary, or have the + # imported function passed to this function as an argument. symbol_corr_dict, symbol_p_value_dict = correlations_of_all_tissue_traits( fetch_gene_symbol_tissue_value_dict_for_trait( (trait_symbol,), probeset_freeze_id, conn), -- cgit v1.2.3 From 99953f6e4a540da41d0517203eb63da4e19405cd Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 29 Nov 2021 14:01:44 +0300 Subject: Fix linting errors Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi --- gn3/computations/partial_correlations.py | 131 +++++++++++++++++-------------- gn3/db/correlations.py | 5 +- gn3/db/traits.py | 47 ++++++----- 3 files changed, 100 insertions(+), 83 deletions(-) (limited to 'gn3') diff --git a/gn3/computations/partial_correlations.py b/gn3/computations/partial_correlations.py index 869bee4..231b0a7 100644 --- a/gn3/computations/partial_correlations.py +++ b/gn3/computations/partial_correlations.py @@ -14,12 +14,20 @@ import pingouin from scipy.stats import pearsonr, spearmanr from gn3.settings import TEXTDIR +from gn3.random import random_string from gn3.function_helpers import compose from gn3.data_helpers import parse_csv_line from gn3.db.traits import export_informative from gn3.db.traits import retrieve_trait_info, retrieve_trait_data from gn3.db.species import species_name, translate_to_mouse_gene_id -from gn3.db.correlations import get_filename, fetch_all_database_data +from gn3.db.correlations import ( + get_filename, + fetch_all_database_data, + check_for_literature_info, + fetch_tissue_correlations, + fetch_literature_correlations, + check_symbol_for_tissue_correlation, + fetch_gene_symbol_tissue_value_dict_for_trait) def control_samples(controls: Sequence[dict], sampleslist: Sequence[str]): """ @@ -311,7 +319,7 @@ def compute_partial( zero_order_corr = pingouin.corr( datafrm["x"], datafrm["y"], method=( - "pearson" if "pearson" in method.lower() else "spearman")) + "pearson" if "pearson" in method.lower() else "spearman")) if math.isnan(pc_coeff): return ( @@ -371,9 +379,10 @@ def partial_correlations_normal(# pylint: disable=R0913 return len(trait_database), all_correlations -def partial_corrs( - conn, samples , primary_vals, control_vals, return_number, species, input_trait_geneid, - input_trait_symbol, tissue_probeset_freeze_id, method, dataset, database_filename): +def partial_corrs(# pylint: disable=[R0913] + conn, samples, primary_vals, control_vals, return_number, species, + input_trait_geneid, input_trait_symbol, tissue_probeset_freeze_id, + method, dataset, database_filename): """ Compute the partial correlations, selecting the fast or normal method depending on the existence of the database text file. @@ -404,8 +413,7 @@ def partial_corrs( data_start_pos, dataset, method) def literature_correlation_by_list( - conn: Any, input_trait_mouse_geneid: int, species: str, - trait_list: Tuple[dict]) -> Tuple[dict]: + conn: Any, species: str, trait_list: Tuple[dict]) -> Tuple[dict]: """ This is a migration of the `web.webqtl.correlation.CorrelationPage.getLiteratureCorrelationByList` @@ -415,16 +423,16 @@ def literature_correlation_by_list( bool(t.get("tissue_corr")) and bool(t.get("tissue_p_value"))))(trait) for trait in trait_list): - temp_table_name = f"LITERATURE{random_string(8)}" - q1 = ( + temporary_table_name = f"LITERATURE{random_string(8)}" + query1 = ( f"CREATE TEMPORARY TABLE {temporary_table_name} " "(GeneId1 INT(12) UNSIGNED, GeneId2 INT(12) UNSIGNED PRIMARY KEY, " "value DOUBLE)") - q2 = ( + query2 = ( f"INSERT INTO {temporary_table_name}(GeneId1, GeneId2, value) " "SELECT GeneId1, GeneId2, value FROM LCorrRamin3 " "WHERE GeneId1=%(geneid)s") - q3 = ( + query3 = ( "INSERT INTO {temporary_table_name}(GeneId1, GeneId2, value) " "SELECT GeneId2, GeneId1, value FROM LCorrRamin3 " "WHERE GeneId2=%s AND GeneId1 != %(geneid)s") @@ -433,7 +441,8 @@ def literature_correlation_by_list( if trait.get("geneid"): return { **trait, - "mouse_geneid": translate_to_mouse_gene_id(trait.get("geneid")) + "mouse_geneid": translate_to_mouse_gene_id( + species, trait.get("geneid"), conn) } return {**trait, "mouse_geneid": 0} @@ -441,13 +450,13 @@ def literature_correlation_by_list( cursor.execute( f"SELECT GeneId2, value FROM {temporary_table_name} " "WHERE GeneId2 IN %(geneids)s", - geneids = geneids) - return {geneid: value for geneid, value in cursor.fetchall()} + geneids=geneids) + return dict(cursor.fetchall()) with conn.cursor() as cursor: - cursor.execute(q1) - cursor.execute(q2) - cursor.execute(q3) + cursor.execute(query1) + cursor.execute(query2) + cursor.execute(query3) traits = tuple(__set_mouse_geneid__(trait) for trait in trait_list) lcorrs = __retrieve_lcorr__( @@ -470,9 +479,9 @@ def tissue_correlation_by_list( `web.webqtl.correlation.CorrelationPage.getTissueCorrelationByList` function in GeneNetwork1. """ - def __add_tissue_corr__(trait, primary_trait_value, trait_value): + def __add_tissue_corr__(trait, primary_trait_values, trait_values): result = pingouin.corr( - primary_trait_values, target_trait_values, + primary_trait_values, trait_values, method=("spearman" if "spearman" in method.lower() else "pearson")) return { **trait, @@ -484,7 +493,8 @@ def tissue_correlation_by_list( prim_trait_symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( (primary_trait_symbol,), tissue_probeset_freeze_id, conn) if primary_trait_symbol.lower() in prim_trait_symbol_value_dict: - primary_trait_value = prim_trait_symbol_value_dict[prim_trait_symbol.lower()] + primary_trait_value = prim_trait_symbol_value_dict[ + primary_trait_symbol.lower()] gene_symbol_list = tuple( trait for trait in trait_list if "symbol" in trait.keys()) symbol_value_dict = fetch_gene_symbol_tissue_value_dict_for_trait( @@ -504,7 +514,7 @@ def tissue_correlation_by_list( } for trait in trait_list) return trait_list -def partial_correlations_entry( +def partial_correlations_entry(# pylint: disable=[R0913, R0914, R0911] conn: Any, primary_trait_name: str, control_trait_names: Tuple[str, ...], method: str, criteria: int, group: str, target_db_name: str) -> dict: @@ -524,7 +534,7 @@ def partial_correlations_entry( primary_trait = retrieve_trait_info(threshold, primary_trait_name, conn) primary_trait_data = retrieve_trait_data(primary_trait, conn) - primary_samples, primary_values, primary_variances = export_informative( + primary_samples, primary_values, _primary_variances = export_informative( primary_trait_data) cntrl_traits = tuple( @@ -537,8 +547,8 @@ def partial_correlations_entry( (cntrl_samples, cntrl_values, - cntrl_variances, - cntrl_ns) = control_samples(cntrl_traits_data, primary_samples) + _cntrl_variances, + _cntrl_ns) = control_samples(cntrl_traits_data, primary_samples) common_primary_control_samples = primary_samples fixed_primary_vals = primary_values @@ -547,8 +557,8 @@ def partial_correlations_entry( (common_primary_control_samples, fixed_primary_vals, fixed_control_vals, - primary_variances, - cntrl_variances) = fix_samples(primary_trait, cntrl_traits) + _primary_variances, + _cntrl_variances) = fix_samples(primary_trait, cntrl_traits) if len(common_primary_control_samples) < corr_min_informative: return { @@ -580,7 +590,6 @@ def partial_correlations_entry( tissue_probeset_freeze_id = 1 db_type = primary_trait["db"]["dataset_type"] - db_name = primary_trait["db"]["dataset_name"] if db_type == "ProbeSet" and method.lower() in ( "sgo literature correlation", @@ -605,10 +614,11 @@ def partial_correlations_entry( "associated Literature Information."), "error_type": "Literature Correlation"} - if (method.lower() in ( - "tissue correlation, pearson's r", - "tissue correlation, spearman's rho") - and input_trait_symbol is None): + if ( + method.lower() in ( + "tissue correlation, pearson's r", + "tissue correlation, spearman's rho") + and input_trait_symbol is None): return { "status": "error", "message": ( @@ -616,11 +626,12 @@ def partial_correlations_entry( "any associated Tissue Correlation Information."), "error_type": "Tissue Correlation"} - if (method.lower() in ( - "tissue correlation, pearson's r", - "tissue correlation, spearman's rho") - and check_symbol_for_tissue_correlation( - conn, tissue_probeset_freeze_id, input_trait_symbol)): + if ( + method.lower() in ( + "tissue correlation, pearson's r", + "tissue correlation, spearman's rho") + and check_symbol_for_tissue_correlation( + conn, tissue_probeset_freeze_id, input_trait_symbol)): return { "status": "error", "message": ( @@ -629,7 +640,7 @@ def partial_correlations_entry( "error_type": "Tissue Correlation"} database_filename = get_filename(conn, target_db_name, TEXTDIR) - total_traits, all_correlations = partial_corrs( + _total_traits, all_correlations = partial_corrs( conn, common_primary_control_samples, fixed_primary_vals, fixed_control_vals, len(fixed_primary_vals), species, input_trait_geneid, input_trait_symbol, tissue_probeset_freeze_id, @@ -637,11 +648,11 @@ def partial_correlations_entry( def __make_sorter__(method): - def __sort_6__(x): - return x[6] + def __sort_6__(row): + return row[6] - def __sort_3__(x): - return x[3] + def __sort_3__(row): + return row[3] if "literature" in method.lower(): return __sort_6__ @@ -655,33 +666,31 @@ def partial_correlations_entry( all_correlations, key=__make_sorter__(method)) add_lit_corr_and_tiss_corr = compose( - partial( - literature_correlation_by_list, conn, input_trait_mouse_geneid, - species), + partial(literature_correlation_by_list, conn, species), partial( tissue_correlation_by_list, conn, input_trait_symbol, tissue_probeset_freeze_id, method)) trait_list = add_lit_corr_and_tiss_corr(tuple( - { - **retrieve_trait_info( - threshold, - f"{primary_trait['db']['dataset_name']}::{item[0]}", - conn), - "noverlap": item[1], - "partial_corr": item[2], - "partial_corr_p_value": item[3], - "corr": item[4], - "corr_p_value": item[5], - "rank_order": (1 if "spearman" in method.lower() else 0), - **({ - "tissue_corr": item[6], - "tissue_p_value": item[7]} + { + **retrieve_trait_info( + threshold, + f"{primary_trait['db']['dataset_name']}::{item[0]}", + conn), + "noverlap": item[1], + "partial_corr": item[2], + "partial_corr_p_value": item[3], + "corr": item[4], + "corr_p_value": item[5], + "rank_order": (1 if "spearman" in method.lower() else 0), + **({ + "tissue_corr": item[6], + "tissue_p_value": item[7]} if len(item) == 8 else {}), - **({"l_corr": item[6]} + **({"l_corr": item[6]} if len(item) == 7 else {}) - } + } for item in - sorted_correlations[:min(criteria, len(all_correlations))])) + sorted_correlations[:min(criteria, len(all_correlations))])) return trait_list diff --git a/gn3/db/correlations.py b/gn3/db/correlations.py index 2a38bae..3d12019 100644 --- a/gn3/db/correlations.py +++ b/gn3/db/correlations.py @@ -29,7 +29,7 @@ def get_filename(conn: Any, target_db_name: str, text_files_dir: str) -> Union[ filename = "ProbeSetFreezeId_{tid}_FullName_{fname}.txt".format( tid=result[0], fname=result[1].replace(' ', '_').replace('/', '_')) - return ((filename in os.listdir(text_file_dir)) + return ((filename in os.listdir(text_files_dir)) and f"{text_files_dir}/{filename}") return False @@ -280,7 +280,8 @@ def build_temporary_tissue_correlations_table( # We should probably pass the `correlations_of_all_tissue_traits` function # as an argument to this function and get rid of the one call immediately # following this comment. - from gn3.computations.partial_correlations import correlations_of_all_tissue_traits + from gn3.computations.partial_correlations import (#pylint: disable=[C0415, R0401] + correlations_of_all_tissue_traits) # This import above is necessary within the function to avoid # circular-imports. # diff --git a/gn3/db/traits.py b/gn3/db/traits.py index 75de4f4..d4a96f0 100644 --- a/gn3/db/traits.py +++ b/gn3/db/traits.py @@ -1,9 +1,10 @@ """This class contains functions relating to trait data manipulation""" import os -import MySQLdb from functools import reduce from typing import Any, Dict, Union, Sequence +import MySQLdb + from gn3.settings import TMPDIR from gn3.random import random_string from gn3.function_helpers import compose @@ -81,10 +82,10 @@ def export_trait_data( def get_trait_csv_sample_data(conn: Any, trait_name: int, phenotype_id: int): """Fetch a trait and return it as a csv string""" - def __float_strip(n): - if str(n)[-2:] == ".0": - return str(int(n)) - return str(n) + def __float_strip(num_str): + if str(num_str)[-2:] == ".0": + return str(int(num_str)) + return str(num_str) sql = ("SELECT DISTINCT Strain.Name, PublishData.value, " "PublishSE.error, NStrain.count FROM " "(PublishData, Strain, PublishXRef, PublishFreeze) " @@ -108,7 +109,7 @@ def get_trait_csv_sample_data(conn: Any, return "\n".join(csv_data) -def update_sample_data(conn: Any, +def update_sample_data(conn: Any, #pylint: disable=[R0913] trait_name: str, strain_name: str, phenotype_id: int, @@ -219,7 +220,7 @@ def delete_sample_data(conn: Any, "WHERE StrainId = %s AND DataId = %s" % (strain_id, data_id))) deleted_n_strains = cursor.rowcount - except Exception as e: + except Exception as e: #pylint: disable=[C0103, W0612] conn.rollback() raise MySQLdb.Error conn.commit() @@ -230,7 +231,7 @@ def delete_sample_data(conn: Any, deleted_se_data, deleted_n_strains) -def insert_sample_data(conn: Any, +def insert_sample_data(conn: Any, #pylint: disable=[R0913] trait_name: str, strain_name: str, phenotype_id: int, @@ -272,7 +273,7 @@ def insert_sample_data(conn: Any, "VALUES (%s, %s, %s)") % (strain_id, data_id, count)) inserted_n_strains = cursor.rowcount - except Exception as e: + except Exception as e: #pylint: disable=[C0103, W0612] conn.rollback() raise MySQLdb.Error return (inserted_published_data, @@ -450,7 +451,7 @@ def set_homologene_id_field(trait_type, trait_info, conn): Common postprocessing function for all trait types. Sets the value for the 'homologene' key.""" - def set_to_null(ti): return {**ti, "homologeneid": None} + def set_to_null(ti): return {**ti, "homologeneid": None} # pylint: disable=[C0103, C0321] functions_table = { "Temp": set_to_null, "Geno": set_to_null, @@ -656,8 +657,9 @@ def retrieve_temp_trait_data(trait_info: dict, conn: Any): query, {"trait_name": trait_info["trait_name"]}) return [dict(zip( - ["sample_name", "value", "se_error", "nstrain", "id"], row)) - for row in cursor.fetchall()] + ["sample_name", "value", "se_error", "nstrain", "id"], + row)) + for row in cursor.fetchall()] return [] @@ -696,8 +698,10 @@ def retrieve_geno_trait_data(trait_info: Dict, conn: Any): "dataset_name": trait_info["db"]["dataset_name"], "species_id": retrieve_species_id( trait_info["db"]["group"], conn)}) - return [dict(zip( - ["sample_name", "value", "se_error", "id"], row)) + return [ + dict(zip( + ["sample_name", "value", "se_error", "id"], + row)) for row in cursor.fetchall()] return [] @@ -728,8 +732,9 @@ def retrieve_publish_trait_data(trait_info: Dict, conn: Any): query, {"trait_name": trait_info["trait_name"], "dataset_id": trait_info["db"]["dataset_id"]}) - return [dict(zip( - ["sample_name", "value", "se_error", "nstrain", "id"], row)) + return [ + dict(zip( + ["sample_name", "value", "se_error", "nstrain", "id"], row)) for row in cursor.fetchall()] return [] @@ -762,8 +767,9 @@ def retrieve_cellid_trait_data(trait_info: Dict, conn: Any): {"cellid": trait_info["cellid"], "trait_name": trait_info["trait_name"], "dataset_id": trait_info["db"]["dataset_id"]}) - return [dict(zip( - ["sample_name", "value", "se_error", "id"], row)) + return [ + dict(zip( + ["sample_name", "value", "se_error", "id"], row)) for row in cursor.fetchall()] return [] @@ -792,8 +798,9 @@ def retrieve_probeset_trait_data(trait_info: Dict, conn: Any): query, {"trait_name": trait_info["trait_name"], "dataset_name": trait_info["db"]["dataset_name"]}) - return [dict(zip( - ["sample_name", "value", "se_error", "id"], row)) + return [ + dict(zip( + ["sample_name", "value", "se_error", "id"], row)) for row in cursor.fetchall()] return [] -- cgit v1.2.3