The civic module¶
CIViCpy is primarily designed to enable exploration of the content of CIViC through Python CivicRecord objects.
While these record objects can be initialized independently, the civic module also provides several routines for
Getting Records directly from CIViC. Use of these routines is recommended.
The civic module may be imported from civicpy at the top level:
>>>from civicpy import civic
CIViC Records¶
- class civic.CivicRecord(partial=False, **kwargs)[source]¶
As a base class,
CivicRecordis used to define the characteristic of all records in CIViC. This class is not intended to be invoked directly by the end user, but provided for documentation of shared methods and variables in child classes.- __init__(partial=False, **kwargs)[source]¶
The record object may be initialized by the user, though the practice is discouraged. To do so, values for each of the object attributes (except
type) must be specified as keyword arguments, or thepartialparameter must be set to True. Ifpartialis set to True, theidkeyword argument is still required.Users are encouraged to use the functions for Getting Records in lieu of directly initializing record objects.
- Parameters:
partial (bool) – Indicates whether the the set of object attributes passed is incomplete. If set to True the
idkeyword is required.
- type¶
The type of record. This field is set automatically by child classes and should not be changed.
- id¶
The record ID. This is set on initialization using the id keyword argument, and reflects the primary ID for the record as stored in CIViC.
- property site_link¶
Returns a URL to the record on the CIViC web application.
- update(allow_partial=True, force=False, **kwargs)[source]¶
Updates the record object from the cache or the server. Keyword arguments may be passed to
kwargs, which will update the corresponding attributes of theCivicRecordinstance.- Parameters:
allow_partial (bool) – Flag to indicate whether the record will be updated according to the contents of CACHE, without requiring all attributes to be assigned.
force (bool) – Flag to indicate whether to force an update from the server, even if a full record exists in the cache.
- Returns:
True if record is complete after update, else False.
The primary CIViC records are found on the sidebar menu on CIViC, and are fully-formed.
Gene¶
- class civic.Gene(**kwargs)[source]¶
Bases:
CivicRecord- aliases¶
A list of alternate gene symbols by which this gene is referenced.
- description¶
A curated summary of the clinical significance of this gene.
- name¶
The HGNC Gene Symbol associated with this gene.
Factor¶
- class civic.Factor(**kwargs)[source]¶
Bases:
CivicRecord- aliases¶
A list of alternate names by which this factor is referenced.
- description¶
A curated summary of the clinical significance of this factor.
- full_name¶
Factor names are often an commonly-used abbreviation. The full name is the unabbreviated name.
- name¶
The shortest, most concise reference to the factor. Often an abbreviation.
- ncit_id¶
The NCIthesaurus ID referencing the factor.
Fusion¶
- class civic.Fusion(**kwargs)[source]¶
Bases:
CivicRecord- subtype¶
- aliases¶
A list of alternate names by which this fusion is referenced.
- description¶
A curated summary of the clinical significance of this fusion.
- five_prime_gene_id¶
The
CivicRecord.idof the 5’ fusion partnerGeneif that partner isKNOWN.
- five_prime_partner_status¶
The status of the 5’ fusion partner. One of
KNOWN,UNKNOWN, orMULTIPLE.
- name¶
The name of the fusion. This will be the 5’ partner, followed by the 3’ partner, separated by
::. If a partner isKNOWN, the HGNC Gene Symbol of the partner gene is used. If the partner isUNKNOWN, a?is used. If there areMULTIPLEpossible gene partners,vis used.
- three_prime_gene_id¶
The
CivicRecord.idof the 3’ fusion partnerGeneif that partner isKNOWN.
- three_prime_partner_status¶
The status of the 3’ fusion partner. One of
KNOWN,UNKNOWN, orMULTIPLE.
Region¶
Variant¶
- class civic.Variant(**kwargs)[source]¶
Bases:
CivicRecord- name¶
The curated name given to this variant.
- single_variant_molecular_profile_id¶
The
CivicRecord.idof theMolecularProfilerepresenting the single variant on its own.
- subtype¶
The specific type of variant. One of
gene_variant,factor_variant, orfusion_variant.
- variant_aliases¶
A curated list of aliases by which this variant is referenced.
- variant_types¶
A list of
VariantTypeobjects describing variant types from the Sequence Ontology.
- property aliases¶
A curated list of aliases by which this variant is references. Shorthand for the
variant_aliasesattribute.
- property groups¶
A list of
VariantGrouprecords to which this variant belongs. Shorthand for thevariant_groupsattribute.
- property molecular_profiles¶
A list of
MolecularProfilerecords involving this variant.
- property single_variant_molecular_profile¶
The
MolecularProfilerecord representing the single variant on its own.
- property types¶
A list of
CivicAttributeobjects describing variant types from the Sequence Ontology.
- property variant_groups¶
A list of
VariantGrouprecords to which this variant belongs.
GeneVariant¶
- class civic.GeneVariant(**kwargs)[source]¶
Bases:
Variant- allele_registry_id¶
The ClinGen Allele Registry ID associated with this variant.
- clinvar_entries¶
A list of clinvar ids associated with this variant.
- coordinates¶
A
Coordinateobject describing CIViC coordinates.
- entrez_name¶
The HGNC Gene Symbol of the gene this variant belongs to.
- hgvs_expressions¶
Curated HGVS expressions describing this variant.
- property is_deletion¶
Based on the coordiantes, True if the variant is a deletion, else False.
- property is_insertion¶
Based on the coordiantes, True if the variant is an insertion, else False.
FactorVariant¶
FusionVariant¶
- class civic.FusionVariant(**kwargs)[source]¶
Bases:
Variant- five_prime_coordinates¶
A
ExonCoordinateobject describing CIViC coordinates of the 5’ fusion partner, if that partner isKNOWN.
- three_prime_coordinates¶
A
ExonCoordinateobject describing CIViC coordinates of the 3’ fusion partner, if that partner isKNOWN.
- vicc_compliant_name¶
A name representing the fusion variant compliant with the VICC fusion specification.
RegionVariant¶
MolecularProfile¶
- class civic.MolecularProfile(**kwargs)[source]¶
Bases:
CivicRecord- aliases¶
A curated list of aliases by which this molecular profile is referenced.
- description¶
A curated summary of the clinical significance of this molecular profile.
- molecular_profile_score¶
The CIViC molecular profile score associated with this molecular profile.
- name¶
The human readable name of this molecular profile, including gene and variant names.
- source_ids¶
A list of integers designating the
CivicRecord.idfor the class:Source records associated with the molecular profile description.
- variant_ids¶
An list of integers designating the
CivicRecord.idfor the class:Variant records involved in this molecular profile.
- property evidence¶
A shorthand for evidence_items.
- property evidence_sources¶
A list of
Sourcerecords associated with all theEvidencerecords under this molecular profile.
- property summary¶
A shorthand for the description.
Evidence¶
- class civic.Evidence(**kwargs)[source]¶
Bases:
CivicRecord- assertion_ids¶
The list of
CivicRecord.idofAssertionrecords this evidence is a part of.
- description¶
The Evidence Statement (returned as description by the CIViC API) is a brief summary of the clinical implications of the
variantin the context of the specificdisease,evidence_type, andsignificanceas curated from the cited literature source.
- disease_id¶
The
CivicRecord.idof theDiseaserecord of the cancer of cancer subtype context for the evidence record. None for functional evidence_type.
- evidence_direction¶
One of ‘Supports’, ‘Does Not Support’, indicating whether the evidence statement supports or refutes the significance of an event.
- evidence_level¶
The evidence level describes the robustness of the study supporting the evidence item. Five different evidence levels are supported: “A - Validated association”, “B - Clinical evidence”, “C - Case study”, “D - Preclinical evidence”, and “E - Inferential association”. For more information, please see Understanding Levels.
- evidence_type¶
Category of clinical action/relevance implicated by event. Refer to the additional documentation on evidence types for details on how to enter evidence of each of the six types: Predictive, Prognostic, Predisposing, Diagnostic, Functional, and Oncogenic.
- molecular_profile_id¶
The
CivicRecord.idof theMolecularProfilethis evidence item belongs to.
- name¶
A system-generated unique identifier for the evidence record, e.g. EID7.
- phenotype_ids¶
The list of
CivicRecord.idofPhenotyperecords linked to corresponding Human Phenotype Ontology (HPO) terms when applicable.
- rating¶
The Evidence Rating is an integer from 1 to 5, indicating the curator’s confidence in the quality of the summarized evidence as a number of stars. For more information about this metric, please see Understanding Evidence Ratings.
- significance¶
A string indicating the type of significance statement being made, values are defined based on the corresponding
evidence_type. Please see Understanding Significance for more details on the expected values for this field.
- source_id¶
The
CivicRecord.idof theSourceobject this evidence was derived from.
- status¶
One of ‘accepted’, ‘rejected’, or ‘submitted’, describing the state of this evidence in the CIViC curation cycle. An evidence item needs to be reviewed by a CIViC editor before being accepted or rejected. Therefore “submitted” evidence might not be accurate or complete.
submitted: This evidence has been submitted by a CIViC curator or editor
accepted: This evidence has been reviewed and approved by a CIViC editor
rejected: This evidence has been reviewed and rejected by a CIViC editor
- therapy_ids¶
The list of
CivicRecord.idof theTherapyobjects this evidence item is linked to. Only used with therapeutic response predictive evidence_type.
- therapy_interaction_type¶
One of ‘Combination’, ‘Sequential’, or ‘Substitutes’, this field describes how multiple indicated therapies within a therapeutic response predictive
evidence_typeare related.
- property disease¶
The
Diseaserecord of the cancer or cancer subtype context for the evidence record. None for functional evidence_type.
- is_valid_for_gks_json(emit_warnings: bool = False) bool[source]¶
Determine whether Evidence is able to be represented as GKS model
- Parameters:
emit_warnings – Whether to log warnings, defaults to False
- Returns:
Trueif Evidence is able to be represented as GKS model.Falseotherwise
- property molecular_profile¶
The
MolecularProfileobject this evidence item belongs to.
- property phenotypes¶
Zero or more
Phenotyperecords, linked to corresponding Human Phenotype Ontology (HPO) terms when applicable.
- property statement¶
A shorthand for the evidence
description.
Assertion¶
- class civic.Assertion(**kwargs)[source]¶
Bases:
CivicRecord- acmg_codes¶
A list of
AcmgCodeobjects describing the evidence codes used in the assessment of germline variant pathogenicity under the ACMG/AMP classification guidelines.
- amp_level¶
The clinical tiering of somatic variants by AMP/ASCO/CAP guidelines.
- assertion_direction¶
One of ‘Supports’ or ‘Does Not Support’, indicating whether the evidence statement supports or refutes the significance of an event.
- assertion_type¶
Category of clinical action/relevance implicated by event. Refer to the additional documentation on assertion types for details on how to enter assertions of each of the five types: Predictive, Prognostic, Predisposing, Diagnostic, and Oncogenic.
- clingen_codes¶
A list of
ClingenCodeobjects describing the classification of somatic variant oncogenicity under the ClinGen/CGC/VICC classification guidelines.
- description¶
The Assertion Description gives detail including practice guidelines and approved tests for the molecular profile. See curating assertions for more details.
- disease_id¶
The
CivicRecord.idof theDiseaserecord of the cancer of cancer subtype context for the assertion record.
- evidence_ids¶
A list of
CivicRecord.idof theEvidencerecords supporting this assertion record.
- fda_companion_test¶
A boolean indicating whether or not the assertion has an associated FDA companion test.
- fda_regulatory_approval¶
A boolean indicating whether or not the therapies indicated in the assertion have regulatory approval for use in the treatment of the assertion disease.
- molecular_profile_id¶
The
CivicRecord.idof the molecular profile this assertion belongs to.
- name¶
A system-generated unique identifier for the assertion, e.g. AID7.
- nccn_guideline¶
A string linking the assertion to the corresponding NCCN Guidelines for treatment of cancer by disease site, if applicable.
- nccn_guideline_version¶
The version associated with the indicated
nccn_guidelinedocument.
- phenotype_ids¶
Zero or more
PhenotypeCivicRecord.id, linked to corresponding Human Phenotype Ontology (HPO) terms when applicable.
- significance¶
A string indicating the type of significance statement being made, values are defined based on the corresponding
evidence_type. Please see Understanding Significance for more details on the expected values for this field.
- status¶
One of ‘accepted’, ‘rejected’, or ‘submitted’, describing the state of this assertion in the CIViC curation cycle. An Assertion needs to be reviewed by a CIViC editor before being accepted or rejected. Therefore “submitted” Assertions might not be accurate or complete.
submitted: This assertion has been submitted by a CIViC curator or editor
accepted: This assertion has been reviewed and approved by a CIViC editor
rejected: This assertion has been reviewed and rejected by a CIViC editor
- summary¶
The Assertion Summary restates the Significance as a brief single sentence statement. It is intended for potential use in clinical reports. The Assertion Summary is designed for rapid communication of the Significance, especially when displayed in a longer list with other molecular profiles.
- therapy_interaction_type¶
One of ‘Combination’, ‘Sequential’, or ‘Substitutes’, this field describes how multiple indicated therapies within a therapeutic response predictive
evidence_typeassertion are related.
- variant_origin¶
The origin of the variants in this molecular profile, one of ‘Somatic’, ‘Rare Germline’, ‘Common Germline’, ‘Unknown’, ‘N/A’, ‘Germline or Somatic’, or ‘Mixed’
- property approvals¶
Zero or more
Approvalrecords representing organizations approving this assertion.
- property disease¶
The
Diseaserecord of the cancer or cancer subtype context for the assertion, linked to a corresponding Disease Ontology term when applicable.
- property evidence¶
A shortcut for the
evidence_itemsproperty.
- property hpo_ids¶
A list of HPO IDs of the
phenotypesassociated with this assertion
- is_valid_for_gks_json(emit_warnings: bool = False) bool[source]¶
Determine whether Assertion is able to be represented as GKS model
- Parameters:
emit_warnings – Whether to log warnings, defaults to False
- Returns:
Trueif Assertion is able to be represented as GKS model.Falseotherwise
- property molecular_profile¶
The
MolecularProfileobject this assertion belongs to.
- property phenotypes¶
Zero or more
Phenotyperecords associated with the assertion, linked to corresponding Human Phenotype Ontology (HPO) terms.
Source¶
- class civic.Source(**kwargs)[source]¶
- abstract¶
The abstract text of the source.
- asco_abstract_id¶
For ASCO sources, the abstract ID.
- author_string¶
A string of all of the authors of the source or, for ASCO sources, the abstract presenter.
- citation¶
A short string containing key information about the source for human-readable identification.
- citation_id¶
A unique identifier for the source. For PubMed sources, this is the PMID. For ASH sources this is the DOI. For ASCO sources this is the ASCO Web ID found in the URL of the abstract.
- clinical_trials¶
A list of
ClinicalTrialobjects of Clinical Trials described in the source.
- full_journal_title¶
The full title of the publishing journal.
- journal¶
An abbreviated version of the title of the publishing journal.
- pmc_id¶
When available, the PubMed Central ID of the source.
- publication_date¶
The date the source was published.
- source_type¶
The platform making the source available. One of
PUBMED,ASCO, orASH.
- source_url¶
A link to the source on the platfrom that made the source available.
- title¶
The title of the source.
- property evidence¶
A shortcut for the
evidence_itemsproperty.
- property molecular_profiles¶
A list of
MolecularProfilerecords supported by this source.
Disease¶
- class civic.Disease(**kwargs)[source]¶
- aliases¶
A list of alternate names for the disease.
- disease_url¶
A link to the Disease Ontology entry for the disease concept.
- doid¶
The Disease Ontology ID for the disease concept.
- name¶
The name of the disease.
- property evidence¶
A shortcut for the
evidence_itemsproperty.
Therapy¶
- class civic.Therapy(**kwargs)[source]¶
- aliases¶
A list of alternate names for the therapy.
- name¶
The name of the therapy.
- ncit_id¶
The NCIthesaurus ID for the therapy concept.
- therapy_url¶
A link to the NCIthesaurus entry for the therapy concept.
- property evidence¶
A shortcut for the
evidence_itemsproperty.
Phenotype¶
- class civic.Phenotype(**kwargs)[source]¶
- name¶
The name of the phenotype.
- hpo_id¶
The Human Phenotype Ontology ID for the phenotype concept.
- phenotype_url¶
A link to the Human Phenotype Ontology entry for the phenotype concept.
- property evidence¶
A shortcut for the
evidence_itemsproperty.
Organization¶
Approval¶
- class civic.Approval(partial=False, **kwargs)[source]¶
- assertion_id¶
The
CivicRecord.idof theAssertionrecord that this approval pertains to.
- last_reviewed¶
Timestamp reflecting the last time the approval was reviewed and put into active status.
- organization_id¶
The
CivicRecord.idof theOrganizationrecord that approved the assertion.
- ready_for_clinvar_submission¶
Boolean, reflecting whether the approval meets all criteria for submission of the assertion to ClinVar.
- status¶
The status of the approval. One of
ACTIVE,REQUIRES_REVIEW, orREVOKED.
- property organization¶
The
Organizationobject this approval was made on behalf of.
CIViC Attributes¶
The CivicAttribute class is a special type of CivicRecord that is not indexed, and is used as a base
class for additional complex records beyond those mentioned above (e.g. diseases, therapies). CivicAttributes are not cached
except as attached objects to non-CivicAttribute CivicRecord objects, and cannot be retrieved
independently.
Some complex records are:
- class civic.Coordinate(**kwargs)[source]¶
- chromosome¶
- start¶
- stop¶
- reference_bases¶
- variant_bases¶
- ensembl_version¶
- representative_transcript¶
- reference_build¶