biocantor.io.models
Data models. These models allow for validation of inputs to a BioCantor model, acting as a JSON schema for serializing and deserializing the models.
Module Contents
Classes
Base for all of the models. |
|
Data model that allows construction of a |
|
Data model that allows construction of a |
|
Data model that allows construction of a |
|
Data model that allows construction of |
|
Data model that allows construction of |
|
Data model that allows construction of |
|
Data model that allows construction of |
|
Data model that allows construction of |
- class biocantor.io.models.BaseModel
Base for all of the models.
- Schema :ClassVar[Type[marshmallow.Schema]]
- class biocantor.io.models.ParentModel
Bases:
BaseModel
Data model that allows construction of a
Parent
object.- seq :Optional[str]
- alphabet :Optional[inscripta.biocantor.sequence.sequence.Alphabet]
- sequence_name :Optional[str]
- type :Optional[Union[inscripta.biocantor.sequence.sequence.SequenceType, str]]
- start :Optional[int]
- end :Optional[int]
- strand :Optional[inscripta.biocantor.location.strand.Strand]
- to_parent() inscripta.biocantor.parent.Parent
- class biocantor.io.models.FeatureIntervalModel
Bases:
BaseModel
Data model that allows construction of a
FeatureInterval
object.FeatureIntervals can have more than one type, and these types are arbitrary and not controlled by a biotype ontology.
- interval_starts :List[int]
- interval_ends :List[int]
- strand :inscripta.biocantor.location.strand.Strand
- qualifiers :Optional[Dict[str, List[Union[str, int, bool, float]]]]
- sequence_name :Optional[str]
- sequence_guid :Optional[uuid.UUID]
- feature_interval_guid :Optional[uuid.UUID]
- feature_guid :Optional[uuid.UUID]
- feature_types :Optional[List[str]]
- feature_name :Optional[str]
- feature_id :Optional[str]
- is_primary_feature :Optional[bool]
- to_feature_interval(parent_or_seq_chunk_parent: Optional[inscripta.biocantor.parent.Parent] = None) inscripta.biocantor.gene.feature.FeatureInterval
Construct a
FeatureInterval
from aFeatureIntervalModel
.A
Parent
can be provided to allow the sequence-retrieval functions to work.
- static from_feature_interval(feature_interval: inscripta.biocantor.gene.feature.FeatureInterval) FeatureIntervalModel
Convert a
FeatureInterval
to aFeatureIntervalModel
- class biocantor.io.models.TranscriptIntervalModel
Bases:
BaseModel
Data model that allows construction of a
TranscriptInterval
object.- exon_starts :List[int]
- exon_ends :List[int]
- strand :inscripta.biocantor.location.strand.Strand
- cds_starts :Optional[List[int]]
- cds_ends :Optional[List[int]]
- cds_frames :Optional[List[inscripta.biocantor.gene.cds_frame.CDSFrame]]
- qualifiers :Optional[Dict[str, List[Union[str, int, bool, float]]]]
- is_primary_tx :Optional[bool]
- transcript_id :Optional[str]
- protein_id :Optional[str]
- product :Optional[str]
- transcript_symbol :Optional[str]
- transcript_type :Optional[inscripta.biocantor.gene.biotype.Biotype]
- sequence_name :Optional[str]
- sequence_guid :Optional[uuid.UUID]
- transcript_interval_guid :Optional[uuid.UUID]
- transcript_guid :Optional[uuid.UUID]
- to_transcript_interval(parent_or_seq_chunk_parent: Optional[inscripta.biocantor.parent.Parent] = None) inscripta.biocantor.gene.transcript.TranscriptInterval
Construct a
TranscriptInterval
from aTranscriptIntervalModel
.A :class:`~biocantor.parent.Parent can be provided to allow the sequence-retrieval functions to work.
- static from_transcript_interval(transcript_interval: inscripta.biocantor.gene.transcript.TranscriptInterval) TranscriptIntervalModel
Convert to a
TranscriptIntervalModel
- class biocantor.io.models.VariantIntervalModel
Bases:
BaseModel
Data model that allows construction of
VariantInterval
object.- start :int
- end :int
- sequence :str
- variant_type :str
- phase_block :Optional[int]
- variant_interval_guid :Optional[uuid.UUID]
- variant_guid :Optional[uuid.UUID]
- variant_name :Optional[str]
- variant_id :Optional[str]
- qualifiers :Optional[Dict[str, List[Union[str, int, bool, float]]]]
- static from_variant_interval(variant_interval: inscripta.biocantor.gene.variants.VariantInterval) VariantIntervalModel
Convert to a
VariantIntervalModel
- to_variant_interval(parent_or_seq_chunk_parent: Optional[inscripta.biocantor.parent.Parent] = None) inscripta.biocantor.gene.variants.VariantInterval
- class biocantor.io.models.GeneIntervalModel
Bases:
BaseModel
Data model that allows construction of
GeneInterval
object.This is a container for one or more
TranscriptInterval
objects.Has additional keys to help query the existing Gene table to see if this gene is there already.
- transcripts :List[TranscriptIntervalModel]
- gene_id :Optional[str]
- gene_symbol :Optional[str]
- gene_type :Optional[inscripta.biocantor.gene.biotype.Biotype]
- locus_tag :Optional[str]
- qualifiers :Optional[Dict[str, List[Union[str, int, bool, float]]]]
- sequence_name :Optional[str]
- sequence_guid :Optional[uuid.UUID]
- gene_guid :Optional[uuid.UUID]
- to_gene_interval(parent_or_seq_chunk_parent: Optional[inscripta.biocantor.parent.Parent] = None) inscripta.biocantor.gene.GeneInterval
Produce a
GeneInterval
from aGeneIntervalModel
.This is the primary method of constructing a
biocantor.gene.collections.GeneInterval
.
- static from_gene_interval(gene: inscripta.biocantor.gene.GeneInterval) GeneIntervalModel
- class biocantor.io.models.FeatureIntervalCollectionModel
Bases:
BaseModel
Data model that allows construction of
FeatureCollection
object.This is a container for one or more
FeatureInterval
objects.Feature Collections do not have a type, but rather their type is the union of all of their child types.
- feature_intervals :List[FeatureIntervalModel]
- feature_collection_name :Optional[str]
- feature_collection_id :Optional[str]
- locus_tag :Optional[str]
- feature_collection_type :Optional[str]
- sequence_name :Optional[str]
- sequence_guid :Optional[uuid.UUID]
- feature_collection_guid :Optional[uuid.UUID]
- qualifiers :Optional[Dict[str, List[Union[str, int, bool, float]]]]
- to_feature_collection(parent_or_seq_chunk_parent: Optional[inscripta.biocantor.parent.Parent] = None) inscripta.biocantor.gene.FeatureIntervalCollection
Produce a feature collection from a
FeatureIntervalCollectionModel
.
- static from_feature_collection(feature_collection: inscripta.biocantor.gene.FeatureIntervalCollection) FeatureIntervalCollectionModel
- class biocantor.io.models.VariantIntervalCollectionModel
Bases:
BaseModel
Data model that allows construction of
VariantCollection
object.This is a container for one or more
VariantInterval
objects.VariantIntervalCollection stores one or more variants on a phase block.
- variant_intervals :List[VariantIntervalModel]
- variant_collection_name :Optional[str]
- variant_collection_id :Optional[str]
- sequence_name :Optional[str]
- sequence_guid :Optional[uuid.UUID]
- variant_collection_guid :Optional[uuid.UUID]
- qualifiers :Optional[Dict[str, List[Union[str, int, bool, float]]]]
- static from_variant_interval_collection(variant_collection: inscripta.biocantor.gene.variants.VariantIntervalCollection) VariantIntervalCollectionModel
Convert to a
VariantIntervalModel
- to_variant_interval_collection(parent_or_seq_chunk_parent: Optional[inscripta.biocantor.parent.Parent] = None) inscripta.biocantor.gene.variants.VariantIntervalCollection
Produce a variant collection from a
VariantIntervalCollectionModel
.
- class biocantor.io.models.AnnotationCollectionModel
Bases:
BaseModel
Data model that allows construction of
AnnotationCollection
object.This is the highest level type of container, and is most often used to store everything for a genomic interval query.
This container has optional
start
andend
members because it can be the product of genomic interval queries that are larger than the contents of the object. If those values are not set, when an :class:~biocantor.gene.collections.AnnotationCollection` is instantiated, they will be inferred.Additionally, this container has an optional
completely_within
member that determines if a range query that produced this container was done using thecompletely_within
flag. If this isTrue
, then it may be the case thatstart
is larger than the smallest start position of a member of this collection, and vice versa forend
.- feature_collections :List[FeatureIntervalCollectionModel]
- genes :List[GeneIntervalModel]
- variant_collections :List[VariantIntervalCollectionModel]
- name :Optional[str]
- id :Optional[str]
- sequence_name :Optional[str]
- sequence_guid :Optional[uuid.UUID]
- sequence_path :Optional[str]
- qualifiers :Optional[Dict[str, List[Union[str, int, bool, float]]]]
- start :Optional[int]
- end :Optional[int]
- completely_within :Optional[bool]
- parent_or_seq_chunk_parent :Optional[ParentModel]
- post_dump(data, model, many=False)
If the object being dumped is an AnnotationCollection, convert the
_parent_or_seq_chunk_parent
value toparent_or_seq_chunk_parent
.
- to_annotation_collection(parent_or_seq_chunk_parent: Optional[inscripta.biocantor.parent.Parent] = None) inscripta.biocantor.gene.collections.AnnotationCollection
Produce an
AnnotationCollection
from this model.
- static from_annotation_collection(annotation_collection: inscripta.biocantor.gene.collections.AnnotationCollection, chromosome_relative_coordinates: bool = True, export_parent: bool = False) AnnotationCollectionModel
Convert back to
AnnotationCollectionModel
.