CLI

The sssom script is a wrapper for multiple sub-commands

The main one is convert

sssom convert -i tests/data/basic.tsv -o basic.ttl

sssom

Run the SSSOM CLI.

sssom [OPTIONS] COMMAND [ARGS]...

Options

-v, --verbose
-q, --quiet <quiet>
--version

Show the version and exit.

annotate

Annotate metadata of a mapping set.

param input:

Input path of the SSSOM tsv file.

param output:

Output location.

param replace_multivalued:

Multivalued slots should be replaced or not, defaults to False

param kwargs:

Options provided by user which are added to the metadata (e.g.: –mapping_set_id http://example.org/abcd)

sssom annotate [OPTIONS] INPUT

Options

-o, --output <output>

Path of SSSOM output file.

--replace-multivalued <replace_multivalued>

Multivalued slots should be replaced or not. [default: False]

--mappings <mappings>
--mapping_set_id <mapping_set_id>
--mapping_set_version <mapping_set_version>
--mapping_set_source <mapping_set_source>
--mapping_set_title <mapping_set_title>
--mapping_set_description <mapping_set_description>
--creator_id <creator_id>
--creator_label <creator_label>
--license <license>
--subject_type <subject_type>
--subject_source <subject_source>
--subject_source_version <subject_source_version>
--object_type <object_type>
--object_source <object_source>
--object_source_version <object_source_version>
--mapping_provider <mapping_provider>
--mapping_tool <mapping_tool>
--mapping_tool_version <mapping_tool_version>
--mapping_date <mapping_date>
--publication_date <publication_date>
--subject_match_field <subject_match_field>
--object_match_field <object_match_field>
--subject_preprocessing <subject_preprocessing>
--object_preprocessing <object_preprocessing>
--see_also <see_also>
--issue_tracker <issue_tracker>
--other <other>
--comment <comment>

Arguments

INPUT

Required argument

cliquesummary

Calculate summaries for each clique in a SSSOM file.

sssom cliquesummary [OPTIONS] INPUT

Options

-o, --output <output>

Path of SSSOM output file.

-m, --metadata <metadata>

The path to a file containing the sssom metadata (including prefix_map) to be used.

-s, --statsfile <statsfile>

Arguments

INPUT

Required argument

convert

Convert a file.

Example:

sssom convert my.sssom.tsv –output-format rdfxml –output my.sssom.owl

sssom convert [OPTIONS] INPUT

Options

-o, --output <output>

Path of SSSOM output file.

-O, --output-format <output_format>

Desired output format.

Options:

tsv | owl | ontoportal_json | fhir_json | json | rdf | turtle | nt | ttl | xml

Arguments

INPUT

Required argument

correlations

Calculate correlations.

sssom correlations [OPTIONS] INPUT

Options

-o, --output <output>

Path of SSSOM output file.

-t, --transpose <transpose>
-f, --fields <fields>

Fields.

Arguments

INPUT

Required argument

crosstab

Write sssom summary cross-tabulated by categories.

sssom crosstab [OPTIONS] INPUT

Options

-o, --output <output>

Path of SSSOM output file.

-t, --transpose <transpose>
-f, --fields <fields>

Fields.

Arguments

INPUT

Required argument

dedupe

Remove lower confidence duplicate lines from an SSSOM file.

sssom dedupe [OPTIONS] INPUT

Options

-o, --output <output>

Path of SSSOM output file.

Arguments

INPUT

Required argument

diff

Compare two SSSOM files.

The output is a new SSSOM file with the union of all mappings, and injected comments indicating uniqueness to set1 or set2.

sssom diff [OPTIONS] INPUTS...

Options

-o, --output <output>

Path of SSSOM output file.

Arguments

INPUTS

Required argument(s)

dosql

Run a SQL query over one or more SSSOM files.

Each of the N inputs is assigned a table name df1, df2, …, dfN

Alternatively, the filenames can be used as table names - these are first stemmed E.g. ~/dir/my.sssom.tsv becomes a table called ‘my’

Example:

sssom dosql -Q “SELECT * FROM df1 WHERE confidence>0.5 ORDER BY confidence” my.sssom.tsv

Example:

sssom dosql -Q “SELECT file1.*,file2.object_id AS ext_object_id, file2.object_label AS ext_object_label FROM file1 INNER JOIN file2 WHERE file1.object_id = file2.subject_id” FROM file1.sssom.tsv file2.sssom.tsv

sssom dosql [OPTIONS] [INPUTS]...

Options

-Q, --query <query>

SQL query. Use “df” as table name.

-o, --output <output>

Path of SSSOM output file.

Arguments

INPUTS

Optional argument(s)

filter

Filter a dataframe by dynamically generating queries based on user input.

e.g. sssom filter –subject_id x:% –subject_id y:% –object_id y:% –object_id z:% tests/data/basic.tsv

yields the query:

“SELECT * FROM df WHERE (subject_id LIKE ‘x:%’ OR subject_id LIKE ‘y:%’)

AND (object_id LIKE ‘y:%’ OR object_id LIKE ‘z:%’) “ and displays the output.

param input:

DataFrame to be queried over.

param output:

Output location.

param kwargs:

Filter options provided by user which generate queries (e.g.: –subject_id x:%).

sssom filter [OPTIONS] INPUT

Options

-o, --output <output>

Path of SSSOM output file.

--subject_id <subject_id>
--subject_label <subject_label>
--subject_category <subject_category>
--predicate_id <predicate_id>
--predicate_label <predicate_label>
--predicate_modifier <predicate_modifier>
--object_id <object_id>
--object_label <object_label>
--object_category <object_category>
--mapping_justification <mapping_justification>
--author_id <author_id>
--author_label <author_label>
--reviewer_id <reviewer_id>
--reviewer_label <reviewer_label>
--creator_id <creator_id>
--creator_label <creator_label>
--license <license>
--subject_type <subject_type>
--subject_source <subject_source>
--subject_source_version <subject_source_version>
--object_type <object_type>
--object_source <object_source>
--object_source_version <object_source_version>
--mapping_provider <mapping_provider>
--mapping_source <mapping_source>
--mapping_cardinality <mapping_cardinality>
--mapping_tool <mapping_tool>
--mapping_tool_version <mapping_tool_version>
--mapping_date <mapping_date>
--publication_date <publication_date>
--confidence <confidence>
--curation_rule <curation_rule>
--curation_rule_text <curation_rule_text>
--subject_match_field <subject_match_field>
--object_match_field <object_match_field>
--match_string <match_string>
--subject_preprocessing <subject_preprocessing>
--object_preprocessing <object_preprocessing>
--semantic_similarity_score <semantic_similarity_score>
--semantic_similarity_measure <semantic_similarity_measure>
--see_also <see_also>
--issue_tracker_item <issue_tracker_item>
--other <other>
--comment <comment>

Arguments

INPUT

Required argument

help

Echoes help for subcommands.

sssom help [OPTIONS] SUBCOMMAND

Arguments

SUBCOMMAND

Required argument

invert

Invert subject and object IDs such that all subjects have the prefix provided.

param input:

SSSOM TSV file.

param subject_prefix:

Prefix of all subject_ids.

param merge_inverted:

If True (default), add inverted dataframe to input else, just return inverted data.

param update_justification:

If True (default), the justification is updated to “sempav:MappingInversion”, else it is left as it is.

param inverse_map:

YAML file providing the inverse mapping for predicates.

param output:

SSSOM TSV file with columns sorted.

sssom invert [OPTIONS] INPUT

Options

-o, --output <output>

Path of SSSOM output file.

-P, --subject-prefix <subject_prefix>

Invert subject_id and object_id such that all subject_ids have the same prefix.

--merge-inverted, --no-merge-inverted

If True (default), add inverted mappings to the input mapping set, else, just return inverted mappings as a separate mapping set.

--update-justification, --no-update-justification

If True (default), the justification is updated to ‘sempav:MappingInversion’, else it is left as it is.

--inverse-map <inverse_map>

Path to file that contains the inverse predicate dictionary.

Arguments

INPUT

Required argument

merge

Merge multiple MappingSetDataFrames into one .

if reconcile=True, then dedupe(remove redundant lower confidence mappings) and reconcile (if msdf contains a higher confidence _negative_ mapping, then remove lower confidence positive one. If confidence is the same, prefer HumanCurated. If both HumanCurated, prefer negative mapping).

sssom merge [OPTIONS] [INPUTS]...

Options

-R, --reconcile <reconcile>

Boolean indicating the need for reconciliation of the SSSOM tsv file.

-o, --output <output>

Path of SSSOM output file.

Arguments

INPUTS

Optional argument(s)

parse

Parse a file in one of the supported formats (such as obographs) into an SSSOM TSV file.

sssom parse [OPTIONS] INPUT

Options

-I, --input-format <input_format>

The string denoting the input format.

Options:

tsv | obographs-json | alignment-api-xml | json | rdf

-m, --metadata <metadata>

The path to a file containing the sssom metadata (including prefix_map) to be used.

-C, --prefix-map-mode <prefix_map_mode>

Required Defines whether the prefix map in the metadata should be extended or replaced with the SSSOM default prefix map.

Default:

metadata_only

Options:

metadata_only | sssom_default_only | merged

-p, --clean-prefixes, --no-clean-prefixes

Required If True (default), records with unknown prefixes are removed from the SSSOM file.

--strict-clean-prefixes, --no-strict-clean-prefixes

If True (default), clean_prefixes(strict = True).

-E, --embedded-mode, --non-embedded-mode

If False, the resultant SSSOM file will be saved in the ‘filename’.tsv provided by -o/–output option AND the metadata gets saved in the ‘filename’.yml.

-F, --mapping-predicate-filter <mapping_predicate_filter>

A list of predicates or a file path containing the list of predicates to be considered.

-o, --output <output>

Path of SSSOM output file.

Arguments

INPUT

Required argument

partition

Partition an SSSOM into one file for each strongly connected component.

sssom partition [OPTIONS] [INPUTS]...

Options

-d, --output-directory <output_directory>

Output directory path.

Arguments

INPUTS

Optional argument(s)

ptable

Convert an SSSOM file to a ptable for kboom/boomer.

sssom ptable [OPTIONS] INPUT

Options

-o, --output <output>

Path of SSSOM output file.

-W, --inverse-factor <inverse_factor>

Inverse factor.

--default-confidence <default_confidence>

Default confidence to be assigned if absent.

Arguments

INPUT

Required argument

reconcile-prefixes

Reconcile prefix_map based on provided YAML file.

param input:

MappingSetDataFrame filename

param reconcile_prefix_file:

YAML file containing the prefix reconcilation rules.

param output:

Target file path.

sssom reconcile-prefixes [OPTIONS] INPUT

Options

-p, --reconcile-prefix-file <reconcile_prefix_file>

Provide YAML file with prefix reconciliation information.

-o, --output <output>

Path of SSSOM output file.

Arguments

INPUT

Required argument

remove

Remove mappings from an input mapping.

param input:

Input SSSOM tsv file.

param output:

Output path.

param remove_map:

Mapping to be removed.

sssom remove [OPTIONS] INPUT

Options

--remove-map <remove_map>

Mapping file path that needs to be removed from input.

-o, --output <output>

Path of SSSOM output file.

Arguments

INPUT

Required argument

rewire

Rewire an ontology using equivalent classes/properties from a mapping file.

Example:

sssom rewire -I xml -i tests/data/cob.owl -m tests/data/cob-to-external.tsv –precedence PR

# noqa: DAR101

sssom rewire [OPTIONS] INPUT

Options

-m, --mapping-file <mapping_file>

Path to SSSOM file.

-I, --input-format <input_format>

Ontology input format.

-O, --output-format <output_format>

Ontology output format.

--precedence <precedence>

List of prefixes in order of precedence.

-o, --output <output>

Path of SSSOM output file.

Arguments

INPUT

Required argument

sort

Sort DataFrame columns canonically.

param input:

SSSOM TSV file.

param by_columns:

Boolean flag to sort columns canonically.

param by_rows:

Boolean flag to sort rows by column #1 (ascending order).

param output:

SSSOM TSV file with columns sorted.

sssom sort [OPTIONS] INPUT

Options

-o, --output <output>

Path of SSSOM output file.

-k, --by-columns <by_columns>

Sort columns of DataFrame canonically.

-r, --by-rows <by_rows>

Sort rows by DataFrame column #1 (ascending).

Arguments

INPUT

Required argument

sparql

Run a SPARQL query.

sssom sparql [OPTIONS]

Options

-c, --config <config>
-e, --url <url>
-g, --graph <graph>
--object-labels, --no-object-labels

if set, includes object labels

-l, --limit <limit>
-P, --prefix <prefix>
-o, --output <output>

Path of SSSOM output file.

split

Split input file into multiple output broken down by prefixes.

sssom split [OPTIONS] INPUT

Options

-d, --output-directory <output_directory>

Output directory path.

Arguments

INPUT

Required argument

validate

Produce an error report for an SSSOM file.

sssom validate [OPTIONS] INPUT

Options

-V, --validation-types <validation_types>
Options:

SchemaValidationType.JsonSchema | SchemaValidationType.Shacl | SchemaValidationType.Sparql | SchemaValidationType.PrefixMapCompleteness

Arguments

INPUT

Required argument