You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-16Lines changed: 10 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,14 +41,14 @@ It supports GA4GH-oriented formats such as Beacon Friendly Format (`BFF`) and Ph
41
41
42
42
## What It Does
43
43
44
-
`Pheno-Ranker` turns hierarchical records into comparable binary vectors and computes pairwise similarity or distance metrics.
44
+
`Pheno-Ranker` turns hierarchical records into comparable one-hot encoded binary vectors. It then computes pairwise similarity or distance metrics for cohort exploration, patient matching, clustering, multidimensional scaling, and graph analytics.
45
45
46
46
Main workflows:
47
47
48
48
-**Cohort mode**: compare every individual or record against every other record in one or more cohorts.
49
49
-**Patient mode**: rank records in a reference cohort against a target patient or object.
50
50
-**Generic JSON mode**: compare arbitrary categorical JSON data using a configuration file.
Copy file name to clipboardExpand all lines: README.md.template
+10-16Lines changed: 10 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -41,14 +41,14 @@ It supports GA4GH-oriented formats such as Beacon Friendly Format (`BFF`) and Ph
41
41
42
42
## What It Does
43
43
44
-
`Pheno-Ranker` turns hierarchical records into comparable binary vectors and computes pairwise similarity or distance metrics.
44
+
`Pheno-Ranker` turns hierarchical records into comparable one-hot encoded binary vectors. It then computes pairwise similarity or distance metrics for cohort exploration, patient matching, clustering, multidimensional scaling, and graph analytics.
45
45
46
46
Main workflows:
47
47
48
48
- **Cohort mode**: compare every individual or record against every other record in one or more cohorts.
49
49
- **Patient mode**: rank records in a reference cohort against a target patient or object.
50
50
- **Generic JSON mode**: compare arbitrary categorical JSON data using a configuration file.
Copy file name to clipboardExpand all lines: docs/algorithm.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,7 @@ Note that the flattened keys maintain the original hierarchical relationships of
76
76
77
77
## Step 2: Generate global hash for reference cohort(s)
78
78
79
-
We generate a global hash for the reference cohort(s) by utilizing the unique variable entries. The size of the hash depends on the number of variables present in the cohort. The algorithm is optimized to handle a large number of variables, even exceeding 100K (e.g., when considering genomic variation data such as SNPs). To address any potential limitations, the algorithm allows selecting a randomly subset of N random variables from the total available (with the flag `--max-number-var`).
79
+
We generate a global hash for the reference cohort(s) by utilizing the unique variable entries. The size of the hash depends on the number of variables present in the cohort. The algorithm is optimized to handle a large number of variables, even exceeding 100K (e.g., when considering genomic variation data such as SNPs). To address any potential limitations, the algorithm allows selecting a random subset of N variables from the total available with `--max-number-vars`.
80
80
81
81
```json
82
82
{
@@ -104,4 +104,4 @@ When working with a target patient's data from a JSON file, it is flattened usin
104
104
105
105
## Step 5: Compute metrics
106
106
107
-
Compute differents metrics depending on _cohort_ or _target_ mode.
107
+
Compute different metrics depending on _cohort_ or _target_ mode.
Copy file name to clipboardExpand all lines: docs/cohort.md
+34-14Lines changed: 34 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,20 @@
1
-
_Cohort mode_ performs a **cross-comparison** of all individuals in a cohort(s) using as a metric the [Hamming distance](https://en.wikipedia.org/wiki/Hamming_distance) or the [Jaccard index](https://en.wikipedia.org/wiki/Jaccard_index). The resulting matrix can be further analyzed (e.g., with `R`) using unsupervised learning techniques such as cluster characterization, dimensionality reduction, or graph-based analytics.
1
+
# Cohort Mode
2
+
3
+
_Cohort mode_ performs an all-vs-all comparison of records in one or more cohorts. Each record is flattened, encoded as a binary vector, and compared with either [Hamming distance](https://en.wikipedia.org/wiki/Hamming_distance) or the [Jaccard index](https://en.wikipedia.org/wiki/Jaccard_index).
4
+
5
+
Use cohort mode when you want to explore the structure of a cohort, compare multiple cohorts, identify clusters, run dimensionality reduction, or export a graph for network analysis.
6
+
7
+
## What You Get
8
+
9
+
-`matrix.txt`: the default dense pairwise comparison matrix.
10
+
-`graph.json`: an optional Cytoscape-compatible graph when `--cytoscape-json` is used.
11
+
-`graph_stats.txt`: optional graph summary statistics when `--graph-stats` is used.
12
+
-`export.*.json`: optional intermediate hashes, vectors, and coverage statistics when `--export` is used.
13
+
-`matrix.mtx`: optional sparse Matrix Market output for large matrix workflows.
14
+
15
+
[See common usage](usage.md){ .md-button .md-button--primary }
We created a [tutorial](generic-json.md) that deliberately uses generic JSON data (i.e., movies) to illustrate the capabilities of `Pheno-Ranker`, as starting with familiar examples can help you better grasp its usage.
@@ -11,17 +27,18 @@ The examples below show common cohort-mode command-line patterns. For the comple
11
27
12
28
=== "Intra-cohort"
13
29
14
-
For this example, we'll use [`individuals.json`](https://github.com/CNAG-Biomedical-Informatics/pheno-ranker/blob/main/t/data/individuals.json), which contains a `JSON` array of 36 patients. We will conduct a comprehensive cross-comparison among all individuals within this file.
30
+
For this example, we use [`individuals.json`](https://github.com/CNAG-Biomedical-Informatics/pheno-ranker/blob/main/t/data/individuals.json), a `JSON` array with 36 patients. The goal is to compare every patient against every other patient in the file.
By default, cohort mode writes a dense tab-separated matrix (`matrix.txt`). For large cohorts, you can instead write a sparse [Matrix Market](https://math.nist.gov/MatrixMarket/formats.html) coordinate file:
38
62
@@ -51,16 +75,13 @@ The examples below show common cohort-mode command-line patterns. For the comple
51
75
52
76
Matrix output and Cytoscape graph output are generated independently. This means `--matrix-format mtx` can be combined with `--cytoscape-json`.
53
77
54
-
??? Tip "Defining the similarity metric"
55
-
Use the flag `--similarity-metric-cohort`. The default value is `hamming`. The alternative value is `jaccard`.
56
-
57
78
??? Tip "Exporting intermediate files"
58
-
It is possible to export all intermediate files, as well as a file indicating coverage with the flag `--e`.
79
+
It is possible to export all intermediate files, as well as a file indicating coverage, with `--export` (`--e`).
59
80
Examples:
60
81
61
82
```bash
62
-
pheno-ranker -r individuals.json --e
63
-
pheno-ranker -r individuals.json --e my_fav_id # for choosing a prefix
83
+
pheno-ranker -r individuals.json --export
84
+
pheno-ranker -r individuals.json --export my_fav_id # choose a prefix
64
85
```
65
86
66
87
The intermediate files can be used for further processing (e.g., import to a database; see [FAQs](faq.md)) or to make **informed decisions**. For instance, the file `export.coverage_stats.json` has stats on the coverage of each term (1D-key) in the cohort. It is possible to go more granular with a tool like `jq` that parses `JSON`. For instance:
@@ -158,11 +179,10 @@ The examples below show common cohort-mode command-line patterns. For the comple
158
179
159
180
=== "Inter-cohort"
160
181
161
-
We'll be using `individuals.json` again, which includes data for 36 patients. This time, however, we'll use it twice to simulate having two cohorts. The software will add a `CX_` prefix to the `primary_key` values to help us keep track of which patient comes from which usage of the file.
182
+
We use `individuals.json` again, but pass it twice to simulate two cohorts. `Pheno-Ranker` adds a `CX_` prefix to the `primary_key` values so each record can be traced back to its source cohort.
162
183
163
184
```bash
164
185
pheno-ranker -r individuals.json individuals.json
165
-
166
186
```
167
187
168
188
!!! Question "Is it possible to have a cohort with just one individual?"
@@ -178,8 +198,8 @@ The examples below show common cohort-mode command-line patterns. For the comple
178
198
179
199
```bash
180
200
pheno-ranker -r individuals.json individuals.json --append-prefixes REF TAR
181
-
182
201
```
202
+
183
203
This will create a `matrix.txt` file of (36+36) x (36+36) cells. Again, this matrix can be processed with R:
Copy file name to clipboardExpand all lines: docs/other-formats.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@
6
6
`Pheno-Ranker` _a priori_ accepts as input "any" `JSON` or `YAML` array file. In order to do it, you'll need a **configuration file**. See a tutorial on how to use it [here](generic-json.md#moviepackets).
7
7
8
8
!!! Bug "What do you mean by "any" `JSON` or `YAML`?"
9
-
`Pheno-Ranker` is capable of processing deeply nested data structures but has its limitations. If your data includes arrays nested more than one level deep, we recommend you that you tranform the 2D (or more) nested array elements into 1D objects.
9
+
`Pheno-Ranker` is capable of processing deeply nested data structures but has its limitations. If your data includes arrays nested more than one level deep, we recommend transforming the 2D (or more) nested array elements into 1D objects.
0 commit comments