Skip to content

Commit 1c0c4e2

Browse files
authored
Merge pull request #409 from monarch-initiative/release-0.9.3
Release `v0.9.3`
2 parents 83e94b4 + 84e48b1 commit 1c0c4e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1154
-541
lines changed

docs/conf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import sys
55

6+
67
# -- General configuration ------------------------------------------------
78

89
# If your documentation needs a minimal Sphinx version, state it here.
@@ -63,7 +64,7 @@
6364
# The short X.Y version.
6465
version = u'0.9'
6566
# The full version, including alpha/beta/rc tags.
66-
release = u'0.9.2'
67+
release = u'0.9.3'
6768

6869
# The language for content autogenerated by Sphinx. Refer to documentation
6970
# for a list of supported languages.
@@ -217,4 +218,4 @@
217218
copybutton_exclude = '.linenos, .gp, .go'
218219

219220
# -- Sphinx Dark Mode setup --------------------------------------------------
220-
# default_dark_mode = False
221+
# default_dark_mode = False
-2.59 KB
Loading
Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
Allele group,Missense,Missense,Truncating,Truncating,,
2-
,Count,Percent,Count,Percent,Corrected p values,p values
3-
Ventricular septal defect [HP:0001629],31/60,52%,29/29,100%,9.550859422122477e-06,5.618152601248516e-07
4-
Hypoplasia of the radius [HP:0002984],30/62,48%,10/27,37%,1.0,0.3614379675325876
5-
Atrial septal defect [HP:0001631],42/44,95%,38/38,100%,1.0,0.49653718759409815
6-
Secundum atrial septal defect [HP:0001684],14/35,40%,13/40,32%,1.0,0.6304400561799244
7-
Abnormal cardiac septum morphology [HP:0001671],62/62,100%,50/50,100%,1.0,1.0
8-
Abnormal hand morphology [HP:0005922],53/53,100%,41/41,100%,1.0,1.0
9-
Abnormal atrial septum morphology [HP:0011994],43/43,100%,38/38,100%,1.0,1.0
10-
Abnormal cardiac atrium morphology [HP:0005120],43/43,100%,38/38,100%,1.0,1.0
11-
Abnormal appendicular skeleton morphology [HP:0011844],64/64,100%,60/60,100%,1.0,1.0
12-
Aplasia/hypoplasia of the extremities [HP:0009815],55/55,100%,44/44,100%,1.0,1.0
13-
Aplasia/hypoplasia involving the skeleton [HP:0009115],56/56,100%,45/45,100%,1.0,1.0
14-
Aplasia/hypoplasia involving bones of the upper limbs [HP:0006496],55/55,100%,44/44,100%,1.0,1.0
15-
Aplasia/hypoplasia involving bones of the extremities [HP:0045060],55/55,100%,44/44,100%,1.0,1.0
16-
Abnormal long bone morphology [HP:0011314],44/44,100%,19/19,100%,1.0,1.0
17-
Abnormal finger morphology [HP:0001167],36/36,100%,56/56,100%,1.0,1.0
18-
Abnormal digit morphology [HP:0011297],38/38,100%,59/59,100%,1.0,1.0
19-
Abnormal thumb morphology [HP:0001172],30/30,100%,56/56,100%,1.0,1.0
1+
,Missense,Truncating,Corrected p values,p values
2+
Ventricular septal defect [HP:0001629],31/60 (52%),29/29 (100%),9.550859422122477e-06,5.618152601248516e-07
3+
Hypoplasia of the radius [HP:0002984],30/62 (48%),10/27 (37%),1.0,0.3614379675325876
4+
Atrial septal defect [HP:0001631],42/44 (95%),38/38 (100%),1.0,0.49653718759409815
5+
Secundum atrial septal defect [HP:0001684],14/35 (40%),13/40 (32%),1.0,0.6304400561799244
6+
Abnormal thumb morphology [HP:0001172],30/30 (100%),56/56 (100%),1.0,1.0
7+
Abnormal finger morphology [HP:0001167],36/36 (100%),56/56 (100%),1.0,1.0
8+
Abnormal digit morphology [HP:0011297],38/38 (100%),59/59 (100%),1.0,1.0
9+
Abnormal atrial septum morphology [HP:0011994],43/43 (100%),38/38 (100%),1.0,1.0
10+
Abnormal cardiac atrium morphology [HP:0005120],43/43 (100%),38/38 (100%),1.0,1.0
11+
Abnormal long bone morphology [HP:0011314],44/44 (100%),19/19 (100%),1.0,1.0
12+
Abnormal hand morphology [HP:0005922],53/53 (100%),41/41 (100%),1.0,1.0
13+
Aplasia/hypoplasia of the extremities [HP:0009815],55/55 (100%),44/44 (100%),1.0,1.0
14+
Aplasia/hypoplasia involving bones of the upper limbs [HP:0006496],55/55 (100%),44/44 (100%),1.0,1.0
15+
Aplasia/hypoplasia involving bones of the extremities [HP:0045060],55/55 (100%),44/44 (100%),1.0,1.0
16+
Aplasia/hypoplasia involving the skeleton [HP:0009115],56/56 (100%),45/45 (100%),1.0,1.0
17+
Abnormal cardiac septum morphology [HP:0001671],62/62 (100%),50/50 (100%),1.0,1.0
18+
Abnormal appendicular skeleton morphology [HP:0011844],64/64 (100%),60/60 (100%),1.0,1.0

docs/tutorial.rst

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -166,32 +166,17 @@ the most common HPO terms, variants, diseases, and variant effects:
166166
Plot distribution of variants with respect to the protein sequence
167167
------------------------------------------------------------------
168168

169-
We can also show the distribution of variants with respect to the encoded protein.
170-
We first obtain ``tx_coordinates`` (:class:`~gpsea.model.TranscriptCoordinates`)
171-
with genomic coordinates of the transcript, including e.g. untranslated regions or exons:
169+
We can use :class:`~gpsea.view.CohortArtist` to plot the distribution of variants
170+
with respect to the encoded protein on
171+
a Matplotlib `Axes <https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html>`_:
172172

173-
>>> from gpsea.preprocessing import configure_default_tx_coordinate_service
174-
>>> tx_service = configure_default_tx_coordinate_service(genome_build="GRCh38.p13")
175-
>>> tx_coordinates = tx_service.fetch(tx_id)
176-
177-
178-
and we also get ``protein_meta`` (:class:`~gpsea.model.ProteinMetadata`)
179-
with the domains and regions of the encoded protein:
180-
181-
>>> from gpsea.preprocessing import configure_default_protein_metadata_service
182-
>>> pms = configure_default_protein_metadata_service()
183-
>>> protein_meta = pms.annotate(px_id)
184-
185-
Now we can plot a diagram of the mutations on the protein:
186-
187-
>>> from gpsea.view import ProteinVisualizer
188173
>>> import matplotlib.pyplot as plt
174+
>>> from gpsea.view import configure_default_cohort_artist
175+
>>> cohort_artist = configure_default_cohort_artist()
189176
>>> fig, ax = plt.subplots(figsize=(15, 8))
190-
>>> visualizer = ProteinVisualizer()
191-
>>> visualizer.draw_protein_diagram(
192-
... tx_coordinates,
193-
... protein_meta,
194-
... cohort,
177+
>>> cohort_artist.draw_protein(
178+
... cohort=cohort,
179+
... protein_id=px_id,
195180
... ax=ax,
196181
... )
197182

docs/user-guide/analyses/partitioning/genotype/allele_count.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ based on presence of zero or one *EGFR* mutation allele:
6161
... target=affects_egfr,
6262
... )
6363
>>> gt_clf.class_labels
64-
('0', '1')
64+
('0 alleles', '1 allele')
6565

6666
The ``allele_count`` needs two inputs.
6767
The ``counts`` takes a tuple of the target allele counts,
@@ -102,9 +102,9 @@ and we will compare the individuals with one allele with those with two alleles:
102102
... target=affects_lmna,
103103
... )
104104
>>> gt_clf.class_labels
105-
('1', '2')
105+
('1 allele', '2 alleles')
106106

107107

108108
The classifier assigns the individuals into one of two classes:
109109
those with one *LMNA* variant allele and those with two *LMNA* variant alleles.
110-
Any cohort member with other allele counts (e.g. `0` or `3`) is ignored.
110+
Any cohort member with other allele counts (e.g. `0 allele` or `3 alleles`) is ignored.

docs/user-guide/analyses/phenotype-scores.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ This is a non-parametric test that compares the medians of the two classes to de
3939
>>> r = stats.mannwhitneyu(x=class1, y=class2, alternative = 'two-sided')
4040
>>> p_value = r.pvalue
4141
>>> float(p_value)
42-
6.348081479150902e-06
42+
6.348081479150...e-06
4343

4444

45-
p value of `6.348081479150901e-06` suggests a significant difference between the classes.
45+
p value of `6.348081479150e-06` suggests a significant difference between the classes.
4646

4747

4848
****************
@@ -73,7 +73,7 @@ from a `JSON file <https://github.com/monarch-initiative/gpsea/tree/main/docs/co
7373
The cohort was prepared from phenopackets as described in :ref:`create-a-cohort` section,
7474
and then serialized as a JSON file following the instructions in :ref:`cohort-persistence` section.
7575

76-
..
76+
..
7777
Prepare the JSON file by running the tests in `tests/tests/test_generate_doc_cohorts.py`.
7878
7979
>>> import json
@@ -99,8 +99,8 @@ Genotype predicate
9999
------------------
100100

101101
*Jordan et al.* compare phenotype of individuals harboring point mutations
102-
with the individuals carrying loss of function mutations.
103-
Let's create a predicate for testing if the variant
102+
with the individuals carrying loss of function mutations.
103+
Let's create a predicate for testing if the variant
104104
is a point mutation or a loss of function mutation.
105105

106106
In this example, the point mutation is a mutation that meets the following conditions:
@@ -158,7 +158,7 @@ As far as GPSEA framework is concerned, the phenotype score must be a floating p
158158
or a `NaN` value if the score cannot be computed for an individual.
159159
This is the essence of the :class:`~gpsea.analysis.pscore.PhenotypeScorer` class.
160160

161-
GPSEA ships with several builtin phenotype scorers which can be used as
161+
GPSEA ships with several builtin phenotype scorers which can be used as
162162

163163
+------------------------------------------------------------+---------------------------------------------+
164164
| Name | Description |
@@ -189,7 +189,7 @@ from the following 5 categories:
189189

190190
For example, an individual with a congenital heart defect would be assigned a score of `1`,
191191
an individual with congenital heart defect and a renal anomaly would be assigned a score of `2`,
192-
and so on. If an individual had two heart defects (e.g., atrial septal defect and ventricular septal defect),
192+
and so on. If an individual had two heart defects (e.g., atrial septal defect and ventricular septal defect),
193193
a score of 1 (not 2) would be assigned for the heart defect category.
194194

195195
The :class:`~gpsea.analysis.pscore.CountingPhenotypeScorer` automatizes this scoring method
@@ -245,7 +245,7 @@ We will put the final analysis together into :class:`~gpsea.analysis.pscore.Phen
245245

246246
>>> from gpsea.analysis.pscore import PhenotypeScoreAnalysis
247247
>>> score_analysis = PhenotypeScoreAnalysis(
248-
... score_statistic=score_statistic,
248+
... score_statistic=score_statistic,
249249
... )
250250

251251

@@ -265,8 +265,8 @@ In case of the *RERE* cohort, the analysis shows a significant difference
265265
between the number of structural defects in individuals
266266
with point vs. loss-of-function mutations.
267267

268-
>>> result.pval
269-
0.012074957610483744
268+
>>> result.pval # doctest: +ELLIPSIS
269+
0.0120749576...
270270

271271

272272
To explore further, we can access a data frame with genotype categories and phenotype counts:
5 Bytes
Loading
Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
1-
Allele group,Frameshift,Frameshift,Other,Other,,
2-
,Count,Percent,Count,Percent,Corrected p values,p values
3-
Ventricular septal defect [HP:0001629],19/19,100%,42/71,59%,0.005806240832840839,0.00024192670136836828
4-
Absent thumb [HP:0009777],14/31,45%,18/100,18%,0.04456405819223913,0.0037136715160199273
5-
Secundum atrial septal defect [HP:0001684],4/22,18%,23/55,42%,0.4065940176561687,0.06544319142266644
6-
Triphalangeal thumb [HP:0001199],13/32,41%,23/99,23%,0.4065940176561687,0.06932119159387057
7-
Muscular ventricular septal defect [HP:0011623],6/25,24%,8/84,10%,0.4065940176561687,0.08470708701170182
8-
Short thumb [HP:0009778],8/30,27%,25/69,36%,1.0,0.4870099714553749
9-
Absent radius [HP:0003974],6/25,24%,9/43,21%,1.0,0.7703831604944444
10-
Atrial septal defect [HP:0001631],20/20,100%,63/65,97%,1.0,1.0
11-
Abnormal atrial septum morphology [HP:0011994],20/20,100%,64/64,100%,1.0,1.0
12-
Abnormal cardiac septum morphology [HP:0001671],28/28,100%,89/89,100%,1.0,1.0
13-
Abnormal cardiac atrium morphology [HP:0005120],20/20,100%,64/64,100%,1.0,1.0
14-
Hypoplasia of the radius [HP:0002984],6/14,43%,34/75,45%,1.0,1.0
15-
Abnormal appendicular skeleton morphology [HP:0011844],34/34,100%,93/93,100%,1.0,1.0
16-
Aplasia/hypoplasia of the extremities [HP:0009815],22/22,100%,78/78,100%,1.0,1.0
17-
Aplasia/hypoplasia involving the skeleton [HP:0009115],23/23,100%,80/80,100%,1.0,1.0
18-
Aplasia/hypoplasia involving bones of the upper limbs [HP:0006496],22/22,100%,78/78,100%,1.0,1.0
19-
Aplasia/hypoplasia involving bones of the extremities [HP:0045060],22/22,100%,78/78,100%,1.0,1.0
20-
Abnormal long bone morphology [HP:0011314],13/13,100%,50/50,100%,1.0,1.0
21-
Abnormal hand morphology [HP:0005922],20/20,100%,75/75,100%,1.0,1.0
22-
Abnormal thumb morphology [HP:0001172],31/31,100%,58/58,100%,1.0,1.0
23-
Abnormal finger morphology [HP:0001167],31/31,100%,64/64,100%,1.0,1.0
24-
Abnormal digit morphology [HP:0011297],33/33,100%,67/67,100%,1.0,1.0
25-
Aplasia/Hypoplasia of fingers [HP:0006265],19/19,100%,44/44,100%,1.0,1.0
26-
Aplasia/hypoplasia involving bones of the hand [HP:0005927],19/19,100%,44/44,100%,1.0,1.0
1+
,Frameshift,Other,Corrected p values,p values
2+
Ventricular septal defect [HP:0001629],19/19 (100%),42/71 (59%),0.005806240832840839,0.00024192670136836828
3+
Absent thumb [HP:0009777],14/31 (45%),18/100 (18%),0.04456405819223913,0.0037136715160199273
4+
Secundum atrial septal defect [HP:0001684],4/22 (18%),23/55 (42%),0.4065940176561687,0.06544319142266644
5+
Triphalangeal thumb [HP:0001199],13/32 (41%),23/99 (23%),0.4065940176561687,0.06932119159387057
6+
Muscular ventricular septal defect [HP:0011623],6/25 (24%),8/84 (10%),0.4065940176561687,0.08470708701170182
7+
Short thumb [HP:0009778],8/30 (27%),25/69 (36%),1.0,0.4870099714553749
8+
Absent radius [HP:0003974],6/25 (24%),9/43 (21%),1.0,0.7703831604944444
9+
Abnormal long bone morphology [HP:0011314],13/13 (100%),50/50 (100%),1.0,1.0
10+
Aplasia/Hypoplasia of fingers [HP:0006265],19/19 (100%),44/44 (100%),1.0,1.0
11+
Aplasia/hypoplasia involving bones of the hand [HP:0005927],19/19 (100%),44/44 (100%),1.0,1.0
12+
Atrial septal defect [HP:0001631],20/20 (100%),63/65 (97%),1.0,1.0
13+
Abnormal atrial septum morphology [HP:0011994],20/20 (100%),64/64 (100%),1.0,1.0
14+
Abnormal cardiac atrium morphology [HP:0005120],20/20 (100%),64/64 (100%),1.0,1.0
15+
Abnormal hand morphology [HP:0005922],20/20 (100%),75/75 (100%),1.0,1.0
16+
Aplasia/hypoplasia of the extremities [HP:0009815],22/22 (100%),78/78 (100%),1.0,1.0
17+
Aplasia/hypoplasia involving bones of the upper limbs [HP:0006496],22/22 (100%),78/78 (100%),1.0,1.0
18+
Aplasia/hypoplasia involving bones of the extremities [HP:0045060],22/22 (100%),78/78 (100%),1.0,1.0
19+
Aplasia/hypoplasia involving the skeleton [HP:0009115],23/23 (100%),80/80 (100%),1.0,1.0
20+
Abnormal cardiac septum morphology [HP:0001671],28/28 (100%),89/89 (100%),1.0,1.0
21+
Abnormal thumb morphology [HP:0001172],31/31 (100%),58/58 (100%),1.0,1.0
22+
Abnormal finger morphology [HP:0001167],31/31 (100%),64/64 (100%),1.0,1.0
23+
Abnormal digit morphology [HP:0011297],33/33 (100%),67/67 (100%),1.0,1.0
24+
Abnormal appendicular skeleton morphology [HP:0011844],34/34 (100%),93/93 (100%),1.0,1.0
25+
Hypoplasia of the radius [HP:0002984],6/14 (43%),34/75 (45%),1.0,1.0
792 Bytes
Loading

docs/user-guide/analyses/survival.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ from a `JSON file <https://github.com/monarch-initiative/gpsea/tree/main/docs/co
2727
The cohort was prepared from phenopackets as described in :ref:`create-a-cohort` section,
2828
and then serialized as a JSON file following the instructions in :ref:`cohort-persistence` section.
2929

30-
..
30+
..
3131
Prepare the JSON file by running the tests in `tests/tests/test_generate_doc_cohorts.py`.
3232
3333
>>> import json
@@ -127,7 +127,7 @@ We execute the analysis by running
127127
... )
128128

129129
>>> result.pval
130-
0.06200425830044376
130+
0.062004258300...
131131

132132

133133
Kaplan-Meier curves
@@ -145,13 +145,13 @@ We can plot Kaplan-Meier curves:
145145
... )
146146
>>> _ = ax.xaxis.set(
147147
... # Show X axis in years ...
148-
... major_formatter=mpl.ticker.FuncFormatter(lambda x, pos: f"{x / Age.DAYS_IN_YEAR:.0f}"),
148+
... major_formatter=mpl.ticker.FuncFormatter(lambda x, pos: f"{x / Age.DAYS_IN_YEAR:.0f}"),
149149
... # ... with a tick for every decade
150150
... major_locator=mpl.ticker.MultipleLocator(10 * Age.DAYS_IN_YEAR),
151151
... )
152152
>>> _ = ax.set(
153153
... xlabel=endpoint.name + " [years]",
154-
... ylabel="Empirical survival",
154+
... ylabel="Event-free proportion",
155155
... )
156156
>>> _ = ax.grid(axis="y")
157157

@@ -164,7 +164,7 @@ We can plot Kaplan-Meier curves:
164164
:hide:
165165

166166
>>> if _overwrite: fig.savefig('docs/user-guide/analyses/report/umod_km_curves.png')
167-
167+
168168

169169
Raw data
170170
--------
@@ -174,7 +174,7 @@ The `result` includes the survival values for all cohort members:
174174
>>> survivals = result.data.sort_index()
175175
>>> survivals.head() # doctest: +NORMALIZE_WHITESPACE
176176
genotype phenotype
177-
patient_id
177+
patient_id
178178
AII.1[PMID_22034507_AII_1] 0 Survival(value=18262.5, is_censored=True)
179179
AII.2[PMID_22034507_AII_2] 0 None
180180
AII.3[PMID_22034507_AII_3] 0 Survival(value=16436.25, is_censored=True)

0 commit comments

Comments
 (0)