Coverage for src/python/ensembl/core/models.py: 100%
787 statements
« prev ^ index » next coverage.py v7.15.1, created at 2026-07-13 09:48 +0000
« prev ^ index » next coverage.py v7.15.1, created at 2026-07-13 09:48 +0000
1# See the NOTICE file distributed with this work for additional information
2# regarding copyright ownership.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14"""Ensembl Core database ORM."""
16# Ignore some pylint and mypy checks due to the nature of SQLAlchemy ORMs
17# pylint: disable=missing-class-docstring,too-many-lines,fixme
18# mypy: disable-error-code="misc, valid-type"
20# WIP: This module is not complete nor fully tested and will most likely change its public interface
21# TODO:
22# - Please help defining/fixing relationships.
23# There are several relationships that have not been mapped yet, please help
24# adding them to the models if you find they're missing
25# https://docs.sqlalchemy.org/en/14/orm/basic_relationships.html
26# - Please help with better names.
27# Class names and attributes were generated directly
28# from the SQL schema but might not be suitable for a ORM.
29# For instance, several class attributes are prepended with the class name.
30# That's redundant most of the times and will result in less readable code.
31# Some class names are somehow reserved (e.g. class Meta) and some attributes names
32# are actually reserved (e.g. type, map, id) please help changing them into
33# meaningful ones
35from typing import Any
37import sqlalchemy
38from sqlalchemy import (
39 Column,
40 DECIMAL,
41 DateTime,
42 Enum,
43 Float,
44 ForeignKey,
45 Index,
46 String,
47 Table,
48 Text,
49 UniqueConstraint,
50 text,
51)
52from sqlalchemy.dialects.mysql import (
53 BIGINT,
54 DOUBLE,
55 INTEGER,
56 LONGTEXT,
57 MEDIUMTEXT,
58 SET,
59 SMALLINT,
60 TINYINT,
61 TINYTEXT,
62 VARCHAR,
63)
64from sqlalchemy.ext.compiler import compiles
65from sqlalchemy.orm import declarative_base, relationship
67Base = declarative_base()
68metadata = Base.metadata
71class AltAlleleGroup(Base):
72 __tablename__ = "alt_allele_group"
74 alt_allele_group_id: Column = Column(INTEGER(10), primary_key=True)
77class Analysis(Base):
78 __tablename__ = "analysis"
80 analysis_id: Column = Column(SMALLINT(5), primary_key=True)
81 created: Column = Column(DateTime)
82 logic_name: Column = Column(String(128), nullable=False, unique=True)
83 db: Column = Column(String(120))
84 db_version: Column = Column(String(40))
85 db_file: Column = Column(String(120))
86 program: Column = Column(String(80))
87 program_version: Column = Column(String(40))
88 program_file: Column = Column(String(80))
89 parameters: Column = Column(Text)
90 module: Column = Column(String(80))
91 module_version: Column = Column(String(40))
92 gff_source: Column = Column(String(40))
93 gff_feature: Column = Column(String(40))
96class AssociatedGroup(Base):
97 __tablename__ = "associated_group"
99 associated_group_id: Column = Column(INTEGER(10), primary_key=True)
100 description: Column = Column(String(128))
103class AttribType(Base):
104 __tablename__ = "attrib_type"
106 attrib_type_id: Column = Column(SMALLINT(5), primary_key=True)
107 code: Column = Column(String(20), nullable=False, unique=True, server_default=text("''"))
108 name: Column = Column(String(255), nullable=False, server_default=text("''"))
109 description: Column = Column(Text)
111 seq_region_attrib = relationship("SeqRegionAttrib", back_populates="attrib_type")
114class Biotype(Base):
115 __tablename__ = "biotype"
116 __table_args__ = (Index("name_type_idx", "name", "object_type", unique=True),)
118 biotype_id: Column = Column(INTEGER(10), primary_key=True)
119 name: Column = Column(String(64), nullable=False)
120 object_type: Column = Column(Enum("gene", "transcript"), nullable=False, server_default=text("'gene'"))
121 db_type: Column = Column(
122 SET(
123 "cdna",
124 "core",
125 "coreexpressionatlas",
126 "coreexpressionest",
127 "coreexpressiongnf",
128 "funcgen",
129 "otherfeatures",
130 "rnaseq",
131 "variation",
132 "vega",
133 "presite",
134 "sangervega",
135 ),
136 nullable=False,
137 server_default=text("'core'"),
138 )
139 attrib_type_id: Column = Column(INTEGER(11))
140 description: Column = Column(Text)
141 biotype_group: Column = Column(
142 Enum(
143 "coding",
144 "pseudogene",
145 "snoncoding",
146 "lnoncoding",
147 "mnoncoding",
148 "LRG",
149 "undefined",
150 "no_group",
151 )
152 )
153 so_acc: Column = Column(String(64))
154 so_term: Column = Column(String(1023))
157class CoordSystem(Base):
158 __tablename__ = "coord_system"
159 __table_args__ = (
160 Index("name_idx", "name", "version", "species_id", unique=True),
161 Index("rank_idx", "rank", "species_id", unique=True),
162 )
164 coord_system_id: Column = Column(INTEGER(10), primary_key=True)
165 species_id: Column = Column(INTEGER(10), nullable=False, index=True, server_default=text("'1'"))
166 name: Column = Column(String(40), nullable=False)
167 version: Column = Column(String(255))
168 rank: Column = Column(INTEGER(11), nullable=False)
169 attrib: Column = Column(SET("default_version", "sequence_level"))
170 # Many to one relationship
171 seq_region = relationship("SeqRegion", back_populates="coord_system")
172 meta = relationship("Meta", back_populates="coord_system")
175class Ditag(Base):
176 __tablename__ = "ditag"
178 ditag_id: Column = Column(INTEGER(10), primary_key=True)
179 name: Column = Column(String(30), nullable=False)
180 tag_type: Column = Column("type", String(30), nullable=False)
181 tag_count: Column = Column(SMALLINT(6), nullable=False, server_default=text("'1'"))
182 sequence: Column = Column(TINYTEXT, nullable=False)
185class DNAAlignFeatureAttrib(Base):
186 __tablename__ = "dna_align_feature_attrib"
187 __table_args__ = (
188 Index(
189 "dna_align_feature_attribx",
190 "dna_align_feature_id",
191 "attrib_type_id",
192 "value",
193 unique=True,
194 mysql_length={"value": 10},
195 ),
196 Index("ditag_type_val_idx", "attrib_type_id", "value", mysql_length={"value": 10}),
197 Index("ditag_value_idx", "value", mysql_length=10),
198 )
200 dna_align_feature_id: Column = Column(
201 INTEGER(10),
202 ForeignKey("dna_align_feature.dna_align_feature_id"),
203 nullable=False,
204 index=True,
205 primary_key=True,
206 )
207 attrib_type_id: Column = Column(SMALLINT(5), nullable=False, primary_key=True)
208 value: Column = Column(String(500), nullable=False, primary_key=True)
211class ExternalDb(Base):
212 __tablename__ = "external_db"
213 __table_args__ = (Index("db_name_db_release_idx", "db_name", "db_release", unique=True),)
215 external_db_id: Column = Column(INTEGER(10), primary_key=True)
216 db_name: Column = Column(String(100), nullable=False)
217 db_release: Column = Column(String(255))
218 status: Column = Column(Enum("KNOWNXREF", "KNOWN", "XREF", "PRED", "ORTH", "PSEUDO"), nullable=False)
219 priority: Column = Column(INTEGER(11), nullable=False)
220 db_display_name: Column = Column(String(255))
221 db_type: Column = Column(
222 "type",
223 Enum(
224 "ARRAY",
225 "ALT_TRANS",
226 "ALT_GENE",
227 "MISC",
228 "LIT",
229 "PRIMARY_DB_SYNONYM",
230 "ENSEMBL",
231 ),
232 nullable=False,
233 )
234 secondary_db_name: Column = Column(String(255))
235 secondary_db_table: Column = Column(String(255))
236 description: Column = Column(Text)
237 seq_region_synonym = relationship("SeqRegionSynonym", back_populates="external_db")
240class Gene(Base):
241 __tablename__ = "gene"
242 __table_args__ = (
243 Index("gene_seq_region_idx", "seq_region_id", "seq_region_start"),
244 Index("gene_stable_id_idx", "stable_id", "version"),
245 )
247 gene_id: Column = Column(INTEGER(10), primary_key=True)
248 biotype: Column = Column(String(40), nullable=False)
249 analysis_id: Column = Column(
250 ForeignKey("analysis.analysis_id"),
251 nullable=False,
252 index=True,
253 )
254 seq_region_id: Column = Column(
255 ForeignKey("seq_region.seq_region_id"),
256 nullable=False,
257 )
258 seq_region_start: Column = Column(INTEGER(10), nullable=False)
259 seq_region_end: Column = Column(INTEGER(10), nullable=False)
260 seq_region_strand: Column = Column(TINYINT(2), nullable=False)
261 display_xref_id: Column = Column(ForeignKey("xref.xref_id"), index=True)
262 source: Column = Column(String(40), nullable=False)
263 description: Column = Column(Text)
264 is_current: Column = Column(TINYINT(1), nullable=False, server_default=text("'1'"))
265 canonical_transcript_id: Column = Column(
266 ForeignKey("transcript.transcript_id"),
267 nullable=False,
268 index=True,
269 )
270 stable_id: Column = Column(String(128))
271 version: Column = Column(SMALLINT(5))
272 created_date: Column = Column(DateTime)
273 modified_date: Column = Column(DateTime)
275 analysis = relationship("Analysis", primaryjoin="Gene.analysis_id == Analysis.analysis_id")
276 canonical_transcript = relationship(
277 "Transcript",
278 primaryjoin="Gene.canonical_transcript_id == Transcript.transcript_id",
279 )
280 display_xref = relationship("Xref", primaryjoin="Gene.display_xref_id == Xref.xref_id")
281 seq_region = relationship("SeqRegion", primaryjoin="Gene.seq_region_id == SeqRegion.seq_region_id")
284class GenomeStatistics(Base):
285 __tablename__ = "genome_statistics"
286 __table_args__ = (Index("stats_uniq", "statistic", "attrib_type_id", "species_id", unique=True),)
288 genome_statistics_id: Column = Column(INTEGER(10), primary_key=True)
289 statistic: Column = Column(String(128), nullable=False)
290 value: Column = Column(BIGINT(11), nullable=False, server_default=text("'0'"))
291 species_id: Column = Column(INTEGER(10), server_default=text("'1'"))
292 attrib_type_id: Column = Column(INTEGER(10))
293 timestamp: Column = Column(DateTime)
296t_interpro = Table(
297 "interpro",
298 metadata,
299 Column("interpro_ac", String(40), nullable=False),
300 Column("id", VARCHAR(40), nullable=False, index=True),
301 Index("accession_idx", "interpro_ac", "id", unique=True),
302)
305class Map(Base):
306 __tablename__ = "map"
308 map_id: Column = Column(INTEGER(10), primary_key=True)
309 map_name: Column = Column(String(30), nullable=False)
312class MappingSession(Base):
313 __tablename__ = "mapping_session"
315 mapping_session_id: Column = Column(INTEGER(10), primary_key=True)
316 old_db_name: Column = Column(String(80), nullable=False, server_default=text("''"))
317 new_db_name: Column = Column(String(80), nullable=False, server_default=text("''"))
318 old_release: Column = Column(String(5), nullable=False, server_default=text("''"))
319 new_release: Column = Column(String(5), nullable=False, server_default=text("''"))
320 old_assembly: Column = Column(String(80), nullable=False, server_default=text("''"))
321 new_assembly: Column = Column(String(80), nullable=False, server_default=text("''"))
322 created: Column = Column(DateTime, nullable=False)
325class MappingSet(Base):
326 __tablename__ = "mapping_set"
327 __table_args__ = (Index("mapping_idx", "internal_schema_build", "external_schema_build", unique=True),)
329 mapping_set_id: Column = Column(INTEGER(10), primary_key=True)
330 internal_schema_build: Column = Column(String(20), nullable=False)
331 external_schema_build: Column = Column(String(20), nullable=False)
334class Marker(Base):
335 __tablename__ = "marker"
336 __table_args__ = (Index("marker_idx", "marker_id", "priority"),)
338 marker_id: Column = Column(INTEGER(10), primary_key=True)
339 display_marker_synonym_id: Column = Column(
340 ForeignKey("marker_synonym.marker_synonym_id"),
341 index=True,
342 )
343 left_primer: Column = Column(String(100), nullable=False)
344 right_primer: Column = Column(String(100), nullable=False)
345 min_primer_dist: Column = Column(INTEGER(10), nullable=False)
346 max_primer_dist: Column = Column(INTEGER(10), nullable=False)
347 priority: Column = Column(INTEGER(11))
348 marker_type: Column = Column("type", Enum("est", "microsatellite"))
350 display_marker_synonym = relationship(
351 "MarkerSynonym",
352 primaryjoin="Marker.display_marker_synonym_id == MarkerSynonym.marker_synonym_id",
353 )
356class MarkerSynonym(Base):
357 __tablename__ = "marker_synonym"
358 __table_args__ = (Index("marker_synonym_idx", "marker_synonym_id", "name"),)
360 marker_synonym_id: Column = Column(INTEGER(10), primary_key=True)
361 marker_id: Column = Column(
362 ForeignKey("marker.marker_id"),
363 nullable=False,
364 index=True,
365 )
366 source: Column = Column(String(20))
367 name: Column = Column(String(50))
369 marker = relationship("Marker", primaryjoin="MarkerSynonym.marker_id == Marker.marker_id")
372class PeptideArchive(Base):
373 __tablename__ = "peptide_archive"
375 peptide_archive_id: Column = Column(INTEGER(10), primary_key=True)
376 md5_checksum: Column = Column(String(32), index=True)
377 peptide_seq: Column = Column(MEDIUMTEXT, nullable=False)
380class RepeatConsensus(Base):
381 __tablename__ = "repeat_consensus"
382 __table_args__ = (Index("repeat_consensus_idx", "repeat_consensus", unique=True, mysql_length=10),)
384 repeat_consensus_id: Column = Column(INTEGER(10), primary_key=True)
385 repeat_name: Column = Column(String(255), nullable=False, index=True)
386 repeat_class: Column = Column(String(100), nullable=False, index=True)
387 repeat_type: Column = Column(String(40), nullable=False, index=True)
388 repeat_consensus: Column = Column(Text)
391class Rnaproduct(Base):
392 __tablename__ = "rnaproduct"
393 __table_args__ = (Index("rnaproduct_stable_id_idx", "stable_id", "version"),)
395 rnaproduct_id: Column = Column(INTEGER(10), primary_key=True)
396 rnaproduct_type_id: Column = Column(SMALLINT(5), nullable=False)
397 transcript_id: Column = Column(INTEGER(10), nullable=False, index=True)
398 seq_start: Column = Column(INTEGER(10), nullable=False)
399 start_exon_id: Column = Column(INTEGER(10))
400 seq_end: Column = Column(INTEGER(10), nullable=False)
401 end_exon_id: Column = Column(INTEGER(10))
402 stable_id: Column = Column(String(128))
403 version: Column = Column(SMALLINT(5))
404 created_date: Column = Column(DateTime)
405 modified_date: Column = Column(DateTime)
408class RNAproductAttrib(Base):
409 __tablename__ = "rnaproduct_attrib"
410 __table_args__ = (
411 Index(
412 "rnaproduct_attribx",
413 "rnaproduct_id",
414 "attrib_type_id",
415 "value",
416 unique=True,
417 mysql_length={"value": 10},
418 ),
419 Index("rnaproduct_type_val_idx", "attrib_type_id", "value", mysql_length={"value": 10}),
420 Index("rnaproduct_value_idx", "value", mysql_length=10),
421 )
422 rnaproduct_id: Column = Column(
423 ForeignKey("rnaproduct.rnaproduct_id"), nullable=False, index=True, primary_key=True
424 )
425 attrib_type_id: Column = Column(SMALLINT(5), nullable=False, primary_key=True)
426 value: Column = Column(String(500), nullable=False, primary_key=True)
429class RnaproductType(Base):
430 __tablename__ = "rnaproduct_type"
432 rnaproduct_type_id: Column = Column(SMALLINT(5), primary_key=True)
433 code: Column = Column(String(20), nullable=False, unique=True, server_default=text("''"))
434 name: Column = Column(String(255), nullable=False, server_default=text("''"))
435 description: Column = Column(Text)
438class Transcript(Base):
439 __tablename__ = "transcript"
440 __table_args__ = (
441 Index("transcript_seq_region_idx", "seq_region_id", "seq_region_start"),
442 Index("transcript_stable_id_idx", "stable_id", "version"),
443 )
445 transcript_id: Column = Column(INTEGER(10), primary_key=True)
446 gene_id: Column = Column(ForeignKey("gene.gene_id"), index=True)
447 analysis_id: Column = Column(
448 ForeignKey("analysis.analysis_id"),
449 nullable=False,
450 index=True,
451 )
452 seq_region_id: Column = Column(
453 ForeignKey("seq_region.seq_region_id"),
454 nullable=False,
455 )
456 seq_region_start: Column = Column(INTEGER(10), nullable=False)
457 seq_region_end: Column = Column(INTEGER(10), nullable=False)
458 seq_region_strand: Column = Column(TINYINT(2), nullable=False)
459 display_xref_id: Column = Column(ForeignKey("xref.xref_id"), index=True)
460 source: Column = Column(String(40), nullable=False, server_default=text("'ensembl'"))
461 biotype: Column = Column(String(40), nullable=False)
462 description: Column = Column(Text)
463 is_current: Column = Column(TINYINT(1), nullable=False, server_default=text("'1'"))
464 canonical_translation_id: Column = Column(
465 ForeignKey("translation.translation_id"),
466 unique=True,
467 )
468 stable_id: Column = Column(String(128))
469 version: Column = Column(SMALLINT(5))
470 created_date: Column = Column(DateTime)
471 modified_date: Column = Column(DateTime)
473 analysis = relationship("Analysis", primaryjoin="Transcript.analysis_id == Analysis.analysis_id")
474 canonical_translation = relationship(
475 "Translation",
476 primaryjoin="Transcript.canonical_translation_id == Translation.translation_id",
477 )
478 display_xref = relationship("Xref", primaryjoin="Transcript.display_xref_id == Xref.xref_id")
479 gene = relationship("Gene", primaryjoin="Transcript.gene_id == Gene.gene_id")
480 seq_region = relationship("SeqRegion", primaryjoin="Transcript.seq_region_id == SeqRegion.seq_region_id")
483class TranscriptIntronSupportingEvidence(Base):
484 __tablename__ = "transcript_intron_supporting_evidence"
486 transcript_id: Column = Column(INTEGER(10), primary_key=True, nullable=False, index=True)
487 intron_supporting_evidence_id: Column = Column(INTEGER(10), primary_key=True, nullable=False)
488 previous_exon_id: Column = Column(INTEGER(10), nullable=False)
489 next_exon_id: Column = Column(INTEGER(10), nullable=False)
492class Translation(Base):
493 __tablename__ = "translation"
494 __table_args__ = (Index("translation_stable_id_idx", "stable_id", "version"),)
496 translation_id: Column = Column(INTEGER(10), primary_key=True)
497 transcript_id: Column = Column(
498 ForeignKey("transcript.transcript_id"),
499 nullable=False,
500 index=True,
501 )
502 seq_start: Column = Column(INTEGER(10), nullable=False)
503 start_exon_id: Column = Column(
504 ForeignKey("exon.exon_id"),
505 nullable=False,
506 index=True,
507 )
508 seq_end: Column = Column(INTEGER(10), nullable=False)
509 end_exon_id: Column = Column(
510 ForeignKey("exon.exon_id"),
511 nullable=False,
512 index=True,
513 )
514 stable_id: Column = Column(String(128))
515 version: Column = Column(SMALLINT(5))
516 created_date: Column = Column(DateTime)
517 modified_date: Column = Column(DateTime)
519 end_exon = relationship("Exon", primaryjoin="Translation.end_exon_id == Exon.exon_id")
520 start_exon = relationship("Exon", primaryjoin="Translation.start_exon_id == Exon.exon_id")
521 transcript = relationship(
522 "Transcript",
523 primaryjoin="Translation.transcript_id == Transcript.transcript_id",
524 )
527class UnmappedReason(Base):
528 __tablename__ = "unmapped_reason"
530 unmapped_reason_id: Column = Column(INTEGER(10), primary_key=True)
531 summary_description: Column = Column(String(255))
532 full_description: Column = Column(String(255))
535class AltAllele(Base):
536 __tablename__ = "alt_allele"
537 __table_args__ = (Index("alt_allele_gene_id_idx", "gene_id", "alt_allele_group_id"),)
539 alt_allele_id: Column = Column(INTEGER(10), primary_key=True)
540 alt_allele_group_id: Column = Column(
541 ForeignKey("alt_allele_group.alt_allele_group_id"),
542 nullable=False,
543 index=True,
544 )
545 gene_id: Column = Column(
546 ForeignKey("gene.gene_id"),
547 nullable=False,
548 unique=True,
549 )
551 alt_allele_group = relationship(
552 "AltAlleleGroup",
553 primaryjoin="AltAllele.alt_allele_group_id == AltAlleleGroup.alt_allele_group_id",
554 )
555 gene = relationship("Gene", primaryjoin="AltAllele.gene_id == Gene.gene_id")
558class AnalysisDescription(Base):
559 __tablename__ = "analysis_description"
561 analysis_id: Column = Column(
562 SMALLINT(5),
563 ForeignKey("analysis.analysis_id"),
564 primary_key=True,
565 nullable=False,
566 unique=True,
567 )
568 description: Column = Column(Text)
569 display_label: Column = Column(String(255), nullable=False)
570 displayable: Column = Column(TINYINT(1), nullable=False, server_default=text("'1'"))
571 web_data: Column = Column(Text)
574class DataFile(Base):
575 __tablename__ = "data_file"
576 __table_args__ = (
577 Index(
578 "df_unq_idx",
579 "coord_system_id",
580 "analysis_id",
581 "name",
582 "file_type",
583 unique=True,
584 ),
585 )
587 data_file_id: Column = Column(INTEGER(10), primary_key=True)
588 coord_system_id: Column = Column(
589 ForeignKey("coord_system.coord_system_id"),
590 nullable=False,
591 )
592 analysis_id: Column = Column(
593 ForeignKey("analysis.analysis_id"),
594 nullable=False,
595 index=True,
596 )
597 name: Column = Column(String(100), nullable=False, index=True)
598 version_lock: Column = Column(TINYINT(1), nullable=False, server_default=text("'0'"))
599 absolute: Column = Column(TINYINT(1), nullable=False, server_default=text("'0'"))
600 url: Column = Column(Text)
601 file_type: Column = Column(Enum("BAM", "BAMCOV", "BIGBED", "BIGWIG", "VCF"))
603 analysis = relationship("Analysis", primaryjoin="DataFile.analysis_id == Analysis.analysis_id")
604 coord_system = relationship(
605 "CoordSystem",
606 primaryjoin="DataFile.coord_system_id == CoordSystem.coord_system_id",
607 )
610class DensityType(Base):
611 __tablename__ = "density_type"
612 __table_args__ = (Index("analysis_idx", "analysis_id", "block_size", "region_features", unique=True),)
614 density_type_id: Column = Column(INTEGER(10), primary_key=True)
615 analysis_id: Column = Column(
616 ForeignKey("analysis.analysis_id"),
617 nullable=False,
618 )
619 block_size: Column = Column(INTEGER(11), nullable=False)
620 region_features: Column = Column(INTEGER(11), nullable=False)
621 value_type: Column = Column(Enum("sum", "ratio"), nullable=False)
623 analysis = relationship("Analysis", primaryjoin="DensityType.analysis_id == Analysis.analysis_id")
626t_gene_archive = Table(
627 "gene_archive",
628 metadata,
629 Column("gene_stable_id", String(128), nullable=False),
630 Column("gene_version", SMALLINT(6), nullable=False, server_default=text("'1'")),
631 Column("transcript_stable_id", String(128), nullable=False),
632 Column("transcript_version", SMALLINT(6), nullable=False, server_default=text("'1'")),
633 Column("translation_stable_id", String(128)),
634 Column("translation_version", SMALLINT(6), nullable=False, server_default=text("'1'")),
635 Column(
636 "peptide_archive_id",
637 ForeignKey("peptide_archive.peptide_archive_id"),
638 index=True,
639 ),
640 Column(
641 "mapping_session_id",
642 ForeignKey("mapping_session.mapping_session_id"),
643 nullable=False,
644 index=True,
645 ),
646 Index("transcript_idx", "transcript_stable_id", "transcript_version"),
647 Index("translation_idx", "translation_stable_id", "translation_version"),
648 Index("gene_idx", "gene_stable_id", "gene_version"),
649)
652class GeneAttrib(Base):
653 __tablename__ = "gene_attrib"
654 __table_args__ = (
655 Index("gene_attribx", "gene_id", "attrib_type_id", "value", unique=True, mysql_length={"value": 10}),
656 Index("gene_attrib_type_val_idx", "attrib_type_id", "value", mysql_length={"value": 10}),
657 Index("gene_attrib_value_idx", "value", mysql_length=10),
658 )
660 gene_id: Column = Column(
661 INTEGER(10),
662 ForeignKey("gene.gene_id"),
663 nullable=False,
664 index=True,
665 server_default=text("'0'"),
666 primary_key=True,
667 )
668 attrib_type_id: Column = Column(
669 SMALLINT(5),
670 ForeignKey("attrib_type.attrib_type_id"),
671 nullable=False,
672 server_default=text("'0'"),
673 primary_key=True,
674 )
675 value: Column = Column(String(500), nullable=False, primary_key=True)
678class MarkerMapLocation(Base):
679 __tablename__ = "marker_map_location"
680 __table_args__ = (Index("map_idx", "map_id", "chromosome_name", "position"),)
682 marker_id: Column = Column(
683 ForeignKey("marker.marker_id"),
684 primary_key=True,
685 nullable=False,
686 )
687 map_id: Column = Column(
688 ForeignKey("map.map_id"),
689 primary_key=True,
690 nullable=False,
691 )
692 chromosome_name: Column = Column(String(15), nullable=False)
693 marker_synonym_id: Column = Column(
694 ForeignKey("marker_synonym.marker_synonym_id"),
695 nullable=False,
696 index=True,
697 )
698 position: Column = Column(String(15), nullable=False)
699 lod_score: Column = Column(Float(asdecimal=True))
701 map_r = relationship("Map", primaryjoin="MarkerMapLocation.map_id == Map.map_id")
702 marker = relationship("Marker", primaryjoin="MarkerMapLocation.marker_id == Marker.marker_id")
703 marker_synonym = relationship(
704 "MarkerSynonym",
705 primaryjoin="MarkerMapLocation.marker_synonym_id == MarkerSynonym.marker_synonym_id",
706 )
709class Meta(Base):
710 __tablename__ = "meta"
711 __table_args__ = (
712 Index("species_value_idx", "species_id", "meta_value"),
713 Index("species_key_value_idx", "species_id", "meta_key", "meta_value", unique=True),
714 )
716 meta_id: Column = Column(INTEGER(11), primary_key=True)
717 species_id: Column = Column(
718 ForeignKey("coord_system.species_id"),
719 server_default=text("'1'"),
720 )
721 meta_key: Column = Column(String(40), nullable=False)
722 meta_value: Column = Column(String(255), nullable=False)
724 coord_system = relationship("CoordSystem", back_populates="meta")
727class MetaCoord(Base):
728 __tablename__ = "meta_coord"
729 __table_args__ = (Index("cs_table_name_idx", "coord_system_id", "table_name", unique=True),)
731 table_name: Column = Column(String(40), primary_key=True, nullable=False)
732 coord_system_id: Column = Column(
733 INTEGER(10),
734 ForeignKey("coord_system.coord_system_id"),
735 primary_key=True,
736 nullable=False,
737 )
738 max_length: Column = Column(INTEGER(11))
741class ProteinFeature(Base):
742 __tablename__ = "protein_feature"
743 __table_args__ = (
744 Index(
745 "aln_idx",
746 "translation_id",
747 "hit_name",
748 "seq_start",
749 "seq_end",
750 "hit_start",
751 "hit_end",
752 "analysis_id",
753 unique=True,
754 ),
755 )
757 protein_feature_id: Column = Column(INTEGER(10), primary_key=True)
758 translation_id: Column = Column(
759 ForeignKey("translation.translation_id"),
760 nullable=False,
761 index=True,
762 )
763 seq_start: Column = Column(INTEGER(10), nullable=False)
764 seq_end: Column = Column(INTEGER(10), nullable=False)
765 hit_start: Column = Column(INTEGER(10), nullable=False)
766 hit_end: Column = Column(INTEGER(10), nullable=False)
767 hit_name: Column = Column(VARCHAR(40), nullable=False, index=True)
768 analysis_id: Column = Column(
769 ForeignKey("analysis.analysis_id"),
770 nullable=False,
771 index=True,
772 )
773 score: Column = Column(Float(asdecimal=True))
774 evalue: Column = Column(Float(asdecimal=True))
775 perc_ident: Column = Column(Float)
776 external_data: Column = Column(Text)
777 hit_description: Column = Column(Text)
778 cigar_line: Column = Column(Text)
779 align_type: Column = Column(Enum("ensembl", "cigar", "cigarplus", "vulgar", "mdtag"))
781 analysis = relationship("Analysis", primaryjoin="ProteinFeature.analysis_id == Analysis.analysis_id")
782 translation = relationship(
783 "Translation",
784 primaryjoin="ProteinFeature.translation_id == Translation.translation_id",
785 )
788class SeqRegion(Base):
789 __tablename__ = "seq_region"
790 __table_args__ = (Index("name_cs_idx", "name", "coord_system_id", unique=True),)
792 seq_region_id: Column = Column(INTEGER(10), primary_key=True)
793 name: Column = Column(String(255), nullable=False)
794 coord_system_id: Column = Column(
795 ForeignKey("coord_system.coord_system_id"),
796 nullable=False,
797 index=True,
798 )
799 length: Column = Column(INTEGER(10), nullable=False)
800 # Many to one relationship
801 coord_system = relationship("CoordSystem", back_populates="seq_region")
802 seq_region_attrib = relationship("SeqRegionAttrib", back_populates="seq_region")
803 seq_region_synonym = relationship("SeqRegionSynonym", back_populates="seq_region")
804 karyotype = relationship("Karyotype", back_populates="seq_region")
807class Dna(SeqRegion):
808 __tablename__ = "dna"
810 seq_region_id: Column = Column(
811 ForeignKey("seq_region.seq_region_id"),
812 primary_key=True,
813 )
814 sequence: Column = Column(LONGTEXT, nullable=False)
816 seq_region = relationship(
817 "SeqRegion",
818 uselist=False,
819 primaryjoin="Dna.seq_region_id == SeqRegion.seq_region_id",
820 )
823class StableIdEvent(Base):
824 __tablename__ = "stable_id_event"
825 __table_args__ = (
826 Index(
827 "uni_idx",
828 "mapping_session_id",
829 "old_stable_id",
830 "new_stable_id",
831 "type",
832 unique=True,
833 ),
834 )
836 old_stable_id: Column = Column(String(128), primary_key=True, index=True)
837 old_version: Column = Column(SMALLINT(6))
838 new_stable_id: Column = Column(String(128), primary_key=True, index=True)
839 new_version: Column = Column(SMALLINT(6))
840 mapping_session_id: Column = Column(
841 INTEGER(10),
842 ForeignKey("mapping_session.mapping_session_id"),
843 primary_key=True,
844 nullable=False,
845 server_default=text("'0'"),
846 )
847 id_type: Column = Column(
848 "type",
849 Enum("gene", "transcript", "translation", "rnaproduct"),
850 primary_key=True,
851 nullable=False,
852 )
853 score: Column = Column(Float, nullable=False, server_default=text("'0'"))
856class TranscriptAttrib(Base):
857 __tablename__ = "transcript_attrib"
858 __table_args__ = (
859 Index("transcript_attrib_type_val_idx", "attrib_type_id", "value", mysql_length={"value": 10}),
860 Index(
861 "transcript_attribx",
862 "transcript_id",
863 "attrib_type_id",
864 "value",
865 unique=True,
866 mysql_length={"value": 10},
867 ),
868 Index("transcript_attrib_value_idx", "value", mysql_length=10),
869 )
871 transcript_id: Column = Column(
872 INTEGER(10),
873 ForeignKey("transcript.transcript_id"),
874 nullable=False,
875 index=True,
876 server_default=text("'0'"),
877 primary_key=True,
878 )
879 attrib_type_id: Column = Column(
880 SMALLINT(5),
881 ForeignKey("attrib_type.attrib_type_id"),
882 nullable=False,
883 server_default=text("'0'"),
884 primary_key=True,
885 )
886 value: Column = Column(String(500), nullable=False, primary_key=True)
889class TranscriptSupportingFeature(Base):
890 __tablename__ = "transcript_supporting_feature"
891 __table_args__ = (
892 Index("transcript_supporting_feature_idx", "feature_type", "feature_id"),
893 Index(
894 "transcript_supporting_feature_all_idx",
895 "transcript_id",
896 "feature_type",
897 "feature_id",
898 unique=True,
899 ),
900 )
902 transcript_id: Column = Column(
903 INTEGER(10),
904 ForeignKey("transcript.transcript_id"),
905 primary_key=True,
906 nullable=False,
907 server_default=text("'0'"),
908 )
909 feature_type: Column = Column(Enum("dna_align_feature", "protein_align_feature"), primary_key=True)
910 feature_id: Column = Column(INTEGER(10), primary_key=True, nullable=False, server_default=text("'0'"))
913class TranslationAttrib(Base):
914 __tablename__ = "translation_attrib"
915 __table_args__ = (
916 Index("translation_attrib_type_val_idx", "attrib_type_id", "value", mysql_length={"value": 10}),
917 Index(
918 "translation_attribx",
919 "translation_id",
920 "attrib_type_id",
921 "value",
922 unique=True,
923 mysql_length={"value": 10},
924 ),
925 Index("translation_attrib_value_idx", "value", mysql_length=10),
926 )
928 translation_id: Column = Column(
929 ForeignKey("translation.translation_id"),
930 nullable=False,
931 index=True,
932 server_default=text("'0'"),
933 primary_key=True,
934 )
935 attrib_type_id: Column = Column(
936 ForeignKey("attrib_type.attrib_type_id"),
937 nullable=False,
938 server_default=text("'0'"),
939 primary_key=True,
940 )
941 value: Column = Column(String(500), nullable=False, primary_key=True)
944class UnmappedObject(Base):
945 __tablename__ = "unmapped_object"
946 __table_args__ = (
947 Index(
948 "unique_unmapped_obj_idx",
949 "ensembl_id",
950 "ensembl_object_type",
951 "identifier",
952 "unmapped_reason_id",
953 "parent",
954 "external_db_id",
955 unique=True,
956 ),
957 Index("anal_exdb_idx", "analysis_id", "external_db_id"),
958 Index("ext_db_identifier_idx", "external_db_id", "identifier"),
959 )
961 unmapped_object_id: Column = Column(INTEGER(10), primary_key=True)
962 unmapped_object_type: Column = Column("type", Enum("xref", "cDNA", "Marker"), nullable=False)
963 analysis_id: Column = Column(
964 ForeignKey("analysis.analysis_id"),
965 nullable=False,
966 )
967 external_db_id: Column = Column(
968 ForeignKey("external_db.external_db_id"),
969 )
970 identifier: Column = Column(String(255), nullable=False, index=True)
971 unmapped_reason_id: Column = Column(
972 ForeignKey("unmapped_reason.unmapped_reason_id"),
973 nullable=False,
974 index=True,
975 )
976 query_score: Column = Column(Float(asdecimal=True))
977 target_score: Column = Column(Float(asdecimal=True))
978 ensembl_id: Column = Column(INTEGER(10), server_default=text("'0'"))
979 ensembl_object_type: Column = Column(
980 Enum("RawContig", "Transcript", "Gene", "Translation"),
981 server_default=text("'RawContig'"),
982 )
983 parent: Column = Column(String(255))
985 analysis = relationship("Analysis", primaryjoin="UnmappedObject.analysis_id == Analysis.analysis_id")
986 external_db = relationship(
987 "ExternalDb",
988 primaryjoin="UnmappedObject.external_db_id == ExternalDb.external_db_id",
989 )
990 unmapped_reason = relationship(
991 "UnmappedReason",
992 primaryjoin="UnmappedObject.unmapped_reason_id == UnmappedReason.unmapped_reason_id",
993 )
996class Xref(Base):
997 __tablename__ = "xref"
998 __table_args__ = (
999 Index(
1000 "id_index",
1001 "dbprimary_acc",
1002 "external_db_id",
1003 "info_type",
1004 "info_text",
1005 "version",
1006 unique=True,
1007 ),
1008 )
1010 xref_id: Column = Column(INTEGER(10), primary_key=True)
1011 external_db_id: Column = Column(
1012 ForeignKey("external_db.external_db_id"),
1013 nullable=False,
1014 index=True,
1015 )
1016 dbprimary_acc: Column = Column(String(512), nullable=False)
1017 display_label: Column = Column(String(512), nullable=False, index=True)
1018 version: Column = Column(String(10))
1019 description: Column = Column(Text)
1020 info_type: Column = Column(
1021 Enum(
1022 "NONE",
1023 "PROJECTION",
1024 "MISC",
1025 "DEPENDENT",
1026 "DIRECT",
1027 "SEQUENCE_MATCH",
1028 "INFERRED_PAIR",
1029 "PROBE",
1030 "UNMAPPED",
1031 "COORDINATE_OVERLAP",
1032 "CHECKSUM",
1033 ),
1034 nullable=False,
1035 index=True,
1036 server_default=text("'NONE'"),
1037 )
1038 info_text: Column = Column(String(255), nullable=False, server_default=text("''"))
1040 external_db = relationship("ExternalDb", primaryjoin="Xref.external_db_id == ExternalDb.external_db_id")
1043t_alt_allele_attrib = Table(
1044 "alt_allele_attrib",
1045 metadata,
1046 Column(
1047 "alt_allele_id",
1048 ForeignKey("alt_allele.alt_allele_id"),
1049 ),
1050 Column(
1051 "attrib",
1052 Enum(
1053 "IS_REPRESENTATIVE",
1054 "IS_MOST_COMMON_ALLELE",
1055 "IN_CORRECTED_ASSEMBLY",
1056 "HAS_CODING_POTENTIAL",
1057 "IN_ARTIFICIALLY_DUPLICATED_ASSEMBLY",
1058 "IN_SYNTENIC_REGION",
1059 "HAS_SAME_UNDERLYING_DNA_SEQUENCE",
1060 "IN_BROKEN_ASSEMBLY_REGION",
1061 "IS_VALID_ALTERNATE",
1062 "SAME_AS_REPRESENTATIVE",
1063 "SAME_AS_ANOTHER_ALLELE",
1064 "MANUALLY_ASSIGNED",
1065 "AUTOMATICALLY_ASSIGNED",
1066 ),
1067 ),
1068 Index("aa_idx", "alt_allele_id", "attrib"),
1069)
1072class Assembly(Base):
1073 __tablename__ = "assembly"
1074 __table_args__ = (
1075 Index("asm_seq_region_idx", "asm_seq_region_id", "asm_start"),
1076 Index(
1077 "asm_all_idx",
1078 "asm_seq_region_id",
1079 "cmp_seq_region_id",
1080 "asm_start",
1081 "asm_end",
1082 "cmp_start",
1083 "cmp_end",
1084 "ori",
1085 unique=True,
1086 ),
1087 )
1089 asm_seq_region_id: Column = Column(
1090 INTEGER(10),
1091 ForeignKey("seq_region.seq_region_id"),
1092 primary_key=True,
1093 nullable=False,
1094 )
1095 cmp_seq_region_id: Column = Column(
1096 INTEGER(10),
1097 ForeignKey("seq_region.seq_region_id"),
1098 primary_key=True,
1099 nullable=False,
1100 )
1101 asm_start: Column = Column(INTEGER(10), primary_key=True, nullable=False)
1102 asm_end: Column = Column(INTEGER(10), primary_key=True, nullable=False)
1103 cmp_start: Column = Column(INTEGER(10), primary_key=True, nullable=False)
1104 cmp_end: Column = Column(INTEGER(10), primary_key=True, nullable=False)
1105 ori: Column = Column(TINYINT(4), primary_key=True, nullable=False)
1108class AssemblyException(Base):
1109 __tablename__ = "assembly_exception"
1110 __table_args__ = (
1111 Index("ex_idx", "exc_seq_region_id", "exc_seq_region_start"),
1112 Index("sr_idx", "seq_region_id", "seq_region_start"),
1113 )
1115 assembly_exception_id: Column = Column(INTEGER(10), primary_key=True)
1116 seq_region_id: Column = Column(
1117 ForeignKey("seq_region.seq_region_id"),
1118 nullable=False,
1119 )
1120 seq_region_start: Column = Column(INTEGER(10), nullable=False)
1121 seq_region_end: Column = Column(INTEGER(10), nullable=False)
1122 exc_type: Column = Column(Enum("HAP", "PAR", "PATCH_FIX", "PATCH_NOVEL"), nullable=False)
1123 exc_seq_region_id: Column = Column(
1124 ForeignKey("seq_region.seq_region_id"),
1125 nullable=False,
1126 )
1127 exc_seq_region_start: Column = Column(INTEGER(10), nullable=False)
1128 exc_seq_region_end: Column = Column(INTEGER(10), nullable=False)
1129 ori: Column = Column(INTEGER(11), nullable=False)
1131 exc_seq_region = relationship(
1132 "SeqRegion",
1133 primaryjoin="AssemblyException.exc_seq_region_id == SeqRegion.seq_region_id",
1134 )
1135 seq_region = relationship(
1136 "SeqRegion",
1137 primaryjoin="AssemblyException.seq_region_id == SeqRegion.seq_region_id",
1138 )
1141class DensityFeature(Base):
1142 __tablename__ = "density_feature"
1143 __table_args__ = (
1144 Index("density_seq_region_idx", "density_type_id", "seq_region_id", "seq_region_start"),
1145 )
1147 density_feature_id: Column = Column(INTEGER(10), primary_key=True)
1148 density_type_id: Column = Column(
1149 ForeignKey("density_type.density_type_id"),
1150 nullable=False,
1151 )
1152 seq_region_id: Column = Column(
1153 ForeignKey("seq_region.seq_region_id"),
1154 nullable=False,
1155 index=True,
1156 )
1157 seq_region_start: Column = Column(INTEGER(10), nullable=False)
1158 seq_region_end: Column = Column(INTEGER(10), nullable=False)
1159 density_value: Column = Column(Float, nullable=False)
1161 density_type = relationship(
1162 "DensityType",
1163 primaryjoin="DensityFeature.density_type_id == DensityType.density_type_id",
1164 )
1165 seq_region = relationship(
1166 "SeqRegion",
1167 primaryjoin="DensityFeature.seq_region_id == SeqRegion.seq_region_id",
1168 )
1171class DitagFeature(Base):
1172 __tablename__ = "ditag_feature"
1173 __table_args__ = (Index("ditag_seq_region_idx", "seq_region_id", "seq_region_start", "seq_region_end"),)
1175 ditag_feature_id: Column = Column(INTEGER(10), primary_key=True)
1176 ditag_id: Column = Column(
1177 ForeignKey("ditag.ditag_id"),
1178 nullable=False,
1179 index=True,
1180 server_default=text("'0'"),
1181 )
1182 ditag_pair_id: Column = Column(INTEGER(10), nullable=False, index=True, server_default=text("'0'"))
1183 seq_region_id: Column = Column(
1184 ForeignKey("seq_region.seq_region_id"),
1185 nullable=False,
1186 server_default=text("'0'"),
1187 )
1188 seq_region_start: Column = Column(INTEGER(10), nullable=False, server_default=text("'0'"))
1189 seq_region_end: Column = Column(INTEGER(10), nullable=False, server_default=text("'0'"))
1190 seq_region_strand: Column = Column(TINYINT(1), nullable=False, server_default=text("'0'"))
1191 analysis_id: Column = Column(
1192 ForeignKey("analysis.analysis_id"),
1193 nullable=False,
1194 index=True,
1195 server_default=text("'0'"),
1196 )
1197 hit_start: Column = Column(INTEGER(10), nullable=False, server_default=text("'0'"))
1198 hit_end: Column = Column(INTEGER(10), nullable=False, server_default=text("'0'"))
1199 hit_strand: Column = Column(TINYINT(1), nullable=False, server_default=text("'0'"))
1200 cigar_line: Column = Column(TINYTEXT, nullable=False)
1201 ditag_side: Column = Column(Enum("F", "L", "R"), nullable=False)
1203 analysis = relationship("Analysis", primaryjoin="DitagFeature.analysis_id == Analysis.analysis_id")
1204 ditag = relationship("Ditag", primaryjoin="DitagFeature.ditag_id == Ditag.ditag_id")
1205 seq_region = relationship(
1206 "SeqRegion", primaryjoin="DitagFeature.seq_region_id == SeqRegion.seq_region_id"
1207 )
1210class DnaAlignFeature(Base):
1211 __tablename__ = "dna_align_feature"
1212 __table_args__ = (
1213 Index("dna_align_seq_region_idx_2", "seq_region_id", "seq_region_start"),
1214 Index(
1215 "dna_align_seq_region_idx",
1216 "seq_region_id",
1217 "analysis_id",
1218 "seq_region_start",
1219 "score",
1220 ),
1221 )
1223 dna_align_feature_id: Column = Column(INTEGER(10), primary_key=True)
1224 seq_region_id: Column = Column(
1225 ForeignKey("seq_region.seq_region_id"),
1226 nullable=False,
1227 )
1228 seq_region_start: Column = Column(INTEGER(10), nullable=False)
1229 seq_region_end: Column = Column(INTEGER(10), nullable=False)
1230 seq_region_strand: Column = Column(TINYINT(1), nullable=False)
1231 hit_start: Column = Column(INTEGER(11), nullable=False)
1232 hit_end: Column = Column(INTEGER(11), nullable=False)
1233 hit_strand: Column = Column(TINYINT(1), nullable=False)
1234 hit_name: Column = Column(String(40), nullable=False, index=True)
1235 analysis_id: Column = Column(
1236 ForeignKey("analysis.analysis_id"),
1237 nullable=False,
1238 index=True,
1239 )
1240 score: Column = Column(Float(asdecimal=True))
1241 evalue: Column = Column(Float(asdecimal=True))
1242 perc_ident: Column = Column(Float)
1243 cigar_line: Column = Column(Text)
1244 external_db_id: Column = Column(
1245 ForeignKey("external_db.external_db_id"),
1246 index=True,
1247 )
1248 hcoverage: Column = Column(Float(asdecimal=True))
1249 align_type: Column = Column(Enum("ensembl", "cigar", "vulgar", "mdtag"), server_default=text("'ensembl'"))
1251 analysis = relationship("Analysis", primaryjoin="DnaAlignFeature.analysis_id == Analysis.analysis_id")
1252 external_db = relationship(
1253 "ExternalDb",
1254 primaryjoin="DnaAlignFeature.external_db_id == ExternalDb.external_db_id",
1255 )
1256 seq_region = relationship(
1257 "SeqRegion",
1258 primaryjoin="DnaAlignFeature.seq_region_id == SeqRegion.seq_region_id",
1259 )
1262class Exon(Base):
1263 __tablename__ = "exon"
1264 __table_args__ = (
1265 Index("exon_seq_region_idx", "seq_region_id", "seq_region_start"),
1266 Index("exon_stable_id_idx", "stable_id", "version"),
1267 )
1269 exon_id: Column = Column(INTEGER(10), primary_key=True)
1270 seq_region_id: Column = Column(
1271 ForeignKey("seq_region.seq_region_id"),
1272 nullable=False,
1273 )
1274 seq_region_start: Column = Column(INTEGER(10), nullable=False)
1275 seq_region_end: Column = Column(INTEGER(10), nullable=False)
1276 seq_region_strand: Column = Column(TINYINT(2), nullable=False)
1277 phase: Column = Column(TINYINT(2), nullable=False)
1278 end_phase: Column = Column(TINYINT(2), nullable=False)
1279 is_current: Column = Column(TINYINT(1), nullable=False, server_default=text("'1'"))
1280 is_constitutive: Column = Column(TINYINT(1), nullable=False, server_default=text("'0'"))
1281 stable_id: Column = Column(String(128))
1282 version: Column = Column(SMALLINT(5))
1283 created_date: Column = Column(DateTime)
1284 modified_date: Column = Column(DateTime)
1286 seq_region = relationship("SeqRegion", primaryjoin="Exon.seq_region_id == SeqRegion.seq_region_id")
1289class ExternalSynonym(Base):
1290 __tablename__ = "external_synonym"
1292 xref_id: Column = Column(
1293 ForeignKey("xref.xref_id"),
1294 primary_key=True,
1295 nullable=False,
1296 )
1297 synonym: Column = Column(String(100), primary_key=True, nullable=False, index=True)
1299 xref = relationship("Xref", primaryjoin="ExternalSynonym.xref_id == Xref.xref_id")
1302class IntronSupportingEvidence(Base):
1303 __tablename__ = "intron_supporting_evidence"
1304 __table_args__ = (
1305 Index(
1306 "analysis_id",
1307 "analysis_id",
1308 "seq_region_id",
1309 "seq_region_start",
1310 "seq_region_end",
1311 "seq_region_strand",
1312 "hit_name",
1313 unique=True,
1314 ),
1315 Index("intron_evidence_seq_region_idx", "seq_region_id", "seq_region_start"),
1316 )
1318 intron_supporting_evidence_id: Column = Column(INTEGER(10), primary_key=True)
1319 analysis_id: Column = Column(
1320 ForeignKey("analysis.analysis_id"),
1321 nullable=False,
1322 )
1323 seq_region_id: Column = Column(
1324 ForeignKey("seq_region.seq_region_id"),
1325 nullable=False,
1326 )
1327 seq_region_start: Column = Column(INTEGER(10), nullable=False)
1328 seq_region_end: Column = Column(INTEGER(10), nullable=False)
1329 seq_region_strand: Column = Column(TINYINT(2), nullable=False)
1330 hit_name: Column = Column(String(100), nullable=False)
1331 score: Column = Column(DECIMAL(10, 3))
1332 score_type: Column = Column(Enum("NONE", "DEPTH"), server_default=text("'NONE'"))
1333 is_splice_canonical: Column = Column(TINYINT(1), nullable=False, server_default=text("'0'"))
1335 analysis = relationship(
1336 "Analysis",
1337 primaryjoin="IntronSupportingEvidence.analysis_id == Analysis.analysis_id",
1338 )
1339 seq_region = relationship(
1340 "SeqRegion",
1341 primaryjoin="IntronSupportingEvidence.seq_region_id == SeqRegion.seq_region_id",
1342 )
1345class Karyotype(Base):
1346 __tablename__ = "karyotype"
1347 __table_args__ = (Index("region_band_idx", "seq_region_id", "band"),)
1349 karyotype_id: Column = Column(INTEGER(10), primary_key=True)
1350 seq_region_id: Column = Column(
1351 ForeignKey("seq_region.seq_region_id"),
1352 nullable=False,
1353 )
1354 seq_region_start: Column = Column(INTEGER(10), nullable=False)
1355 seq_region_end: Column = Column(INTEGER(10), nullable=False)
1356 band: Column = Column(String(40))
1357 stain: Column = Column(String(40))
1359 seq_region = relationship("SeqRegion", primaryjoin="Karyotype.seq_region_id == SeqRegion.seq_region_id")
1362class MarkerFeature(Base):
1363 __tablename__ = "marker_feature"
1364 __table_args__ = (Index("marker_seq_region_idx", "seq_region_id", "seq_region_start"),)
1366 marker_feature_id: Column = Column(INTEGER(10), primary_key=True)
1367 marker_id: Column = Column(
1368 ForeignKey("marker.marker_id"),
1369 nullable=False,
1370 index=True,
1371 )
1372 seq_region_id: Column = Column(
1373 ForeignKey("seq_region.seq_region_id"),
1374 nullable=False,
1375 )
1376 seq_region_start: Column = Column(INTEGER(10), nullable=False)
1377 seq_region_end: Column = Column(INTEGER(10), nullable=False)
1378 analysis_id: Column = Column(
1379 ForeignKey("analysis.analysis_id"),
1380 nullable=False,
1381 index=True,
1382 )
1383 map_weight: Column = Column(INTEGER(10))
1385 analysis = relationship("Analysis", primaryjoin="MarkerFeature.analysis_id == Analysis.analysis_id")
1386 marker = relationship("Marker", primaryjoin="MarkerFeature.marker_id == Marker.marker_id")
1387 seq_region = relationship(
1388 "SeqRegion",
1389 primaryjoin="MarkerFeature.seq_region_id == SeqRegion.seq_region_id",
1390 )
1393t_misc_feature_misc_set = Table(
1394 "misc_feature_misc_set",
1395 metadata,
1396 Column(
1397 "misc_feature_id",
1398 ForeignKey("misc_feature.misc_feature_id"),
1399 primary_key=True,
1400 nullable=False,
1401 server_default=text("'0'"),
1402 ),
1403 Column(
1404 "misc_set_id",
1405 ForeignKey("misc_set.misc_set_id"),
1406 primary_key=True,
1407 nullable=False,
1408 server_default=text("'0'"),
1409 ),
1410 Index("reverse_idx", "misc_set_id", "misc_feature_id"),
1411)
1414class MiscSet(Base):
1415 __tablename__ = "misc_set"
1417 misc_set_id: Column = Column(SMALLINT(5), primary_key=True)
1418 code: Column = Column(String(25), nullable=False, unique=True, server_default=text("''"))
1419 name: Column = Column(String(255), nullable=False, server_default=text("''"))
1420 description: Column = Column(Text, nullable=False)
1421 max_length: Column = Column(INTEGER(10), nullable=False)
1423 # misc_features = relationship("MiscFeature", secondary=t_misc_feature_misc_set)
1426class MiscFeature(Base):
1427 __tablename__ = "misc_feature"
1428 __table_args__ = (Index("misc_seq_region_idx", "seq_region_id", "seq_region_start"),)
1430 misc_feature_id: Column = Column(INTEGER(10), primary_key=True)
1431 seq_region_id: Column = Column(
1432 ForeignKey("seq_region.seq_region_id"),
1433 nullable=False,
1434 server_default=text("'0'"),
1435 )
1436 seq_region_start: Column = Column(INTEGER(10), nullable=False, server_default=text("'0'"))
1437 seq_region_end: Column = Column(INTEGER(10), nullable=False, server_default=text("'0'"))
1438 seq_region_strand: Column = Column(TINYINT(4), nullable=False, server_default=text("'0'"))
1440 seq_region = relationship("SeqRegion", primaryjoin="MiscFeature.seq_region_id == SeqRegion.seq_region_id")
1441 # misc_sets = relationship("MiscSet", secondary=t_misc_feature_misc_set)
1444class ObjectXref(Base):
1445 __tablename__ = "object_xref"
1446 __table_args__ = (
1447 Index("ensembl_idx", "ensembl_object_type", "ensembl_id"),
1448 Index(
1449 "xref_idx",
1450 "xref_id",
1451 "ensembl_object_type",
1452 "ensembl_id",
1453 "analysis_id",
1454 unique=True,
1455 ),
1456 )
1458 object_xref_id: Column = Column(INTEGER(10), primary_key=True)
1459 ensembl_id: Column = Column(INTEGER(10), nullable=False)
1460 ensembl_object_type: Column = Column(
1461 Enum(
1462 "RawContig",
1463 "Transcript",
1464 "Gene",
1465 "Translation",
1466 "Operon",
1467 "OperonTranscript",
1468 "Marker",
1469 "RNAProduct",
1470 ),
1471 nullable=False,
1472 )
1473 xref_id: Column = Column(ForeignKey("xref.xref_id"), nullable=False)
1474 linkage_annotation: Column = Column(String(255))
1475 analysis_id: Column = Column(
1476 ForeignKey("analysis.analysis_id"),
1477 index=True,
1478 )
1480 analysis = relationship("Analysis", primaryjoin="ObjectXref.analysis_id == Analysis.analysis_id")
1481 xref = relationship("Xref", primaryjoin="ObjectXref.xref_id == Xref.xref_id")
1484class DependentXref(ObjectXref):
1485 __tablename__ = "dependent_xref"
1487 object_xref_id: Column = Column(
1488 ForeignKey("object_xref.object_xref_id"),
1489 primary_key=True,
1490 )
1491 master_xref_id: Column = Column(
1492 ForeignKey("xref.xref_id"),
1493 nullable=False,
1494 index=True,
1495 )
1496 dependent_xref_id: Column = Column(
1497 ForeignKey("xref.xref_id"),
1498 nullable=False,
1499 index=True,
1500 )
1503class IdentityXref(ObjectXref):
1504 __tablename__ = "identity_xref"
1506 object_xref_id: Column = Column(
1507 ForeignKey("object_xref.object_xref_id"),
1508 primary_key=True,
1509 )
1510 xref_identity: Column = Column(INTEGER(5))
1511 ensembl_identity: Column = Column(INTEGER(5))
1512 xref_start: Column = Column(INTEGER(11))
1513 xref_end: Column = Column(INTEGER(11))
1514 ensembl_start: Column = Column(INTEGER(11))
1515 ensembl_end: Column = Column(INTEGER(11))
1516 cigar_line: Column = Column(Text)
1517 score: Column = Column(Float(asdecimal=True))
1518 evalue: Column = Column(Float(asdecimal=True))
1520 object_xref = relationship(
1521 "ObjectXref",
1522 uselist=False,
1523 primaryjoin="IdentityXref.object_xref_id == ObjectXref.object_xref_id",
1524 )
1527class Operon(Base):
1528 __tablename__ = "operon"
1529 __table_args__ = (
1530 Index("operon_seq_region_idx", "seq_region_id", "seq_region_start"),
1531 Index("operon_stable_id_idx", "stable_id", "version"),
1532 )
1534 operon_id: Column = Column(INTEGER(10), primary_key=True)
1535 seq_region_id: Column = Column(
1536 ForeignKey("seq_region.seq_region_id"),
1537 nullable=False,
1538 )
1539 seq_region_start: Column = Column(INTEGER(10), nullable=False)
1540 seq_region_end: Column = Column(INTEGER(10), nullable=False)
1541 seq_region_strand: Column = Column(TINYINT(2), nullable=False)
1542 display_label: Column = Column(String(255), index=True)
1543 analysis_id: Column = Column(
1544 ForeignKey("analysis.analysis_id"),
1545 nullable=False,
1546 index=True,
1547 )
1548 stable_id: Column = Column(String(128))
1549 version: Column = Column(SMALLINT(5))
1550 created_date: Column = Column(DateTime)
1551 modified_date: Column = Column(DateTime)
1553 analysis = relationship("Analysis", primaryjoin="Operon.analysis_id == Analysis.analysis_id")
1554 seq_region = relationship("SeqRegion", primaryjoin="Operon.seq_region_id == SeqRegion.seq_region_id")
1557class PredictionTranscript(Base):
1558 __tablename__ = "prediction_transcript"
1559 __table_args__ = (Index("prediction_transcript_seq_region_idx", "seq_region_id", "seq_region_start"),)
1561 prediction_transcript_id: Column = Column(INTEGER(10), primary_key=True)
1562 seq_region_id: Column = Column(
1563 ForeignKey("seq_region.seq_region_id"),
1564 nullable=False,
1565 )
1566 seq_region_start: Column = Column(INTEGER(10), nullable=False)
1567 seq_region_end: Column = Column(INTEGER(10), nullable=False)
1568 seq_region_strand: Column = Column(TINYINT(4), nullable=False)
1569 analysis_id: Column = Column(
1570 ForeignKey("analysis.analysis_id"),
1571 nullable=False,
1572 index=True,
1573 )
1574 display_label: Column = Column(String(255))
1576 analysis = relationship(
1577 "Analysis",
1578 primaryjoin="PredictionTranscript.analysis_id == Analysis.analysis_id",
1579 )
1580 seq_region = relationship(
1581 "SeqRegion",
1582 primaryjoin="PredictionTranscript.seq_region_id == SeqRegion.seq_region_id",
1583 )
1586class ProteinAlignFeature(Base):
1587 __tablename__ = "protein_align_feature"
1588 __table_args__ = (
1589 Index("protein_align_seq_region_idx_2", "seq_region_id", "seq_region_start"),
1590 Index(
1591 "seq_region_idx",
1592 "seq_region_id",
1593 "analysis_id",
1594 "seq_region_start",
1595 "score",
1596 ),
1597 )
1599 protein_align_feature_id: Column = Column(INTEGER(10), primary_key=True)
1600 seq_region_id: Column = Column(
1601 ForeignKey("seq_region.seq_region_id"),
1602 nullable=False,
1603 )
1604 seq_region_start: Column = Column(INTEGER(10), nullable=False)
1605 seq_region_end: Column = Column(INTEGER(10), nullable=False)
1606 seq_region_strand: Column = Column(TINYINT(1), nullable=False, server_default=text("'1'"))
1607 hit_start: Column = Column(INTEGER(10), nullable=False)
1608 hit_end: Column = Column(INTEGER(10), nullable=False)
1609 hit_name: Column = Column(String(40), nullable=False, index=True)
1610 analysis_id: Column = Column(
1611 ForeignKey("analysis.analysis_id"),
1612 nullable=False,
1613 index=True,
1614 )
1615 score: Column = Column(Float(asdecimal=True))
1616 evalue: Column = Column(Float(asdecimal=True))
1617 perc_ident: Column = Column(Float)
1618 cigar_line: Column = Column(Text)
1619 external_db_id: Column = Column(
1620 ForeignKey("external_db.external_db_id"),
1621 index=True,
1622 )
1623 hcoverage: Column = Column(Float(asdecimal=True))
1624 align_type: Column = Column(Enum("ensembl", "cigar", "vulgar", "mdtag"), server_default=text("'ensembl'"))
1626 analysis = relationship(
1627 "Analysis",
1628 primaryjoin="ProteinAlignFeature.analysis_id == Analysis.analysis_id",
1629 )
1630 external_db = relationship(
1631 "ExternalDb",
1632 primaryjoin="ProteinAlignFeature.external_db_id == ExternalDb.external_db_id",
1633 )
1634 seq_region = relationship(
1635 "SeqRegion",
1636 primaryjoin="ProteinAlignFeature.seq_region_id == SeqRegion.seq_region_id",
1637 )
1640class RepeatFeature(Base):
1641 __tablename__ = "repeat_feature"
1642 __table_args__ = (Index("repeat_feature_seq_region_idx", "seq_region_id", "seq_region_start"),)
1644 repeat_feature_id: Column = Column(INTEGER(10), primary_key=True)
1645 seq_region_id: Column = Column(
1646 ForeignKey("seq_region.seq_region_id"),
1647 nullable=False,
1648 )
1649 seq_region_start: Column = Column(INTEGER(10), nullable=False)
1650 seq_region_end: Column = Column(INTEGER(10), nullable=False)
1651 seq_region_strand: Column = Column(TINYINT(1), nullable=False, server_default=text("'1'"))
1652 repeat_start: Column = Column(INTEGER(10), nullable=False)
1653 repeat_end: Column = Column(INTEGER(10), nullable=False)
1654 repeat_consensus_id: Column = Column(
1655 ForeignKey("repeat_consensus.repeat_consensus_id"),
1656 nullable=False,
1657 index=True,
1658 )
1659 analysis_id: Column = Column(
1660 ForeignKey("analysis.analysis_id"),
1661 nullable=False,
1662 index=True,
1663 )
1664 score: Column = Column(Float(asdecimal=True))
1666 analysis = relationship("Analysis", primaryjoin="RepeatFeature.analysis_id == Analysis.analysis_id")
1667 repeat_consensus = relationship(
1668 "RepeatConsensus",
1669 primaryjoin="RepeatFeature.repeat_consensus_id == RepeatConsensus.repeat_consensus_id",
1670 )
1671 seq_region = relationship(
1672 "SeqRegion",
1673 primaryjoin="RepeatFeature.seq_region_id == SeqRegion.seq_region_id",
1674 )
1677class SeqRegionAttrib(Base):
1678 __tablename__ = "seq_region_attrib"
1679 __table_args__ = (
1680 Index(
1681 "region_attribx",
1682 "seq_region_id",
1683 "attrib_type_id",
1684 "value",
1685 unique=True,
1686 mysql_length={"value": 10},
1687 ),
1688 Index("region_attrib_type_val_idx", "attrib_type_id", "value", mysql_length={"value": 10}),
1689 Index("region_attrib_value_idx", "value", mysql_length=10),
1690 )
1692 seq_region_id: Column = Column(
1693 ForeignKey("seq_region.seq_region_id"),
1694 nullable=False,
1695 index=True,
1696 server_default=text("'0'"),
1697 primary_key=True,
1698 )
1699 attrib_type_id: Column = Column(
1700 ForeignKey("attrib_type.attrib_type_id"),
1701 nullable=False,
1702 server_default=text("'0'"),
1703 primary_key=True,
1704 )
1705 value: Column = Column(String(500), nullable=False, primary_key=True)
1707 UniqueConstraint("seq_region_id", "attrib_type_id", "value", name="region_attribx")
1708 seq_region = relationship("SeqRegion", back_populates="seq_region_attrib")
1709 attrib_type = relationship("AttribType", back_populates="seq_region_attrib")
1712# Not in first normal form, can't be mapped (i.e. it has fully duplicated rows for homo_sapiens_core)
1713t_seq_region_mapping = Table(
1714 "seq_region_mapping",
1715 metadata,
1716 Column("external_seq_region_id", INTEGER(10), nullable=False),
1717 Column(
1718 "internal_seq_region_id",
1719 ForeignKey("seq_region.seq_region_id"),
1720 nullable=False,
1721 index=True,
1722 ),
1723 Column(
1724 "mapping_set_id",
1725 ForeignKey("mapping_set.mapping_set_id"),
1726 nullable=False,
1727 index=True,
1728 ),
1729)
1732class SeqRegionSynonym(Base):
1733 __tablename__ = "seq_region_synonym"
1734 __table_args__ = (Index("syn_idx", "synonym", "seq_region_id", unique=True),)
1736 seq_region_synonym_id: Column = Column(INTEGER(10), primary_key=True)
1737 seq_region_id: Column = Column(
1738 ForeignKey("seq_region.seq_region_id"),
1739 nullable=False,
1740 index=True,
1741 )
1742 synonym: Column = Column(String(250), nullable=False)
1743 external_db_id: Column = Column(ForeignKey("external_db.external_db_id"))
1745 seq_region = relationship("SeqRegion", back_populates="seq_region_synonym")
1746 external_db = relationship("ExternalDb", back_populates="seq_region_synonym")
1749class SimpleFeature(Base):
1750 __tablename__ = "simple_feature"
1751 __table_args__ = (Index("simple_feature_seq_region_idx", "seq_region_id", "seq_region_start"),)
1753 simple_feature_id: Column = Column(INTEGER(10), primary_key=True)
1754 seq_region_id: Column = Column(
1755 ForeignKey("seq_region.seq_region_id"),
1756 nullable=False,
1757 )
1758 seq_region_start: Column = Column(INTEGER(10), nullable=False)
1759 seq_region_end: Column = Column(INTEGER(10), nullable=False)
1760 seq_region_strand: Column = Column(TINYINT(1), nullable=False)
1761 display_label: Column = Column(String(255), nullable=False, index=True)
1762 analysis_id: Column = Column(
1763 ForeignKey("analysis.analysis_id"),
1764 nullable=False,
1765 index=True,
1766 )
1767 score: Column = Column(Float(asdecimal=True))
1769 analysis = relationship("Analysis", primaryjoin="SimpleFeature.analysis_id == Analysis.analysis_id")
1770 seq_region = relationship(
1771 "SeqRegion",
1772 primaryjoin="SimpleFeature.seq_region_id == SeqRegion.seq_region_id",
1773 )
1776class AssociatedXref(Base):
1777 __tablename__ = "associated_xref"
1778 __table_args__ = (
1779 Index(
1780 "object_associated_source_type_idx",
1781 "object_xref_id",
1782 "xref_id",
1783 "source_xref_id",
1784 "condition_type",
1785 "associated_group_id",
1786 unique=True,
1787 ),
1788 )
1790 associated_xref_id: Column = Column(INTEGER(10), primary_key=True)
1791 object_xref_id: Column = Column(
1792 ForeignKey("object_xref.object_xref_id"),
1793 nullable=False,
1794 index=True,
1795 server_default=text("'0'"),
1796 )
1797 xref_id: Column = Column(
1798 ForeignKey("xref.xref_id"),
1799 nullable=False,
1800 index=True,
1801 server_default=text("'0'"),
1802 )
1803 source_xref_id: Column = Column(INTEGER(10), index=True)
1804 condition_type: Column = Column(String(128))
1805 associated_group_id: Column = Column(
1806 ForeignKey("associated_group.associated_group_id"),
1807 index=True,
1808 )
1809 rank: Column = Column(INTEGER(10), server_default=text("'0'"))
1811 associated_group = relationship(
1812 "AssociatedGroup",
1813 primaryjoin="AssociatedXref.associated_group_id == AssociatedGroup.associated_group_id",
1814 )
1815 object_xref = relationship(
1816 "ObjectXref",
1817 primaryjoin="AssociatedXref.object_xref_id == ObjectXref.object_xref_id",
1818 )
1819 xref = relationship("Xref", primaryjoin="AssociatedXref.xref_id == Xref.xref_id")
1822class ExonTranscript(Base):
1823 __tablename__ = "exon_transcript"
1825 exon_id: Column = Column(
1826 ForeignKey("exon.exon_id"),
1827 primary_key=True,
1828 nullable=False,
1829 index=True,
1830 )
1831 transcript_id: Column = Column(
1832 ForeignKey("transcript.transcript_id"),
1833 primary_key=True,
1834 nullable=False,
1835 index=True,
1836 )
1837 rank: Column = Column(INTEGER(10), primary_key=True, nullable=False)
1839 exon = relationship("Exon", primaryjoin="ExonTranscript.exon_id == Exon.exon_id")
1840 transcript = relationship(
1841 "Transcript",
1842 primaryjoin="ExonTranscript.transcript_id == Transcript.transcript_id",
1843 )
1846class MiscAttrib(Base):
1847 __tablename__ = "misc_attrib"
1848 __table_args__ = (
1849 Index("misc_attrib_type_val_idx", "attrib_type_id", "value", mysql_length={"value": 10}),
1850 Index(
1851 "misc_attribx",
1852 "misc_feature_id",
1853 "attrib_type_id",
1854 "value",
1855 unique=True,
1856 mysql_length={"value": 10},
1857 ),
1858 Index("misc_attrib_value_idx", "value", mysql_length=10),
1859 )
1861 misc_feature_id: Column = Column(
1862 INTEGER(10),
1863 ForeignKey("misc_feature.misc_feature_id"),
1864 nullable=False,
1865 index=True,
1866 server_default=text("'0'"),
1867 primary_key=True,
1868 )
1869 attrib_type_id: Column = Column(
1870 SMALLINT(5),
1871 ForeignKey("attrib_type.attrib_type_id"),
1872 nullable=False,
1873 server_default=text("'0'"),
1874 primary_key=True,
1875 )
1876 value: Column = Column(String(500), nullable=False, primary_key=True)
1879class OntologyXref(Base):
1880 __tablename__ = "ontology_xref"
1881 __table_args__ = (
1882 Index(
1883 "object_source_type_idx",
1884 "object_xref_id",
1885 "source_xref_id",
1886 "linkage_type",
1887 unique=True,
1888 ),
1889 )
1891 object_xref_id: Column = Column(
1892 INTEGER(10),
1893 ForeignKey("object_xref.object_xref_id"),
1894 primary_key=True,
1895 nullable=False,
1896 index=True,
1897 server_default=text("'0'"),
1898 )
1899 source_xref_id: Column = Column(
1900 INTEGER(10),
1901 ForeignKey("xref.xref_id"),
1902 primary_key=True,
1903 index=True,
1904 )
1905 linkage_type: Column = Column(String(3), primary_key=True)
1908class OperonTranscript(Base):
1909 __tablename__ = "operon_transcript"
1910 __table_args__ = (
1911 Index("operon_transcript_stable_id_idx", "stable_id", "version"),
1912 Index("operon_transcript_seq_region_idx", "seq_region_id", "seq_region_start"),
1913 )
1915 operon_transcript_id: Column = Column(INTEGER(10), primary_key=True)
1916 seq_region_id: Column = Column(
1917 ForeignKey("seq_region.seq_region_id"),
1918 nullable=False,
1919 )
1920 seq_region_start: Column = Column(INTEGER(10), nullable=False)
1921 seq_region_end: Column = Column(INTEGER(10), nullable=False)
1922 seq_region_strand: Column = Column(TINYINT(2), nullable=False)
1923 operon_id: Column = Column(
1924 ForeignKey("operon.operon_id"),
1925 nullable=False,
1926 index=True,
1927 )
1928 display_label: Column = Column(String(255))
1929 analysis_id: Column = Column(
1930 ForeignKey("analysis.analysis_id"),
1931 nullable=False,
1932 index=True,
1933 )
1934 stable_id: Column = Column(String(128))
1935 version: Column = Column(SMALLINT(5))
1936 created_date: Column = Column(DateTime)
1937 modified_date: Column = Column(DateTime)
1939 analysis = relationship("Analysis", primaryjoin="OperonTranscript.analysis_id == Analysis.analysis_id")
1940 operon = relationship("Operon", primaryjoin="OperonTranscript.operon_id == Operon.operon_id")
1941 seq_region = relationship(
1942 "SeqRegion",
1943 primaryjoin="OperonTranscript.seq_region_id == SeqRegion.seq_region_id",
1944 )
1947class PredictionExon(Base):
1948 __tablename__ = "prediction_exon"
1949 __table_args__ = (Index("prediction_exon_seq_region_idx", "seq_region_id", "seq_region_start"),)
1951 prediction_exon_id: Column = Column(INTEGER(10), primary_key=True)
1952 prediction_transcript_id: Column = Column(
1953 ForeignKey("prediction_transcript.prediction_transcript_id"),
1954 nullable=False,
1955 index=True,
1956 )
1957 exon_rank: Column = Column(SMALLINT(5), nullable=False)
1958 seq_region_id: Column = Column(
1959 ForeignKey("seq_region.seq_region_id"),
1960 nullable=False,
1961 )
1962 seq_region_start: Column = Column(INTEGER(10), nullable=False)
1963 seq_region_end: Column = Column(INTEGER(10), nullable=False)
1964 seq_region_strand: Column = Column(TINYINT(4), nullable=False)
1965 start_phase: Column = Column(TINYINT(4), nullable=False)
1966 score: Column = Column(Float(asdecimal=True))
1967 p_value: Column = Column(Float(asdecimal=True))
1969 prediction_transcript = relationship(
1970 "PredictionTranscript",
1971 primaryjoin=(
1972 "PredictionExon.prediction_transcript_id ==" "PredictionTranscript.prediction_transcript_id"
1973 ),
1974 )
1975 seq_region = relationship(
1976 "SeqRegion",
1977 primaryjoin="PredictionExon.seq_region_id == SeqRegion.seq_region_id",
1978 )
1981class SupportingFeature(Base):
1982 __tablename__ = "supporting_feature"
1983 __table_args__ = (
1984 Index("supporting_feature_all_idx", "exon_id", "feature_type", "feature_id", unique=True),
1985 Index("supporting_feature_idx", "feature_type", "feature_id"),
1986 )
1988 exon_id: Column = Column(
1989 INTEGER(10),
1990 ForeignKey("exon.exon_id"),
1991 primary_key=True,
1992 nullable=False,
1993 server_default=text("'0'"),
1994 )
1995 feature_type: Column = Column(Enum("dna_align_feature", "protein_align_feature"), primary_key=True)
1996 feature_id: Column = Column(INTEGER(10), primary_key=True, nullable=False, server_default=text("'0'"))
1999t_operon_transcript_gene = Table(
2000 "operon_transcript_gene",
2001 metadata,
2002 Column(
2003 "operon_transcript_id",
2004 ForeignKey("operon_transcript.operon_transcript_id"),
2005 ),
2006 Column("gene_id", ForeignKey("gene.gene_id"), index=True),
2007 Index("operon_transcript_gene_idx", "operon_transcript_id", "gene_id"),
2008)
2011@compiles(SET, "sqlite")
2012def compile_set_sqlite(
2013 type_: sqlalchemy.sql.expression.ColumnClause, # pylint: disable=unused-argument
2014 compiler: sqlalchemy.engine.interfaces.Compiled, # pylint: disable=unused-argument
2015 **kw: Any, # pylint: disable=unused-argument
2016) -> str:
2017 """Cast MySQL SET to SQLite TEXT."""
2018 return "TEXT"
2021@compiles(TINYTEXT, "sqlite")
2022def compile_tinytext_sqlite(
2023 type_: sqlalchemy.sql.expression.ColumnClause, # pylint: disable=unused-argument
2024 compiler: sqlalchemy.engine.interfaces.Compiled, # pylint: disable=unused-argument
2025 **kw: Any, # pylint: disable=unused-argument
2026) -> str:
2027 """Cast MySQL TINYTEXT to SQLite TEXT."""
2028 return "TEXT"
2031@compiles(MEDIUMTEXT, "sqlite")
2032def compile_mediumtext_sqlite(
2033 type_: sqlalchemy.sql.expression.ColumnClause, # pylint: disable=unused-argument
2034 compiler: sqlalchemy.engine.interfaces.Compiled, # pylint: disable=unused-argument
2035 **kw: Any, # pylint: disable=unused-argument
2036) -> str:
2037 """Cast MySQL MEDIUMTEXT to SQLite TEXT."""
2038 return "TEXT"
2041@compiles(LONGTEXT, "sqlite")
2042def compile_longtext_sqlite(
2043 type_: sqlalchemy.sql.expression.ColumnClause, # pylint: disable=unused-argument
2044 compiler: sqlalchemy.engine.interfaces.Compiled, # pylint: disable=unused-argument
2045 **kw: Any, # pylint: disable=unused-argument
2046) -> str:
2047 """Cast MySQL LONGTEXT to SQLite TEXT."""
2048 return "TEXT"
2051@compiles(TINYINT, "sqlite")
2052def compile_tinyint_sqlite(
2053 type_: sqlalchemy.sql.expression.ColumnClause, # pylint: disable=unused-argument
2054 compiler: sqlalchemy.engine.interfaces.Compiled, # pylint: disable=unused-argument
2055 **kw: Any, # pylint: disable=unused-argument
2056) -> str:
2057 """Cast MySQL TINYINT to SQLite INT."""
2058 return "INT"
2061@compiles(DOUBLE, "sqlite")
2062def compile_double_sqlite(
2063 type_: sqlalchemy.sql.expression.ColumnClause, # pylint: disable=unused-argument
2064 compiler: sqlalchemy.engine.interfaces.Compiled, # pylint: disable=unused-argument
2065 **kw: Any, # pylint: disable=unused-argument
2066) -> str:
2067 """Cast MySQL DOUBLE to SQLite NUMBER."""
2068 return "NUMBER"