Skip to content

Commit 492e763

Browse files
committed
Merge
1 parent d313892 commit 492e763

24 files changed

+738
-228
lines changed

docs/conf.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# https://www.sphinx-doc.org/en/master/usage/configuration.html
55

66
import os
7-
import re
87
import sys
98
from datetime import date
109
from sssom import __version__
@@ -13,9 +12,9 @@
1312
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
1413
sys.path.insert(0, os.path.abspath("../"))
1514

16-
project = 'sssom-py'
15+
project = "sssom-py"
1716
copyright = f"{date.today().year}, Chris Mungall; Nicolas Matentzoglu; Harshad Hegde"
18-
author = 'Chris Mungall; Nicolas Matentzoglu; Harshad Hegde'
17+
author = "Chris Mungall; Nicolas Matentzoglu; Harshad Hegde"
1918
release = __version__
2019

2120
# -- General configuration ---------------------------------------------------
@@ -78,7 +77,7 @@
7877
"github_repo": "sssom-py",
7978
"github_version": "master/docs/",
8079
"display_github": True, # Add 'Edit on Github' link instead of 'View page source'
81-
"conf_py_path": "/master/docs/", # Path in the checkout to the docs root
80+
"conf_py_path": "/master/docs/", # Path in the checkout to the docs root
8281
}
8382

8483
# The name of an image file (relative to this directory) to place at the top

src/sssom/cli.py

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ def split(input: str, output_directory: str, method: SplitMethod) -> None:
251251
type=click.FloatRange(0, 1),
252252
help="Default confidence to be assigned if absent.",
253253
)
254-
def ptable(input: str, output: TextIO, inverse_factor: float, default_confidence: float) -> None:
254+
def ptable(
255+
input: str, output: TextIO, inverse_factor: float, default_confidence: float
256+
) -> None:
255257
"""Convert an SSSOM file to a ptable for kboom/`boomer <https://github.com/INCATools/boomer>`_."""
256258
# TODO should maybe move to boomer (but for now it can live here, so cjm can tweak
257259
msdf = parse_sssom_table(input)
@@ -301,7 +303,9 @@ def dosql(query: str, inputs: List[str], output: TextIO) -> None:
301303
run_sql_query(query=query, inputs=inputs, output=output)
302304
except ModuleNotFoundError as e:
303305
if e.name == "pansql":
304-
raise click.ClickException("The dosql command requires the optional pansql module.")
306+
raise click.ClickException(
307+
"The dosql command requires the optional pansql module."
308+
)
305309
raise
306310

307311
# n = 1
@@ -458,7 +462,9 @@ def cliquesummary(input: str, output: TextIO, metadata: str, statsfile: str) ->
458462
@output_option
459463
@transpose_option
460464
@fields_option
461-
def crosstab(input: str, output: TextIO, transpose: bool, fields: Tuple[str, str]) -> None:
465+
def crosstab(
466+
input: str, output: TextIO, transpose: bool, fields: Tuple[str, str]
467+
) -> None:
462468
"""Write sssom summary cross-tabulated by categories."""
463469
df = remove_unmatched(parse_sssom_table(input).df)
464470
logging.info(f"#CROSSTAB ON {fields}")
@@ -474,12 +480,16 @@ def crosstab(input: str, output: TextIO, transpose: bool, fields: Tuple[str, str
474480
@transpose_option
475481
@fields_option
476482
@input_argument
477-
def correlations(input: str, output: TextIO, transpose: bool, fields: Tuple[str, str]) -> None:
483+
def correlations(
484+
input: str, output: TextIO, transpose: bool, fields: Tuple[str, str]
485+
) -> None:
478486
"""Calculate correlations."""
479487
try:
480488
from scipy.stats import chi2_contingency
481489
except ModuleNotFoundError:
482-
raise click.ClickException("The correlations command requires the optional scipy module.")
490+
raise click.ClickException(
491+
"The correlations command requires the optional scipy module."
492+
)
483493

484494
msdf = parse_sssom_table(input)
485495
df = remove_unmatched(msdf.df)
@@ -645,7 +655,9 @@ def filter(input: str, output: TextIO, **kwargs: Any) -> None:
645655
filter_file(input=input, output=output, **kwargs)
646656
except ModuleNotFoundError as e:
647657
if e.name == "pansql":
648-
raise click.ClickException("The filter command requires the pansql optional module.")
658+
raise click.ClickException(
659+
"The filter command requires the pansql optional module."
660+
)
649661
raise
650662

651663

@@ -664,9 +676,13 @@ def filter(input: str, output: TextIO, **kwargs: Any) -> None:
664676
help="Multivalued slots should be replaced or not.",
665677
)
666678
@dynamically_generate_sssom_options(SSSOM_SV_OBJECT.mapping_set_slots)
667-
def annotate(input: str, output: TextIO, replace_multivalued: bool, **kwargs: Any) -> None:
679+
def annotate(
680+
input: str, output: TextIO, replace_multivalued: bool, **kwargs: Any
681+
) -> None:
668682
"""Annotate metadata of a mapping set."""
669-
annotate_file(input=input, output=output, replace_multivalued=replace_multivalued, **kwargs)
683+
annotate_file(
684+
input=input, output=output, replace_multivalued=replace_multivalued, **kwargs
685+
)
670686

671687

672688
@main.command()
@@ -706,7 +722,9 @@ def remove(input: str, output: TextIO, remove_map: str) -> None:
706722
is_flag=True,
707723
help="If True (default), the justification is updated to 'sempav:MappingInversion', else it is left as it is.",
708724
)
709-
@click.option("--inverse-map", help="Path to file that contains the inverse predicate dictionary.")
725+
@click.option(
726+
"--inverse-map", help="Path to file that contains the inverse predicate dictionary."
727+
)
710728
def invert(
711729
input: str,
712730
output: TextIO,

src/sssom/cliquesummary.py

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@
55
"""
66

77
import dataclasses
8-
import re
9-
import sys
108
from dataclasses import dataclass
119
from typing import Any, ClassVar, Dict, List, Optional, Union
1210

13-
from jsonasobj2 import JsonObj, as_dict
14-
from linkml_runtime.linkml_model.meta import EnumDefinition, PermissibleValue, PvFormulaOptions
1511
from linkml_runtime.utils.curienamespace import CurieNamespace
16-
from linkml_runtime.utils.dataclass_extensions_376 import dataclasses_init_fn_with_kwargs
17-
from linkml_runtime.utils.enumerations import EnumDefinitionImpl
18-
from linkml_runtime.utils.formatutils import camelcase, sfx, underscore
12+
from linkml_runtime.utils.dataclass_extensions_376 import (
13+
dataclasses_init_fn_with_kwargs,
14+
)
1915
from linkml_runtime.utils.metamodelcore import (
2016
URI,
2117
Bool,
@@ -27,13 +23,14 @@
2723
XSDDate,
2824
XSDDateTime,
2925
XSDTime,
30-
bnode,
31-
empty_dict,
3226
empty_list,
3327
)
3428
from linkml_runtime.utils.slot import Slot
35-
from linkml_runtime.utils.yamlutils import YAMLRoot, extended_float, extended_int, extended_str
36-
from rdflib import Namespace, URIRef
29+
from linkml_runtime.utils.yamlutils import (
30+
YAMLRoot,
31+
extended_str,
32+
)
33+
from rdflib import URIRef
3734

3835
metamodel_version = "1.7.0"
3936

@@ -232,54 +229,78 @@ def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]):
232229
self.members = [v if isinstance(v, str) else str(v) for v in self.members]
233230

234231
if not isinstance(self.members_labels, list):
235-
self.members_labels = [self.members_labels] if self.members_labels is not None else []
236-
self.members_labels = [v if isinstance(v, str) else str(v) for v in self.members_labels]
232+
self.members_labels = (
233+
[self.members_labels] if self.members_labels is not None else []
234+
)
235+
self.members_labels = [
236+
v if isinstance(v, str) else str(v) for v in self.members_labels
237+
]
237238

238239
if self.num_members is not None and not isinstance(self.num_members, int):
239240
self.num_members = int(self.num_members)
240241

241-
if self.max_confidence is not None and not isinstance(self.max_confidence, float):
242+
if self.max_confidence is not None and not isinstance(
243+
self.max_confidence, float
244+
):
242245
self.max_confidence = float(self.max_confidence)
243246

244-
if self.min_confidence is not None and not isinstance(self.min_confidence, float):
247+
if self.min_confidence is not None and not isinstance(
248+
self.min_confidence, float
249+
):
245250
self.min_confidence = float(self.min_confidence)
246251

247-
if self.avg_confidence is not None and not isinstance(self.avg_confidence, float):
252+
if self.avg_confidence is not None and not isinstance(
253+
self.avg_confidence, float
254+
):
248255
self.avg_confidence = float(self.avg_confidence)
249256

250257
if self.is_conflated is not None and not isinstance(self.is_conflated, Bool):
251258
self.is_conflated = Bool(self.is_conflated)
252259

253-
if self.is_all_conflated is not None and not isinstance(self.is_all_conflated, Bool):
260+
if self.is_all_conflated is not None and not isinstance(
261+
self.is_all_conflated, Bool
262+
):
254263
self.is_all_conflated = Bool(self.is_all_conflated)
255264

256-
if self.total_conflated is not None and not isinstance(self.total_conflated, int):
265+
if self.total_conflated is not None and not isinstance(
266+
self.total_conflated, int
267+
):
257268
self.total_conflated = int(self.total_conflated)
258269

259270
if self.proportion_conflated is not None and not isinstance(
260271
self.proportion_conflated, float
261272
):
262273
self.proportion_conflated = float(self.proportion_conflated)
263274

264-
if self.conflation_score is not None and not isinstance(self.conflation_score, float):
275+
if self.conflation_score is not None and not isinstance(
276+
self.conflation_score, float
277+
):
265278
self.conflation_score = float(self.conflation_score)
266279

267280
if self.members_count is not None and not isinstance(self.members_count, int):
268281
self.members_count = int(self.members_count)
269282

270-
if self.min_count_by_source is not None and not isinstance(self.min_count_by_source, int):
283+
if self.min_count_by_source is not None and not isinstance(
284+
self.min_count_by_source, int
285+
):
271286
self.min_count_by_source = int(self.min_count_by_source)
272287

273-
if self.max_count_by_source is not None and not isinstance(self.max_count_by_source, int):
288+
if self.max_count_by_source is not None and not isinstance(
289+
self.max_count_by_source, int
290+
):
274291
self.max_count_by_source = int(self.max_count_by_source)
275292

276-
if self.avg_count_by_source is not None and not isinstance(self.avg_count_by_source, float):
293+
if self.avg_count_by_source is not None and not isinstance(
294+
self.avg_count_by_source, float
295+
):
277296
self.avg_count_by_source = float(self.avg_count_by_source)
278297

279298
if self.harmonic_mean_count_by_source is not None and not isinstance(
280299
self.harmonic_mean_count_by_source, float
281300
):
282-
self.harmonic_mean_count_by_source = float(self.harmonic_mean_count_by_source)
301+
self.harmonic_mean_count_by_source = float(
302+
self.harmonic_mean_count_by_source
303+
)
283304

284305
super().__post_init__(**kwargs)
285306

src/sssom/constants.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,11 @@ def multivalued_slots(self) -> Set[str]:
260260
@cached_property
261261
def entity_reference_slots(self) -> Set[str]:
262262
"""Return set of entity reference slots."""
263-
return {c for c in self.view.all_slots() if self.view.get_slot(c).range == ENTITY_REFERENCE}
263+
return {
264+
c
265+
for c in self.view.all_slots()
266+
if self.view.get_slot(c).range == ENTITY_REFERENCE
267+
}
264268

265269
@cached_property
266270
def mapping_enum_keys(self) -> Set[str]:
@@ -292,7 +296,9 @@ def propagatable_slots(self) -> List[str]:
292296
def _get_sssom_schema_object() -> SSSOMSchemaView:
293297
"""Get a view over the SSSOM schema."""
294298
sssom_sv_object = (
295-
SSSOMSchemaView.instance if hasattr(SSSOMSchemaView, "instance") else SSSOMSchemaView()
299+
SSSOMSchemaView.instance
300+
if hasattr(SSSOMSchemaView, "instance")
301+
else SSSOMSchemaView()
296302
)
297303
return sssom_sv_object
298304

src/sssom/context.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ def _get_built_in_prefix_map() -> Converter:
7171
ConverterHint = Union[None, Mapping[str, str], Converter]
7272

7373

74-
def ensure_converter(prefix_map: ConverterHint = None, *, use_defaults: bool = True) -> Converter:
74+
def ensure_converter(
75+
prefix_map: ConverterHint = None, *, use_defaults: bool = True
76+
) -> Converter:
7577
"""Ensure a converter is available.
7678
7779
:param prefix_map: One of the following:

0 commit comments

Comments
 (0)