diff --git a/.claude/rules/database.md b/.claude/rules/database.md new file mode 100644 index 000000000..74f29ab80 --- /dev/null +++ b/.claude/rules/database.md @@ -0,0 +1,14 @@ +--- +paths: + - "src/mavedb/models/**" + - "src/mavedb/lib/**" + - "src/mavedb/routers/**" + - "src/mavedb/worker/**" + - "src/mavedb/scripts/**" +--- + +# Database + +- Write new queries in SQLAlchemy 2.0 `select()` style. Older code still uses `db.query()`; don't copy it. +- ValidTime tables never return only live rows by default. Filter with `Model.current` or `Model.live_at(...)`. +- Replace ValidTime rows with `supersede_with` or `supersede_live_where`, never a separate retire-then-insert, so the handoff has no gap. diff --git a/.claude/rules/migrations.md b/.claude/rules/migrations.md new file mode 100644 index 000000000..4b0d92d99 --- /dev/null +++ b/.claude/rules/migrations.md @@ -0,0 +1,14 @@ +--- +paths: + - "alembic/**" +--- + +# Migrations + +- Generate with `poetry run alembic revision --autogenerate -m ""`, then read the result: autogenerate misses or mangles enum changes, server defaults, views and functions. +- Set `down_revision` to the current head so the chain stays linear. Check with `poetry run alembic heads` (one head). +- Never edit a revision that has run on staging or production. Write a new one, even for a fix. The one exception is the squash at a cycle boundary (`alembic/README.md`). +- One logical change per revision. The message says what changes ("add variant_count to scoresets"), not "update model". +- Every migration must replay from an empty database inside one transaction: no imports from `mavedb.*`, no network calls, ORM sessions or commits, no `CONCURRENTLY` or `autocommit_block()`, and no `ALTER TYPE ... ADD VALUE` (enums are text with a `CHECK` constraint). `bin/check-migrations` enforces this; the rules are in `alembic/README.md`. +- Production tables are large (`variants`, `mapping_records`, `mapping_record_alleles`, `alleles`, `annotation_event` run to millions of rows). A full-table `UPDATE` holds its lock for minutes. For an index on one of them, put the `CREATE INDEX CONCURRENTLY` to run by hand before the deploy in the docstring, and create the same index with `IF NOT EXISTS` in the migration. +- Data work that needs application code or external services is an operator script in `src/mavedb/scripts/`, not a migration. diff --git a/.claude/rules/permissions.md b/.claude/rules/permissions.md new file mode 100644 index 000000000..21f6b2221 --- /dev/null +++ b/.claude/rules/permissions.md @@ -0,0 +1,12 @@ +--- +paths: + - "src/mavedb/routers/**" + - "src/mavedb/lib/**" +--- + +# Permissions + +- Import from `mavedb.lib.permissions`. Check the entity a route names with `assert_permission(user, entity, Action.X)`. +- When a read fans out from that entity to related ones (score set → calibrations, allele → score sets), get a `Principal` from the `get_principal` dependency and filter with its `Viewer` for that entity type. Some entities are stricter than their parent: for instance, reading a score set doesn't grant reading its calibrations. Never assume that permission on one entity implies permission on its related entities. +- `Principal` and `Viewer` are request-scoped. Never use one as a default argument. +- Read enforcement is moving into Postgres row-level security (#808). Until it lands, these application checks are the only enforcement. diff --git a/.claude/rules/routes.md b/.claude/rules/routes.md new file mode 100644 index 000000000..5ae884830 --- /dev/null +++ b/.claude/rules/routes.md @@ -0,0 +1,15 @@ +--- +paths: + - "src/mavedb/routers/**" + - "src/mavedb/lib/authentication.py" + - "src/mavedb/lib/authorization.py" +--- + +# Routes + +FastAPI runs `def` handlers and dependencies in a thread pool and `async def` ones on the event loop, so a synchronous database call inside `async def` stalls every request on that process (#881). + +- New routes, dependencies and helpers are `def`. +- Use `async def` only for real awaits (ARQ enqueue, async HTTP), and run the synchronous database work in the thread pool. +- Start worker pipelines only through `enqueue_pipeline_for_score_set` (`lib/workflow/kickoff.py`). +- Route tests go in `tests/routers/`. diff --git a/.claude/rules/tests.md b/.claude/rules/tests.md new file mode 100644 index 000000000..6b7142281 --- /dev/null +++ b/.claude/rules/tests.md @@ -0,0 +1,14 @@ +--- +paths: + - "tests/**" +--- + +# Tests + +- Mock only at system boundaries: external services, Redis/ARQ, S3, Slack. Don't mock internal helpers, validators or transforms. +- Assert on outcomes: return values, responses, database state, and calls at system boundaries. Don't assert on internal calls, call counts or log and progress message strings; tests should survive a refactor. +- Unit tests cover edge cases and error paths with external services mocked. Integration tests cover happy paths end to end against the real test database. +- `session.refresh()` before asserting on a modified ORM object. Include negative assertions where they matter (the record that must not exist). +- Name tests `test___` when you write or modify them; don't rename untouched tests. +- Use `@pytest.mark.parametrize` with `ids` instead of near-identical copies. +- Put a fixture in the most specific `conftest.py` that needs it, and lift it to the nearest common one when it's shared. diff --git a/.claude/rules/worker.md b/.claude/rules/worker.md new file mode 100644 index 000000000..3aeebddb8 --- /dev/null +++ b/.claude/rules/worker.md @@ -0,0 +1,23 @@ +--- +paths: + - "src/mavedb/worker/**" + - "tests/worker/**" +--- + +# Worker + +Read `src/mavedb/worker/README.md` first; `best_practices.md`, `job_decorators.md`, `job_managers.md` and `pipeline_management.md` beside it cover job structure, decorators and pipelines. + +## Rules + +- Job signature: `async def job(ctx, job_id, job_manager) -> JobExecutionOutcome`. Register jobs in `worker/jobs/registry.py`. +- Job code never commits. The management decorators and `update_progress()` own commits. +- Start pipelines only through `enqueue_pipeline_for_score_set` (`lib/workflow/kickoff.py`). +- `max_jobs = 2` is deliberate: psycopg2 is synchronous and blocks the worker's event loop. + +## Testing jobs + +- Assert on `JobExecutionOutcome.status` and `.data` in every job test, plus database state for the objects the job changes. For external-service jobs, assert the boundary calls (ClinGen CAR/LDH, UniProt, gnomAD/Athena, ClinVar, S3). +- Let `update_progress()` run unpatched. It commits as a checkpoint in production, and tests should exercise that. +- Use `TransactionSpy` (`tests/helpers/transaction_spy.py`) only in manager and decorator tests, where commit and rollback are the contract. In job tests, check database state instead. +- `mock_database_flush_failure` and `mock_database_rollback_failure` are for infrastructure error-recovery paths that are hard to trigger otherwise. diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 000000000..3dac982ca --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,32 @@ +{ + "env": { + "AWS_PROFILE": "mavedb-agent-readonly" + }, + "permissions": { + "deny": ["Bash(* --no-verify*)", "Read(~/.aws/**)", "Read(~/.pgpass)", "Read(~/.ssh/**)"], + "ask": [ + "Edit(**/.claude/settings*.json)", + "Bash(git push *--force*)", + "Bash(git push * -f*)", + "Bash(git push * main*)", + "Bash(git push * mavedb-main*)", + "Bash(git push * mavedb-dev*)", + "Bash(git push * release-*)", + "Bash(git -C * push *--force*)", + "Bash(git -C * push * -f*)", + "Bash(git -C * push * main*)", + "Bash(git -C * push * mavedb-main*)", + "Bash(git -C * push * mavedb-dev*)", + "Bash(git -C * push * release-*)", + "Bash(aws *--profile*)", + "Bash(*AWS_PROFILE=*)", + "Bash(eb *)", + "Bash(*MODE=prodapi*)", + "Bash(poetry add *)", + "Bash(poetry -C * add *)", + "Bash(npm install *)", + "Bash(npm --prefix * install *)", + "Bash(*pip install *)" + ] + } +} diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 000000000..2729397ee --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,5 @@ +# Formatting-only commits, skipped by `git blame` (GitHub reads this file automatically). +# Locally: git config blame.ignoreRevsFile .git-blame-ignore-revs + +# style: apply Ruff 0.17.1 formatting +dcf4e382d2e0bea48bd6c094141727275cbf262f diff --git a/.github/instructions/api.instructions.md b/.github/instructions/api.instructions.md deleted file mode 100644 index a19e68521..000000000 --- a/.github/instructions/api.instructions.md +++ /dev/null @@ -1,165 +0,0 @@ ---- -description: 'MaveDB API patterns — routers, authentication, authorization, endpoints' -applyTo: 'src/mavedb/routers/**/*.py' ---- - -# API Patterns for MaveDB - -## Router Structure - -All routers use: -- `ROUTER_BASE_PREFIX = "/api/v1"` from `src/mavedb/routers/__init__.py` -- `LoggedRoute` as the custom `route_class` for canonical request/response logging -- Kebab-case URL paths: `/score-sets`, `/experiment-sets` - -```python -router = APIRouter( - prefix="/api/v1/score-sets", - tags=["score-sets"], - route_class=LoggedRoute, - responses=shared_responses, -) -``` - -## Authentication - -Three tiers of auth dependency injection: - -| Dependency | Returns | Use When | -|-----------|---------|----------| -| `get_current_user` | `Optional[UserData]` | Public endpoints that behave differently for authenticated users | -| `require_current_user` | `UserData` | Endpoints requiring login | -| `require_current_user_with_email` | `UserData` | Endpoints requiring verified email (write operations) | - -Auth supports two mechanisms: -- **ORCID JWT tokens** — primary auth for web users -- **API keys** — for programmatic access - -```python -@router.get("/{urn}") -def get_score_set( - urn: str, - db: Session = Depends(get_db), - user: Optional[UserData] = Depends(get_current_user), -): - ... -``` - -## Authorization - -Permission checks use the `assert_permission()` helper with an `Action` enum: - -```python -from mavedb.lib.authorization import assert_permission, Action - -assert_permission(user, item, Action.READ) # View -assert_permission(user, item, Action.UPDATE) # Modify -assert_permission(user, item, Action.DELETE) # Delete -assert_permission(user, item, Action.ADD_ROLE) # Manage contributors -``` - -Key authorization behaviors: -- **Private resources return 404** (not 403) to prevent information leakage about existence -- Permission logic dispatches by resource type (ExperimentSet, Experiment, ScoreSet, etc.) -- Admins bypass most permission checks - -## Endpoint Patterns - -### Standard CRUD -```python -@router.get("/", response_model=list[ScoreSetShortModel]) -def list_score_sets(db: Session = Depends(get_db)): ... - -@router.get("/{urn}", response_model=ScoreSetFullModel) -def get_score_set(urn: str, db: Session = Depends(get_db)): ... - -@router.post("/", response_model=ScoreSetSavedModel, status_code=201) -def create_score_set(body: ScoreSetCreateModel, db: Session = Depends(get_db)): ... - -@router.put("/{urn}", response_model=ScoreSetSavedModel) -def update_score_set(urn: str, body: ScoreSetUpdateModel, db: Session = Depends(get_db)): ... - -@router.delete("/{urn}", status_code=204) -def delete_score_set(urn: str, db: Session = Depends(get_db)): ... -``` - -### Background Job Enqueueing -For operations that trigger async processing: -```python -@router.post("/{urn}:publish") -async def publish_score_set( - urn: str, - db: Session = Depends(get_db), - user: UserData = Depends(require_current_user_with_email), - worker: ArqRedis = Depends(get_worker), -): - # ... validation and DB updates ... - await enqueue_pipeline_for_score_set( - db=db, - redis=worker, - pipeline_name="publish_score_set", - score_set=item, - user=user_data.user, - ) -``` - -### Error Responses -Shared error response definitions are used across routers: -```python -responses=shared_responses # Defines 4xx/5xx response schemas -``` - -## Worker Integration - -### Pipeline System - -Most write operations trigger a multi-step pipeline via the worker: - -```python -from mavedb.lib.workflow.kickoff import enqueue_pipeline_for_score_set - -# In a router endpoint: -pipeline, job = await enqueue_pipeline_for_score_set( - db=db, - redis=worker, - pipeline_name="validate_map_annotate_score_set", - score_set=item, - user=user_data.user, - extra_params={"scores_file_key": scores_file_key, ...}, -) -``` - -`enqueue_pipeline_for_score_set` is the single kickoff seam shared by routers and scripts. It fills `score_set_id`, `updater_id` and `correlation_id`, uses `PipelineFactory` to create a `Pipeline` with its `JobRun` and `JobDependency` records, then enqueues the pipeline's `start_pipeline` entrypoint in ARQ. A failed enqueue discards the just-created pipeline records. The worker coordinates the rest — each job runs after its dependencies complete. - -### Job Function Signature - -All job functions follow this signature (the decorator injects `job_manager`): - -```python -@with_pipeline_management -async def create_variants_for_score_set( - ctx: dict, job_id: int, job_manager: JobManager -) -> JobExecutionOutcome: - job = job_manager.get_job() - validate_job_params(["score_set_id", "correlation_id", "updater_id"], job) - # ... business logic using job_manager.db ... - return JobExecutionOutcome.succeeded(data={"variants_created": count}) -``` - -Callers pass only `ctx` and `job_id` when enqueueing. The decorator creates the `JobManager` from the `job_id`. - -### Correlation IDs - -Correlation IDs flow from the API request through the pipeline to each job: - -```python -# In the router — save request context; the kickoff seam reads the correlation ID from it -from mavedb.lib.logging.context import save_to_logging_context - -save_to_logging_context({"score_set_urn": urn}) -await enqueue_pipeline_for_score_set(db=db, redis=worker, pipeline_name="validate_map_annotate_score_set", ...) -``` - -Each job retrieves the correlation ID from its `job_params` and uses `job_manager.save_to_context()` for structured logging. - -For detailed worker conventions, see `.github/instructions/worker.instructions.md` and `src/mavedb/worker/README.md`. diff --git a/.github/instructions/copilot-instructions.md b/.github/instructions/copilot-instructions.md deleted file mode 100644 index 884e83245..000000000 --- a/.github/instructions/copilot-instructions.md +++ /dev/null @@ -1,257 +0,0 @@ ---- -description: 'Primary project guide for MaveDB API — architecture, conventions, domain patterns' -applyTo: '**' ---- - -# MaveDB API — Project Guide - -MaveDB is a bioinformatics database API for Multiplex Assays of Variant Effect (MAVE) datasets. It stores, validates, maps, and publishes functional genomics data using standardized variant representations (HGVS, GA4GH VRS). - -## Architecture - -### Service Architecture -- **FastAPI application** — `src/mavedb/server_main.py`, router-based endpoint organization -- **Background worker** — ARQ/Redis for async processing (variant creation, mapping, publication, annotation) -- **Multi-container setup** — API server, worker, PostgreSQL 15, Redis, moto (local S3), plus external services (cdot-rest, dcd-mapping, seqrepo) -- **Docker config** — `docker-compose-dev.yml` (9 services), multi-stage `Dockerfile` - -### Core Domain Model -- **Hierarchical URN system**: ExperimentSet (`urn:mavedb:00000001`) → Experiment (`00000001-a`) → ScoreSet (`00000001-a-1`) → Variant (ScoreSet URN + `#` + number) -- **Temporary URNs** during development: `tmp:` format, converted to permanent URNs on publication -- **Resource lifecycle**: Draft → Published (with background worker processing for variant creation, mapping, and annotation) -- **URN regex patterns**: `src/mavedb/lib/validation/urn_re.py` -- **URN generation**: `src/mavedb/lib/urns.py` and `temp_urns.py` - -### Key Dependencies (Dependency Injection) -```python -def get_db() -> Generator[Session, Any, None] # Database session -async def get_worker() -> AsyncGenerator[ArqRedis, Any] # Worker queue -def hgvs_data_provider() -> RESTDataProvider # HGVS validation -def get_seqrepo() -> SeqRepo # Sequence retrieval -``` - -## Project Structure - -``` -src/mavedb/ -├── server_main.py # FastAPI app setup, middleware, dependency injection -├── models/ # SQLAlchemy ORM models -├── view_models/ # Pydantic request/response models -├── routers/ # API endpoint handlers -├── worker/ # ARQ background worker system -│ ├── jobs/ # Job function implementations (by category) -│ │ ├── registry.py # Central registry of all jobs, cron definitions -│ │ ├── variant_processing/ # Variant creation, mapping, reverse translation -│ │ ├── external_services/ # ClinGen, ClinVar, gnomAD, UniProt, VEP -│ │ ├── pipeline_management/ # Pipeline entrypoint (start_pipeline) -│ │ └── system/ # Cron maintenance (cleanup stalled jobs) -│ ├── lib/ # Infrastructure layer -│ │ ├── decorators/ # @with_pipeline_management, @with_job_management -│ │ └── managers/ # JobManager, PipelineManager state management -│ └── settings/ # ARQ worker config, lifecycle hooks -├── lib/ # Shared utilities -│ ├── authentication.py # ORCID JWT + API key auth -│ ├── authorization.py # Permission checks -│ ├── exceptions.py # Domain exceptions (MixedTargetError, NonexistentOrcidError, etc.) -│ ├── logging/ # LoggedRoute, logging_context(), save_to_logging_context() -│ ├── urns.py # URN generation -│ └── validation/ # Validators, URN regex, HGVS checks, transform module -├── data_providers/ # External service clients -│ └── services.py # ClinGen, SeqRepo, CDOT integrations -└── scripts/ # Operational Click-based CLI scripts -alembic/ -├── versions/ # Migration files -└── manual_migrations/ # Complex data migration scripts -tests/ -├── conftest.py # Core fixtures (DB, auth, users) -├── helpers/ -│ └── constants.py # Test data constants -└── -``` - -## Naming Conventions - -| Element | Convention | Example | -|---------|-----------|---------| -| Variables & functions | `snake_case` | `score_set_id`, `create_variants_for_score_set` | -| Classes | `PascalCase` | `ScoreSet`, `UserData`, `ProcessingState` | -| Constants | `UPPER_SNAKE_CASE` | `MAPPING_QUEUE_NAME`, `ROUTER_BASE_PREFIX` | -| Enum values | `snake_case` | `ProcessingState.success`, `MappingState.incomplete` | -| Database tables | `snake_case` | `scoresets`, `scoreset_contributors` | -| API endpoints | kebab-case | `/score-sets`, `/experiment-sets` | -| View model aliases | camelCase (auto) | Python `score_set` → JSON `scoreSet` | - -## Living Documentation - -Documentation and instruction files (`.github/instructions/`, `.claude/`, `CLAUDE.md`, `README.md`, etc.) are living documents. When making code changes that render existing instructions or documentation obsolete, update those files as part of the same changeset. Never leave stale docs behind. - -## Commenting Guidelines - -**Core principle: explain WHY, not WHAT. Focus on bioinformatics reasoning.** - -Comment for: -- Complex bioinformatics algorithms (variant mapping, score normalization) -- Business logic rationale (why validation rules exist) -- External API constraints (rate limits, data format requirements) -- Non-obvious thresholds or configuration values - -Do not comment obvious operations, variable assignments, or code that is self-explanatory. - -## Error Handling - -- **Structured logging**: Use `logger` with `extra=logging_context()` for correlation IDs via starlette-context -- **HTTP exceptions**: FastAPI `HTTPException` with appropriate status codes -- **Domain exceptions**: `src/mavedb/lib/exceptions.py` — `MixedTargetError`, `NonexistentOrcidError`, etc. -- **Worker errors**: `send_slack_job_error()` or `send_slack_job_error()` + full logging context -- **Validation errors**: Two distinct classes exist: - - `src/mavedb/lib/validation/exceptions.py` — validation package exceptions - - `src/mavedb/lib/exceptions.py` — legacy `ValidationError` (Django-style, used in some older code) - -## External Integrations - -| Service | Purpose | Client Location | -|---------|---------|----------------| -| HGVS / SeqRepo | Genomic sequence operations, variant validation | `data_providers/services.py` | -| DCD Mapping | Variant mapping and VRS transformation | `data_providers/services.py` | -| CDOT | Transcript/genomic coordinate conversion | REST service in Docker | -| GA4GH VRS | Variant representation standardization | Via DCD Mapping | -| ClinGen Allele Registry | Allele registration and lookup | `data_providers/services.py` | -| ClinGen Linked Data Hub | Functional annotation submission | `data_providers/services.py` | - -## Development Commands - -```bash -# Docker development environment -docker-compose -f docker-compose-dev.yml up --build -d - -# Direct execution (requires env vars) -export PYTHONPATH="${PYTHONPATH}:`pwd`/src" -uvicorn mavedb.server_main:app --reload - -# Run tests -poetry run pytest tests/ - -# Database migrations -alembic upgrade head -alembic revision --autogenerate -m "Description" - -# Operational scripts (Click CLI, dry-run by default) -poetry run python -m mavedb.scripts. -``` - -## Key Reference Files - -- [score_set.py](src/mavedb/models/score_set.py) — Primary data model patterns -- [score_sets.py](src/mavedb/routers/score_sets.py) — Complex router with worker integration -- [registry.py](src/mavedb/worker/jobs/registry.py) — Background job registration -- [score_set.py](src/mavedb/view_models/score_set.py) — Pydantic model hierarchy -- [server_main.py](src/mavedb/server_main.py) — App setup and dependency injection -- [authentication.py](src/mavedb/lib/authentication.py) — Auth patterns -- [conftest.py](tests/conftest.py) — Test fixtures and database setup - -### Naming Conventions -- **Variables & functions**: `snake_case` (e.g., `score_set_id`, `create_variants_for_score_set`) -- **Classes**: `PascalCase` (e.g., `ScoreSet`, `UserData`, `ProcessingState`) -- **Constants**: `UPPER_SNAKE_CASE` (e.g., `MAPPING_QUEUE_NAME`, `DEFAULT_LDH_SUBMISSION_BATCH_SIZE`) -- **Enum values**: `snake_case` (e.g., `ProcessingState.success`, `MappingState.incomplete`) -- **Database tables**: `snake_case` with descriptive association table names (e.g., `scoreset_contributors`, `experiment_set_doi_identifiers`) -- **API endpoints**: kebab-case paths (e.g., `/score-sets`, `/experiment-sets`) - -### Documentation Conventions -*For general Python documentation standards, see `.github/instructions/python.instructions.md`. The following are MaveDB-specific additions:* - -- **Algorithm explanations**: Include comments explaining complex logic, especially URN generation and bioinformatics operations -- **Design decisions**: Comment on why certain architectural choices were made -- **External dependencies**: Explain purpose of external bioinformatics libraries (HGVS, SeqRepo, etc.) -- **Bioinformatics context**: Document biological reasoning behind genomic data processing patterns - -### Commenting Guidelines -**Core Principle: Write self-explanatory code. Comment only to explain WHY, not WHAT.** - -**✅ WRITE Comments For:** -- **Complex bioinformatics algorithms**: Variant mapping algorithms, external service interactions -- **Business logic**: Why specific validation rules exist, regulatory requirements -- **External API constraints**: Rate limits, data format requirements -- **Non-obvious calculations**: Score normalization, statistical methods -- **Configuration values**: Why specific timeouts, batch sizes, or thresholds were chosen - -**❌ AVOID Comments For:** -- **Obvious operations**: Variable assignments, simple loops, basic conditionals -- **Redundant descriptions**: Comments that repeat what the code clearly shows -- **Outdated information**: Comments that don't match current implementation - -### Error Handling Conventions -- **Structured logging**: Always use `logger` with `extra=logging_context()` for correlation IDs -- **HTTP exceptions**: Use FastAPI `HTTPException` with appropriate status codes and descriptive messages -- **Custom exceptions**: Define domain-specific exceptions in `src/mavedb/lib/exceptions.py` -- **Worker job errors**: Send Slack notifications via `send_slack_job_error()` or `send_slack_job_failure()` and log with full context -- **Validation errors**: Use Pydantic validators and raise `ValueError` with clear messages - -### Code Style and Organization Conventions -*For general Python style conventions, see `.github/instructions/python.instructions.md`. The following are MaveDB-specific patterns:* - -- **Async patterns**: Use `async def` for I/O operations, regular functions for CPU-bound work -- **Database operations**: Use SQLAlchemy 2.0 style with `session.scalars(select(...)).one()` -- **Pydantic models**: Separate request/response models with clear inheritance hierarchies -- **Bioinformatics data flow**: Structure code to clearly show genomic data transformations - -### Testing Conventions -*For testing philosophy, mocking boundaries, and conventions see `.github/instructions/testing.instructions.md`. For general Python testing standards, see `.github/instructions/python.instructions.md`. The following are MaveDB-specific patterns:* - -- **Test function naming**: Use descriptive names that reflect bioinformatics operations (e.g., `test_cannot_publish_score_set_without_variants`) -- **Fixtures**: Use `conftest.py` for shared fixtures, especially database and worker setup -- **Mocking**: Mock only at system boundaries (external services, Redis/ARQ, Slack). Do not mock internal helpers or `update_progress` -- **Constants**: Define test data including genomic sequences and variants in `tests/helpers/constants.py` -- **Integration testing**: Test full bioinformatics workflows including external service interactions - -## Codebase Conventions - -### URN Validation -- Use regex patterns from `src/mavedb/lib/validation/urn_re.py` -- Validate URNs in Pydantic models with `@field_validator` -- URN generation logic in `src/mavedb/lib/urns.py` and `temp_urns.py` - -### Worker Jobs (ARQ/Redis) -- **Two-layer architecture**: Infrastructure (decorators + managers) handles lifecycle/state; business layer (jobs/) implements domain logic -- **Job registry**: All jobs registered in `src/mavedb/worker/jobs/registry.py` — `BACKGROUND_FUNCTIONS`, `BACKGROUND_CRONJOBS`, `STANDALONE_JOB_DEFINITIONS` -- **Job function signature**: `async def job_name(ctx: dict, job_id: int, job_manager: JobManager) -> JobExecutionOutcome` — `job_manager` is injected by the decorator, not passed by callers -- **Decorators**: `@with_pipeline_management` (most jobs), `@with_job_management` (standalone), `@with_guaranteed_job_run_record` (cron/auto-created JobRun) -- **Pipeline system**: `PipelineFactory.create_pipeline()` creates Pipeline + JobRun + JobDependency records from definitions in `src/mavedb/lib/workflow/definitions.py` -- **Session management**: Task-local DB sessions via `ContextVar` prevent concurrent ARQ jobs from sharing sessions -- **Commit discipline**: Decorators commit lifecycle state changes; `update_progress()` commits as a checkpoint; job code should NOT commit -- **Key job types**: - - `create_variants_for_score_set` - Parse uploaded CSV, create variant records - - `map_variants_for_score_set` - Map variants via DCD Mapping / VRS - - `reverse_translate_variants_for_score_set` - Derive equivalent nucleotide/protein alleles and projection groups via variant-annotation - - `submit_score_set_mappings_to_car/ldh` - Submit to ClinGen services - - `cleanup_stalled_jobs` - Cron job for recovering stuck jobs -- **Enqueueing pipelines**: Routers and scripts call `enqueue_pipeline_for_score_set()` (`src/mavedb/lib/workflow/kickoff.py`), which creates the pipeline via `PipelineFactory.create_pipeline()` and enqueues its `start_pipeline` entrypoint JobRun -- **Detailed documentation**: See `src/mavedb/worker/README.md` and `.github/instructions/worker.instructions.md` - -### View Models (Pydantic) -- **Base model** (`src/mavedb/view_models/base/base.py`) converts empty strings to None and uses camelCase aliases -- **Inheritance patterns**: `Base` → `Create` → `Modify` → `Saved` model hierarchy -- **Field validation**: Use `@field_validator` for single fields, `@model_validator(mode="after")` for cross-field validation -- **URN validation**: Validate URNs with regex patterns from `urn_re.py` in field validators -- **Transform functions**: Use functions in `validation/transform.py` for complex data transformations -- **Separate models**: Request (`Create`, `Modify`) vs response (`Saved`) models with different field requirements - -### External Integrations -- **HGVS/SeqRepo** for genomic sequence operations -- **DCD Mapping** for variant mapping and VRS transformation -- **CDOT** for transcript/genomic coordinate conversion -- **GA4GH VRS** for variant representation standardization -- **ClinGen services** for allele registry and linked data hub submissions - -## Key Files to Reference -- `src/mavedb/models/score_set.py` - Primary data model patterns -- `src/mavedb/routers/score_sets.py` - Complex router with worker integration -- `src/mavedb/worker/jobs/registry.py` - Job registration and available functions -- `src/mavedb/worker/jobs/variant_processing/creation.py` - Reference pipeline job implementation -- `src/mavedb/lib/workflow/definitions.py` - Pipeline and job definitions -- `src/mavedb/view_models/score_set.py` - Pydantic model hierarchy examples -- `src/mavedb/server_main.py` - Application setup and dependency injection -- `src/mavedb/data_providers/services.py` - External service integration patterns -- `src/mavedb/lib/authentication.py` - Authentication and authorization patterns -- `tests/conftest.py` - Test fixtures and database setup -- `docker-compose-dev.yml` - Service architecture and dependencies diff --git a/.github/instructions/database.instructions.md b/.github/instructions/database.instructions.md deleted file mode 100644 index 947fc36cc..000000000 --- a/.github/instructions/database.instructions.md +++ /dev/null @@ -1,133 +0,0 @@ ---- -description: 'MaveDB database patterns — SQLAlchemy models, migrations, query conventions' -applyTo: 'src/mavedb/models/**/*.py,alembic/**/*.py' ---- - -# Database Patterns for MaveDB - -## Model Structure - -### Base Class -All models subclass the `@as_declarative()` `Base` in `src/mavedb/db/base.py`. It declares no columns; it only defaults `__tablename__` to the lowercased class name. Table models declare their own `id` primary key and set `__tablename__` explicitly; view models map `__table__` to a view instead. - -### Common Columns -Most resource models include: -- `creation_date` / `modification_date`: `Date` columns defaulting to today (`modification_date` updates on write) -- `created_by_id` / `modified_by_id`: Foreign keys to the users table (user-owned resources: experiment sets, experiments, score sets, calibrations, calibration controls, collections) -- `urn`: Unique string identifier (temporary `tmp:` or permanent `urn:mavedb:...`) -- `private`: Boolean flag for visibility control -- `approved`: Boolean for moderation status -- `published_date`: Nullable datetime, set on publication -- `extra_metadata`: JSONB column for extensible metadata - -### Relationship Patterns - -**One-to-many** (parent → children): -```python -class Experiment(Base): - experiment_set_id = Column(Integer, ForeignKey("experiment_sets.id"), nullable=False) - experiment_set = relationship("ExperimentSet", back_populates="experiments") -``` - -**Many-to-many with association tables** (simple join): -```python -# Table object for simple joins (no extra columns) -scoreset_contributors = Table( - "scoreset_contributors", - Base.metadata, - Column("scoreset_id", ForeignKey("scoresets.id")), - Column("contributor_id", ForeignKey("contributors.id")), -) -``` - -**Many-to-many with Association Object** (extra columns needed): -```python -# Class-based for additional attributes on the relationship -class ScoreSetPublicationIdentifierAssociation(Base): - scoreset_id = Column(ForeignKey("scoresets.id"), primary_key=True) - publication_identifier_id = Column(ForeignKey("publication_identifiers.id"), primary_key=True) - primary = Column(Boolean, default=False) -``` - -### Valid-Time Versioning (`ValidTime`) -Rows that change over time mix in `ValidTime` (`src/mavedb/db/mixins.py`) instead of being updated or deleted in place: -- `valid_from` / `valid_to`: a row is live while `valid_to` is NULL; history is the half-open window `[valid_from, valid_to)`. -- Reads: filter explicitly with `Model.current` or `Model.live_at(as_of)` (`None` means current; also works on `aliased()` classes). Never assume a query returns only live rows. -- Replacing a row: `supersede_with` (one row) or `supersede_live_where` (bulk) retire the old rows and stamp the new rows' `valid_from` with the same timestamp, so the handoff has no gap. Never retire and then insert separately. -- Withdrawing with no successor: `retire` (one row) or `retire_live_where` (bulk UPDATE). -- `__retire_cascade__`: relationship names whose live `ValidTime` children are retired when the parent is (one level deep). `supersede_live_where` raises on a class that declares it; use `supersede_with` per row. -- Each table adds a partial unique index over its natural key `WHERE valid_to IS NULL`, so a second live row raises `IntegrityError`. -- Content-addressed, immutable rows (e.g. alleles) do not use the mixin. - -### Enum Columns -Use non-native enums stored as strings: -```python -processing_state = Column( - Enum(ProcessingState, native_enum=False, create_constraint=True, length=32), - nullable=True, -) -``` - -### JSONB Columns -Use `JSONB` for flexible structured data: -```python -mapped_scores = Column(JSONB, nullable=True) # Post-mapping variant scores -extra_metadata = Column(JSONB, nullable=True) # User-defined metadata -``` - -### Column Aliasing -When Python attribute names differ from DB column names: -```python -num_variants = Column("variant_count", Integer, nullable=False, default=0) -``` - -## Migrations (Alembic) - -### Standard Migrations -```bash -alembic revision --autogenerate -m "add column to scoresets" -alembic upgrade head -``` - -### Manual Migrations -For complex data transformations that can't be auto-generated: -- Place scripts in `alembic/manual_migrations/` -- Import and call from the version file's `upgrade()` function -- Always include a `downgrade()` path - -### Migration Conventions -- One logical change per migration -- Use descriptive messages: `"add variant_count to scoresets"` not `"update model"` -- Test migrations against a populated database when possible -- For enum changes: use `native_enum=False` to avoid PostgreSQL enum type ALTER issues - -## Query Patterns - -### Fetching -```python -# Single item (raises if not found) -item = db.scalars(select(ScoreSet).where(ScoreSet.urn == urn)).one() - -# Single item (returns None if not found) -item = db.scalars(select(ScoreSet).where(ScoreSet.urn == urn)).one_or_none() - -# List with filters -items = db.scalars( - select(ScoreSet) - .where(ScoreSet.private.is_(False)) - .order_by(ScoreSet.urn) -).all() -``` - -### Visibility Filtering -Private resources return 404 (not 403) to avoid information leakage: -```python -item = db.scalars(select(ScoreSet).where(ScoreSet.urn == urn)).one_or_none() -if item is None: - raise HTTPException(status_code=404) -if item.private and not user_has_access(user, item): - raise HTTPException(status_code=404) # 404, not 403 -``` - -## Materialized Views -Used for pre-computed aggregations. Refresh via worker cron jobs defined in `src/mavedb/worker/jobs/registry.py`. diff --git a/.github/instructions/python.instructions.md b/.github/instructions/python.instructions.md deleted file mode 100644 index 53c526354..000000000 --- a/.github/instructions/python.instructions.md +++ /dev/null @@ -1,112 +0,0 @@ ---- -description: 'MaveDB Python coding conventions — SQLAlchemy, Pydantic, FastAPI patterns' -applyTo: '**/*.py' ---- - -# Python Conventions for MaveDB - -## Style - -- Follow PEP 8 with 4-space indentation -- Use type hints on all function signatures -- Use `from __future__ import annotations` where needed for forward references -- Prefer `list[str]` over `List[str]` (Python 3.10+ style) in new code, but match surrounding code style - -## SQLAlchemy 2.0 Patterns - -Use 2.0-style query syntax throughout: - -```python -# Correct — 2.0 style -item = db.scalars(select(ScoreSet).where(ScoreSet.urn == urn)).one() -items = db.scalars(select(ScoreSet).where(ScoreSet.private.is_(False))).all() - -# Avoid — legacy 1.x style -item = db.query(ScoreSet).filter_by(urn=urn).one() -``` - -Use `session.add()` / `session.flush()` / `session.commit()` appropriately: -- Routers: `db.add()` then `db.commit()` for write operations -- Worker jobs: manage sessions via `setup_db_session()` or `SessionLocal()` - -## Pydantic v2 Patterns - -### Base Model -All view models inherit from a custom `BaseModel` (`src/mavedb/view_models/base/base.py`) that: -- Converts empty strings to `None` via `@model_validator(mode="before")` -- Uses `alias_generator = humps.camelize` for camelCase JSON serialization -- Sets `populate_by_name = True` to accept both Python and camelCase names - -### Model Hierarchy -Follow the established inheritance pattern: -``` -Base (shared fields) -├── Create (POST request body) -├── Update (PUT/PATCH request body) -└── Saved (GET response) - ├── Short (list endpoints, minimal fields) - ├── Full (detail endpoints, all fields) - ├── Admin (admin-only fields) - └── PublicDump (data export) -``` - -### record_type Pattern -Every saved view model must include a `record_type` literal for frontend type discrimination: -```python -class ScoreSetSavedModel(BaseModel): - record_type: Literal["score_set"] = "score_set" -``` - -### Validators -- `@field_validator("field_name", mode="before")` — single field transformations -- `@model_validator(mode="before")` — pre-parse transformations (e.g. ORM → dict conversions) -- `@model_validator(mode="after")` — cross-field validation - -### Synthetic Fields (ORM → View Model) -When SQLAlchemy model attributes don't map 1:1 to view model fields, use `@model_validator(mode="before")`: -```python -@model_validator(mode="before") -@classmethod -def set_computed_field(cls, data): - if hasattr(data, "some_relationship"): - data.__setattr__("computed_count", len(data.some_relationship)) - return data -``` - -### all_fields_optional_model Decorator -Used to create PATCH-style update models from existing models: -```python -@all_fields_optional_model -class ScoreSetUpdateModel(ScoreSetCreateModel): - ... -``` - -## Enum Conventions - -- Enum values use `snake_case`: `ProcessingState.success`, `MappingState.incomplete` -- Database enums use `native_enum=False` with `String` column type -- Define in `src/mavedb/lib/` or alongside the model that uses them - -## Async Patterns - -- Router endpoints: `async def` when they await worker/external calls, regular `def` for synchronous DB operations -- Worker jobs: `async def` (ARQ requirement) -- Database operations are synchronous (SQLAlchemy sync sessions) - -## Logging - -Use structured logging with starlette-context correlation IDs: -```python -import logging -from mavedb.lib.logging.context import logging_context, save_to_logging_context - -logger = logging.getLogger(__name__) -logger.info("Processing score set", extra=logging_context()) -``` - -## Scripts - -Operational scripts use Click with a `@with_database_session` decorator: -- Always default to `dry_run=True` -- Located in `src/mavedb/scripts/` -- Run via `poetry run python -m mavedb.scripts.` diff --git a/.github/instructions/testing.instructions.md b/.github/instructions/testing.instructions.md deleted file mode 100644 index 4fd1b1ce6..000000000 --- a/.github/instructions/testing.instructions.md +++ /dev/null @@ -1,88 +0,0 @@ ---- -description: 'Testing philosophy and conventions for the MaveDB API' -applyTo: 'tests/**/*.py' ---- - -# Testing Conventions - -## Outcome-Based Testing - -Test what code does (return values, DB state, external boundary calls), not how it does it (internal method calls, message strings, call sequences). Tests should survive internal refactoring without changes. - -**Assert on:** -- Return values and response objects -- DB state changes (query for created/updated/deleted records) -- External boundary calls (see Mocking Boundaries below) - -**Do not assert on:** -- Internal function invocations (e.g., that a helper was called with specific args) -- Call counts or call sequences on internal methods -- Log or progress message strings - -## Mocking Boundaries - -Only mock at system boundaries — the edges where your code talks to something external: -- External services (APIs, third-party clients) -- Infrastructure (Redis/ARQ, Slack, email) -- Network I/O (`run_in_executor`, HTTP clients) -- File I/O (S3, local filesystem in tests) - -Do NOT mock internal helpers, validators, or data transforms. Test through them. - -## Unit vs Integration Test Responsibilities - -**Unit tests:** Edge cases, error paths, invalid inputs, boundary conditions. Use mocked external services. - -**Integration tests:** Happy paths, end-to-end workflows, DB state verification. Use real DB with test fixtures. - -## Assertion Best Practices - -- Use `session.refresh()` before asserting on modified ORM objects -- Add custom assertion messages to complex assertions where the failure message wouldn't immediately clarify what went wrong -- Include negative assertions where appropriate (verify unwanted records don't exist) -- Don't add messages to trivially clear assertions like `assert len(variants) == 0` - -## Test Naming - -Use the pattern: `test___` - -Examples: -- `test_submit_to_car_when_disabled_skips_submission` -- `test_create_score_set_returns_422_when_missing_target` - -Apply to tests being modified; don't rename all tests at once. - -## Parametrization - -Use `@pytest.mark.parametrize` with descriptive `ids` when the same logic is tested across multiple states. Prefer parametrization over copy-pasting near-identical tests. - -## Fixtures - -- Keep fixtures minimal and composable -- Define fixtures in the most specific `conftest.py` where they're needed -- Don't duplicate fixtures across test classes — lift shared ones to the nearest common conftest -- Use factory fixtures when tests need variants of the same object - ---- - -# Worker-Specific Conventions - -The following conventions apply specifically to `tests/worker/`. - -## Job Test Assertions - -- Assert on `JobExecutionOutcome.status` and `.data` for every job test -- Assert on DB state changes for the domain objects the job modifies -- For external service jobs: assert boundary calls (ClinGen CAR/LDH, UniProt, gnomAD/Athena, S3, ClinVar) - -## Let `update_progress` Run Unpatched - -`update_progress()` calls `session.commit()` as a checkpoint. This is production behavior and should execute in tests. Letting it run means tests verify that checkpoint commits don't break state or interfere with final outcomes. Don't patch it, don't mock it, don't assert on its messages. - -## TransactionSpy Usage - -**USE in manager/decorator tests** (e.g., `test_job_manager.py`, `test_pipeline_manager.py`): The commit/rollback boundary IS the contract here. If someone removes a commit, data silently won't persist in production. DB state checks alone can't catch this because the test session may auto-commit on teardown. - -**USE `mock_database_flush_failure` / `mock_database_rollback_failure`**: These simulate DB errors that are genuinely hard to reproduce otherwise. Valuable for testing error recovery paths in infrastructure code. - -**DO NOT USE in job-level tests** (e.g., `test_clingen.py`, `test_cleanup.py`, `test_creation.py`): The job's contract is "variants were created" or "stalled jobs were retried," not "session.commit() was called." Use DB state queries instead. diff --git a/.github/instructions/worker.instructions.md b/.github/instructions/worker.instructions.md deleted file mode 100644 index 8d654c2d5..000000000 --- a/.github/instructions/worker.instructions.md +++ /dev/null @@ -1,192 +0,0 @@ ---- -description: 'MaveDB worker patterns — jobs, decorators, managers, pipelines' -applyTo: 'src/mavedb/worker/**/*.py' ---- - -# Worker Conventions for MaveDB - -*For comprehensive documentation with walkthroughs and examples, see `src/mavedb/worker/README.md` and linked docs.* - -## Architecture - -The worker is a two-layer system: - -- **Infrastructure layer** (`lib/decorators/`, `lib/managers/`): Handles job lifecycle, state persistence, error recovery, pipeline coordination. Developers rarely modify this. -- **Business layer** (`jobs/`): Implements domain logic (variant creation, mapping, external service calls). This is where most new code goes. - -Decorators bridge the two layers. Job functions focus purely on business logic and return a `JobExecutionOutcome`. Decorators handle lifecycle state, commits, error recovery, and pipeline coordination automatically. - -## Job Function Contract - -Every job function follows this signature: - -```python -@with_pipeline_management -async def my_job(ctx: dict, job_id: int, job_manager: JobManager) -> JobExecutionOutcome: -``` - -- `ctx`: ARQ context dict containing `db`, `redis`, `hdp` (HGVS data provider), `pool`, `state` -- `job_id`: `JobRun.id` from the database (passed by the caller / ARQ) -- `job_manager`: Injected by the decorator — **NOT passed by the caller** -- Return: Always a `JobExecutionOutcome` via its factory methods - -**Callers enqueue jobs with only the job function name and `job_id`.** The decorator injects `job_manager` as a keyword argument before the function executes. - -## Decorator Rules - -| Decorator | Use For | Stacking | -|-----------|---------|----------| -| `@with_pipeline_management` | Jobs that belong (or may belong) to a pipeline | Use alone — it wraps `@with_job_management` internally | -| `@with_job_management` | Standalone jobs without pipeline coordination | Use alone or under `@with_guaranteed_job_run_record` | -| `@with_guaranteed_job_run_record(type)` | Cron/standalone jobs that need a `JobRun` record auto-created | Must be outermost; stack with `@with_job_management` only | - -**Most jobs use `@with_pipeline_management`** because it works for both pipeline and non-pipeline jobs. If the job has no pipeline association, the decorator simply skips coordination. - -`@with_guaranteed_job_run_record` is **NOT compatible** with `@with_pipeline_management`. It is only for standalone/cron jobs. - -### Decorator internals - -- All decorators become no-ops when `MAVEDB_TEST_MODE=1` (checked via `is_test_mode()`). This allows tests to call job functions directly with a pre-built `JobManager`. -- `ensure_session_ctx()` creates a task-local DB session via `ContextVar`, preventing concurrent ARQ jobs from sharing or closing each other's sessions. -- `with_pipeline_management` wraps `with_job_management` internally by calling `with_job_management(func)` inside `_execute_managed_pipeline`. Do not stack them manually. - -## JobManager API (What Job Code Uses) - -From within a job function, use `job_manager` for: - -```python -# Access the job's DB record and parameters -job = job_manager.get_job() # Returns JobRun ORM object -params = job.job_params # Dict of job parameters (JSONB) - -# Access the database session -score_set = job_manager.db.scalars(select(ScoreSet).where(...)).one() - -# Progress tracking (each call commits as a checkpoint by default) -job_manager.update_progress(current, total, message) -job_manager.update_progress(50, 100, "Halfway done", commit=False) # Skip checkpoint - -# Logging context -job_manager.save_to_context({"score_set_id": 123, "correlation_id": "abc"}) -logger.info("Processing", extra=job_manager.logging_context()) -``` - -**Do not call** `start_job()`, `succeed_job()`, `fail_job()`, `error_job()`, or `complete_job()` from job code. The decorator handles these based on the `JobExecutionOutcome` you return. - -## Session & Commit Discipline - -- **Decorators handle commits** for job lifecycle state transitions (start, complete, fail, retry) -- **`update_progress()` commits by default** as a checkpoint — this commits ALL pending session changes, so call it only at safe transaction boundaries. Pass `commit=False` to skip. -- **Job code should NOT call `db.commit()`** — use `db.flush()` if you need generated IDs before the decorator commits -- **PipelineManager commits before its async Redis enqueue loop** to release PostgreSQL row locks and prevent deadlocks (psycopg2 is synchronous, so a blocked UPDATE would freeze asyncio) - -## Return Values (JobExecutionOutcome) - -Always return using factory methods: - -```python -return JobExecutionOutcome.succeeded(data={"variants_created": count}) -return JobExecutionOutcome.failed(reason="No mapping records found", data={...}) -return JobExecutionOutcome.failed(reason="HGVS parse error", failure_category=FailureCategory.DATA_ERROR) -return JobExecutionOutcome.skipped(data={"reason": "Feature disabled"}) -# For unhandled exceptions: let them propagate — the decorator catches and creates .errored() -``` - -The optional `failure_category` parameter on `.failed()` and `.errored()` controls retry eligibility. Categories in `RETRYABLE_FAILURE_CATEGORIES` (e.g., `NETWORK_ERROR`, `TIMEOUT`, `SERVICE_UNAVAILABLE`) enable automatic retries. When a job doesn't set an explicit category, the decorator classifies unhandled exceptions via `classify_exception()` (e.g., `ConnectionError` → `NETWORK_ERROR`). Unclassifiable exceptions default to `UNKNOWN` (not retryable). - -**Do not return `.errored()` from job code.** Let unhandled exceptions propagate; the decorator catches them, classifies the failure, marks the job as ERRORED, sends Slack alerts, and handles retry logic. - -## Parameter Access Pattern - -Job parameters live in `JobRun.job_params` (JSONB column), not in function arguments: - -```python -job = job_manager.get_job() - -_job_required_params = ["score_set_id", "correlation_id", "updater_id"] -validate_job_params(_job_required_params, job) - -score_set_id = job.job_params["score_set_id"] -correlation_id = job.job_params["correlation_id"] -``` - -Always call `validate_job_params()` (from `worker.jobs.utils.setup`) before accessing params. - -Parameters with `None` values in pipeline definitions are filled at runtime from `pipeline_params` passed by the router/script when creating the pipeline. - -## Error Handling - -- **Business failures** (validation errors, missing data): Return `JobExecutionOutcome.failed(reason=..., failure_category=...)` with an explicit `FailureCategory` for retry control. -- **Unhandled exceptions**: Let them propagate. The decorator catches them, classifies the exception via `classify_exception()`, marks the job as ERRORED, sends a Slack alert, and evaluates retry eligibility. -- **External service disabled/unavailable**: Return `JobExecutionOutcome.skipped()` if a config check shows the service is disabled. Let connection errors propagate for retry handling. -- **Retry eligibility**: Determined by `should_retry()` which checks `retry_count < max_retries` and `failure_category in RETRYABLE_FAILURE_CATEGORIES`. -- **Failure classification**: `classify_exception()` in `utils.py` maps infrastructure exceptions to categories (`ConnectionError` → `NETWORK_ERROR`, `TimeoutError` → `TIMEOUT`, `OSError` → `NETWORK_ERROR`). Unmapped exceptions default to `UNKNOWN`. Job-level explicit `failure_category` on the outcome takes priority over automatic classification. -- **Slack safety**: `send_slack_job_failure()` and `send_slack_job_error()` catch their own exceptions internally (logging critical on failure), so Slack outages never interfere with job lifecycle management or error recovery in the decorators. -- **Stale RUNNING recovery**: `start_job()` accepts RUNNING as a startable status (alongside QUEUED and PENDING). When ARQ re-delivers a job after a worker crash, `start_job()` logs a warning and resets the start timestamp rather than raising `JobTransitionError`. -- **Concurrency limit**: `max_jobs = 2` in `ArqWorkerSettings` prevents event loop starvation from sync psycopg2 DB calls. With the default `max_jobs=10`, multiple concurrent jobs issuing blocking DB operations can starve the asyncio event loop. -- **Fast lane**: `start_pipeline` and `create_variants_for_score_set` run on a separate queue (`FAST_LANE_QUEUE_NAME`) consumed by a second worker process (`ArqFastLaneWorkerSettings`), so long mapping jobs can't block new pipelines. Every `enqueue_job` and every `arq.jobs.Job(...)` status/abort call must pass `_queue_name=arq_queue_name(job_run)`. - -## Pipeline Lifecycle (Brief) - -1. Router or script calls `enqueue_pipeline_for_score_set()` (`lib/workflow/kickoff.py`) → `PipelineFactory.create_pipeline()` creates `Pipeline`, `JobRun`, and `JobDependency` records -2. The same call enqueues the `start_pipeline` entrypoint job in ARQ -3. `start_pipeline` runs → its `@with_pipeline_management` decorator starts the pipeline and calls `coordinate_pipeline()` -4. `coordinate_pipeline()` finds PENDING jobs whose dependencies are met → marks them QUEUED → enqueues in ARQ -5. Each job runs → after completion, its decorator calls `coordinate_pipeline()` again -6. Cycle repeats until all jobs complete or the pipeline fails/is cancelled - -Pipeline definitions live in `src/mavedb/lib/workflow/definitions.py`. The `PipelineFactory` (in `src/mavedb/lib/workflow/pipeline_factory.py`) reads these definitions and creates the DB records. - -*For full details, see `src/mavedb/worker/pipeline_management.md`.* - -## Adding a New Pipeline Job - -1. Create the job function in `src/mavedb/worker/jobs//.py` -2. Decorate with `@with_pipeline_management` -3. Follow the signature: `async def job_name(ctx, job_id, job_manager) -> JobExecutionOutcome` -4. Export from the category's `__init__.py` -5. Register in `src/mavedb/worker/jobs/registry.py` → add to `BACKGROUND_FUNCTIONS` -6. Add a `JobDefinition` entry to the relevant pipeline in `src/mavedb/lib/workflow/definitions.py` - -## Adding a Standalone/Cron Job - -1. Create the job function in `src/mavedb/worker/jobs//.py` -2. Stack `@with_guaranteed_job_run_record("job_type")` (outer) + `@with_job_management` (inner) -3. Export from the category's `__init__.py` -4. Register in `src/mavedb/worker/jobs/registry.py` → add to `BACKGROUND_FUNCTIONS` -5. For cron: also add to `BACKGROUND_CRONJOBS` with schedule -6. Optionally add to `STANDALONE_JOB_DEFINITIONS` if the job needs to be invoked via operational scripts - -## Testing - -- Decorators are no-ops in test mode (`MAVEDB_TEST_MODE=1`). Tests call job functions directly, passing a real `JobManager` instance. -- Assert on `JobExecutionOutcome.status` and `.data` for every job test. -- Assert on DB state changes (query for created/updated/deleted records). -- Let `update_progress()` run unpatched — its commit behavior is production behavior that should be tested. -- Mock only at system boundaries (external APIs, S3, Slack). Do not mock internal helpers. -- Use `TransactionSpy` in manager/decorator tests only, not in job-level tests. - -*For full testing conventions, see `.github/instructions/testing.instructions.md`.* - -## Key Reference Files - -| File | Purpose | -|------|---------| -| `jobs/registry.py` | All registered job functions, cron definitions, standalone definitions | -| `jobs/variant_processing/creation.py` | Reference pipeline job implementation | -| `jobs/system/cleanup.py` | Reference standalone cron job implementation | -| `lib/decorators/pipeline_management.py` | Pipeline decorator (coordinates after job completion) | -| `lib/decorators/job_management.py` | Job lifecycle decorator (start/complete/error handling) | -| `lib/decorators/utils.py` | Session management (`ensure_session_ctx`), test mode (`is_test_mode`) | -| `lib/managers/job_manager.py` | Job state management (used by decorators and job code) | -| `lib/managers/pipeline_manager.py` | Pipeline coordination, dependency resolution, job enqueueing | -| `lib/managers/constants.py` | Status groupings (`TERMINAL_JOB_STATUSES`, `STARTABLE_JOB_STATUSES`, etc.) | -| `lib/managers/exceptions.py` | Exception hierarchy (`JobStateError`, `PipelineCoordinationError`, etc.) | -| `settings/worker.py` | `ArqWorkerSettings` (main) and `ArqFastLaneWorkerSettings` classes (ARQ worker configuration) | -| `settings/lifecycle.py` | Worker startup/shutdown hooks, `standalone_ctx()` | -| `src/mavedb/lib/workflow/definitions.py` | Pipeline and job definitions (`PIPELINE_DEFINITIONS`) | -| `src/mavedb/lib/workflow/pipeline_factory.py` | Creates Pipeline + JobRun + JobDependency records | -| `src/mavedb/lib/types/workflow.py` | `JobExecutionOutcome`, `JobDefinition`, `PipelineDefinition` types | -| `src/mavedb/models/job_run.py` | `JobRun` ORM model | -| `src/mavedb/models/pipeline.py` | `Pipeline` ORM model | -| `src/mavedb/models/enums/job_pipeline.py` | `JobStatus`, `PipelineStatus`, `DependencyType`, `FailureCategory` enums | diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..604b0b681 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,22 @@ +## Summary + + + +Closes # + + + +## Tests + + + +## Checklist + +- [ ] Targets the open patch branch if this is a small, non-breaking change, or the cycle's `release-..0` + branch otherwise; never `main` +- [ ] API schema change? A matching `mavedb-ui` PR regenerates `src/schema/openapi.d.ts` +- [ ] Docs and instruction files touched by this change are updated diff --git a/.github/scripts/issue-status.js b/.github/scripts/issue-status.js new file mode 100644 index 000000000..ec24876df --- /dev/null +++ b/.github/scripts/issue-status.js @@ -0,0 +1,282 @@ +/** + * Moves issues across the MaveDB Backlog project as the pull requests linked to them progress. + * + * - A PR is opened, pushed to or marked ready: its linked issues go to In review (In progress while it's a draft). + * - A PR merges into a release branch: its linked issues go to Pending release, once no other open PR still links them. + * - A release branch's PR into the default branch is opened or pushed to: its description gets a "Closes" line for every + * open issue linked from a PR merged into that branch since its last release, so GitHub closes them when the release + * merges. The board's "Item closed" workflow then sets Done. + * + * Release branches are release-* in mavedb-api and mavedb-ui, and the long-lived mavedb-dev in dcd_mapping2. The + * pattern covers every repo because issues are linked across repos, and each repo carries an identical copy of this + * file. + * + * A PR's issues are the ones linked from its Development sidebar plus those named on a "Closes #N" line in its + * description. GitHub turns that line into a link only on PRs into the default branch; on a PR into a release branch it + * is a plain mention, so this script reads the description itself. + * + * Issues only move forward, so the release PR linking an issue that is already Pending release leaves it there. Issues + * that aren't on the board are skipped, not added: adding one fires the board's "Item added to project" workflow, which + * would race this script's status change. + * + * Called from .github/workflows/issue-status.yml through actions/github-script, with a GitHub App token that can write + * to the org's projects. + */ + +const PROJECT_OWNER = 'VariantEffect'; +const PROJECT_NUMBER = 4; + +// Board order, left to right. Matched by suffix so the option emoji can change without breaking this. +const ORDER = ['New', 'Backlog', 'Ready', 'In progress', 'Waiting/Blocked', 'In review', 'Pending release', 'Done']; + +const RELEASE_SECTION_START = ''; +const RELEASE_SECTION_END = ''; + +const rank = (statusName) => (statusName ? ORDER.findIndex((label) => statusName.endsWith(label)) : -1); +const isReleaseBranch = (ref) => /^(release-.+|mavedb-dev)$/.test(ref); + +async function loadProject(github) { + const { organization } = await github.graphql( + `query($owner: String!, $number: Int!) { + organization(login: $owner) { + projectV2(number: $number) { + id + field(name: "Status") { ... on ProjectV2SingleSelectField { id options { id name } } } + } + } + }`, + { owner: PROJECT_OWNER, number: PROJECT_NUMBER }, + ); + const project = organization.projectV2; + const options = Object.fromEntries( + ORDER.map((label) => { + const option = project.field.options.find((o) => o.name.endsWith(label)); + if (!option) throw new Error(`The project's Status field has no "${label}" option.`); + return [label, option.id]; + }), + ); + return { id: project.id, fieldId: project.field.id, options }; +} + +const ISSUE_FIELDS = ` + id number state + repository { nameWithOwner } + projectItems(first: 20) { + nodes { + id + project { id } + status: fieldValueByName(name: "Status") { ... on ProjectV2ItemFieldSingleSelectValue { name } } + } + } + closedByPullRequestsReferences(first: 20, includeClosedPrs: false) { + nodes { number headRefName repository { nameWithOwner } } + } +`; + +const CLOSING_REF = /\b(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?):?\s+(?:([\w.-]+)\/([\w.-]+))?#(\d+)\b/gi; + +// HTML comments are dropped first so the template's own "Closes #123" example doesn't count. +function closingRefs(body, owner, repo) { + const text = (body ?? '').replace(//g, ''); + return [...text.matchAll(CLOSING_REF)].map(([, o, r, n]) => ({ owner: o ?? owner, repo: r ?? repo, number: Number(n) })); +} + +const linkRefs = (links) => + links.nodes.map((i) => { + const [owner, repo] = i.repository.nameWithOwner.split('/'); + return { owner, repo, number: i.number }; + }); + +// Fetches the issues behind a set of refs in one query. Refs that turn out to be PRs, or that don't resolve, are dropped. +async function fetchIssues(github, refs) { + const unique = [...new Map(refs.map((r) => [`${r.owner}/${r.repo}#${r.number}`.toLowerCase(), r])).values()]; + if (!unique.length) return []; + const query = `query { + ${unique + .map( + (r, i) => `i${i}: repository(owner: ${JSON.stringify(r.owner)}, name: ${JSON.stringify(r.repo)}) { + issueOrPullRequest(number: ${r.number}) { ... on Issue { ${ISSUE_FIELDS} } } + }`, + ) + .join('\n')} + }`; + let data; + try { + data = await github.graphql(query); + } catch (error) { + if (!error.data) throw error; + data = error.data; // A ref to a missing repo fails only its own alias. + } + return Object.values(data) + .map((r) => r?.issueOrPullRequest) + .filter((issue) => issue?.id && issue.state === 'OPEN'); +} + +async function linkedIssues(github, owner, repo, pr) { + const { repository } = await github.graphql( + `query($owner: String!, $repo: String!, $number: Int!) { + repository(owner: $owner, name: $repo) { + pullRequest(number: $number) { + closingIssuesReferences(first: 50) { nodes { number repository { nameWithOwner } } } + } + } + }`, + { owner, repo, number: pr.number }, + ); + const links = repository.pullRequest.closingIssuesReferences; + return fetchIssues(github, [...linkRefs(links), ...closingRefs(pr.body, owner, repo)]); +} + +async function moveIssue(github, core, project, issue, target) { + const label = `${issue.repository.nameWithOwner}#${issue.number}`; + const item = issue.projectItems.nodes.find((i) => i.project.id === project.id); + if (!item) { + core.notice(`${label} isn't on the project; skipping.`); + return; + } + const current = item.status?.name; + if (rank(current) >= ORDER.indexOf(target)) { + core.info(`${label} is already at "${current}"; leaving it.`); + return; + } + await github.graphql( + `mutation($project: ID!, $item: ID!, $field: ID!, $option: String!) { + updateProjectV2ItemFieldValue(input: { + projectId: $project, itemId: $item, fieldId: $field, value: { singleSelectOptionId: $option } + }) { projectV2Item { id } } + }`, + { project: project.id, item: item.id, field: project.fieldId, option: project.options[target] }, + ); + core.info(`${label}: "${current ?? 'no status'}" -> "${target}".`); +} + +async function markInReview(github, core, project, owner, repo, pr) { + const target = pr.draft ? 'In progress' : 'In review'; + for (const issue of await linkedIssues(github, owner, repo, pr)) { + await moveIssue(github, core, project, issue, target); + } +} + +// An issue split across several PRs, possibly in different repos, waits for the last of them. Release PRs link every +// issue in the release, so they don't count. Only sidebar links are visible here, not "Closes" lines in other PRs. +function stillOpenElsewhere(core, issue) { + const open = issue.closedByPullRequestsReferences.nodes.filter((p) => !isReleaseBranch(p.headRefName)); + if (open.length) { + const refs = open.map((p) => `${p.repository.nameWithOwner}#${p.number}`).join(', '); + core.info(`${issue.repository.nameWithOwner}#${issue.number} is still linked from open ${refs}; leaving it.`); + } + return open.length > 0; +} + +async function markPendingRelease(github, core, project, owner, repo, pr) { + // By the time "closed" fires, the merged PR no longer counts as open. + for (const issue of await linkedIssues(github, owner, repo, pr)) { + if (!stillOpenElsewhere(core, issue)) await moveIssue(github, core, project, issue, 'Pending release'); + } +} + +// Long-lived release branches (mavedb-dev) keep their history, so only PRs merged since the branch last shipped count. +async function lastReleasedAt(github, owner, repo, pr) { + const { search } = await github.graphql( + `query($query: String!) { + search(type: ISSUE, query: $query, first: 1) { nodes { ... on PullRequest { mergedAt } } } + }`, + { query: `repo:${owner}/${repo} is:pr is:merged head:${pr.head.ref} base:${pr.base.ref} sort:created-desc` }, + ); + return search.nodes[0]?.mergedAt ?? null; +} + +async function updateReleaseDescription(github, core, owner, repo, pr) { + const since = await lastReleasedAt(github, owner, repo, pr); + const query = `repo:${owner}/${repo} is:pr is:merged base:${pr.head.ref}` + (since ? ` merged:>${since}` : ''); + const refs = []; + let cursor = null; + do { + const { search } = await github.graphql( + `query($query: String!, $cursor: String) { + search(type: ISSUE, query: $query, first: 50, after: $cursor) { + pageInfo { hasNextPage endCursor } + nodes { + ... on PullRequest { + body + closingIssuesReferences(first: 50) { nodes { number repository { nameWithOwner } } } + } + } + } + }`, + { query, cursor }, + ); + for (const merged of search.nodes) { + refs.push(...linkRefs(merged.closingIssuesReferences), ...closingRefs(merged.body, owner, repo)); + } + cursor = search.pageInfo.hasNextPage ? search.pageInfo.endCursor : null; + } while (cursor); + + const issues = new Map(); + for (const issue of await fetchIssues(github, refs)) { + if (stillOpenElsewhere(core, issue)) continue; + const sameRepo = issue.repository.nameWithOwner === `${owner}/${repo}`; + issues.set(sameRepo ? `#${issue.number}` : `${issue.repository.nameWithOwner}#${issue.number}`, issue); + } + + const listed = [...issues.keys()].sort((a, b) => a.localeCompare(b, 'en', { numeric: true })); + const section = [ + RELEASE_SECTION_START, + '### Issues closed by this release', + '', + `_Generated from the issues linked to PRs merged into \`${pr.head.ref}\` for this release, and rewritten on every push. Issues still linked from an open PR are left out. To change the list, change those PRs' linked issues or Closes lines._`, + '', + ...(listed.length ? listed.map((ref) => `- Closes ${ref}`) : ['None.']), + RELEASE_SECTION_END, + ].join('\n'); + + const body = pr.body ?? ''; + const start = body.indexOf(RELEASE_SECTION_START); + const end = body.indexOf(RELEASE_SECTION_END); + const updated = + start !== -1 && end > start + ? body.slice(0, start) + section + body.slice(end + RELEASE_SECTION_END.length) + : `${body.trimEnd()}\n\n${section}\n`; + if (updated === body) { + core.info('Release description is up to date.'); + return; + } + await github.rest.pulls.update({ owner, repo, pull_number: pr.number, body: updated }); + core.info(`Release description lists ${listed.length} issue(s).`); +} + +module.exports = async ({ github, context, core }) => { + const { owner, repo } = context.repo; + const project = await loadProject(github); + + // Linking an issue from the PR's Development sidebar fires no event, so a periodic sweep catches those. + if (context.eventName === 'schedule' || context.eventName === 'workflow_dispatch') { + const prs = await github.paginate(github.rest.pulls.list, { owner, repo, state: 'open', per_page: 100 }); + for (const pr of prs.filter((p) => !isReleaseBranch(p.head.ref))) { + await markInReview(github, core, project, owner, repo, pr); + } + return; + } + + const pr = context.payload.pull_request; + const action = context.payload.action; + + if (isReleaseBranch(pr.head.ref) && pr.base.ref === context.payload.repository.default_branch) { + if (['opened', 'reopened', 'synchronize'].includes(action)) { + await updateReleaseDescription(github, core, owner, repo, pr); + } + return; + } + + if (action === 'closed') { + if (pr.merged && isReleaseBranch(pr.base.ref)) { + await markPendingRelease(github, core, project, owner, repo, pr); + } + return; + } + + // Hotfixes merged straight into the default branch close their issues natively. + if (pr.base.ref !== context.payload.repository.default_branch) { + await markInReview(github, core, project, owner, repo, pr); + } +}; diff --git a/.github/workflows/issue-status.yml b/.github/workflows/issue-status.yml new file mode 100644 index 000000000..8d5d305b2 --- /dev/null +++ b/.github/workflows/issue-status.yml @@ -0,0 +1,41 @@ +name: Issue status + +# Moves linked issues across the MaveDB Backlog project; the logic and its rules are in .github/scripts/issue-status.js. +# pull_request_target runs this file from the base branch with the org secrets, so it works for fork PRs too. It never +# checks out or runs the PR's code. +on: + pull_request_target: + types: [opened, reopened, edited, synchronize, ready_for_review, converted_to_draft, closed] + schedule: + - cron: '17 * * * *' + workflow_dispatch: + +concurrency: + group: issue-status-${{ github.event.pull_request.number || github.run_id }} + +permissions: + contents: read + +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + sparse-checkout: .github/scripts + + # The default GITHUB_TOKEN can't write to org projects. The app needs org Projects read/write and repo Issues + # read and Pull requests read/write, installed on mavedb-api, mavedb-ui and dcd_mapping2. + - uses: actions/create-github-app-token@v2 + id: app-token + with: + app-id: ${{ vars.PROJECT_AUTOMATION_APP_ID }} + private-key: ${{ secrets.PROJECT_AUTOMATION_PRIVATE_KEY }} + owner: VariantEffect + + - uses: actions/github-script@v7 + with: + github-token: ${{ steps.app-token.outputs.token }} + script: | + const run = require('./.github/scripts/issue-status.js'); + await run({ github, context, core }); diff --git a/.github/workflows/run-tests-on-push.yml b/.github/workflows/run-tests-on-push.yml index d03a77591..6f8088e89 100644 --- a/.github/workflows/run-tests-on-push.yml +++ b/.github/workflows/run-tests-on-push.yml @@ -8,11 +8,13 @@ on: env: LOG_CONFIG: test + # Keep pytest's temp files, including each worker's Postgres data directory, in memory. + PYTEST_ADDOPTS: --basetemp=/dev/shm/pytest jobs: - run-mypy-3_11: + run-checks: runs-on: ubuntu-latest - name: MyPy checks on Python 3.11 + name: Lint, format and type checks (bin/check) steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 @@ -24,23 +26,43 @@ jobs: - run: pip install --upgrade pip - run: pip install poetry - run: poetry install --with dev --extras server - - run: poetry run mypy src/ + - run: bin/check - run-ruff-lint: + replay-migrations: runs-on: ubuntu-latest - name: Ruff linting on Python 3.11 + name: Replay migrations on an empty database + services: + postgres: + image: postgres:15 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: mavedb + ports: + - 5432:5432 + options: >- + --health-cmd "pg_isready -U postgres" + --health-interval 5s + --health-timeout 5s + --health-retries 10 + env: + DB_HOST: localhost + DB_PORT: 5432 + DB_DATABASE_NAME: mavedb + DB_USERNAME: postgres + DB_PASSWORD: postgres steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.11" cache: 'pip' - - run: sudo apt-get update - - run: sudo apt-get install -y tabix - run: pip install --upgrade pip - run: pip install poetry - run: poetry install --with dev --extras server - - run: poetry run ruff check + - run: poetry run alembic upgrade head + - name: Check there is exactly one head + run: test "$(poetry run alembic heads | wc -l)" -eq 1 run-tests-3_11-core-dependencies: runs-on: ubuntu-latest @@ -56,10 +78,10 @@ jobs: - run: poetry install --with dev - name: Run fast tests on PRs if: github.event_name == 'pull_request' - run: poetry run pytest tests/ -m "not network and not slow" + run: bin/t tests/ -n logical -m "not network and not slow" - name: Run full tests on main and release branches if: github.event_name == 'push' - run: poetry run pytest tests/ + run: bin/t tests/ -n logical run-tests-3_12-core-dependencies: runs-on: ubuntu-latest @@ -75,10 +97,10 @@ jobs: - run: poetry install --with dev - name: Run fast tests on PRs if: github.event_name == 'pull_request' - run: poetry run pytest tests/ -m "not network and not slow" + run: bin/t tests/ -n logical -m "not network and not slow" - name: Run all tests on main and release branches if: github.event_name == 'push' - run: poetry run pytest tests/ + run: bin/t tests/ -n logical run-tests-3_11: runs-on: ubuntu-latest @@ -98,12 +120,12 @@ jobs: if: github.event_name == 'pull_request' run: | mkdir -p coverage - poetry run pytest tests/ -m "not network and not slow" --show-capture=stdout --cov=src --cov-report=term-missing --cov-report=lcov:coverage/lcov.info + bin/t tests/ -n logical -m "not network and not slow" --show-capture=stdout --cov=src --cov-report=term-missing --cov-report=lcov:coverage/lcov.info - name: Run all tests with coverage on main and release branches if: github.event_name == 'push' run: | mkdir -p coverage - poetry run pytest tests/ --show-capture=stdout --cov=src --cov-report=term-missing --cov-report=lcov:coverage/lcov.info + bin/t tests/ -n logical --show-capture=stdout --cov=src --cov-report=term-missing --cov-report=lcov:coverage/lcov.info - name: Upload coverage to Coveralls uses: coverallsapp/github-action@v2 with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 529ceabb7..cc0085c29 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,9 +1,18 @@ +# Ruff runs from the Poetry environment so poetry.lock is the only place its version is pinned. +# --force-exclude keeps pyproject's `exclude` in effect when pre-commit passes file paths explicitly. repos: - - repo: https://github.com/astral-sh/ruff-pre-commit - # Ruff version. - rev: v0.6.8 + - repo: local hooks: - # Run the linter. - id: ruff - # Run the formatter. + name: ruff check + entry: poetry run ruff check --fix --force-exclude + language: system + types_or: [python, pyi] + require_serial: true - id: ruff-format + name: ruff format + entry: poetry run ruff format --force-exclude + language: system + # Ruff also formats Python code blocks in Markdown; bin/check and CI check them too. + types_or: [python, pyi, markdown] + require_serial: true diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..eaf39e5bc --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,39 @@ +# AGENTS.md — MaveDB API + +Facts about this repo that you can't work out from the code. Keep this file short. Guidance for specific paths goes in `.claude/rules/`, which loads when you touch those paths. Rules shared with the other MaveDB repos are in the workspace `AGENTS.md` one folder up. Update all of them in the same change that makes any of it untrue. + +The MaveDB API is a FastAPI app plus an ARQ/Redis worker over PostgreSQL. The web app and the user docs live in `VariantEffect/mavedb-ui`. + +## Setup + +- `poetry install --with dev --extras server`, on Python 3.11 or 3.12. +- Run everything through `poetry run`. The host Python has none of the dependencies. +- Tests need PostgreSQL server binaries on `PATH`, because pytest-postgresql runs `pg_ctl`, which refuses to run as root. With `bin/test-db up` they need Docker instead. Server-extras tests also need `tabix`. + +## Commands + +| Task | Command | +|---|---| +| Lint, format check, types, migration rules | `bin/check` | +| Start the test database (Postgres on tmpfs in Docker) | `bin/test-db up` (`bin/test-db down` stops it) | +| Targeted tests | `bin/t tests/routers/test_score_set.py -k publish` | +| What PR CI runs | `bin/t tests/ -n logical -m "not network and not slow"` | +| Format | `poetry run ruff format` | +| Migrations | `poetry run alembic upgrade head` | +| Operator scripts | `poetry run python -m mavedb.scripts.` (dry run unless `--commit`) | + +- Run `bin/check` after every edit. It takes seconds. +- Run `bin/test-db up` before testing when Docker is available. `bin/t` uses it automatically, which keeps the thousands of files each test database creates off the host disk; without it, test runs load macOS's file watchers and endpoint scanning heavily. One container serves every checkout and worktree. +- Before handing work back, run the targeted tests for what you touched. Add `-n 6` when running more than a couple of files; xdist costs a few seconds to start, so skip it for one file. The PR set is about 5,400 tests and takes about 2.5 minutes with `bin/test-db up` and `-n 6`. +- If the pre-commit hook rewrites files, re-stage them and commit again. Never use `--no-verify`. +- Change Ruff's version or rule set only in a commit of its own. + +## Rules + +- Private records return 404, never 403, so a response doesn't reveal that they exist. +- A route's permission check covers only the entity it names. Anything a read fans out to needs its own check through a `Viewer` (see `.claude/rules/permissions.md`). +- Never write an `async def` that has no real await (#881). +- Changes reachable from a route or a serving `lib/` module need tests, and so do scripts that emit a recurring public artifact such as the data dump. One-shot operator scripts don't. +- Never add `slow` or `network` markers to get green; those markers drop a test from PR CI. +- Run operator scripts with `--commit` only against a local database unless asked. Never commit to production or staging databases without explicit permission. +- Never write to `mapped_variants` or `variant_translations`; they're legacy and read-only, and new mapping data goes to mapping records and alleles. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 000000000..43c994c2d --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/Makefile b/Makefile deleted file mode 100644 index 16f8319bc..000000000 --- a/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -VENV := .venv/bin - -.DEFAULT_GOAL := help - -.PHONY: help -help: - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-12s %s\n", $$1, $$2}' - -.PHONY: dev -dev: ## Install deps including local editable variant-annotation - poetry install --extras server - -.PHONY: test -test: ## Run the test suite - $(VENV)/pytest tests/ - -.PHONY: lint -lint: ## Check code with ruff - $(VENV)/ruff check src/ tests/ - -.PHONY: format -format: ## Format code with ruff - $(VENV)/ruff format src/ tests/ diff --git a/README.md b/README.md index 8155e470c..770016603 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Or add `mavedb` to your Python project's dependencies. ### Prerequisites -- Python 3.11 or later +- Python 3.11 or 3.12 (the versions CI tests) - PIP - [Poetry](https://python-poetry.org/) for building and publishing distributions. For details on installing poetry, consult its [documentation](https://python-poetry.org/docs/#installation). @@ -46,8 +46,21 @@ poetry publish -r pypi -u -p To build and publish the package in one go, just pass the `--build` flag to the publish command. -For use as a server, this distribution includes an optional set of dependencies, which are only invoked if the package -is installed with `poetry install mavedb --extras server`. +For use as a server, this distribution includes an optional set of dependencies, which are only installed with +`poetry install --extras server`. + +### Development setup + +Once per clone: + +``` +poetry install --with dev --extras server +poetry run pre-commit install +git config blame.ignoreRevsFile .git-blame-ignore-revs +``` + +The pre-commit hooks run Ruff's linter and formatter. The `git config` line makes `git blame` skip formatting-only +commits. Check and test commands are in [AGENTS.md](AGENTS.md). ### Running a local version of the API server diff --git a/alembic/README b/alembic/README deleted file mode 100644 index 98e4f9c44..000000000 --- a/alembic/README +++ /dev/null @@ -1 +0,0 @@ -Generic single-database configuration. \ No newline at end of file diff --git a/alembic/README.md b/alembic/README.md new file mode 100644 index 000000000..c13e79671 --- /dev/null +++ b/alembic/README.md @@ -0,0 +1,49 @@ +# Migrations + +`alembic upgrade head` must build a working database from an empty one, and every upgrade must apply all or nothing. CI checks both: it replays the history on an empty Postgres for every PR, and `bin/check-migrations` (run by `bin/check`) fails on the patterns below. + +## Rules for new migrations + +- No imports from `mavedb.*`. Write views and functions as literal SQL, so replaying a migration builds what it shipped with, not what the models say today. +- No network calls, ORM sessions or commits. Data that needs either belongs in a script in `src/mavedb/scripts/`, run by an operator. +- Nothing that can't run inside a transaction, such as `CREATE INDEX CONCURRENTLY` or `autocommit_block()`. +- No `ALTER TYPE ... ADD VALUE`. The replay runs every migration in one transaction, and Postgres won't use an enum value in the transaction that added it. Store enums as text with a `CHECK` constraint, as the existing ones are. + +### Large indexes + +Building an index on a large table without `CONCURRENTLY` holds a lock for minutes. Build it by hand in production before the deploy: + +```sql +CREATE INDEX CONCURRENTLY IF NOT EXISTS ix_name ON big_table (column); +``` + +The migration then creates the same index without `CONCURRENTLY` and with `IF NOT EXISTS`. In production that does nothing; on an empty database it builds the index. Put the by-hand statement in the migration's docstring, which the check ignores. + +## The baseline + +The oldest revision is a baseline: one migration that builds the schema as of a release, from `alembic/baseline/.sql`. It keeps that release's head revision ID, so databases already at that release need no restamp. It can't be downgraded; the rollback across it is a database snapshot. + +The SQL file comes from a schema-only dump of production plus the fixed vocabulary an empty database needs (`SEED_TABLES` and `SEED_ROWS` in `bin/build-baseline`). Don't edit it by hand. + +## Squashing + +At each cycle boundary, once the last release has been stable in production for a few days, squash up to its head: + +1. Confirm production and staging both report the release's head in `alembic_version`, and that no open branch's migration is older than it. +2. Write the baseline from production, as the master user through the bastion tunnel: + + ```bash + bin/build-baseline "host=localhost port=15432 dbname=mavedb user=postgres sslmode=require" + ``` + +3. Replace the head revision's file with a baseline migration (copy the current one), and delete every older revision and the previous baseline's SQL file. Migrations after the head already point at its ID. +4. Check the replay: run `alembic upgrade head` on an empty database, and diff a schema-only dump of it against production's. +5. Re-parent the first migration on each open branch onto the baseline, and add a row to the log below. + +Ownership and grants aren't in the baseline. The role bootstrap script applies them (#827). + +## Squash log + +| Baseline revision | Release | Squashed on | +|---|---|---| +| `c5e1a9d4b7f2` | 2026.3.0 | 2026-10-19 | diff --git a/alembic/alembic_helpers.py b/alembic/alembic_helpers.py deleted file mode 100644 index 902f52cb7..000000000 --- a/alembic/alembic_helpers.py +++ /dev/null @@ -1,26 +0,0 @@ -# From https://improveandrepeat.com/2021/09/python-friday-87-handling-pre-existing-tables-with-alembic-and-sqlalchemy/ -# Based on https://github.com/talkpython/data-driven-web-apps-with-flask - -from sqlalchemy import engine_from_config -from sqlalchemy.engine import reflection - -from alembic import op - - -def table_does_not_exist(table, schema=None): - config = op.get_context().config - engine = engine_from_config(config.get_section(config.config_ini_section), prefix="sqlalchemy.") - insp = reflection.Inspector.from_engine(engine) - return insp.has_table(table, schema) is False - - -def table_has_column(table, column): - config = op.get_context().config - engine = engine_from_config(config.get_section(config.config_ini_section), prefix="sqlalchemy.") - insp = reflection.Inspector.from_engine(engine) - has_column = False - for col in insp.get_columns(table): - if column not in col["name"]: - continue - has_column = True - return has_column diff --git a/alembic/baseline/c5e1a9d4b7f2.sql b/alembic/baseline/c5e1a9d4b7f2.sql new file mode 100644 index 000000000..e1666b79e --- /dev/null +++ b/alembic/baseline/c5e1a9d4b7f2.sql @@ -0,0 +1,5050 @@ +-- +-- PostgreSQL database dump +-- + + +-- Dumped from database version 15.17 +-- Dumped by pg_dump version 15.17 (Homebrew) + + +-- +-- Name: pg_stat_statements; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS pg_stat_statements WITH SCHEMA public; + + +-- +-- Name: EXTENSION pg_stat_statements; Type: COMMENT; Schema: -; Owner: - +-- + +COMMENT ON EXTENSION pg_stat_statements IS 'track planning and execution statistics of all SQL statements executed'; + + +-- +-- Name: reset_sequence(text, text, text); Type: FUNCTION; Schema: public; Owner: - +-- + +CREATE FUNCTION public.reset_sequence(tablename text, columnname text, sequence_name text) RETURNS void + LANGUAGE plpgsql + AS $$ + DECLARE + BEGIN + + EXECUTE 'SELECT setval( ''' || sequence_name || ''', ' || '(SELECT MAX(' || columnname || + ') FROM ' || tablename || ')' || '+1)'; + + END; + + $$; + + + + +-- +-- Name: access_keys; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.access_keys ( + id integer NOT NULL, + user_id integer NOT NULL, + key_id character varying NOT NULL, + public_key character varying NOT NULL, + name character varying, + expiration_date date, + creation_time timestamp without time zone, + role_id integer +); + + +-- +-- Name: access_keys_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.access_keys_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: access_keys_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.access_keys_id_seq OWNED BY public.access_keys.id; + + +-- +-- Name: acmg_classifications; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.acmg_classifications ( + id integer NOT NULL, + criterion character varying(32), + evidence_strength character varying(32), + points integer, + creation_date date NOT NULL, + modification_date date NOT NULL +); + + +-- +-- Name: acmg_classifications_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.acmg_classifications_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: acmg_classifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.acmg_classifications_id_seq OWNED BY public.acmg_classifications.id; + + +-- +-- Name: alleles; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.alleles ( + id integer NOT NULL, + vrs_digest character varying NOT NULL, + level character varying(16) NOT NULL, + hgvs_g character varying, + hgvs_c character varying, + hgvs_p character varying, + clingen_allele_id character varying, + post_mapped jsonb, + created_at date DEFAULT CURRENT_DATE NOT NULL, + updated_at date DEFAULT CURRENT_DATE NOT NULL +); + + +-- +-- Name: alleles_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.alleles_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: alleles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.alleles_id_seq OWNED BY public.alleles.id; + + +-- +-- Name: annotation_event; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.annotation_event ( + id integer NOT NULL, + annotation_type character varying(50) NOT NULL, + variant_id integer, + allele_id integer, + disposition character varying(50) NOT NULL, + reason character varying(50) NOT NULL, + source_version character varying(50), + metadata jsonb, + job_run_id integer, + score_set_id integer, + created_at timestamp with time zone DEFAULT now() NOT NULL, + CONSTRAINT ck_annotation_event_subject CHECK (((((annotation_type)::text = ANY ((ARRAY['vrs_mapping'::character varying, 'cross_level_translation'::character varying, 'variant_translation'::character varying, 'ldh_submission'::character varying])::text[])) AND (variant_id IS NOT NULL) AND (allele_id IS NULL)) OR (((annotation_type)::text = ANY ((ARRAY['clingen_allele_id'::character varying, 'gnomad_allele_frequency'::character varying, 'vep_functional_consequence'::character varying, 'clinvar_control'::character varying, 'mapped_hgvs'::character varying])::text[])) AND (allele_id IS NOT NULL) AND (variant_id IS NULL)))) +); + + +-- +-- Name: annotation_event_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.annotation_event_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: annotation_event_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.annotation_event_id_seq OWNED BY public.annotation_event.id; + + +-- +-- Name: calibration_controls; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.calibration_controls ( + id integer NOT NULL, + calibration_id integer NOT NULL, + variant_id integer NOT NULL, + clinical_status character varying(32) NOT NULL, + created_by_id integer NOT NULL, + modified_by_id integer NOT NULL, + creation_date date NOT NULL, + modification_date date NOT NULL +); + + +-- +-- Name: calibration_controls_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.calibration_controls_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: calibration_controls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.calibration_controls_id_seq OWNED BY public.calibration_controls.id; + + +-- +-- Name: clinvar_controls; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.clinvar_controls ( + id integer NOT NULL, + db_identifier character varying NOT NULL, + gene_symbol character varying NOT NULL, + clinical_significance character varying NOT NULL, + clinical_review_status character varying NOT NULL, + db_version character varying NOT NULL, + creation_date date NOT NULL, + modification_date date NOT NULL, + db_name character varying NOT NULL, + clinvar_variation_id character varying +); + + +-- +-- Name: clinical_controls_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.clinical_controls_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: clinical_controls_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.clinical_controls_id_seq OWNED BY public.clinvar_controls.id; + + +-- +-- Name: clinvar_allele_links; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.clinvar_allele_links ( + id integer NOT NULL, + allele_id integer NOT NULL, + clinvar_control_id integer NOT NULL, + valid_from timestamp with time zone DEFAULT now() NOT NULL, + valid_to timestamp with time zone +); + + +-- +-- Name: clinvar_allele_links_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.clinvar_allele_links_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: clinvar_allele_links_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.clinvar_allele_links_id_seq OWNED BY public.clinvar_allele_links.id; + + +-- +-- Name: collection_experiments; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.collection_experiments ( + collection_id integer NOT NULL, + experiment_id integer NOT NULL, + "position" integer NOT NULL +); + + +-- +-- Name: collection_score_sets; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.collection_score_sets ( + collection_id integer NOT NULL, + score_set_id integer NOT NULL, + "position" integer NOT NULL +); + + +-- +-- Name: collection_user_associations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.collection_user_associations ( + collection_id integer NOT NULL, + user_id integer NOT NULL, + contribution_role character varying(32) NOT NULL, + CONSTRAINT contributionrole CHECK (((contribution_role)::text = ANY ((ARRAY['admin'::character varying, 'editor'::character varying, 'viewer'::character varying])::text[]))) +); + + +-- +-- Name: collections; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.collections ( + id integer NOT NULL, + urn character varying(64), + private boolean NOT NULL, + name character varying NOT NULL, + badge_name character varying, + description character varying, + created_by_id integer, + modified_by_id integer, + creation_date date NOT NULL, + modification_date date NOT NULL +); + + +-- +-- Name: collections_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.collections_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: collections_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.collections_id_seq OWNED BY public.collections.id; + + +-- +-- Name: contributors; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.contributors ( + id integer NOT NULL, + orcid_id character varying NOT NULL, + given_name character varying, + family_name character varying +); + + +-- +-- Name: contributors_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.contributors_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: contributors_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.contributors_id_seq OWNED BY public.contributors.id; + + +-- +-- Name: controlled_keywords; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.controlled_keywords ( + id integer NOT NULL, + key character varying NOT NULL, + label character varying NOT NULL, + system character varying, + special boolean, + description character varying, + creation_date date NOT NULL, + modification_date date NOT NULL, + code character varying, + version character varying +); + + +-- +-- Name: controlled_keywords_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.controlled_keywords_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: controlled_keywords_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.controlled_keywords_id_seq OWNED BY public.controlled_keywords.id; + + +-- +-- Name: doi_identifiers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.doi_identifiers ( + id integer NOT NULL, + identifier character varying NOT NULL, + db_name character varying NOT NULL, + db_version character varying, + url character varying, + creation_date date NOT NULL, + modification_date date NOT NULL +); + + +-- +-- Name: doi_identifiers_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.doi_identifiers_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: doi_identifiers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.doi_identifiers_id_seq OWNED BY public.doi_identifiers.id; + + +-- +-- Name: ensembl_identifiers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.ensembl_identifiers ( + id integer NOT NULL, + identifier character varying NOT NULL, + db_name character varying NOT NULL, + db_version character varying, + url character varying, + creation_date date NOT NULL, + modification_date date NOT NULL +); + + +-- +-- Name: ensembl_identifiers_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.ensembl_identifiers_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: ensembl_identifiers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.ensembl_identifiers_id_seq OWNED BY public.ensembl_identifiers.id; + + +-- +-- Name: ensembl_offsets; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.ensembl_offsets ( + identifier_id integer NOT NULL, + target_gene_id integer NOT NULL, + "offset" integer NOT NULL +); + + +-- +-- Name: experiment_contributors; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.experiment_contributors ( + experiment_id integer NOT NULL, + contributor_id integer NOT NULL +); + + +-- +-- Name: experiment_controlled_keywords; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.experiment_controlled_keywords ( + experiment_id integer NOT NULL, + controlled_keyword_id integer NOT NULL, + description character varying +); + + +-- +-- Name: experiment_doi_identifiers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.experiment_doi_identifiers ( + experiment_id integer NOT NULL, + doi_identifier_id integer NOT NULL +); + + +-- +-- Name: experiment_keywords; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.experiment_keywords ( + experiment_id integer NOT NULL, + keyword_id integer NOT NULL +); + + +-- +-- Name: experiment_publication_identifiers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.experiment_publication_identifiers ( + experiment_id integer NOT NULL, + publication_identifier_id integer NOT NULL, + "primary" boolean +); + + +-- +-- Name: experiment_set_contributors; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.experiment_set_contributors ( + experiment_set_id integer NOT NULL, + contributor_id integer NOT NULL +); + + +-- +-- Name: experiment_set_doi_identifiers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.experiment_set_doi_identifiers ( + experiment_set_id integer NOT NULL, + doi_identifier_id integer NOT NULL +); + + +-- +-- Name: experiment_set_keywords; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.experiment_set_keywords ( + experiment_set_id integer NOT NULL, + keyword_id integer NOT NULL +); + + +-- +-- Name: experiment_set_publication_identifiers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.experiment_set_publication_identifiers ( + experiment_set_id integer NOT NULL, + publication_identifier_id integer NOT NULL +); + + +-- +-- Name: experiment_set_sra_identifiers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.experiment_set_sra_identifiers ( + experiment_set_id integer NOT NULL, + sra_identifier_id integer NOT NULL +); + + +-- +-- Name: experiment_sets; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.experiment_sets ( + id integer NOT NULL, + urn character varying(64), + extra_metadata jsonb NOT NULL, + private boolean NOT NULL, + approved boolean NOT NULL, + published_date date, + processing_state character varying, + num_experiments integer NOT NULL, + created_by_id integer, + modified_by_id integer, + creation_date date NOT NULL, + modification_date date NOT NULL +); + + +-- +-- Name: experiment_sets_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.experiment_sets_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: experiment_sets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.experiment_sets_id_seq OWNED BY public.experiment_sets.id; + + +-- +-- Name: experiment_sra_identifiers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.experiment_sra_identifiers ( + experiment_id integer NOT NULL, + sra_identifier_id integer NOT NULL +); + + +-- +-- Name: experiments; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.experiments ( + id integer NOT NULL, + urn character varying(64), + title character varying NOT NULL, + short_description character varying NOT NULL, + abstract_text character varying NOT NULL, + method_text character varying NOT NULL, + extra_metadata jsonb NOT NULL, + private boolean NOT NULL, + approved boolean NOT NULL, + published_date date, + processing_state character varying, + num_scoresets integer NOT NULL, + experiment_set_id integer, + created_by_id integer, + modified_by_id integer, + creation_date date NOT NULL, + modification_date date NOT NULL, + external_links jsonb DEFAULT '{}'::jsonb NOT NULL +); + + +-- +-- Name: experiments_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.experiments_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: experiments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.experiments_id_seq OWNED BY public.experiments.id; + + +-- +-- Name: genome_identifiers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.genome_identifiers ( + id integer NOT NULL, + identifier character varying NOT NULL, + db_name character varying NOT NULL, + db_version character varying, + url character varying, + creation_date date NOT NULL, + modification_date date NOT NULL +); + + +-- +-- Name: genome_identifiers_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.genome_identifiers_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: genome_identifiers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.genome_identifiers_id_seq OWNED BY public.genome_identifiers.id; + + +-- +-- Name: gnomad_allele_links; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.gnomad_allele_links ( + id integer NOT NULL, + allele_id integer NOT NULL, + gnomad_variant_id integer NOT NULL, + valid_from timestamp with time zone DEFAULT now() NOT NULL, + valid_to timestamp with time zone +); + + +-- +-- Name: gnomad_allele_links_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.gnomad_allele_links_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gnomad_allele_links_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.gnomad_allele_links_id_seq OWNED BY public.gnomad_allele_links.id; + + +-- +-- Name: gnomad_variants; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.gnomad_variants ( + id integer NOT NULL, + db_name character varying NOT NULL, + db_identifier character varying NOT NULL, + db_version character varying NOT NULL, + allele_count integer NOT NULL, + allele_number integer NOT NULL, + allele_frequency double precision NOT NULL, + faf95_max double precision, + faf95_max_ancestry character varying, + creation_date date NOT NULL, + modification_date date NOT NULL +); + + +-- +-- Name: gnomad_variants_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.gnomad_variants_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: gnomad_variants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.gnomad_variants_id_seq OWNED BY public.gnomad_variants.id; + + +-- +-- Name: gnomad_variants_mapped_variants; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.gnomad_variants_mapped_variants ( + mapped_variant_id integer NOT NULL, + gnomad_variant_id integer NOT NULL +); + + +-- +-- Name: job_dependencies; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.job_dependencies ( + id integer NOT NULL, + depends_on_job_id integer NOT NULL, + dependency_type character varying(50) NOT NULL, + created_at timestamp with time zone DEFAULT now() NOT NULL, + metadata jsonb, + CONSTRAINT ck_job_dependencies_type_valid CHECK (((dependency_type IS NULL) OR ((dependency_type)::text = ANY ((ARRAY['success_required'::character varying, 'completion_required'::character varying])::text[])))) +); + + +-- +-- Name: job_runs; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.job_runs ( + id integer NOT NULL, + urn character varying(255), + job_type character varying(100) NOT NULL, + job_function character varying(255) NOT NULL, + job_params jsonb, + status character varying(50) NOT NULL, + pipeline_id integer, + max_retries integer NOT NULL, + retry_count integer NOT NULL, + retry_delay_seconds integer, + scheduled_at timestamp with time zone DEFAULT now() NOT NULL, + started_at timestamp with time zone, + finished_at timestamp with time zone, + created_at timestamp with time zone DEFAULT now() NOT NULL, + error_message text, + error_traceback text, + failure_category character varying(100), + progress_current integer, + progress_total integer, + progress_message character varying(500), + correlation_id character varying(255), + metadata jsonb DEFAULT '{}'::jsonb NOT NULL, + mavedb_version character varying(50), + progress_updated_at timestamp with time zone DEFAULT now() NOT NULL, + CONSTRAINT ck_job_runs_max_retries_positive CHECK ((max_retries >= 0)), + CONSTRAINT ck_job_runs_retry_count_positive CHECK ((retry_count >= 0)), + CONSTRAINT ck_job_runs_status_valid CHECK (((status)::text = ANY ((ARRAY['pending'::character varying, 'queued'::character varying, 'running'::character varying, 'succeeded'::character varying, 'failed'::character varying, 'errored'::character varying, 'cancelled'::character varying, 'skipped'::character varying])::text[]))) +); + + +-- +-- Name: job_runs_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.job_runs_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: job_runs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.job_runs_id_seq OWNED BY public.job_runs.id; + + +-- +-- Name: keywords; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.keywords ( + id integer NOT NULL, + text character varying NOT NULL, + creation_date date NOT NULL, + modification_date date NOT NULL +); + + +-- +-- Name: keywords_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.keywords_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: keywords_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.keywords_id_seq OWNED BY public.keywords.id; + + +-- +-- Name: licenses; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.licenses ( + id integer NOT NULL, + long_name character varying NOT NULL, + short_name character varying NOT NULL, + text character varying NOT NULL, + link character varying, + version character varying, + creation_date date NOT NULL, + modification_date date NOT NULL, + active boolean DEFAULT true NOT NULL +); + + +-- +-- Name: licenses_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.licenses_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: licenses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.licenses_id_seq OWNED BY public.licenses.id; + + +-- +-- Name: mapped_variants; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.mapped_variants ( + id integer NOT NULL, + pre_mapped jsonb, + post_mapped jsonb, + variant_id integer NOT NULL, + vrs_version character varying DEFAULT '1.3'::character varying, + error_message character varying, + modification_date date DEFAULT CURRENT_DATE NOT NULL, + mapped_date date DEFAULT '2024-01-01'::date NOT NULL, + mapping_api_version character varying DEFAULT '0.0.0'::character varying NOT NULL, + current boolean DEFAULT false NOT NULL, + clingen_allele_id character varying, + vep_functional_consequence character varying, + vep_access_date date, + hgvs_assay_level character varying, + hgvs_g character varying, + hgvs_c character varying, + hgvs_p character varying, + target_gene_mapping_id integer, + alignment_level character varying(16), + at_mismatched_locus boolean, + near_gap boolean, + CONSTRAINT ck_mapped_variants_alignment_level_valid CHECK (((alignment_level IS NULL) OR ((alignment_level)::text = ANY ((ARRAY['protein'::character varying, 'cdna'::character varying, 'genomic'::character varying])::text[])))) +); + + +-- +-- Name: mapped_variants_clinical_controls; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.mapped_variants_clinical_controls ( + mapped_variant_id integer NOT NULL, + clinical_control_id integer NOT NULL +); + + +-- +-- Name: mapped_variants_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.mapped_variants_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mapped_variants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.mapped_variants_id_seq OWNED BY public.mapped_variants.id; + + +-- +-- Name: mapping_record_alleles; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.mapping_record_alleles ( + id integer NOT NULL, + mapping_record_id integer NOT NULL, + allele_id integer NOT NULL, + is_authoritative boolean DEFAULT false NOT NULL, + valid_from timestamp with time zone DEFAULT now() NOT NULL, + valid_to timestamp with time zone, + projection_group integer, + score_set_id integer NOT NULL +); + + +-- +-- Name: mapping_record_alleles_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.mapping_record_alleles_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mapping_record_alleles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.mapping_record_alleles_id_seq OWNED BY public.mapping_record_alleles.id; + + +-- +-- Name: mapping_records; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.mapping_records ( + id integer NOT NULL, + variant_id integer NOT NULL, + vrs_digest character varying, + pre_mapped jsonb, + assay_level character varying(16) NOT NULL, + hgvs_assay_level character varying, + mapping_api_version character varying NOT NULL, + mapped_date date NOT NULL, + vrs_version character varying, + alignment_level character varying(16), + at_mismatched_locus boolean, + near_gap boolean, + target_gene_mapping_id integer, + valid_from timestamp with time zone DEFAULT now() NOT NULL, + valid_to timestamp with time zone, + score_set_id integer NOT NULL, + CONSTRAINT ck_mapping_records_assay_level_valid CHECK (((assay_level)::text = ANY ((ARRAY['genomic'::character varying, 'cdna'::character varying, 'protein'::character varying])::text[]))) +); + + +-- +-- Name: mapping_records_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.mapping_records_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mapping_records_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.mapping_records_id_seq OWNED BY public.mapping_records.id; + + +-- +-- Name: mavedb_ldh_records; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.mavedb_ldh_records ( + variant_urn text, + ldh_id bigint, + ldh_creation_date timestamp without time zone, + ldh_modification_date timestamp without time zone, + clingen_allele_id text, + post_mapped_hgvs_1 text, + post_mapped_hgvs_2 text, + post_mapped_hgvs_3 text, + post_mapped_hgvs_4 text, + post_mapped_hgvs_5 text, + post_mapped_hgvs_6 text, + post_mapped_hgvs_7 text, + post_mapped_hgvs_8 text +); + + +-- +-- Name: mavedb_ldh_records_audit; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.mavedb_ldh_records_audit ( + variant_urn text, + ldh_id bigint, + ldh_creation_date timestamp without time zone, + ldh_modification_date timestamp without time zone, + clingen_allele_id text, + post_mapped_hgvs_1 text, + post_mapped_hgvs_2 text, + post_mapped_hgvs_3 text, + post_mapped_hgvs_4 text, + post_mapped_hgvs_5 text, + post_mapped_hgvs_6 text, + post_mapped_hgvs_7 text, + post_mapped_hgvs_8 text, + num_alleles_from_post_mapped_vrs integer, + num_alleles_from_hgvs_nt integer, + num_alleles_from_hgvs_pro integer, + num_alleles_from_hgvs integer, + num_clingen_allele_ids integer, + hgvs_nt text, + hgvs_pro text +); + + +-- +-- Name: mavedb_staging_mapped_clinvar_allele_ids_1; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.mavedb_staging_mapped_clinvar_allele_ids_1 ( + urn text, + clingen_allele_id text +); + + +-- +-- Name: mavedb_staging_mapped_variants_clinical_controls; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.mavedb_staging_mapped_variants_clinical_controls ( + variant_urn text, + clinical_control_id integer +); + + +-- +-- Name: mondo_terms; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.mondo_terms ( + id integer NOT NULL, + code character varying NOT NULL, + system character varying NOT NULL, + system_version character varying, + label character varying NOT NULL, + creation_date date NOT NULL, + modification_date date NOT NULL +); + + +-- +-- Name: mondo_terms_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.mondo_terms_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: mondo_terms_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.mondo_terms_id_seq OWNED BY public.mondo_terms.id; + + +-- +-- Name: pipelines; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.pipelines ( + id integer NOT NULL, + urn character varying(255), + name character varying(500) NOT NULL, + description text, + status character varying(50) NOT NULL, + correlation_id character varying(255), + metadata jsonb DEFAULT '{}'::jsonb NOT NULL, + created_at timestamp with time zone DEFAULT now() NOT NULL, + started_at timestamp with time zone, + finished_at timestamp with time zone, + created_by_user_id integer, + mavedb_version character varying(50), + CONSTRAINT ck_pipelines_status_valid CHECK (((status)::text = ANY ((ARRAY['created'::character varying, 'running'::character varying, 'succeeded'::character varying, 'failed'::character varying, 'cancelled'::character varying, 'paused'::character varying, 'partial'::character varying])::text[]))) +); + + +-- +-- Name: COLUMN pipelines.metadata; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN public.pipelines.metadata IS 'Flexible metadata storage for pipeline-specific data'; + + +-- +-- Name: pipelines_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.pipelines_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: pipelines_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.pipelines_id_seq OWNED BY public.pipelines.id; + + +-- +-- Name: projection_groups; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.projection_groups ( + id integer NOT NULL, + mapping_record_id integer NOT NULL, + score_set_id integer NOT NULL, + hgvs_c character varying, + hgvs_g character varying, + hgvs_p character varying, + valid_from timestamp with time zone DEFAULT now() NOT NULL, + valid_to timestamp with time zone +); + + +-- +-- Name: projection_groups_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.projection_groups_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: projection_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.projection_groups_id_seq OWNED BY public.projection_groups.id; + + +-- +-- Name: publication_identifiers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.publication_identifiers ( + id integer NOT NULL, + identifier character varying NOT NULL, + db_name character varying NOT NULL, + db_version character varying, + url character varying, + reference_html character varying, + creation_date date NOT NULL, + modification_date date NOT NULL, + title character varying NOT NULL, + abstract character varying, + authors jsonb NOT NULL, + publication_year integer, + publication_journal character varying, + doi character varying +); + + +-- +-- Name: publication_identifiers_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.publication_identifiers_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: publication_identifiers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.publication_identifiers_id_seq OWNED BY public.publication_identifiers.id; + + +-- +-- Name: scoresets; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.scoresets ( + id integer NOT NULL, + urn character varying(64), + title character varying NOT NULL, + method_text character varying NOT NULL, + abstract_text character varying NOT NULL, + short_description character varying NOT NULL, + extra_metadata jsonb NOT NULL, + dataset_columns jsonb NOT NULL, + normalised boolean NOT NULL, + private boolean NOT NULL, + approved boolean NOT NULL, + published_date date, + processing_state character varying(32), + data_usage_policy character varying, + num_variants integer NOT NULL, + experiment_id integer NOT NULL, + licence_id integer NOT NULL, + replaces_id integer, + created_by_id integer, + modified_by_id integer, + creation_date date NOT NULL, + modification_date date NOT NULL, + processing_errors jsonb, + external_links jsonb DEFAULT '{}'::jsonb NOT NULL, + mapping_state character varying(32), + mapping_errors jsonb, + score_distribution jsonb, + CONSTRAINT mappingstate CHECK (((mapping_state)::text = ANY ((ARRAY['incomplete'::character varying, 'processing'::character varying, 'failed'::character varying, 'complete'::character varying, 'pending_variant_processing'::character varying, 'not_attempted'::character varying, 'queued'::character varying])::text[]))), + CONSTRAINT processingstate CHECK (((processing_state)::text = ANY (ARRAY[('incomplete'::character varying)::text, ('processing'::character varying)::text, ('failed'::character varying)::text, ('success'::character varying)::text]))) +); + + +-- +-- Name: variants; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.variants ( + id integer NOT NULL, + urn character varying(64), + data jsonb NOT NULL, + scoreset_id integer NOT NULL, + hgvs_nt character varying, + hgvs_pro character varying, + hgvs_splice character varying, + creation_date date NOT NULL, + modification_date date NOT NULL +); + + +-- +-- Name: published_variants_materialized_view; Type: MATERIALIZED VIEW; Schema: public; Owner: - +-- + +CREATE MATERIALIZED VIEW public.published_variants_materialized_view AS + SELECT variants.id AS variant_id, + variants.urn AS variant_urn, + mapping_records.id AS mapping_record_id, + scoresets.id AS score_set_id, + scoresets.urn AS score_set_urn, + scoresets.published_date, + (mapping_records.valid_to IS NULL) AS current_mapping_record + FROM ((public.variants + LEFT JOIN public.mapping_records ON ((variants.id = mapping_records.variant_id))) + JOIN public.scoresets ON ((scoresets.id = variants.scoreset_id))) + WHERE (scoresets.published_date IS NOT NULL) + WITH NO DATA; + + +-- +-- Name: refseq_identifiers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.refseq_identifiers ( + id integer NOT NULL, + identifier character varying NOT NULL, + db_name character varying NOT NULL, + db_version character varying, + url character varying, + reference_html character varying, + creation_date date NOT NULL, + modification_date date NOT NULL +); + + +-- +-- Name: refseq_identifiers_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.refseq_identifiers_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: refseq_identifiers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.refseq_identifiers_id_seq OWNED BY public.refseq_identifiers.id; + + +-- +-- Name: refseq_offsets; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.refseq_offsets ( + identifier_id integer NOT NULL, + target_gene_id integer NOT NULL, + "offset" integer NOT NULL +); + + +-- +-- Name: roles; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.roles ( + id integer NOT NULL, + name character varying NOT NULL +); + + +-- +-- Name: roles_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.roles_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.roles_id_seq OWNED BY public.roles.id; + + +-- +-- Name: score_calibration_functional_classification_variants; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.score_calibration_functional_classification_variants ( + functional_classification_id integer NOT NULL, + variant_id integer NOT NULL +); + + +-- +-- Name: score_calibration_functional_classifications; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.score_calibration_functional_classifications ( + id integer NOT NULL, + calibration_id integer NOT NULL, + label character varying NOT NULL, + description character varying, + functional_classification character varying(32) NOT NULL, + range jsonb, + inclusive_lower_bound boolean, + inclusive_upper_bound boolean, + oddspaths_ratio double precision, + positive_likelihood_ratio double precision, + acmg_classification_id integer, + class_ character varying +); + + +-- +-- Name: score_calibration_functional_classifications_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.score_calibration_functional_classifications_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: score_calibration_functional_classifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.score_calibration_functional_classifications_id_seq OWNED BY public.score_calibration_functional_classifications.id; + + +-- +-- Name: score_calibration_publication_identifiers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.score_calibration_publication_identifiers ( + score_calibration_id integer NOT NULL, + publication_identifier_id integer NOT NULL, + relation character varying(32) NOT NULL +); + + +-- +-- Name: score_calibrations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.score_calibrations ( + id integer NOT NULL, + urn character varying(64), + score_set_id integer NOT NULL, + title character varying NOT NULL, + research_use_only boolean NOT NULL, + "primary" boolean NOT NULL, + investigator_provided boolean NOT NULL, + private boolean NOT NULL, + notes character varying, + baseline_score double precision, + baseline_score_description character varying, + calibration_metadata jsonb, + created_by_id integer NOT NULL, + modified_by_id integer NOT NULL, + creation_date date NOT NULL, + modification_date date NOT NULL, + disease_term_id integer NOT NULL, + controls_not_phi boolean +); + + +-- +-- Name: score_calibrations_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.score_calibrations_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: score_calibrations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.score_calibrations_id_seq OWNED BY public.score_calibrations.id; + + +-- +-- Name: scoreset_contributors; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.scoreset_contributors ( + scoreset_id integer NOT NULL, + contributor_id integer NOT NULL +); + + +-- +-- Name: scoreset_doi_identifiers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.scoreset_doi_identifiers ( + scoreset_id integer NOT NULL, + doi_identifier_id integer NOT NULL +); + + +-- +-- Name: scoreset_keywords; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.scoreset_keywords ( + scoreset_id integer NOT NULL, + keyword_id integer NOT NULL +); + + +-- +-- Name: scoreset_meta_analysis_sources; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.scoreset_meta_analysis_sources ( + source_scoreset_id integer NOT NULL, + meta_analysis_scoreset_id integer NOT NULL +); + + +-- +-- Name: scoreset_publication_identifiers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.scoreset_publication_identifiers ( + scoreset_id integer NOT NULL, + publication_identifier_id integer NOT NULL, + "primary" boolean +); + + +-- +-- Name: scoreset_sra_identifiers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.scoreset_sra_identifiers ( + scoreset_id integer NOT NULL, + sra_identifier_id integer NOT NULL +); + + +-- +-- Name: scoresets_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.scoresets_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: scoresets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.scoresets_id_seq OWNED BY public.scoresets.id; + + +-- +-- Name: sra_identifiers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.sra_identifiers ( + id integer NOT NULL, + identifier character varying NOT NULL, + db_name character varying NOT NULL, + db_version character varying, + url character varying, + creation_date date NOT NULL, + modification_date date NOT NULL +); + + +-- +-- Name: sra_identifiers_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.sra_identifiers_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: sra_identifiers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.sra_identifiers_id_seq OWNED BY public.sra_identifiers.id; + + +-- +-- Name: target_accessions; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.target_accessions ( + id integer NOT NULL, + assembly character varying, + accession character varying NOT NULL, + creation_date date NOT NULL, + modification_date date NOT NULL, + gene character varying, + is_base_editor boolean DEFAULT false NOT NULL +); + + +-- +-- Name: target_accessions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.target_accessions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: target_accessions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.target_accessions_id_seq OWNED BY public.target_accessions.id; + + +-- +-- Name: target_gene_mappings; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.target_gene_mappings ( + id integer NOT NULL, + target_gene_id integer NOT NULL, + alignment_level character varying(16) NOT NULL, + preferred boolean DEFAULT false NOT NULL, + reference_assembly character varying, + reference_accession character varying, + reference_sequence_id character varying, + alignment_score double precision, + next_best_alignment_score double precision, + alignment_length integer, + alignment_string character varying, + mismatch_count integer, + gap_count integer, + percent_identity double precision, + total_variants integer, + variants_failed integer, + variants_with_alignment_warnings integer, + variants_mapped_cleanly integer, + tool_name character varying DEFAULT 'dcd-mapping'::character varying NOT NULL, + tool_version character varying NOT NULL, + tool_parameters jsonb, + alignment_metadata jsonb, + vrs_version character varying, + mapped_date date, + creation_date date NOT NULL, + modification_date date NOT NULL, + job_run_id integer, + CONSTRAINT ck_target_gene_mappings_alignment_level_valid CHECK (((alignment_level)::text = ANY ((ARRAY['protein'::character varying, 'cdna'::character varying, 'genomic'::character varying])::text[]))) +); + + +-- +-- Name: target_gene_mappings_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.target_gene_mappings_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: target_gene_mappings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.target_gene_mappings_id_seq OWNED BY public.target_gene_mappings.id; + + +-- +-- Name: target_genes; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.target_genes ( + id integer NOT NULL, + name character varying NOT NULL, + category character varying(32) NOT NULL, + scoreset_id integer NOT NULL, + target_sequence_id integer, + creation_date date NOT NULL, + modification_date date NOT NULL, + accession_id integer, + pre_mapped_metadata jsonb, + post_mapped_metadata jsonb, + uniprot_id_from_mapped_metadata character varying, + mapped_hgnc_name character varying, + CONSTRAINT targetcategory CHECK (((category)::text = ANY ((ARRAY['protein_coding'::character varying, 'other_noncoding'::character varying, 'regulatory'::character varying])::text[]))) +); + + +-- +-- Name: target_genes_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.target_genes_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: target_genes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.target_genes_id_seq OWNED BY public.target_genes.id; + + +-- +-- Name: target_sequences; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.target_sequences ( + id integer NOT NULL, + sequence_type character varying NOT NULL, + sequence character varying NOT NULL, + creation_date date NOT NULL, + modification_date date NOT NULL, + label character varying, + taxonomy_id integer +); + + +-- +-- Name: target_sequences_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.target_sequences_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: target_sequences_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.target_sequences_id_seq OWNED BY public.target_sequences.id; + + +-- +-- Name: taxonomies; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.taxonomies ( + id integer NOT NULL, + code integer NOT NULL, + organism_name character varying, + common_name character varying, + rank character varying, + has_described_species_name boolean, + url character varying NOT NULL, + article_reference character varying, + genome_identifier_id integer, + creation_date date NOT NULL, + modification_date date NOT NULL +); + + +-- +-- Name: taxonomies_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.taxonomies_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: taxonomies_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.taxonomies_id_seq OWNED BY public.taxonomies.id; + + +-- +-- Name: uniprot_identifiers; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.uniprot_identifiers ( + id integer NOT NULL, + identifier character varying NOT NULL, + db_name character varying NOT NULL, + db_version character varying, + url character varying, + reference_html character varying, + creation_date date NOT NULL, + modification_date date NOT NULL +); + + +-- +-- Name: uniprot_identifiers_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.uniprot_identifiers_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: uniprot_identifiers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.uniprot_identifiers_id_seq OWNED BY public.uniprot_identifiers.id; + + +-- +-- Name: uniprot_offsets; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.uniprot_offsets ( + identifier_id integer NOT NULL, + target_gene_id integer NOT NULL, + "offset" integer NOT NULL +); + + +-- +-- Name: urn_redirects; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.urn_redirects ( + id integer NOT NULL, + old_urn character varying(64) NOT NULL, + new_urn character varying(64) NOT NULL, + created_at timestamp with time zone DEFAULT now() NOT NULL +); + + +-- +-- Name: urn_redirects_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.urn_redirects_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: urn_redirects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.urn_redirects_id_seq OWNED BY public.urn_redirects.id; + + +-- +-- Name: users; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.users ( + id integer NOT NULL, + username character varying NOT NULL, + first_name character varying, + last_name character varying, + is_superuser boolean NOT NULL, + is_staff boolean NOT NULL, + is_active boolean NOT NULL, + date_joined timestamp without time zone, + email character varying, + last_login timestamp without time zone, + is_first_login boolean DEFAULT false NOT NULL +); + + +-- +-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.users_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id; + + +-- +-- Name: users_roles; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.users_roles ( + user_id integer NOT NULL, + role_id integer NOT NULL +); + + +-- +-- Name: v_current_annotation_events; Type: VIEW; Schema: public; Owner: - +-- + +CREATE VIEW public.v_current_annotation_events AS + SELECT ranked_annotation_events.id, + ranked_annotation_events.annotation_type, + ranked_annotation_events.variant_id, + ranked_annotation_events.allele_id, + ranked_annotation_events.disposition, + ranked_annotation_events.reason, + ranked_annotation_events.source_version, + ranked_annotation_events.event_metadata, + ranked_annotation_events.job_run_id, + ranked_annotation_events.created_at + FROM ( SELECT annotation_event.id, + annotation_event.annotation_type, + annotation_event.variant_id, + annotation_event.allele_id, + annotation_event.disposition, + annotation_event.reason, + annotation_event.source_version, + annotation_event.metadata AS event_metadata, + annotation_event.job_run_id, + annotation_event.created_at, + row_number() OVER (PARTITION BY annotation_event.allele_id, annotation_event.variant_id, annotation_event.annotation_type, + CASE + WHEN ((annotation_event.annotation_type)::text = 'clinvar_control'::text) THEN annotation_event.source_version + ELSE NULL::character varying + END ORDER BY annotation_event.id DESC) AS row_number + FROM public.annotation_event) ranked_annotation_events + WHERE (ranked_annotation_events.row_number = 1); + + +-- +-- Name: variant_annotation_status; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.variant_annotation_status ( + id integer NOT NULL, + variant_id integer NOT NULL, + annotation_type character varying(50) NOT NULL, + version character varying(50), + status character varying(50) NOT NULL, + error_message text, + failure_category character varying(100), + annotation_metadata jsonb, + current boolean DEFAULT true NOT NULL, + job_run_id integer, + created_at timestamp with time zone DEFAULT now() NOT NULL, + updated_at timestamp with time zone DEFAULT now() NOT NULL, + CONSTRAINT ck_variant_annotation_failure_category_valid CHECK (((failure_category IS NULL) OR ((failure_category)::text = ANY ((ARRAY['missing_identifier'::character varying, 'unsupported_identifier'::character varying, 'external_api_error'::character varying, 'external_service_rejected'::character varying, 'external_reference_not_found'::character varying, 'no_linked_allele'::character varying, 'unknown'::character varying])::text[])))), + CONSTRAINT ck_variant_annotation_status_valid CHECK (((status)::text = ANY ((ARRAY['success'::character varying, 'failed'::character varying, 'skipped'::character varying])::text[]))), + CONSTRAINT ck_variant_annotation_type_valid CHECK (((annotation_type)::text = ANY ((ARRAY['vrs_mapping'::character varying, 'cross_level_translation'::character varying, 'clingen_allele_id'::character varying, 'mapped_hgvs'::character varying, 'variant_translation'::character varying, 'gnomad_allele_frequency'::character varying, 'clinvar_control'::character varying, 'vep_functional_consequence'::character varying, 'ldh_submission'::character varying])::text[]))) +); + + +-- +-- Name: COLUMN variant_annotation_status.annotation_type; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN public.variant_annotation_status.annotation_type IS 'Type of annotation: vrs, clinvar, gnomad, etc.'; + + +-- +-- Name: COLUMN variant_annotation_status.version; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN public.variant_annotation_status.version IS 'Version of the annotation source used (if applicable)'; + + +-- +-- Name: COLUMN variant_annotation_status.status; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN public.variant_annotation_status.status IS 'success, failed, skipped, pending'; + + +-- +-- Name: COLUMN variant_annotation_status.annotation_metadata; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN public.variant_annotation_status.annotation_metadata IS 'Structured metadata for the annotation result'; + + +-- +-- Name: COLUMN variant_annotation_status.current; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON COLUMN public.variant_annotation_status.current IS 'Whether this is the current status for the variant and annotation type'; + + +-- +-- Name: vep_allele_consequences; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.vep_allele_consequences ( + id integer NOT NULL, + allele_id integer NOT NULL, + functional_consequence character varying, + source_version character varying NOT NULL, + access_date date NOT NULL, + valid_from timestamp with time zone DEFAULT now() NOT NULL, + valid_to timestamp with time zone, + consequence_terms jsonb, + consequence_source character varying(32), + matched_transcript character varying, + resolver_version character varying, + CONSTRAINT vepconsequencesource CHECK (((consequence_source)::text = ANY ((ARRAY['transcript'::character varying, 'most_severe'::character varying, 'reference_identical'::character varying])::text[]))) +); + + +-- +-- Name: v_variant_annotations; Type: VIEW; Schema: public; Owner: - +-- + +CREATE VIEW public.v_variant_annotations AS + SELECT variants.urn AS variant_urn, + scoresets.urn AS score_set_urn, + variants.hgvs_nt, + variants.hgvs_pro, + variants.hgvs_splice, + mapping_records.id AS mapping_record_id, + ( SELECT alleles.clingen_allele_id + FROM (public.mapping_record_alleles + JOIN public.alleles ON ((alleles.id = mapping_record_alleles.allele_id))) + WHERE ((mapping_record_alleles.mapping_record_id = mapping_records.id) AND (mapping_record_alleles.is_authoritative IS TRUE) AND (mapping_record_alleles.valid_to IS NULL)) + LIMIT 1) AS clingen_allele_id, + mapping_records.hgvs_assay_level, + ( SELECT alleles.hgvs_g + FROM (public.mapping_record_alleles + JOIN public.alleles ON ((alleles.id = mapping_record_alleles.allele_id))) + WHERE ((mapping_record_alleles.mapping_record_id = mapping_records.id) AND (mapping_record_alleles.valid_to IS NULL) AND ((alleles.level)::text = 'genomic'::text)) + LIMIT 1) AS hgvs_g, + ( SELECT alleles.hgvs_c + FROM (public.mapping_record_alleles + JOIN public.alleles ON ((alleles.id = mapping_record_alleles.allele_id))) + WHERE ((mapping_record_alleles.mapping_record_id = mapping_records.id) AND (mapping_record_alleles.valid_to IS NULL) AND ((alleles.level)::text = 'cdna'::text)) + LIMIT 1) AS hgvs_c, + ( SELECT alleles.hgvs_p + FROM (public.mapping_record_alleles + JOIN public.alleles ON ((alleles.id = mapping_record_alleles.allele_id))) + WHERE ((mapping_record_alleles.mapping_record_id = mapping_records.id) AND (mapping_record_alleles.valid_to IS NULL) AND ((alleles.level)::text = 'protein'::text)) + LIMIT 1) AS hgvs_p, + ( SELECT vep_allele_consequences.functional_consequence + FROM ((public.mapping_record_alleles + JOIN public.alleles ON ((alleles.id = mapping_record_alleles.allele_id))) + JOIN public.vep_allele_consequences ON (((vep_allele_consequences.allele_id = alleles.id) AND (vep_allele_consequences.valid_to IS NULL)))) + WHERE ((mapping_record_alleles.mapping_record_id = mapping_records.id) AND (mapping_record_alleles.is_authoritative IS TRUE) AND (mapping_record_alleles.valid_to IS NULL)) + LIMIT 1) AS vep_functional_consequence, + ( SELECT vep_allele_consequences.access_date + FROM ((public.mapping_record_alleles + JOIN public.alleles ON ((alleles.id = mapping_record_alleles.allele_id))) + JOIN public.vep_allele_consequences ON (((vep_allele_consequences.allele_id = alleles.id) AND (vep_allele_consequences.valid_to IS NULL)))) + WHERE ((mapping_record_alleles.mapping_record_id = mapping_records.id) AND (mapping_record_alleles.is_authoritative IS TRUE) AND (mapping_record_alleles.valid_to IS NULL)) + LIMIT 1) AS vep_access_date, + mapping_records.mapped_date, + mapping_records.mapping_api_version, + mapping_records.vrs_version, + variant_annotation_status.annotation_type, + variant_annotation_status.status AS annotation_status, + variant_annotation_status.failure_category, + variant_annotation_status.error_message AS annotation_error, + variant_annotation_status.version AS annotation_version, + variant_annotation_status.annotation_metadata, + variant_annotation_status.current, + variant_annotation_status.created_at AS annotation_created_at, + variant_annotation_status.updated_at AS annotation_updated_at + FROM (((public.variants + JOIN public.scoresets ON ((scoresets.id = variants.scoreset_id))) + LEFT JOIN public.mapping_records ON (((mapping_records.variant_id = variants.id) AND (mapping_records.valid_to IS NULL)))) + LEFT JOIN public.variant_annotation_status ON (((variant_annotation_status.variant_id = variants.id) AND (variant_annotation_status.current = true)))); + + +-- +-- Name: variant_annotation_status_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.variant_annotation_status_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: variant_annotation_status_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.variant_annotation_status_id_seq OWNED BY public.variant_annotation_status.id; + + +-- +-- Name: variant_translations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.variant_translations ( + aa_clingen_id character varying NOT NULL, + nt_clingen_id character varying NOT NULL, + creation_date date NOT NULL, + modification_date date NOT NULL +); + + +-- +-- Name: variants_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.variants_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: variants_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.variants_id_seq OWNED BY public.variants.id; + + +-- +-- Name: variants_to_sync; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.variants_to_sync ( + variant_id integer, + variant_urn text, + hgvs_nt text, + hgvs_pro text, + hgvs_splice text, + score_set_urn text +); + + +-- +-- Name: vep_allele_consequences_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.vep_allele_consequences_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: vep_allele_consequences_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.vep_allele_consequences_id_seq OWNED BY public.vep_allele_consequences.id; + + +-- +-- Name: vep_functional_consequence_archive; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.vep_functional_consequence_archive ( + mapped_variant_id integer NOT NULL, + vep_functional_consequence character varying, + vep_access_date date, + cleared_at timestamp with time zone +); + + +-- +-- Name: access_keys id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.access_keys ALTER COLUMN id SET DEFAULT nextval('public.access_keys_id_seq'::regclass); + + +-- +-- Name: acmg_classifications id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.acmg_classifications ALTER COLUMN id SET DEFAULT nextval('public.acmg_classifications_id_seq'::regclass); + + +-- +-- Name: alleles id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.alleles ALTER COLUMN id SET DEFAULT nextval('public.alleles_id_seq'::regclass); + + +-- +-- Name: annotation_event id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.annotation_event ALTER COLUMN id SET DEFAULT nextval('public.annotation_event_id_seq'::regclass); + + +-- +-- Name: calibration_controls id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.calibration_controls ALTER COLUMN id SET DEFAULT nextval('public.calibration_controls_id_seq'::regclass); + + +-- +-- Name: clinvar_allele_links id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.clinvar_allele_links ALTER COLUMN id SET DEFAULT nextval('public.clinvar_allele_links_id_seq'::regclass); + + +-- +-- Name: clinvar_controls id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.clinvar_controls ALTER COLUMN id SET DEFAULT nextval('public.clinical_controls_id_seq'::regclass); + + +-- +-- Name: collections id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.collections ALTER COLUMN id SET DEFAULT nextval('public.collections_id_seq'::regclass); + + +-- +-- Name: contributors id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.contributors ALTER COLUMN id SET DEFAULT nextval('public.contributors_id_seq'::regclass); + + +-- +-- Name: controlled_keywords id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.controlled_keywords ALTER COLUMN id SET DEFAULT nextval('public.controlled_keywords_id_seq'::regclass); + + +-- +-- Name: doi_identifiers id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.doi_identifiers ALTER COLUMN id SET DEFAULT nextval('public.doi_identifiers_id_seq'::regclass); + + +-- +-- Name: ensembl_identifiers id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.ensembl_identifiers ALTER COLUMN id SET DEFAULT nextval('public.ensembl_identifiers_id_seq'::regclass); + + +-- +-- Name: experiment_sets id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_sets ALTER COLUMN id SET DEFAULT nextval('public.experiment_sets_id_seq'::regclass); + + +-- +-- Name: experiments id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiments ALTER COLUMN id SET DEFAULT nextval('public.experiments_id_seq'::regclass); + + +-- +-- Name: genome_identifiers id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.genome_identifiers ALTER COLUMN id SET DEFAULT nextval('public.genome_identifiers_id_seq'::regclass); + + +-- +-- Name: gnomad_allele_links id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gnomad_allele_links ALTER COLUMN id SET DEFAULT nextval('public.gnomad_allele_links_id_seq'::regclass); + + +-- +-- Name: gnomad_variants id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gnomad_variants ALTER COLUMN id SET DEFAULT nextval('public.gnomad_variants_id_seq'::regclass); + + +-- +-- Name: job_runs id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.job_runs ALTER COLUMN id SET DEFAULT nextval('public.job_runs_id_seq'::regclass); + + +-- +-- Name: keywords id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.keywords ALTER COLUMN id SET DEFAULT nextval('public.keywords_id_seq'::regclass); + + +-- +-- Name: licenses id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.licenses ALTER COLUMN id SET DEFAULT nextval('public.licenses_id_seq'::regclass); + + +-- +-- Name: mapped_variants id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mapped_variants ALTER COLUMN id SET DEFAULT nextval('public.mapped_variants_id_seq'::regclass); + + +-- +-- Name: mapping_record_alleles id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mapping_record_alleles ALTER COLUMN id SET DEFAULT nextval('public.mapping_record_alleles_id_seq'::regclass); + + +-- +-- Name: mapping_records id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mapping_records ALTER COLUMN id SET DEFAULT nextval('public.mapping_records_id_seq'::regclass); + + +-- +-- Name: mondo_terms id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mondo_terms ALTER COLUMN id SET DEFAULT nextval('public.mondo_terms_id_seq'::regclass); + + +-- +-- Name: pipelines id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.pipelines ALTER COLUMN id SET DEFAULT nextval('public.pipelines_id_seq'::regclass); + + +-- +-- Name: projection_groups id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.projection_groups ALTER COLUMN id SET DEFAULT nextval('public.projection_groups_id_seq'::regclass); + + +-- +-- Name: publication_identifiers id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.publication_identifiers ALTER COLUMN id SET DEFAULT nextval('public.publication_identifiers_id_seq'::regclass); + + +-- +-- Name: refseq_identifiers id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.refseq_identifiers ALTER COLUMN id SET DEFAULT nextval('public.refseq_identifiers_id_seq'::regclass); + + +-- +-- Name: roles id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.roles ALTER COLUMN id SET DEFAULT nextval('public.roles_id_seq'::regclass); + + +-- +-- Name: score_calibration_functional_classifications id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.score_calibration_functional_classifications ALTER COLUMN id SET DEFAULT nextval('public.score_calibration_functional_classifications_id_seq'::regclass); + + +-- +-- Name: score_calibrations id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.score_calibrations ALTER COLUMN id SET DEFAULT nextval('public.score_calibrations_id_seq'::regclass); + + +-- +-- Name: scoresets id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoresets ALTER COLUMN id SET DEFAULT nextval('public.scoresets_id_seq'::regclass); + + +-- +-- Name: sra_identifiers id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.sra_identifiers ALTER COLUMN id SET DEFAULT nextval('public.sra_identifiers_id_seq'::regclass); + + +-- +-- Name: target_accessions id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.target_accessions ALTER COLUMN id SET DEFAULT nextval('public.target_accessions_id_seq'::regclass); + + +-- +-- Name: target_gene_mappings id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.target_gene_mappings ALTER COLUMN id SET DEFAULT nextval('public.target_gene_mappings_id_seq'::regclass); + + +-- +-- Name: target_genes id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.target_genes ALTER COLUMN id SET DEFAULT nextval('public.target_genes_id_seq'::regclass); + + +-- +-- Name: target_sequences id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.target_sequences ALTER COLUMN id SET DEFAULT nextval('public.target_sequences_id_seq'::regclass); + + +-- +-- Name: taxonomies id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.taxonomies ALTER COLUMN id SET DEFAULT nextval('public.taxonomies_id_seq'::regclass); + + +-- +-- Name: uniprot_identifiers id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.uniprot_identifiers ALTER COLUMN id SET DEFAULT nextval('public.uniprot_identifiers_id_seq'::regclass); + + +-- +-- Name: urn_redirects id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.urn_redirects ALTER COLUMN id SET DEFAULT nextval('public.urn_redirects_id_seq'::regclass); + + +-- +-- Name: users id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); + + +-- +-- Name: variant_annotation_status id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.variant_annotation_status ALTER COLUMN id SET DEFAULT nextval('public.variant_annotation_status_id_seq'::regclass); + + +-- +-- Name: variants id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.variants ALTER COLUMN id SET DEFAULT nextval('public.variants_id_seq'::regclass); + + +-- +-- Name: vep_allele_consequences id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.vep_allele_consequences ALTER COLUMN id SET DEFAULT nextval('public.vep_allele_consequences_id_seq'::regclass); + + +-- +-- Name: access_keys access_keys_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.access_keys + ADD CONSTRAINT access_keys_pkey PRIMARY KEY (id); + + +-- +-- Name: acmg_classifications acmg_classifications_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.acmg_classifications + ADD CONSTRAINT acmg_classifications_pkey PRIMARY KEY (id); + + +-- +-- Name: alleles alleles_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.alleles + ADD CONSTRAINT alleles_pkey PRIMARY KEY (id); + + +-- +-- Name: annotation_event annotation_event_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.annotation_event + ADD CONSTRAINT annotation_event_pkey PRIMARY KEY (id); + + +-- +-- Name: calibration_controls calibration_controls_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.calibration_controls + ADD CONSTRAINT calibration_controls_pkey PRIMARY KEY (id); + + +-- +-- Name: clinvar_controls clinical_controls_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.clinvar_controls + ADD CONSTRAINT clinical_controls_pkey PRIMARY KEY (id); + + +-- +-- Name: clinvar_allele_links clinvar_allele_links_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.clinvar_allele_links + ADD CONSTRAINT clinvar_allele_links_pkey PRIMARY KEY (id); + + +-- +-- Name: collection_experiments collection_experiments_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.collection_experiments + ADD CONSTRAINT collection_experiments_pkey PRIMARY KEY (collection_id, experiment_id); + + +-- +-- Name: collection_score_sets collection_score_sets_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.collection_score_sets + ADD CONSTRAINT collection_score_sets_pkey PRIMARY KEY (collection_id, score_set_id); + + +-- +-- Name: collection_user_associations collection_user_associations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.collection_user_associations + ADD CONSTRAINT collection_user_associations_pkey PRIMARY KEY (collection_id, user_id); + + +-- +-- Name: collections collections_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.collections + ADD CONSTRAINT collections_pkey PRIMARY KEY (id); + + +-- +-- Name: contributors contributors_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.contributors + ADD CONSTRAINT contributors_pkey PRIMARY KEY (id); + + +-- +-- Name: controlled_keywords controlled_keywords_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.controlled_keywords + ADD CONSTRAINT controlled_keywords_pkey PRIMARY KEY (id); + + +-- +-- Name: doi_identifiers doi_identifiers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.doi_identifiers + ADD CONSTRAINT doi_identifiers_pkey PRIMARY KEY (id); + + +-- +-- Name: ensembl_identifiers ensembl_identifiers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.ensembl_identifiers + ADD CONSTRAINT ensembl_identifiers_pkey PRIMARY KEY (id); + + +-- +-- Name: ensembl_offsets ensembl_offsets_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.ensembl_offsets + ADD CONSTRAINT ensembl_offsets_pkey PRIMARY KEY (identifier_id, target_gene_id); + + +-- +-- Name: experiment_contributors experiment_contributors_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_contributors + ADD CONSTRAINT experiment_contributors_pkey PRIMARY KEY (experiment_id, contributor_id); + + +-- +-- Name: experiment_controlled_keywords experiment_controlled_keywords_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_controlled_keywords + ADD CONSTRAINT experiment_controlled_keywords_pkey PRIMARY KEY (experiment_id, controlled_keyword_id); + + +-- +-- Name: experiment_doi_identifiers experiment_doi_identifiers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_doi_identifiers + ADD CONSTRAINT experiment_doi_identifiers_pkey PRIMARY KEY (experiment_id, doi_identifier_id); + + +-- +-- Name: experiment_keywords experiment_keywords_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_keywords + ADD CONSTRAINT experiment_keywords_pkey PRIMARY KEY (experiment_id, keyword_id); + + +-- +-- Name: experiment_publication_identifiers experiment_publication_identifiers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_publication_identifiers + ADD CONSTRAINT experiment_publication_identifiers_pkey PRIMARY KEY (experiment_id, publication_identifier_id); + + +-- +-- Name: experiment_set_contributors experiment_set_contributors_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_set_contributors + ADD CONSTRAINT experiment_set_contributors_pkey PRIMARY KEY (experiment_set_id, contributor_id); + + +-- +-- Name: experiment_set_doi_identifiers experiment_set_doi_identifiers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_set_doi_identifiers + ADD CONSTRAINT experiment_set_doi_identifiers_pkey PRIMARY KEY (experiment_set_id, doi_identifier_id); + + +-- +-- Name: experiment_set_keywords experiment_set_keywords_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_set_keywords + ADD CONSTRAINT experiment_set_keywords_pkey PRIMARY KEY (experiment_set_id, keyword_id); + + +-- +-- Name: experiment_set_publication_identifiers experiment_set_publication_identifiers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_set_publication_identifiers + ADD CONSTRAINT experiment_set_publication_identifiers_pkey PRIMARY KEY (experiment_set_id, publication_identifier_id); + + +-- +-- Name: experiment_set_sra_identifiers experiment_set_sra_identifiers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_set_sra_identifiers + ADD CONSTRAINT experiment_set_sra_identifiers_pkey PRIMARY KEY (experiment_set_id, sra_identifier_id); + + +-- +-- Name: experiment_sets experiment_sets_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_sets + ADD CONSTRAINT experiment_sets_pkey PRIMARY KEY (id); + + +-- +-- Name: experiment_sra_identifiers experiment_sra_identifiers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_sra_identifiers + ADD CONSTRAINT experiment_sra_identifiers_pkey PRIMARY KEY (experiment_id, sra_identifier_id); + + +-- +-- Name: experiments experiments_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiments + ADD CONSTRAINT experiments_pkey PRIMARY KEY (id); + + +-- +-- Name: genome_identifiers genome_identifiers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.genome_identifiers + ADD CONSTRAINT genome_identifiers_pkey PRIMARY KEY (id); + + +-- +-- Name: gnomad_allele_links gnomad_allele_links_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gnomad_allele_links + ADD CONSTRAINT gnomad_allele_links_pkey PRIMARY KEY (id); + + +-- +-- Name: gnomad_variants_mapped_variants gnomad_variants_mapped_variants_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gnomad_variants_mapped_variants + ADD CONSTRAINT gnomad_variants_mapped_variants_pkey PRIMARY KEY (mapped_variant_id, gnomad_variant_id); + + +-- +-- Name: gnomad_variants gnomad_variants_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gnomad_variants + ADD CONSTRAINT gnomad_variants_pkey PRIMARY KEY (id); + + +-- +-- Name: controlled_keywords ix_controlled_keywords_key_label; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.controlled_keywords + ADD CONSTRAINT ix_controlled_keywords_key_label UNIQUE (key, label); + + +-- +-- Name: job_dependencies job_dependencies_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.job_dependencies + ADD CONSTRAINT job_dependencies_pkey PRIMARY KEY (id, depends_on_job_id); + + +-- +-- Name: job_runs job_runs_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.job_runs + ADD CONSTRAINT job_runs_pkey PRIMARY KEY (id); + + +-- +-- Name: job_runs job_runs_urn_key; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.job_runs + ADD CONSTRAINT job_runs_urn_key UNIQUE (urn); + + +-- +-- Name: keywords keywords_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.keywords + ADD CONSTRAINT keywords_pkey PRIMARY KEY (id); + + +-- +-- Name: keywords keywords_text_key; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.keywords + ADD CONSTRAINT keywords_text_key UNIQUE (text); + + +-- +-- Name: licenses licenses_long_name_key; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.licenses + ADD CONSTRAINT licenses_long_name_key UNIQUE (long_name); + + +-- +-- Name: licenses licenses_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.licenses + ADD CONSTRAINT licenses_pkey PRIMARY KEY (id); + + +-- +-- Name: licenses licenses_short_name_key; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.licenses + ADD CONSTRAINT licenses_short_name_key UNIQUE (short_name); + + +-- +-- Name: mapped_variants_clinical_controls mapped_variants_clinical_controls_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mapped_variants_clinical_controls + ADD CONSTRAINT mapped_variants_clinical_controls_pkey PRIMARY KEY (mapped_variant_id, clinical_control_id); + + +-- +-- Name: mapped_variants mapped_variants_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mapped_variants + ADD CONSTRAINT mapped_variants_pkey PRIMARY KEY (id); + + +-- +-- Name: mapping_record_alleles mapping_record_alleles_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mapping_record_alleles + ADD CONSTRAINT mapping_record_alleles_pkey PRIMARY KEY (id); + + +-- +-- Name: mapping_records mapping_records_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mapping_records + ADD CONSTRAINT mapping_records_pkey PRIMARY KEY (id); + + +-- +-- Name: mondo_terms mondo_terms_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mondo_terms + ADD CONSTRAINT mondo_terms_pkey PRIMARY KEY (id); + + +-- +-- Name: pipelines pipelines_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.pipelines + ADD CONSTRAINT pipelines_pkey PRIMARY KEY (id); + + +-- +-- Name: pipelines pipelines_urn_key; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.pipelines + ADD CONSTRAINT pipelines_urn_key UNIQUE (urn); + + +-- +-- Name: projection_groups projection_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.projection_groups + ADD CONSTRAINT projection_groups_pkey PRIMARY KEY (id); + + +-- +-- Name: publication_identifiers publication_identifiers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.publication_identifiers + ADD CONSTRAINT publication_identifiers_pkey PRIMARY KEY (id); + + +-- +-- Name: refseq_identifiers refseq_identifiers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.refseq_identifiers + ADD CONSTRAINT refseq_identifiers_pkey PRIMARY KEY (id); + + +-- +-- Name: refseq_offsets refseq_offsets_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.refseq_offsets + ADD CONSTRAINT refseq_offsets_pkey PRIMARY KEY (identifier_id, target_gene_id); + + +-- +-- Name: roles roles_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.roles + ADD CONSTRAINT roles_pkey PRIMARY KEY (id); + + +-- +-- Name: score_calibration_functional_classification_variants score_calibration_functional_classification_variants_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.score_calibration_functional_classification_variants + ADD CONSTRAINT score_calibration_functional_classification_variants_pkey PRIMARY KEY (functional_classification_id, variant_id); + + +-- +-- Name: score_calibration_functional_classifications score_calibration_functional_classifications_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.score_calibration_functional_classifications + ADD CONSTRAINT score_calibration_functional_classifications_pkey PRIMARY KEY (id); + + +-- +-- Name: score_calibration_publication_identifiers score_calibration_publication_identifiers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.score_calibration_publication_identifiers + ADD CONSTRAINT score_calibration_publication_identifiers_pkey PRIMARY KEY (score_calibration_id, publication_identifier_id, relation); + + +-- +-- Name: score_calibrations score_calibrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.score_calibrations + ADD CONSTRAINT score_calibrations_pkey PRIMARY KEY (id); + + +-- +-- Name: scoreset_contributors scoreset_contributors_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoreset_contributors + ADD CONSTRAINT scoreset_contributors_pkey PRIMARY KEY (scoreset_id, contributor_id); + + +-- +-- Name: scoreset_doi_identifiers scoreset_doi_identifiers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoreset_doi_identifiers + ADD CONSTRAINT scoreset_doi_identifiers_pkey PRIMARY KEY (scoreset_id, doi_identifier_id); + + +-- +-- Name: scoreset_keywords scoreset_keywords_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoreset_keywords + ADD CONSTRAINT scoreset_keywords_pkey PRIMARY KEY (scoreset_id, keyword_id); + + +-- +-- Name: scoreset_meta_analysis_sources scoreset_meta_analysis_sources_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoreset_meta_analysis_sources + ADD CONSTRAINT scoreset_meta_analysis_sources_pkey PRIMARY KEY (source_scoreset_id, meta_analysis_scoreset_id); + + +-- +-- Name: scoreset_publication_identifiers scoreset_publication_identifiers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoreset_publication_identifiers + ADD CONSTRAINT scoreset_publication_identifiers_pkey PRIMARY KEY (scoreset_id, publication_identifier_id); + + +-- +-- Name: scoreset_sra_identifiers scoreset_sra_identifiers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoreset_sra_identifiers + ADD CONSTRAINT scoreset_sra_identifiers_pkey PRIMARY KEY (scoreset_id, sra_identifier_id); + + +-- +-- Name: scoresets scoresets_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoresets + ADD CONSTRAINT scoresets_pkey PRIMARY KEY (id); + + +-- +-- Name: sra_identifiers sra_identifiers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.sra_identifiers + ADD CONSTRAINT sra_identifiers_pkey PRIMARY KEY (id); + + +-- +-- Name: target_accessions target_accessions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.target_accessions + ADD CONSTRAINT target_accessions_pkey PRIMARY KEY (id); + + +-- +-- Name: target_gene_mappings target_gene_mappings_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.target_gene_mappings + ADD CONSTRAINT target_gene_mappings_pkey PRIMARY KEY (id); + + +-- +-- Name: target_genes target_genes_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.target_genes + ADD CONSTRAINT target_genes_pkey PRIMARY KEY (id); + + +-- +-- Name: target_sequences target_sequences_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.target_sequences + ADD CONSTRAINT target_sequences_pkey PRIMARY KEY (id); + + +-- +-- Name: taxonomies taxonomies_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.taxonomies + ADD CONSTRAINT taxonomies_pkey PRIMARY KEY (id); + + +-- +-- Name: uniprot_identifiers uniprot_identifiers_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.uniprot_identifiers + ADD CONSTRAINT uniprot_identifiers_pkey PRIMARY KEY (id); + + +-- +-- Name: uniprot_offsets uniprot_offsets_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.uniprot_offsets + ADD CONSTRAINT uniprot_offsets_pkey PRIMARY KEY (identifier_id, target_gene_id); + + +-- +-- Name: alleles uq_alleles_vrs_digest; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.alleles + ADD CONSTRAINT uq_alleles_vrs_digest UNIQUE (vrs_digest); + + +-- +-- Name: calibration_controls uq_calibration_controls_calibration_id_variant_id; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.calibration_controls + ADD CONSTRAINT uq_calibration_controls_calibration_id_variant_id UNIQUE (calibration_id, variant_id); + + +-- +-- Name: clinvar_controls uq_clinvar_controls_db_name_identifier_version; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.clinvar_controls + ADD CONSTRAINT uq_clinvar_controls_db_name_identifier_version UNIQUE (db_name, db_identifier, db_version); + + +-- +-- Name: mondo_terms uq_mondo_terms_system_code; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mondo_terms + ADD CONSTRAINT uq_mondo_terms_system_code UNIQUE (system, code); + + +-- +-- Name: urn_redirects urn_redirects_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.urn_redirects + ADD CONSTRAINT urn_redirects_pkey PRIMARY KEY (id); + + +-- +-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.users + ADD CONSTRAINT users_pkey PRIMARY KEY (id); + + +-- +-- Name: users_roles users_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.users_roles + ADD CONSTRAINT users_roles_pkey PRIMARY KEY (user_id, role_id); + + +-- +-- Name: variant_annotation_status variant_annotation_status_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.variant_annotation_status + ADD CONSTRAINT variant_annotation_status_pkey PRIMARY KEY (id); + + +-- +-- Name: variant_translations variant_translations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.variant_translations + ADD CONSTRAINT variant_translations_pkey PRIMARY KEY (aa_clingen_id, nt_clingen_id); + + +-- +-- Name: variants variants_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.variants + ADD CONSTRAINT variants_pkey PRIMARY KEY (id); + + +-- +-- Name: vep_allele_consequences vep_allele_consequences_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.vep_allele_consequences + ADD CONSTRAINT vep_allele_consequences_pkey PRIMARY KEY (id); + + +-- +-- Name: vep_functional_consequence_archive vep_functional_consequence_archive_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.vep_functional_consequence_archive + ADD CONSTRAINT vep_functional_consequence_archive_pkey PRIMARY KEY (mapped_variant_id); + + +-- +-- Name: idx_published_variants_materialized_view_ids; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX idx_published_variants_materialized_view_ids ON public.published_variants_materialized_view USING btree (mapping_record_id, variant_id, score_set_id); + + +-- +-- Name: ix_access_keys_key_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX ix_access_keys_key_id ON public.access_keys USING btree (key_id); + + +-- +-- Name: ix_access_keys_user_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_access_keys_user_id ON public.access_keys USING btree (user_id); + + +-- +-- Name: ix_alleles_clingen_allele_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_alleles_clingen_allele_id ON public.alleles USING btree (clingen_allele_id); + + +-- +-- Name: ix_alleles_level; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_alleles_level ON public.alleles USING btree (level); + + +-- +-- Name: ix_alleles_vrs_digest; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_alleles_vrs_digest ON public.alleles USING btree (vrs_digest); + + +-- +-- Name: ix_annotation_event_allele_type_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_annotation_event_allele_type_id ON public.annotation_event USING btree (allele_id, annotation_type, id DESC); + + +-- +-- Name: ix_annotation_event_allele_type_version; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_annotation_event_allele_type_version ON public.annotation_event USING btree (allele_id, annotation_type, source_version); + + +-- +-- Name: ix_annotation_event_job_run_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_annotation_event_job_run_id ON public.annotation_event USING btree (job_run_id); + + +-- +-- Name: ix_annotation_event_score_set_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_annotation_event_score_set_id ON public.annotation_event USING btree (score_set_id); + + +-- +-- Name: ix_annotation_event_variant_type_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_annotation_event_variant_type_id ON public.annotation_event USING btree (variant_id, annotation_type, id DESC); + + +-- +-- Name: ix_calibration_controls_calibration_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_calibration_controls_calibration_id ON public.calibration_controls USING btree (calibration_id); + + +-- +-- Name: ix_calibration_controls_created_by_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_calibration_controls_created_by_id ON public.calibration_controls USING btree (created_by_id); + + +-- +-- Name: ix_calibration_controls_modified_by_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_calibration_controls_modified_by_id ON public.calibration_controls USING btree (modified_by_id); + + +-- +-- Name: ix_calibration_controls_variant_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_calibration_controls_variant_id ON public.calibration_controls USING btree (variant_id); + + +-- +-- Name: ix_clinical_controls_db_identifier; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_clinical_controls_db_identifier ON public.clinvar_controls USING btree (db_identifier); + + +-- +-- Name: ix_clinical_controls_db_name; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_clinical_controls_db_name ON public.clinvar_controls USING btree (db_name); + + +-- +-- Name: ix_clinical_controls_db_version; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_clinical_controls_db_version ON public.clinvar_controls USING btree (db_version); + + +-- +-- Name: ix_clinical_controls_gene_symbol; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_clinical_controls_gene_symbol ON public.clinvar_controls USING btree (gene_symbol); + + +-- +-- Name: ix_clinvar_allele_links_allele_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_clinvar_allele_links_allele_id ON public.clinvar_allele_links USING btree (allele_id); + + +-- +-- Name: ix_clinvar_allele_links_clinvar_control_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_clinvar_allele_links_clinvar_control_id ON public.clinvar_allele_links USING btree (clinvar_control_id); + + +-- +-- Name: ix_clinvar_variants_allele_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_clinvar_variants_allele_id ON public.clinvar_controls USING btree (db_identifier); + + +-- +-- Name: ix_collections_created_by_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_collections_created_by_id ON public.collections USING btree (created_by_id); + + +-- +-- Name: ix_collections_modified_by_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_collections_modified_by_id ON public.collections USING btree (modified_by_id); + + +-- +-- Name: ix_collections_urn; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX ix_collections_urn ON public.collections USING btree (urn); + + +-- +-- Name: ix_contributors_orcid_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX ix_contributors_orcid_id ON public.contributors USING btree (orcid_id); + + +-- +-- Name: ix_controlled_keywords_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_controlled_keywords_id ON public.controlled_keywords USING btree (id); + + +-- +-- Name: ix_experiment_sets_created_by_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_experiment_sets_created_by_id ON public.experiment_sets USING btree (created_by_id); + + +-- +-- Name: ix_experiment_sets_modified_by_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_experiment_sets_modified_by_id ON public.experiment_sets USING btree (modified_by_id); + + +-- +-- Name: ix_experiment_sets_urn; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX ix_experiment_sets_urn ON public.experiment_sets USING btree (urn); + + +-- +-- Name: ix_experiments_created_by_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_experiments_created_by_id ON public.experiments USING btree (created_by_id); + + +-- +-- Name: ix_experiments_experiment_set_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_experiments_experiment_set_id ON public.experiments USING btree (experiment_set_id); + + +-- +-- Name: ix_experiments_modified_by_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_experiments_modified_by_id ON public.experiments USING btree (modified_by_id); + + +-- +-- Name: ix_experiments_urn; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX ix_experiments_urn ON public.experiments USING btree (urn); + + +-- +-- Name: ix_gnomad_allele_links_allele_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_gnomad_allele_links_allele_id ON public.gnomad_allele_links USING btree (allele_id); + + +-- +-- Name: ix_gnomad_allele_links_gnomad_variant_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_gnomad_allele_links_gnomad_variant_id ON public.gnomad_allele_links USING btree (gnomad_variant_id); + + +-- +-- Name: ix_gnomad_variants_db_identifier; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_gnomad_variants_db_identifier ON public.gnomad_variants USING btree (db_identifier); + + +-- +-- Name: ix_job_dependencies_created_at; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_job_dependencies_created_at ON public.job_dependencies USING btree (created_at); + + +-- +-- Name: ix_job_dependencies_depends_on_job_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_job_dependencies_depends_on_job_id ON public.job_dependencies USING btree (depends_on_job_id); + + +-- +-- Name: ix_job_runs_correlation_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_job_runs_correlation_id ON public.job_runs USING btree (correlation_id); + + +-- +-- Name: ix_job_runs_created_at; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_job_runs_created_at ON public.job_runs USING btree (created_at); + + +-- +-- Name: ix_job_runs_job_type; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_job_runs_job_type ON public.job_runs USING btree (job_type); + + +-- +-- Name: ix_job_runs_pipeline_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_job_runs_pipeline_id ON public.job_runs USING btree (pipeline_id); + + +-- +-- Name: ix_job_runs_scheduled_at; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_job_runs_scheduled_at ON public.job_runs USING btree (scheduled_at); + + +-- +-- Name: ix_job_runs_status; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_job_runs_status ON public.job_runs USING btree (status); + + +-- +-- Name: ix_job_runs_status_progress_updated; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_job_runs_status_progress_updated ON public.job_runs USING btree (status, progress_updated_at); + + +-- +-- Name: ix_job_runs_status_scheduled; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_job_runs_status_scheduled ON public.job_runs USING btree (status, scheduled_at); + + +-- +-- Name: ix_mapped_variants_clingen_allele_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_mapped_variants_clingen_allele_id ON public.mapped_variants USING btree (clingen_allele_id); + + +-- +-- Name: ix_mapped_variants_post_mapped_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_mapped_variants_post_mapped_id ON public.mapped_variants USING btree (((post_mapped ->> 'id'::text))); + + +-- +-- Name: ix_mapped_variants_pre_mapped_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_mapped_variants_pre_mapped_id ON public.mapped_variants USING btree (((pre_mapped ->> 'id'::text))); + + +-- +-- Name: ix_mapped_variants_target_gene_mapping_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_mapped_variants_target_gene_mapping_id ON public.mapped_variants USING btree (target_gene_mapping_id); + + +-- +-- Name: ix_mapped_variants_variant_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_mapped_variants_variant_id ON public.mapped_variants USING btree (variant_id); + + +-- +-- Name: ix_mapping_record_alleles_allele_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_mapping_record_alleles_allele_id ON public.mapping_record_alleles USING btree (allele_id); + + +-- +-- Name: ix_mapping_record_alleles_mapping_record_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_mapping_record_alleles_mapping_record_id ON public.mapping_record_alleles USING btree (mapping_record_id); + + +-- +-- Name: ix_mapping_record_alleles_projection_group; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_mapping_record_alleles_projection_group ON public.mapping_record_alleles USING btree (projection_group); + + +-- +-- Name: ix_mapping_records_target_gene_mapping_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_mapping_records_target_gene_mapping_id ON public.mapping_records USING btree (target_gene_mapping_id); + + +-- +-- Name: ix_mapping_records_variant_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_mapping_records_variant_id ON public.mapping_records USING btree (variant_id); + + +-- +-- Name: ix_mapping_records_vrs_digest; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_mapping_records_vrs_digest ON public.mapping_records USING btree (vrs_digest); + + +-- +-- Name: ix_pipelines_correlation_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_pipelines_correlation_id ON public.pipelines USING btree (correlation_id); + + +-- +-- Name: ix_pipelines_created_at; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_pipelines_created_at ON public.pipelines USING btree (created_at); + + +-- +-- Name: ix_pipelines_created_by_user_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_pipelines_created_by_user_id ON public.pipelines USING btree (created_by_user_id); + + +-- +-- Name: ix_pipelines_status; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_pipelines_status ON public.pipelines USING btree (status); + + +-- +-- Name: ix_projection_groups_mapping_record_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_projection_groups_mapping_record_id ON public.projection_groups USING btree (mapping_record_id); + + +-- +-- Name: ix_score_calib_func_classification_variants_variant_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_score_calib_func_classification_variants_variant_id ON public.score_calibration_functional_classification_variants USING btree (variant_id); + + +-- +-- Name: ix_score_calibrations_created_by_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_score_calibrations_created_by_id ON public.score_calibrations USING btree (created_by_id); + + +-- +-- Name: ix_score_calibrations_disease_term_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_score_calibrations_disease_term_id ON public.score_calibrations USING btree (disease_term_id); + + +-- +-- Name: ix_score_calibrations_modified_by_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_score_calibrations_modified_by_id ON public.score_calibrations USING btree (modified_by_id); + + +-- +-- Name: ix_score_calibrations_urn; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX ix_score_calibrations_urn ON public.score_calibrations USING btree (urn); + + +-- +-- Name: ix_scoresets_created_by_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_scoresets_created_by_id ON public.scoresets USING btree (created_by_id); + + +-- +-- Name: ix_scoresets_experiment_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_scoresets_experiment_id ON public.scoresets USING btree (experiment_id); + + +-- +-- Name: ix_scoresets_licence_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_scoresets_licence_id ON public.scoresets USING btree (licence_id); + + +-- +-- Name: ix_scoresets_modified_by_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_scoresets_modified_by_id ON public.scoresets USING btree (modified_by_id); + + +-- +-- Name: ix_scoresets_replaces_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX ix_scoresets_replaces_id ON public.scoresets USING btree (replaces_id); + + +-- +-- Name: ix_scoresets_urn; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX ix_scoresets_urn ON public.scoresets USING btree (urn); + + +-- +-- Name: ix_target_gene_mappings_job_run_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_target_gene_mappings_job_run_id ON public.target_gene_mappings USING btree (job_run_id); + + +-- +-- Name: ix_target_gene_mappings_target_alignment; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_target_gene_mappings_target_alignment ON public.target_gene_mappings USING btree (target_gene_id, alignment_level); + + +-- +-- Name: ix_target_gene_mappings_target_gene_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_target_gene_mappings_target_gene_id ON public.target_gene_mappings USING btree (target_gene_id); + + +-- +-- Name: ix_target_genes_accession_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_target_genes_accession_id ON public.target_genes USING btree (accession_id); + + +-- +-- Name: ix_target_genes_scoreset_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_target_genes_scoreset_id ON public.target_genes USING btree (scoreset_id); + + +-- +-- Name: ix_target_genes_target_sequence_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_target_genes_target_sequence_id ON public.target_genes USING btree (target_sequence_id); + + +-- +-- Name: ix_target_sequences_taxonomy_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_target_sequences_taxonomy_id ON public.target_sequences USING btree (taxonomy_id); + + +-- +-- Name: ix_taxonomies_genome_identifier_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_taxonomies_genome_identifier_id ON public.taxonomies USING btree (genome_identifier_id); + + +-- +-- Name: ix_urn_redirects_old_urn; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX ix_urn_redirects_old_urn ON public.urn_redirects USING btree (old_urn); + + +-- +-- Name: ix_users_username; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX ix_users_username ON public.users USING btree (username); + + +-- +-- Name: ix_variant_annotation_status_job_run_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_variant_annotation_status_job_run_id ON public.variant_annotation_status USING btree (job_run_id); + + +-- +-- Name: ix_variant_annotation_status_variant_type_version_current; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_variant_annotation_status_variant_type_version_current ON public.variant_annotation_status USING btree (variant_id, annotation_type, version, current); + + +-- +-- Name: ix_variants_scoreset_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_variants_scoreset_id ON public.variants USING btree (scoreset_id); + + +-- +-- Name: ix_variants_scoreset_number; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_variants_scoreset_number ON public.variants USING btree (scoreset_id, ((split_part((urn)::text, '#'::text, 2))::integer), id); + + +-- +-- Name: ix_variants_urn; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX ix_variants_urn ON public.variants USING btree (urn); + + +-- +-- Name: ix_vep_allele_consequences_allele_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX ix_vep_allele_consequences_allele_id ON public.vep_allele_consequences USING btree (allele_id); + + +-- +-- Name: uq_alleles_hgvs; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX uq_alleles_hgvs ON public.alleles USING btree (COALESCE(hgvs_g, hgvs_c, hgvs_p)); + + +-- +-- Name: INDEX uq_alleles_hgvs; Type: COMMENT; Schema: public; Owner: - +-- + +COMMENT ON INDEX public.uq_alleles_hgvs IS 'One allele per HGVS expression. A violation means two writers disagree about the sequence an allele sits on (see mavedb.lib.variant_translations.AlleleIdentityConflictError).'; + + +-- +-- Name: uq_clinvar_allele_links_live; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX uq_clinvar_allele_links_live ON public.clinvar_allele_links USING btree (allele_id, clinvar_control_id) WHERE (valid_to IS NULL); + + +-- +-- Name: uq_gnomad_allele_links_live; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX uq_gnomad_allele_links_live ON public.gnomad_allele_links USING btree (allele_id) WHERE (valid_to IS NULL); + + +-- +-- Name: uq_mapping_record_alleles_live; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX uq_mapping_record_alleles_live ON public.mapping_record_alleles USING btree (mapping_record_id, allele_id) WHERE (valid_to IS NULL); + + +-- +-- Name: uq_mapping_record_alleles_live_authoritative; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX uq_mapping_record_alleles_live_authoritative ON public.mapping_record_alleles USING btree (mapping_record_id) WHERE (is_authoritative AND (valid_to IS NULL)); + + +-- +-- Name: uq_mapping_records_current; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX uq_mapping_records_current ON public.mapping_records USING btree (variant_id) WHERE (valid_to IS NULL); + + +-- +-- Name: uq_mapping_records_id_score_set; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX uq_mapping_records_id_score_set ON public.mapping_records USING btree (id, score_set_id); + + +-- +-- Name: uq_projection_groups_id_mapping_record; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX uq_projection_groups_id_mapping_record ON public.projection_groups USING btree (id, mapping_record_id); + + +-- +-- Name: uq_variants_id_scoreset; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX uq_variants_id_scoreset ON public.variants USING btree (id, scoreset_id); + + +-- +-- Name: uq_vep_allele_consequences_live; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX uq_vep_allele_consequences_live ON public.vep_allele_consequences USING btree (allele_id) WHERE (valid_to IS NULL); + + +-- +-- Name: access_keys access_key_roles_fk_constraint; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.access_keys + ADD CONSTRAINT access_key_roles_fk_constraint FOREIGN KEY (role_id) REFERENCES public.roles(id); + + +-- +-- Name: access_keys access_keys_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.access_keys + ADD CONSTRAINT access_keys_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); + + +-- +-- Name: annotation_event annotation_event_allele_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.annotation_event + ADD CONSTRAINT annotation_event_allele_id_fkey FOREIGN KEY (allele_id) REFERENCES public.alleles(id) ON DELETE RESTRICT; + + +-- +-- Name: annotation_event annotation_event_job_run_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.annotation_event + ADD CONSTRAINT annotation_event_job_run_id_fkey FOREIGN KEY (job_run_id) REFERENCES public.job_runs(id) ON DELETE SET NULL; + + +-- +-- Name: annotation_event annotation_event_score_set_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.annotation_event + ADD CONSTRAINT annotation_event_score_set_id_fkey FOREIGN KEY (score_set_id) REFERENCES public.scoresets(id) ON DELETE SET NULL; + + +-- +-- Name: annotation_event annotation_event_variant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.annotation_event + ADD CONSTRAINT annotation_event_variant_id_fkey FOREIGN KEY (variant_id) REFERENCES public.variants(id) ON DELETE CASCADE; + + +-- +-- Name: calibration_controls calibration_controls_calibration_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.calibration_controls + ADD CONSTRAINT calibration_controls_calibration_id_fkey FOREIGN KEY (calibration_id) REFERENCES public.score_calibrations(id) ON DELETE CASCADE; + + +-- +-- Name: calibration_controls calibration_controls_created_by_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.calibration_controls + ADD CONSTRAINT calibration_controls_created_by_id_fkey FOREIGN KEY (created_by_id) REFERENCES public.users(id); + + +-- +-- Name: calibration_controls calibration_controls_modified_by_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.calibration_controls + ADD CONSTRAINT calibration_controls_modified_by_id_fkey FOREIGN KEY (modified_by_id) REFERENCES public.users(id); + + +-- +-- Name: calibration_controls calibration_controls_variant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.calibration_controls + ADD CONSTRAINT calibration_controls_variant_id_fkey FOREIGN KEY (variant_id) REFERENCES public.variants(id); + + +-- +-- Name: collection_experiments collection_experiments_collection_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.collection_experiments + ADD CONSTRAINT collection_experiments_collection_id_fkey FOREIGN KEY (collection_id) REFERENCES public.collections(id); + + +-- +-- Name: collection_experiments collection_experiments_experiment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.collection_experiments + ADD CONSTRAINT collection_experiments_experiment_id_fkey FOREIGN KEY (experiment_id) REFERENCES public.experiments(id); + + +-- +-- Name: collection_score_sets collection_score_sets_collection_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.collection_score_sets + ADD CONSTRAINT collection_score_sets_collection_id_fkey FOREIGN KEY (collection_id) REFERENCES public.collections(id); + + +-- +-- Name: collection_score_sets collection_score_sets_score_set_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.collection_score_sets + ADD CONSTRAINT collection_score_sets_score_set_id_fkey FOREIGN KEY (score_set_id) REFERENCES public.scoresets(id); + + +-- +-- Name: collection_user_associations collection_user_associations_collection_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.collection_user_associations + ADD CONSTRAINT collection_user_associations_collection_id_fkey FOREIGN KEY (collection_id) REFERENCES public.collections(id); + + +-- +-- Name: collection_user_associations collection_user_associations_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.collection_user_associations + ADD CONSTRAINT collection_user_associations_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); + + +-- +-- Name: collections collections_created_by_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.collections + ADD CONSTRAINT collections_created_by_id_fkey FOREIGN KEY (created_by_id) REFERENCES public.users(id); + + +-- +-- Name: collections collections_modified_by_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.collections + ADD CONSTRAINT collections_modified_by_id_fkey FOREIGN KEY (modified_by_id) REFERENCES public.users(id); + + +-- +-- Name: ensembl_offsets ensembl_offsets_identifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.ensembl_offsets + ADD CONSTRAINT ensembl_offsets_identifier_id_fkey FOREIGN KEY (identifier_id) REFERENCES public.ensembl_identifiers(id); + + +-- +-- Name: ensembl_offsets ensembl_offsets_target_gene_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.ensembl_offsets + ADD CONSTRAINT ensembl_offsets_target_gene_id_fkey FOREIGN KEY (target_gene_id) REFERENCES public.target_genes(id); + + +-- +-- Name: experiment_contributors experiment_contributors_contributor_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_contributors + ADD CONSTRAINT experiment_contributors_contributor_id_fkey FOREIGN KEY (contributor_id) REFERENCES public.contributors(id); + + +-- +-- Name: experiment_contributors experiment_contributors_experiment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_contributors + ADD CONSTRAINT experiment_contributors_experiment_id_fkey FOREIGN KEY (experiment_id) REFERENCES public.experiments(id); + + +-- +-- Name: experiment_controlled_keywords experiment_controlled_keywords_controlled_keyword_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_controlled_keywords + ADD CONSTRAINT experiment_controlled_keywords_controlled_keyword_id_fkey FOREIGN KEY (controlled_keyword_id) REFERENCES public.controlled_keywords(id); + + +-- +-- Name: experiment_controlled_keywords experiment_controlled_keywords_experiment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_controlled_keywords + ADD CONSTRAINT experiment_controlled_keywords_experiment_id_fkey FOREIGN KEY (experiment_id) REFERENCES public.experiments(id); + + +-- +-- Name: experiment_doi_identifiers experiment_doi_identifiers_doi_identifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_doi_identifiers + ADD CONSTRAINT experiment_doi_identifiers_doi_identifier_id_fkey FOREIGN KEY (doi_identifier_id) REFERENCES public.doi_identifiers(id); + + +-- +-- Name: experiment_doi_identifiers experiment_doi_identifiers_experiment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_doi_identifiers + ADD CONSTRAINT experiment_doi_identifiers_experiment_id_fkey FOREIGN KEY (experiment_id) REFERENCES public.experiments(id); + + +-- +-- Name: experiment_keywords experiment_keywords_experiment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_keywords + ADD CONSTRAINT experiment_keywords_experiment_id_fkey FOREIGN KEY (experiment_id) REFERENCES public.experiments(id); + + +-- +-- Name: experiment_keywords experiment_keywords_keyword_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_keywords + ADD CONSTRAINT experiment_keywords_keyword_id_fkey FOREIGN KEY (keyword_id) REFERENCES public.keywords(id); + + +-- +-- Name: experiment_publication_identifiers experiment_pub_identifiers_experiment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_publication_identifiers + ADD CONSTRAINT experiment_pub_identifiers_experiment_id_fkey FOREIGN KEY (experiment_id) REFERENCES public.experiments(id); + + +-- +-- Name: experiment_publication_identifiers experiment_pub_identifiers_publication_identifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_publication_identifiers + ADD CONSTRAINT experiment_pub_identifiers_publication_identifier_id_fkey FOREIGN KEY (publication_identifier_id) REFERENCES public.publication_identifiers(id); + + +-- +-- Name: experiment_set_contributors experiment_set_contributors_contributor_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_set_contributors + ADD CONSTRAINT experiment_set_contributors_contributor_id_fkey FOREIGN KEY (contributor_id) REFERENCES public.contributors(id); + + +-- +-- Name: experiment_set_contributors experiment_set_contributors_experiment_set_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_set_contributors + ADD CONSTRAINT experiment_set_contributors_experiment_set_id_fkey FOREIGN KEY (experiment_set_id) REFERENCES public.experiment_sets(id); + + +-- +-- Name: experiment_set_doi_identifiers experiment_set_doi_identifiers_doi_identifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_set_doi_identifiers + ADD CONSTRAINT experiment_set_doi_identifiers_doi_identifier_id_fkey FOREIGN KEY (doi_identifier_id) REFERENCES public.doi_identifiers(id); + + +-- +-- Name: experiment_set_doi_identifiers experiment_set_doi_identifiers_experiment_set_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_set_doi_identifiers + ADD CONSTRAINT experiment_set_doi_identifiers_experiment_set_id_fkey FOREIGN KEY (experiment_set_id) REFERENCES public.experiment_sets(id); + + +-- +-- Name: experiment_set_keywords experiment_set_keywords_experiment_set_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_set_keywords + ADD CONSTRAINT experiment_set_keywords_experiment_set_id_fkey FOREIGN KEY (experiment_set_id) REFERENCES public.experiment_sets(id); + + +-- +-- Name: experiment_set_keywords experiment_set_keywords_keyword_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_set_keywords + ADD CONSTRAINT experiment_set_keywords_keyword_id_fkey FOREIGN KEY (keyword_id) REFERENCES public.keywords(id); + + +-- +-- Name: experiment_set_publication_identifiers experiment_set_pub_identifiers_experiment_set_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_set_publication_identifiers + ADD CONSTRAINT experiment_set_pub_identifiers_experiment_set_id_fkey FOREIGN KEY (experiment_set_id) REFERENCES public.experiment_sets(id); + + +-- +-- Name: experiment_set_publication_identifiers experiment_set_pub_identifiers_publication_identifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_set_publication_identifiers + ADD CONSTRAINT experiment_set_pub_identifiers_publication_identifier_id_fkey FOREIGN KEY (publication_identifier_id) REFERENCES public.publication_identifiers(id); + + +-- +-- Name: experiment_set_sra_identifiers experiment_set_sra_identifiers_experiment_set_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_set_sra_identifiers + ADD CONSTRAINT experiment_set_sra_identifiers_experiment_set_id_fkey FOREIGN KEY (experiment_set_id) REFERENCES public.experiment_sets(id); + + +-- +-- Name: experiment_set_sra_identifiers experiment_set_sra_identifiers_sra_identifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_set_sra_identifiers + ADD CONSTRAINT experiment_set_sra_identifiers_sra_identifier_id_fkey FOREIGN KEY (sra_identifier_id) REFERENCES public.sra_identifiers(id); + + +-- +-- Name: experiment_sets experiment_sets_created_by_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_sets + ADD CONSTRAINT experiment_sets_created_by_id_fkey FOREIGN KEY (created_by_id) REFERENCES public.users(id); + + +-- +-- Name: experiment_sets experiment_sets_modified_by_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_sets + ADD CONSTRAINT experiment_sets_modified_by_id_fkey FOREIGN KEY (modified_by_id) REFERENCES public.users(id); + + +-- +-- Name: experiment_sra_identifiers experiment_sra_identifiers_experiment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_sra_identifiers + ADD CONSTRAINT experiment_sra_identifiers_experiment_id_fkey FOREIGN KEY (experiment_id) REFERENCES public.experiments(id); + + +-- +-- Name: experiment_sra_identifiers experiment_sra_identifiers_sra_identifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiment_sra_identifiers + ADD CONSTRAINT experiment_sra_identifiers_sra_identifier_id_fkey FOREIGN KEY (sra_identifier_id) REFERENCES public.sra_identifiers(id); + + +-- +-- Name: experiments experiments_created_by_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiments + ADD CONSTRAINT experiments_created_by_id_fkey FOREIGN KEY (created_by_id) REFERENCES public.users(id); + + +-- +-- Name: experiments experiments_experiment_set_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiments + ADD CONSTRAINT experiments_experiment_set_id_fkey FOREIGN KEY (experiment_set_id) REFERENCES public.experiment_sets(id); + + +-- +-- Name: experiments experiments_modified_by_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.experiments + ADD CONSTRAINT experiments_modified_by_id_fkey FOREIGN KEY (modified_by_id) REFERENCES public.users(id); + + +-- +-- Name: clinvar_allele_links fk_clinvar_allele_links_allele_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.clinvar_allele_links + ADD CONSTRAINT fk_clinvar_allele_links_allele_id FOREIGN KEY (allele_id) REFERENCES public.alleles(id) ON DELETE RESTRICT; + + +-- +-- Name: clinvar_allele_links fk_clinvar_allele_links_clinvar_control_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.clinvar_allele_links + ADD CONSTRAINT fk_clinvar_allele_links_clinvar_control_id FOREIGN KEY (clinvar_control_id) REFERENCES public.clinvar_controls(id) ON DELETE RESTRICT; + + +-- +-- Name: gnomad_allele_links fk_gnomad_allele_links_allele_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gnomad_allele_links + ADD CONSTRAINT fk_gnomad_allele_links_allele_id FOREIGN KEY (allele_id) REFERENCES public.alleles(id) ON DELETE RESTRICT; + + +-- +-- Name: gnomad_allele_links fk_gnomad_allele_links_gnomad_variant_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gnomad_allele_links + ADD CONSTRAINT fk_gnomad_allele_links_gnomad_variant_id FOREIGN KEY (gnomad_variant_id) REFERENCES public.gnomad_variants(id) ON DELETE RESTRICT; + + +-- +-- Name: mapped_variants fk_mapped_variants_target_gene_mapping_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mapped_variants + ADD CONSTRAINT fk_mapped_variants_target_gene_mapping_id FOREIGN KEY (target_gene_mapping_id) REFERENCES public.target_gene_mappings(id); + + +-- +-- Name: mapping_record_alleles fk_mapping_record_alleles_allele_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mapping_record_alleles + ADD CONSTRAINT fk_mapping_record_alleles_allele_id FOREIGN KEY (allele_id) REFERENCES public.alleles(id) ON DELETE RESTRICT; + + +-- +-- Name: mapping_record_alleles fk_mapping_record_alleles_mapping_record_score_set; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mapping_record_alleles + ADD CONSTRAINT fk_mapping_record_alleles_mapping_record_score_set FOREIGN KEY (mapping_record_id, score_set_id) REFERENCES public.mapping_records(id, score_set_id) ON DELETE CASCADE; + + +-- +-- Name: mapping_record_alleles fk_mapping_record_alleles_projection_group; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mapping_record_alleles + ADD CONSTRAINT fk_mapping_record_alleles_projection_group FOREIGN KEY (projection_group, mapping_record_id) REFERENCES public.projection_groups(id, mapping_record_id) ON DELETE CASCADE; + + +-- +-- Name: mapping_records fk_mapping_records_target_gene_mapping_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mapping_records + ADD CONSTRAINT fk_mapping_records_target_gene_mapping_id FOREIGN KEY (target_gene_mapping_id) REFERENCES public.target_gene_mappings(id); + + +-- +-- Name: mapping_records fk_mapping_records_variant_score_set; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mapping_records + ADD CONSTRAINT fk_mapping_records_variant_score_set FOREIGN KEY (variant_id, score_set_id) REFERENCES public.variants(id, scoreset_id) ON DELETE CASCADE; + + +-- +-- Name: projection_groups fk_projection_groups_mapping_record_score_set; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.projection_groups + ADD CONSTRAINT fk_projection_groups_mapping_record_score_set FOREIGN KEY (mapping_record_id, score_set_id) REFERENCES public.mapping_records(id, score_set_id) ON DELETE CASCADE; + + +-- +-- Name: score_calibrations fk_score_calibrations_disease_term_id_mondo_terms; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.score_calibrations + ADD CONSTRAINT fk_score_calibrations_disease_term_id_mondo_terms FOREIGN KEY (disease_term_id) REFERENCES public.mondo_terms(id); + + +-- +-- Name: target_gene_mappings fk_target_gene_mappings_job_run_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.target_gene_mappings + ADD CONSTRAINT fk_target_gene_mappings_job_run_id FOREIGN KEY (job_run_id) REFERENCES public.job_runs(id) ON DELETE SET NULL; + + +-- +-- Name: vep_allele_consequences fk_vep_allele_consequences_allele_id; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.vep_allele_consequences + ADD CONSTRAINT fk_vep_allele_consequences_allele_id FOREIGN KEY (allele_id) REFERENCES public.alleles(id) ON DELETE RESTRICT; + + +-- +-- Name: gnomad_variants_mapped_variants gnomad_variants_mapped_variants_gnomad_variant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gnomad_variants_mapped_variants + ADD CONSTRAINT gnomad_variants_mapped_variants_gnomad_variant_id_fkey FOREIGN KEY (gnomad_variant_id) REFERENCES public.gnomad_variants(id); + + +-- +-- Name: gnomad_variants_mapped_variants gnomad_variants_mapped_variants_mapped_variant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.gnomad_variants_mapped_variants + ADD CONSTRAINT gnomad_variants_mapped_variants_mapped_variant_id_fkey FOREIGN KEY (mapped_variant_id) REFERENCES public.mapped_variants(id); + + +-- +-- Name: job_dependencies job_dependencies_depends_on_job_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.job_dependencies + ADD CONSTRAINT job_dependencies_depends_on_job_id_fkey FOREIGN KEY (depends_on_job_id) REFERENCES public.job_runs(id) ON DELETE CASCADE; + + +-- +-- Name: job_dependencies job_dependencies_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.job_dependencies + ADD CONSTRAINT job_dependencies_id_fkey FOREIGN KEY (id) REFERENCES public.job_runs(id) ON DELETE CASCADE; + + +-- +-- Name: job_runs job_runs_pipeline_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.job_runs + ADD CONSTRAINT job_runs_pipeline_id_fkey FOREIGN KEY (pipeline_id) REFERENCES public.pipelines(id) ON DELETE SET NULL; + + +-- +-- Name: mapped_variants_clinical_controls mapped_variants_clinical_controls_clinical_control_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mapped_variants_clinical_controls + ADD CONSTRAINT mapped_variants_clinical_controls_clinical_control_id_fkey FOREIGN KEY (clinical_control_id) REFERENCES public.clinvar_controls(id); + + +-- +-- Name: mapped_variants_clinical_controls mapped_variants_clinical_controls_mapped_variant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mapped_variants_clinical_controls + ADD CONSTRAINT mapped_variants_clinical_controls_mapped_variant_id_fkey FOREIGN KEY (mapped_variant_id) REFERENCES public.mapped_variants(id); + + +-- +-- Name: mapped_variants mapped_variants_variant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.mapped_variants + ADD CONSTRAINT mapped_variants_variant_id_fkey FOREIGN KEY (variant_id) REFERENCES public.variants(id); + + +-- +-- Name: pipelines pipelines_created_by_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.pipelines + ADD CONSTRAINT pipelines_created_by_user_id_fkey FOREIGN KEY (created_by_user_id) REFERENCES public.users(id) ON DELETE SET NULL; + + +-- +-- Name: refseq_offsets refseq_offsets_identifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.refseq_offsets + ADD CONSTRAINT refseq_offsets_identifier_id_fkey FOREIGN KEY (identifier_id) REFERENCES public.refseq_identifiers(id); + + +-- +-- Name: refseq_offsets refseq_offsets_target_gene_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.refseq_offsets + ADD CONSTRAINT refseq_offsets_target_gene_id_fkey FOREIGN KEY (target_gene_id) REFERENCES public.target_genes(id); + + +-- +-- Name: score_calibration_functional_classification_variants score_calibration_functional__functional_classification_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.score_calibration_functional_classification_variants + ADD CONSTRAINT score_calibration_functional__functional_classification_id_fkey FOREIGN KEY (functional_classification_id) REFERENCES public.score_calibration_functional_classifications(id); + + +-- +-- Name: score_calibration_functional_classifications score_calibration_functional_classi_acmg_classification_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.score_calibration_functional_classifications + ADD CONSTRAINT score_calibration_functional_classi_acmg_classification_id_fkey FOREIGN KEY (acmg_classification_id) REFERENCES public.acmg_classifications(id); + + +-- +-- Name: score_calibration_functional_classifications score_calibration_functional_classification_calibration_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.score_calibration_functional_classifications + ADD CONSTRAINT score_calibration_functional_classification_calibration_id_fkey FOREIGN KEY (calibration_id) REFERENCES public.score_calibrations(id); + + +-- +-- Name: score_calibration_functional_classification_variants score_calibration_functional_classification_var_variant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.score_calibration_functional_classification_variants + ADD CONSTRAINT score_calibration_functional_classification_var_variant_id_fkey FOREIGN KEY (variant_id) REFERENCES public.variants(id); + + +-- +-- Name: score_calibration_publication_identifiers score_calibration_publication_id_publication_identifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.score_calibration_publication_identifiers + ADD CONSTRAINT score_calibration_publication_id_publication_identifier_id_fkey FOREIGN KEY (publication_identifier_id) REFERENCES public.publication_identifiers(id); + + +-- +-- Name: score_calibration_publication_identifiers score_calibration_publication_identif_score_calibration_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.score_calibration_publication_identifiers + ADD CONSTRAINT score_calibration_publication_identif_score_calibration_id_fkey FOREIGN KEY (score_calibration_id) REFERENCES public.score_calibrations(id); + + +-- +-- Name: score_calibrations score_calibrations_created_by_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.score_calibrations + ADD CONSTRAINT score_calibrations_created_by_id_fkey FOREIGN KEY (created_by_id) REFERENCES public.users(id); + + +-- +-- Name: score_calibrations score_calibrations_modified_by_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.score_calibrations + ADD CONSTRAINT score_calibrations_modified_by_id_fkey FOREIGN KEY (modified_by_id) REFERENCES public.users(id); + + +-- +-- Name: score_calibrations score_calibrations_score_set_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.score_calibrations + ADD CONSTRAINT score_calibrations_score_set_id_fkey FOREIGN KEY (score_set_id) REFERENCES public.scoresets(id); + + +-- +-- Name: scoreset_contributors scoreset_contributors_contributor_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoreset_contributors + ADD CONSTRAINT scoreset_contributors_contributor_id_fkey FOREIGN KEY (contributor_id) REFERENCES public.contributors(id); + + +-- +-- Name: scoreset_contributors scoreset_contributors_scoreset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoreset_contributors + ADD CONSTRAINT scoreset_contributors_scoreset_id_fkey FOREIGN KEY (scoreset_id) REFERENCES public.scoresets(id); + + +-- +-- Name: scoreset_doi_identifiers scoreset_doi_identifiers_doi_identifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoreset_doi_identifiers + ADD CONSTRAINT scoreset_doi_identifiers_doi_identifier_id_fkey FOREIGN KEY (doi_identifier_id) REFERENCES public.doi_identifiers(id); + + +-- +-- Name: scoreset_doi_identifiers scoreset_doi_identifiers_scoreset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoreset_doi_identifiers + ADD CONSTRAINT scoreset_doi_identifiers_scoreset_id_fkey FOREIGN KEY (scoreset_id) REFERENCES public.scoresets(id); + + +-- +-- Name: scoreset_keywords scoreset_keywords_keyword_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoreset_keywords + ADD CONSTRAINT scoreset_keywords_keyword_id_fkey FOREIGN KEY (keyword_id) REFERENCES public.keywords(id); + + +-- +-- Name: scoreset_keywords scoreset_keywords_scoreset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoreset_keywords + ADD CONSTRAINT scoreset_keywords_scoreset_id_fkey FOREIGN KEY (scoreset_id) REFERENCES public.scoresets(id); + + +-- +-- Name: scoreset_meta_analysis_sources scoreset_meta_analysis_sources_meta_analysis_scoreset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoreset_meta_analysis_sources + ADD CONSTRAINT scoreset_meta_analysis_sources_meta_analysis_scoreset_id_fkey FOREIGN KEY (meta_analysis_scoreset_id) REFERENCES public.scoresets(id); + + +-- +-- Name: scoreset_meta_analysis_sources scoreset_meta_analysis_sources_source_scoreset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoreset_meta_analysis_sources + ADD CONSTRAINT scoreset_meta_analysis_sources_source_scoreset_id_fkey FOREIGN KEY (source_scoreset_id) REFERENCES public.scoresets(id); + + +-- +-- Name: scoreset_publication_identifiers scoreset_pub_identifiers_publication_identifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoreset_publication_identifiers + ADD CONSTRAINT scoreset_pub_identifiers_publication_identifier_id_fkey FOREIGN KEY (publication_identifier_id) REFERENCES public.publication_identifiers(id); + + +-- +-- Name: scoreset_publication_identifiers scoreset_pub_identifiers_scoreset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoreset_publication_identifiers + ADD CONSTRAINT scoreset_pub_identifiers_scoreset_id_fkey FOREIGN KEY (scoreset_id) REFERENCES public.scoresets(id); + + +-- +-- Name: scoreset_sra_identifiers scoreset_sra_identifiers_scoreset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoreset_sra_identifiers + ADD CONSTRAINT scoreset_sra_identifiers_scoreset_id_fkey FOREIGN KEY (scoreset_id) REFERENCES public.scoresets(id); + + +-- +-- Name: scoreset_sra_identifiers scoreset_sra_identifiers_sra_identifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoreset_sra_identifiers + ADD CONSTRAINT scoreset_sra_identifiers_sra_identifier_id_fkey FOREIGN KEY (sra_identifier_id) REFERENCES public.sra_identifiers(id); + + +-- +-- Name: scoresets scoresets_created_by_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoresets + ADD CONSTRAINT scoresets_created_by_id_fkey FOREIGN KEY (created_by_id) REFERENCES public.users(id); + + +-- +-- Name: scoresets scoresets_experiment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoresets + ADD CONSTRAINT scoresets_experiment_id_fkey FOREIGN KEY (experiment_id) REFERENCES public.experiments(id); + + +-- +-- Name: scoresets scoresets_licence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoresets + ADD CONSTRAINT scoresets_licence_id_fkey FOREIGN KEY (licence_id) REFERENCES public.licenses(id); + + +-- +-- Name: scoresets scoresets_modified_by_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoresets + ADD CONSTRAINT scoresets_modified_by_id_fkey FOREIGN KEY (modified_by_id) REFERENCES public.users(id); + + +-- +-- Name: scoresets scoresets_replaces_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.scoresets + ADD CONSTRAINT scoresets_replaces_id_fkey FOREIGN KEY (replaces_id) REFERENCES public.scoresets(id); + + +-- +-- Name: target_gene_mappings target_gene_mappings_target_gene_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.target_gene_mappings + ADD CONSTRAINT target_gene_mappings_target_gene_id_fkey FOREIGN KEY (target_gene_id) REFERENCES public.target_genes(id); + + +-- +-- Name: target_genes target_genes_accession_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.target_genes + ADD CONSTRAINT target_genes_accession_id_fkey FOREIGN KEY (accession_id) REFERENCES public.target_accessions(id); + + +-- +-- Name: target_genes target_genes_scoreset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.target_genes + ADD CONSTRAINT target_genes_scoreset_id_fkey FOREIGN KEY (scoreset_id) REFERENCES public.scoresets(id); + + +-- +-- Name: target_genes target_genes_wt_sequence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.target_genes + ADD CONSTRAINT target_genes_wt_sequence_id_fkey FOREIGN KEY (target_sequence_id) REFERENCES public.target_sequences(id); + + +-- +-- Name: target_sequences target_sequence_taxonomy_id_foreign_key_constraint; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.target_sequences + ADD CONSTRAINT target_sequence_taxonomy_id_foreign_key_constraint FOREIGN KEY (taxonomy_id) REFERENCES public.taxonomies(id); + + +-- +-- Name: taxonomies taxonomies_genome_identifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.taxonomies + ADD CONSTRAINT taxonomies_genome_identifier_id_fkey FOREIGN KEY (genome_identifier_id) REFERENCES public.genome_identifiers(id); + + +-- +-- Name: uniprot_offsets uniprot_offsets_identifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.uniprot_offsets + ADD CONSTRAINT uniprot_offsets_identifier_id_fkey FOREIGN KEY (identifier_id) REFERENCES public.uniprot_identifiers(id); + + +-- +-- Name: uniprot_offsets uniprot_offsets_target_gene_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.uniprot_offsets + ADD CONSTRAINT uniprot_offsets_target_gene_id_fkey FOREIGN KEY (target_gene_id) REFERENCES public.target_genes(id); + + +-- +-- Name: users_roles users_roles_role_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.users_roles + ADD CONSTRAINT users_roles_role_id_fkey FOREIGN KEY (role_id) REFERENCES public.roles(id); + + +-- +-- Name: users_roles users_roles_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.users_roles + ADD CONSTRAINT users_roles_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id); + + +-- +-- Name: variant_annotation_status variant_annotation_status_job_run_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.variant_annotation_status + ADD CONSTRAINT variant_annotation_status_job_run_id_fkey FOREIGN KEY (job_run_id) REFERENCES public.job_runs(id) ON DELETE SET NULL; + + +-- +-- Name: variant_annotation_status variant_annotation_status_variant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.variant_annotation_status + ADD CONSTRAINT variant_annotation_status_variant_id_fkey FOREIGN KEY (variant_id) REFERENCES public.variants(id) ON DELETE CASCADE; + + +-- +-- Name: variants variants_scoreset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.variants + ADD CONSTRAINT variants_scoreset_id_fkey FOREIGN KEY (scoreset_id) REFERENCES public.scoresets(id); + + +-- +-- PostgreSQL database dump complete +-- + + + +-- +-- Seed vocabulary +-- + +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":1,"key":"Variant Library Creation Method","label":"Endogenous locus library method","system":null,"special":false,"description":"A methodology for generating a variant library at an endogenous locus","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":2,"key":"Variant Library Creation Method","label":"In vitro construct library method","system":null,"special":false,"description":"A methodology for generating a variant library at an endogenous locus","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":3,"key":"Variant Library Creation Method","label":"Other","system":null,"special":false,"description":"A methodology for generating a variant library at an endogenous locus","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":4,"key":"Endogenous Locus Library Method System","label":"SpCas9","system":null,"special":false,"description":"The system used to generate the library","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":5,"key":"Endogenous Locus Library Method System","label":"SaCas9","system":null,"special":false,"description":"The system used to generate the library","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":6,"key":"Endogenous Locus Library Method System","label":"AsCas12a","system":null,"special":false,"description":"The system used to generate the library","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":7,"key":"Endogenous Locus Library Method System","label":"RfsCas13d","system":null,"special":false,"description":"The system used to generate the library","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":8,"key":"Endogenous Locus Library Method System","label":"Other","system":null,"special":false,"description":"The system used to generate the library","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":9,"key":"Endogenous Locus Library Method Mechanism","label":"Nuclease","system":null,"special":false,"description":"The functional mechanism of the library generation method","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":10,"key":"Endogenous Locus Library Method Mechanism","label":"Base editor","system":null,"special":false,"description":"The functional mechanism of the library generation method","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":11,"key":"Endogenous Locus Library Method Mechanism","label":"Prime editor","system":null,"special":false,"description":"The functional mechanism of the library generation method","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":12,"key":"Endogenous Locus Library Method Mechanism","label":"Other","system":null,"special":false,"description":"The functional mechanism of the library generation method","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":13,"key":"In Vitro Construct Library Method System","label":"Oligo-directed mutagenic PCR","system":null,"special":false,"description":"The type of method used to generate the library","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":14,"key":"In Vitro Construct Library Method System","label":"Error-prone PCR","system":null,"special":false,"description":"The type of method used to generate the library","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":15,"key":"In Vitro Construct Library Method System","label":"Nicking mutagenesis","system":null,"special":false,"description":"The type of method used to generate the library","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":16,"key":"In Vitro Construct Library Method System","label":"Microarray synthesis","system":null,"special":false,"description":"The type of method used to generate the library","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":17,"key":"In Vitro Construct Library Method System","label":"Site-directed mutagenesis","system":null,"special":false,"description":"The type of method used to generate the library","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":18,"key":"In Vitro Construct Library Method System","label":"Doped oligo synthesis","system":null,"special":false,"description":"The type of method used to generate the library","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":19,"key":"In Vitro Construct Library Method System","label":"Oligo pool synthesis","system":null,"special":false,"description":"The type of method used to generate the library","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":20,"key":"In Vitro Construct Library Method System","label":"Proprietary method","system":null,"special":false,"description":"The type of method used to generate the library","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":21,"key":"In Vitro Construct Library Method System","label":"Other","system":null,"special":false,"description":"The type of method used to generate the library","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":22,"key":"In Vitro Construct Library Method Mechanism","label":"Native locus replacement","system":null,"special":false,"description":"The mechanism for integration or expression of an exogenous construct","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":23,"key":"In Vitro Construct Library Method Mechanism","label":"Extra-local construct insertion","system":null,"special":false,"description":"The mechanism for integration or expression of an exogenous construct","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":24,"key":"In Vitro Construct Library Method Mechanism","label":"Random locus viral integration","system":null,"special":false,"description":"The mechanism for integration or expression of an exogenous construct","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":25,"key":"In Vitro Construct Library Method Mechanism","label":"Episomal delivery","system":null,"special":false,"description":"The mechanism for integration or expression of an exogenous construct","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":26,"key":"In Vitro Construct Library Method Mechanism","label":"Plasmid (not integrated)","system":null,"special":false,"description":"The mechanism for integration or expression of an exogenous construct","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":27,"key":"In Vitro Construct Library Method Mechanism","label":"Transfection of RNA","system":null,"special":false,"description":"The mechanism for integration or expression of an exogenous construct","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":28,"key":"In Vitro Construct Library Method Mechanism","label":"Other","system":null,"special":false,"description":"The mechanism for integration or expression of an exogenous construct","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":29,"key":"Delivery Method","label":"Electroporation","system":null,"special":false,"description":"How the variant library was delivered to the model system for phenotype evaluation.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":30,"key":"Delivery Method","label":"Nucleofection","system":null,"special":false,"description":"How the variant library was delivered to the model system for phenotype evaluation.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":31,"key":"Delivery Method","label":"Chemical-based transfection","system":null,"special":false,"description":"How the variant library was delivered to the model system for phenotype evaluation.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":32,"key":"Delivery Method","label":"Adeno-associated virus transduction","system":null,"special":false,"description":"How the variant library was delivered to the model system for phenotype evaluation.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":33,"key":"Delivery Method","label":"Lentivirus transduction","system":null,"special":false,"description":"How the variant library was delivered to the model system for phenotype evaluation.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":34,"key":"Delivery Method","label":"Chemical or heat shock transformation","system":null,"special":false,"description":"How the variant library was delivered to the model system for phenotype evaluation.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":35,"key":"Delivery Method","label":"Other","system":null,"special":false,"description":"How the variant library was delivered to the model system for phenotype evaluation.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":36,"key":"Phenotypic Assay Dimensionality","label":"Single-dimensional data","system":null,"special":false,"description":"A coding defining the dimensionality of the assay as single or multiple functional readouts.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":37,"key":"Phenotypic Assay Dimensionality","label":"High-dimensional data","system":null,"special":false,"description":"A coding defining the dimensionality of the assay as single or multiple functional readouts.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":38,"key":"Phenotypic Assay Dimensionality","label":"Combined functional data","system":null,"special":false,"description":"A coding defining the dimensionality of the assay as single or multiple functional readouts.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":39,"key":"Phenotypic Assay Dimensionality","label":"Other","system":null,"special":false,"description":"A coding defining the dimensionality of the assay as single or multiple functional readouts.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":40,"key":"Phenotypic Assay Method","label":"Promoter activity detection by reporter gene assay","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":41,"key":"Phenotypic Assay Method","label":"Bulk RNA-sequencing","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":42,"key":"Phenotypic Assay Method","label":"Single-cell RNA sequencing assay","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":43,"key":"Phenotypic Assay Method","label":"Fluorescence in-situ hybridization (FISH) assay","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":44,"key":"Phenotypic Assay Method","label":"Flow cytometry assay","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":45,"key":"Phenotypic Assay Method","label":"Imaging mass cytometry assay","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":46,"key":"Phenotypic Assay Method","label":"Systematic evolution of ligands by exponential enrichment assay","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":47,"key":"Phenotypic Assay Method","label":"Single cell imaging","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":48,"key":"Phenotypic Assay Method","label":"Multiplexed fluorescent antibody imaging","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":49,"key":"Phenotypic Assay Method","label":"Binding assay","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":50,"key":"Phenotypic Assay Method","label":"Cell proliferation assay","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":51,"key":"Phenotypic Assay Method","label":"Survival assessment assay","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":52,"key":"Phenotypic Assay Method","label":"Other","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":53,"key":"Phenotypic Assay Model System","label":"Immortalized human cells","system":null,"special":false,"description":"The model system context that influences expression of the phenotype.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":54,"key":"Phenotypic Assay Model System","label":"Murine primary cells","system":null,"special":false,"description":"The model system context that influences expression of the phenotype.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":55,"key":"Phenotypic Assay Model System","label":"Induced pluripotent stem cells from human male","system":null,"special":false,"description":"The model system context that influences expression of the phenotype.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":56,"key":"Phenotypic Assay Model System","label":"Induced pluripotent stem cells from human female","system":null,"special":false,"description":"The model system context that influences expression of the phenotype.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":57,"key":"Phenotypic Assay Model System","label":"Patient derived primary cells (e.g. T-cells, adipocytes)","system":null,"special":false,"description":"The model system context that influences expression of the phenotype.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":58,"key":"Phenotypic Assay Model System","label":"Yeast","system":null,"special":false,"description":"The model system context that influences expression of the phenotype.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":59,"key":"Phenotypic Assay Model System","label":"Bacteria","system":null,"special":false,"description":"The model system context that influences expression of the phenotype.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":60,"key":"Phenotypic Assay Model System","label":"Bacteriophage","system":null,"special":false,"description":"The model system context that influences expression of the phenotype.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":61,"key":"Phenotypic Assay Model System","label":"Molecular display","system":null,"special":false,"description":"The model system context that influences expression of the phenotype.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":62,"key":"Phenotypic Assay Model System","label":"Other","system":null,"special":false,"description":"The model system context that influences expression of the phenotype.","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":63,"key":"Phenotypic Assay Profiling Strategy","label":"Direct sequencing","system":null,"special":false,"description":"The strategy used to profile the variant library","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":64,"key":"Phenotypic Assay Profiling Strategy","label":"Shotgun sequencing","system":null,"special":false,"description":"The strategy used to profile the variant library","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":65,"key":"Phenotypic Assay Profiling Strategy","label":"Barcode sequencing","system":null,"special":false,"description":"The strategy used to profile the variant library","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":66,"key":"Phenotypic Assay Profiling Strategy","label":"Other","system":null,"special":false,"description":"The strategy used to profile the variant library","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":67,"key":"Phenotypic Assay Sequencing Read Type","label":"Single-segment (short read)","system":null,"special":false,"description":"The sequencing method used","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":68,"key":"Phenotypic Assay Sequencing Read Type","label":"Single-segment (long read)","system":null,"special":false,"description":"The sequencing method used","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":69,"key":"Phenotypic Assay Sequencing Read Type","label":"Multi-segment","system":null,"special":false,"description":"The sequencing method used","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":70,"key":"Phenotypic Assay Sequencing Read Type","label":"Other","system":null,"special":false,"description":"The sequencing method used","creation_date":"2024-08-28","modification_date":"2024-08-28","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":71,"key":"Phenotypic Assay Mechanism","label":"Other","system":null,"special":false,"description":"The Gene Ontology (GO) is a structured, standardized representation of biological knowledge.","creation_date":"2025-09-15","modification_date":"2025-09-15","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":72,"key":"Phenotypic Assay Mechanism","label":"Loss of function","system":null,"special":false,"description":"The Gene Ontology (GO) is a structured, standardized representation of biological knowledge.","creation_date":"2025-09-15","modification_date":"2025-09-15","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":73,"key":"Phenotypic Assay Mechanism","label":"Gain of function","system":null,"special":false,"description":"The Gene Ontology (GO) is a structured, standardized representation of biological knowledge.","creation_date":"2025-09-21","modification_date":"2025-09-21","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":74,"key":"Phenotypic Assay Mechanism","label":"Dominant-negative effect","system":null,"special":false,"description":"The Gene Ontology (GO) is a structured, standardized representation of biological knowledge.","creation_date":"2025-09-21","modification_date":"2025-09-21","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":75,"key":"Phenotypic Assay Method","label":"Cell morphology assay","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2025-09-21","modification_date":"2025-09-21","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":76,"key":"Phenotypic Assay Method","label":"Genetic complementation","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2025-09-21","modification_date":"2025-09-21","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":77,"key":"Phenotypic Assay Method","label":"Ion channel assay","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2025-09-21","modification_date":"2025-09-21","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":78,"key":"Phenotypic Assay Method","label":"Electrophysiological method","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2025-09-21","modification_date":"2025-09-21","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":79,"key":"Phenotypic Assay Method","label":"Localization assay","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2025-09-21","modification_date":"2025-09-21","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":80,"key":"Phenotypic Assay Method","label":"One-hybrid assay","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2025-09-21","modification_date":"2025-09-21","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":81,"key":"Phenotypic Assay Method","label":"Posttranslation modification assay","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2025-09-21","modification_date":"2025-09-21","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":82,"key":"Phenotypic Assay Method","label":"Protein stability assay","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2025-09-21","modification_date":"2025-09-21","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":83,"key":"Phenotypic Assay Method","label":"Reporter gene assay","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2025-09-21","modification_date":"2025-09-21","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":84,"key":"Phenotypic Assay Method","label":"Homology-directed DNA repair frequency measurement","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2025-09-21","modification_date":"2025-09-21","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":85,"key":"Phenotypic Assay Model System","label":"Not applicable","system":null,"special":false,"description":"The model system context that influences expression of the phenotype.","creation_date":"2025-09-21","modification_date":"2025-09-21","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":86,"key":"Phenotypic Assay Method","label":"Ion channel assay with electrophysicological method","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2025-09-21","modification_date":"2025-09-21","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":87,"key":"Phenotypic Assay Method","label":"Cell proliferation assay with genetic complementation","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2025-09-21","modification_date":"2025-09-21","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":88,"key":"Phenotypic Assay Mechanism","label":"Gain or loss of function","system":null,"special":false,"description":"The Gene Ontology (GO) is a structured, standardized representation of biological knowledge.","creation_date":"2025-09-21","modification_date":"2025-09-21","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":89,"key":"Phenotypic Assay Mechanism","label":"Loss of function or dominant-negative effect","system":null,"special":false,"description":"The Gene Ontology (GO) is a structured, standardized representation of biological knowledge.","creation_date":"2025-09-21","modification_date":"2025-09-21","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":90,"key":"Variant Library Creation Method","label":"N/A (meta-analysis)","system":null,"special":false,"description":"A methodology for generating a variant library at an endogenous locus","creation_date":"2025-09-24","modification_date":"2025-09-24","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":91,"key":"Phenotypic Assay Method","label":"Cell fitness","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2025-09-25","modification_date":"2025-09-25","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":92,"key":"Phenotypic Assay Method","label":"Direct protein function","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2025-09-25","modification_date":"2025-09-25","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":93,"key":"Phenotypic Assay Method","label":"Not applicable (trained predictor)","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2025-09-25","modification_date":"2025-09-25","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":94,"key":"Phenotypic Assay Method","label":"Reporter","system":null,"special":false,"description":"The assay method, defining the molecular properties interrogated.","creation_date":"2025-09-25","modification_date":"2025-09-25","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":95,"key":"Molecular Mechanism Assessed","label":"Catalytic and Cysteine synthase activity","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":96,"key":"Molecular Mechanism Assessed","label":"Catalytic and Hydroxymethylbilane synthase activity","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":97,"key":"Molecular Mechanism Assessed","label":"Catalytic and Lipid phosphatase activity","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":98,"key":"Molecular Mechanism Assessed","label":"Catalytic and Thiamine diphosphokinase activity","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":99,"key":"Molecular Mechanism Assessed","label":"Cellular response to cisplatin, DNA repair and Double-strand break repair via homologous recombination","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":100,"key":"Molecular Mechanism Assessed","label":"DNA damage response, signal transduction by p53 class mediator and MDM2/MDM4 family protein binding","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":101,"key":"Molecular Mechanism Assessed","label":"DNA repair and Double-strand break repair via homologous recombination","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":102,"key":"Molecular Mechanism Assessed","label":"Double-strand break repair, damage response, signal transduction by p53 class mediator and Response to etoposide","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":103,"key":"Molecular Mechanism Assessed","label":"Molecular function","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":104,"key":"Molecular Mechanism Assessed","label":"Monoatomic ion transport and Potassium channel activity","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":105,"key":"Molecular Mechanism Assessed","label":"Sodium channel activity","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":106,"key":"Molecular Mechanism Assessed","label":"Calcium-mediated signaling","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":107,"key":"Molecular Mechanism Assessed","label":"Catalytic and Gluconokinase activity","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":108,"key":"Molecular Mechanism Assessed","label":"Catalytic activity and Ornithine carbamoyltransferase activity","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":109,"key":"Molecular Mechanism Assessed","label":"Core promoter sequence-specific DNA binding","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":110,"key":"Molecular Mechanism Assessed","label":"DNA damage checkpoint signaling","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":111,"key":"Molecular Mechanism Assessed","label":"DNA and Mismatch repair","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":112,"key":"Molecular Mechanism Assessed","label":"Molecular condensate scaffold activity","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":113,"key":"Molecular Mechanism Assessed","label":"Monoatomic ion transport and Sodium ion transport","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":114,"key":"Molecular Mechanism Assessed","label":"Oxidative phosphorylation","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":115,"key":"Molecular Mechanism Assessed","label":"Protein carboxylation","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":116,"key":"Molecular Mechanism Assessed","label":"Protein glycosylation","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":117,"key":"Molecular Mechanism Assessed","label":"Protein localization to plasma membrane","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":118,"key":"Molecular Mechanism Assessed","label":"Regulation of protein stability","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +INSERT INTO public.controlled_keywords SELECT * FROM json_populate_record(NULL::public.controlled_keywords, '{"id":119,"key":"Molecular Mechanism Assessed","label":"Response to misfolded protein","system":null,"special":false,"description":"The biological or molecular process investigated by the assay","creation_date":"2025-09-29","modification_date":"2025-09-29","code":null,"version":null}'); +SELECT pg_catalog.setval(pg_get_serial_sequence('public.controlled_keywords', 'id'), (SELECT coalesce(max(id), 1) FROM public.controlled_keywords)); +INSERT INTO public.licenses SELECT * FROM json_populate_record(NULL::public.licenses, E'{"id":1,"long_name":"CC0 (Public domain)","short_name":"CC0","text":"Creative Commons Legal Code\\n\\nCC0 1.0 Universal\\n\\n CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE\\n LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN\\n ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS\\n INFORMATION ON AN \\"AS-IS\\" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES\\n REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS\\n PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM\\n THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED\\n HEREUNDER.\\n\\nStatement of Purpose\\n\\nThe laws of most jurisdictions throughout the world automatically confer\\nexclusive Copyright and Related Rights (defined below) upon the creator\\nand subsequent owner(s) (each and all, an \\"owner\\") of an original work of\\nauthorship and/or a database (each, a \\"Work\\").\\n\\nCertain owners wish to permanently relinquish those rights to a Work for\\nthe purpose of contributing to a commons of creative, cultural and\\nscientific works (\\"Commons\\") that the public can reliably and without fear\\nof later claims of infringement build upon, modify, incorporate in other\\nworks, reuse and redistribute as freely as possible in any form whatsoever\\nand for any purposes, including without limitation commercial purposes.\\nThese owners may contribute to the Commons to promote the ideal of a free\\nculture and the further production of creative, cultural and scientific\\nworks, or to gain reputation or greater distribution for their Work in\\npart through the use and efforts of others.\\n\\nFor these and/or other purposes and motivations, and without any\\nexpectation of additional consideration or compensation, the person\\nassociating CC0 with a Work (the \\"Affirmer\\"), to the extent that he or she\\nis an owner of Copyright and Related Rights in the Work, voluntarily\\nelects to apply CC0 to the Work and publicly distribute the Work under its\\nterms, with knowledge of his or her Copyright and Related Rights in the\\nWork and the meaning and intended legal effect of CC0 on those rights.\\n\\n1. Copyright and Related Rights. A Work made available under CC0 may be\\nprotected by copyright and related or neighboring rights (\\"Copyright and\\nRelated Rights\\"). Copyright and Related Rights include, but are not\\nlimited to, the following:\\n\\n i. the right to reproduce, adapt, distribute, perform, display,\\n communicate, and translate a Work;\\n ii. moral rights retained by the original author(s) and/or performer(s);\\niii. publicity and privacy rights pertaining to a person''s image or\\n likeness depicted in a Work;\\n iv. rights protecting against unfair competition in regards to a Work,\\n subject to the limitations in paragraph 4(a), below;\\n v. rights protecting the extraction, dissemination, use and reuse of data\\n in a Work;\\n vi. database rights (such as those arising under Directive 96/9/EC of the\\n European Parliament and of the Council of 11 March 1996 on the legal\\n protection of databases, and under any national implementation\\n thereof, including any amended or successor version of such\\n directive); and\\nvii. other similar, equivalent or corresponding rights throughout the\\n world based on applicable law or treaty, and any national\\n implementations thereof.\\n\\n2. Waiver. To the greatest extent permitted by, but not in contravention\\nof, applicable law, Affirmer hereby overtly, fully, permanently,\\nirrevocably and unconditionally waives, abandons, and surrenders all of\\nAffirmer''s Copyright and Related Rights and associated claims and causes\\nof action, whether now known or unknown (including existing as well as\\nfuture claims and causes of action), in the Work (i) in all territories\\nworldwide, (ii) for the maximum duration provided by applicable law or\\ntreaty (including future time extensions), (iii) in any current or future\\nmedium and for any number of copies, and (iv) for any purpose whatsoever,\\nincluding without limitation commercial, advertising or promotional\\npurposes (the \\"Waiver\\"). Affirmer makes the Waiver for the benefit of each\\nmember of the public at large and to the detriment of Affirmer''s heirs and\\nsuccessors, fully intending that such Waiver shall not be subject to\\nrevocation, rescission, cancellation, termination, or any other legal or\\nequitable action to disrupt the quiet enjoyment of the Work by the public\\nas contemplated by Affirmer''s express Statement of Purpose.\\n\\n3. Public License Fallback. Should any part of the Waiver for any reason\\nbe judged legally invalid or ineffective under applicable law, then the\\nWaiver shall be preserved to the maximum extent permitted taking into\\naccount Affirmer''s express Statement of Purpose. In addition, to the\\nextent the Waiver is so judged Affirmer hereby grants to each affected\\nperson a royalty-free, non transferable, non sublicensable, non exclusive,\\nirrevocable and unconditional license to exercise Affirmer''s Copyright and\\nRelated Rights in the Work (i) in all territories worldwide, (ii) for the\\nmaximum duration provided by applicable law or treaty (including future\\ntime extensions), (iii) in any current or future medium and for any number\\nof copies, and (iv) for any purpose whatsoever, including without\\nlimitation commercial, advertising or promotional purposes (the\\n\\"License\\"). The License shall be deemed effective as of the date CC0 was\\napplied by Affirmer to the Work. Should any part of the License for any\\nreason be judged legally invalid or ineffective under applicable law, such\\npartial invalidity or ineffectiveness shall not invalidate the remainder\\nof the License, and in such case Affirmer hereby affirms that he or she\\nwill not (i) exercise any of his or her remaining Copyright and Related\\nRights in the Work or (ii) assert any associated claims and causes of\\naction with respect to the Work, in either case contrary to Affirmer''s\\nexpress Statement of Purpose.\\n\\n4. Limitations and Disclaimers.\\n\\n a. No trademark or patent rights held by Affirmer are waived, abandoned,\\n surrendered, licensed or otherwise affected by this document.\\n b. Affirmer offers the Work as-is and makes no representations or\\n warranties of any kind concerning the Work, express, implied,\\n statutory or otherwise, including without limitation warranties of\\n title, merchantability, fitness for a particular purpose, non\\n infringement, or the absence of latent or other defects, accuracy, or\\n the present or absence of errors, whether or not discoverable, all to\\n the greatest extent permissible under applicable law.\\n c. Affirmer disclaims responsibility for clearing rights of other persons\\n that may apply to the Work or any use thereof, including without\\n limitation any person''s Copyright and Related Rights in the Work.\\n Further, Affirmer disclaims responsibility for obtaining any necessary\\n consents, permissions or other rights required for any use of the\\n Work.\\n d. Affirmer understands and acknowledges that Creative Commons is not a\\n party to this document and has no duty or obligation with respect to\\n this CC0 or use of the Work.","link":"https://creativecommons.org/publicdomain/zero/1.0/","version":"1.0","creation_date":"2018-06-22","modification_date":"2023-03-30","active":true}'); +INSERT INTO public.licenses SELECT * FROM json_populate_record(NULL::public.licenses, E'{"id":2,"long_name":"CC BY-NC-SA 4.0 (Attribution-NonCommercial-ShareAlike)","short_name":"CC BY-NC-SA 4.0","text":"Attribution-NonCommercial-ShareAlike 4.0 International\\n\\n=======================================================================\\n\\nCreative Commons Corporation (\\"Creative Commons\\") is not a law firm and\\ndoes not provide legal services or legal advice. Distribution of\\nCreative Commons public licenses does not create a lawyer-client or\\nother relationship. Creative Commons makes its licenses and related\\ninformation available on an \\"as-is\\" basis. Creative Commons gives no\\nwarranties regarding its licenses, any material licensed under their\\nterms and conditions, or any related information. Creative Commons\\ndisclaims all liability for damages resulting from their use to the\\nfullest extent possible.\\n\\nUsing Creative Commons Public Licenses\\n\\nCreative Commons public licenses provide a standard set of terms and\\nconditions that creators and other rights holders may use to share\\noriginal works of authorship and other material subject to copyright\\nand certain other rights specified in the public license below. The\\nfollowing considerations are for informational purposes only, are not\\nexhaustive, and do not form part of our licenses.\\n\\n Considerations for licensors: Our public licenses are\\n intended for use by those authorized to give the public\\n permission to use material in ways otherwise restricted by\\n copyright and certain other rights. Our licenses are\\n irrevocable. Licensors should read and understand the terms\\n and conditions of the license they choose before applying it.\\n Licensors should also secure all rights necessary before\\n applying our licenses so that the public can reuse the\\n material as expected. Licensors should clearly mark any\\n material not subject to the license. This includes other CC-\\n licensed material, or material used under an exception or\\n limitation to copyright. More considerations for licensors:\\n\\twiki.creativecommons.org/Considerations_for_licensors\\n\\n Considerations for the public: By using one of our public\\n licenses, a licensor grants the public permission to use the\\n licensed material under specified terms and conditions. If\\n the licensor''s permission is not necessary for any reason--for\\n example, because of any applicable exception or limitation to\\n copyright--then that use is not regulated by the license. Our\\n licenses grant only permissions under copyright and certain\\n other rights that a licensor has authority to grant. Use of\\n the licensed material may still be restricted for other\\n reasons, including because others have copyright or other\\n rights in the material. A licensor may make special requests,\\n such as asking that all changes be marked or described.\\n Although not required by our licenses, you are encouraged to\\n respect those requests where reasonable. More considerations\\n for the public: \\n\\twiki.creativecommons.org/Considerations_for_licensees\\n\\n=======================================================================\\n\\nCreative Commons Attribution-NonCommercial-ShareAlike 4.0 International\\nPublic License\\n\\nBy exercising the Licensed Rights (defined below), You accept and agree\\nto be bound by the terms and conditions of this Creative Commons\\nAttribution-NonCommercial-ShareAlike 4.0 International Public License\\n(\\"Public License\\"). To the extent this Public License may be\\ninterpreted as a contract, You are granted the Licensed Rights in\\nconsideration of Your acceptance of these terms and conditions, and the\\nLicensor grants You such rights in consideration of benefits the\\nLicensor receives from making the Licensed Material available under\\nthese terms and conditions.\\n\\n\\nSection 1 -- Definitions.\\n\\n a. Adapted Material means material subject to Copyright and Similar\\n Rights that is derived from or based upon the Licensed Material\\n and in which the Licensed Material is translated, altered,\\n arranged, transformed, or otherwise modified in a manner requiring\\n permission under the Copyright and Similar Rights held by the\\n Licensor. For purposes of this Public License, where the Licensed\\n Material is a musical work, performance, or sound recording,\\n Adapted Material is always produced where the Licensed Material is\\n synched in timed relation with a moving image.\\n\\n b. Adapter''s License means the license You apply to Your Copyright\\n and Similar Rights in Your contributions to Adapted Material in\\n accordance with the terms and conditions of this Public License.\\n\\n c. BY-NC-SA Compatible License means a license listed at\\n creativecommons.org/compatiblelicenses, approved by Creative\\n Commons as essentially the equivalent of this Public License.\\n\\n d. Copyright and Similar Rights means copyright and/or similar rights\\n closely related to copyright including, without limitation,\\n performance, broadcast, sound recording, and Sui Generis Database\\n Rights, without regard to how the rights are labeled or\\n categorized. For purposes of this Public License, the rights\\n specified in Section 2(b)(1)-(2) are not Copyright and Similar\\n Rights.\\n\\n e. Effective Technological Measures means those measures that, in the\\n absence of proper authority, may not be circumvented under laws\\n fulfilling obligations under Article 11 of the WIPO Copyright\\n Treaty adopted on December 20, 1996, and/or similar international\\n agreements.\\n\\n f. Exceptions and Limitations means fair use, fair dealing, and/or\\n any other exception or limitation to Copyright and Similar Rights\\n that applies to Your use of the Licensed Material.\\n\\n g. License Elements means the license attributes listed in the name\\n of a Creative Commons Public License. The License Elements of this\\n Public License are Attribution, NonCommercial, and ShareAlike.\\n\\n h. Licensed Material means the artistic or literary work, database,\\n or other material to which the Licensor applied this Public\\n License.\\n\\n i. Licensed Rights means the rights granted to You subject to the\\n terms and conditions of this Public License, which are limited to\\n all Copyright and Similar Rights that apply to Your use of the\\n Licensed Material and that the Licensor has authority to license.\\n\\n j. Licensor means the individual(s) or entity(ies) granting rights\\n under this Public License.\\n\\n k. NonCommercial means not primarily intended for or directed towards\\n commercial advantage or monetary compensation. For purposes of\\n this Public License, the exchange of the Licensed Material for\\n other material subject to Copyright and Similar Rights by digital\\n file-sharing or similar means is NonCommercial provided there is\\n no payment of monetary compensation in connection with the\\n exchange.\\n\\n l. Share means to provide material to the public by any means or\\n process that requires permission under the Licensed Rights, such\\n as reproduction, public display, public performance, distribution,\\n dissemination, communication, or importation, and to make material\\n available to the public including in ways that members of the\\n public may access the material from a place and at a time\\n individually chosen by them.\\n\\n m. Sui Generis Database Rights means rights other than copyright\\n resulting from Directive 96/9/EC of the European Parliament and of\\n the Council of 11 March 1996 on the legal protection of databases,\\n as amended and/or succeeded, as well as other essentially\\n equivalent rights anywhere in the world.\\n\\n n. You means the individual or entity exercising the Licensed Rights\\n under this Public License. Your has a corresponding meaning.\\n\\n\\nSection 2 -- Scope.\\n\\n a. License grant.\\n\\n 1. Subject to the terms and conditions of this Public License,\\n the Licensor hereby grants You a worldwide, royalty-free,\\n non-sublicensable, non-exclusive, irrevocable license to\\n exercise the Licensed Rights in the Licensed Material to:\\n\\n a. reproduce and Share the Licensed Material, in whole or\\n in part, for NonCommercial purposes only; and\\n\\n b. produce, reproduce, and Share Adapted Material for\\n NonCommercial purposes only.\\n\\n 2. Exceptions and Limitations. For the avoidance of doubt, where\\n Exceptions and Limitations apply to Your use, this Public\\n License does not apply, and You do not need to comply with\\n its terms and conditions.\\n\\n 3. Term. The term of this Public License is specified in Section\\n 6(a).\\n\\n 4. Media and formats; technical modifications allowed. The\\n Licensor authorizes You to exercise the Licensed Rights in\\n all media and formats whether now known or hereafter created,\\n and to make technical modifications necessary to do so. The\\n Licensor waives and/or agrees not to assert any right or\\n authority to forbid You from making technical modifications\\n necessary to exercise the Licensed Rights, including\\n technical modifications necessary to circumvent Effective\\n Technological Measures. For purposes of this Public License,\\n simply making modifications authorized by this Section 2(a)\\n (4) never produces Adapted Material.\\n\\n 5. Downstream recipients.\\n\\n a. Offer from the Licensor -- Licensed Material. Every\\n recipient of the Licensed Material automatically\\n receives an offer from the Licensor to exercise the\\n Licensed Rights under the terms and conditions of this\\n Public License.\\n\\n b. Additional offer from the Licensor -- Adapted Material.\\n Every recipient of Adapted Material from You\\n automatically receives an offer from the Licensor to\\n exercise the Licensed Rights in the Adapted Material\\n under the conditions of the Adapter''s License You apply.\\n\\n c. No downstream restrictions. You may not offer or impose\\n any additional or different terms or conditions on, or\\n apply any Effective Technological Measures to, the\\n Licensed Material if doing so restricts exercise of the\\n Licensed Rights by any recipient of the Licensed\\n Material.\\n\\n 6. No endorsement. Nothing in this Public License constitutes or\\n may be construed as permission to assert or imply that You\\n are, or that Your use of the Licensed Material is, connected\\n with, or sponsored, endorsed, or granted official status by,\\n the Licensor or others designated to receive attribution as\\n provided in Section 3(a)(1)(A)(i).\\n\\n b. Other rights.\\n\\n 1. Moral rights, such as the right of integrity, are not\\n licensed under this Public License, nor are publicity,\\n privacy, and/or other similar personality rights; however, to\\n the extent possible, the Licensor waives and/or agrees not to\\n assert any such rights held by the Licensor to the limited\\n extent necessary to allow You to exercise the Licensed\\n Rights, but not otherwise.\\n\\n 2. Patent and trademark rights are not licensed under this\\n Public License.\\n\\n 3. To the extent possible, the Licensor waives any right to\\n collect royalties from You for the exercise of the Licensed\\n Rights, whether directly or through a collecting society\\n under any voluntary or waivable statutory or compulsory\\n licensing scheme. In all other cases the Licensor expressly\\n reserves any right to collect such royalties, including when\\n the Licensed Material is used other than for NonCommercial\\n purposes.\\n\\n\\nSection 3 -- License Conditions.\\n\\nYour exercise of the Licensed Rights is expressly made subject to the\\nfollowing conditions.\\n\\n a. Attribution.\\n\\n 1. If You Share the Licensed Material (including in modified\\n form), You must:\\n\\n a. retain the following if it is supplied by the Licensor\\n with the Licensed Material:\\n\\n i. identification of the creator(s) of the Licensed\\n Material and any others designated to receive\\n attribution, in any reasonable manner requested by\\n the Licensor (including by pseudonym if\\n designated);\\n\\n ii. a copyright notice;\\n\\n iii. a notice that refers to this Public License;\\n\\n iv. a notice that refers to the disclaimer of\\n warranties;\\n\\n v. a URI or hyperlink to the Licensed Material to the\\n extent reasonably practicable;\\n\\n b. indicate if You modified the Licensed Material and\\n retain an indication of any previous modifications; and\\n\\n c. indicate the Licensed Material is licensed under this\\n Public License, and include the text of, or the URI or\\n hyperlink to, this Public License.\\n\\n 2. You may satisfy the conditions in Section 3(a)(1) in any\\n reasonable manner based on the medium, means, and context in\\n which You Share the Licensed Material. For example, it may be\\n reasonable to satisfy the conditions by providing a URI or\\n hyperlink to a resource that includes the required\\n information.\\n 3. If requested by the Licensor, You must remove any of the\\n information required by Section 3(a)(1)(A) to the extent\\n reasonably practicable.\\n\\n b. ShareAlike.\\n\\n In addition to the conditions in Section 3(a), if You Share\\n Adapted Material You produce, the following conditions also apply.\\n\\n 1. The Adapter''s License You apply must be a Creative Commons\\n license with the same License Elements, this version or\\n later, or a BY-NC-SA Compatible License.\\n\\n 2. You must include the text of, or the URI or hyperlink to, the\\n Adapter''s License You apply. You may satisfy this condition\\n in any reasonable manner based on the medium, means, and\\n context in which You Share Adapted Material.\\n\\n 3. You may not offer or impose any additional or different terms\\n or conditions on, or apply any Effective Technological\\n Measures to, Adapted Material that restrict exercise of the\\n rights granted under the Adapter''s License You apply.\\n\\n\\nSection 4 -- Sui Generis Database Rights.\\n\\nWhere the Licensed Rights include Sui Generis Database Rights that\\napply to Your use of the Licensed Material:\\n\\n a. for the avoidance of doubt, Section 2(a)(1) grants You the right\\n to extract, reuse, reproduce, and Share all or a substantial\\n portion of the contents of the database for NonCommercial purposes\\n only;\\n\\n b. if You include all or a substantial portion of the database\\n contents in a database in which You have Sui Generis Database\\n Rights, then the database in which You have Sui Generis Database\\n Rights (but not its individual contents) is Adapted Material,\\n including for purposes of Section 3(b); and\\n\\n c. You must comply with the conditions in Section 3(a) if You Share\\n all or a substantial portion of the contents of the database.\\n\\nFor the avoidance of doubt, this Section 4 supplements and does not\\nreplace Your obligations under this Public License where the Licensed\\nRights include other Copyright and Similar Rights.\\n\\n\\nSection 5 -- Disclaimer of Warranties and Limitation of Liability.\\n\\n a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE\\n EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS\\n AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF\\n ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,\\n IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,\\n WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR\\n PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,\\n ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT\\n KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT\\n ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.\\n\\n b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE\\n TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,\\n NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,\\n INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,\\n COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR\\n USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN\\n ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR\\n DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR\\n IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.\\n\\n c. The disclaimer of warranties and limitation of liability provided\\n above shall be interpreted in a manner that, to the extent\\n possible, most closely approximates an absolute disclaimer and\\n waiver of all liability.\\n\\n\\nSection 6 -- Term and Termination.\\n\\n a. This Public License applies for the term of the Copyright and\\n Similar Rights licensed here. However, if You fail to comply with\\n this Public License, then Your rights under this Public License\\n terminate automatically.\\n\\n b. Where Your right to use the Licensed Material has terminated under\\n Section 6(a), it reinstates:\\n\\n 1. automatically as of the date the violation is cured, provided\\n it is cured within 30 days of Your discovery of the\\n violation; or\\n\\n 2. upon express reinstatement by the Licensor.\\n\\n For the avoidance of doubt, this Section 6(b) does not affect any\\n right the Licensor may have to seek remedies for Your violations\\n of this Public License.\\n\\n c. For the avoidance of doubt, the Licensor may also offer the\\n Licensed Material under separate terms or conditions or stop\\n distributing the Licensed Material at any time; however, doing so\\n will not terminate this Public License.\\n\\n d. Sections 1, 5, 6, 7, and 8 survive termination of this Public\\n License.\\n\\n\\nSection 7 -- Other Terms and Conditions.\\n\\n a. The Licensor shall not be bound by any additional or different\\n terms or conditions communicated by You unless expressly agreed.\\n\\n b. Any arrangements, understandings, or agreements regarding the\\n Licensed Material not stated herein are separate from and\\n independent of the terms and conditions of this Public License.\\n\\n\\nSection 8 -- Interpretation.\\n\\n a. For the avoidance of doubt, this Public License does not, and\\n shall not be interpreted to, reduce, limit, restrict, or impose\\n conditions on any use of the Licensed Material that could lawfully\\n be made without permission under this Public License.\\n\\n b. To the extent possible, if any provision of this Public License is\\n deemed unenforceable, it shall be automatically reformed to the\\n minimum extent necessary to make it enforceable. If the provision\\n cannot be reformed, it shall be severed from this Public License\\n without affecting the enforceability of the remaining terms and\\n conditions.\\n\\n c. No term or condition of this Public License will be waived and no\\n failure to comply consented to unless expressly agreed to by the\\n Licensor.\\n\\n d. Nothing in this Public License constitutes or may be interpreted\\n as a limitation upon, or waiver of, any privileges and immunities\\n that apply to the Licensor or You, including from the legal\\n processes of any jurisdiction or authority.\\n\\n=======================================================================\\n\\nCreative Commons is not a party to its public\\nlicenses. Notwithstanding, Creative Commons may elect to apply one of\\nits public licenses to material it publishes and in those instances\\nwill be considered the “Licensor.” The text of the Creative Commons\\npublic licenses is dedicated to the public domain under the CC0 Public\\nDomain Dedication. Except for the limited purpose of indicating that\\nmaterial is shared under a Creative Commons public license or as\\notherwise permitted by the Creative Commons policies published at\\ncreativecommons.org/policies, Creative Commons does not authorize the\\nuse of the trademark \\"Creative Commons\\" or any other trademark or logo\\nof Creative Commons without its prior written consent including,\\nwithout limitation, in connection with any unauthorized modifications\\nto any of its public licenses or any other arrangements,\\nunderstandings, or agreements concerning use of licensed material. For\\nthe avoidance of doubt, this paragraph does not form part of the\\npublic licenses.\\n\\nCreative Commons may be contacted at creativecommons.org.","link":"https://creativecommons.org/licenses/by-nc-sa/4.0/","version":"4.0","creation_date":"2018-06-22","modification_date":"2024-11-21","active":false}'); +INSERT INTO public.licenses SELECT * FROM json_populate_record(NULL::public.licenses, E'{"id":3,"long_name":"CC BY 4.0 (Attribution)","short_name":"CC BY 4.0","text":"Attribution 4.0 International\\n\\n=======================================================================\\n\\nCreative Commons Corporation (\\"Creative Commons\\") is not a law firm and\\ndoes not provide legal services or legal advice. Distribution of\\nCreative Commons public licenses does not create a lawyer-client or\\nother relationship. Creative Commons makes its licenses and related\\ninformation available on an \\"as-is\\" basis. Creative Commons gives no\\nwarranties regarding its licenses, any material licensed under their\\nterms and conditions, or any related information. Creative Commons\\ndisclaims all liability for damages resulting from their use to the\\nfullest extent possible.\\n\\nUsing Creative Commons Public Licenses\\n\\nCreative Commons public licenses provide a standard set of terms and\\nconditions that creators and other rights holders may use to share\\noriginal works of authorship and other material subject to copyright\\nand certain other rights specified in the public license below. The\\nfollowing considerations are for informational purposes only, are not\\nexhaustive, and do not form part of our licenses.\\n\\n Considerations for licensors: Our public licenses are\\n intended for use by those authorized to give the public\\n permission to use material in ways otherwise restricted by\\n copyright and certain other rights. Our licenses are\\n irrevocable. Licensors should read and understand the terms\\n and conditions of the license they choose before applying it.\\n Licensors should also secure all rights necessary before\\n applying our licenses so that the public can reuse the\\n material as expected. Licensors should clearly mark any\\n material not subject to the license. This includes other CC-\\n licensed material, or material used under an exception or\\n limitation to copyright. More considerations for licensors:\\n\\twiki.creativecommons.org/Considerations_for_licensors\\n\\n Considerations for the public: By using one of our public\\n licenses, a licensor grants the public permission to use the\\n licensed material under specified terms and conditions. If\\n the licensor''s permission is not necessary for any reason--for\\n example, because of any applicable exception or limitation to\\n copyright--then that use is not regulated by the license. Our\\n licenses grant only permissions under copyright and certain\\n other rights that a licensor has authority to grant. Use of\\n the licensed material may still be restricted for other\\n reasons, including because others have copyright or other\\n rights in the material. A licensor may make special requests,\\n such as asking that all changes be marked or described.\\n Although not required by our licenses, you are encouraged to\\n respect those requests where reasonable. More considerations\\n for the public: \\n\\twiki.creativecommons.org/Considerations_for_licensees\\n\\n=======================================================================\\n\\nCreative Commons Attribution 4.0 International Public License\\n\\nBy exercising the Licensed Rights (defined below), You accept and agree\\nto be bound by the terms and conditions of this Creative Commons\\nAttribution 4.0 International Public License (\\"Public License\\"). To the\\nextent this Public License may be interpreted as a contract, You are\\ngranted the Licensed Rights in consideration of Your acceptance of\\nthese terms and conditions, and the Licensor grants You such rights in\\nconsideration of benefits the Licensor receives from making the\\nLicensed Material available under these terms and conditions.\\n\\n\\nSection 1 -- Definitions.\\n\\n a. Adapted Material means material subject to Copyright and Similar\\n Rights that is derived from or based upon the Licensed Material\\n and in which the Licensed Material is translated, altered,\\n arranged, transformed, or otherwise modified in a manner requiring\\n permission under the Copyright and Similar Rights held by the\\n Licensor. For purposes of this Public License, where the Licensed\\n Material is a musical work, performance, or sound recording,\\n Adapted Material is always produced where the Licensed Material is\\n synched in timed relation with a moving image.\\n\\n b. Adapter''s License means the license You apply to Your Copyright\\n and Similar Rights in Your contributions to Adapted Material in\\n accordance with the terms and conditions of this Public License.\\n\\n c. Copyright and Similar Rights means copyright and/or similar rights\\n closely related to copyright including, without limitation,\\n performance, broadcast, sound recording, and Sui Generis Database\\n Rights, without regard to how the rights are labeled or\\n categorized. For purposes of this Public License, the rights\\n specified in Section 2(b)(1)-(2) are not Copyright and Similar\\n Rights.\\n\\n d. Effective Technological Measures means those measures that, in the\\n absence of proper authority, may not be circumvented under laws\\n fulfilling obligations under Article 11 of the WIPO Copyright\\n Treaty adopted on December 20, 1996, and/or similar international\\n agreements.\\n\\n e. Exceptions and Limitations means fair use, fair dealing, and/or\\n any other exception or limitation to Copyright and Similar Rights\\n that applies to Your use of the Licensed Material.\\n\\n f. Licensed Material means the artistic or literary work, database,\\n or other material to which the Licensor applied this Public\\n License.\\n\\n g. Licensed Rights means the rights granted to You subject to the\\n terms and conditions of this Public License, which are limited to\\n all Copyright and Similar Rights that apply to Your use of the\\n Licensed Material and that the Licensor has authority to license.\\n\\n h. Licensor means the individual(s) or entity(ies) granting rights\\n under this Public License.\\n\\n i. Share means to provide material to the public by any means or\\n process that requires permission under the Licensed Rights, such\\n as reproduction, public display, public performance, distribution,\\n dissemination, communication, or importation, and to make material\\n available to the public including in ways that members of the\\n public may access the material from a place and at a time\\n individually chosen by them.\\n\\n j. Sui Generis Database Rights means rights other than copyright\\n resulting from Directive 96/9/EC of the European Parliament and of\\n the Council of 11 March 1996 on the legal protection of databases,\\n as amended and/or succeeded, as well as other essentially\\n equivalent rights anywhere in the world.\\n\\n k. You means the individual or entity exercising the Licensed Rights\\n under this Public License. Your has a corresponding meaning.\\n\\n\\nSection 2 -- Scope.\\n\\n a. License grant.\\n\\n 1. Subject to the terms and conditions of this Public License,\\n the Licensor hereby grants You a worldwide, royalty-free,\\n non-sublicensable, non-exclusive, irrevocable license to\\n exercise the Licensed Rights in the Licensed Material to:\\n\\n a. reproduce and Share the Licensed Material, in whole or\\n in part; and\\n\\n b. produce, reproduce, and Share Adapted Material.\\n\\n 2. Exceptions and Limitations. For the avoidance of doubt, where\\n Exceptions and Limitations apply to Your use, this Public\\n License does not apply, and You do not need to comply with\\n its terms and conditions.\\n\\n 3. Term. The term of this Public License is specified in Section\\n 6(a).\\n\\n 4. Media and formats; technical modifications allowed. The\\n Licensor authorizes You to exercise the Licensed Rights in\\n all media and formats whether now known or hereafter created,\\n and to make technical modifications necessary to do so. The\\n Licensor waives and/or agrees not to assert any right or\\n authority to forbid You from making technical modifications\\n necessary to exercise the Licensed Rights, including\\n technical modifications necessary to circumvent Effective\\n Technological Measures. For purposes of this Public License,\\n simply making modifications authorized by this Section 2(a)\\n (4) never produces Adapted Material.\\n\\n 5. Downstream recipients.\\n\\n a. Offer from the Licensor -- Licensed Material. Every\\n recipient of the Licensed Material automatically\\n receives an offer from the Licensor to exercise the\\n Licensed Rights under the terms and conditions of this\\n Public License.\\n\\n b. No downstream restrictions. You may not offer or impose\\n any additional or different terms or conditions on, or\\n apply any Effective Technological Measures to, the\\n Licensed Material if doing so restricts exercise of the\\n Licensed Rights by any recipient of the Licensed\\n Material.\\n\\n 6. No endorsement. Nothing in this Public License constitutes or\\n may be construed as permission to assert or imply that You\\n are, or that Your use of the Licensed Material is, connected\\n with, or sponsored, endorsed, or granted official status by,\\n the Licensor or others designated to receive attribution as\\n provided in Section 3(a)(1)(A)(i).\\n\\n b. Other rights.\\n\\n 1. Moral rights, such as the right of integrity, are not\\n licensed under this Public License, nor are publicity,\\n privacy, and/or other similar personality rights; however, to\\n the extent possible, the Licensor waives and/or agrees not to\\n assert any such rights held by the Licensor to the limited\\n extent necessary to allow You to exercise the Licensed\\n Rights, but not otherwise.\\n\\n 2. Patent and trademark rights are not licensed under this\\n Public License.\\n\\n 3. To the extent possible, the Licensor waives any right to\\n collect royalties from You for the exercise of the Licensed\\n Rights, whether directly or through a collecting society\\n under any voluntary or waivable statutory or compulsory\\n licensing scheme. In all other cases the Licensor expressly\\n reserves any right to collect such royalties.\\n\\n\\nSection 3 -- License Conditions.\\n\\nYour exercise of the Licensed Rights is expressly made subject to the\\nfollowing conditions.\\n\\n a. Attribution.\\n\\n 1. If You Share the Licensed Material (including in modified\\n form), You must:\\n\\n a. retain the following if it is supplied by the Licensor\\n with the Licensed Material:\\n\\n i. identification of the creator(s) of the Licensed\\n Material and any others designated to receive\\n attribution, in any reasonable manner requested by\\n the Licensor (including by pseudonym if\\n designated);\\n\\n ii. a copyright notice;\\n\\n iii. a notice that refers to this Public License;\\n\\n iv. a notice that refers to the disclaimer of\\n warranties;\\n\\n v. a URI or hyperlink to the Licensed Material to the\\n extent reasonably practicable;\\n\\n b. indicate if You modified the Licensed Material and\\n retain an indication of any previous modifications; and\\n\\n c. indicate the Licensed Material is licensed under this\\n Public License, and include the text of, or the URI or\\n hyperlink to, this Public License.\\n\\n 2. You may satisfy the conditions in Section 3(a)(1) in any\\n reasonable manner based on the medium, means, and context in\\n which You Share the Licensed Material. For example, it may be\\n reasonable to satisfy the conditions by providing a URI or\\n hyperlink to a resource that includes the required\\n information.\\n\\n 3. If requested by the Licensor, You must remove any of the\\n information required by Section 3(a)(1)(A) to the extent\\n reasonably practicable.\\n\\n 4. If You Share Adapted Material You produce, the Adapter''s\\n License You apply must not prevent recipients of the Adapted\\n Material from complying with this Public License.\\n\\n\\nSection 4 -- Sui Generis Database Rights.\\n\\nWhere the Licensed Rights include Sui Generis Database Rights that\\napply to Your use of the Licensed Material:\\n\\n a. for the avoidance of doubt, Section 2(a)(1) grants You the right\\n to extract, reuse, reproduce, and Share all or a substantial\\n portion of the contents of the database;\\n\\n b. if You include all or a substantial portion of the database\\n contents in a database in which You have Sui Generis Database\\n Rights, then the database in which You have Sui Generis Database\\n Rights (but not its individual contents) is Adapted Material; and\\n\\n c. You must comply with the conditions in Section 3(a) if You Share\\n all or a substantial portion of the contents of the database.\\n\\nFor the avoidance of doubt, this Section 4 supplements and does not\\nreplace Your obligations under this Public License where the Licensed\\nRights include other Copyright and Similar Rights.\\n\\n\\nSection 5 -- Disclaimer of Warranties and Limitation of Liability.\\n\\n a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE\\n EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS\\n AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF\\n ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,\\n IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,\\n WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR\\n PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,\\n ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT\\n KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT\\n ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.\\n\\n b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE\\n TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,\\n NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,\\n INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,\\n COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR\\n USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN\\n ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR\\n DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR\\n IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.\\n\\n c. The disclaimer of warranties and limitation of liability provided\\n above shall be interpreted in a manner that, to the extent\\n possible, most closely approximates an absolute disclaimer and\\n waiver of all liability.\\n\\n\\nSection 6 -- Term and Termination.\\n\\n a. This Public License applies for the term of the Copyright and\\n Similar Rights licensed here. However, if You fail to comply with\\n this Public License, then Your rights under this Public License\\n terminate automatically.\\n\\n b. Where Your right to use the Licensed Material has terminated under\\n Section 6(a), it reinstates:\\n\\n 1. automatically as of the date the violation is cured, provided\\n it is cured within 30 days of Your discovery of the\\n violation; or\\n\\n 2. upon express reinstatement by the Licensor.\\n\\n For the avoidance of doubt, this Section 6(b) does not affect any\\n right the Licensor may have to seek remedies for Your violations\\n of this Public License.\\n\\n c. For the avoidance of doubt, the Licensor may also offer the\\n Licensed Material under separate terms or conditions or stop\\n distributing the Licensed Material at any time; however, doing so\\n will not terminate this Public License.\\n\\n d. Sections 1, 5, 6, 7, and 8 survive termination of this Public\\n License.\\n\\n\\nSection 7 -- Other Terms and Conditions.\\n\\n a. The Licensor shall not be bound by any additional or different\\n terms or conditions communicated by You unless expressly agreed.\\n\\n b. Any arrangements, understandings, or agreements regarding the\\n Licensed Material not stated herein are separate from and\\n independent of the terms and conditions of this Public License.\\n\\n\\nSection 8 -- Interpretation.\\n\\n a. For the avoidance of doubt, this Public License does not, and\\n shall not be interpreted to, reduce, limit, restrict, or impose\\n conditions on any use of the Licensed Material that could lawfully\\n be made without permission under this Public License.\\n\\n b. To the extent possible, if any provision of this Public License is\\n deemed unenforceable, it shall be automatically reformed to the\\n minimum extent necessary to make it enforceable. If the provision\\n cannot be reformed, it shall be severed from this Public License\\n without affecting the enforceability of the remaining terms and\\n conditions.\\n\\n c. No term or condition of this Public License will be waived and no\\n failure to comply consented to unless expressly agreed to by the\\n Licensor.\\n\\n d. Nothing in this Public License constitutes or may be interpreted\\n as a limitation upon, or waiver of, any privileges and immunities\\n that apply to the Licensor or You, including from the legal\\n processes of any jurisdiction or authority.\\n\\n\\n=======================================================================\\n\\nCreative Commons is not a party to its public\\nlicenses. Notwithstanding, Creative Commons may elect to apply one of\\nits public licenses to material it publishes and in those instances\\nwill be considered the “Licensor.” The text of the Creative Commons\\npublic licenses is dedicated to the public domain under the CC0 Public\\nDomain Dedication. Except for the limited purpose of indicating that\\nmaterial is shared under a Creative Commons public license or as\\notherwise permitted by the Creative Commons policies published at\\ncreativecommons.org/policies, Creative Commons does not authorize the\\nuse of the trademark \\"Creative Commons\\" or any other trademark or logo\\nof Creative Commons without its prior written consent including,\\nwithout limitation, in connection with any unauthorized modifications\\nto any of its public licenses or any other arrangements,\\nunderstandings, or agreements concerning use of licensed material. For\\nthe avoidance of doubt, this paragraph does not form part of the\\npublic licenses.\\n\\nCreative Commons may be contacted at creativecommons.org.","link":"https://creativecommons.org/licenses/by/4.0/","version":"4.0","creation_date":"2018-07-05","modification_date":"2023-03-30","active":true}'); +INSERT INTO public.licenses SELECT * FROM json_populate_record(NULL::public.licenses, '{"id":4,"long_name":"Other - See Data Usage Guidelines","short_name":"Other - See Data Usage Guidelines","text":"Other - See Data Usage Guidelines","link":"","version":"1.0","creation_date":"2019-08-06","modification_date":"2024-11-21","active":false}'); +INSERT INTO public.licenses SELECT * FROM json_populate_record(NULL::public.licenses, '{"id":6,"long_name":"CC BY-SA 4.0 (Attribution-ShareAlike)","short_name":"CC BY-SA 4.0","text":"Attribution-ShareAlike 4.0 International","link":"https://creativecommons.org/licenses/by-sa/4.0/","version":"4.0","creation_date":"2024-11-21","modification_date":"2024-11-21","active":true}'); +SELECT pg_catalog.setval(pg_get_serial_sequence('public.licenses', 'id'), (SELECT coalesce(max(id), 1) FROM public.licenses)); +INSERT INTO public.roles SELECT * FROM json_populate_record(NULL::public.roles, '{"id":1,"name":"admin"}'); +INSERT INTO public.roles SELECT * FROM json_populate_record(NULL::public.roles, '{"id":2,"name":"mapper"}'); +SELECT pg_catalog.setval(pg_get_serial_sequence('public.roles', 'id'), (SELECT coalesce(max(id), 1) FROM public.roles)); +INSERT INTO public.mondo_terms SELECT * FROM json_populate_record(NULL::public.mondo_terms, '{"id":1,"code":"MONDO:0000001","system":"https://purl.obolibrary.org/obo/mondo.owl","system_version":null,"label":"disease or disorder","creation_date":"2026-10-15","modification_date":"2026-10-15"}'); +SELECT pg_catalog.setval(pg_get_serial_sequence('public.mondo_terms', 'id'), (SELECT coalesce(max(id), 1) FROM public.mondo_terms)); + +REFRESH MATERIALIZED VIEW public.published_variants_materialized_view; diff --git a/alembic/manual_migrations/README b/alembic/manual_migrations/README deleted file mode 100644 index 824b46c17..000000000 --- a/alembic/manual_migrations/README +++ /dev/null @@ -1 +0,0 @@ -This directory contains database migrations run manually for which there is no simple upgrade/downgrade path. They are not runnable as is and will need to be either manually added to an existing alembic migration or transformed into raw SQL statements and executed directly. diff --git a/alembic/manual_migrations/migrate_consolidated_score_ranges_and_calibrations.py b/alembic/manual_migrations/migrate_consolidated_score_ranges_and_calibrations.py deleted file mode 100644 index be6f4a68b..000000000 --- a/alembic/manual_migrations/migrate_consolidated_score_ranges_and_calibrations.py +++ /dev/null @@ -1,125 +0,0 @@ -""" -To be run as part of revision af87c9953d2d -""" - -import sqlalchemy as sa -from sqlalchemy.orm import Session, configure_mappers - -from mavedb.models import * -from sqlalchemy.orm import Session - -from mavedb.models.score_set import ScoreSet -from mavedb.view_models.score_range import ScoreSetRangesCreate, InvestigatorScoreRangesCreate, ZeibergCalibrationScoreRangesCreate, ZeibergCalibrationScoreRangeCreate - - -from mavedb.db.session import SessionLocal - -configure_mappers() - - -evidence_strength_to_label = { - -8: "BS3_VERY_STRONG", - -4: "BS3_STRONG", - -3: "BS3_MODERATE+", - -2: "BS3_MODERATE", - -1: "BS3_SUPPORTING", - 1: "PS3_SUPPORTING", - 2: "PS3_MODERATE", - 3: "PS3_MODERATE+", - 4: "PS3_STRONG", - 8: "PS3_VERY_STRONG", -} - - -def do_migration(db: Session): - score_sets_with_ranges_or_calibrations = db.scalars(sa.select(ScoreSet).where(ScoreSet.score_ranges.isnot(None) | ScoreSet.score_calibrations.isnot(None))).all() - - for score_set in score_sets_with_ranges_or_calibrations: - if score_set.score_ranges is not None: - investigator_ranges = InvestigatorScoreRangesCreate( - **score_set.score_ranges - ) - for score_range in investigator_ranges.ranges: - score_range.inclusive_lower_bound = False if score_range.range[0] is None else True - score_range.inclusive_upper_bound = False - - else: - investigator_ranges = None - - if score_set.score_calibrations is not None: - thresholds = score_set.score_calibrations.get("zeiberg_calibration", {}).get("thresholds", []) - evidence_strengths = score_set.score_calibrations.get("zeiberg_calibration", {}).get("evidence_strengths", []) - positive_likelihood_ratios = score_set.score_calibrations.get("zeiberg_calibration", {}).get("positive_likelihood_ratios", []) - prior_probability_pathogenicity = score_set.score_calibrations.get("zeiberg_calibration", {}).get("prior_probability_pathogenicity", None) - parameter_sets = score_set.score_calibrations.get("zeiberg_calibration", {}).get("parameter_sets", []) - - ranges = [] - boundary_direction = -1 # Start with a negative sign to indicate the first range has the lower boundary appearing prior to the threshold - for idx, vals in enumerate(zip(thresholds, evidence_strengths, positive_likelihood_ratios)): - threshold, evidence_strength, positive_likelihood_ratio = vals - - if idx == 0: - calculated_range = (None, threshold) - ranges.append(ZeibergCalibrationScoreRangeCreate( - range=(None, threshold), - classification="normal" if evidence_strength < 0 else "abnormal", - label=str(evidence_strength), - evidence_strength=evidence_strength, - positive_likelihood_ratio=positive_likelihood_ratio, - inclusive_lower_bound=False, - inclusive_upper_bound=False, - )) - elif idx == len(thresholds) - 1: - calculated_range = (threshold, None) - ranges.append(ZeibergCalibrationScoreRangeCreate( - range=(threshold, None), - classification="normal" if evidence_strength < 0 else "abnormal", - evidence_strength=evidence_strength, - label=str(evidence_strength), - positive_likelihood_ratio=positive_likelihood_ratio, - inclusive_lower_bound=True, - inclusive_upper_bound=False, - )) - else: - if boundary_direction < 0: - calculated_range = (thresholds[idx - 1], threshold) - else: - calculated_range = (threshold, thresholds[idx + 1]) - - ranges.append(ZeibergCalibrationScoreRangeCreate( - range=calculated_range, - classification="normal" if evidence_strength < 0 else "abnormal", - label=str(evidence_strength), - evidence_strength=evidence_strength, - positive_likelihood_ratio=positive_likelihood_ratio, - inclusive_lower_bound=True, - inclusive_upper_bound=False, - )) - - # Set boundary_direction if the sign of evidence_strength flips compared to the next one - if idx != len(evidence_strengths) - 1 and (evidence_strengths[idx + 1] * evidence_strength < 0): - boundary_direction = -boundary_direction - - zeiberg_calibration_ranges = ZeibergCalibrationScoreRangesCreate( - prior_probability_pathogenicity=prior_probability_pathogenicity, - parameter_sets=parameter_sets, - ranges=ranges, - ) - else: - zeiberg_calibration_ranges = None - - score_set.score_ranges = ScoreSetRangesCreate( - investigator_provided=investigator_ranges if investigator_ranges else None, - zeiberg_calibration=zeiberg_calibration_ranges if zeiberg_calibration_ranges else None, - ).model_dump() - db.add(score_set) - - -if __name__ == "__main__": - db = SessionLocal() - db.current_user = None # type: ignore - - do_migration(db) - - db.commit() - db.close() diff --git a/alembic/manual_migrations/migrate_jsonb_ranges_to_table_rows.py b/alembic/manual_migrations/migrate_jsonb_ranges_to_table_rows.py deleted file mode 100644 index 115af0b34..000000000 --- a/alembic/manual_migrations/migrate_jsonb_ranges_to_table_rows.py +++ /dev/null @@ -1,374 +0,0 @@ -""" -Migration script to convert JSONB functional_ranges to the new row-based implementation. - -This script migrates data from ScoreCalibration.functional_ranges (JSONB column) -to the new ScoreCalibrationFunctionalClassification table with proper foreign key relationships. -""" -from typing import Any, Dict - -import sqlalchemy as sa -from sqlalchemy.orm import Session, configure_mappers - -from mavedb.models import * -from mavedb.db.session import SessionLocal -from mavedb.models.acmg_classification import ACMGClassification -from mavedb.models.enums.acmg_criterion import ACMGCriterion -from mavedb.models.enums.functional_classification import FunctionalClassification -from mavedb.models.enums.strength_of_evidence import StrengthOfEvidenceProvided -from mavedb.models.score_calibration import ScoreCalibration -from mavedb.models.score_calibration_functional_classification import ScoreCalibrationFunctionalClassification -from mavedb.models.score_calibration_functional_classification_variant_association import ( - score_calibration_functional_classification_variants_association_table -) -from mavedb.models.variant import Variant -from mavedb.view_models.acmg_classification import ACMGClassificationCreate - -configure_mappers() - - -def populate_variant_associations( - db: Session, - functional_classification: ScoreCalibrationFunctionalClassification, - calibration: ScoreCalibration, -) -> int: - """Populate the association table with variants that fall within this functional range.""" - # Create a view model instance to use the existing range checking logic - if not functional_classification or not functional_classification.range: - print(f" Skipping variant association - no valid range or view model") - return 0 - - print(f" Finding variants within range {functional_classification.range} (lower_inclusive={functional_classification.inclusive_lower_bound}, upper_inclusive={functional_classification.inclusive_upper_bound})") - - # Get all variants for this score set and their scores - variants_query = db.execute(sa.select(Variant).where( - Variant.score_set_id == calibration.score_set_id, - )).scalars().all() - - variants_in_range = [] - total_variants = 0 - - for variant in variants_query: - total_variants += 1 - - # Extract score from JSONB data - try: - score_data = variant.data.get("score_data", {}).get("score") if variant.data else None - if score_data is not None: - variant_score = float(score_data) - - # Use the existing view model method for range checking - if functional_classification.score_is_contained_in_range(variant_score): - variants_in_range.append(variant) - - except (ValueError, TypeError) as e: - print(f" Warning: Could not parse score for variant {variant.id}: {e}") - continue - - print(f" Found {len(variants_in_range)} variants in range out of {total_variants} total variants") - - # Bulk insert associations - if variants_in_range: - associations = [ - { - "functional_classification_id": functional_classification.id, - "variant_id": variant.id - } - for variant in variants_in_range - ] - - db.execute( - score_calibration_functional_classification_variants_association_table.insert(), - associations - ) - - return len(variants_in_range) - - -def migrate_functional_range_to_row( - db: Session, - calibration: ScoreCalibration, - functional_range: Dict[str, Any], - acmg_classification_cache: Dict[str, ACMGClassification] -) -> ScoreCalibrationFunctionalClassification: - """Convert a single functional range from JSONB to table row.""" - - # Handle ACMG classification if present - acmg_classification_id = None - acmg_data = functional_range.get("acmg_classification") - if acmg_data: - # Create a cache key for the ACMG classification - criterion = acmg_data.get("criterion").upper() if acmg_data.get("criterion") else None - evidence_strength = acmg_data.get("evidence_strength").upper() if acmg_data.get("evidence_strength") else None - points = acmg_data.get("points") - - classification = ACMGClassificationCreate( - criterion=ACMGCriterion(criterion) if criterion else None, - evidence_strength=StrengthOfEvidenceProvided(evidence_strength) if evidence_strength else None, - points=points - ) - - cache_key = f"{classification.criterion}_{classification.evidence_strength}_{classification.points}" - - if cache_key not in acmg_classification_cache: - # Create new ACMG classification - acmg_classification = ACMGClassification( - criterion=classification.criterion, - evidence_strength=classification.evidence_strength, - points=classification.points - ) - db.add(acmg_classification) - db.flush() # Get the ID - acmg_classification_cache[cache_key] = acmg_classification - - acmg_classification_id = acmg_classification_cache[cache_key].id - - # Create the functional classification row - functional_classification = ScoreCalibrationFunctionalClassification( - calibration_id=calibration.id, - label=functional_range.get("label", ""), - description=functional_range.get("description"), - functional_classification=FunctionalClassification(functional_range.get("classification", "not_specified")), - range=functional_range.get("range"), - inclusive_lower_bound=functional_range.get("inclusive_lower_bound"), - inclusive_upper_bound=functional_range.get("inclusive_upper_bound"), - oddspaths_ratio=functional_range.get("oddspaths_ratio"), - positive_likelihood_ratio=functional_range.get("positive_likelihood_ratio"), - acmg_classification_id=acmg_classification_id - ) - - return functional_classification - - -def do_migration(db: Session): - """Main migration function.""" - print("Starting migration of JSONB functional_ranges to table rows...") - - # Find all calibrations with functional_ranges - calibrations_with_ranges = db.scalars( - sa.select(ScoreCalibration).where(ScoreCalibration.functional_ranges_deprecated_json.isnot(None)) - ).all() - - print(f"Found {len(calibrations_with_ranges)} calibrations with functional ranges to migrate.") - - # Cache for ACMG classifications to avoid duplicates - acmg_classification_cache: Dict[str, ACMGClassification] = {} - - migrated_count = 0 - error_count = 0 - - for calibration in calibrations_with_ranges: - try: - print(f"Migrating calibration {calibration.id} (URN: {calibration.urn})...") - - functional_ranges_data = calibration.functional_ranges_deprecated_json - if not functional_ranges_data or not isinstance(functional_ranges_data, list): - print(f" Skipping calibration {calibration.id} - no valid functional ranges data") - continue - - # Create functional classification rows for each range - functional_classifications = [] - for i, functional_range in enumerate(functional_ranges_data): - try: - functional_classification = migrate_functional_range_to_row( - db, calibration, functional_range, acmg_classification_cache - ) - db.add(functional_classification) - functional_classifications.append(functional_classification) - print(f" Created functional classification row {i+1}/{len(functional_ranges_data)}") - - except Exception as e: - print(f" Error migrating functional range {i+1} for calibration {calibration.id}: {e}") - error_count += 1 - continue - - # Flush to get IDs for the functional classifications - db.flush() - - # Populate variant associations for each functional classification - total_associations = 0 - for functional_classification in functional_classifications: - try: - associations_count = populate_variant_associations( - db, functional_classification, calibration - ) - total_associations += associations_count - - except Exception as e: - print(f" Error populating variant associations for functional classification {functional_classification.id}: {e}") - error_count += 1 - continue - - print(f" Created {total_associations} variant associations") - - # Commit the changes for this calibration - db.commit() - migrated_count += 1 - print(f" Successfully migrated calibration {calibration.id}") - - except Exception as e: - print(f"Error migrating calibration {calibration.id}: {e}") - db.rollback() - error_count += 1 - continue - - # Final statistics - total_functional_classifications = db.scalar( - sa.select(sa.func.count(ScoreCalibrationFunctionalClassification.id)) - ) - - total_associations = db.scalar( - sa.select(sa.func.count()).select_from( - score_calibration_functional_classification_variants_association_table - ) - ) or 0 - - print(f"\nMigration completed:") - print(f" Successfully migrated: {migrated_count} calibrations") - print(f" Functional classification rows created: {total_functional_classifications}") - print(f" Variant associations created: {total_associations}") - print(f" ACMG classifications created: {len(acmg_classification_cache)}") - print(f" Errors encountered: {error_count}") - - -def verify_migration(db: Session): - """Verify that the migration was successful.""" - print("\nVerifying migration...") - - # Count original calibrations with functional ranges - original_count = db.scalar( - sa.select(sa.func.count(ScoreCalibration.id)).where( - ScoreCalibration.functional_ranges_deprecated_json.isnot(None) - ) - ) - - # Count migrated functional classifications - migrated_count = db.scalar( - sa.select(sa.func.count(ScoreCalibrationFunctionalClassification.id)) - ) - - # Count ACMG classifications - acmg_count = db.scalar( - sa.select(sa.func.count(ACMGClassification.id)) - ) - - # Count variant associations - association_count = db.scalar( - sa.select(sa.func.count()).select_from( - score_calibration_functional_classification_variants_association_table - ) - ) - - print(f"Original calibrations with functional ranges: {original_count}") - print(f"Migrated functional classification rows: {migrated_count}") - print(f"ACMG classification records: {acmg_count}") - print(f"Variant associations created: {association_count}") - - # Sample verification - check that relationships work - sample_classification = db.scalar( - sa.select(ScoreCalibrationFunctionalClassification).limit(1) - ) - - if sample_classification: - print(f"\nSample verification:") - print(f" Functional classification ID: {sample_classification.id}") - print(f" Label: {sample_classification.label}") - print(f" Classification: {sample_classification.classification}") - print(f" Range: {sample_classification.range}") - print(f" Calibration ID: {sample_classification.calibration_id}") - print(f" ACMG classification ID: {sample_classification.acmg_classification_id}") - - # Count variants associated with this classification - variant_count = db.scalar( - sa.select(sa.func.count()).select_from( - score_calibration_functional_classification_variants_association_table - ).where( - score_calibration_functional_classification_variants_association_table.c.functional_classification_id == sample_classification.id - ) - ) - print(f" Associated variants: {variant_count}") - - # Functional classifications by type - classification_stats = db.execute( - sa.select( - ScoreCalibrationFunctionalClassification.classification, - sa.func.count().label('count') - ).group_by(ScoreCalibrationFunctionalClassification.classification) - ).all() - - for classification, count in classification_stats: - print(f"{classification}: {count} ranges") - - - -def rollback_migration(db: Session): - """Rollback the migration by deleting all migrated data.""" - print("Rolling back migration...") - - # Count records before deletion - functional_count = db.scalar( - sa.select(sa.func.count(ScoreCalibrationFunctionalClassification.id)) - ) - - acmg_count = db.scalar( - sa.select(sa.func.count(ACMGClassification.id)) - ) - - association_count = db.scalar( - sa.select(sa.func.count()).select_from( - score_calibration_functional_classification_variants_association_table - ) - ) - - # Delete in correct order (associations first, then functional classifications, then ACMG) - db.execute(sa.delete(score_calibration_functional_classification_variants_association_table)) - db.execute(sa.delete(ScoreCalibrationFunctionalClassification)) - db.execute(sa.delete(ACMGClassification)) - db.commit() - - print(f"Deleted {association_count} variant associations") - print(f"Deleted {functional_count} functional classification rows") - print(f"Deleted {acmg_count} ACMG classification rows") - - -def show_usage(): - """Show usage information.""" - print(""" -Usage: python migrate_jsonb_ranges_to_table_rows.py [command] - -Commands: - migrate (default) - Migrate JSONB functional_ranges to table rows - verify - Verify migration without running it - rollback - Remove all migrated data (destructive!) - -Examples: - python migrate_jsonb_ranges_to_table_rows.py # Run migration - python migrate_jsonb_ranges_to_table_rows.py verify # Check status - python migrate_jsonb_ranges_to_table_rows.py rollback # Undo migration -""") - - -if __name__ == "__main__": - import sys - - command = sys.argv[1] if len(sys.argv) > 1 else "migrate" - - if command == "help" or command == "--help" or command == "-h": - show_usage() - elif command == "rollback": - print("WARNING: This will delete all migrated functional classification data!") - response = input("Are you sure you want to continue? (y/N): ") - if response.lower() == 'y': - with SessionLocal() as db: - rollback_migration(db) - else: - print("Rollback cancelled.") - elif command == "verify": - with SessionLocal() as db: - verify_migration(db) - elif command == "migrate": - with SessionLocal() as db: - do_migration(db) - verify_migration(db) - else: - print(f"Unknown command: {command}") - show_usage() diff --git a/alembic/manual_migrations/migrate_non_api_like_constants.py b/alembic/manual_migrations/migrate_non_api_like_constants.py deleted file mode 100644 index e59d5f3c2..000000000 --- a/alembic/manual_migrations/migrate_non_api_like_constants.py +++ /dev/null @@ -1,40 +0,0 @@ -import sqlalchemy as sa -from sqlalchemy.orm import Session, configure_mappers - -from mavedb.models import * -from mavedb.models.enums.target_category import TargetCategory -from mavedb.models.target_gene import TargetGene - -from mavedb.db.session import SessionLocal - -configure_mappers() - -def api_like_target_gene_category(category: str): - if category == "Protein coding": - return TargetCategory.protein_coding - elif category == "Other noncoding": - return TargetCategory.other_noncoding - elif category == "Regulatory": - return TargetCategory.regulatory - else: - raise ValueError() - - -def do_migration(db: Session): - target_genes = db.scalars(sa.select(TargetGene)).all() - - for target in target_genes: - target.category = api_like_target_gene_category(target.category) - db.add(target) - - db.commit() - - -if __name__ == "__main__": - db = SessionLocal() - db.current_user = None # type: ignore - - do_migration(db) - - db.commit() - db.close() diff --git a/alembic/manual_migrations/migrate_score_ranges_to_calibrations.py b/alembic/manual_migrations/migrate_score_ranges_to_calibrations.py deleted file mode 100644 index 615f19e0f..000000000 --- a/alembic/manual_migrations/migrate_score_ranges_to_calibrations.py +++ /dev/null @@ -1,155 +0,0 @@ - -from typing import Union - -import sqlalchemy as sa -from sqlalchemy.orm import Session - -# SQLAlchemy needs access to all models to properly map relationships. -from mavedb.models import * - -from mavedb.db.session import SessionLocal -from mavedb.models.score_set import ScoreSet -from mavedb.models.score_calibration import ScoreCalibration as ScoreCalibrationDBModel -from mavedb.models.publication_identifier import PublicationIdentifier -from mavedb.view_models.score_range import ( - ScoreRangeCreate, - ScoreSetRangesAdminCreate, - ZeibergCalibrationScoreRangesAdminCreate, - ScottScoreRangesAdminCreate, - InvestigatorScoreRangesAdminCreate, - IGVFCodingVariantFocusGroupControlScoreRangesAdminCreate, - IGVFCodingVariantFocusGroupMissenseScoreRangesAdminCreate, -) - -score_range_kinds: dict[ - str, - Union[ - type[ZeibergCalibrationScoreRangesAdminCreate], - type[ScottScoreRangesAdminCreate], - type[InvestigatorScoreRangesAdminCreate], - type[IGVFCodingVariantFocusGroupControlScoreRangesAdminCreate], - type[IGVFCodingVariantFocusGroupMissenseScoreRangesAdminCreate], - ], -] = { - "zeiberg_calibration": ZeibergCalibrationScoreRangesAdminCreate, - "scott_calibration": ScottScoreRangesAdminCreate, - "investigator_provided": InvestigatorScoreRangesAdminCreate, - "cvfg_all_variants": IGVFCodingVariantFocusGroupControlScoreRangesAdminCreate, - "cvfg_missense_variants": IGVFCodingVariantFocusGroupMissenseScoreRangesAdminCreate, -} - -EVIDENCE_STRENGTH_FROM_POINTS = { - 8: "Very Strong", - 4: "Strong", - 3: "Moderate+", - 2: "Moderate", - 1: "Supporting", -} - - -def do_migration(session: Session) -> None: - score_sets_with_ranges = ( - session.execute(sa.select(ScoreSet).where(ScoreSet.score_ranges.isnot(None))).scalars().all() - ) - - for score_set in score_sets_with_ranges: - if not score_set.score_ranges: - continue - - score_set_ranges = ScoreSetRangesAdminCreate.model_validate(score_set.score_ranges) - - for field in score_set_ranges.model_fields_set: - if field == "record_type": - continue - - ranges = getattr(score_set_ranges, field) - if not ranges: - continue - - range_model = score_range_kinds.get(field) - inferred_ranges = range_model.model_validate(ranges) - - model_thresholds = [] - for range in inferred_ranges.ranges: - model_thresholds.append(ScoreRangeCreate.model_validate(range.__dict__).model_dump()) - - # We should migrate the zeiberg evidence classifications to be explicitly part of the calibration ranges. - if field == "zeiberg_calibration": - for inferred_range, model_range in zip( - inferred_ranges.ranges, - model_thresholds, - ): - model_range["label"] = f"PS3 {EVIDENCE_STRENGTH_FROM_POINTS.get(inferred_range.evidence_strength, 'Unknown')}" if inferred_range.evidence_strength > 0 else f"BS3 {EVIDENCE_STRENGTH_FROM_POINTS.get(abs(inferred_range.evidence_strength), 'Unknown')}" - model_range["acmg_classification"] = {"points": inferred_range.evidence_strength} - - # Reliant on existing behavior that these sources have been created already. - # If not present, no sources will be associated. - if "odds_path_source" in inferred_ranges.model_fields_set and inferred_ranges.odds_path_source: - oddspaths_sources = ( - session.execute( - sa.select(PublicationIdentifier).where( - PublicationIdentifier.identifier.in_( - [src.identifier for src in (inferred_ranges.odds_path_source or [])] - ) - ) - ) - .scalars() - .all() - ) - else: - oddspaths_sources = [] - - if "source" in inferred_ranges.model_fields_set and inferred_ranges.source: - range_sources = ( - session.execute( - sa.select(PublicationIdentifier).where( - PublicationIdentifier.identifier.in_( - [src.identifier for src in (inferred_ranges.source or [])] - ) - ) - ) - .scalars() - .all() - ) - else: - range_sources = [] - - sources = set() - for publication in oddspaths_sources: - setattr(publication, "relation", "method") - sources.add(publication) - for publication in range_sources: - setattr(publication, "relation", "threshold") - sources.add(publication) - - score_calibration = ScoreCalibrationDBModel( - score_set_id=score_set.id, - title=inferred_ranges.title, - research_use_only=inferred_ranges.research_use_only, - primary=inferred_ranges.primary, - private=False, # All migrated calibrations are public. - investigator_provided=True if field == "investigator_provided" else False, - baseline_score=inferred_ranges.baseline_score - if "baseline_score" in inferred_ranges.model_fields_set - else None, - baseline_score_description=inferred_ranges.baseline_score_description - if "baseline_score_description" in inferred_ranges.model_fields_set - else None, - functional_ranges=None if not model_thresholds else model_thresholds, - calibration_metadata=None, - publication_identifiers=sources, - # If investigator_provided, set to creator of score set, else set to default system user (1). - created_by_id=score_set.created_by_id if field == "investigator_provided" else 1, - modified_by_id=score_set.created_by_id if field == "investigator_provided" else 1, - ) - session.add(score_calibration) - - -if __name__ == "__main__": - db = SessionLocal() - db.current_user = None # type: ignore - - do_migration(db) - - db.commit() - db.close() \ No newline at end of file diff --git a/alembic/manual_migrations/migrate_single_target_endogenous_edit_transcripts_to_be_fully_qualified.py b/alembic/manual_migrations/migrate_single_target_endogenous_edit_transcripts_to_be_fully_qualified.py deleted file mode 100644 index e9008dfb4..000000000 --- a/alembic/manual_migrations/migrate_single_target_endogenous_edit_transcripts_to_be_fully_qualified.py +++ /dev/null @@ -1,56 +0,0 @@ -import sqlalchemy as sa -from sqlalchemy.orm import Session, configure_mappers - -from mavedb.models import * - -from mavedb.models.score_set import ScoreSet -from mavedb.models.variant import Variant -from mavedb.models.target_gene import TargetGene -from mavedb.models.target_accession import TargetAccession - -from mavedb.db.session import SessionLocal - -configure_mappers() - - -def do_migration(db: Session): - accession_based_score_sets = db.execute( - sa.select(ScoreSet).join(TargetGene).where(TargetGene.accession_id.isnot(None)) - ).scalars() - - for score_set in accession_based_score_sets: - total_targets = len( - list(db.execute(sa.select(TargetGene).where(TargetGene.score_set_id == score_set.id)).scalars()) - ) - - # Variants from score sets with multiple targets are already in the desired format. - if total_targets > 1: - continue - - target_accession = db.execute( - sa.select(TargetAccession.accession).join(TargetGene).where(TargetGene.score_set_id == score_set.id) - ).scalar() - variants = db.execute(sa.select(Variant).where(Variant.score_set_id == score_set.id)).scalars() - - if target_accession is None: - raise ValueError("target accession should never be None.") - - for variant in variants: - if variant.hgvs_nt: - variant.hgvs_nt = f"{target_accession}:{variant.hgvs_nt}" - if variant.hgvs_pro: - variant.hgvs_pro = f"{target_accession}:{variant.hgvs_pro}" - if variant.hgvs_splice: - variant.hgvs_splice = f"{target_accession}:{variant.hgvs_splice}" - - db.add(variant) - - -if __name__ == "__main__": - db = SessionLocal() - db.current_user = None # type: ignore - - do_migration(db) - - db.commit() - db.close() diff --git a/alembic/manual_migrations/migrate_target_gene_mapping_qc.py b/alembic/manual_migrations/migrate_target_gene_mapping_qc.py deleted file mode 100644 index 41eec4665..000000000 --- a/alembic/manual_migrations/migrate_target_gene_mapping_qc.py +++ /dev/null @@ -1,610 +0,0 @@ -"""Backfill ``target_gene_mappings`` rows and per-variant ScoreAnnotation columns -for existing ``mapped_variants``. - -Context -------- -Schema migration ``8c4a2f1d9e6b`` introduced the ``target_gene_mappings`` table -(per-(target gene, alignment level) provenance/QC) and added -``target_gene_mapping_id`` / ``alignment_level`` / ``at_mismatched_locus`` / -``near_gap`` columns on ``mapped_variants``. These columns are nullable so the -schema migration can run without data; this standalone script populates them. - -Strategy --------- -We can't recover the original QC numbers (they were never produced), so most -TargetGeneMapping fields stay null. What we *can* derive deterministically: - -* ``alignment_level`` of each MappedVariant -- via the cascade described below. -* ``target_gene`` of each MappedVariant -- the only target for single-target - score sets; for multi-target score sets we parse the ``Variant.hgvs_nt`` / - ``hgvs_pro`` / ``hgvs_splice`` prefix (``TARGET_NAME:c.1A>G``). -* ``tool_version`` -- copied from ``MappedVariant.mapping_api_version`` (one - TargetGeneMapping row is created per distinct (target, level, tool_version)). - -Layer attribution cascade -------------------------- -Attribution is attempted in order, stopping at the first success: - -1. ``target.post_mapped_metadata`` keys -- deterministic when populated. -2. ``target.pre_mapped_metadata`` keys -- same layer structure; covers targets - where a computed reference sequence was found but all variant-level mappings - failed before producing ``post_mapped`` output. -3. ``post_mapped`` VRS HGVS / sequence alphabet -- inspects a sample of mapped - variants; reliable because dcd-mapping uses ``preferred_layer_only=True``. -4. ``target_sequence.sequence_type`` + ``category`` -- last resort for targets - where every variant failed before any VRS data was produced: - - ``protein`` sequence_type → protein layer (always) - - ``dna`` + ``protein_coding`` category → genomic (dcd-mapping uses MANE - select for protein-coding genes regardless of input sequence) - - ``dna`` + non-coding categories → ambiguous; left unattributed - -Known unattributable case --------------------------- -Score sets whose targets have a ``dna`` sequence type with a non-coding category -(``regulatory`` or ``other_noncoding``) AND where every mapped variant failed -before producing any ``post_mapped`` or reference-sequence metadata cannot be -attributed deterministically. For these targets, cDNA and genomic are both valid -dcd-mapping outputs and there is no surviving signal to distinguish them. - -In practice this means we can fully attribute all legacy mappings to a layer as -we don't have any examples of this unnatributable case in production data. - -We follow the multi-hop/standalone-script convention used by -``migrate_jsonb_ranges_to_table_rows.py`` so this can be invoked outside of -``alembic upgrade`` (it can take a long time on production data). - -Usage ------ -:: - - python -m alembic.manual_migrations.migrate_target_gene_mapping_qc # run - python -m alembic.manual_migrations.migrate_target_gene_mapping_qc verify # status - python -m alembic.manual_migrations.migrate_target_gene_mapping_qc rollback # destructive -""" - -from __future__ import annotations - -import re -import sys -from collections import defaultdict -from typing import Optional - -import sqlalchemy as sa -from sqlalchemy.orm import Session, configure_mappers, selectinload - -# SQLAlchemy needs access to all models to properly map relationships. -from mavedb.models import * # noqa: F401,F403 pylint: disable=wildcard-import -from mavedb.db.session import SessionLocal -from mavedb.lib.variants import HGVS_G_REGEX, HGVS_P_REGEX, get_hgvs_from_post_mapped -from mavedb.models.enums.sequence_level import SequenceLevel -from mavedb.models.mapped_variant import MappedVariant -from mavedb.models.score_set import ScoreSet -from mavedb.models.target_gene import TargetGene -from mavedb.models.target_gene_mapping import TargetGeneMapping -from mavedb.models.variant import Variant - -configure_mappers() - -# Pattern for the ``TARGET_NAME:`` prefix used on variant.hgvs_* strings in -# multi-target score sets. Per mavehgvs grammar a target name is an unquoted -# identifier ending with ``:``; we only need to capture the leading token. -_MULTI_TARGET_PREFIX_RE = re.compile(r"^([^:\s]+):") - -# cDNA / non-coding HGVS prefix (``c.`` or ``n.``). ``HGVS_G_REGEX`` and -# ``HGVS_P_REGEX`` already cover ``g.`` and ``p.`` -- this fills the gap. -_HGVS_C_REGEX = re.compile(r"(^|:)[cn]\.") - -# Nucleotide alphabet for distinguishing protein from nucleotide sequences in VRS -# state/ref-allele payloads. IUPAC ambiguity codes (``V``, ``S``, ``H`` etc.) are -# intentionally excluded -- they overlap with amino-acid one-letter codes and are -# not used in MAVE variant alleles. Any letter outside this set (e.g. ``V``, ``S``, -# ``T`` as amino acids) pins the layer to protein. -_NUCLEOTIDE_ALPHABET = frozenset("ACGTUNRYSWKMBDHV-") - - -def _layer_from_hgvs(hgvs: str) -> Optional[SequenceLevel]: - """Classify an HGVS string into an :class:`SequenceLevel`.""" - if HGVS_G_REGEX.search(hgvs): - return SequenceLevel.genomic - if HGVS_P_REGEX.search(hgvs): - return SequenceLevel.protein - if _HGVS_C_REGEX.search(hgvs): - return SequenceLevel.cdna - return None - - -def _layer_from_vrs_sequence(post_mapped: dict) -> Optional[SequenceLevel]: - """ - Infer layer from VRS sequence alphabet (protein vs nucleotide). - Returns protein if any allele/member sequence contains a non-nucleotide letter. - Returns genomic otherwise (since we never go to cDNA directly). - Handles both VRS 2.X and VRS 1.X (VariationDescriptor) structures. - """ - if not post_mapped: - return None - - def extract_sequences(obj): - # VRS 2.X Allele - if obj.get("type") == "Allele": - seq = obj.get("state", {}).get("sequence") - if seq: - yield seq - - # VRS 1.X VariationDescriptor - elif obj.get("type") == "VariationDescriptor": - seq = obj.get("vrs_ref_allele_seq") - if seq: - yield seq - - # Also check nested variation - var = obj.get("variation") - if isinstance(var, dict): - yield from extract_sequences(var) - - # Haplotype or CisPhasedBlock - elif obj.get("type") in ("Haplotype", "CisPhasedBlock"): - for member in obj.get("members", []): - yield from extract_sequences(member) - - found_seq = False - for seq in extract_sequences(post_mapped): - found_seq = True - if any(letter.upper() not in _NUCLEOTIDE_ALPHABET for letter in seq if letter.isalpha()): - return SequenceLevel.protein - - if found_seq: - return SequenceLevel.genomic - - return None - - -def _alignment_level_for(target: TargetGene) -> Optional[SequenceLevel]: - """Recover the alignment layer for legacy mapped variants of ``target``. - - Tries ``post_mapped_metadata`` first, then ``pre_mapped_metadata`` (same - key structure). The worker writes one entry per layer that produced a - reference sequence; genomic alignments also emit cDNA metadata "for free" - via the transcript, so ``{genomic, cdna}`` is a normal genomic-layer output. - ``{genomic, protein}`` is not a valid ``preferred_layer_only=True`` output; - we treat it as unattributable so diagnostics surface it for inspection. - """ - for metadata in (target.post_mapped_metadata or {}, target.pre_mapped_metadata or {}): - has_genomic = "genomic" in metadata - has_protein = "protein" in metadata - has_cdna = "cdna" in metadata - - if has_genomic and has_protein: - return None - - if has_genomic: - return SequenceLevel.genomic - if has_protein: - return SequenceLevel.protein - if has_cdna: - return SequenceLevel.cdna - - return None - - -def _layer_from_sequence_type(target: TargetGene) -> Optional[SequenceLevel]: - """Infer alignment layer from ``target_sequence.sequence_type`` and ``category``. - - Last-resort fallback for targets where all variant-level mappings failed - before any VRS data was produced. Reflects dcd-mapping's selection logic: - - Protein sequences are always aligned at the protein layer. - - DNA sequences for protein-coding genes are aligned at the genomic layer - via MANE select, regardless of the input sequence representation. - - DNA sequences for non-coding categories are ambiguous without VRS data - (cDNA or genomic) and are left unattributed. - """ - if target.target_sequence is None: - return None - seq_type = target.target_sequence.sequence_type - if seq_type == "protein": - return SequenceLevel.protein - if seq_type == "dna" and target.category is not None and target.category.value == "protein_coding": - return SequenceLevel.genomic - return None - - -def _populate_layer_by_target_id( - db: Session, - targets_by_score_set_id: dict[int, list[TargetGene]], - layer_by_target_id: dict[int, Optional[SequenceLevel]], - layer_via_hgvs_target_ids: set[int], - layer_via_sequence_type_target_ids: set[int], -) -> None: - """Determine the alignment layer for every target up front. - - Applies the attribution cascade documented in the module docstring: - 1. post/pre_mapped_metadata keys on the target gene - 2. post_mapped VRS inspection on a sample of mapped variants - 3. target_sequence.sequence_type + category as last resort - """ - mv_t = MappedVariant.__table__ - v_t = Variant.__table__ - - for score_set_id, targets in targets_by_score_set_id.items(): - ambiguous: list[TargetGene] = [] - for target in targets: - level = _alignment_level_for(target) - if level is not None: - layer_by_target_id[target.id] = level - else: - ambiguous.append(target) - - if not ambiguous: - continue - - # Sample mapped_variants for this score set with parseable post_mapped data. - # Pull HGVS prefixes alongside so we can route each row to the right target on - # multi-target score sets. Cap the sample size: in practice dcd-mapping emits - # uniform layers per target, so a handful of rows is enough. - sample_limit = 50 * max(len(ambiguous), 1) - rows = db.execute( - sa.select( - mv_t.c.post_mapped, - v_t.c.hgvs_nt, - v_t.c.hgvs_pro, - v_t.c.hgvs_splice, - ) - .select_from(mv_t.join(v_t, mv_t.c.variant_id == v_t.c.id)) - .where(v_t.c.scoreset_id == score_set_id) - .where(mv_t.c.post_mapped.is_not(None)) - .limit(sample_limit) - ).all() - - if rows: - ambiguous_ids = {t.id for t in ambiguous} - for row in rows: - target = _resolve_target_from_row(row, targets) - if target is None or target.id not in ambiguous_ids: - continue - if target.id in layer_by_target_id: - continue - - hgvs = get_hgvs_from_post_mapped(row.post_mapped) - level = None - if hgvs: - level = _layer_from_hgvs(hgvs) - if level is None: - level = _layer_from_vrs_sequence(row.post_mapped) - if level is None: - continue - - layer_by_target_id[target.id] = level - layer_via_hgvs_target_ids.add(target.id) - ambiguous_ids.discard(target.id) - if not ambiguous_ids: - break - - # Record cache misses so the chunk loop doesn't re-evaluate them per row. - for target in ambiguous: - layer_by_target_id.setdefault(target.id, None) - - # Last-resort: for targets still unattributed after VRS inspection (including - # score sets where every mapped variant had null post_mapped), infer from - # target_sequence.sequence_type + category. Accessing target.target_sequence - # triggers a lazy load; acceptable here since this path is rare. - for target in ambiguous: - if layer_by_target_id.get(target.id) is None: - level = _layer_from_sequence_type(target) - if level is not None: - layer_by_target_id[target.id] = level - layer_via_sequence_type_target_ids.add(target.id) - - -def _resolve_target_from_row(row, targets: list[TargetGene]) -> Optional[TargetGene]: - if len(targets) == 1: - return targets[0] - - if not targets: - return None - - # Multi-target score sets prefix each HGVS string with the per-target identifier: - # ``target_sequence.label`` for sequence-based score sets, ``target_accession.accession`` - # for accession-based ones. Build a single lookup covering both. - target_by_name: dict[str, TargetGene] = {} - for t in targets: - if t.target_sequence is not None and t.target_sequence.label: - target_by_name[t.target_sequence.label] = t - if t.target_accession is not None and t.target_accession.accession: - target_by_name[t.target_accession.accession] = t - - for raw in (row.hgvs_nt, row.hgvs_pro, row.hgvs_splice): - if not raw: - continue - - match = _MULTI_TARGET_PREFIX_RE.match(raw) - if not match: - continue - - candidate = target_by_name.get(match.group(1)) - if candidate is not None: - return candidate - - return None - - -def do_migration(db: Session) -> None: - print("Starting backfill of target_gene_mappings and mapped_variant ScoreAnnotation columns...") - - # Index target genes by score_set_id so we can resolve target ownership without - # an extra query per mapped variant on multi-target score sets. - targets_by_score_set_id: dict[int, list[TargetGene]] = defaultdict(list) - for target in db.scalars(sa.select(TargetGene).options(selectinload(TargetGene.target_sequence))).all(): - targets_by_score_set_id[target.score_set_id].append(target) - - # Index score set urns by id for diagnostic logging on unattributed rows -- - # cheap, and lets the post-run report group by URN without joins. - score_set_urn_by_id: dict[int, str] = dict( - db.execute(sa.select(ScoreSet.id, ScoreSet.urn)).all() # type: ignore[arg-type] - ) - - # Cache (target_gene_id, alignment_level, tool_version) -> persisted TargetGeneMapping - # so we create one row per distinct combination and reuse it across every - # mapped variant that maps into it. - cache: dict[tuple[int, SequenceLevel, str], TargetGeneMapping] = {} - - total = db.scalar(sa.select(sa.func.count(MappedVariant.id))) or 0 - print(f" {total} mapped variants to consider.") - - # Walk in id order so re-runs are reproducible. Stream in chunks to keep - # the session footprint bounded; each chunk is committed independently so a - # mid-run failure leaves a partial-but-consistent state we can resume from. - chunk_size = 50000 - processed = 0 - backfilled = 0 - skipped_no_target = 0 - skipped_no_target_current = 0 - skipped_no_layer = 0 - skipped_no_layer_current = 0 - - # Diagnostics so we can decide what to do with unattributed legacy rows - # before flipping ``target_gene_mapping_id`` to NOT NULL in a future migration. - # Counts by (reason, current) and per-score-set; sample ids capped to keep output bounded. - skipped_by_score_set: dict[tuple[str, str, bool], int] = defaultdict(int) - skipped_samples: dict[str, list[int]] = defaultdict(list) - sample_cap = 10 - - # Project only the columns we need and join Variant once pulling full ORM objects forces - # an N+1 lazy-load on ``mapped_variant.variant`` for every row. - mv_t = MappedVariant.__table__ - v_t = Variant.__table__ - projection = ( - sa.select( - mv_t.c.id, - mv_t.c.current, - mv_t.c.mapping_api_version, - mv_t.c.vrs_version, - mv_t.c.mapped_date, - v_t.c.scoreset_id.label("score_set_id"), - v_t.c.hgvs_nt, - v_t.c.hgvs_pro, - v_t.c.hgvs_splice, - ) - .select_from(mv_t.join(v_t, mv_t.c.variant_id == v_t.c.id)) - .where(mv_t.c.target_gene_mapping_id.is_(None)) - .order_by(mv_t.c.id) - ) - - # Per-target alignment-level cache. Under dcd-mapping ``preferred_layer_only=True``, - # every successfully mapped variant for a given target shares the same layer, so we - # only need to determine it once per target -- and any single attributable mapped - # variant for that target lets us attribute every sibling. The via_* sets track which - # fallback was used so the diagnostic report shows attribution breadth. - layer_by_target_id: dict[int, Optional[SequenceLevel]] = {} - layer_via_hgvs_target_ids: set[int] = set() - layer_via_sequence_type_target_ids: set[int] = set() - _populate_layer_by_target_id( - db, - targets_by_score_set_id, - layer_by_target_id, - layer_via_hgvs_target_ids, - layer_via_sequence_type_target_ids, - ) - print( - f" Layer attributed for {sum(1 for v in layer_by_target_id.values() if v is not None)} of " - f"{len(layer_by_target_id)} targets " - f"({len(layer_via_hgvs_target_ids)} via post_mapped HGVS, " - f"{len(layer_via_sequence_type_target_ids)} via sequence_type fallback)." - ) - - last_id = 0 - while True: - chunk = db.execute( - projection.where(mv_t.c.id > last_id).limit(chunk_size) - ).all() - if not chunk: - break - - # Group ids to update by (tgm_id, level) so we can issue one bulk UPDATE - # per group instead of a per-row ORM flush. - updates_by_group: dict[tuple[int, SequenceLevel], list[int]] = defaultdict(list) - - for row in chunk: - last_id = row.id - processed += 1 - - targets = targets_by_score_set_id.get(row.score_set_id, []) - target = _resolve_target_from_row(row, targets) - if target is None: - skipped_no_target += 1 - if row.current: - skipped_no_target_current += 1 - - score_set_urn = score_set_urn_by_id.get(row.score_set_id, "") - skipped_by_score_set[(score_set_urn, "no_target", bool(row.current))] += 1 - samples = skipped_samples["no_target"] - - if len(samples) < sample_cap: - samples.append(row.id) - - continue - - level = layer_by_target_id.get(target.id) - if level is None: - skipped_no_layer += 1 - if row.current: - skipped_no_layer_current += 1 - - score_set_urn = score_set_urn_by_id.get(row.score_set_id, "") - skipped_by_score_set[(score_set_urn, "no_layer", bool(row.current))] += 1 - samples = skipped_samples["no_layer"] - - if len(samples) < sample_cap: - samples.append(row.id) - - continue - - tool_version = row.mapping_api_version - cache_key = (target.id, level, tool_version) - tgm = cache.get(cache_key) - if tgm is None: - # Look up an already-persisted row first (idempotent re-runs). - tgm = db.scalars( - sa.select(TargetGeneMapping).where( - TargetGeneMapping.target_gene_id == target.id, - TargetGeneMapping.alignment_level == level, - TargetGeneMapping.tool_version == tool_version, - ) - ).first() - - if tgm is None: - tgm = TargetGeneMapping( - target_gene_id=target.id, - alignment_level=level, - # The legacy mapping was the one selected for this variant, - # so it's effectively the preferred record for (target, level). - preferred=True, - tool_name="dcd-mapping", - tool_version=tool_version, - vrs_version=row.vrs_version, - mapped_date=row.mapped_date, - ) - db.add(tgm) - db.flush() - - cache[cache_key] = tgm - - updates_by_group[(tgm.id, level)].append(row.id) - backfilled += 1 - - # One bulk UPDATE per (tgm, level) group -- typically only a handful per - # chunk even on multi-target score sets. - for (tgm_id, level), ids in updates_by_group.items(): - db.execute( - sa.update(mv_t) - .where(mv_t.c.id.in_(ids)) - .values(target_gene_mapping_id=tgm_id, alignment_level=level.value) - ) - - db.commit() - print( - f" Committed chunk -- processed={processed} backfilled={backfilled} " - f"skipped_no_target={skipped_no_target} skipped_no_layer={skipped_no_layer}" - ) - - print("Backfill complete:") - print(f" processed: {processed}") - print(f" backfilled: {backfilled}") - print(f" skipped_no_target: {skipped_no_target} (current=True: {skipped_no_target_current})") - print(f" skipped_no_layer: {skipped_no_layer} (current=True: {skipped_no_layer_current})") - print(f" TargetGeneMapping rows created: {len(cache)}") - - # Diagnostic report. ``current=True`` rows are the ones we actually need to - # attribute before the future NOT NULL migration; ``current=False`` rows are - # historical tombstones and are likely fine to leave or delete. - if skipped_by_score_set: - print("\nUnattributed mapped_variants by score set / reason / current:") - # Sort by current=True rows desc so the rows that block a future NOT NULL - # constraint surface first. - rows = sorted( - skipped_by_score_set.items(), - key=lambda kv: (not kv[0][2], -kv[1]), - ) - print(f" {'urn':<32} {'reason':<10} {'current':<7} count") - for (urn, reason, current), count in rows: - print(f" {urn:<32} {reason:<10} {str(current):<7} {count}") - - for reason, samples in skipped_samples.items(): - if samples: - print(f" Sample mapped_variant.id (reason={reason}): {samples}") - else: - print("\nNo unattributed mapped_variants -- safe to flip target_gene_mapping_id NOT NULL after this run.") - - -def verify_migration(db: Session) -> None: - print("\nVerifying backfill...") - total = db.scalar(sa.select(sa.func.count(MappedVariant.id))) or 0 - backfilled = db.scalar( - sa.select(sa.func.count(MappedVariant.id)).where(MappedVariant.target_gene_mapping_id.is_not(None)) - ) or 0 - tgm_count = db.scalar(sa.select(sa.func.count(TargetGeneMapping.id))) or 0 - print(f" mapped_variants total: {total}") - print(f" mapped_variants backfilled: {backfilled}") - print(f" mapped_variants still null: {total - backfilled}") - print(f" target_gene_mappings rows present: {tgm_count}") - - # Break the still-null bucket down by ``current``. ``current=True`` is the - # blocker for tightening the FK to NOT NULL in a future migration; the rest - # are inert historical rows. - null_current = db.scalar( - sa.select(sa.func.count(MappedVariant.id)) - .where(MappedVariant.target_gene_mapping_id.is_(None)) - .where(MappedVariant.current.is_(True)) - ) or 0 - null_historical = (total - backfilled) - null_current - print(f" of which current=True: {null_current}") - print(f" of which current=False: {null_historical}") - - -def rollback_migration(db: Session) -> None: - """Destructive: clears every column populated by :func:`do_migration`.""" - print("Rolling back backfill...") - db.execute( - sa.update(MappedVariant).values(target_gene_mapping_id=None, alignment_level=None) - ) - deleted = db.execute(sa.delete(TargetGeneMapping)).rowcount # type: ignore[attr-defined] - db.commit() - print(f" Cleared mapped_variant FKs and dropped {deleted} target_gene_mappings rows.") - - -def show_usage() -> None: - print( - """ -Usage: python -m alembic.manual_migrations.migrate_target_gene_mapping_qc [command] - -Commands: - migrate (default) - Backfill target_gene_mappings and ScoreAnnotation columns - verify - Report current backfill status (read-only) - rollback - Destructive: clear all backfilled data -""" - ) - - -if __name__ == "__main__": - command = sys.argv[1] if len(sys.argv) > 1 else "migrate" - - if command in {"help", "--help", "-h"}: - show_usage() - elif command == "rollback": - print("WARNING: This will delete every target_gene_mappings row and clear the FKs on mapped_variants.") - if input("Are you sure you want to continue? (y/N): ").lower() == "y": - with SessionLocal() as db: - rollback_migration(db) - else: - print("Rollback cancelled.") - - elif command == "verify": - with SessionLocal() as db: - verify_migration(db) - - elif command == "migrate": - with SessionLocal() as db: - do_migration(db) - verify_migration(db) - - else: - print(f"Unknown command: {command}") - show_usage() diff --git a/alembic/manual_migrations/migrate_target_organism_to_taxonomy.py b/alembic/manual_migrations/migrate_target_organism_to_taxonomy.py deleted file mode 100644 index 813c30b6c..000000000 --- a/alembic/manual_migrations/migrate_target_organism_to_taxonomy.py +++ /dev/null @@ -1,6568 +0,0 @@ - # Update target_sequences table. There are total 654 NULL taxonomies in target_sequences table. - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 632 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 625 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 626 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 627 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 628 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 629 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 630 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2378 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1107 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1106 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1108 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1128 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1129 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1127 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 752 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 751 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 750 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 39 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 828 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 39 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 829 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 39 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 830 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 24 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1232 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 24 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1233 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 24 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1234 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2308 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2309 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2307 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2629 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 201 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 217 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 218 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 40 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1596 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 40 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1595 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 40 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1597 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 369 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 367 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 368 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 24 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 117 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 114 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 112 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 119 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 122 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 125 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 120 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 121 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 124 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 123 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 116 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 118 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1362 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1361 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1363 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1598 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1599 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1325 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1327 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1600 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1326 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1713 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1712 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1714 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1544 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1546 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1545 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 440 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 443 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 441 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 439 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 437 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 438 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 446 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 445 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 444 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 753 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 754 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 755 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 43 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1147 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 43 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1145 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 43 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1146 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2387 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2386 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 25 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1267 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 25 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1266 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 25 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1265 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1469 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1471 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1470 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 21 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1422 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 21 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1423 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 21 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1421 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 21 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1426 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 21 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1425 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 21 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1424 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 21 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1429 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 21 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1427 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 21 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1428 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 75 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 250 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 75 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 251 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 143 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2646 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2648 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2645 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2649 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2650 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2644 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2643 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 72 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1532 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 72 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1534 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 72 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1533 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2616 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2497 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2442 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2553 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2499 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2582 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2565 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 968 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 967 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 966 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 71 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1220 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 71 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1221 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 71 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1222 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 40 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 8 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 253 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 283 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2377 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2421 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 252 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 615 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2376 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2422 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 366 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 425 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 426 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 616 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2374 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2657 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2656 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 624 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 623 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 622 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 620 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 619 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 618 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 617 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2375 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2373 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 331 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 332 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 333 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 334 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 336 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 335 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 337 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 338 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 339 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 340 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 323 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 324 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 342 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 341 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 343 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 344 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 346 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 345 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 347 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 348 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 325 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 326 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 328 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 327 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 329 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 330 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 350 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 13 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 639 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 636 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 637 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 638 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 16 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 641 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 15 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 14 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 640 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 633 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 634 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 635 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 610 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 609 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 607 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 606 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 614 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2367 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 631 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 613 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 611 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 608 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 276 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 938 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 937 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 936 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 69 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1395 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 69 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1396 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 69 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1394 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 8 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 9 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1523 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1525 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1524 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 22 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1057 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 22 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1058 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 22 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1056 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 4 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1472 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 4 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1474 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 4 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1473 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 81 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1320 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 81 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1321 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 81 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1319 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 104 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 105 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 106 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 103 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 21 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 20 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1168 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1167 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1166 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1164 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1165 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1163 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 264 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 7 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 244 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 7 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 246 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 154 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 155 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 156 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1131 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1130 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1132 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 150 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 149 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 151 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 94 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1437 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 94 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1436 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 94 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1438 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 17 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1373 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 17 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1375 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 17 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1374 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 93 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 944 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 93 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 942 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 93 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 943 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 16 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1311 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 16 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1310 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 16 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1312 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 16 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1314 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 16 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1313 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 16 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1315 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 16 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1317 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 16 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1318 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 16 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1316 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1435 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1434 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1433 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2430 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2429 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2428 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2431 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 26 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1039 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 26 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1038 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 26 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1040 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1002 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1003 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1004 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 881 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 879 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 880 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 12 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 891 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 12 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 892 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 12 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 893 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 869 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 868 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 867 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2282 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2280 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2281 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 871 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 872 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 870 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 874 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 873 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 875 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 27 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 779 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 27 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 777 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 27 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 778 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 27 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 780 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 27 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 782 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 27 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 781 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 27 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 783 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 27 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 784 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 27 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 785 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 61 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1339 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 61 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1338 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 61 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1337 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 61 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1341 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 61 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1340 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 61 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1342 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 61 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1344 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 61 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1345 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 61 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1343 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 89 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 243 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 89 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 245 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1457 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1458 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1459 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 159 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 157 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 158 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 38 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1359 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 38 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1358 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 38 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1357 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 38 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1356 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 38 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1355 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 38 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1348 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 38 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1347 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 38 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1346 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 38 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1360 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 38 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1349 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 38 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1351 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 38 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1350 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 38 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1353 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 38 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1354 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 38 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1352 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 197 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 300 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 299 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 196 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2498 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2389 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 413 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 414 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 415 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 416 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 417 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 418 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 419 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 420 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2390 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 406 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 407 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 408 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 409 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 410 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 411 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 412 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1649 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1650 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1651 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1585 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1584 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1583 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1743 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1744 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1742 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 30 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 422 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 62 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 198 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 62 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 199 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 70 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 281 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 70 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 282 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1301 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1303 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1302 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1710 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1711 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1709 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1289 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1290 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1291 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 74 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1483 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 74 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1481 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 74 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1482 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1367 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1368 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1369 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 65 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1138 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 65 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1137 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 65 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1136 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 34 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1381 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 34 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1379 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 34 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1380 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 34 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1383 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 34 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1382 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 34 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1384 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1679 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1680 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1681 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 23 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 17 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 18 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1760 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1762 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1761 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1764 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1763 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1765 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1766 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1768 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1767 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1769 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1770 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1771 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1773 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1774 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1772 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1777 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1776 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1775 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1779 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1780 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1778 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1781 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1782 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1783 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1784 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1786 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1785 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1787 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1788 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1789 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 25 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1791 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1792 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1790 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1793 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1794 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1795 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1798 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1796 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1797 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1799 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1801 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1800 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1804 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1802 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1803 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1805 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1807 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1806 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1808 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1809 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1810 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1812 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1811 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1813 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1815 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1814 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1816 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1819 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1817 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1818 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1820 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1821 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1822 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1823 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1824 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1825 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1828 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1827 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1826 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1829 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1830 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1831 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1832 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1834 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1833 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1837 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1835 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1836 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1838 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1840 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1839 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1841 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1842 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1843 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1844 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1846 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1845 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1848 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1849 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1847 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1852 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1850 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1851 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1854 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1853 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1855 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1857 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1856 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1858 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1861 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1860 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1859 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1863 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1862 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1864 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1865 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1866 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1867 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1868 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1870 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1869 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1873 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1872 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1871 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1876 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1875 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1874 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1878 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1877 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1879 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1881 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1882 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1880 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1883 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1885 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1884 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1888 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1886 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1887 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1891 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1890 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1889 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1894 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1893 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1892 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1897 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1895 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1896 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1898 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1899 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1900 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1901 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1902 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1903 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1905 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1904 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1906 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1908 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1909 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1907 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1910 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1911 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1912 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1914 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1915 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1913 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 75 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 100 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1916 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1917 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1918 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1669 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1668 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1667 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1921 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1919 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1920 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1924 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1922 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1923 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1926 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1927 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1925 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1929 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1930 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1928 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1932 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1933 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1931 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1936 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1935 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1934 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1937 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1939 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1938 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1941 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1942 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1940 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1944 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1943 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1945 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1946 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1948 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1947 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1949 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1951 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1950 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1952 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1953 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1954 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1956 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1955 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1957 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1958 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1960 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1959 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1961 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1962 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1963 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1966 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1964 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1965 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1968 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1969 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1967 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1970 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1971 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1972 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1974 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1973 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1975 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1976 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1977 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1978 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1979 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1980 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1981 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1982 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1983 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1984 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1986 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1987 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1985 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1989 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1990 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1988 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1992 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1991 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1993 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1994 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1995 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1996 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1997 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1998 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1999 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2001 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2000 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2002 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2004 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2003 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2005 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2008 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2007 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2006 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2010 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2009 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2011 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2013 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2012 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2014 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 23 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1702 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 23 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1700 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 23 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1701 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1590 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1589 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1591 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 23 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1154 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 23 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 804 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 23 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 805 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 23 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 806 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 23 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1155 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 23 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1156 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2595 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2559 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2596 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2560 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2597 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2561 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 87 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1245 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 32 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1213 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 32 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1211 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 32 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1212 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 87 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1246 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 87 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1244 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 87 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1247 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 87 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1249 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 87 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1248 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 87 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1250 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 87 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1251 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 87 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1252 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 32 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1216 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 32 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1215 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 32 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1214 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 32 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1217 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 32 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1219 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 32 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1218 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 807 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 808 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 809 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 142 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1496 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1497 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1498 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2407 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2399 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2401 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2402 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2403 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 41 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1086 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1087 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1088 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 237 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 241 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 240 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 239 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 238 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 43 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1135 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 43 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1133 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 43 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1134 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1203 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1202 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1204 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 370 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 372 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 42 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1563 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1306 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1304 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1270 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1305 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1268 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1269 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1564 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1562 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1707 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 735 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1708 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1706 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 737 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 736 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 740 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 739 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 738 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 743 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 741 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 742 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 744 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 746 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 745 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 747 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 749 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 748 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1152 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1151 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1153 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 31 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 28 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 33 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 32 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 30 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 29 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1550 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1551 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1552 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 365 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 295 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 403 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 144 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 179 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 215 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 13 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1105 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 13 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1103 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 13 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1104 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 10 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1410 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 64 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1417 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 10 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1413 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 10 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1411 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 10 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1409 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 64 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1415 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 64 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1416 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 10 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1414 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 10 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1412 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2017 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2015 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2016 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2018 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2019 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2020 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2023 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2022 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2021 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2025 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2024 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2026 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2029 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2027 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2028 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2030 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2032 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2031 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2033 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2035 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2034 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2036 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2038 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2037 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2041 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2040 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2039 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2044 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2043 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2042 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2047 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2045 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2046 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2048 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2050 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2049 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2053 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2052 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2051 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2055 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2056 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2054 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2058 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2057 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2059 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 140 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 43 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 68 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1739 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 68 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1741 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 68 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1740 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 379 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 376 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 377 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 378 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1703 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1705 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1704 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 63 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 284 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 44 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 45 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1603 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1602 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1601 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1565 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1567 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1566 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2061 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2062 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2060 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2063 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2065 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2066 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2064 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2067 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2068 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2069 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2072 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2071 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2070 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2075 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2073 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2074 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2078 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2076 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2077 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2080 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2079 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2081 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2082 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2084 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2083 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2087 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2085 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2086 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2089 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2090 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2088 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2093 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2091 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2092 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2095 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2096 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2094 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2099 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2098 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2097 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2100 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2102 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2101 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2103 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2104 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2105 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2108 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2106 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2107 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2111 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2110 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2109 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1670 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1671 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1672 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2114 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2113 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2112 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2116 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2117 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2115 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2120 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2118 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2119 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1665 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2122 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2123 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2121 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1664 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1666 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2125 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2124 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2126 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2127 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2129 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2128 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2132 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2130 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2131 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2133 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2134 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2135 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2138 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2137 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2136 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2139 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2140 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2141 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2144 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2143 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2142 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2146 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2145 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2147 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2149 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2150 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2148 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2153 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2152 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2151 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2156 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2154 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2155 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2158 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2157 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2159 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2160 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2161 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2162 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2165 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2163 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2164 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2168 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2167 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2166 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2169 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2170 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2171 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2173 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2174 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2172 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2177 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2175 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2176 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2178 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2180 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2179 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2181 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2183 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2182 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2185 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2186 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2184 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2189 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2187 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2188 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2191 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2190 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2192 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2195 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2193 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2194 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2198 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2197 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2196 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2201 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2199 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2200 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2204 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2203 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2202 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2206 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2205 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2207 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2209 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2208 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2210 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 394 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 395 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 396 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 77 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 82 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 78 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 46 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1052 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1051 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1050 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 757 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 756 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1716 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 758 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1715 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1717 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 761 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 760 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 759 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 235 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 97 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 37 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 87 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 88 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 89 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 90 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 91 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 92 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 93 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 94 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 95 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 96 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 141 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1089 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1092 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1090 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1091 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1093 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 12 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 83 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1335 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 83 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1676 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 83 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1677 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 83 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1678 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 83 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1336 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 83 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1334 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 83 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1328 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 83 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1329 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 83 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1330 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 51 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1609 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 51 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1607 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 51 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1608 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 83 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1332 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 83 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1333 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 83 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1331 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 35 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 998 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 35 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 997 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 35 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 996 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 35 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 999 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 35 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1001 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 35 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1000 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 882 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 884 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 883 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 885 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 887 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 886 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 890 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 889 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 888 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 225 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 47 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 48 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 24 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1292 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 24 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1294 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 24 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1293 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1549 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1548 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1547 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 397 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 371 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 305 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 303 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 495 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 493 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 497 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2520 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 496 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 568 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 570 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 560 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 567 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 571 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 492 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 491 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 566 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 565 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 564 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 563 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 536 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 534 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 294 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 302 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 301 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 291 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 290 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 288 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 287 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 289 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 286 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 285 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 293 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 292 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 296 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 699 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 703 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 706 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 707 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 708 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2364 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 709 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 712 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 713 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 714 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 702 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2362 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 698 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 723 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 727 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 722 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 728 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 729 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 730 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2365 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 719 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 720 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 721 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 726 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 700 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 701 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 715 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 716 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 717 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 725 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 718 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 52 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 204 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 52 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 203 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1570 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1568 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1569 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1282 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1281 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1280 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 842 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 841 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 840 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 69 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 80 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 70 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 81 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 50 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 49 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 27 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 26 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1721 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1722 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1723 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 858 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 860 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 859 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 356 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 359 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 361 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 360 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 4 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1686 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 4 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1685 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 4 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1687 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 6 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1727 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 6 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1729 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 6 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1728 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 262 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 261 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 257 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 258 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 259 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 260 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 263 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 255 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 256 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 254 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 398 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 400 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 399 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 401 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 101 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 153 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 51 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 160 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 208 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 74 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 76 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 161 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 72 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 71 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 75 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 205 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 211 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 210 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 73 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 209 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 206 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 212 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 207 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 52 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 53 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2388 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2368 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 731 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 733 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 643 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 732 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1080 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1082 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1081 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1043 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1041 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1042 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 32 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1225 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 32 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1223 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 32 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1224 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 32 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1226 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 32 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1228 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 32 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1227 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 32 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1230 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 32 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1231 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 32 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1229 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 214 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2519 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2517 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1613 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1614 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1615 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1034 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1032 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1033 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 11 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1095 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 11 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1096 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 11 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1094 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 11 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1098 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 11 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1097 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 11 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1099 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 11 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1102 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 11 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1100 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 11 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1101 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1285 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1284 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1283 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 53 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 277 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 19 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 278 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 53 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 279 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 53 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 280 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 946 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 947 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 945 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 948 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 949 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 950 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 951 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 953 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 952 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 39 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1605 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 39 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1606 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 39 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1604 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 242 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 189 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 190 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1031 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1029 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1030 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 20 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1419 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 20 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1420 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 20 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1418 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 49 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1181 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 49 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1183 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 49 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1182 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 49 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1184 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 49 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1185 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 49 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1186 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 49 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1187 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 49 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1189 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 49 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1188 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 11 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1637 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 11 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1639 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 11 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1638 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 11 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1642 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 11 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1641 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 11 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1640 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 11 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1644 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 11 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1643 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 11 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1645 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1012 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1011 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1013 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1049 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1047 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1048 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 402 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 3 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1652 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 3 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1653 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 3 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1654 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 126 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 36 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1387 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1386 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1385 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 363 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 362 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1495 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1023 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1494 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1493 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1017 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1018 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1019 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1020 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1021 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1025 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1022 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1024 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 18 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1144 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 18 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1143 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 18 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1142 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2287 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2288 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2286 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1398 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1397 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1198 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1197 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1399 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1388 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1196 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1402 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1390 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1400 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1389 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1401 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1391 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1393 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1392 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 848 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 847 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 846 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1276 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1274 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1275 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1279 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1277 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1278 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 54 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 55 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1006 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1005 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1007 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 70 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1036 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 70 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1035 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 70 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1037 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 73 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1455 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 73 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1456 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 73 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1454 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1431 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1432 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1430 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 600 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 33 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1499 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 33 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1501 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 33 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1500 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 33 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1504 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 33 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1502 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 33 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1503 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 33 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1506 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 33 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1507 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 33 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1505 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 33 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1555 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 33 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1554 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 33 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1553 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 33 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1556 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 33 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1558 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 33 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1557 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1008 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1009 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1010 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 46 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 923 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 46 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 921 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 46 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 922 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 77 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 941 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 92 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 825 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 92 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 826 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 92 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 827 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 77 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 940 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 77 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 939 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 424 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 373 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 183 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 182 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 374 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 375 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 380 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 381 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 38 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 358 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 184 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 357 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1207 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1205 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1206 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 57 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2305 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 57 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2304 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 57 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2306 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 76 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 249 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 14 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1440 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 14 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1441 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 14 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1439 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 67 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1190 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 67 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1191 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 67 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1192 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 28 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1308 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 28 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1307 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 28 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1309 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 65 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1201 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 65 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1199 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 65 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1200 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2213 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2212 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2211 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2216 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2215 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2214 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2217 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2218 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2219 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2222 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2220 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2221 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2223 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2225 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2224 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2226 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2228 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2227 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2229 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2231 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2230 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2232 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2233 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2234 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2236 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2237 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2235 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2239 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2240 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2238 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2241 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2243 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2242 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2246 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2244 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2245 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2248 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2249 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2247 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2251 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2252 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2250 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2255 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2253 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2254 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2257 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2256 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2258 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2261 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2260 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2259 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2264 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2263 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2262 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2267 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2266 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2265 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2269 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2270 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2268 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2272 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2271 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2273 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 851 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 850 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 849 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 165 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 168 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 167 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 166 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 169 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 162 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 164 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 163 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 170 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1239 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1240 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1238 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 172 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 173 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 174 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 171 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1376 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1377 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1378 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 56 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 352 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 56 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1407 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 56 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1408 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 56 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1406 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1110 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1111 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1109 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1113 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1112 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1114 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1116 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1115 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1117 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1119 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1118 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1120 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1122 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1121 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1123 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1124 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1125 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 41 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1126 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 48 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 930 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 48 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 932 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 48 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 931 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 42 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2301 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 42 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2302 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 42 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2303 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 31 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1586 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 31 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1587 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 31 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1288 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 31 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1286 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 31 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1588 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 31 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2283 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 31 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2284 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 31 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1287 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 31 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2285 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 102 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 308 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 321 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 320 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 319 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 318 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 307 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 322 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 309 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 310 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 311 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 312 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 313 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 314 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 315 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 306 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 316 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 317 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2635 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2642 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2624 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2623 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2622 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2636 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2614 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2637 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2607 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2652 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2632 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2653 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2628 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2627 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2626 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2625 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2633 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2654 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2630 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2655 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2615 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2611 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 111 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 109 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 108 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 110 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 200 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 90 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 202 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1543 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1542 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1541 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 60 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1510 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 60 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1509 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 60 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1508 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 351 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 27 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 926 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 27 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 925 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 27 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 924 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2398 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 866 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 864 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 865 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1478 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1480 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1479 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 58 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 57 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 59 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1746 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1745 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1747 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1061 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1059 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 861 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2292 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2293 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2294 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 55 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1737 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 55 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1736 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 55 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1738 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1076 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1075 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1074 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 863 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 862 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1060 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1062 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1064 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1063 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1065 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1066 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1067 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1068 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1070 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1069 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1073 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1071 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 29 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1072 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 85 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 224 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 85 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 223 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 9 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1735 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 9 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1733 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 9 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1734 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 37 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1731 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 37 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1732 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 37 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1730 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 914 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1322 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1323 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1324 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 795 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 796 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 797 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 810 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 811 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 812 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 819 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 820 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 821 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 852 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 853 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 854 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1475 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1476 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1477 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1484 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1485 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1486 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1487 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1488 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1489 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 895 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 894 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 896 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1720 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1718 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 912 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 913 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1658 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1719 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1663 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1662 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1661 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1660 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1659 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1655 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1656 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1657 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 813 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 814 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 815 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 917 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 915 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 916 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 816 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 818 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 817 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 918 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 920 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 919 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 897 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 899 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 898 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 799 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 800 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 798 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 900 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 902 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 901 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 905 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 904 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 903 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 908 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 907 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 906 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 910 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 909 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 911 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 803 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 802 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 79 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 801 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1514 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 833 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 832 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 831 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1083 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 764 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 763 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1084 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1085 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 762 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1515 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1516 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 969 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 970 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1577 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1579 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 971 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 972 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 973 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 974 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1208 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1209 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1210 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1578 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 927 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1242 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 928 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1241 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1243 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 929 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1295 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1296 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1297 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 933 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 934 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 935 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1625 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1626 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1627 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1628 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1629 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1630 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1632 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1631 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1633 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 767 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 765 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 766 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1517 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1518 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1519 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 768 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 769 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 770 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1634 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1636 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1635 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 834 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 836 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 835 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 790 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 791 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 789 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 839 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 838 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 837 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1521 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1520 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1522 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1527 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1528 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1526 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1157 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1159 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1158 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1616 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1617 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 965 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1618 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 963 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 964 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 98 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1621 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1619 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1620 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 99 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1624 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1622 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1623 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 92 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1160 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 92 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1162 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 92 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1161 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 80 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 857 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 80 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 856 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 80 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 855 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 80 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 771 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 80 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 773 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 80 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 772 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 80 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 775 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 80 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 774 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 80 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 776 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 187 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 185 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1300 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1299 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1298 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 54 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1693 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 54 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1692 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 54 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1691 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 54 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1694 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 54 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1696 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 54 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1695 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 54 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1698 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 54 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1699 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 54 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1697 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2409 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2408 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1078 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1026 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1027 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1540 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1538 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1539 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1079 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1077 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1028 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 35 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 34 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 6 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 7 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 4 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2290 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 4 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2291 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 4 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2289 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 194 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 195 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 787 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 786 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 788 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1460 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1462 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1461 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1463 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1465 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1464 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1467 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1466 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1468 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1452 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1451 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1453 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1447 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1445 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1446 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1449 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1448 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1450 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 60 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 824 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 823 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 91 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 822 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 216 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 268 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 267 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 265 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 266 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 273 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 274 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 275 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 152 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 270 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 354 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 353 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 269 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 427 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 221 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 219 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 428 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 222 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 271 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 272 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 63 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 64 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 62 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 61 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 44 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1194 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 44 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1195 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 44 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1193 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2297 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1537 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2295 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1535 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1612 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1536 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1611 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1610 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2296 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 2 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1170 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 2 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1169 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 2 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1171 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1647 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1648 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1646 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 177 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 176 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 175 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 11 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 10 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 39 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1560 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1757 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1759 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1690 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1593 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1689 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1688 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1592 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1055 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1053 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1754 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1559 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1755 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1753 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1751 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1561 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1581 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1054 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1748 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1750 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1752 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1594 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1442 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1582 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1580 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1749 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1443 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1444 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 734 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 876 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 877 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 878 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1758 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1756 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 793 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 794 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 66 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 792 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1364 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1366 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1365 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2300 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2299 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1684 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2298 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1683 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1682 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 977 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 956 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 955 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 954 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2276 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2275 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2274 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 975 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 976 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 957 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 958 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 959 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 978 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 979 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 980 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 982 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 983 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 981 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 961 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 960 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 962 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 985 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 986 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 984 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 987 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 989 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 988 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 992 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 991 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 990 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 995 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 993 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 994 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 3 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 5 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 4 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 22 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1572 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1571 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1573 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 85 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 84 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 86 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 5 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 83 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 843 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 844 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 845 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2277 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2279 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2278 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 65 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 88 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1725 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 88 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1726 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 88 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1724 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 78 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1174 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 78 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1172 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 78 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1173 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 78 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1177 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 78 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1175 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 78 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1176 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 78 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1179 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 78 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1180 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 78 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1178 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1512 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1046 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1576 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1045 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1574 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1044 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1015 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1014 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1016 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1575 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1511 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 59 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1513 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 45 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 230 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 45 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 233 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 45 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 232 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 45 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 231 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 45 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 229 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 45 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 228 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 45 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 227 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 45 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 226 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 45 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 234 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 50 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2310 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 50 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2312 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 50 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2311 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 181 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 247 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 248 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 180 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 4 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1675 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 4 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1673 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 4 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1674 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 84 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1271 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 84 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1272 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 84 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1273 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1491 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1490 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1492 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2326 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2327 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2325 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2315 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2314 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2313 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2318 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2317 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2316 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2319 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2321 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2320 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2322 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2324 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2323 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2329 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2328 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2330 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2331 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2332 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2333 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2336 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2334 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2335 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2338 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2339 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2337 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2341 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2342 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2340 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2345 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2343 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2344 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2348 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2346 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2347 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2350 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2351 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2349 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2354 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2352 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2353 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2357 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2355 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2356 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2360 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2358 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 2359 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 82 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1404 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 82 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1405 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 82 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1403 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1237 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1236 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 36 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1235 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1529 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1530 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 58 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1531 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 82 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1372 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 82 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1370 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 82 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1371 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 27 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1150 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 27 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1148 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 27 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1149 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 66 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 86 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1141 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 86 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1139 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 86 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1140 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1254 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1255 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1253 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1263 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1264 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1262 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1256 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1258 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1257 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1261 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1260 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 1 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 1259 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 47 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 236 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 67 AND ts.id = ts_join.id""" - ) - op.execute( - """UPDATE target_sequences AS ts SET taxonomy_id = 15 FROM target_sequences AS ts_join JOIN target_genes AS tg ON ts_join.id = tg.target_sequence_id WHERE tg.id = 68 AND ts.id = ts_join.id""" - ) - - # Update the target sequences without taxonomy. These target sequences are not associated to any target gene. - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 298""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 297""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 213""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 132""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 355""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 304""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 220""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 364""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 349""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 145""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 139""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 134""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 19""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 136""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 127""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 137""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 133""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 129""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 79""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 138""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 115""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 128""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 131""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 130""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 107""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 113""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 135""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 148""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 147""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 146""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 178""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 186""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE id = 188""") - # These two original reference genomes are Homo Sapiens - op.execute("""UPDATE target_sequences SET taxonomy_id = 15 WHERE id = 568""") - op.execute("""UPDATE target_sequences SET taxonomy_id = 15 WHERE id = 2470""") - # In case any missing target_sequence. - # tax_id is 0 but id is 1 in Taxonomy table. It corresponds to taxonomy_id is 1 in Target_sequence table. - op.execute("""UPDATE target_sequences SET taxonomy_id = 1 WHERE taxonomy_id is NULL""") - diff --git a/alembic/manual_migrations/populate_taxonomy_table.py b/alembic/manual_migrations/populate_taxonomy_table.py deleted file mode 100644 index e02df7661..000000000 --- a/alembic/manual_migrations/populate_taxonomy_table.py +++ /dev/null @@ -1,283 +0,0 @@ - # Insert taxonomies table - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (0, 'NULL', 'NULL', 'NULL', 'False', 'NULL', 'NULL', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (212017, 'Lethocerus indicus', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=212017', 'NCBI:txid212017', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (31604, 'Small ruminant morbillivirus', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=31604', 'NCBI:txid31604', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (3702, 'Arabidopsis thaliana', 'thale cress', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=3702', 'NCBI:txid3702', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (559292, 'Saccharomyces cerevisiae S288C', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=559292', 'NCBI:txid559292', 6, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (254252, 'Lactococcus virus P2', 'NULL', 'SPECIES', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=254252', 'NCBI:txid254252', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (1521, 'Ruminiclostridium cellulolyticum', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=1521', 'NCBI:txid1521', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (9913, 'Bos taurus', 'cattle', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=9913', 'NCBI:txid9913', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (9823, 'Sus scrofa', 'pig', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=9823', 'NCBI:txid9823', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (223997, 'Murine norovirus 1', 'NULL', 'NULL', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=223997', 'NCBI:txid223997', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (70601, 'Pyrococcus horikoshii OT3', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=70601', 'NCBI:txid70601', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (10710, 'Lambdavirus lambda', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=10710', 'NCBI:txid10710', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (10754, 'Lederbergvirus P22', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=10754', 'NCBI:txid10754', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (271848, 'Burkholderia thailandensis E264', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=271848', 'NCBI:txid271848', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (9606, 'Homo sapiens', 'human', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=9606', 'NCBI:txid9606', 5, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (392021, 'Rickettsia rickettsii str. ''Sheila Smith''', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=392021', 'NCBI:txid392021', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (294381, 'Entamoeba histolytica HM-1:IMSS', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=294381', 'NCBI:txid294381', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (90371, 'Salmonella enterica subsp. enterica serovar Typhimurium', 'NULL', 'NULL', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=90371', 'NCBI:txid90371', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (211044, 'Influenza A virus (A/Puerto Rico/8/1934(H1N1))', 'NULL', 'NULL', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=211044', 'NCBI:txid211044', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (83332, 'Mycobacterium tuberculosis H37Rv', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=83332', 'NCBI:txid83332', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (226185, 'Enterococcus faecalis V583', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=226185', 'NCBI:txid226185', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (3055, 'Chlamydomonas reinhardtii', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=3055', 'NCBI:txid3055', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (7227, 'Drosophila melanogaster', 'fruit fly', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=7227', 'NCBI:txid7227', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (196620, 'Staphylococcus aureus subsp. aureus MW2', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=196620', 'NCBI:txid196620', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (103690, 'Nostoc sp. PCC 7120 = FACHB-418', 'NULL', 'SPECIES', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=103690', 'NCBI:txid103690', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (85962, 'Helicobacter pylori 26695', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=85962', 'NCBI:txid85962', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (224308, 'Bacillus subtilis subsp. subtilis str. 168', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=224308', 'NCBI:txid224308', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (262724, 'Thermus thermophilus HB27', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=262724', 'NCBI:txid262724', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (1280, 'Staphylococcus aureus', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=1280', 'NCBI:txid1280', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (31634, 'Dengue virus 2 Thailand/16681/84', 'NULL', 'NULL', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=31634', 'NCBI:txid31634', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (4784, 'Phytophthora capsici', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=4784', 'NCBI:txid4784', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (195102, 'Clostridium perfringens str. 13', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=195102', 'NCBI:txid195102', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (1260, 'Finegoldia magna', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=1260', 'NCBI:txid1260', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (170187, 'Streptococcus pneumoniae TIGR4', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=170187', 'NCBI:txid170187', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (8201, 'Lycodichthys dearborni', 'Antarctic eel pout', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=8201', 'NCBI:txid8201', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (83333, 'Escherichia coli K-12', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=83333', 'NCBI:txid83333', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (94237, 'Mola mola', 'ocean sunfish', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=94237', 'NCBI:txid94237', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (1351, 'Enterococcus faecalis', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=1351', 'NCBI:txid1351', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (224324, 'Aquifex aeolicus VF5', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=224324', 'NCBI:txid224324', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (272560, 'Burkholderia pseudomallei K96243', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=272560', 'NCBI:txid272560', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (1422, 'Geobacillus stearothermophilus', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=1422', 'NCBI:txid1422', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (203119, 'Acetivibrio thermocellus ATCC 27405', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=203119', 'NCBI:txid203119', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (258594, 'Rhodopseudomonas palustris CGA009', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=258594', 'NCBI:txid258594', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (269799, 'Geobacter metallireducens GS-15', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=269799', 'NCBI:txid269799', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (287, 'Pseudomonas aeruginosa', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=287', 'NCBI:txid287', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (32049, 'Synechococcus sp. PCC 7002', 'NULL', 'SPECIES', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=32049', 'NCBI:txid32049', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (64320, 'Zika virus', 'NULL', 'NULL', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=64320', 'NCBI:txid64320', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (274, 'Thermus thermophilus', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=274', 'NCBI:txid274', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (187420, 'Methanothermobacter thermautotrophicus str. Delta H', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=187420', 'NCBI:txid187420', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (1961, 'Streptomyces virginiae', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=1961', 'NCBI:txid1961', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (48416, 'Zoarces viviparus', 'viviparous blenny', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=48416', 'NCBI:txid48416', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (316385, 'Escherichia coli str. K-12 substr. DH10B', 'NULL', 'NULL', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=316385', 'NCBI:txid316385', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (387139, 'Influenza A virus (A/Aichi/2/1968(H3N2))', 'NULL', 'NULL', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=387139', 'NCBI:txid387139', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (351614, 'Xenorhabdus stockiae', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=351614', 'NCBI:txid351614', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (93061, 'Staphylococcus aureus subsp. aureus NCTC 8325', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=93061', 'NCBI:txid93061', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (232237, 'Xipdecavirus Xp10', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=232237', 'NCBI:txid232237', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (272620, 'Klebsiella pneumoniae subsp. pneumoniae MGH 78578', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=272620', 'NCBI:txid272620', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (562, 'Escherichia coli', 'E. coli', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=562', 'NCBI:txid562', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (9031, 'Gallus gallus', 'chicken', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=9031', 'NCBI:txid9031', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (282458, 'Staphylococcus aureus subsp. aureus MRSA252', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=282458', 'NCBI:txid282458', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (169963, 'Listeria monocytogenes EGD-e', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=169963', 'NCBI:txid169963', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (469008, 'Escherichia coli BL21(DE3)', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=469008', 'NCBI:txid469008', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (114727, 'H1N1 subtype', 'NULL', 'SEROTYPE', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=114727', 'NCBI:txid114727', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (463722, 'Murine norovirus GV/CR6/2005/USA', 'NULL', 'NULL', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=463722', 'NCBI:txid463722', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (211586, 'Shewanella oneidensis MR-1', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=211586', 'NCBI:txid211586', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (8199, 'Zoarces americanus', 'ocean pout', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=8199', 'NCBI:txid8199', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (218491, 'Pectobacterium atrosepticum SCRI1043', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=218491', 'NCBI:txid218491', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (484895, 'Bruynoghevirus LUZ24', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=484895', 'NCBI:txid484895', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (44689, 'Dictyostelium discoideum', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=44689', 'NCBI:txid44689', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (10116, 'Rattus norvegicus', 'Norway rat', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=10116', 'NCBI:txid10116', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (194439, 'Chlorobaculum tepidum TLS', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=194439', 'NCBI:txid194439', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (10760, 'Escherichia phage T7', 'NULL', 'NULL', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=10760', 'NCBI:txid10760', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (523795, 'Porcine enteric sapovirus swine/Cowden/1980/US', 'NULL', 'NULL', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=523795', 'NCBI:txid523795', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (6239, 'Caenorhabditis elegans', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=6239', 'NCBI:txid6239', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (6100, 'Aequorea victoria', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=6100', 'NCBI:txid6100', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (33113, 'Atropa belladonna', 'belladonna', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=33113', 'NCBI:txid33113', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (29413, 'Nostoc sp. PCC 8009', 'NULL', 'SPECIES', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=29413', 'NCBI:txid29413', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (243232, 'Methanocaldococcus jannaschii DSM 2661', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=243232', 'NCBI:txid243232', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (1320, 'Streptococcus sp. ''group G''', 'NULL', 'SPECIES', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=1320', 'NCBI:txid1320', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (273057, 'Saccharolobus solfataricus P2', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=273057', 'NCBI:txid273057', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (34, 'Myxococcus xanthus', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=34', 'NCBI:txid34', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (99287, 'Salmonella enterica subsp. enterica serovar Typhimurium str. LT2', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=99287', 'NCBI:txid99287', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (291231, 'Zoarces elongatus', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=291231', 'NCBI:txid291231', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (2681611, 'Escherichia phage Lambda', 'NULL', 'NULL', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=2681611', 'NCBI:txid2681611', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (1314, 'Streptococcus pyogenes', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=1314', 'NCBI:txid1314', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (246200, 'Ruegeria pomeroyi DSS-3', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=246200', 'NCBI:txid246200', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (195103, 'Clostridium perfringens ATCC 13124', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=195103', 'NCBI:txid195103', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (1185654, 'Pyrococcus furiosus COM1', 'NULL', 'STRAIN', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=1185654', 'NCBI:txid1185654', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (1515, 'Acetivibrio thermocellus', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=1515', 'NCBI:txid1515', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (2697049, 'Severe acute respiratory syndrome coronavirus 2', 'NULL', 'NULL', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=2697049', 'NCBI:txid2697049', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (10090, 'Mus musculus', 'house mouse', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=10090', 'NCBI:txid10090', 8, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (1111708, 'Synechocystis sp. PCC 6803 substr. Kazusa', 'NULL', 'NULL', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=1111708', 'NCBI:txid1111708', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (10712, 'Phage 434', 'NULL', 'NULL', 'False', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=10712', 'NCBI:txid10712', NULL, NOW(), NOW())""" - ) - op.execute( - """INSERT INTO taxonomies (tax_id, organism_name, common_name, rank, has_described_species_name, url, article_reference, genome_identifier_id, creation_date, modification_date) VALUES (37553, 'Saprolegnia monoica', 'NULL', 'SPECIES', 'True', 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=info&id=37553', 'NCBI:txid37553', NULL, NOW(), NOW())""" - ) diff --git a/alembic/manual_migrations/refresh_published_tmp_urns.py b/alembic/manual_migrations/refresh_published_tmp_urns.py deleted file mode 100644 index 9fe4a4b4a..000000000 --- a/alembic/manual_migrations/refresh_published_tmp_urns.py +++ /dev/null @@ -1,33 +0,0 @@ -import sqlalchemy as sa -from sqlalchemy.orm import Session, configure_mappers - -from mavedb.models import * - -from mavedb.lib.score_sets import refresh_variant_urns - -from mavedb.models.score_set import ScoreSet -from mavedb.models.variant import Variant - -from mavedb.db.session import SessionLocal - -configure_mappers() - - -def do_migration(db: Session): - published_score_sets_with_associated_tmp_variants: sa.ScalarResult[str] - published_score_sets_with_associated_tmp_variants = db.execute( - sa.select(sa.distinct(ScoreSet.urn)).join(Variant).where(ScoreSet.published_date.is_not(None), Variant.urn.like("%tmp:%")) - ).scalars() - - for score_set_urn in published_score_sets_with_associated_tmp_variants: - refresh_variant_urns(db, db.execute(sa.select(ScoreSet).where(ScoreSet.urn == score_set_urn)).scalar_one()) - - -if __name__ == "__main__": - db = SessionLocal() - db.current_user = None # type: ignore - - do_migration(db) - - db.commit() - db.close() diff --git a/alembic/versions/002f6f9ec7ac_add_score_calibration_table.py b/alembic/versions/002f6f9ec7ac_add_score_calibration_table.py deleted file mode 100644 index 86ae65395..000000000 --- a/alembic/versions/002f6f9ec7ac_add_score_calibration_table.py +++ /dev/null @@ -1,92 +0,0 @@ -"""add score calibration table - -Revision ID: 002f6f9ec7ac -Revises: 019eb75ad9ae -Create Date: 2025-10-08 08:59:10.563528 - -""" - -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql - - -# revision identifiers, used by Alembic. -revision = "002f6f9ec7ac" -down_revision = "019eb75ad9ae" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "score_calibrations", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("urn", sa.String(length=64), nullable=True), - sa.Column("score_set_id", sa.Integer(), nullable=False), - sa.Column("title", sa.String(), nullable=False), - sa.Column("research_use_only", sa.Boolean(), nullable=False), - sa.Column("primary", sa.Boolean(), nullable=False), - sa.Column("investigator_provided", sa.Boolean(), nullable=False), - sa.Column("private", sa.Boolean(), nullable=False), - sa.Column("notes", sa.String(), nullable=True), - sa.Column("baseline_score", sa.Float(), nullable=True), - sa.Column("baseline_score_description", sa.String(), nullable=True), - sa.Column("functional_ranges", postgresql.JSONB(astext_type=sa.Text(), none_as_null=True), nullable=True), - sa.Column("calibration_metadata", postgresql.JSONB(astext_type=sa.Text(), none_as_null=True), nullable=True), - sa.Column("created_by_id", sa.Integer(), nullable=False), - sa.Column("modified_by_id", sa.Integer(), nullable=False), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.ForeignKeyConstraint( - ["score_set_id"], - ["scoresets.id"], - ), - sa.ForeignKeyConstraint( - ["created_by_id"], - ["users.id"], - ), - sa.ForeignKeyConstraint( - ["modified_by_id"], - ["users.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_table( - "score_calibration_publication_identifiers", - sa.Column("score_calibration_id", sa.Integer(), nullable=False), - sa.Column("publication_identifier_id", sa.Integer(), nullable=False), - sa.Column( - "relation", - sa.Enum( - "thresholds", - "classifications", - "methods", - name="scorecalibrationrelation", - native_enum=False, - length=32, - ), - nullable=False, - ), - sa.ForeignKeyConstraint( - ["publication_identifier_id"], - ["publication_identifiers.id"], - ), - sa.ForeignKeyConstraint( - ["score_calibration_id"], - ["score_calibrations.id"], - ), - sa.PrimaryKeyConstraint("score_calibration_id", "publication_identifier_id", "relation"), - ) - op.create_index(op.f("ix_score_calibrations_urn"), "score_calibrations", ["urn"], unique=True) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f("ix_score_calibrations_urn"), table_name="score_calibrations") - op.drop_table("score_calibration_publication_identifiers") - op.drop_table("score_calibrations") - # ### end Alembic commands ### diff --git a/alembic/versions/009570ae0cb0_rename_success_data_to_annotation_.py b/alembic/versions/009570ae0cb0_rename_success_data_to_annotation_.py deleted file mode 100644 index 7fa0de6d8..000000000 --- a/alembic/versions/009570ae0cb0_rename_success_data_to_annotation_.py +++ /dev/null @@ -1,33 +0,0 @@ -"""rename_success_data_to_annotation_metadata - -Revision ID: 009570ae0cb0 -Revises: 8de33cc35cd7 -Create Date: 2026-04-16 17:26:16.151395 - -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "009570ae0cb0" -down_revision = "8de33cc35cd7" -branch_labels = None -depends_on = None - - -def upgrade(): - op.alter_column( - "variant_annotation_status", - "success_data", - new_column_name="annotation_metadata", - comment="Structured metadata for the annotation result", - ) - - -def downgrade(): - op.alter_column( - "variant_annotation_status", - "annotation_metadata", - new_column_name="success_data", - comment="Annotation results when successful", - ) diff --git a/alembic/versions/00dab0f5f498_add_external_links_property_to_.py b/alembic/versions/00dab0f5f498_add_external_links_property_to_.py deleted file mode 100644 index 4e99b22ee..000000000 --- a/alembic/versions/00dab0f5f498_add_external_links_property_to_.py +++ /dev/null @@ -1,33 +0,0 @@ -"""add external links property to experiments - -Revision ID: 00dab0f5f498 -Revises: 0520dfa9f2db -Create Date: 2025-12-16 12:06:15.265947 - -""" - -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "00dab0f5f498" -down_revision = "0520dfa9f2db" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column( - "experiments", - sa.Column("external_links", postgresql.JSONB(astext_type=sa.Text()), nullable=False, server_default="{}"), - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column("experiments", "external_links") - # ### end Alembic commands ### diff --git a/alembic/versions/019eb75ad9ae_rename_tax_id_to_code.py b/alembic/versions/019eb75ad9ae_rename_tax_id_to_code.py deleted file mode 100644 index 78f5d99b8..000000000 --- a/alembic/versions/019eb75ad9ae_rename_tax_id_to_code.py +++ /dev/null @@ -1,29 +0,0 @@ -"""rename_tax_id_to_code - -Revision ID: 019eb75ad9ae -Revises: b29bbfb2a13a -Create Date: 2025-08-20 16:21:15.872816 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "019eb75ad9ae" -down_revision = "0b29eefbe1dd" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.alter_column("taxonomies", "tax_id", new_column_name="code", existing_type=sa.Integer(), existing_nullable=False) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.alter_column("taxonomies", "code", new_column_name="tax_id", existing_type=sa.Integer(), existing_nullable=False) - # ### end Alembic commands ### diff --git a/alembic/versions/024370c4bca7_add_calibration_controls_table_and_phi_.py b/alembic/versions/024370c4bca7_add_calibration_controls_table_and_phi_.py deleted file mode 100644 index 996badf85..000000000 --- a/alembic/versions/024370c4bca7_add_calibration_controls_table_and_phi_.py +++ /dev/null @@ -1,113 +0,0 @@ -"""add calibration controls, mondo terms, and phi/disease columns - -Revision ID: 024370c4bca7 -Revises: f6752571d14d -Create Date: 2026-09-15 16:01:06.013964 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "024370c4bca7" -down_revision = "f6752571d14d" -branch_labels = None -depends_on = None - -# The generic "disease or disorder" MONDO term seeded so the non-nullable calibration FK always resolves. -MONDO_SYSTEM = "https://purl.obolibrary.org/obo/mondo.owl" -MONDO_GENERIC_CODE = "MONDO:0000001" -MONDO_GENERIC_LABEL = "disease or disorder" - - -def upgrade(): - op.create_table( - "calibration_controls", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("calibration_id", sa.Integer(), nullable=False), - sa.Column("variant_id", sa.Integer(), nullable=False), - sa.Column( - "clinical_status", - sa.Enum("pathogenic", "benign", name="calibrationcontrolstatus", native_enum=False, length=32), - nullable=False, - ), - sa.Column("created_by_id", sa.Integer(), nullable=False), - sa.Column("modified_by_id", sa.Integer(), nullable=False), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.ForeignKeyConstraint(["calibration_id"], ["score_calibrations.id"], ondelete="CASCADE"), - sa.ForeignKeyConstraint(["variant_id"], ["variants.id"]), - sa.ForeignKeyConstraint(["created_by_id"], ["users.id"]), - sa.ForeignKeyConstraint(["modified_by_id"], ["users.id"]), - sa.PrimaryKeyConstraint("id"), - sa.UniqueConstraint("calibration_id", "variant_id", name="uq_calibration_controls_calibration_id_variant_id"), - ) - op.create_index( - op.f("ix_calibration_controls_calibration_id"), "calibration_controls", ["calibration_id"], unique=False - ) - op.create_index(op.f("ix_calibration_controls_variant_id"), "calibration_controls", ["variant_id"], unique=False) - op.create_index( - op.f("ix_calibration_controls_created_by_id"), "calibration_controls", ["created_by_id"], unique=False - ) - op.create_index( - op.f("ix_calibration_controls_modified_by_id"), "calibration_controls", ["modified_by_id"], unique=False - ) - - # MONDO disease terms, with the generic root seeded as the default for calibrations naming no disease. - op.create_table( - "mondo_terms", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("code", sa.String(), nullable=False), - sa.Column("system", sa.String(), nullable=False), - sa.Column("system_version", sa.String(), nullable=True), - sa.Column("label", sa.String(), nullable=False), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.PrimaryKeyConstraint("id"), - sa.UniqueConstraint("system", "code", name="uq_mondo_terms_system_code"), - ) - op.execute( - sa.text( - "INSERT INTO mondo_terms (code, system, label, creation_date, modification_date) " - "VALUES (:code, :system, :label, CURRENT_DATE, CURRENT_DATE)" - ).bindparams(code=MONDO_GENERIC_CODE, system=MONDO_SYSTEM, label=MONDO_GENERIC_LABEL) - ) - - # Disease FK: add nullable, backfill existing calibrations to the generic term, then enforce NOT NULL. - op.add_column("score_calibrations", sa.Column("disease_term_id", sa.Integer(), nullable=True)) - op.execute( - sa.text( - "UPDATE score_calibrations SET disease_term_id = " - "(SELECT id FROM mondo_terms WHERE system = :system AND code = :code)" - ).bindparams(system=MONDO_SYSTEM, code=MONDO_GENERIC_CODE) - ) - op.alter_column("score_calibrations", "disease_term_id", nullable=False) - op.create_index( - op.f("ix_score_calibrations_disease_term_id"), "score_calibrations", ["disease_term_id"], unique=False - ) - op.create_foreign_key( - "fk_score_calibrations_disease_term_id_mondo_terms", - "score_calibrations", - "mondo_terms", - ["disease_term_id"], - ["id"], - ) - - op.add_column("score_calibrations", sa.Column("controls_not_phi", sa.Boolean(), nullable=True)) - - -def downgrade(): - op.drop_column("score_calibrations", "controls_not_phi") - - op.drop_constraint("fk_score_calibrations_disease_term_id_mondo_terms", "score_calibrations", type_="foreignkey") - op.drop_index(op.f("ix_score_calibrations_disease_term_id"), table_name="score_calibrations") - op.drop_column("score_calibrations", "disease_term_id") - op.drop_table("mondo_terms") - - op.drop_index(op.f("ix_calibration_controls_modified_by_id"), table_name="calibration_controls") - op.drop_index(op.f("ix_calibration_controls_created_by_id"), table_name="calibration_controls") - op.drop_index(op.f("ix_calibration_controls_variant_id"), table_name="calibration_controls") - op.drop_index(op.f("ix_calibration_controls_calibration_id"), table_name="calibration_controls") - op.drop_table("calibration_controls") diff --git a/alembic/versions/03c7124c33e1_target_category_enum.py b/alembic/versions/03c7124c33e1_target_category_enum.py deleted file mode 100644 index ce9720acd..000000000 --- a/alembic/versions/03c7124c33e1_target_category_enum.py +++ /dev/null @@ -1,54 +0,0 @@ -"""Target category enum - -Revision ID: 03c7124c33e1 -Revises: 2b6f40ea2fb6 -Create Date: 2024-11-01 11:27:03.609116 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "03c7124c33e1" -down_revision = "2b6f40ea2fb6" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.alter_column( - "target_genes", - "category", - type_=sa.Enum( - "protein_coding", - "other_noncoding", - "regulatory", - name="targetcategory", - native_enum=False, - create_constraint=True, - length=32, - ), - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.alter_column( - "target_genes", - "category", - type_=sa.String(), - existing_type=sa.Enum( - "protein_coding", - "other_noncoding", - "regulatory", - name="targetcategory", - native_enum=False, - create_constraint=True, - length=32, - ), - ) - # ### end Alembic commands ### diff --git a/alembic/versions/0520dfa9f2db_rename_functional_ranges_to_functional_.py b/alembic/versions/0520dfa9f2db_rename_functional_ranges_to_functional_.py deleted file mode 100644 index 7b66d976a..000000000 --- a/alembic/versions/0520dfa9f2db_rename_functional_ranges_to_functional_.py +++ /dev/null @@ -1,45 +0,0 @@ -"""rename functional ranges to functional classifications, add class_ to model, rename classification to functional_classification - -Revision ID: 0520dfa9f2db -Revises: c770fa9e6e58 -Create Date: 2025-11-18 18:51:33.107952 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "0520dfa9f2db" -down_revision = "c770fa9e6e58" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.alter_column( - "score_calibration_functional_classifications", - "classification", - new_column_name="functional_classification", - type_=sa.Enum( - "normal", "abnormal", "not_specified", name="functionalclassification", native_enum=False, length=32 - ), - nullable=False, - ) - op.add_column("score_calibration_functional_classifications", sa.Column("class_", sa.String(), nullable=True)) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.alter_column( - "score_calibration_functional_classifications", - "functional_classification", - new_column_name="classification", - type_=sa.VARCHAR(length=32), - nullable=False, - ) - op.drop_column("score_calibration_functional_classifications", "class_") - # ### end Alembic commands ### diff --git a/alembic/versions/0b29eefbe1dd_controlled_keyword_modification.py b/alembic/versions/0b29eefbe1dd_controlled_keyword_modification.py deleted file mode 100644 index 1802d243e..000000000 --- a/alembic/versions/0b29eefbe1dd_controlled_keyword_modification.py +++ /dev/null @@ -1,55 +0,0 @@ -"""controlled keyword modification - -Revision ID: 0b29eefbe1dd -Revises: 2b7a977e7e98 -Create Date: 2025-08-07 15:45:43.241567 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "0b29eefbe1dd" -down_revision = "2b7a977e7e98" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - # Rename existing columns - op.alter_column( - "controlled_keywords", "value", new_column_name="label", existing_type=sa.String(), existing_nullable=False - ) - op.alter_column( - "controlled_keywords", "vocabulary", new_column_name="system", existing_type=sa.String(), existing_nullable=True - ) - # Add new columns - op.add_column("controlled_keywords", sa.Column("code", sa.String(), nullable=True)) - op.add_column("controlled_keywords", sa.Column("version", sa.String(), nullable=True)) - # Drop and recreate the correct unique constraint - op.drop_constraint("ix_controlled_keywords_key_value", "controlled_keywords", type_="unique") - op.create_unique_constraint("ix_controlled_keywords_key_label", "controlled_keywords", ["key", "label"]) - # ### end Alembic commands ### - - # TODO: Will modify this part when we get the final GO terms. - op.execute( - """INSERT INTO controlled_keywords (key, label, system, code, version, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Mechanism', 'Other', NULL, NULL, NULL, False, 'The Gene Ontology (GO) is a structured, standardized representation of biological knowledge.', NOW(), NOW())""" - ) - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.alter_column( - "controlled_keywords", "label", new_column_name="value", existing_type=sa.String(), existing_nullable=False - ) - op.alter_column( - "controlled_keywords", "system", new_column_name="vocabulary", existing_type=sa.String(), existing_nullable=True - ) - op.drop_constraint("ix_controlled_keywords_key_label", "controlled_keywords", type_="unique") - op.create_unique_constraint("ix_controlled_keywords_key_value", "controlled_keywords", ["key", "value"]) - op.drop_column("controlled_keywords", "version") - op.drop_column("controlled_keywords", "code") - # ### end Alembic commands ### diff --git a/alembic/versions/15c40c367731_index_functional_classification_variant_.py b/alembic/versions/15c40c367731_index_functional_classification_variant_.py deleted file mode 100644 index 5140e3b7a..000000000 --- a/alembic/versions/15c40c367731_index_functional_classification_variant_.py +++ /dev/null @@ -1,39 +0,0 @@ -"""index functional classification variant fk - -variant_id is only the trailing column of score_calibration_functional_classification_variants' -composite primary key, so Postgres has no index it can use to look up rows by variant_id alone. -Every Variant delete (including the per-variant cascade when a score set is deleted) forces a -sequential scan of this table to enforce that FK, which dominates the delete for any score set -with a nontrivial number of variants. See mavedb-api#677 ("unpublished score set deletion often -fails"). - -Building it takes a lock that blocks writes to the table, so in a populated database build it by hand -first, which makes this migration a no-op: - - CREATE INDEX CONCURRENTLY IF NOT EXISTS ix_score_calib_func_classification_variants_variant_id - ON score_calibration_functional_classification_variants (variant_id); - -Revision ID: 15c40c367731 -Revises: c4b18d0f7a92 -Create Date: 2026-09-21 11:19:39.396343 - -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "15c40c367731" -down_revision = "c4b18d0f7a92" -branch_labels = None -depends_on = None - -INDEX_NAME = "ix_score_calib_func_classification_variants_variant_id" -TABLE_NAME = "score_calibration_functional_classification_variants" - - -def upgrade(): - op.execute(f"CREATE INDEX IF NOT EXISTS {INDEX_NAME} ON {TABLE_NAME} (variant_id)") - - -def downgrade(): - op.execute(f"DROP INDEX IF EXISTS {INDEX_NAME}") diff --git a/alembic/versions/16beeb593513_add_acmg_classification_and_functional_.py b/alembic/versions/16beeb593513_add_acmg_classification_and_functional_.py deleted file mode 100644 index 77708250a..000000000 --- a/alembic/versions/16beeb593513_add_acmg_classification_and_functional_.py +++ /dev/null @@ -1,141 +0,0 @@ -"""add acmg classification and functional classification tables - -Revision ID: 16beeb593513 -Revises: b22b450d409c -Create Date: 2025-11-17 11:46:38.276980 - -""" - -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "16beeb593513" -down_revision = "b22b450d409c" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "acmg_classifications", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column( - "criterion", - sa.Enum( - "PVS1", - "PS1", - "PS2", - "PS3", - "PS4", - "PM1", - "PM2", - "PM3", - "PM4", - "PM5", - "PM6", - "PP1", - "PP2", - "PP3", - "PP4", - "PP5", - "BA1", - "BS1", - "BS2", - "BS3", - "BS4", - "BP1", - "BP2", - "BP3", - "BP4", - "BP5", - "BP6", - "BP7", - name="acmgcriterion", - native_enum=False, - length=32, - ), - nullable=True, - ), - sa.Column( - "evidence_strength", - sa.Enum( - "VERY_STRONG", - "STRONG", - "MODERATE_PLUS", - "MODERATE", - "SUPPORTING", - name="strengthofevidenceprovided", - native_enum=False, - length=32, - ), - nullable=True, - ), - sa.Column("points", sa.Integer(), nullable=True), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.PrimaryKeyConstraint("id"), - ) - op.create_table( - "score_calibration_functional_classifications", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("calibration_id", sa.Integer(), nullable=False), - sa.Column("label", sa.String(), nullable=False), - sa.Column("description", sa.String(), nullable=True), - sa.Column( - "classification", - sa.Enum( - "normal", "abnormal", "not_specified", name="functionalclassification", native_enum=False, length=32 - ), - nullable=False, - ), - sa.Column("range", postgresql.JSONB(none_as_null=True, astext_type=sa.Text()), nullable=True), - sa.Column("inclusive_lower_bound", sa.Boolean(), nullable=True), - sa.Column("inclusive_upper_bound", sa.Boolean(), nullable=True), - sa.Column("oddspaths_ratio", sa.Float(), nullable=True), - sa.Column("positive_likelihood_ratio", sa.Float(), nullable=True), - sa.Column("acmg_classification_id", sa.Integer(), nullable=True), - sa.ForeignKeyConstraint( - ["acmg_classification_id"], - ["acmg_classifications.id"], - ), - sa.ForeignKeyConstraint( - ["calibration_id"], - ["score_calibrations.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_table( - "score_calibration_functional_classification_variants", - sa.Column("functional_classification_id", sa.Integer(), nullable=False), - sa.Column("variant_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["functional_classification_id"], - ["score_calibration_functional_classifications.id"], - ), - sa.ForeignKeyConstraint( - ["variant_id"], - ["variants.id"], - ), - sa.PrimaryKeyConstraint("functional_classification_id", "variant_id"), - ) - op.alter_column("score_calibrations", "functional_ranges", new_column_name="functional_ranges_deprecated_json") - op.create_index( - op.f("ix_score_calibrations_modified_by_id"), "score_calibrations", ["modified_by_id"], unique=False - ) - op.create_index(op.f("ix_score_calibrations_created_by_id"), "score_calibrations", ["created_by_id"], unique=False) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f("ix_score_calibrations_modified_by_id"), table_name="score_calibrations") - op.drop_index(op.f("ix_score_calibrations_created_by_id"), table_name="score_calibrations") - op.drop_table("score_calibration_functional_classification_variants") - op.drop_table("score_calibration_functional_classifications") - op.drop_table("acmg_classifications") - op.alter_column("score_calibrations", "functional_ranges_deprecated_json", new_column_name="functional_ranges") - # ### end Alembic commands ### diff --git a/alembic/versions/194cfebabe32_rename_wild_type_sequence.py b/alembic/versions/194cfebabe32_rename_wild_type_sequence.py deleted file mode 100644 index c8f250685..000000000 --- a/alembic/versions/194cfebabe32_rename_wild_type_sequence.py +++ /dev/null @@ -1,31 +0,0 @@ -"""Rename Wild Type Sequence - -Revision ID: 194cfebabe32 -Revises: 44d5c568f64b -Create Date: 2023-08-29 12:48:18.390567 - -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "194cfebabe32" -down_revision = "44d5c568f64b" -branch_labels = None -depends_on = None - - -def upgrade(): - op.rename_table("wild_type_sequences", "target_sequences") - op.alter_column("target_genes", "wt_sequence_id", new_column_name="target_sequence_id") - op.execute("ALTER SEQUENCE wild_type_sequences_id_seq RENAME TO target_sequences_id_seq") - op.execute("ALTER INDEX wild_type_sequences_pkey RENAME TO target_sequences_pkey") - op.execute("ALTER INDEX ix_wild_type_sequences_id RENAME TO ix_target_sequences_id") - - -def downgrade(): - op.rename_table("target_sequences", "wild_type_sequences") - op.alter_column("target_genes", "target_sequence_id", new_column_name="wt_sequence_id") - op.execute("ALTER SEQUENCE target_sequences_id_seq RENAME TO wild_type_sequences_id_seq") - op.execute("ALTER INDEX target_sequences_pkey RENAME TO wild_type_sequences_pkey") - op.execute("ALTER INDEX ix_target_sequences_id RENAME TO ix_wild_type_sequences_id") diff --git a/alembic/versions/1cee01c42909_make_index_on_contributors_unique.py b/alembic/versions/1cee01c42909_make_index_on_contributors_unique.py deleted file mode 100644 index 97fdfa371..000000000 --- a/alembic/versions/1cee01c42909_make_index_on_contributors_unique.py +++ /dev/null @@ -1,29 +0,0 @@ -"""make index on contributors unique - -Revision ID: 1cee01c42909 -Revises: 76e1e55bc5c1 -Create Date: 2024-09-03 09:53:21.635751 - -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "1cee01c42909" -down_revision = "1d4933b4b6f7" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index("ix_contributors_orcid_id", table_name="contributors") - op.create_index(op.f("ix_contributors_orcid_id"), "contributors", ["orcid_id"], unique=True) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f("ix_contributors_orcid_id"), table_name="contributors") - op.create_index("ix_contributors_orcid_id", "contributors", ["orcid_id"], unique=False) - # ### end Alembic commands ### diff --git a/alembic/versions/1d4933b4b6f7_merge_76e1e55bc5c1_and_d7e6f8c3b9dc.py b/alembic/versions/1d4933b4b6f7_merge_76e1e55bc5c1_and_d7e6f8c3b9dc.py deleted file mode 100644 index 5ff043377..000000000 --- a/alembic/versions/1d4933b4b6f7_merge_76e1e55bc5c1_and_d7e6f8c3b9dc.py +++ /dev/null @@ -1,21 +0,0 @@ -"""merge 76e1e55bc5c1 and d7e6f8c3b9dc - -Revision ID: 1d4933b4b6f7 -Revises: 76e1e55bc5c1, d7e6f8c3b9dc -Create Date: 2024-09-04 16:17:20.875937 - -""" - -# revision identifiers, used by Alembic. -revision = "1d4933b4b6f7" -down_revision = ("76e1e55bc5c1", "d7e6f8c3b9dc") -branch_labels = None -depends_on = None - - -def upgrade(): - pass - - -def downgrade(): - pass diff --git a/alembic/versions/1e08b947679d_add_functional_consequence.py b/alembic/versions/1e08b947679d_add_functional_consequence.py deleted file mode 100644 index 008485e72..000000000 --- a/alembic/versions/1e08b947679d_add_functional_consequence.py +++ /dev/null @@ -1,31 +0,0 @@ -"""Add functional consequence - -Revision ID: 1e08b947679d -Revises: f5a72192fafd -Create Date: 2025-09-17 11:15:52.091271 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "1e08b947679d" -down_revision = "f5a72192fafd" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column("mapped_variants", sa.Column("vep_functional_consequence", sa.String(), nullable=True)) - op.add_column("mapped_variants", sa.Column("vep_access_date", sa.Date(), nullable=True)) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column("mapped_variants", "vep_access_date") - op.drop_column("mapped_variants", "vep_functional_consequence") - # ### end Alembic commands ### diff --git a/alembic/versions/22e2d92d602e_add_publication_identifier_metadata_.py b/alembic/versions/22e2d92d602e_add_publication_identifier_metadata_.py deleted file mode 100644 index 13c079c09..000000000 --- a/alembic/versions/22e2d92d602e_add_publication_identifier_metadata_.py +++ /dev/null @@ -1,193 +0,0 @@ -"""add publication identifier metadata columns - -Revision ID: 22e2d92d602e -Revises: da9ba478647d -Create Date: 2023-06-01 14:51:04.700969 - -""" - -import os -from typing import Optional - -import eutils -import sqlalchemy as sa -from eutils import EutilsNCBIError -from eutils._internal.xmlfacades.pubmedarticleset import PubmedArticleSet -from sqlalchemy.dialects.postgresql import JSONB -from sqlalchemy.orm import Session - -from alembic import op -from mavedb.lib.exceptions import AmbiguousIdentifierError -from mavedb.lib.external_publications import Rxiv -from mavedb.lib.identifiers import ExternalPublication -from mavedb.models.publication_identifier import PublicationIdentifier - -# revision identifiers, used by Alembic. -revision = "22e2d92d602e" -down_revision = "33e99d4b90cc" -branch_labels = None -depends_on = None - - -def upgrade(): - conn = op.get_bind() - session = Session(bind=conn) - - # add new publication data metadata cols - op.add_column( - table_name="publication_identifiers", - column=sa.Column("title", sa.Text, nullable=True), - ) - op.add_column( - table_name="publication_identifiers", - column=sa.Column("abstract", sa.Text, nullable=True), - ) - op.add_column( - table_name="publication_identifiers", - column=sa.Column("authors", JSONB, nullable=True), - ) - op.add_column( - table_name="publication_identifiers", - column=sa.Column("publication_doi", sa.Text, nullable=True), - ) - op.add_column( - table_name="publication_identifiers", - column=sa.Column("preprint_doi", sa.Text, nullable=True), - ) - # Metapub only provides the publication year - op.add_column( - table_name="publication_identifiers", - column=sa.Column("publication_year", sa.Integer, nullable=True), - ) - op.add_column( - table_name="publication_identifiers", - column=sa.Column("preprint_date", sa.Date, nullable=True), - ) - op.add_column( - table_name="publication_identifiers", - column=sa.Column("publication_journal", sa.Text, nullable=True), - ) - - # Data migration to back-populate all publication identifiers with metadata - for item in session.query(PublicationIdentifier).filter_by(title=None): - if item.db_name == "PubMed": - pub_article = fetch_pubmed_article(item.identifier) - else: - pub_article = None - if item.db_name == "bioRxiv": - bio_article = fetch_biorxiv_article(item.identifier) - else: - bio_article = None - if item.db_name == "medRxiv": - med_article = fetch_medrxiv_article(item.identifier) - else: - med_article = None - - if pub_article: - item.title = pub_article.title - item.abstract = pub_article.abstract - item.publication_doi = pub_article.publication_doi - item.publication_year = pub_article.publication_year - item.publication_journal = pub_article.publication_journal - - authors = [str(author["name"]).replace("'", "''") for author in pub_article.authors] - authors = [{"name": author, "primary": idx == 0} for idx, author in enumerate(authors)] - item.authors = authors - - if bio_article: - item.title = bio_article.title - item.abstract = bio_article.abstract - item.preprint_doi = bio_article.preprint_doi - item.preprint_date = bio_article.preprint_date - item.reference_html = bio_article.reference_html - - authors = [str(author["name"]).replace("'", "''") for author in bio_article.authors] - authors = [{"name": author, "primary": idx == 0} for idx, author in enumerate(authors)] - item.authors = authors - - if med_article: - item.title = med_article.title - item.abstract = med_article.abstract - item.preprint_doi = med_article.preprint_doi - item.preprint_date = med_article.preprint_date - item.reference_html = med_article.reference_html - - authors = [str(author["name"]).replace("'", "''") for author in med_article.authors] - authors = [{"name": author, "primary": idx == 0} for idx, author in enumerate(authors)] - item.authors = authors - - session.commit() - - # make our title and authors columns non-nullable and add a constraint so that one DOI must be filled - op.alter_column("publication_identifiers", column_name="title", nullable=False) - op.alter_column("publication_identifiers", column_name="authors", nullable=False) - op.create_check_constraint( - "publication_doi_preprint_doi_not_null_constraint", - table_name="publication_identifiers", - condition="(publication_doi IS NULL) <> (preprint_doi IS NULL)", - ) - - -def downgrade(): - op.drop_constraint( - table_name="publication_identifiers", constraint_name="publication_doi_preprint_doi_not_null_constraint" - ) - - op.drop_column(table_name="publication_identifiers", column_name="title") - op.drop_column(table_name="publication_identifiers", column_name="abstract") - op.drop_column(table_name="publication_identifiers", column_name="authors") - op.drop_column(table_name="publication_identifiers", column_name="publication_doi") - op.drop_column(table_name="publication_identifiers", column_name="preprint_doi") - op.drop_column(table_name="publication_identifiers", column_name="publication_year") - op.drop_column(table_name="publication_identifiers", column_name="preprint_date") - op.drop_column(table_name="publication_identifiers", column_name="publication_journal") - - -# Pull these in here to spoof non-async behavior, ideally we only run this migration once and -# don't have to worry about any drift. -def fetch_pubmed_article(identifier: str) -> Optional[ExternalPublication]: - """ - Fetch an existing PubMed article from NCBI - """ - fetch = eutils.QueryService(api_key=os.getenv("NCBI_API_KEY")) - try: - fetched_articles = list(PubmedArticleSet(fetch.efetch({"db": "pubmed", "id": identifier}))) - assert len(fetched_articles) < 2 - article = ExternalPublication(identifier=identifier, db_name="PubMed", external_publication=fetched_articles[0]) - - except AssertionError as exc: - raise AmbiguousIdentifierError(f"Fetched more than 1 PubMed article associated with PMID {identifier}") from exc - except EutilsNCBIError: - return None - except IndexError: - return None - else: - return article - - -def fetch_biorxiv_article(identifier: str) -> Optional[ExternalPublication]: - """ - Fetch an existing bioRxiv article from Rxiv - """ - fetch = Rxiv("https://api.biorxiv.org", "biorxiv") - try: - article = fetch.content_detail(identifier=identifier) - article = ExternalPublication(identifier=identifier, db_name="bioRxiv", external_publication=article[-1]) - except IndexError: - return None - else: - return article - - -def fetch_medrxiv_article(identifier: str) -> Optional[ExternalPublication]: - """ - Fetch an existing medRxiv article from Rxiv - """ - fetch = Rxiv("https://api.biorxiv.org", "medrxiv") - try: - article = fetch.content_detail(identifier=identifier) - article = ExternalPublication(identifier=identifier, db_name="medRxiv", external_publication=article[-1]) - except IndexError: - return None - else: - return article diff --git a/alembic/versions/2b6f40ea2fb6_add_score_range_column.py b/alembic/versions/2b6f40ea2fb6_add_score_range_column.py deleted file mode 100644 index 0f69eedef..000000000 --- a/alembic/versions/2b6f40ea2fb6_add_score_range_column.py +++ /dev/null @@ -1,30 +0,0 @@ -"""Add score range column - -Revision ID: 2b6f40ea2fb6 -Revises: 1cee01c42909 -Create Date: 2024-09-09 12:25:33.180077 - -""" - -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "2b6f40ea2fb6" -down_revision = "1cee01c42909" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column("scoresets", sa.Column("score_ranges", postgresql.JSONB(astext_type=sa.Text()), nullable=True)) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column("scoresets", "score_ranges") - # ### end Alembic commands ### diff --git a/alembic/versions/2b7a977e7e98_make_faf95_max_and_ancestry_possibly_.py b/alembic/versions/2b7a977e7e98_make_faf95_max_and_ancestry_possibly_.py deleted file mode 100644 index 58ff51a44..000000000 --- a/alembic/versions/2b7a977e7e98_make_faf95_max_and_ancestry_possibly_.py +++ /dev/null @@ -1,31 +0,0 @@ -"""Make faf95_max and ancestry possibly nullable - -Revision ID: 2b7a977e7e98 -Revises: a8e345cca190 -Create Date: 2025-08-21 10:08:58.565416 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "2b7a977e7e98" -down_revision = "a8e345cca190" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.alter_column("gnomad_variants", "faf95_max", existing_type=sa.DOUBLE_PRECISION(precision=53), nullable=True) - op.alter_column("gnomad_variants", "faf95_max_ancestry", existing_type=sa.VARCHAR(), nullable=True) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.alter_column("gnomad_variants", "faf95_max_ancestry", existing_type=sa.VARCHAR(), nullable=False) - op.alter_column("gnomad_variants", "faf95_max", existing_type=sa.DOUBLE_PRECISION(precision=53), nullable=False) - # ### end Alembic commands ### diff --git a/alembic/versions/2c8d7e2bf2fe_consolidate_publication_identifier_dois.py b/alembic/versions/2c8d7e2bf2fe_consolidate_publication_identifier_dois.py deleted file mode 100644 index 09d7449b3..000000000 --- a/alembic/versions/2c8d7e2bf2fe_consolidate_publication_identifier_dois.py +++ /dev/null @@ -1,45 +0,0 @@ -"""Consolidate Publication Identifier DOIs - -Revision ID: 2c8d7e2bf2fe -Revises: 8bcb2b4edc60 -Create Date: 2024-05-16 13:06:05.561411 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "2c8d7e2bf2fe" -down_revision = "8bcb2b4edc60" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column("publication_identifiers", sa.Column("doi", sa.String(), nullable=True)) - op.execute("UPDATE publication_identifiers SET doi = COALESCE(publication_doi, preprint_doi)") - - op.drop_constraint("publication_doi_preprint_doi_not_null_constraint", table_name="publication_identifiers") - op.drop_column("publication_identifiers", "publication_doi") - op.drop_column("publication_identifiers", "preprint_doi") - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column("publication_identifiers", sa.Column("publication_doi", sa.String(), nullable=True)) - op.add_column("publication_identifiers", sa.Column("preprint_doi", sa.String(), nullable=True)) - - op.execute("UPDATE publication_identifiers SET publication_doi = doi WHERE publication_journal <> 'Preprint'") - op.execute("UPDATE publication_identifiers SET preprint_doi = doi WHERE publication_journal = 'Preprint'") - - op.create_check_constraint( - "publication_doi_preprint_doi_not_null_constraint", - table_name="publication_identifiers", - condition="(publication_doi IS NULL) <> (preprint_doi IS NULL)", - ) - op.drop_column("publication_identifiers", "doi") - # ### end Alembic commands ### diff --git a/alembic/versions/33e99d4b90cc_add_mapped_variants_table.py b/alembic/versions/33e99d4b90cc_add_mapped_variants_table.py deleted file mode 100644 index 6eff735b6..000000000 --- a/alembic/versions/33e99d4b90cc_add_mapped_variants_table.py +++ /dev/null @@ -1,43 +0,0 @@ -"""Add mapped_variants table - -Revision ID: 33e99d4b90cc -Revises: 988ca84c701b -Create Date: 2023-05-15 17:24:07.847206 - -""" - -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "33e99d4b90cc" -down_revision = "da9ba478647d" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "mapped_variants", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("pre_mapped", postgresql.JSONB(astext_type=sa.Text()), nullable=False), - sa.Column("post_mapped", postgresql.JSONB(astext_type=sa.Text()), nullable=False), - sa.Column("variant_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["variant_id"], - ["variants.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_mapped_variants_id"), "mapped_variants", ["id"], unique=False) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f("ix_mapped_variants_id"), table_name="mapped_variants") - op.drop_table("mapped_variants") - # ### end Alembic commands ### diff --git a/alembic/versions/34026092c7f8_clinvar_variant_table.py b/alembic/versions/34026092c7f8_clinvar_variant_table.py deleted file mode 100644 index 17031c49c..000000000 --- a/alembic/versions/34026092c7f8_clinvar_variant_table.py +++ /dev/null @@ -1,58 +0,0 @@ -"""clinvar variant table - -Revision ID: 34026092c7f8 -Revises: e8a3b5d8f885 -Create Date: 2025-01-28 21:48:42.532346 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "34026092c7f8" -down_revision = "e8a3b5d8f885" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "clinvar_variants", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("allele_id", sa.Integer(), nullable=False), - sa.Column("gene_symbol", sa.String(), nullable=False), - sa.Column("clinical_significance", sa.String(), nullable=False), - sa.Column("clinical_review_status", sa.String(), nullable=False), - sa.Column("clinvar_db_version", sa.String(), nullable=False), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_clinvar_variants_allele_id"), "clinvar_variants", ["allele_id"], unique=False) - op.add_column("mapped_variants", sa.Column("clinvar_variant_id", sa.Integer(), nullable=True)) - op.create_index( - op.f("ix_mapped_variants_clinvar_variant_id"), "mapped_variants", ["clinvar_variant_id"], unique=False - ) - op.create_foreign_key( - "mapped_variant_clinvar_variant_id_foreign_key_constraint", - "mapped_variants", - "clinvar_variants", - ["clinvar_variant_id"], - ["id"], - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_constraint( - "mapped_variant_clinvar_variant_id_foreign_key_constraint", "mapped_variants", type_="foreignkey" - ) - op.drop_index(op.f("ix_mapped_variants_clinvar_variant_id"), table_name="mapped_variants") - op.drop_column("mapped_variants", "clinvar_variant_id") - op.drop_index(op.f("ix_clinvar_variants_allele_id"), table_name="clinvar_variants") - op.drop_table("clinvar_variants") - # ### end Alembic commands ### diff --git a/alembic/versions/377bb8c30bde_roles_as_enums_access_keys_can_have_.py b/alembic/versions/377bb8c30bde_roles_as_enums_access_keys_can_have_.py deleted file mode 100644 index 2cee5bacf..000000000 --- a/alembic/versions/377bb8c30bde_roles_as_enums_access_keys_can_have_.py +++ /dev/null @@ -1,31 +0,0 @@ -"""Roles as Enums, Access Keys can have Roles - -Revision ID: 377bb8c30bde -Revises: b3767156e04a -Create Date: 2024-04-18 09:19:04.008237 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "377bb8c30bde" -down_revision = "b3767156e04a" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column("access_keys", sa.Column("role_id", sa.Integer(), nullable=True)) - op.create_foreign_key("access_key_roles_fk_constraint", "access_keys", "roles", ["role_id"], ["id"]) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_constraint("access_key_roles_fk_constraint", "access_keys", type_="foreignkey") - op.drop_column("access_keys", "role_id") - # ### end Alembic commands ### diff --git a/alembic/versions/393764b9e833_cascade_annotation_event_variant_delete.py b/alembic/versions/393764b9e833_cascade_annotation_event_variant_delete.py deleted file mode 100644 index 95450a795..000000000 --- a/alembic/versions/393764b9e833_cascade_annotation_event_variant_delete.py +++ /dev/null @@ -1,43 +0,0 @@ -"""cascade annotation events when their variant is deleted - -Revision ID: 393764b9e833 -Revises: 45e8ec1db15e -Create Date: 2026-09-29 - -The mapping job records a variant-subject ``annotation_event`` for every variant it maps. With the foreign key -on ``RESTRICT``, deleting a mapped score set or re-uploading its variants failed on that key. Variant-subject -events now go with their variant, as ``variant_annotation_status`` rows do. Allele-subject events keep -``RESTRICT``: alleles are shared across score sets and are never deleted with one. -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "393764b9e833" -down_revision = "45e8ec1db15e" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.drop_constraint("annotation_event_variant_id_fkey", "annotation_event", type_="foreignkey") - op.create_foreign_key( - "annotation_event_variant_id_fkey", - "annotation_event", - "variants", - ["variant_id"], - ["id"], - ondelete="CASCADE", - ) - - -def downgrade() -> None: - op.drop_constraint("annotation_event_variant_id_fkey", "annotation_event", type_="foreignkey") - op.create_foreign_key( - "annotation_event_variant_id_fkey", - "annotation_event", - "variants", - ["variant_id"], - ["id"], - ondelete="RESTRICT", - ) diff --git a/alembic/versions/398067c53257_add_unique_constraint_to_clinical_.py b/alembic/versions/398067c53257_add_unique_constraint_to_clinical_.py deleted file mode 100644 index 9dfde7156..000000000 --- a/alembic/versions/398067c53257_add_unique_constraint_to_clinical_.py +++ /dev/null @@ -1,120 +0,0 @@ -"""add unique constraint to clinical_controls (db_name, db_identifier, db_version) - -Prevents duplicate ClinicalControl rows that can arise when concurrent -refresh_clinvar_controls jobs race on the same (db_name, db_identifier, -db_version) tuple. The upsert in the job code relies on this constraint. - -Revision ID: 398067c53257 -Revises: 8c4a2f1d9e6b -Create Date: 2026-05-07 14:54:48.633770 - -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "398067c53257" -down_revision = "8c4a2f1d9e6b" -branch_labels = None -depends_on = None - - -def upgrade(): - # Re-point mapped_variants_clinical_controls rows that reference a duplicate - # clinical_control to the surviving (lowest-id) row for that group, so no - # association links are lost during deduplication. - # - # Step 1: Drop association rows that would produce a composite-PK conflict - # after re-pointing (i.e. the mapped_variant is already linked to the - # surviving control). - op.execute( - """ - WITH survivors AS ( - SELECT db_name, db_identifier, db_version, MIN(id) AS survivor_id - FROM clinical_controls - GROUP BY db_name, db_identifier, db_version - HAVING COUNT(*) > 1 - ), - duplicates AS ( - SELECT cc.id AS duplicate_id, s.survivor_id - FROM clinical_controls cc - JOIN survivors s - ON cc.db_name = s.db_name - AND cc.db_identifier = s.db_identifier - AND cc.db_version = s.db_version - AND cc.id != s.survivor_id - ) - DELETE FROM mapped_variants_clinical_controls mvcc - USING duplicates d - WHERE mvcc.clinical_control_id = d.duplicate_id - AND EXISTS ( - SELECT 1 - FROM mapped_variants_clinical_controls existing - WHERE existing.mapped_variant_id = mvcc.mapped_variant_id - AND existing.clinical_control_id = d.survivor_id - ) - """ - ) - - # Step 2: Re-point remaining association rows from duplicate IDs to the - # survivor, preserving all mapped_variant links. - op.execute( - """ - WITH survivors AS ( - SELECT db_name, db_identifier, db_version, MIN(id) AS survivor_id - FROM clinical_controls - GROUP BY db_name, db_identifier, db_version - HAVING COUNT(*) > 1 - ), - duplicates AS ( - SELECT cc.id AS duplicate_id, s.survivor_id - FROM clinical_controls cc - JOIN survivors s - ON cc.db_name = s.db_name - AND cc.db_identifier = s.db_identifier - AND cc.db_version = s.db_version - AND cc.id != s.survivor_id - ) - UPDATE mapped_variants_clinical_controls mvcc - SET clinical_control_id = d.survivor_id - FROM duplicates d - WHERE mvcc.clinical_control_id = d.duplicate_id - """ - ) - - # Step 3: Delete the now-unlinked duplicate clinical_control rows. - op.execute( - """ - DELETE FROM clinical_controls - WHERE id NOT IN ( - SELECT MIN(id) - FROM clinical_controls - GROUP BY db_name, db_identifier, db_version - ) - """ - ) - - # CREATE UNIQUE INDEX CONCURRENTLY must run outside a transaction. - # autocommit_block() commits the cleanup steps above, then builds the index - # without holding an AccessExclusiveLock for the full duration. - with op.get_context().autocommit_block(): - op.execute( - "CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS " - "uq_clinical_controls_db_name_identifier_version " - "ON clinical_controls (db_name, db_identifier, db_version)" - ) - - # Promote the index to a named constraint (brief catalog update only). - op.execute( - "ALTER TABLE clinical_controls " - "ADD CONSTRAINT uq_clinical_controls_db_name_identifier_version " - "UNIQUE USING INDEX uq_clinical_controls_db_name_identifier_version" - ) - - -def downgrade(): - op.drop_constraint( - "uq_clinical_controls_db_name_identifier_version", - "clinical_controls", - type_="unique", - ) diff --git a/alembic/versions/44a45d616036_make_index_on_users_unique.py b/alembic/versions/44a45d616036_make_index_on_users_unique.py deleted file mode 100644 index 22c6239f5..000000000 --- a/alembic/versions/44a45d616036_make_index_on_users_unique.py +++ /dev/null @@ -1,29 +0,0 @@ -"""Make Index on Users Unique - -Revision ID: 44a45d616036 -Revises: ec5d2787bec9 -Create Date: 2024-08-16 13:25:14.980820 - -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "44a45d616036" -down_revision = "ec5d2787bec9" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index("ix_users_username", table_name="users") - op.create_index(op.f("ix_users_username"), "users", ["username"], unique=True) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f("ix_users_username"), table_name="users") - op.create_index("ix_users_username", "users", ["username"], unique=False) - # ### end Alembic commands ### diff --git a/alembic/versions/44d5c568f64b_simplify_reference_genome_target_.py b/alembic/versions/44d5c568f64b_simplify_reference_genome_target_.py deleted file mode 100644 index 7b6d080c1..000000000 --- a/alembic/versions/44d5c568f64b_simplify_reference_genome_target_.py +++ /dev/null @@ -1,62 +0,0 @@ -"""Simplify Reference Genome Target Structure - -Revision ID: 44d5c568f64b -Revises: 90e7860964a2 -Create Date: 2023-08-24 15:20:01.208691 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "44d5c568f64b" -down_revision = "90e7860964a2" -branch_labels = None -depends_on = None - - -def upgrade(): - op.add_column( - "wild_type_sequences", - sa.Column("reference_id", sa.Integer, sa.ForeignKey("reference_genomes.id"), nullable=True), - ) - op.execute( - """ - UPDATE wild_type_sequences w - SET reference_id = l.genome_id - FROM - (select * from reference_maps inner join target_genes on target_genes.id = reference_maps.target_id) as l - WHERE w.id = l.wt_sequence_id - """ - ) - - op.alter_column("wild_type_sequences", "reference_id", nullable=True) - op.drop_table("reference_maps") - - -def downgrade(): - op.create_table( - "reference_maps", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("is_primary", sa.Boolean(), nullable=False), - sa.Column("genome_id", sa.Integer(), sa.ForeignKey("reference_genomes.id"), nullable=False), - sa.Column("target_id", sa.Integer(), sa.ForeignKey("target_genes.id"), nullable=False), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.PrimaryKeyConstraint("id"), - ) - op.execute("delete from target_genes where wt_sequence_id is NULL") - op.execute( - """ - INSERT INTO reference_maps (is_primary, genome_id, target_id, creation_date, modification_date) - SELECT false, wild_type_sequences.reference_id, target_genes.id, current_date, current_date - FROM target_genes JOIN wild_type_sequences on target_genes.wt_sequence_id = wild_type_sequences.id - WHERE wild_type_sequences.reference_id is not null - """ - ) - op.execute( - "delete from reference_maps where target_id in (select id from target_genes where wt_sequence_id is NULL)" - ) - op.drop_column("wild_type_sequences", "reference_id") diff --git a/alembic/versions/45e8ec1db15e_carry_score_set_id_on_mapping_tables.py b/alembic/versions/45e8ec1db15e_carry_score_set_id_on_mapping_tables.py deleted file mode 100644 index 92d88dd81..000000000 --- a/alembic/versions/45e8ec1db15e_carry_score_set_id_on_mapping_tables.py +++ /dev/null @@ -1,94 +0,0 @@ -"""carry score_set_id on mapping_records and mapping_record_alleles - -Revision ID: 45e8ec1db15e -Revises: d1c9b7a3e2f4 -Create Date: 2026-09-28 - -Adds a ``score_set_id`` column to ``mapping_records`` and ``mapping_record_alleles`` so an RLS policy can -check a row's score set directly (#833). Both tables otherwise reach their score set only through -``variants``, and delegating through a table that size costs ~700 ms per lookup. - -Each column sits under a composite foreign key to its parent's id and score set, so it can't disagree -with the variant it belongs to. The composite keys replace the single-column ``variant_id`` and -``mapping_record_id`` foreign keys. Both cascade on delete, so deleting a variant (on re-upload or score set -deletion) removes its mapping records and their allele links. - -**Before deploying to production**, build the ``variants`` index by hand, since a migration can't build it -concurrently (#877). The ``IF NOT EXISTS`` below then does nothing there, and builds the index on an empty -or small database:: - - CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS uq_variants_id_scoreset ON variants (id, scoreset_id); - -The backfills are sized for staging, where the mapping tables already hold data. In production the tables -are empty when this runs. -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "45e8ec1db15e" -down_revision = "d1c9b7a3e2f4" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.execute("CREATE UNIQUE INDEX IF NOT EXISTS uq_variants_id_scoreset ON variants (id, scoreset_id)") - - op.execute("ALTER TABLE mapping_records ADD COLUMN score_set_id integer") - op.execute("UPDATE mapping_records mr SET score_set_id = v.scoreset_id FROM variants v WHERE v.id = mr.variant_id") - op.execute("ALTER TABLE mapping_records ALTER COLUMN score_set_id SET NOT NULL") - op.execute("CREATE UNIQUE INDEX uq_mapping_records_id_score_set ON mapping_records (id, score_set_id)") - op.drop_constraint("fk_mapping_records_variant_id", "mapping_records", type_="foreignkey") - op.create_foreign_key( - "fk_mapping_records_variant_score_set", - "mapping_records", - "variants", - ["variant_id", "score_set_id"], - ["id", "scoreset_id"], - ondelete="CASCADE", - ) - - op.execute("ALTER TABLE mapping_record_alleles ADD COLUMN score_set_id integer") - op.execute( - "UPDATE mapping_record_alleles mra SET score_set_id = mr.score_set_id " - "FROM mapping_records mr WHERE mr.id = mra.mapping_record_id" - ) - op.execute("ALTER TABLE mapping_record_alleles ALTER COLUMN score_set_id SET NOT NULL") - op.drop_constraint("fk_mapping_record_alleles_mapping_record_id", "mapping_record_alleles", type_="foreignkey") - op.create_foreign_key( - "fk_mapping_record_alleles_mapping_record_score_set", - "mapping_record_alleles", - "mapping_records", - ["mapping_record_id", "score_set_id"], - ["id", "score_set_id"], - ondelete="CASCADE", - ) - - -def downgrade() -> None: - op.drop_constraint( - "fk_mapping_record_alleles_mapping_record_score_set", "mapping_record_alleles", type_="foreignkey" - ) - op.create_foreign_key( - "fk_mapping_record_alleles_mapping_record_id", - "mapping_record_alleles", - "mapping_records", - ["mapping_record_id"], - ["id"], - ondelete="CASCADE", - ) - op.drop_column("mapping_record_alleles", "score_set_id") - - op.drop_constraint("fk_mapping_records_variant_score_set", "mapping_records", type_="foreignkey") - op.create_foreign_key( - "fk_mapping_records_variant_id", - "mapping_records", - "variants", - ["variant_id"], - ["id"], - ) - op.drop_index("uq_mapping_records_id_score_set", table_name="mapping_records") - op.drop_column("mapping_records", "score_set_id") - - op.drop_index("uq_variants_id_scoreset", table_name="variants") diff --git a/alembic/versions/4726e4dddde8_simplify_published_variants_mv_indexes.py b/alembic/versions/4726e4dddde8_simplify_published_variants_mv_indexes.py deleted file mode 100644 index 1ce888933..000000000 --- a/alembic/versions/4726e4dddde8_simplify_published_variants_mv_indexes.py +++ /dev/null @@ -1,75 +0,0 @@ -"""simplify published variants mv indexes - -Revision ID: 4726e4dddde8 -Revises: b85bc7b1bec7 -Create Date: 2025-03-25 10:46:46.641777 - -""" - -from alembic import op - - -# revision identifiers, used by Alembic. -revision = "4726e4dddde8" -down_revision = "b85bc7b1bec7" -branch_labels = None -depends_on = None - -# Frozen literal, not imported from the model: this migration replaces the historical -# mapped_variants-based MV indexes at its point in history. A later migration rebuilds the MV onto -# the mapping_records substrate and re-indexes it, so the column names below stay the legacy ones. -signature = "published_variants_materialized_view" - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(f"idx_{signature}_variant_id", signature) - op.drop_index(f"idx_{signature}_variant_urn", signature) - op.drop_index(f"idx_{signature}_mapped_variant_id", signature) - op.drop_index(f"idx_{signature}_score_set_id", signature) - op.drop_index(f"idx_{signature}_score_set_urn", signature) - - op.create_index( - f"idx_{signature}_ids", - signature, - ["mapped_variant_id", "variant_id", "score_set_id"], - unique=True, - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(f"idx_{signature}_ids", signature) - - op.create_index( - f"idx_{signature}_variant_id", - signature, - ["variant_id"], - unique=False, - ) - op.create_index( - f"idx_{signature}_variant_urn", - signature, - ["variant_urn"], - unique=False, - ) - op.create_index( - f"idx_{signature}_score_set_id", - signature, - ["score_set_id"], - unique=False, - ) - op.create_index( - f"idx_{signature}_score_set_urn", - signature, - ["score_set_urn"], - unique=False, - ) - op.create_index( - f"idx_{signature}_mapped_variant_id", - signature, - ["mapped_variant_id"], - unique=True, - ) - # ### end Alembic commands ### diff --git a/alembic/versions/4b9fb51a460d_add_uniprot_id_field_for_mapped_metadata.py b/alembic/versions/4b9fb51a460d_add_uniprot_id_field_for_mapped_metadata.py deleted file mode 100644 index a0ba6dde4..000000000 --- a/alembic/versions/4b9fb51a460d_add_uniprot_id_field_for_mapped_metadata.py +++ /dev/null @@ -1,29 +0,0 @@ -"""add uniprot id field for mapped metadata - -Revision ID: 4b9fb51a460d -Revises: aa3933cf0cb3 -Create Date: 2025-07-24 16:07:51.548202 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "4b9fb51a460d" -down_revision = "aa3933cf0cb3" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column("target_genes", sa.Column("uniprot_id_from_mapped_metadata", sa.String(), nullable=True)) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column("target_genes", "uniprot_id_from_mapped_metadata") - # ### end Alembic commands ### diff --git a/alembic/versions/4dbf24ed1857_add_unique_constraint_on_replaces_id.py b/alembic/versions/4dbf24ed1857_add_unique_constraint_on_replaces_id.py deleted file mode 100644 index b3f2e5905..000000000 --- a/alembic/versions/4dbf24ed1857_add_unique_constraint_on_replaces_id.py +++ /dev/null @@ -1,28 +0,0 @@ -"""add unique constraint on replaces_id - -Revision ID: 4dbf24ed1857 -Revises: 398067c53257 -Create Date: 2026-05-13 11:22:59.646605 - -""" -from alembic import op - -# revision identifiers, used by Alembic. -revision = '4dbf24ed1857' -down_revision = '398067c53257' -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index('ix_scoresets_replaces_id', table_name='scoresets') - op.create_index(op.f('ix_scoresets_replaces_id'), 'scoresets', ['replaces_id'], unique=True) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f('ix_scoresets_replaces_id'), table_name='scoresets') - op.create_index('ix_scoresets_replaces_id', 'scoresets', ['replaces_id'], unique=False) - # ### end Alembic commands ### diff --git a/alembic/versions/5cad62af3705_rename_pubmed_identifiers_table_to_publication_identifiers.py b/alembic/versions/5cad62af3705_rename_pubmed_identifiers_table_to_publication_identifiers.py deleted file mode 100644 index e3d9e9879..000000000 --- a/alembic/versions/5cad62af3705_rename_pubmed_identifiers_table_to_publication_identifiers.py +++ /dev/null @@ -1,241 +0,0 @@ -"""rename pubmed_identifiers table to publication_identifiers - -Revision ID: 5cad62af3705 -Revises: 988ca84c701b -Create Date: 2023-05-09 16:18:41.360541 - -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "5cad62af3705" -down_revision = "f11fd758436e" -branch_labels = None -depends_on = None - - -def upgrade(): - op.drop_constraint( - constraint_name="experiment_pubmed_identifiers_pubmed_identifier_id_fkey", - table_name="experiment_pubmed_identifiers", - type_="foreignkey", - ) - op.drop_constraint( - constraint_name="experiment_set_pubmed_identifiers_pubmed_identifier_id_fkey", - table_name="experiment_set_pubmed_identifiers", - type_="foreignkey", - ) - op.drop_constraint( - constraint_name="scoreset_pubmed_identifiers_pubmed_identifier_id_fkey", - table_name="scoreset_pubmed_identifiers", - type_="foreignkey", - ) - op.drop_constraint( - constraint_name="experiment_pubmed_identifiers_experiment_id_fkey", - table_name="experiment_pubmed_identifiers", - type_="foreignkey", - ) - op.drop_constraint( - constraint_name="experiment_set_pubmed_identifiers_experiment_set_id_fkey", - table_name="experiment_set_pubmed_identifiers", - type_="foreignkey", - ) - op.drop_constraint( - constraint_name="scoreset_pubmed_identifiers_scoreset_id_fkey", - table_name="scoreset_pubmed_identifiers", - type_="foreignkey", - ) - - op.rename_table("pubmed_identifiers", "publication_identifiers") - - op.execute("ALTER SEQUENCE pubmed_identifiers_id_seq RENAME TO publication_identifiers_id_seq") - op.execute("ALTER INDEX pubmed_identifiers_pkey RENAME TO publication_identifiers_pkey") - op.execute("ALTER INDEX ix_pubmed_identifiers_id RENAME TO ix_publication_identifiers_id") - - op.rename_table("experiment_pubmed_identifiers", "experiment_publication_identifiers") - op.rename_table("experiment_set_pubmed_identifiers", "experiment_set_publication_identifiers") - op.rename_table("scoreset_pubmed_identifiers", "scoreset_publication_identifiers") - - op.alter_column( - "experiment_publication_identifiers", - "pubmed_identifier_id", - nullable=False, - new_column_name="publication_identifier_id", - ) - op.alter_column( - "experiment_set_publication_identifiers", - "pubmed_identifier_id", - nullable=False, - new_column_name="publication_identifier_id", - ) - op.alter_column( - "scoreset_publication_identifiers", - "pubmed_identifier_id", - nullable=False, - new_column_name="publication_identifier_id", - ) - - op.execute("ALTER INDEX experiment_pubmed_identifiers_pkey RENAME TO experiment_publication_identifiers_pkey") - op.execute( - "ALTER INDEX experiment_set_pubmed_identifiers_pkey RENAME TO experiment_set_publication_identifiers_pkey" - ) - op.execute("ALTER INDEX scoreset_pubmed_identifiers_pkey RENAME TO scoreset_publication_identifiers_pkey") - - # If we follow our naming conventions, the next two constraint names would exceed an - # internal postgres 63 char limit. This value is technically configurable if we edit - # and recompile our psql source code, but it's much easier to just skirt our naming - # conventions in the case of publication identifiers. -capodb 10.5.2023 - op.create_foreign_key( - constraint_name="experiment_pub_identifiers_publication_identifier_id_fkey", - source_table="experiment_publication_identifiers", - referent_table="publication_identifiers", - local_cols=["publication_identifier_id"], - remote_cols=["id"], - ) - op.create_foreign_key( - constraint_name="experiment_set_pub_identifiers_publication_identifier_id_fkey", - source_table="experiment_set_publication_identifiers", - referent_table="publication_identifiers", - local_cols=["publication_identifier_id"], - remote_cols=["id"], - ) - op.create_foreign_key( - constraint_name="scoreset_pub_identifiers_publication_identifier_id_fkey", - source_table="scoreset_publication_identifiers", - referent_table="publication_identifiers", - local_cols=["publication_identifier_id"], - remote_cols=["id"], - ) - op.create_foreign_key( - constraint_name="experiment_pub_identifiers_experiment_id_fkey", - source_table="experiment_publication_identifiers", - referent_table="experiments", - local_cols=["experiment_id"], - remote_cols=["id"], - ) - op.create_foreign_key( - constraint_name="experiment_set_pub_identifiers_experiment_set_id_fkey", - source_table="experiment_set_publication_identifiers", - referent_table="experiment_sets", - local_cols=["experiment_set_id"], - remote_cols=["id"], - ) - op.create_foreign_key( - constraint_name="scoreset_pub_identifiers_scoreset_id_fkey", - source_table="scoreset_publication_identifiers", - referent_table="scoresets", - local_cols=["scoreset_id"], - remote_cols=["id"], - ) - - -def downgrade(): - op.drop_constraint( - constraint_name="experiment_pub_identifiers_publication_identifier_id_fkey", - table_name="experiment_publication_identifiers", - type_="foreignkey", - ) - op.drop_constraint( - constraint_name="experiment_set_pub_identifiers_publication_identifier_id_fkey", - table_name="experiment_set_publication_identifiers", - type_="foreignkey", - ) - op.drop_constraint( - constraint_name="scoreset_pub_identifiers_publication_identifier_id_fkey", - table_name="scoreset_publication_identifiers", - type_="foreignkey", - ) - op.drop_constraint( - constraint_name="experiment_pub_identifiers_experiment_id_fkey", - table_name="experiment_publication_identifiers", - type_="foreignkey", - ) - op.drop_constraint( - constraint_name="experiment_set_pub_identifiers_experiment_set_id_fkey", - table_name="experiment_set_publication_identifiers", - type_="foreignkey", - ) - op.drop_constraint( - constraint_name="scoreset_pub_identifiers_scoreset_id_fkey", - table_name="scoreset_publication_identifiers", - type_="foreignkey", - ) - - op.rename_table("publication_identifiers", "pubmed_identifiers") - - op.execute("ALTER SEQUENCE publication_identifiers_id_seq RENAME TO pubmed_identifiers_id_seq") - op.execute("ALTER INDEX publication_identifiers_pkey RENAME TO pubmed_identifiers_pkey") - op.execute("ALTER INDEX ix_publication_identifiers_id RENAME TO ix_pubmed_identifiers_id") - - op.rename_table("experiment_publication_identifiers", "experiment_pubmed_identifiers") - op.rename_table("experiment_set_publication_identifiers", "experiment_set_pubmed_identifiers") - op.rename_table("scoreset_publication_identifiers", "scoreset_pubmed_identifiers") - - op.alter_column( - "experiment_pubmed_identifiers", - "publication_identifier_id", - nullable=False, - new_column_name="pubmed_identifier_id", - ) - op.alter_column( - "experiment_set_pubmed_identifiers", - "publication_identifier_id", - nullable=False, - new_column_name="pubmed_identifier_id", - ) - op.alter_column( - "scoreset_pubmed_identifiers", - "publication_identifier_id", - nullable=False, - new_column_name="pubmed_identifier_id", - ) - - op.execute("ALTER INDEX experiment_publication_identifiers_pkey RENAME TO experiment_pubmed_identifiers_pkey") - op.execute( - "ALTER INDEX experiment_set_publication_identifiers_pkey RENAME TO experiment_set_pubmed_identifiers_pkey" - ) - op.execute("ALTER INDEX scoreset_publication_identifiers_pkey RENAME TO scoreset_pubmed_identifiers_pkey") - - op.create_foreign_key( - constraint_name="experiment_pubmed_identifiers_pubmed_identifier_id_fkey", - source_table="experiment_pubmed_identifiers", - referent_table="pubmed_identifiers", - local_cols=["pubmed_identifier_id"], - remote_cols=["id"], - ) - op.create_foreign_key( - constraint_name="experiment_set_pubmed_identifiers_pubmed_identifier_id_fkey", - source_table="experiment_set_pubmed_identifiers", - referent_table="pubmed_identifiers", - local_cols=["pubmed_identifier_id"], - remote_cols=["id"], - ) - op.create_foreign_key( - constraint_name="scoreset_pubmed_identifiers_pubmed_identifier_id_fkey", - source_table="scoreset_pubmed_identifiers", - referent_table="pubmed_identifiers", - local_cols=["pubmed_identifier_id"], - remote_cols=["id"], - ) - op.create_foreign_key( - constraint_name="experiment_pubmed_identifiers_experiment_id_fkey", - source_table="experiment_pubmed_identifiers", - referent_table="experiments", - local_cols=["experiment_id"], - remote_cols=["id"], - ) - op.create_foreign_key( - constraint_name="experiment_set_pubmed_identifiers_experiment_set_id_fkey", - source_table="experiment_set_pubmed_identifiers", - referent_table="experiment_sets", - local_cols=["experiment_set_id"], - remote_cols=["id"], - ) - op.create_foreign_key( - constraint_name="scoreset_pubmed_identifiers_scoreset_id_fkey", - source_table="scoreset_pubmed_identifiers", - referent_table="scoresets", - local_cols=["scoreset_id"], - remote_cols=["id"], - ) diff --git a/alembic/versions/60103ad1cb5b_add_target_sequence_label.py b/alembic/versions/60103ad1cb5b_add_target_sequence_label.py deleted file mode 100644 index b0c09e137..000000000 --- a/alembic/versions/60103ad1cb5b_add_target_sequence_label.py +++ /dev/null @@ -1,25 +0,0 @@ -"""Add Target Sequence Label - -Revision ID: 60103ad1cb5b -Revises: 194cfebabe32 -Create Date: 2023-08-29 16:04:44.620385 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "60103ad1cb5b" -down_revision = "194cfebabe32" -branch_labels = None -depends_on = None - - -def upgrade(): - op.add_column("target_sequences", sa.Column("label", sa.String(), nullable=True)) - - -def downgrade(): - op.drop_column("target_sequences", "label") diff --git a/alembic/versions/659999dec5d9_rename_calibration_publication_relation_.py b/alembic/versions/659999dec5d9_rename_calibration_publication_relation_.py deleted file mode 100644 index 70c6382d8..000000000 --- a/alembic/versions/659999dec5d9_rename_calibration_publication_relation_.py +++ /dev/null @@ -1,35 +0,0 @@ -"""rename calibration publication relation classification to evidence - -Revision ID: 659999dec5d9 -Revises: e1f2a3b4c5d6 -Create Date: 2026-02-23 00:00:00.000000 - -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "659999dec5d9" -down_revision = "e1f2a3b4c5d6" -branch_labels = None -depends_on = None - - -def upgrade(): - op.execute( - """ - UPDATE score_calibration_publication_identifiers - SET relation = 'evidence' - WHERE relation = 'classification' - """ - ) - - -def downgrade(): - op.execute( - """ - UPDATE score_calibration_publication_identifiers - SET relation = 'classification' - WHERE relation = 'evidence' - """ - ) diff --git a/alembic/versions/68a0ec57694e_add_active_column_to_licenses.py b/alembic/versions/68a0ec57694e_add_active_column_to_licenses.py deleted file mode 100644 index 3ced2b3b3..000000000 --- a/alembic/versions/68a0ec57694e_add_active_column_to_licenses.py +++ /dev/null @@ -1,29 +0,0 @@ -"""Add active column to licenses - -Revision ID: 68a0ec57694e -Revises: 03c7124c33e1 -Create Date: 2024-10-22 15:36:41.868909 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "68a0ec57694e" -down_revision = "03c7124c33e1" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column("licenses", sa.Column("active", sa.Boolean(), nullable=False, server_default=sa.true())) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column("licenses", "active") - # ### end Alembic commands ### diff --git a/alembic/versions/695b73abe581_genericize_clinvar_variants_table.py b/alembic/versions/695b73abe581_genericize_clinvar_variants_table.py deleted file mode 100644 index 29dfcbadc..000000000 --- a/alembic/versions/695b73abe581_genericize_clinvar_variants_table.py +++ /dev/null @@ -1,101 +0,0 @@ -"""genericize clinvar variants table - -Revision ID: 695b73abe581 -Revises: 34026092c7f8 -Create Date: 2025-02-18 11:54:15.243078 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "695b73abe581" -down_revision = "34026092c7f8" -branch_labels = None -depends_on = None - - -def upgrade(): - op.rename_table("clinvar_variants", "clinical_controls") - op.execute("ALTER SEQUENCE clinvar_variants_id_seq RENAME TO clinical_controls_id_seq") - op.execute("ALTER INDEX clinvar_variants_pkey RENAME TO clinical_controls_pkey") - - op.alter_column("clinical_controls", "clinvar_db_version", nullable=False, new_column_name="db_version") - op.alter_column("clinical_controls", "allele_id", nullable=False, new_column_name="db_identifier") - op.add_column("clinical_controls", sa.Column("db_name", sa.String(), nullable=True)) - - op.create_index("ix_clinical_controls_gene_symbol", "clinical_controls", ["gene_symbol"]) - op.create_index("ix_clinical_controls_db_name", "clinical_controls", ["db_name"]) - op.create_index("ix_clinical_controls_db_identifier", "clinical_controls", ["db_identifier"]) - op.create_index("ix_clinical_controls_db_version", "clinical_controls", ["db_version"]) - - op.create_table( - "mapped_variants_clinical_controls", - sa.Column("mapped_variant_id", sa.Integer(), nullable=False), - sa.Column("clinical_control_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["mapped_variant_id"], - ["mapped_variants.id"], - ), - sa.ForeignKeyConstraint( - ["clinical_control_id"], - ["clinical_controls.id"], - ), - sa.PrimaryKeyConstraint("mapped_variant_id", "clinical_control_id"), - ) - - # Convert any existing ClinVar variants into clinical control variants. Since - # this table is being update from a clinvar specific table, we assume all existing - # controls are from ClinVar. - op.execute( - """ - INSERT INTO mapped_variants_clinical_controls ( - mapped_variant_id, - clinical_control_id - ) - SELECT id, clinvar_variant_id - FROM mapped_variants - WHERE clinvar_variant_id IS NOT NULL - """ - ) - - op.execute("UPDATE clinical_controls SET db_name='ClinVar'") - op.alter_column("clinical_controls", "db_name", nullable=False) - - op.drop_index("ix_mapped_variants_clinvar_variant_id", "mapped_variants") - op.drop_column("mapped_variants", "clinvar_variant_id") - - -def downgrade(): - op.rename_table("clinical_controls", "clinvar_variants") - op.execute("ALTER SEQUENCE clinical_controls_id_seq RENAME TO clinvar_variants_id_seq") - op.execute("ALTER INDEX clinical_controls_pkey RENAME TO clinvar_variants_pkey") - - op.drop_index("ix_clinical_controls_gene_symbol", "clinical_controls") - op.drop_index("ix_clinical_controls_db_name", "clinical_controls") - op.drop_index("ix_clinical_controls_db_identifier", "clinical_controls") - op.drop_index("ix_clinical_controls_db_version", "clinical_controls") - - op.alter_column("clinvar_variants", "db_version", nullable=False, new_column_name="clinvar_db_version") - op.alter_column("clinvar_variants", "db_identifier", nullable=False, new_column_name="allele_id") - op.drop_column("clinvar_variants", "db_name") - - op.add_column( - "mapped_variants", - sa.Column("clinvar_variant_id", sa.Integer(), sa.ForeignKey("clinvar_variants.id"), nullable=True), - ) - - # Downgrades a many-to-many relationship to a one to many. This will result in data loss. - op.execute( - """ - UPDATE mapped_variants - SET clinvar_variant_id=mapped_variants_clinical_controls.clinical_control_id - FROM mapped_variants_clinical_controls - WHERE mapped_variants_clinical_controls.mapped_variant_id=mapped_variants.id - """ - ) - - op.create_index("ix_mapped_variants_clinvar_variant_id", "mapped_variants", ["clinvar_variant_id"]) - op.drop_table("mapped_variants_clinical_controls") diff --git a/alembic/versions/6987f253e02a_store_access_keys_as_hashes.py b/alembic/versions/6987f253e02a_store_access_keys_as_hashes.py new file mode 100644 index 000000000..c3fa02f48 --- /dev/null +++ b/alembic/versions/6987f253e02a_store_access_keys_as_hashes.py @@ -0,0 +1,40 @@ +"""store access keys as hashes + +Revision ID: 6987f253e02a +Revises: d7a3e9c1f5b2 +Create Date: 2026-10-21 + +Replaces each ``access_keys.key_id`` with the hex SHA-256 of the key, and adds ``key_hint``, the key's +last four characters, so listings can tell keys apart. Authentication hashes the presented key and looks +it up by hash, so existing keys keep working. Keys are long and random, so an unsalted SHA-256 suffices. + +The hint can only be taken from the key before it is hashed, so this migration fills it. + +Can't be downgraded: the original keys can't be recovered from their hashes. Roll back with a database +snapshot. +""" + +import sqlalchemy as sa + +from alembic import op + +# revision identifiers, used by Alembic. +revision = "6987f253e02a" +down_revision = "d7a3e9c1f5b2" +branch_labels = None +depends_on = None + +# One statement, so the hint is read from the key before it is hashed. The unique index on key_id carries +# over: distinct keys have distinct hashes. tests/lib/test_authentication.py runs this against a stored key. +HASH_ACCESS_KEYS = ( + "UPDATE access_keys SET key_hint = right(key_id, 4), key_id = encode(sha256(convert_to(key_id, 'UTF8')), 'hex')" +) + + +def upgrade() -> None: + op.add_column("access_keys", sa.Column("key_hint", sa.String(), nullable=True)) + op.execute(HASH_ACCESS_KEYS) + + +def downgrade() -> None: + raise NotImplementedError("Access keys can't be restored from their hashes. Restore from a snapshot instead.") diff --git a/alembic/versions/6fae83d65ee4_taxonomy.py b/alembic/versions/6fae83d65ee4_taxonomy.py deleted file mode 100644 index 9c03f314c..000000000 --- a/alembic/versions/6fae83d65ee4_taxonomy.py +++ /dev/null @@ -1,79 +0,0 @@ -"""taxonomy - -Revision ID: 6fae83d65ee4 -Revises: fecb3e0d181d -Create Date: 2023-12-21 18:06:18.912925 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "6fae83d65ee4" -down_revision = "fecb3e0d181d" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "taxonomies", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("tax_id", sa.Integer(), nullable=False), - sa.Column("organism_name", sa.String(), nullable=True), - sa.Column("common_name", sa.String(), nullable=True), - sa.Column("rank", sa.String(), nullable=True), - sa.Column("has_described_species_name", sa.Boolean(), nullable=True), - sa.Column("url", sa.String(), nullable=False), - sa.Column("article_reference", sa.String(), nullable=True), - sa.Column("genome_identifier_id", sa.Integer(), nullable=True), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.ForeignKeyConstraint( - ["genome_identifier_id"], - ["genome_identifiers.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_taxonomies_id"), "taxonomies", ["id"], unique=False) - op.add_column("target_sequences", sa.Column("taxonomy_id", sa.Integer(), nullable=True)) - op.drop_constraint("wild_type_sequences_reference_id_fkey", "target_sequences", type_="foreignkey") - op.create_foreign_key( - "target_sequence_taxonomy_id_foreign_key_constraint", "target_sequences", "taxonomies", ["taxonomy_id"], ["id"] - ) - op.drop_column("target_sequences", "reference_id") - op.drop_index("ix_reference_genomes_id", table_name="reference_genomes") - op.drop_table("reference_genomes") - ## end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "reference_genomes", - sa.Column("id", sa.INTEGER(), autoincrement=True, nullable=False), - sa.Column("short_name", sa.VARCHAR(), autoincrement=False, nullable=False), - sa.Column("organism_name", sa.VARCHAR(), autoincrement=False, nullable=False), - sa.Column("genome_identifier_id", sa.INTEGER(), autoincrement=False, nullable=True), - sa.Column("creation_date", sa.DATE(), autoincrement=False, nullable=False), - sa.Column("modification_date", sa.DATE(), autoincrement=False, nullable=False), - sa.ForeignKeyConstraint( - ["genome_identifier_id"], ["genome_identifiers.id"], name="reference_genomes_genome_identifier_id_fkey" - ), - sa.PrimaryKeyConstraint("id", name="reference_genomes_pkey"), - ) - - op.add_column("target_sequences", sa.Column("reference_id", sa.INTEGER(), autoincrement=False, nullable=True)) - op.drop_constraint("target_sequence_taxonomy_id_foreign_key_constraint", "target_sequences", type_="foreignkey") - op.create_foreign_key( - "wild_type_sequences_reference_id_fkey", "target_sequences", "reference_genomes", ["reference_id"], ["id"] - ) - op.drop_column("target_sequences", "taxonomy_id") - - op.create_index("ix_reference_genomes_id", "reference_genomes", ["id"], unique=False) - op.drop_index(op.f("ix_taxonomies_id"), table_name="taxonomies") - op.drop_table("taxonomies") - # ### end Alembic commands ### diff --git a/alembic/versions/76e1e55bc5c1_add_contributors.py b/alembic/versions/76e1e55bc5c1_add_contributors.py deleted file mode 100644 index d4feed832..000000000 --- a/alembic/versions/76e1e55bc5c1_add_contributors.py +++ /dev/null @@ -1,79 +0,0 @@ -"""Add contributors - -Revision ID: 76e1e55bc5c1 -Revises: 9702d32bacb3 -Create Date: 2024-08-22 06:17:03.265438 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "76e1e55bc5c1" -down_revision = "9702d32bacb3" -branch_labels = None -depends_on = None - - -def upgrade(): - op.create_table( - "contributors", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("orcid_id", sa.String(), nullable=False), - sa.Column("given_name", sa.String(), nullable=True), - sa.Column("family_name", sa.String(), nullable=True), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_contributors_orcid_id"), "contributors", ["orcid_id"], unique=False) - op.create_table( - "experiment_set_contributors", - sa.Column("experiment_set_id", sa.Integer(), nullable=False), - sa.Column("contributor_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["contributor_id"], - ["contributors.id"], - ), - sa.ForeignKeyConstraint( - ["experiment_set_id"], - ["experiment_sets.id"], - ), - sa.PrimaryKeyConstraint("experiment_set_id", "contributor_id"), - ) - op.create_table( - "experiment_contributors", - sa.Column("experiment_id", sa.Integer(), nullable=False), - sa.Column("contributor_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["contributor_id"], - ["contributors.id"], - ), - sa.ForeignKeyConstraint( - ["experiment_id"], - ["experiments.id"], - ), - sa.PrimaryKeyConstraint("experiment_id", "contributor_id"), - ) - op.create_table( - "scoreset_contributors", - sa.Column("scoreset_id", sa.Integer(), nullable=False), - sa.Column("contributor_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["contributor_id"], - ["contributors.id"], - ), - sa.ForeignKeyConstraint( - ["scoreset_id"], - ["scoresets.id"], - ), - sa.PrimaryKeyConstraint("scoreset_id", "contributor_id"), - ) - - -def downgrade(): - op.drop_table("scoreset_contributors") - op.drop_table("experiment_contributors") - op.drop_table("experiment_set_contributors") - op.drop_index(op.f("ix_contributors_orcid_id"), table_name="contributors") - op.drop_table("contributors") diff --git a/alembic/versions/79b28316dd0c_add_gnomad_variants_table.py b/alembic/versions/79b28316dd0c_add_gnomad_variants_table.py deleted file mode 100644 index 7372ec8e8..000000000 --- a/alembic/versions/79b28316dd0c_add_gnomad_variants_table.py +++ /dev/null @@ -1,45 +0,0 @@ -"""add gnomad variants table - -Revision ID: 79b28316dd0c -Revises: 4b9fb51a460d -Create Date: 2025-06-17 08:38:51.954238 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "79b28316dd0c" -down_revision = "4b9fb51a460d" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "gnomad_variants", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("db_name", sa.String(), nullable=False), - sa.Column("db_identifier", sa.String(), nullable=False), - sa.Column("db_version", sa.String(), nullable=False), - sa.Column("allele_count", sa.Integer(), nullable=False), - sa.Column("allele_number", sa.Integer(), nullable=False), - sa.Column("allele_frequency", sa.Float(), nullable=False), - sa.Column("faf95_max", sa.Float(), nullable=False), - sa.Column("faf95_max_ancestry", sa.String(), nullable=False), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_gnomad_variants_db_identifier"), "gnomad_variants", ["db_identifier"], unique=False) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f("ix_gnomad_variants_db_identifier"), table_name="gnomad_variants") - op.drop_table("gnomad_variants") - # ### end Alembic commands ### diff --git a/alembic/versions/7a345f1bf9c3_unify_publication_identifier_date_fields.py b/alembic/versions/7a345f1bf9c3_unify_publication_identifier_date_fields.py deleted file mode 100644 index 40437e321..000000000 --- a/alembic/versions/7a345f1bf9c3_unify_publication_identifier_date_fields.py +++ /dev/null @@ -1,34 +0,0 @@ -"""Unify publication identifier date fields - -Revision ID: 7a345f1bf9c3 -Revises: 2c8d7e2bf2fe -Create Date: 2024-05-17 16:09:39.508434 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "7a345f1bf9c3" -down_revision = "2c8d7e2bf2fe" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.execute( - "UPDATE publication_identifiers SET publication_year = date_part('year', preprint_date) WHERE publication_journal = 'Preprint';" - ) - op.drop_column("publication_identifiers", "preprint_date") - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column("publication_identifiers", sa.Column("preprint_date", sa.DATE(), autoincrement=False, nullable=True)) - # TODO: There isn't a great way to re-populate this column. - - # ### end Alembic commands ### diff --git a/alembic/versions/886e059ad1a8_score_set_processing_errors.py b/alembic/versions/886e059ad1a8_score_set_processing_errors.py deleted file mode 100644 index dcb143613..000000000 --- a/alembic/versions/886e059ad1a8_score_set_processing_errors.py +++ /dev/null @@ -1,30 +0,0 @@ -"""score set processing errors - -Revision ID: 886e059ad1a8 -Revises: fecb3e0d181d -Create Date: 2024-03-19 16:28:05.797406 - -""" - -import sqlalchemy as sa -from sqlalchemy.dialects.postgresql import JSONB - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "886e059ad1a8" -down_revision = "fecb3e0d181d" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column("scoresets", sa.Column("processing_errors", JSONB, nullable=True)) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column("scoresets", "processing_errors") - # ### end Alembic commands ### diff --git a/alembic/versions/8bcb2b4edc60_add_foreign_key_indices.py b/alembic/versions/8bcb2b4edc60_add_foreign_key_indices.py deleted file mode 100644 index 0dffa1209..000000000 --- a/alembic/versions/8bcb2b4edc60_add_foreign_key_indices.py +++ /dev/null @@ -1,93 +0,0 @@ -"""Add foreign key indices - -Revision ID: 8bcb2b4edc60 -Revises: 8e26f1a1160d -Create Date: 2024-05-14 22:36:47.095490 - -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "8bcb2b4edc60" -down_revision = "8e26f1a1160d" -branch_labels = None -depends_on = None - - -def upgrade(): - op.create_index(op.f("ix_access_keys_user_id"), "access_keys", ["user_id"], unique=False) - op.drop_index("ix_doi_identifiers_id", table_name="doi_identifiers") - op.drop_index("ix_ensembl_identifiers_id", table_name="ensembl_identifiers") - op.drop_index("ix_experiment_sets_id", table_name="experiment_sets") - op.create_index(op.f("ix_experiment_sets_created_by_id"), "experiment_sets", ["created_by_id"], unique=False) - op.create_index(op.f("ix_experiment_sets_modified_by_id"), "experiment_sets", ["modified_by_id"], unique=False) - op.drop_index("ix_experiments_id", table_name="experiments") - op.create_index(op.f("ix_experiments_created_by_id"), "experiments", ["created_by_id"], unique=False) - op.create_index(op.f("ix_experiments_experiment_set_id"), "experiments", ["experiment_set_id"], unique=False) - op.create_index(op.f("ix_experiments_modified_by_id"), "experiments", ["modified_by_id"], unique=False) - op.drop_index("ix_genome_identifiers_id", table_name="genome_identifiers") - op.drop_index("ix_keywords_id", table_name="keywords") - op.drop_index("ix_licenses_id", table_name="licenses") - op.drop_index("ix_mapped_variants_id", table_name="mapped_variants") - op.create_index(op.f("ix_mapped_variants_variant_id"), "mapped_variants", ["variant_id"], unique=False) - op.drop_index("ix_publication_identifiers_id", table_name="publication_identifiers") - op.drop_index("ix_refseq_identifiers_id", table_name="refseq_identifiers") - op.drop_index("ix_roles_name", table_name="roles") - op.drop_index("ix_scoresets_id", table_name="scoresets") - op.create_index(op.f("ix_scoresets_created_by_id"), "scoresets", ["created_by_id"], unique=False) - op.create_index(op.f("ix_scoresets_experiment_id"), "scoresets", ["experiment_id"], unique=False) - op.create_index(op.f("ix_scoresets_licence_id"), "scoresets", ["licence_id"], unique=False) - op.create_index(op.f("ix_scoresets_modified_by_id"), "scoresets", ["modified_by_id"], unique=False) - op.create_index(op.f("ix_scoresets_replaces_id"), "scoresets", ["replaces_id"], unique=False) - op.drop_index("ix_sra_identifiers_id", table_name="sra_identifiers") - op.drop_index("ix_target_genes_id", table_name="target_genes") - op.create_index(op.f("ix_target_genes_accession_id"), "target_genes", ["accession_id"], unique=False) - op.create_index(op.f("ix_target_genes_scoreset_id"), "target_genes", ["scoreset_id"], unique=False) - op.create_index(op.f("ix_target_genes_target_sequence_id"), "target_genes", ["target_sequence_id"], unique=False) - op.drop_index("ix_target_sequences_id", table_name="target_sequences") - op.create_index(op.f("ix_target_sequences_taxonomy_id"), "target_sequences", ["taxonomy_id"], unique=False) - op.drop_index("ix_taxonomies_id", table_name="taxonomies") - op.create_index(op.f("ix_taxonomies_genome_identifier_id"), "taxonomies", ["genome_identifier_id"], unique=False) - op.drop_index("ix_uniprot_identifiers_id", table_name="uniprot_identifiers") - op.drop_index("ix_variants_id", table_name="variants") - op.create_index(op.f("ix_variants_scoreset_id"), "variants", ["scoreset_id"], unique=False) - - -def downgrade(): - op.drop_index(op.f("ix_variants_scoreset_id"), table_name="variants") - op.create_index("ix_variants_id", "variants", ["id"], unique=False) - op.create_index("ix_uniprot_identifiers_id", "uniprot_identifiers", ["id"], unique=False) - op.drop_index(op.f("ix_taxonomies_genome_identifier_id"), table_name="taxonomies") - op.create_index("ix_taxonomies_id", "taxonomies", ["id"], unique=False) - op.drop_index(op.f("ix_target_sequences_taxonomy_id"), table_name="target_sequences") - op.create_index("ix_target_sequences_id", "target_sequences", ["id"], unique=False) - op.drop_index(op.f("ix_target_genes_target_sequence_id"), table_name="target_genes") - op.drop_index(op.f("ix_target_genes_scoreset_id"), table_name="target_genes") - op.drop_index(op.f("ix_target_genes_accession_id"), table_name="target_genes") - op.create_index("ix_target_genes_id", "target_genes", ["id"], unique=False) - op.create_index("ix_sra_identifiers_id", "sra_identifiers", ["id"], unique=False) - op.drop_index(op.f("ix_scoresets_replaces_id"), table_name="scoresets") - op.drop_index(op.f("ix_scoresets_modified_by_id"), table_name="scoresets") - op.drop_index(op.f("ix_scoresets_licence_id"), table_name="scoresets") - op.drop_index(op.f("ix_scoresets_experiment_id"), table_name="scoresets") - op.drop_index(op.f("ix_scoresets_created_by_id"), table_name="scoresets") - op.create_index("ix_scoresets_id", "scoresets", ["id"], unique=False) - op.create_index("ix_roles_name", "roles", ["name"], unique=False) - op.create_index("ix_refseq_identifiers_id", "refseq_identifiers", ["id"], unique=False) - op.create_index("ix_publication_identifiers_id", "publication_identifiers", ["id"], unique=False) - op.drop_index(op.f("ix_mapped_variants_variant_id"), table_name="mapped_variants") - op.create_index("ix_mapped_variants_id", "mapped_variants", ["id"], unique=False) - op.create_index("ix_licenses_id", "licenses", ["id"], unique=False) - op.create_index("ix_keywords_id", "keywords", ["id"], unique=False) - op.create_index("ix_genome_identifiers_id", "genome_identifiers", ["id"], unique=False) - op.drop_index(op.f("ix_experiments_modified_by_id"), table_name="experiments") - op.drop_index(op.f("ix_experiments_experiment_set_id"), table_name="experiments") - op.drop_index(op.f("ix_experiments_created_by_id"), table_name="experiments") - op.create_index("ix_experiments_id", "experiments", ["id"], unique=False) - op.drop_index(op.f("ix_experiment_sets_modified_by_id"), table_name="experiment_sets") - op.drop_index(op.f("ix_experiment_sets_created_by_id"), table_name="experiment_sets") - op.create_index("ix_experiment_sets_id", "experiment_sets", ["id"], unique=False) - op.create_index("ix_ensembl_identifiers_id", "ensembl_identifiers", ["id"], unique=False) - op.create_index("ix_doi_identifiers_id", "doi_identifiers", ["id"], unique=False) - op.drop_index(op.f("ix_access_keys_user_id"), table_name="access_keys") diff --git a/alembic/versions/8c4a2f1d9e6b_target_gene_mappings_and_score_annotation_columns.py b/alembic/versions/8c4a2f1d9e6b_target_gene_mappings_and_score_annotation_columns.py deleted file mode 100644 index 74d09dc9b..000000000 --- a/alembic/versions/8c4a2f1d9e6b_target_gene_mappings_and_score_annotation_columns.py +++ /dev/null @@ -1,131 +0,0 @@ -"""target_gene_mappings table and ScoreAnnotation columns on mapped_variants - -Revision ID: 8c4a2f1d9e6b -Revises: f2a1b3c4d5e6 -Create Date: 2026-04-28 - -Adds the ``target_gene_mappings`` table (per-(target gene, alignment level) -provenance and QC produced by the dcd-mapping QC API) and extends -``mapped_variants`` with the new ``ScoreAnnotation`` columns: - -* ``target_gene_mapping_id`` -- FK to the QC record for this mapping (the - resolved target gene is reachable via this relationship) -* ``alignment_level`` -- ``p`` / ``c`` / ``g`` -* ``at_mismatched_locus`` / ``near_gap`` -- per-variant QC flags - -The new columns are nullable because variants whose mapping fails before an -alignment is selected cannot be attributed to a specific target/layer. - -Backfill of existing rows is performed by the standalone manual migration -``alembic/manual_migrations/migrate_target_gene_mapping_qc.py`` (it walks all -mapped variants and infers the (target_gene, alignment_level) tuple from the -HGVS strings). -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "8c4a2f1d9e6b" -down_revision = "f2a1b3c4d5e6" -branch_labels = None -depends_on = None - - -VALID_ALIGNMENT_LEVELS = "('protein', 'cdna', 'genomic')" - - -def upgrade() -> None: - op.create_table( - "target_gene_mappings", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("target_gene_id", sa.Integer(), nullable=False), - sa.Column("alignment_level", sa.String(length=16), nullable=False), - sa.Column("preferred", sa.Boolean(), nullable=False, server_default=sa.false()), - sa.Column("reference_assembly", sa.String(), nullable=True), - sa.Column("reference_accession", sa.String(), nullable=True), - sa.Column("reference_sequence_id", sa.String(), nullable=True), - sa.Column("alignment_score", sa.Float(), nullable=True), - sa.Column("next_best_alignment_score", sa.Float(), nullable=True), - sa.Column("alignment_length", sa.Integer(), nullable=True), - sa.Column("alignment_string", sa.String(), nullable=True), - sa.Column("mismatch_count", sa.Integer(), nullable=True), - sa.Column("gap_count", sa.Integer(), nullable=True), - sa.Column("percent_identity", sa.Float(), nullable=True), - sa.Column("total_variants", sa.Integer(), nullable=True), - sa.Column("variants_failed", sa.Integer(), nullable=True), - sa.Column("variants_with_alignment_warnings", sa.Integer(), nullable=True), - sa.Column("variants_mapped_cleanly", sa.Integer(), nullable=True), - sa.Column("tool_name", sa.String(), nullable=False, server_default="dcd-mapping"), - sa.Column("tool_version", sa.String(), nullable=False), - sa.Column("tool_parameters", sa.dialects.postgresql.JSONB(), nullable=True), - sa.Column("alignment_metadata", sa.dialects.postgresql.JSONB(), nullable=True), - sa.Column("vrs_version", sa.String(), nullable=True), - sa.Column("mapped_date", sa.Date(), nullable=True), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.ForeignKeyConstraint(["target_gene_id"], ["target_genes.id"]), - sa.PrimaryKeyConstraint("id"), - sa.CheckConstraint( - f"alignment_level IN {VALID_ALIGNMENT_LEVELS}", - name="ck_target_gene_mappings_alignment_level_valid", - ), - ) - op.create_index( - "ix_target_gene_mappings_target_gene_id", - "target_gene_mappings", - ["target_gene_id"], - ) - op.create_index( - "ix_target_gene_mappings_target_alignment", - "target_gene_mappings", - ["target_gene_id", "alignment_level"], - ) - - op.add_column( - "mapped_variants", - sa.Column("target_gene_mapping_id", sa.Integer(), nullable=True), - ) - op.add_column( - "mapped_variants", - sa.Column("alignment_level", sa.String(length=16), nullable=True), - ) - op.add_column("mapped_variants", sa.Column("at_mismatched_locus", sa.Boolean(), nullable=True)) - op.add_column("mapped_variants", sa.Column("near_gap", sa.Boolean(), nullable=True)) - - op.create_foreign_key( - "fk_mapped_variants_target_gene_mapping_id", - "mapped_variants", - "target_gene_mappings", - ["target_gene_mapping_id"], - ["id"], - ) - op.create_index( - "ix_mapped_variants_target_gene_mapping_id", - "mapped_variants", - ["target_gene_mapping_id"], - ) - op.create_check_constraint( - "ck_mapped_variants_alignment_level_valid", - "mapped_variants", - f"alignment_level IS NULL OR alignment_level IN {VALID_ALIGNMENT_LEVELS}", - ) - - -def downgrade() -> None: - op.drop_constraint( - "ck_mapped_variants_alignment_level_valid", - "mapped_variants", - type_="check", - ) - op.drop_index("ix_mapped_variants_target_gene_mapping_id", table_name="mapped_variants") - op.drop_constraint("fk_mapped_variants_target_gene_mapping_id", "mapped_variants", type_="foreignkey") - op.drop_column("mapped_variants", "near_gap") - op.drop_column("mapped_variants", "at_mismatched_locus") - op.drop_column("mapped_variants", "alignment_level") - op.drop_column("mapped_variants", "target_gene_mapping_id") - - op.drop_index("ix_target_gene_mappings_target_alignment", table_name="target_gene_mappings") - op.drop_index("ix_target_gene_mappings_target_gene_id", table_name="target_gene_mappings") - op.drop_table("target_gene_mappings") diff --git a/alembic/versions/8de33cc35cd7_add_pipeline_and_job_tracking_tables.py b/alembic/versions/8de33cc35cd7_add_pipeline_and_job_tracking_tables.py deleted file mode 100644 index 9530868cc..000000000 --- a/alembic/versions/8de33cc35cd7_add_pipeline_and_job_tracking_tables.py +++ /dev/null @@ -1,222 +0,0 @@ -"""add pipeline and job tracking tables - -Revision ID: 8de33cc35cd7 -Revises: 659999dec5d9 -Create Date: 2026-01-28 10:08:36.906494 - -""" - -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "8de33cc35cd7" -down_revision = "659999dec5d9" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "pipelines", - sa.Column("id", sa.Integer(), autoincrement=True, nullable=False), - sa.Column("urn", sa.String(length=255), nullable=True), - sa.Column("name", sa.String(length=500), nullable=False), - sa.Column("description", sa.Text(), nullable=True), - sa.Column("status", sa.String(length=50), nullable=False), - sa.Column("correlation_id", sa.String(length=255), nullable=True), - sa.Column( - "metadata", - postgresql.JSONB(astext_type=sa.Text()), - server_default="{}", - nullable=False, - comment="Flexible metadata storage for pipeline-specific data", - ), - sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False), - sa.Column("started_at", sa.DateTime(timezone=True), nullable=True), - sa.Column("finished_at", sa.DateTime(timezone=True), nullable=True), - sa.Column("created_by_user_id", sa.Integer(), nullable=True), - sa.Column("mavedb_version", sa.String(length=50), nullable=True), - sa.CheckConstraint( - "status IN ('created', 'running', 'succeeded', 'failed', 'cancelled', 'paused', 'partial')", - name="ck_pipelines_status_valid", - ), - sa.ForeignKeyConstraint(["created_by_user_id"], ["users.id"], ondelete="SET NULL"), - sa.PrimaryKeyConstraint("id"), - sa.UniqueConstraint("urn"), - ) - op.create_index("ix_pipelines_correlation_id", "pipelines", ["correlation_id"], unique=False) - op.create_index("ix_pipelines_created_at", "pipelines", ["created_at"], unique=False) - op.create_index("ix_pipelines_created_by_user_id", "pipelines", ["created_by_user_id"], unique=False) - op.create_index("ix_pipelines_status", "pipelines", ["status"], unique=False) - op.create_table( - "job_runs", - sa.Column("id", sa.Integer(), autoincrement=True, nullable=False), - sa.Column("urn", sa.String(length=255), nullable=True), - sa.Column("job_type", sa.String(length=100), nullable=False), - sa.Column("job_function", sa.String(length=255), nullable=False), - sa.Column("job_params", postgresql.JSONB(astext_type=sa.Text()), nullable=True), - sa.Column("status", sa.String(length=50), nullable=False), - sa.Column("pipeline_id", sa.Integer(), nullable=True), - sa.Column("priority", sa.Integer(), nullable=False), - sa.Column("max_retries", sa.Integer(), nullable=False), - sa.Column("retry_count", sa.Integer(), nullable=False), - sa.Column("retry_delay_seconds", sa.Integer(), nullable=True), - sa.Column("scheduled_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False), - sa.Column("started_at", sa.DateTime(timezone=True), nullable=True), - sa.Column("finished_at", sa.DateTime(timezone=True), nullable=True), - sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False), - sa.Column("error_message", sa.Text(), nullable=True), - sa.Column("error_traceback", sa.Text(), nullable=True), - sa.Column("failure_category", sa.String(length=100), nullable=True), - sa.Column("progress_current", sa.Integer(), nullable=True), - sa.Column("progress_total", sa.Integer(), nullable=True), - sa.Column("progress_message", sa.String(length=500), nullable=True), - sa.Column("correlation_id", sa.String(length=255), nullable=True), - sa.Column("metadata", postgresql.JSONB(astext_type=sa.Text()), server_default="{}", nullable=False), - sa.Column("mavedb_version", sa.String(length=50), nullable=True), - sa.CheckConstraint( - "status IN ('pending', 'queued', 'running', 'succeeded', 'failed', 'errored', 'cancelled', 'skipped')", - name="ck_job_runs_status_valid", - ), - sa.CheckConstraint("max_retries >= 0", name="ck_job_runs_max_retries_positive"), - sa.CheckConstraint("priority >= 0", name="ck_job_runs_priority_positive"), - sa.CheckConstraint("retry_count >= 0", name="ck_job_runs_retry_count_positive"), - sa.ForeignKeyConstraint(["pipeline_id"], ["pipelines.id"], ondelete="SET NULL"), - sa.PrimaryKeyConstraint("id"), - sa.UniqueConstraint("urn"), - ) - op.create_index("ix_job_runs_correlation_id", "job_runs", ["correlation_id"], unique=False) - op.create_index("ix_job_runs_created_at", "job_runs", ["created_at"], unique=False) - op.create_index("ix_job_runs_job_type", "job_runs", ["job_type"], unique=False) - op.create_index("ix_job_runs_pipeline_id", "job_runs", ["pipeline_id"], unique=False) - op.create_index("ix_job_runs_scheduled_at", "job_runs", ["scheduled_at"], unique=False) - op.create_index("ix_job_runs_status", "job_runs", ["status"], unique=False) - op.create_index("ix_job_runs_status_scheduled", "job_runs", ["status", "scheduled_at"], unique=False) - op.create_table( - "job_dependencies", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("depends_on_job_id", sa.Integer(), nullable=False), - sa.Column("dependency_type", sa.String(length=50), nullable=False), - sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False), - sa.Column("metadata", postgresql.JSONB(astext_type=sa.Text()), nullable=True), - sa.CheckConstraint( - "dependency_type IS NULL OR dependency_type IN ('success_required', 'completion_required')", - name="ck_job_dependencies_type_valid", - ), - sa.ForeignKeyConstraint(["depends_on_job_id"], ["job_runs.id"], ondelete="CASCADE"), - sa.ForeignKeyConstraint(["id"], ["job_runs.id"], ondelete="CASCADE"), - sa.PrimaryKeyConstraint("id", "depends_on_job_id"), - ) - op.create_index("ix_job_dependencies_created_at", "job_dependencies", ["created_at"], unique=False) - op.create_index("ix_job_dependencies_depends_on_job_id", "job_dependencies", ["depends_on_job_id"], unique=False) - op.create_table( - "variant_annotation_status", - sa.Column("id", sa.Integer(), autoincrement=True, nullable=False), - sa.Column("variant_id", sa.Integer(), nullable=False), - sa.Column( - "annotation_type", - sa.String(length=50), - nullable=False, - comment="Type of annotation: vrs, clinvar, gnomad, etc.", - ), - sa.Column( - "version", - sa.String(length=50), - nullable=True, - comment="Version of the annotation source used (if applicable)", - ), - sa.Column("status", sa.String(length=50), nullable=False, comment="success, failed, skipped, pending"), - sa.Column("error_message", sa.Text(), nullable=True), - sa.Column("failure_category", sa.String(length=100), nullable=True), - sa.Column( - "success_data", - postgresql.JSONB(astext_type=sa.Text()), - nullable=True, - comment="Annotation results when successful", - ), - sa.Column( - "current", - sa.Boolean(), - server_default="true", - nullable=False, - comment="Whether this is the current status for the variant and annotation type", - ), - sa.Column("job_run_id", sa.Integer(), nullable=True), - sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False), - sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False), - sa.CheckConstraint( - "annotation_type IN ('vrs_mapping', 'clingen_allele_id', 'mapped_hgvs', 'variant_translation', 'gnomad_allele_frequency', 'clinvar_control', 'vep_functional_consequence', 'ldh_submission')", - name="ck_variant_annotation_type_valid", - ), - sa.CheckConstraint("status IN ('success', 'failed', 'skipped')", name="ck_variant_annotation_status_valid"), - sa.ForeignKeyConstraint(["job_run_id"], ["job_runs.id"], ondelete="SET NULL"), - sa.ForeignKeyConstraint(["variant_id"], ["variants.id"], ondelete="CASCADE"), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index( - "ix_variant_annotation_status_annotation_type", "variant_annotation_status", ["annotation_type"], unique=False - ) - op.create_index( - "ix_variant_annotation_status_created_at", "variant_annotation_status", ["created_at"], unique=False - ) - op.create_index("ix_variant_annotation_status_current", "variant_annotation_status", ["current"], unique=False) - op.create_index( - "ix_variant_annotation_status_job_run_id", "variant_annotation_status", ["job_run_id"], unique=False - ) - op.create_index("ix_variant_annotation_status_status", "variant_annotation_status", ["status"], unique=False) - op.create_index( - "ix_variant_annotation_status_variant_id", "variant_annotation_status", ["variant_id"], unique=False - ) - op.create_index( - "ix_variant_annotation_status_variant_type_version_current", - "variant_annotation_status", - ["variant_id", "annotation_type", "version", "current"], - unique=False, - ) - op.create_index("ix_variant_annotation_status_version", "variant_annotation_status", ["version"], unique=False) - op.create_index( - "ix_variant_annotation_type_status", "variant_annotation_status", ["annotation_type", "status"], unique=False - ) - op.create_index( - "ix_variant_annotation_variant_type_status", - "variant_annotation_status", - ["variant_id", "annotation_type", "status"], - unique=False, - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index("ix_variant_annotation_variant_type_status", table_name="variant_annotation_status") - op.drop_index("ix_variant_annotation_type_status", table_name="variant_annotation_status") - op.drop_index("ix_variant_annotation_status_version", table_name="variant_annotation_status") - op.drop_index("ix_variant_annotation_status_variant_type_version_current", table_name="variant_annotation_status") - op.drop_index("ix_variant_annotation_status_variant_id", table_name="variant_annotation_status") - op.drop_index("ix_variant_annotation_status_status", table_name="variant_annotation_status") - op.drop_index("ix_variant_annotation_status_job_run_id", table_name="variant_annotation_status") - op.drop_index("ix_variant_annotation_status_current", table_name="variant_annotation_status") - op.drop_index("ix_variant_annotation_status_created_at", table_name="variant_annotation_status") - op.drop_index("ix_variant_annotation_status_annotation_type", table_name="variant_annotation_status") - op.drop_table("variant_annotation_status") - op.drop_index("ix_job_dependencies_depends_on_job_id", table_name="job_dependencies") - op.drop_index("ix_job_dependencies_created_at", table_name="job_dependencies") - op.drop_table("job_dependencies") - op.drop_index("ix_job_runs_status_scheduled", table_name="job_runs") - op.drop_index("ix_job_runs_status", table_name="job_runs") - op.drop_index("ix_job_runs_scheduled_at", table_name="job_runs") - op.drop_index("ix_job_runs_pipeline_id", table_name="job_runs") - op.drop_index("ix_job_runs_job_type", table_name="job_runs") - op.drop_index("ix_job_runs_created_at", table_name="job_runs") - op.drop_index("ix_job_runs_correlation_id", table_name="job_runs") - op.drop_table("job_runs") - op.drop_index("ix_pipelines_status", table_name="pipelines") - op.drop_index("ix_pipelines_created_by_user_id", table_name="pipelines") - op.drop_index("ix_pipelines_created_at", table_name="pipelines") - op.drop_index("ix_pipelines_correlation_id", table_name="pipelines") - op.drop_table("pipelines") - # ### end Alembic commands ### diff --git a/alembic/versions/8e26f1a1160d_add_is_first_login_column_to_user_model.py b/alembic/versions/8e26f1a1160d_add_is_first_login_column_to_user_model.py deleted file mode 100644 index 6bb2187fc..000000000 --- a/alembic/versions/8e26f1a1160d_add_is_first_login_column_to_user_model.py +++ /dev/null @@ -1,29 +0,0 @@ -"""Add is_first_login Column to User Model. - -Revision ID: 8e26f1a1160d -Revises: 377bb8c30bde -Create Date: 2024-04-29 11:15:07.067857 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "8e26f1a1160d" -down_revision = "377bb8c30bde" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column("users", sa.Column("is_first_login", sa.Boolean(), nullable=False, server_default="False")) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column("users", "is_first_login") - # ### end Alembic commands ### diff --git a/alembic/versions/90e7860964a2_add_target_accession.py b/alembic/versions/90e7860964a2_add_target_accession.py deleted file mode 100644 index a4b94c174..000000000 --- a/alembic/versions/90e7860964a2_add_target_accession.py +++ /dev/null @@ -1,43 +0,0 @@ -"""Add Target Accession - -Revision ID: 90e7860964a2 -Revises: 22e2d92d602e -Create Date: 2023-08-04 11:40:37.434740 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "90e7860964a2" -down_revision = "22e2d92d602e" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "target_accessions", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("assembly", sa.String(), nullable=False), - sa.Column("accession", sa.String(), nullable=False), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.PrimaryKeyConstraint("id"), - ) - op.add_column( - "target_genes", sa.Column("accession_id", sa.Integer, sa.ForeignKey("target_accessions.id"), nullable=True) - ) - op.alter_column("target_genes", "wt_sequence_id", nullable=True) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column("target_genes", "accession_id") - op.drop_table("target_accessions") - op.alter_column("target_genes", "wt_sequence_id", nullable=False) - # ### end Alembic commands ### diff --git a/alembic/versions/9702d32bacb3_controlled_keyword.py b/alembic/versions/9702d32bacb3_controlled_keyword.py deleted file mode 100644 index 4464c2b58..000000000 --- a/alembic/versions/9702d32bacb3_controlled_keyword.py +++ /dev/null @@ -1,271 +0,0 @@ -"""controlled_keyword - -Revision ID: 9702d32bacb3 -Revises: 44a45d616036 -Create Date: 2024-05-24 14:48:50.266496 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "9702d32bacb3" -down_revision = "44a45d616036" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "controlled_keywords", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("key", sa.String(), nullable=False), - sa.Column("value", sa.String(), nullable=False), - sa.Column("vocabulary", sa.String(), nullable=True), - sa.Column("special", sa.Boolean(), nullable=True), - sa.Column("description", sa.String(), nullable=True), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.PrimaryKeyConstraint("id"), - sa.UniqueConstraint("key", "value", name="ix_controlled_keywords_key_value"), - ) - op.create_index(op.f("ix_controlled_keywords_id"), "controlled_keywords", ["id"], unique=False) - op.create_table( - "experiment_controlled_keywords", - sa.Column("experiment_id", sa.Integer(), nullable=False), - sa.Column("controlled_keyword_id", sa.Integer(), nullable=False), - sa.Column("description", sa.String(), nullable=True), - sa.ForeignKeyConstraint( - ["controlled_keyword_id"], - ["controlled_keywords.id"], - ), - sa.ForeignKeyConstraint( - ["experiment_id"], - ["experiments.id"], - ), - sa.PrimaryKeyConstraint("experiment_id", "controlled_keyword_id"), - ) - - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Variant Library Creation Method', 'Endogenous locus library method', NULL, False, 'A methodology for generating a variant library at an endogenous locus', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Variant Library Creation Method', 'In vitro construct library method', NULL, False, 'A methodology for generating a variant library at an endogenous locus', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Variant Library Creation Method', 'Other', NULL, False, 'A methodology for generating a variant library at an endogenous locus', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Endogenous Locus Library Method System', 'SpCas9', NULL, False, 'The system used to generate the library', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Endogenous Locus Library Method System', 'SaCas9', NULL, False, 'The system used to generate the library', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Endogenous Locus Library Method System', 'AsCas12a', NULL, False, 'The system used to generate the library', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Endogenous Locus Library Method System', 'RfsCas13d', NULL, False, 'The system used to generate the library', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Endogenous Locus Library Method System', 'Other', NULL, False, 'The system used to generate the library', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Endogenous Locus Library Method Mechanism', 'Nuclease', NULL, False, 'The functional mechanism of the library generation method', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Endogenous Locus Library Method Mechanism', 'Base editor', NULL, False, 'The functional mechanism of the library generation method', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Endogenous Locus Library Method Mechanism', 'Prime editor', NULL, False, 'The functional mechanism of the library generation method', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Endogenous Locus Library Method Mechanism', 'Other', NULL, False, 'The functional mechanism of the library generation method', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('In Vitro Construct Library Method System', 'Oligo-directed mutagenic PCR', NULL, False, 'The type of method used to generate the library', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('In Vitro Construct Library Method System', 'Error-prone PCR', NULL, False, 'The type of method used to generate the library', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('In Vitro Construct Library Method System', 'Nicking mutagenesis', NULL, False, 'The type of method used to generate the library', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('In Vitro Construct Library Method System', 'Microarray synthesis', NULL, False, 'The type of method used to generate the library', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('In Vitro Construct Library Method System', 'Site-directed mutagenesis', NULL, False, 'The type of method used to generate the library', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('In Vitro Construct Library Method System', 'Doped oligo synthesis', NULL, False, 'The type of method used to generate the library', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('In Vitro Construct Library Method System', 'Oligo pool synthesis', NULL, False, 'The type of method used to generate the library', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('In Vitro Construct Library Method System', 'Proprietary method', NULL, False, 'The type of method used to generate the library', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('In Vitro Construct Library Method System', 'Other', NULL, False, 'The type of method used to generate the library', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('In Vitro Construct Library Method Mechanism', 'Native locus replacement', NULL, False, 'The mechanism for integration or expression of an exogenous construct', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('In Vitro Construct Library Method Mechanism', 'Extra-local construct insertion', NULL, False, 'The mechanism for integration or expression of an exogenous construct', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('In Vitro Construct Library Method Mechanism', 'Random locus viral integration', NULL, False, 'The mechanism for integration or expression of an exogenous construct', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('In Vitro Construct Library Method Mechanism', 'Episomal delivery', NULL, False, 'The mechanism for integration or expression of an exogenous construct', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('In Vitro Construct Library Method Mechanism', 'Plasmid (not integrated)', NULL, False, 'The mechanism for integration or expression of an exogenous construct', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('In Vitro Construct Library Method Mechanism', 'Transfection of RNA', NULL, False, 'The mechanism for integration or expression of an exogenous construct', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('In Vitro Construct Library Method Mechanism', 'Other', NULL, False, 'The mechanism for integration or expression of an exogenous construct', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Delivery method', 'Electroporation', NULL, False, 'How the variant library was delivered to the model system for phenotype evaluation.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Delivery method', 'Nucleofection', NULL, False, 'How the variant library was delivered to the model system for phenotype evaluation.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Delivery method', 'Chemical-based transfection', NULL, False, 'How the variant library was delivered to the model system for phenotype evaluation.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Delivery method', 'Adeno-associated virus transduction', NULL, False, 'How the variant library was delivered to the model system for phenotype evaluation.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Delivery method', 'Lentivirus transduction', NULL, False, 'How the variant library was delivered to the model system for phenotype evaluation.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Delivery method', 'Chemical or heat shock transformation', NULL, False, 'How the variant library was delivered to the model system for phenotype evaluation.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Delivery method', 'Other', NULL, False, 'How the variant library was delivered to the model system for phenotype evaluation.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Dimensionality', 'Single-dimensional data', NULL, False, 'A coding defining the dimensionality of the assay as single or multiple functional readouts.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Dimensionality', 'High-dimensional data', NULL, False, 'A coding defining the dimensionality of the assay as single or multiple functional readouts.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Dimensionality', 'Combined functional data', NULL, False, 'A coding defining the dimensionality of the assay as single or multiple functional readouts.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Dimensionality', 'Other', NULL, False, 'A coding defining the dimensionality of the assay as single or multiple functional readouts.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Method', 'Promoter activity detection by reporter gene assay', NULL, False, 'The assay method, defining the molecular properties interrogated.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Method', 'Bulk RNA-sequencing', NULL, False, 'The assay method, defining the molecular properties interrogated.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Method', 'Single-cell RNA sequencing assay', NULL, False, 'The assay method, defining the molecular properties interrogated.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Method', 'Fluorescence in-situ hybridization (FISH) assay', NULL, False, 'The assay method, defining the molecular properties interrogated.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Method', 'Flow cytometry assay', NULL, False, 'The assay method, defining the molecular properties interrogated.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Method', 'Imaging mass cytometry assay', NULL, False, 'The assay method, defining the molecular properties interrogated.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Method', 'Systematic evolution of ligands by exponential enrichment assay', NULL, False, 'The assay method, defining the molecular properties interrogated.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Method', 'Single cell imaging', NULL, False, 'The assay method, defining the molecular properties interrogated.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Method', 'Multiplexed fluorescent antibody imaging', NULL, False, 'The assay method, defining the molecular properties interrogated.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Method', 'Binding assay', NULL, False, 'The assay method, defining the molecular properties interrogated.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Method', 'Cell proliferation assay', NULL, False, 'The assay method, defining the molecular properties interrogated.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Method', 'Survival assessment assay', NULL, False, 'The assay method, defining the molecular properties interrogated.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Method', 'Other', NULL, False, 'The assay method, defining the molecular properties interrogated.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Model System', 'Immortalized human cells', NULL, False, 'The model system context that influences expression of the phenotype.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Model System', 'Murine primary cells', NULL, False, 'The model system context that influences expression of the phenotype.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Model System', 'Induced pluripotent stem cells from human male', NULL, False, 'The model system context that influences expression of the phenotype.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Model System', 'Induced pluripotent stem cells from human female', NULL, False, 'The model system context that influences expression of the phenotype.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Model System', 'Patient derived primary cells (e.g. T-cells, adipocytes)', NULL, False, 'The model system context that influences expression of the phenotype.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Model System', 'Yeast', NULL, False, 'The model system context that influences expression of the phenotype.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Model System', 'Bacteria', NULL, False, 'The model system context that influences expression of the phenotype.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Model System', 'Bacteriophage', NULL, False, 'The model system context that influences expression of the phenotype.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Model System', 'Molecular display', NULL, False, 'The model system context that influences expression of the phenotype.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Model System', 'Other', NULL, False, 'The model system context that influences expression of the phenotype.', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Profiling Strategy', 'Direct sequencing', NULL, False, 'The strategy used to profile the variant library', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Profiling Strategy', 'Shotgun sequencing', NULL, False, 'The strategy used to profile the variant library', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Profiling Strategy', 'Barcode sequencing', NULL, False, 'The strategy used to profile the variant library', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Profiling Strategy', 'Other', NULL, False, 'The strategy used to profile the variant library', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Sequencing Read Type', 'Single-segment (short read)', NULL, False, 'The sequencing method used', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Sequencing Read Type', 'Single-segment (long read)', NULL, False, 'The sequencing method used', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Sequencing Read Type', 'Multi-segment', NULL, False, 'The sequencing method used', NOW(), NOW())""" - ) - op.execute( - """INSERT INTO controlled_keywords (key, value, vocabulary, special, description, creation_date, modification_date) VALUES ('Phenotypic Assay Sequencing Read Type', 'Other', NULL, False, 'The sequencing method used', NOW(), NOW())""" - ) - - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table("experiment_controlled_keywords") - op.drop_index(op.f("ix_controlled_keywords_id"), table_name="controlled_keywords") - op.drop_table("controlled_keywords") - # ### end Alembic commands ### diff --git a/alembic/versions/986b635a697f_variant_translations_data_model.py b/alembic/versions/986b635a697f_variant_translations_data_model.py deleted file mode 100644 index e78fdffdd..000000000 --- a/alembic/versions/986b635a697f_variant_translations_data_model.py +++ /dev/null @@ -1,36 +0,0 @@ -"""Variant translations data model - -Revision ID: 986b635a697f -Revises: af87c9953d2d -Create Date: 2025-03-24 14:00:18.063245 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "986b635a697f" -down_revision = "af87c9953d2d" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "variant_translations", - sa.Column("aa_clingen_id", sa.String(), nullable=False), - sa.Column("nt_clingen_id", sa.String(), nullable=False), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.PrimaryKeyConstraint("aa_clingen_id", "nt_clingen_id"), - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table("variant_translations") - # ### end Alembic commands ### diff --git a/alembic/versions/988ca84c701b_.py b/alembic/versions/988ca84c701b_.py deleted file mode 100644 index 5b48a95a6..000000000 --- a/alembic/versions/988ca84c701b_.py +++ /dev/null @@ -1,50 +0,0 @@ -"""empty message - -Revision ID: 988ca84c701b -Revises: 9d566d915a2c -Create Date: 2023-04-10 05:19:28.099693 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "988ca84c701b" -down_revision = "9d566d915a2c" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "licenses", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("long_name", sa.String(), nullable=False), - sa.Column("short_name", sa.String(), nullable=False), - sa.Column("text", sa.String(), nullable=False), - sa.Column("link", sa.String(), nullable=True), - sa.Column("version", sa.String(), nullable=True), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.PrimaryKeyConstraint("id"), - sa.UniqueConstraint("long_name"), - sa.UniqueConstraint("short_name"), - ) - op.create_index(op.f("ix_licenses_id"), "licenses", ["id"], unique=False) - op.alter_column("scoresets", "licence_id", existing_type=sa.INTEGER(), nullable=False) - op.create_foreign_key(None, "scoresets", "licenses", ["licence_id"], ["id"]) - op.create_foreign_key(None, "scoresets", "scoresets", ["replaces_id"], ["id"]) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_constraint(None, "scoresets", type_="foreignkey") - op.drop_constraint(None, "scoresets", type_="foreignkey") - op.alter_column("scoresets", "licence_id", existing_type=sa.INTEGER(), nullable=True) - op.drop_index(op.f("ix_licenses_id"), table_name="licenses") - op.drop_table("licenses") - # ### end Alembic commands ### diff --git a/alembic/versions/9d566d915a2c_.py b/alembic/versions/9d566d915a2c_.py deleted file mode 100644 index db9e473f3..000000000 --- a/alembic/versions/9d566d915a2c_.py +++ /dev/null @@ -1,656 +0,0 @@ -"""empty message - -Revision ID: 9d566d915a2c -Revises: -Create Date: 2022-09-04 19:01:51.002043 - -""" - -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "9d566d915a2c" -down_revision = None -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "doi_identifiers", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("identifier", sa.String(), nullable=False), - sa.Column("db_name", sa.String(), nullable=False), - sa.Column("db_version", sa.String(), nullable=True), - sa.Column("url", sa.String(), nullable=True), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_doi_identifiers_id"), "doi_identifiers", ["id"], unique=False) - op.create_table( - "ensembl_identifiers", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("identifier", sa.String(), nullable=False), - sa.Column("db_name", sa.String(), nullable=False), - sa.Column("db_version", sa.String(), nullable=True), - sa.Column("url", sa.String(), nullable=True), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_ensembl_identifiers_id"), "ensembl_identifiers", ["id"], unique=False) - op.create_table( - "genome_identifiers", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("identifier", sa.String(), nullable=False), - sa.Column("db_name", sa.String(), nullable=False), - sa.Column("db_version", sa.String(), nullable=True), - sa.Column("url", sa.String(), nullable=True), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_genome_identifiers_id"), "genome_identifiers", ["id"], unique=False) - op.create_table( - "keywords", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("text", sa.String(), nullable=False), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.PrimaryKeyConstraint("id"), - sa.UniqueConstraint("text"), - ) - op.create_index(op.f("ix_keywords_id"), "keywords", ["id"], unique=False) - op.create_table( - "pubmed_identifiers", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("identifier", sa.String(), nullable=False), - sa.Column("db_name", sa.String(), nullable=False), - sa.Column("db_version", sa.String(), nullable=True), - sa.Column("url", sa.String(), nullable=True), - sa.Column("reference_html", sa.String(), nullable=True), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_pubmed_identifiers_id"), "pubmed_identifiers", ["id"], unique=False) - op.create_table( - "refseq_identifiers", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("identifier", sa.String(), nullable=False), - sa.Column("db_name", sa.String(), nullable=False), - sa.Column("db_version", sa.String(), nullable=True), - sa.Column("url", sa.String(), nullable=True), - sa.Column("reference_html", sa.String(), nullable=True), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_refseq_identifiers_id"), "refseq_identifiers", ["id"], unique=False) - op.create_table( - "roles", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("name", sa.String(), nullable=False), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_roles_name"), "roles", ["name"], unique=False) - op.create_table( - "sra_identifiers", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("identifier", sa.String(), nullable=False), - sa.Column("db_name", sa.String(), nullable=False), - sa.Column("db_version", sa.String(), nullable=True), - sa.Column("url", sa.String(), nullable=True), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_sra_identifiers_id"), "sra_identifiers", ["id"], unique=False) - op.create_table( - "uniprot_identifiers", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("identifier", sa.String(), nullable=False), - sa.Column("db_name", sa.String(), nullable=False), - sa.Column("db_version", sa.String(), nullable=True), - sa.Column("url", sa.String(), nullable=True), - sa.Column("reference_html", sa.String(), nullable=True), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_uniprot_identifiers_id"), "uniprot_identifiers", ["id"], unique=False) - op.create_table( - "users", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("username", sa.String(), nullable=False), - sa.Column("first_name", sa.String(), nullable=True), - sa.Column("last_name", sa.String(), nullable=True), - sa.Column("is_superuser", sa.Boolean(), nullable=False), - sa.Column("is_staff", sa.Boolean(), nullable=False), - sa.Column("is_active", sa.Boolean(), nullable=False), - sa.Column("date_joined", sa.DateTime(), nullable=True), - sa.Column("email", sa.String(), nullable=True), - sa.Column("last_login", sa.DateTime(), nullable=True), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_users_username"), "users", ["username"], unique=False) - op.create_table( - "wild_type_sequences", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("sequence_type", sa.String(), nullable=False), - sa.Column("sequence", sa.String(), nullable=False), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_wild_type_sequences_id"), "wild_type_sequences", ["id"], unique=False) - op.create_table( - "access_keys", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("user_id", sa.Integer(), nullable=False), - sa.Column("key_id", sa.String(), nullable=False), - sa.Column("public_key", sa.String(), nullable=False), - sa.Column("name", sa.String(), nullable=True), - sa.Column("expiration_date", sa.Date(), nullable=True), - sa.Column("creation_time", sa.DateTime(), nullable=True), - sa.ForeignKeyConstraint( - ["user_id"], - ["users.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_access_keys_key_id"), "access_keys", ["key_id"], unique=True) - op.create_table( - "experiment_sets", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("urn", sa.String(length=64), nullable=True), - sa.Column("title", sa.String(), nullable=False), - sa.Column("method_text", sa.String(), nullable=False), - sa.Column("abstract_text", sa.String(), nullable=False), - sa.Column("short_description", sa.String(), nullable=False), - sa.Column("extra_metadata", postgresql.JSONB(astext_type=sa.Text()), nullable=False), - sa.Column("private", sa.Boolean(), nullable=False), - sa.Column("approved", sa.Boolean(), nullable=False), - sa.Column("published_date", sa.Date(), nullable=True), - sa.Column("processing_state", sa.String(), nullable=True), - sa.Column("num_experiments", sa.Integer(), nullable=False), - sa.Column("created_by_id", sa.Integer(), nullable=True), - sa.Column("modified_by_id", sa.Integer(), nullable=True), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.ForeignKeyConstraint( - ["created_by_id"], - ["users.id"], - ), - sa.ForeignKeyConstraint( - ["modified_by_id"], - ["users.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_experiment_sets_id"), "experiment_sets", ["id"], unique=False) - op.create_table( - "reference_genomes", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("short_name", sa.String(), nullable=False), - sa.Column("organism_name", sa.String(), nullable=False), - sa.Column("genome_identifier_id", sa.Integer(), nullable=True), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.ForeignKeyConstraint( - ["genome_identifier_id"], - ["genome_identifiers.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_reference_genomes_id"), "reference_genomes", ["id"], unique=False) - op.create_table( - "users_roles", - sa.Column("user_id", sa.Integer(), nullable=False), - sa.Column("role_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["role_id"], - ["roles.id"], - ), - sa.ForeignKeyConstraint( - ["user_id"], - ["users.id"], - ), - sa.PrimaryKeyConstraint("user_id", "role_id"), - ) - op.create_table( - "experiment_set_doi_identifiers", - sa.Column("experiment_set_id", sa.Integer(), nullable=False), - sa.Column("doi_identifier_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["doi_identifier_id"], - ["doi_identifiers.id"], - ), - sa.ForeignKeyConstraint( - ["experiment_set_id"], - ["experiment_sets.id"], - ), - sa.PrimaryKeyConstraint("experiment_set_id", "doi_identifier_id"), - ) - op.create_table( - "experiment_set_keywords", - sa.Column("experiment_set_id", sa.Integer(), nullable=False), - sa.Column("keyword_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["experiment_set_id"], - ["experiment_sets.id"], - ), - sa.ForeignKeyConstraint( - ["keyword_id"], - ["keywords.id"], - ), - sa.PrimaryKeyConstraint("experiment_set_id", "keyword_id"), - ) - op.create_table( - "experiment_set_pubmed_identifiers", - sa.Column("experiment_set_id", sa.Integer(), nullable=False), - sa.Column("pubmed_identifier_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["experiment_set_id"], - ["experiment_sets.id"], - ), - sa.ForeignKeyConstraint( - ["pubmed_identifier_id"], - ["pubmed_identifiers.id"], - ), - sa.PrimaryKeyConstraint("experiment_set_id", "pubmed_identifier_id"), - ) - op.create_table( - "experiment_set_sra_identifiers", - sa.Column("experiment_set_id", sa.Integer(), nullable=False), - sa.Column("sra_identifier_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["experiment_set_id"], - ["experiment_sets.id"], - ), - sa.ForeignKeyConstraint( - ["sra_identifier_id"], - ["sra_identifiers.id"], - ), - sa.PrimaryKeyConstraint("experiment_set_id", "sra_identifier_id"), - ) - op.create_table( - "experiments", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("urn", sa.String(length=64), nullable=True), - sa.Column("title", sa.String(), nullable=False), - sa.Column("short_description", sa.String(), nullable=False), - sa.Column("abstract_text", sa.String(), nullable=False), - sa.Column("method_text", sa.String(), nullable=False), - sa.Column("extra_metadata", postgresql.JSONB(astext_type=sa.Text()), nullable=False), - sa.Column("private", sa.Boolean(), nullable=False), - sa.Column("approved", sa.Boolean(), nullable=False), - sa.Column("published_date", sa.Date(), nullable=True), - sa.Column("processing_state", sa.String(), nullable=True), - sa.Column("num_scoresets", sa.Integer(), nullable=False), - sa.Column("experiment_set_id", sa.Integer(), nullable=True), - sa.Column("created_by_id", sa.Integer(), nullable=True), - sa.Column("modified_by_id", sa.Integer(), nullable=True), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.ForeignKeyConstraint( - ["created_by_id"], - ["users.id"], - ), - sa.ForeignKeyConstraint( - ["experiment_set_id"], - ["experiment_sets.id"], - ), - sa.ForeignKeyConstraint( - ["modified_by_id"], - ["users.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_experiments_id"), "experiments", ["id"], unique=False) - op.create_table( - "experiment_doi_identifiers", - sa.Column("experiment_id", sa.Integer(), nullable=False), - sa.Column("doi_identifier_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["doi_identifier_id"], - ["doi_identifiers.id"], - ), - sa.ForeignKeyConstraint( - ["experiment_id"], - ["experiments.id"], - ), - sa.PrimaryKeyConstraint("experiment_id", "doi_identifier_id"), - ) - op.create_table( - "experiment_keywords", - sa.Column("experiment_id", sa.Integer(), nullable=False), - sa.Column("keyword_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["experiment_id"], - ["experiments.id"], - ), - sa.ForeignKeyConstraint( - ["keyword_id"], - ["keywords.id"], - ), - sa.PrimaryKeyConstraint("experiment_id", "keyword_id"), - ) - op.create_table( - "experiment_pubmed_identifiers", - sa.Column("experiment_id", sa.Integer(), nullable=False), - sa.Column("pubmed_identifier_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["experiment_id"], - ["experiments.id"], - ), - sa.ForeignKeyConstraint( - ["pubmed_identifier_id"], - ["pubmed_identifiers.id"], - ), - sa.PrimaryKeyConstraint("experiment_id", "pubmed_identifier_id"), - ) - op.create_table( - "experiment_sra_identifiers", - sa.Column("experiment_id", sa.Integer(), nullable=False), - sa.Column("sra_identifier_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["experiment_id"], - ["experiments.id"], - ), - sa.ForeignKeyConstraint( - ["sra_identifier_id"], - ["sra_identifiers.id"], - ), - sa.PrimaryKeyConstraint("experiment_id", "sra_identifier_id"), - ) - op.create_table( - "scoresets", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("urn", sa.String(length=64), nullable=True), - sa.Column("title", sa.String(), nullable=False), - sa.Column("method_text", sa.String(), nullable=False), - sa.Column("abstract_text", sa.String(), nullable=False), - sa.Column("short_description", sa.String(), nullable=False), - sa.Column("extra_metadata", postgresql.JSONB(astext_type=sa.Text()), nullable=False), - sa.Column("dataset_columns", postgresql.JSONB(astext_type=sa.Text()), nullable=False), - sa.Column("normalised", sa.Boolean(), nullable=False), - sa.Column("private", sa.Boolean(), nullable=False), - sa.Column("approved", sa.Boolean(), nullable=False), - sa.Column("published_date", sa.Date(), nullable=True), - sa.Column( - "processing_state", - sa.Enum( - "incomplete", - "processing", - "failed", - "success", - name="processingstate", - native_enum=False, - create_constraint=True, - length=32, - ), - nullable=True, - ), - sa.Column("data_usage_policy", sa.String(), nullable=True), - sa.Column("num_variants", sa.Integer(), nullable=False), - sa.Column("experiment_id", sa.Integer(), nullable=False), - sa.Column("licence_id", sa.Integer(), nullable=True), - sa.Column("replaces_id", sa.Integer(), nullable=True), - sa.Column("created_by_id", sa.Integer(), nullable=True), - sa.Column("modified_by_id", sa.Integer(), nullable=True), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.ForeignKeyConstraint( - ["created_by_id"], - ["users.id"], - ), - sa.ForeignKeyConstraint( - ["experiment_id"], - ["experiments.id"], - ), - sa.ForeignKeyConstraint( - ["modified_by_id"], - ["users.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_scoresets_id"), "scoresets", ["id"], unique=False) - op.create_table( - "scoreset_doi_identifiers", - sa.Column("scoreset_id", sa.Integer(), nullable=False), - sa.Column("doi_identifier_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["doi_identifier_id"], - ["doi_identifiers.id"], - ), - sa.ForeignKeyConstraint( - ["scoreset_id"], - ["scoresets.id"], - ), - sa.PrimaryKeyConstraint("scoreset_id", "doi_identifier_id"), - ) - op.create_table( - "scoreset_keywords", - sa.Column("scoreset_id", sa.Integer(), nullable=False), - sa.Column("keyword_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["keyword_id"], - ["keywords.id"], - ), - sa.ForeignKeyConstraint( - ["scoreset_id"], - ["scoresets.id"], - ), - sa.PrimaryKeyConstraint("scoreset_id", "keyword_id"), - ) - op.create_table( - "scoreset_meta_analysis_sources", - sa.Column("source_scoreset_id", sa.Integer(), nullable=False), - sa.Column("meta_analysis_scoreset_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["meta_analysis_scoreset_id"], - ["scoresets.id"], - ), - sa.ForeignKeyConstraint( - ["source_scoreset_id"], - ["scoresets.id"], - ), - sa.PrimaryKeyConstraint("source_scoreset_id", "meta_analysis_scoreset_id"), - ) - op.create_table( - "scoreset_pubmed_identifiers", - sa.Column("scoreset_id", sa.Integer(), nullable=False), - sa.Column("pubmed_identifier_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["pubmed_identifier_id"], - ["pubmed_identifiers.id"], - ), - sa.ForeignKeyConstraint( - ["scoreset_id"], - ["scoresets.id"], - ), - sa.PrimaryKeyConstraint("scoreset_id", "pubmed_identifier_id"), - ) - op.create_table( - "scoreset_sra_identifiers", - sa.Column("scoreset_id", sa.Integer(), nullable=False), - sa.Column("sra_identifier_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["scoreset_id"], - ["scoresets.id"], - ), - sa.ForeignKeyConstraint( - ["sra_identifier_id"], - ["sra_identifiers.id"], - ), - sa.PrimaryKeyConstraint("scoreset_id", "sra_identifier_id"), - ) - op.create_table( - "target_genes", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("name", sa.String(), nullable=False), - sa.Column("category", sa.String(), nullable=False), - sa.Column("scoreset_id", sa.Integer(), nullable=False), - sa.Column("wt_sequence_id", sa.Integer(), nullable=False), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.ForeignKeyConstraint( - ["scoreset_id"], - ["scoresets.id"], - ), - sa.ForeignKeyConstraint( - ["wt_sequence_id"], - ["wild_type_sequences.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_target_genes_id"), "target_genes", ["id"], unique=False) - op.create_table( - "variants", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("urn", sa.String(length=64), nullable=True), - sa.Column("data", postgresql.JSONB(astext_type=sa.Text()), nullable=False), - sa.Column("scoreset_id", sa.Integer(), nullable=False), - sa.Column("hgvs_nt", sa.String(), nullable=True), - sa.Column("hgvs_pro", sa.String(), nullable=True), - sa.Column("hgvs_splice", sa.String(), nullable=True), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.ForeignKeyConstraint( - ["scoreset_id"], - ["scoresets.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_variants_id"), "variants", ["id"], unique=False) - op.create_table( - "ensembl_offsets", - sa.Column("identifier_id", sa.Integer(), nullable=False), - sa.Column("target_gene_id", sa.Integer(), nullable=False), - sa.Column("offset", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["identifier_id"], - ["ensembl_identifiers.id"], - ), - sa.ForeignKeyConstraint( - ["target_gene_id"], - ["target_genes.id"], - ), - sa.PrimaryKeyConstraint("identifier_id", "target_gene_id"), - ) - op.create_table( - "reference_maps", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("is_primary", sa.Boolean(), nullable=False), - sa.Column("genome_id", sa.Integer(), nullable=False), - sa.Column("target_id", sa.Integer(), nullable=False), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.ForeignKeyConstraint( - ["genome_id"], - ["reference_genomes.id"], - ), - sa.ForeignKeyConstraint( - ["target_id"], - ["target_genes.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_reference_maps_id"), "reference_maps", ["id"], unique=False) - op.create_table( - "refseq_offsets", - sa.Column("identifier_id", sa.Integer(), nullable=False), - sa.Column("target_gene_id", sa.Integer(), nullable=False), - sa.Column("offset", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["identifier_id"], - ["refseq_identifiers.id"], - ), - sa.ForeignKeyConstraint( - ["target_gene_id"], - ["target_genes.id"], - ), - sa.PrimaryKeyConstraint("identifier_id", "target_gene_id"), - ) - op.create_table( - "uniprot_offsets", - sa.Column("identifier_id", sa.Integer(), nullable=False), - sa.Column("target_gene_id", sa.Integer(), nullable=False), - sa.Column("offset", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["identifier_id"], - ["uniprot_identifiers.id"], - ), - sa.ForeignKeyConstraint( - ["target_gene_id"], - ["target_genes.id"], - ), - sa.PrimaryKeyConstraint("identifier_id", "target_gene_id"), - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table("uniprot_offsets") - op.drop_table("refseq_offsets") - op.drop_index(op.f("ix_reference_maps_id"), table_name="reference_maps") - op.drop_table("reference_maps") - op.drop_table("ensembl_offsets") - op.drop_index(op.f("ix_variants_id"), table_name="variants") - op.drop_table("variants") - op.drop_index(op.f("ix_target_genes_id"), table_name="target_genes") - op.drop_table("target_genes") - op.drop_table("scoreset_sra_identifiers") - op.drop_table("scoreset_pubmed_identifiers") - op.drop_table("scoreset_meta_analysis_sources") - op.drop_table("scoreset_keywords") - op.drop_table("scoreset_doi_identifiers") - op.drop_index(op.f("ix_scoresets_id"), table_name="scoresets") - op.drop_table("scoresets") - op.drop_table("experiment_sra_identifiers") - op.drop_table("experiment_pubmed_identifiers") - op.drop_table("experiment_keywords") - op.drop_table("experiment_doi_identifiers") - op.drop_index(op.f("ix_experiments_id"), table_name="experiments") - op.drop_table("experiments") - op.drop_table("experiment_set_sra_identifiers") - op.drop_table("experiment_set_pubmed_identifiers") - op.drop_table("experiment_set_keywords") - op.drop_table("experiment_set_doi_identifiers") - op.drop_table("users_roles") - op.drop_index(op.f("ix_reference_genomes_id"), table_name="reference_genomes") - op.drop_table("reference_genomes") - op.drop_index(op.f("ix_experiment_sets_id"), table_name="experiment_sets") - op.drop_table("experiment_sets") - op.drop_index(op.f("ix_access_keys_key_id"), table_name="access_keys") - op.drop_table("access_keys") - op.drop_index(op.f("ix_wild_type_sequences_id"), table_name="wild_type_sequences") - op.drop_table("wild_type_sequences") - op.drop_index(op.f("ix_users_username"), table_name="users") - op.drop_table("users") - op.drop_index(op.f("ix_uniprot_identifiers_id"), table_name="uniprot_identifiers") - op.drop_table("uniprot_identifiers") - op.drop_index(op.f("ix_sra_identifiers_id"), table_name="sra_identifiers") - op.drop_table("sra_identifiers") - op.drop_index(op.f("ix_roles_name"), table_name="roles") - op.drop_table("roles") - op.drop_index(op.f("ix_refseq_identifiers_id"), table_name="refseq_identifiers") - op.drop_table("refseq_identifiers") - op.drop_index(op.f("ix_pubmed_identifiers_id"), table_name="pubmed_identifiers") - op.drop_table("pubmed_identifiers") - op.drop_index(op.f("ix_keywords_id"), table_name="keywords") - op.drop_table("keywords") - op.drop_index(op.f("ix_genome_identifiers_id"), table_name="genome_identifiers") - op.drop_table("genome_identifiers") - op.drop_index(op.f("ix_ensembl_identifiers_id"), table_name="ensembl_identifiers") - op.drop_table("ensembl_identifiers") - op.drop_index(op.f("ix_doi_identifiers_id"), table_name="doi_identifiers") - op.drop_table("doi_identifiers") - # ### end Alembic commands ### diff --git a/alembic/versions/a1b2c3d4e5f6_add_alleles_and_mapping_records_tables.py b/alembic/versions/a1b2c3d4e5f6_add_alleles_and_mapping_records_tables.py deleted file mode 100644 index 6c1fc1d99..000000000 --- a/alembic/versions/a1b2c3d4e5f6_add_alleles_and_mapping_records_tables.py +++ /dev/null @@ -1,151 +0,0 @@ -"""Add mapping_records, alleles, and mapping_record_alleles tables - -Revision ID: a1b2c3d4e5f6 -Revises: a7f3c2e9b104 -Create Date: 2026-05-29 - -New parallel tables for the Better Reverse Translation epic (#746). -The existing mapped_variants table is left untouched (frozen serving). -""" - -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "a1b2c3d4e5f6" -down_revision = "a7f3c2e9b104" -branch_labels = None -depends_on = None - -VALID_ASSAY_LEVELS = "('genomic', 'cdna', 'protein')" -VALID_ALIGNMENT_LEVELS = "('protein', 'cdna', 'genomic')" - - -def upgrade() -> None: - op.create_table( - "alleles", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("vrs_digest", sa.String(), nullable=False), - sa.Column("level", sa.String(length=16), nullable=False), - sa.Column("transcript", sa.String(), nullable=False), - sa.Column("hgvs_g", sa.String(), nullable=True), - sa.Column("hgvs_c", sa.String(), nullable=True), - sa.Column("hgvs_p", sa.String(), nullable=True), - sa.Column("clingen_allele_id", sa.String(), nullable=True), - sa.Column("post_mapped", postgresql.JSONB(), nullable=True), - sa.Column("created_at", sa.Date(), nullable=False, server_default=sa.text("CURRENT_DATE")), - sa.Column( - "updated_at", - sa.Date(), - nullable=False, - server_default=sa.text("CURRENT_DATE"), - onupdate=sa.text("CURRENT_DATE"), - ), - sa.PrimaryKeyConstraint("id"), - sa.UniqueConstraint("vrs_digest", name="uq_alleles_vrs_digest"), - ) - op.create_index("ix_alleles_vrs_digest", "alleles", ["vrs_digest"]) - op.create_index("ix_alleles_level", "alleles", ["level"]) - op.create_index("ix_alleles_clingen_allele_id", "alleles", ["clingen_allele_id"]) - - op.create_table( - "mapping_records", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("variant_id", sa.Integer(), nullable=False), - sa.Column("vrs_digest", sa.String(), nullable=True), - sa.Column("pre_mapped", postgresql.JSONB(), nullable=True), - sa.Column("assay_level", sa.String(length=16), nullable=False), - sa.Column("hgvs_assay_level", sa.String(), nullable=True), - sa.Column("mapping_api_version", sa.String(), nullable=False), - sa.Column("mapped_date", sa.Date(), nullable=False), - sa.Column("vrs_version", sa.String(), nullable=True), - sa.Column("current", sa.Boolean(), nullable=False), - sa.Column("alignment_level", sa.String(length=16), nullable=True), - sa.Column("at_mismatched_locus", sa.Boolean(), nullable=True), - sa.Column("near_gap", sa.Boolean(), nullable=True), - sa.Column("target_gene_mapping_id", sa.Integer(), nullable=True), - sa.Column("created_at", sa.Date(), nullable=False, server_default=sa.text("CURRENT_DATE")), - sa.Column( - "updated_at", - sa.Date(), - nullable=False, - server_default=sa.text("CURRENT_DATE"), - onupdate=sa.text("CURRENT_DATE"), - ), - sa.ForeignKeyConstraint( - ["variant_id"], - ["variants.id"], - name="fk_mapping_records_variant_id", - ), - sa.ForeignKeyConstraint( - ["target_gene_mapping_id"], - ["target_gene_mappings.id"], - name="fk_mapping_records_target_gene_mapping_id", - ), - sa.PrimaryKeyConstraint("id"), - sa.CheckConstraint( - f"assay_level IN {VALID_ASSAY_LEVELS}", - name="ck_mapping_records_assay_level_valid", - ), - ) - op.create_index("ix_mapping_records_variant_id", "mapping_records", ["variant_id"]) - op.create_index("ix_mapping_records_vrs_digest", "mapping_records", ["vrs_digest"]) - op.create_index( - "ix_mapping_records_target_gene_mapping_id", - "mapping_records", - ["target_gene_mapping_id"], - ) - - op.create_table( - "mapping_record_alleles", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("mapping_record_id", sa.Integer(), nullable=False), - sa.Column("allele_id", sa.Integer(), nullable=False), - sa.Column( - "is_authoritative", - sa.Boolean(), - nullable=False, - server_default=sa.text("false"), - ), - sa.ForeignKeyConstraint( - ["mapping_record_id"], - ["mapping_records.id"], - name="fk_mapping_record_alleles_mapping_record_id", - ondelete="CASCADE", - ), - sa.ForeignKeyConstraint( - ["allele_id"], - ["alleles.id"], - name="fk_mapping_record_alleles_allele_id", - ondelete="RESTRICT", - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index( - "ix_mapping_record_alleles_mapping_record_id", - "mapping_record_alleles", - ["mapping_record_id"], - ) - op.create_index( - "ix_mapping_record_alleles_allele_id", - "mapping_record_alleles", - ["allele_id"], - ) - - -def downgrade() -> None: - op.drop_index("ix_mapping_record_alleles_allele_id", table_name="mapping_record_alleles") - op.drop_index("ix_mapping_record_alleles_mapping_record_id", table_name="mapping_record_alleles") - op.drop_table("mapping_record_alleles") - - op.drop_index("ix_mapping_records_target_gene_mapping_id", table_name="mapping_records") - op.drop_index("ix_mapping_records_vrs_digest", table_name="mapping_records") - op.drop_index("ix_mapping_records_variant_id", table_name="mapping_records") - op.drop_table("mapping_records") - - op.drop_index("ix_alleles_clingen_allele_id", table_name="alleles") - op.drop_index("ix_alleles_level", table_name="alleles") - op.drop_index("ix_alleles_vrs_digest", table_name="alleles") - op.drop_table("alleles") diff --git a/alembic/versions/a1d4f7c2e9b0_rewrite_v_variant_annotations_onto_alleles.py b/alembic/versions/a1d4f7c2e9b0_rewrite_v_variant_annotations_onto_alleles.py deleted file mode 100644 index c8f702d72..000000000 --- a/alembic/versions/a1d4f7c2e9b0_rewrite_v_variant_annotations_onto_alleles.py +++ /dev/null @@ -1,91 +0,0 @@ -"""rewrite v_variant_annotations onto the mapping_records/alleles substrate - -Revision ID: a1d4f7c2e9b0 -Revises: e7b2c9a1f4d3 -Create Date: 2026-07-18 - -Drops the legacy ``mapped_variants``-based ``v_variant_annotations`` view and recreates it over the -``MappingRecord`` / ``Allele`` / ``MappingRecordAllele`` substrate (part of the MappedVariant -read-path teardown). Column changes vs. the legacy shape: - * ``mapped_variant_id`` -> ``mapping_record_id`` (the mapping identity is now the mapping record). - * ``mapping_error`` dropped — there is no per-mapping-record error column; per-subject annotation - dispositions live in ``v_current_annotation_events`` and score-set-level mapping errors on - ``scoresets.mapping_errors``. - -Both directions are frozen inline as literal SQL — the migration imports nothing from the model layer. -A migration is an immutable historical record: importing ``variant_annotation_view.definition`` would -couple this fixed revision to mutable code, so the next model edit (the following view rewrite) would -make a replay of *this* revision build that later shape — against tables that may not exist yet at this -point in history — and fail. ``_UPGRADE_DEFINITION`` below was compiled once from the model at -authoring time (``CreateView(signature, definition).compile(postgresql.dialect())``) and must not be -edited to track the model; the next shape change gets its own migration. -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "a1d4f7c2e9b0" -down_revision = "e7b2c9a1f4d3" -branch_labels = None -depends_on = None - -SIGNATURE = "v_variant_annotations" - -# New (mapping_records/alleles) definition, frozen at this revision. Compiled from the model once at -# authoring time; do not edit to track the model. Allele-derived columns are correlated scalar -# subqueries so the grain stays one row per (variant, annotation_type), matching the legacy view. -_UPGRADE_DEFINITION = """ -SELECT variants.urn AS variant_urn, scoresets.urn AS score_set_urn, variants.hgvs_nt, variants.hgvs_pro, - variants.hgvs_splice, mapping_records.id AS mapping_record_id, (SELECT alleles.clingen_allele_id -FROM mapping_record_alleles JOIN alleles ON alleles.id = mapping_record_alleles.allele_id -WHERE mapping_record_alleles.mapping_record_id = mapping_records.id AND mapping_record_alleles.is_authoritative IS true AND mapping_record_alleles.valid_to IS NULL - LIMIT 1) AS clingen_allele_id, mapping_records.hgvs_assay_level, (SELECT alleles.hgvs_g -FROM mapping_record_alleles JOIN alleles ON alleles.id = mapping_record_alleles.allele_id -WHERE mapping_record_alleles.mapping_record_id = mapping_records.id AND mapping_record_alleles.valid_to IS NULL AND alleles.level = 'genomic' - LIMIT 1) AS hgvs_g, (SELECT alleles.hgvs_c -FROM mapping_record_alleles JOIN alleles ON alleles.id = mapping_record_alleles.allele_id -WHERE mapping_record_alleles.mapping_record_id = mapping_records.id AND mapping_record_alleles.valid_to IS NULL AND alleles.level = 'cdna' - LIMIT 1) AS hgvs_c, (SELECT alleles.hgvs_p -FROM mapping_record_alleles JOIN alleles ON alleles.id = mapping_record_alleles.allele_id -WHERE mapping_record_alleles.mapping_record_id = mapping_records.id AND mapping_record_alleles.valid_to IS NULL AND alleles.level = 'protein' - LIMIT 1) AS hgvs_p, (SELECT vep_allele_consequences.functional_consequence -FROM mapping_record_alleles JOIN alleles ON alleles.id = mapping_record_alleles.allele_id JOIN vep_allele_consequences ON vep_allele_consequences.allele_id = alleles.id AND vep_allele_consequences.valid_to IS NULL -WHERE mapping_record_alleles.mapping_record_id = mapping_records.id AND mapping_record_alleles.is_authoritative IS true AND mapping_record_alleles.valid_to IS NULL - LIMIT 1) AS vep_functional_consequence, (SELECT vep_allele_consequences.access_date -FROM mapping_record_alleles JOIN alleles ON alleles.id = mapping_record_alleles.allele_id JOIN vep_allele_consequences ON vep_allele_consequences.allele_id = alleles.id AND vep_allele_consequences.valid_to IS NULL -WHERE mapping_record_alleles.mapping_record_id = mapping_records.id AND mapping_record_alleles.is_authoritative IS true AND mapping_record_alleles.valid_to IS NULL - LIMIT 1) AS vep_access_date, mapping_records.mapped_date, mapping_records.mapping_api_version, mapping_records.vrs_version, variant_annotation_status.annotation_type, variant_annotation_status.status AS annotation_status, variant_annotation_status.failure_category, variant_annotation_status.error_message AS annotation_error, variant_annotation_status.version AS annotation_version, variant_annotation_status.annotation_metadata, variant_annotation_status.current, variant_annotation_status.created_at AS annotation_created_at, variant_annotation_status.updated_at AS annotation_updated_at -FROM variants JOIN scoresets ON scoresets.id = variants.scoreset_id - LEFT OUTER JOIN mapping_records ON mapping_records.variant_id = variants.id AND mapping_records.valid_to IS NULL - LEFT OUTER JOIN variant_annotation_status ON variant_annotation_status.variant_id = variants.id AND variant_annotation_status.current = true -""" - -# Legacy (mapped_variants-based) definition, inlined so the downgrade can restore the prior shape. -# ``mapped_variants`` still exists at this revision (dropped in a later teardown migration), so this -# remains runnable on downgrade. -_LEGACY_DEFINITION = """ -SELECT variants.urn AS variant_urn, scoresets.urn AS score_set_urn, variants.hgvs_nt, variants.hgvs_pro, - variants.hgvs_splice, mapped_variants.id AS mapped_variant_id, mapped_variants.clingen_allele_id, - mapped_variants.hgvs_assay_level, mapped_variants.hgvs_g, mapped_variants.hgvs_c, mapped_variants.hgvs_p, - mapped_variants.vep_functional_consequence, mapped_variants.vep_access_date, mapped_variants.mapped_date, - mapped_variants.mapping_api_version, mapped_variants.vrs_version, mapped_variants.error_message AS mapping_error, - variant_annotation_status.annotation_type, variant_annotation_status.status AS annotation_status, - variant_annotation_status.failure_category, variant_annotation_status.error_message AS annotation_error, - variant_annotation_status.version AS annotation_version, variant_annotation_status.annotation_metadata, - variant_annotation_status.current, variant_annotation_status.created_at AS annotation_created_at, - variant_annotation_status.updated_at AS annotation_updated_at -FROM variants JOIN scoresets ON scoresets.id = variants.scoreset_id - LEFT OUTER JOIN mapped_variants ON mapped_variants.variant_id = variants.id AND mapped_variants.current = true - LEFT OUTER JOIN variant_annotation_status - ON variant_annotation_status.variant_id = variants.id AND variant_annotation_status.current = true -""" - - -def upgrade() -> None: - op.execute(f"DROP VIEW {SIGNATURE}") - op.execute(f"CREATE VIEW {SIGNATURE} AS {_UPGRADE_DEFINITION}") - - -def downgrade() -> None: - op.execute(f"DROP VIEW {SIGNATURE}") - op.execute(f"CREATE VIEW {SIGNATURE} AS {_LEGACY_DEFINITION}") diff --git a/alembic/versions/a3b7c9d1e2f4_drop_redundant_variant_annotation_.py b/alembic/versions/a3b7c9d1e2f4_drop_redundant_variant_annotation_.py deleted file mode 100644 index 6647ab0df..000000000 --- a/alembic/versions/a3b7c9d1e2f4_drop_redundant_variant_annotation_.py +++ /dev/null @@ -1,61 +0,0 @@ -"""drop_redundant_variant_annotation_status_indexes - -Revision ID: a3b7c9d1e2f4 -Revises: 009570ae0cb0 -Create Date: 2026-04-20 12:00:00.000000 - -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "a3b7c9d1e2f4" -down_revision = "009570ae0cb0" -branch_labels = None -depends_on = None - - -# The variant_annotation_status table is append-only and write-heavy. Every -# production query filters on (variant_id, annotation_type, [version], current), -# which is fully served by the composite index -# ix_variant_annotation_status_variant_type_version_current. -# -# The 8 indexes being dropped here are either: -# - single-column prefixes of that composite (redundant), -# - on low-selectivity columns (boolean, 3 enum values), or -# - on columns that are never filtered in any query (status, created_at). -# -# Keeping: the 4-column composite + the job_run_id FK index. - -INDEXES_TO_DROP = [ - "ix_variant_annotation_status_variant_id", - "ix_variant_annotation_status_annotation_type", - "ix_variant_annotation_status_status", - "ix_variant_annotation_status_created_at", - "ix_variant_annotation_variant_type_status", - "ix_variant_annotation_type_status", - "ix_variant_annotation_status_current", - "ix_variant_annotation_status_version", -] - -# Column definitions for downgrade (recreating dropped indexes) -INDEX_COLUMNS = { - "ix_variant_annotation_status_variant_id": ["variant_id"], - "ix_variant_annotation_status_annotation_type": ["annotation_type"], - "ix_variant_annotation_status_status": ["status"], - "ix_variant_annotation_status_created_at": ["created_at"], - "ix_variant_annotation_variant_type_status": ["variant_id", "annotation_type", "status"], - "ix_variant_annotation_type_status": ["annotation_type", "status"], - "ix_variant_annotation_status_current": ["current"], - "ix_variant_annotation_status_version": ["version"], -} - - -def upgrade() -> None: - for index_name in INDEXES_TO_DROP: - op.drop_index(index_name, table_name="variant_annotation_status") - - -def downgrade() -> None: - for index_name, columns in INDEX_COLUMNS.items(): - op.create_index(index_name, "variant_annotation_status", columns) diff --git a/alembic/versions/a3f9c2e1b7d6_add_vep_consequence_provenance.py b/alembic/versions/a3f9c2e1b7d6_add_vep_consequence_provenance.py deleted file mode 100644 index ff1790bf3..000000000 --- a/alembic/versions/a3f9c2e1b7d6_add_vep_consequence_provenance.py +++ /dev/null @@ -1,73 +0,0 @@ -"""add resolution provenance to vep_allele_consequences - -Revision ID: a3f9c2e1b7d6 -Revises: b2e5a8d3f0c1 -Create Date: 2026-08-26 - -Adds four nullable columns to ``vep_allele_consequences`` so a stored consequence records *how* it was -resolved, not just the headline term (#772): - -- ``consequence_terms`` (JSONB) — every term from the matched transcript entry, severity-ordered. -- ``consequence_source`` (varchar check-constraint enum) — ``transcript`` | ``most_severe`` | - ``reference_identical``. -- ``matched_transcript`` (varchar) — the versioned transcript VEP used; NULL unless the source is - ``transcript``. -- ``resolver_version`` (varchar) — ``variant_annotation.lib.vep.RESOLVER_VERSION``, the version of our - resolution *rule* (severity ranking, transcript-matching, Recoder combination). Pairs with - ``source_version`` (the Ensembl release) as the second version axis the current-release skip keys on, - so a rule fix shipped in the shared kernel re-queries every allele instead of looking current forever. - -All nullable, no backfill: rows written before this migration keep NULL provenance / resolver_version. -A NULL ``resolver_version`` never matches the current one, so a legacy row is re-queried on the next VEP -run and then filled in place (the linker supersedes on a value change, and a NULL→populated column for -an unchanged headline term advances in place rather than churning history). -""" - -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "a3f9c2e1b7d6" -down_revision = "b2e5a8d3f0c1" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.add_column( - "vep_allele_consequences", - sa.Column("consequence_terms", postgresql.JSONB(none_as_null=True), nullable=True), - ) - op.add_column( - "vep_allele_consequences", - sa.Column( - "consequence_source", - sa.Enum( - "transcript", - "most_severe", - "reference_identical", - name="vepconsequencesource", - native_enum=False, - create_constraint=True, - length=32, - ), - nullable=True, - ), - ) - op.add_column( - "vep_allele_consequences", - sa.Column("matched_transcript", sa.String(), nullable=True), - ) - op.add_column( - "vep_allele_consequences", - sa.Column("resolver_version", sa.String(), nullable=True), - ) - - -def downgrade() -> None: - op.drop_column("vep_allele_consequences", "resolver_version") - op.drop_column("vep_allele_consequences", "matched_transcript") - op.drop_column("vep_allele_consequences", "consequence_source") - op.drop_column("vep_allele_consequences", "consequence_terms") diff --git a/alembic/versions/a7c3e5f9b1d2_unique_allele_hgvs_expression.py b/alembic/versions/a7c3e5f9b1d2_unique_allele_hgvs_expression.py deleted file mode 100644 index 1ead4d392..000000000 --- a/alembic/versions/a7c3e5f9b1d2_unique_allele_hgvs_expression.py +++ /dev/null @@ -1,64 +0,0 @@ -"""enforce one allele per HGVS expression - -Revision ID: a7c3e5f9b1d2 -Revises: 024370c4bca7 -Create Date: 2026-09-30 - -Adds a unique index on the allele's HGVS expression (whichever of hgvs_g / hgvs_c / hgvs_p is set; the -model guarantees exactly one). An allele digest covers the refget of the sequence the allele sits on, -and alleles deduplicate on that digest. The same expression under two digests therefore means two -writers built the allele on different sequences (this happened with NM_007294.3 and NP_001346945.1 when -the mapper and reverse translation resolved one accession to different sequences), and the copies never -merge: reverse translation's fold-in misses the measured allele and the convergent / projection -labelling breaks. Nothing else detects it, because both digests are internally consistent. This index -moves the failure to write time, in get_or_create_allele, which raises AlleleIdentityConflictError with -both digests, both refgets and how to debug it. - -Built CONCURRENTLY: mapping and reverse translation write to alleles, and a plain CREATE UNIQUE INDEX -would block them. A concurrent build that fails leaves an INVALID index behind, which must be dropped -before retrying: - - DROP INDEX CONCURRENTLY IF EXISTS uq_alleles_hgvs; - -Assumes no two alleles share an HGVS expression. Check first: - - SELECT coalesce(hgvs_g, hgvs_c, hgvs_p) AS hgvs, count(*), array_agg(id ORDER BY id) - FROM alleles - GROUP BY 1 HAVING count(*) > 1; - -If that returns rows, remove the duplicates before applying this migration. In each group keep the -allele whose refget is the one SeqRepo holds for its accession. Delete the other allele and the rows -that reference it (mapping_record_alleles, gnomad_allele_links, vep_allele_consequences, -clinvar_allele_links, annotation_event; all ON DELETE RESTRICT), then remap the affected score sets. -Delete before remapping: get_or_create_allele refuses to create an allele while another holds its HGVS. -""" - -import sqlalchemy as sa -from alembic import op - -# revision identifiers, used by Alembic. -revision = "a7c3e5f9b1d2" -down_revision = "024370c4bca7" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - with op.get_context().autocommit_block(): - op.create_index( - "uq_alleles_hgvs", - "alleles", - [sa.text("(coalesce(hgvs_g, hgvs_c, hgvs_p))")], - unique=True, - postgresql_concurrently=True, - ) - op.execute( - "COMMENT ON INDEX uq_alleles_hgvs IS " - "'One allele per HGVS expression. A violation means two writers disagree about the sequence an " - "allele sits on (see mavedb.lib.variant_translations.AlleleIdentityConflictError).'" - ) - - -def downgrade() -> None: - with op.get_context().autocommit_block(): - op.drop_index("uq_alleles_hgvs", table_name="alleles", postgresql_concurrently=True) diff --git a/alembic/versions/a7c4e9d2f1b8_add_vep_allele_consequences.py b/alembic/versions/a7c4e9d2f1b8_add_vep_allele_consequences.py deleted file mode 100644 index 8b655f625..000000000 --- a/alembic/versions/a7c4e9d2f1b8_add_vep_allele_consequences.py +++ /dev/null @@ -1,65 +0,0 @@ -"""add vep_allele_consequences table - -Revision ID: a7c4e9d2f1b8 -Revises: e5f7a9c1b3d4 -Create Date: 2026-06-22 - -New valid-time table holding a deduplicated allele's VEP functional consequence, replacing the frozen -vep_functional_consequence/vep_access_date columns on mapped_variants for new-model writes (Step 2 of -the annotation infrastructure migration, docs/design/annotation-infrastructure-migration.md). A row is -live while valid_to is NULL; the partial unique index enforces a single live consequence per allele -(VEP's most-severe consequence is one current value, so a change supersedes rather than accumulates). -functional_consequence is nullable (reserved for a future negative cache). source_version is the -Ensembl release the consequence was resolved under (coordinated software + transcript set + vocabulary), -which version-keys the refresh skip like gnomAD's db_version; access_date is retained as a "last -confirmed" audit stamp. The VEP columns on mapped_variants are left untouched (frozen serving). -""" - -import sqlalchemy as sa -from alembic import op - -# revision identifiers, used by Alembic. -revision = "a7c4e9d2f1b8" -down_revision = "e5f7a9c1b3d4" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.create_table( - "vep_allele_consequences", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("allele_id", sa.Integer(), nullable=False), - sa.Column("functional_consequence", sa.String(), nullable=True), - sa.Column("source_version", sa.String(), nullable=False), - sa.Column("access_date", sa.Date(), nullable=False), - sa.Column("valid_from", sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()), - sa.Column("valid_to", sa.DateTime(timezone=True), nullable=True), - sa.ForeignKeyConstraint( - ["allele_id"], - ["alleles.id"], - name="fk_vep_allele_consequences_allele_id", - ondelete="RESTRICT", - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index( - "ix_vep_allele_consequences_allele_id", - "vep_allele_consequences", - ["allele_id"], - ) - # One live consequence per allele: VEP's most-severe consequence is a single current value, so a - # changed result supersedes the prior row rather than accumulating one live row per access. - op.create_index( - "uq_vep_allele_consequences_live", - "vep_allele_consequences", - ["allele_id"], - unique=True, - postgresql_where=sa.text("valid_to IS NULL"), - ) - - -def downgrade() -> None: - op.drop_index("uq_vep_allele_consequences_live", table_name="vep_allele_consequences") - op.drop_index("ix_vep_allele_consequences_allele_id", table_name="vep_allele_consequences") - op.drop_table("vep_allele_consequences") diff --git a/alembic/versions/a7e1c4f9b3d2_add_annotation_event.py b/alembic/versions/a7e1c4f9b3d2_add_annotation_event.py deleted file mode 100644 index cf8d77e35..000000000 --- a/alembic/versions/a7e1c4f9b3d2_add_annotation_event.py +++ /dev/null @@ -1,79 +0,0 @@ -"""add annotation_event log - -Revision ID: a7e1c4f9b3d2 -Revises: d4e5f6a7b8c9 -Create Date: 2026-06-25 16:00:00.000000 - -""" - -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "a7e1c4f9b3d2" -down_revision = "d4e5f6a7b8c9" -branch_labels = None -depends_on = None - -_VARIANT_SUBJECT_TYPES = "'vrs_mapping', 'cross_level_translation', 'variant_translation', 'ldh_submission'" -_ALLELE_SUBJECT_TYPES = ( - "'clingen_allele_id', 'gnomad_allele_frequency', 'vep_functional_consequence', 'clinvar_control', 'mapped_hgvs'" -) - - -def upgrade(): - op.create_table( - "annotation_event", - sa.Column("id", sa.Integer(), autoincrement=True, nullable=False), - sa.Column("annotation_type", sa.String(length=50), nullable=False), - sa.Column("variant_id", sa.Integer(), nullable=True), - sa.Column("allele_id", sa.Integer(), nullable=True), - sa.Column("disposition", sa.String(length=50), nullable=False), - sa.Column("reason", sa.String(length=50), nullable=False), - sa.Column("source_version", sa.String(length=50), nullable=True), - sa.Column("metadata", postgresql.JSONB(astext_type=sa.Text()), nullable=True), - sa.Column("job_run_id", sa.Integer(), nullable=True), - sa.Column("score_set_id", sa.Integer(), nullable=True), - sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False), - sa.CheckConstraint( - f"(annotation_type IN ({_VARIANT_SUBJECT_TYPES}) " - "AND variant_id IS NOT NULL AND allele_id IS NULL) " - f"OR (annotation_type IN ({_ALLELE_SUBJECT_TYPES}) " - "AND allele_id IS NOT NULL AND variant_id IS NULL)", - name="ck_annotation_event_subject", - ), - sa.ForeignKeyConstraint(["variant_id"], ["variants.id"], ondelete="RESTRICT"), - sa.ForeignKeyConstraint(["allele_id"], ["alleles.id"], ondelete="RESTRICT"), - sa.ForeignKeyConstraint(["job_run_id"], ["job_runs.id"], ondelete="SET NULL"), - sa.ForeignKeyConstraint(["score_set_id"], ["scoresets.id"], ondelete="SET NULL"), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index( - "ix_annotation_event_allele_type_id", - "annotation_event", - ["allele_id", "annotation_type", sa.text("id DESC")], - unique=False, - ) - op.create_index( - "ix_annotation_event_variant_type_id", - "annotation_event", - ["variant_id", "annotation_type", sa.text("id DESC")], - unique=False, - ) - op.create_index( - "ix_annotation_event_allele_type_version", - "annotation_event", - ["allele_id", "annotation_type", "source_version"], - unique=False, - ) - op.create_index("ix_annotation_event_job_run_id", "annotation_event", ["job_run_id"], unique=False) - - -def downgrade(): - op.drop_index("ix_annotation_event_job_run_id", table_name="annotation_event") - op.drop_index("ix_annotation_event_allele_type_version", table_name="annotation_event") - op.drop_index("ix_annotation_event_variant_type_id", table_name="annotation_event") - op.drop_index("ix_annotation_event_allele_type_id", table_name="annotation_event") - op.drop_table("annotation_event") diff --git a/alembic/versions/a7f3c2e9b104_add_progress_updated_at_to_job_runs.py b/alembic/versions/a7f3c2e9b104_add_progress_updated_at_to_job_runs.py deleted file mode 100644 index d04ceab9b..000000000 --- a/alembic/versions/a7f3c2e9b104_add_progress_updated_at_to_job_runs.py +++ /dev/null @@ -1,44 +0,0 @@ -"""Add progress_updated_at heartbeat column to job_runs - -Revision ID: a7f3c2e9b104 -Revises: 4dbf24ed1857 -Create Date: 2026-07-09 00:00:00.000000 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "a7f3c2e9b104" -down_revision = "4dbf24ed1857" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column( - "job_runs", - sa.Column( - "progress_updated_at", - sa.DateTime(timezone=True), - server_default=sa.text("now()"), - nullable=False, - ), - ) - op.create_index( - "ix_job_runs_status_progress_updated", - "job_runs", - ["status", "progress_updated_at"], - unique=False, - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index("ix_job_runs_status_progress_updated", table_name="job_runs") - op.drop_column("job_runs", "progress_updated_at") - # ### end Alembic commands ### diff --git a/alembic/versions/a8e345cca190_cast_db_identifier_in_clinical_controls_.py b/alembic/versions/a8e345cca190_cast_db_identifier_in_clinical_controls_.py deleted file mode 100644 index 9f8d01c54..000000000 --- a/alembic/versions/a8e345cca190_cast_db_identifier_in_clinical_controls_.py +++ /dev/null @@ -1,59 +0,0 @@ -"""cast db_identifier in clinical controls table to a string - -Revision ID: a8e345cca190 -Revises: 986b635a697f -Create Date: 2025-08-20 12:30:05.388503 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "a8e345cca190" -down_revision = "986b635a697f" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.alter_column( - "clinical_controls", "db_identifier", existing_type=sa.INTEGER(), type_=sa.String(), existing_nullable=False - ) - op.alter_column( - "publication_identifiers", "title", existing_type=sa.TEXT(), type_=sa.String(), existing_nullable=False - ) - op.alter_column( - "publication_identifiers", "abstract", existing_type=sa.TEXT(), type_=sa.String(), existing_nullable=True - ) - op.alter_column( - "publication_identifiers", - "publication_journal", - existing_type=sa.TEXT(), - type_=sa.String(), - existing_nullable=True, - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.alter_column( - "publication_identifiers", - "publication_journal", - existing_type=sa.String(), - type_=sa.TEXT(), - existing_nullable=True, - ) - op.alter_column( - "publication_identifiers", "abstract", existing_type=sa.String(), type_=sa.TEXT(), existing_nullable=True - ) - op.alter_column( - "publication_identifiers", "title", existing_type=sa.String(), type_=sa.TEXT(), existing_nullable=False - ) - op.alter_column( - "clinical_controls", "db_identifier", existing_type=sa.String(), type_=sa.INTEGER(), existing_nullable=False - ) - # ### end Alembic commands ### diff --git a/alembic/versions/aa3933cf0cb3_add_ix_for_mapped_variant_pre_post_id.py b/alembic/versions/aa3933cf0cb3_add_ix_for_mapped_variant_pre_post_id.py deleted file mode 100644 index 327dc9040..000000000 --- a/alembic/versions/aa3933cf0cb3_add_ix_for_mapped_variant_pre_post_id.py +++ /dev/null @@ -1,31 +0,0 @@ -"""add ix for mapped variant pre/post id - -Revision ID: aa3933cf0cb3 -Revises: f69b4049bc3b -Create Date: 2025-06-02 11:42:34.479411 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "aa3933cf0cb3" -down_revision = "f69b4049bc3b" -branch_labels = None -depends_on = None - - -def upgrade(): - op.create_index( - "ix_mapped_variants_pre_mapped_id", "mapped_variants", [sa.text("(pre_mapped->>'id')")], unique=False - ) - op.create_index( - "ix_mapped_variants_post_mapped_id", "mapped_variants", [sa.text("(post_mapped->>'id')")], unique=False - ) - - -def downgrade(): - op.drop_index("ix_mapped_variants_pre_mapped_id", table_name="mapped_variants") - op.drop_index("ix_mapped_variants_post_mapped_id", table_name="mapped_variants") diff --git a/alembic/versions/aa73d39b3705_score_set_level_score_thresholds.py b/alembic/versions/aa73d39b3705_score_set_level_score_thresholds.py deleted file mode 100644 index 7b1cf5e3e..000000000 --- a/alembic/versions/aa73d39b3705_score_set_level_score_thresholds.py +++ /dev/null @@ -1,29 +0,0 @@ -"""score set level score thresholds - -Revision ID: aa73d39b3705 -Revises: 68a0ec57694e -Create Date: 2024-11-13 11:23:57.917725 - -""" - -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql - -# revision identifiers, used by Alembic. -revision = "aa73d39b3705" -down_revision = "68a0ec57694e" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column("scoresets", sa.Column("score_calibrations", postgresql.JSONB(astext_type=sa.Text()), nullable=True)) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column("scoresets", "score_calibrations") - # ### end Alembic commands ### diff --git a/alembic/versions/af87c9953d2d_consolidate_score_ranges_and_.py b/alembic/versions/af87c9953d2d_consolidate_score_ranges_and_.py deleted file mode 100644 index b9947dcc1..000000000 --- a/alembic/versions/af87c9953d2d_consolidate_score_ranges_and_.py +++ /dev/null @@ -1,32 +0,0 @@ -"""consolidate score ranges and calibrations - -Revision ID: af87c9953d2d -Revises: ec535fd72270 -Create Date: 2025-07-09 21:04:33.916597 - -""" - -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql - -# revision identifiers, used by Alembic. -revision = "af87c9953d2d" -down_revision = "ec535fd72270" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column("scoresets", "score_calibrations") - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column( - "scoresets", - sa.Column("score_calibrations", postgresql.JSONB(astext_type=sa.Text()), autoincrement=False, nullable=True), - ) - # ### end Alembic commands ### diff --git a/alembic/versions/b22b450d409c_add_mapped_hgvs.py b/alembic/versions/b22b450d409c_add_mapped_hgvs.py deleted file mode 100644 index 42bd6ecb6..000000000 --- a/alembic/versions/b22b450d409c_add_mapped_hgvs.py +++ /dev/null @@ -1,34 +0,0 @@ -"""Add mapped hgvs - -Revision ID: b22b450d409c -Revises: 1e08b947679d -Create Date: 2025-10-09 09:53:47.903249 - -""" - -from alembic import op -import sqlalchemy as sa - -# revision identifiers, used by Alembic. -revision = "b22b450d409c" -down_revision = "1e08b947679d" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column("mapped_variants", sa.Column("hgvs_assay_level", sa.String(), nullable=True)) - op.add_column("mapped_variants", sa.Column("hgvs_g", sa.String(), nullable=True)) - op.add_column("mapped_variants", sa.Column("hgvs_c", sa.String(), nullable=True)) - op.add_column("mapped_variants", sa.Column("hgvs_p", sa.String(), nullable=True)) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column("mapped_variants", "hgvs_p") - op.drop_column("mapped_variants", "hgvs_c") - op.drop_column("mapped_variants", "hgvs_g") - op.drop_column("mapped_variants", "hgvs_assay_level") - # ### end Alembic commands ### diff --git a/alembic/versions/b2c3d4e5f6a7_rename_clinical_controls_to_clinvar_controls.py b/alembic/versions/b2c3d4e5f6a7_rename_clinical_controls_to_clinvar_controls.py deleted file mode 100644 index 19cca0789..000000000 --- a/alembic/versions/b2c3d4e5f6a7_rename_clinical_controls_to_clinvar_controls.py +++ /dev/null @@ -1,39 +0,0 @@ -"""rename clinical_controls to clinvar_controls - -Revision ID: b2c3d4e5f6a7 -Revises: a7c4e9d2f1b8 -Create Date: 2026-06-22 - -Renames the clinical_controls entity table to clinvar_controls, and renames the unique -constraint to match. The frozen association table (mapped_variants_clinical_controls) -and its FK to the renamed table are left structurally intact — PostgreSQL updates the FK -target automatically on table rename. The Python model is renamed ClinicalControl → -ClinvarControl in the same changeset (no data migration). -""" - -from alembic import op - -revision = "b2c3d4e5f6a7" -down_revision = "a7c4e9d2f1b8" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.rename_table("clinical_controls", "clinvar_controls") - # PostgreSQL does not auto-rename constraints on table rename; rename explicitly so the - # on_conflict_do_update(constraint=...) in the job references the correct name. - op.execute( - "ALTER TABLE clinvar_controls RENAME CONSTRAINT " - "uq_clinical_controls_db_name_identifier_version " - "TO uq_clinvar_controls_db_name_identifier_version" - ) - - -def downgrade() -> None: - op.execute( - "ALTER TABLE clinvar_controls RENAME CONSTRAINT " - "uq_clinvar_controls_db_name_identifier_version " - "TO uq_clinical_controls_db_name_identifier_version" - ) - op.rename_table("clinvar_controls", "clinical_controls") diff --git a/alembic/versions/b2e5a8d3f0c1_rebuild_published_variants_mv_onto_records.py b/alembic/versions/b2e5a8d3f0c1_rebuild_published_variants_mv_onto_records.py deleted file mode 100644 index 2f9dad721..000000000 --- a/alembic/versions/b2e5a8d3f0c1_rebuild_published_variants_mv_onto_records.py +++ /dev/null @@ -1,86 +0,0 @@ -"""rebuild published_variants MV onto the mapping_records substrate - -Revision ID: b2e5a8d3f0c1 -Revises: a1d4f7c2e9b0 -Create Date: 2026-07-18 - -Rebuilds the ``published_variants_materialized_view`` off the legacy ``mapped_variants`` join onto the -``mapping_records`` substrate (part of the MappedVariant read-path teardown). The MV keeps its grain -(one row per published variant per mapping-record version, unmapped variants retained with a NULL -mapping id) and its published filter. Column changes: - * ``mapped_variant_id`` -> ``mapping_record_id`` - * ``current_mapped_variant`` -> ``current_mapping_record`` (``valid_to IS NULL``) - -Both directions are frozen inline as literal SQL — the migration imports nothing from the model layer. -A migration is an immutable historical record: importing ``published_variant.definition`` would couple -this fixed revision to mutable code, so a later model edit would make a replay of *this* revision build -that later shape (possibly against tables that no longer exist by then) and fail. ``_UPGRADE_DEFINITION`` -below was compiled once from the model at authoring time and must not be edited to track the model. -""" - -from alembic_utils.pg_materialized_view import PGMaterializedView - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "b2e5a8d3f0c1" -down_revision = "a1d4f7c2e9b0" -branch_labels = None -depends_on = None - -SIGNATURE = "published_variants_materialized_view" - -# New (mapping_records-based) definition, frozen at this revision. Compiled from the model once at -# authoring time; do not edit to track the model. The LEFT OUTER JOIN to mapping_records carries no -# liveness filter on purpose — every record version is retained and current-ness is exposed via the -# ``current_mapping_record`` flag (``valid_to IS NULL``). -_UPGRADE_DEFINITION = """ -SELECT variants.id AS variant_id, variants.urn AS variant_urn, mapping_records.id AS mapping_record_id, - scoresets.id AS score_set_id, scoresets.urn AS score_set_urn, scoresets.published_date AS published_date, - mapping_records.valid_to IS NULL AS current_mapping_record -FROM variants LEFT OUTER JOIN mapping_records ON variants.id = mapping_records.variant_id - JOIN scoresets ON scoresets.id = variants.scoreset_id -WHERE scoresets.published_date IS NOT NULL -""" - -# Legacy (mapped_variants-based) definition, inlined for the downgrade path. ``mapped_variants`` still -# exists at this revision (dropped in a later teardown migration), so downgrade remains runnable. -_LEGACY_DEFINITION = """ -SELECT variants.id AS variant_id, variants.urn AS variant_urn, mapped_variants.id AS mapped_variant_id, - scoresets.id AS score_set_id, scoresets.urn AS score_set_urn, scoresets.published_date AS published_date, - mapped_variants.current AS current_mapped_variant -FROM variants LEFT OUTER JOIN mapped_variants ON variants.id = mapped_variants.variant_id - JOIN scoresets ON scoresets.id = variants.scoreset_id -WHERE scoresets.published_date IS NOT NULL -""" - - -def upgrade(): - # Dropping the MV cascades to its owned indexes (the legacy idx_..._ids on mapped_variant_id). - op.drop_entity( - PGMaterializedView(schema="public", signature=SIGNATURE, definition=_LEGACY_DEFINITION, with_data=True) - ) - op.create_entity( - PGMaterializedView(schema="public", signature=SIGNATURE, definition=_UPGRADE_DEFINITION, with_data=True) - ) - op.create_index( - f"idx_{SIGNATURE}_ids", - SIGNATURE, - ["mapping_record_id", "variant_id", "score_set_id"], - unique=True, - ) - - -def downgrade(): - op.drop_entity( - PGMaterializedView(schema="public", signature=SIGNATURE, definition=_UPGRADE_DEFINITION, with_data=True) - ) - op.create_entity( - PGMaterializedView(schema="public", signature=SIGNATURE, definition=_LEGACY_DEFINITION, with_data=True) - ) - op.create_index( - f"idx_{SIGNATURE}_ids", - SIGNATURE, - ["mapped_variant_id", "variant_id", "score_set_id"], - unique=True, - ) diff --git a/alembic/versions/b3767156e04a_merge_6fae83d65ee4_and_886e059ad1a8.py b/alembic/versions/b3767156e04a_merge_6fae83d65ee4_and_886e059ad1a8.py deleted file mode 100644 index 35c5b011e..000000000 --- a/alembic/versions/b3767156e04a_merge_6fae83d65ee4_and_886e059ad1a8.py +++ /dev/null @@ -1,21 +0,0 @@ -"""merge 6fae83d65ee4 and 886e059ad1a8 - -Revision ID: b3767156e04a -Revises: 6fae83d65ee4, 886e059ad1a8 -Create Date: 2024-04-15 11:24:54.269178 - -""" - -# revision identifiers, used by Alembic. -revision = "b3767156e04a" -down_revision = ("6fae83d65ee4", "886e059ad1a8") -branch_labels = None -depends_on = None - - -def upgrade(): - pass - - -def downgrade(): - pass diff --git a/alembic/versions/b4d8f2a6c1e3_score_set_score_distribution.py b/alembic/versions/b4d8f2a6c1e3_score_set_score_distribution.py deleted file mode 100644 index 364018af9..000000000 --- a/alembic/versions/b4d8f2a6c1e3_score_set_score_distribution.py +++ /dev/null @@ -1,30 +0,0 @@ -"""store a binned score distribution on each score set - -Revision ID: b4d8f2a6c1e3 -Revises: a7c3e5f9b1d2 -Create Date: 2026-10-08 - -Adds a nullable score_distribution JSONB column, written by the variant creation job (see -mavedb.lib.score_distribution). Adding a nullable column without a default is a catalog-only change and -does not rewrite the table. Existing score sets stay null until the backfill runs: - - python -m mavedb.scripts.backfill_score_distributions --commit -""" - -import sqlalchemy as sa -from alembic import op -from sqlalchemy.dialects import postgresql - -# revision identifiers, used by Alembic. -revision = "b4d8f2a6c1e3" -down_revision = "a7c3e5f9b1d2" -branch_labels = None -depends_on = None - - -def upgrade(): - op.add_column("scoresets", sa.Column("score_distribution", postgresql.JSONB(astext_type=sa.Text()), nullable=True)) - - -def downgrade(): - op.drop_column("scoresets", "score_distribution") diff --git a/alembic/versions/b5c8d2e4f6a7_simplify_variant_annotation_status_pk.py b/alembic/versions/b5c8d2e4f6a7_simplify_variant_annotation_status_pk.py deleted file mode 100644 index 875f63f60..000000000 --- a/alembic/versions/b5c8d2e4f6a7_simplify_variant_annotation_status_pk.py +++ /dev/null @@ -1,35 +0,0 @@ -"""simplify variant_annotation_status pk to id only - -Revision ID: b5c8d2e4f6a7 -Revises: a3b7c9d1e2f4 -Create Date: 2026-04-20 - -The composite PK (id, variant_id, annotation_type) is unnecessary because `id` -is already unique (autoincrement serial). Keeping variant_id and annotation_type -in the PK just widens the B-tree on every INSERT with no benefit — no FK -references this composite key. - -This migration drops the composite PK and recreates it on `id` alone. -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "b5c8d2e4f6a7" -down_revision = "a3b7c9d1e2f4" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.drop_constraint("variant_annotation_status_pkey", "variant_annotation_status", type_="primary") - op.create_primary_key("variant_annotation_status_pkey", "variant_annotation_status", ["id"]) - - -def downgrade() -> None: - op.drop_constraint("variant_annotation_status_pkey", "variant_annotation_status", type_="primary") - op.create_primary_key( - "variant_annotation_status_pkey", - "variant_annotation_status", - ["id", "variant_id", "annotation_type"], - ) diff --git a/alembic/versions/b85bc7b1bec7_materialized_view_for_variant_statistics.py b/alembic/versions/b85bc7b1bec7_materialized_view_for_variant_statistics.py deleted file mode 100644 index 3b3855e7a..000000000 --- a/alembic/versions/b85bc7b1bec7_materialized_view_for_variant_statistics.py +++ /dev/null @@ -1,90 +0,0 @@ -"""materialized view for variant statistics -Revision ID: b85bc7b1bec7 -Revises: c404b6719110 -Create Date: 2025-03-14 01:53:19.898198 - -The MV SQL is inlined as a frozen literal rather than imported from the model. At this revision the -MV joins the (now legacy) ``mapped_variants`` table; a later migration rebuilds it onto the -``mapping_records`` substrate. Importing the live model definition here would make a fresh replay -build *that* later shape at this early revision — before the substrate tables exist — and fail. -Freezing the historical SQL keeps replay green; the rebuild happens in its own migration. -""" - -from alembic import op -from alembic_utils.pg_materialized_view import PGMaterializedView - - -# revision identifiers, used by Alembic. -revision = "b85bc7b1bec7" -down_revision = "c404b6719110" -branch_labels = None -depends_on = None - -SIGNATURE = "published_variants_materialized_view" - -# Historical definition, frozen at this revision. Do not edit to track the model. -DEFINITION = """ -SELECT variants.id AS variant_id, variants.urn AS variant_urn, mapped_variants.id AS mapped_variant_id, - scoresets.id AS score_set_id, scoresets.urn AS score_set_urn, scoresets.published_date AS published_date, - mapped_variants.current AS current_mapped_variant -FROM variants LEFT OUTER JOIN mapped_variants ON variants.id = mapped_variants.variant_id - JOIN scoresets ON scoresets.id = variants.scoreset_id -WHERE scoresets.published_date IS NOT NULL -""" - - -def upgrade(): - op.create_entity( - PGMaterializedView( - schema="public", - signature=SIGNATURE, - definition=DEFINITION, - with_data=True, - ) - ) - op.create_index( - f"idx_{SIGNATURE}_variant_id", - SIGNATURE, - ["variant_id"], - unique=False, - ) - op.create_index( - f"idx_{SIGNATURE}_variant_urn", - SIGNATURE, - ["variant_urn"], - unique=False, - ) - op.create_index( - f"idx_{SIGNATURE}_score_set_id", - SIGNATURE, - ["score_set_id"], - unique=False, - ) - op.create_index( - f"idx_{SIGNATURE}_score_set_urn", - SIGNATURE, - ["score_set_urn"], - unique=False, - ) - op.create_index( - f"idx_{SIGNATURE}_mapped_variant_id", - SIGNATURE, - ["mapped_variant_id"], - unique=True, - ) - - -def downgrade(): - op.drop_index(f"idx_{SIGNATURE}_variant_id", SIGNATURE) - op.drop_index(f"idx_{SIGNATURE}_variant_urn", SIGNATURE) - op.drop_index(f"idx_{SIGNATURE}_mapped_variant_id", SIGNATURE) - op.drop_index(f"idx_{SIGNATURE}_score_set_id", SIGNATURE) - op.drop_index(f"idx_{SIGNATURE}_score_set_urn", SIGNATURE) - op.drop_entity( - PGMaterializedView( - schema="public", - signature=SIGNATURE, - definition=DEFINITION, - with_data=True, - ) - ) diff --git a/alembic/versions/b8e1f0a2c4d7_drop_alleles_transcript_column.py b/alembic/versions/b8e1f0a2c4d7_drop_alleles_transcript_column.py deleted file mode 100644 index 2705d9a3c..000000000 --- a/alembic/versions/b8e1f0a2c4d7_drop_alleles_transcript_column.py +++ /dev/null @@ -1,32 +0,0 @@ -"""drop alleles.transcript column - -Revision ID: b8e1f0a2c4d7 -Revises: f4d2a9c1b7e3 -Create Date: 2026-06-05 - -The `transcript` column duplicated data already present in the HGVS columns — it was -always extract_accession(hgvs_g/hgvs_c/hgvs_p). It is now a derived hybrid_property on -the Allele model (split_part(coalesce(hgvs_g, hgvs_c, hgvs_p), ':', 1)), so the stored -column is removed to keep a single source of truth and avoid drift. -""" - -import sqlalchemy as sa -from alembic import op - -# revision identifiers, used by Alembic. -revision = "b8e1f0a2c4d7" -down_revision = "f4d2a9c1b7e3" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.drop_column("alleles", "transcript") - - -def downgrade() -> None: - # Re-add the column and backfill it from the HGVS columns (the same derivation the - # hybrid_property uses) so the restored NOT NULL column is consistent. - op.add_column("alleles", sa.Column("transcript", sa.String(), nullable=True)) - op.execute("UPDATE alleles SET transcript = split_part(coalesce(hgvs_g, hgvs_c, hgvs_p), ':', 1)") - op.alter_column("alleles", "transcript", nullable=False) diff --git a/alembic/versions/b8f2c5a1d3e4_add_v_current_annotation_events_view.py b/alembic/versions/b8f2c5a1d3e4_add_v_current_annotation_events_view.py deleted file mode 100644 index 73843866c..000000000 --- a/alembic/versions/b8f2c5a1d3e4_add_v_current_annotation_events_view.py +++ /dev/null @@ -1,30 +0,0 @@ -"""add v_current_annotation_events view - -Revision ID: b8f2c5a1d3e4 -Revises: a7e1c4f9b3d2 -Create Date: 2026-06-26 - -Creates the v_current_annotation_events view: the latest AnnotationEvent per (subject, annotation_type), -with ClinVar partitioned additionally by source_version (multi-live, one current row per release). -Replaces the per-variant v_variant_annotations as the current-state projection over the new -allele-model annotation log. Intended for operator queries, BI, and the annotation CLI scripts. -""" - -from alembic import op - -from mavedb.db.view import CreateView, DropView -from mavedb.models.annotation_event_view import definition, signature - -# revision identifiers, used by Alembic. -revision = "b8f2c5a1d3e4" -down_revision = "a7e1c4f9b3d2" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.execute(CreateView(signature, definition, materialized=False)) - - -def downgrade() -> None: - op.execute(DropView(signature, materialized=False)) diff --git a/alembic/versions/c3d4e5f6a7b8_add_clinvar_allele_links.py b/alembic/versions/c3d4e5f6a7b8_add_clinvar_allele_links.py deleted file mode 100644 index 4a20f008f..000000000 --- a/alembic/versions/c3d4e5f6a7b8_add_clinvar_allele_links.py +++ /dev/null @@ -1,73 +0,0 @@ -"""add clinvar_allele_links table - -Revision ID: c3d4e5f6a7b8 -Revises: b2c3d4e5f6a7 -Create Date: 2026-06-22 - -New valid-time link table connecting deduplicated alleles to ClinvarControl rows, replacing -the frozen mapped_variants_clinical_controls association for new-model writes. - -ClinVar's link shape is deliberately multi-live: the partial unique index is -(allele_id, clinvar_control_id) WHERE valid_to IS NULL, so an allele accumulates one live -link per ClinVar release rather than superseding as in gnomAD/VEP. Each ClinVar release is a -distinct ClinvarControl row, so different releases stack as independent live links. A link is -retired (valid_to closed) only if ClinVar later removes the variant from a release, which -would surface as a re-run finding no data for that release and retiring the corresponding -link — archival data never changes, so this path is theoretical. - -The existing mapped_variants_clinical_controls association table is left untouched (frozen -for serving existing data). -""" - -import sqlalchemy as sa - -from alembic import op - -revision = "c3d4e5f6a7b8" -down_revision = "b2c3d4e5f6a7" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.create_table( - "clinvar_allele_links", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("allele_id", sa.Integer(), nullable=False), - sa.Column("clinvar_control_id", sa.Integer(), nullable=False), - sa.Column("valid_from", sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()), - sa.Column("valid_to", sa.DateTime(timezone=True), nullable=True), - sa.ForeignKeyConstraint( - ["allele_id"], - ["alleles.id"], - name="fk_clinvar_allele_links_allele_id", - ondelete="RESTRICT", - ), - sa.ForeignKeyConstraint( - ["clinvar_control_id"], - ["clinvar_controls.id"], - name="fk_clinvar_allele_links_clinvar_control_id", - ondelete="RESTRICT", - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index("ix_clinvar_allele_links_allele_id", "clinvar_allele_links", ["allele_id"]) - op.create_index("ix_clinvar_allele_links_clinvar_control_id", "clinvar_allele_links", ["clinvar_control_id"]) - # Multi-live: one live link per (allele, release). An allele accumulates one live link per - # ClinVar release rather than superseding — unlike gnomAD/VEP which enforce one live link - # per allele across all versions. Superseded rows (valid_to IS NOT NULL) are preserved for - # point-in-time queries. - op.create_index( - "uq_clinvar_allele_links_live", - "clinvar_allele_links", - ["allele_id", "clinvar_control_id"], - unique=True, - postgresql_where=sa.text("valid_to IS NULL"), - ) - - -def downgrade() -> None: - op.drop_index("uq_clinvar_allele_links_live", table_name="clinvar_allele_links") - op.drop_index("ix_clinvar_allele_links_clinvar_control_id", table_name="clinvar_allele_links") - op.drop_index("ix_clinvar_allele_links_allele_id", table_name="clinvar_allele_links") - op.drop_table("clinvar_allele_links") diff --git a/alembic/versions/c3d5e7f9a1b2_temporal_mapping_record_alleles.py b/alembic/versions/c3d5e7f9a1b2_temporal_mapping_record_alleles.py deleted file mode 100644 index 26d3d6dbf..000000000 --- a/alembic/versions/c3d5e7f9a1b2_temporal_mapping_record_alleles.py +++ /dev/null @@ -1,48 +0,0 @@ -"""add valid-time versioning to mapping_record_alleles - -Revision ID: c3d5e7f9a1b2 -Revises: b8e1f0a2c4d7 -Create Date: 2026-06-05 - -Make the link table valid-time versioned (TemporalLink): a link is live while valid_to is -NULL, and superseding it closes valid_to instead of deleting, so reverse translation can be -re-run independently while prior derivations remain queryable point-in-time. The partial -unique index enforces a single live link per (mapping_record, allele). - -Assumes no pre-existing duplicate live links — true for these parallel tables, which are -new-only writes and not yet serving. If this ever runs against data with duplicates, the -unique index creation will fail and the duplicates must be retired first. -""" - -import sqlalchemy as sa -from alembic import op - -# revision identifiers, used by Alembic. -revision = "c3d5e7f9a1b2" -down_revision = "b8e1f0a2c4d7" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.add_column( - "mapping_record_alleles", - sa.Column("valid_from", sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()), - ) - op.add_column( - "mapping_record_alleles", - sa.Column("valid_to", sa.DateTime(timezone=True), nullable=True), - ) - op.create_index( - "uq_mapping_record_alleles_live", - "mapping_record_alleles", - ["mapping_record_id", "allele_id"], - unique=True, - postgresql_where=sa.text("valid_to IS NULL"), - ) - - -def downgrade() -> None: - op.drop_index("uq_mapping_record_alleles_live", table_name="mapping_record_alleles") - op.drop_column("mapping_record_alleles", "valid_to") - op.drop_column("mapping_record_alleles", "valid_from") diff --git a/alembic/versions/c404b6719110_collections_data_model.py b/alembic/versions/c404b6719110_collections_data_model.py deleted file mode 100644 index a1f4e2eec..000000000 --- a/alembic/versions/c404b6719110_collections_data_model.py +++ /dev/null @@ -1,117 +0,0 @@ -"""Collections data model - -Revision ID: c404b6719110 -Revises: aa73d39b3705 -Create Date: 2024-10-15 12:57:29.682271 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "c404b6719110" -down_revision = "aa73d39b3705" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "collections", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("urn", sa.String(length=64), nullable=True), - sa.Column("private", sa.Boolean(), nullable=False), - sa.Column("name", sa.String(), nullable=False), - sa.Column("badge_name", sa.String(), nullable=True), - sa.Column("description", sa.String(), nullable=True), - sa.Column("created_by_id", sa.Integer(), nullable=True), - sa.Column("modified_by_id", sa.Integer(), nullable=True), - sa.Column("creation_date", sa.Date(), nullable=False), - sa.Column("modification_date", sa.Date(), nullable=False), - sa.ForeignKeyConstraint( - ["created_by_id"], - ["users.id"], - ), - sa.ForeignKeyConstraint( - ["modified_by_id"], - ["users.id"], - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index(op.f("ix_collections_created_by_id"), "collections", ["created_by_id"], unique=False) - op.create_index(op.f("ix_collections_modified_by_id"), "collections", ["modified_by_id"], unique=False) - op.create_index(op.f("ix_collections_urn"), "collections", ["urn"], unique=True) - - op.create_table( - "collection_user_associations", - sa.Column("collection_id", sa.Integer(), nullable=False), - sa.Column("user_id", sa.Integer(), nullable=False), - sa.Column( - "contribution_role", - sa.Enum( - "admin", - "editor", - "viewer", - name="contributionrole", - native_enum=False, - create_constraint=True, - length=32, - ), - nullable=False, - ), - sa.ForeignKeyConstraint( - ["collection_id"], - ["collections.id"], - ), - sa.ForeignKeyConstraint( - ["user_id"], - ["users.id"], - ), - sa.PrimaryKeyConstraint("collection_id", "user_id"), - ) - - op.create_table( - "collection_experiments", - sa.Column("collection_id", sa.Integer(), nullable=False), - sa.Column("experiment_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["collection_id"], - ["collections.id"], - ), - sa.ForeignKeyConstraint( - ["experiment_id"], - ["experiments.id"], - ), - sa.PrimaryKeyConstraint("collection_id", "experiment_id"), - ) - - op.create_table( - "collection_score_sets", - sa.Column("collection_id", sa.Integer(), nullable=False), - sa.Column("score_set_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["collection_id"], - ["collections.id"], - ), - sa.ForeignKeyConstraint( - ["score_set_id"], - ["scoresets.id"], - ), - sa.PrimaryKeyConstraint("collection_id", "score_set_id"), - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table("collection_score_sets") - op.drop_table("collection_experiments") - op.drop_table("collection_user_associations") - op.drop_index(op.f("ix_collections_urn"), table_name="collections") - op.drop_index(op.f("ix_collections_modified_by_id"), table_name="collections") - op.drop_index(op.f("ix_collections_created_by_id"), table_name="collections") - op.drop_table("collections") - # ### end Alembic commands ### diff --git a/alembic/versions/c4b18d0f7a92_add_urn_redirects.py b/alembic/versions/c4b18d0f7a92_add_urn_redirects.py deleted file mode 100644 index 043ea825f..000000000 --- a/alembic/versions/c4b18d0f7a92_add_urn_redirects.py +++ /dev/null @@ -1,35 +0,0 @@ -"""Add urn_redirects, forwarding URNs that publication has retired - -Revision ID: c4b18d0f7a92 -Revises: 393764b9e833 -Create Date: 2026-09-01 00:00:00.000000 - -""" - -import sqlalchemy as sa -from alembic import op - -# revision identifiers, used by Alembic. -revision = "c4b18d0f7a92" -down_revision = "393764b9e833" -branch_labels = None -depends_on = None - - -def upgrade(): - # Not backfilled: publication overwrote each record's temporary URN in place and kept no history of - # it, so the URNs retired before this table existed cannot be recovered. - op.create_table( - "urn_redirects", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("old_urn", sa.String(length=64), nullable=False), - sa.Column("new_urn", sa.String(length=64), nullable=False), - sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=False), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index("ix_urn_redirects_old_urn", "urn_redirects", ["old_urn"], unique=True) - - -def downgrade(): - op.drop_index("ix_urn_redirects_old_urn", table_name="urn_redirects") - op.drop_table("urn_redirects") diff --git a/alembic/versions/c5e1a9d4b7f2_add_projection_groups.py b/alembic/versions/c5e1a9d4b7f2_add_projection_groups.py deleted file mode 100644 index b3762678e..000000000 --- a/alembic/versions/c5e1a9d4b7f2_add_projection_groups.py +++ /dev/null @@ -1,75 +0,0 @@ -"""add projection groups - -Revision ID: c5e1a9d4b7f2 -Revises: b4d8f2a6c1e3 -Create Date: 2026-10-14 - -Makes ``mapping_record_alleles.projection_group`` a foreign key to a ``projection_groups`` row that holds -the group's coding, genomic and protein HGVS. A group's levels need not all have an allele: an intronic -coding projection has no VRS representation but is still the variant's coding coordinate. - -The composite foreign key on ``(projection_group, mapping_record_id)`` keeps a link inside its own record's -groups. Existing group numbers name no row, so they are cleared; re-run the projection step and reverse -translation to rebuild them. Production has none after the substrate backfill, which writes no groups. -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "c5e1a9d4b7f2" -down_revision = "b4d8f2a6c1e3" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.create_table( - "projection_groups", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("mapping_record_id", sa.Integer(), nullable=False), - sa.Column("score_set_id", sa.Integer(), nullable=False), - sa.Column("hgvs_c", sa.String(), nullable=True), - sa.Column("hgvs_g", sa.String(), nullable=True), - sa.Column("hgvs_p", sa.String(), nullable=True), - sa.Column("valid_from", sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()), - sa.Column("valid_to", sa.DateTime(timezone=True), nullable=True), - sa.ForeignKeyConstraint( - ["mapping_record_id", "score_set_id"], - ["mapping_records.id", "mapping_records.score_set_id"], - name="fk_projection_groups_mapping_record_score_set", - ondelete="CASCADE", - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index("ix_projection_groups_mapping_record_id", "projection_groups", ["mapping_record_id"]) - # Target of mapping_record_alleles' composite foreign key, which keeps a link inside its own record's groups. - op.create_index( - "uq_projection_groups_id_mapping_record", "projection_groups", ["id", "mapping_record_id"], unique=True - ) - - # Existing group numbers name no row. - mapping_record_alleles = sa.table("mapping_record_alleles", sa.column("projection_group", sa.Integer)) - op.execute( - mapping_record_alleles.update() - .where(mapping_record_alleles.c.projection_group.isnot(None)) - .values(projection_group=None) - ) - op.create_foreign_key( - "fk_mapping_record_alleles_projection_group", - "mapping_record_alleles", - "projection_groups", - ["projection_group", "mapping_record_id"], - ["id", "mapping_record_id"], - ondelete="CASCADE", - ) - op.create_index("ix_mapping_record_alleles_projection_group", "mapping_record_alleles", ["projection_group"]) - - -def downgrade() -> None: - op.drop_index("ix_mapping_record_alleles_projection_group", table_name="mapping_record_alleles") - op.drop_constraint("fk_mapping_record_alleles_projection_group", "mapping_record_alleles", type_="foreignkey") - op.drop_index("uq_projection_groups_id_mapping_record", table_name="projection_groups") - op.drop_index("ix_projection_groups_mapping_record_id", table_name="projection_groups") - op.drop_table("projection_groups") diff --git a/alembic/versions/c5e1a9d4b7f2_baseline_2026_3_0.py b/alembic/versions/c5e1a9d4b7f2_baseline_2026_3_0.py new file mode 100644 index 000000000..8d88909eb --- /dev/null +++ b/alembic/versions/c5e1a9d4b7f2_baseline_2026_3_0.py @@ -0,0 +1,35 @@ +"""baseline: schema as of release 2026.3.0 + +Revision ID: c5e1a9d4b7f2 +Revises: +Create Date: 2026-10-19 + +Replaces every revision up to and including 2026.3.0's head, keeping that head's ID so databases already +there need no restamp. Builds the schema and seed vocabulary from ``alembic/baseline/c5e1a9d4b7f2.sql``, +written by ``bin/build-baseline`` from production. See ``alembic/README.md``. +""" + +from pathlib import Path + +from alembic import op + +# revision identifiers, used by Alembic. +revision = "c5e1a9d4b7f2" +down_revision = None +branch_labels = None +depends_on = None + +BASELINE = Path(__file__).resolve().parent.parent / "baseline" / f"{revision}.sql" + + +def upgrade(): + # Function bodies in the dump can reference tables created later in it. The upgrade runs in one + # transaction, so the setting is restored for the migrations that follow. + op.execute("SET LOCAL check_function_bodies = false") + # Executed by the driver directly, so SQLAlchemy doesn't read ``:name`` in the dump as a bind parameter. + op.get_bind().exec_driver_sql(BASELINE.read_text()) + op.execute("SET LOCAL check_function_bodies = DEFAULT") + + +def downgrade(): + raise NotImplementedError("The baseline can't be downgraded. Restore from a snapshot instead.") diff --git a/alembic/versions/c6154dd7d9b9_add_gene_name_column_to_target_.py b/alembic/versions/c6154dd7d9b9_add_gene_name_column_to_target_.py deleted file mode 100644 index 4c5d55d60..000000000 --- a/alembic/versions/c6154dd7d9b9_add_gene_name_column_to_target_.py +++ /dev/null @@ -1,31 +0,0 @@ -"""Add gene name column to target accession definition - -Revision ID: c6154dd7d9b9 -Revises: 60103ad1cb5b -Create Date: 2023-10-04 17:00:42.960917 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "c6154dd7d9b9" -down_revision = "60103ad1cb5b" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column("target_accessions", sa.Column("gene", sa.String(), nullable=True)) - op.alter_column("target_accessions", "assembly", nullable=True) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column("target_accessions", "gene") - op.alter_column("target_accessions", "assembly", nullable=False) - # ### end Alembic commands ### diff --git a/alembic/versions/c6d9e3f7a8b2_add_annotation_failure_category_check.py b/alembic/versions/c6d9e3f7a8b2_add_annotation_failure_category_check.py deleted file mode 100644 index 886a16ccf..000000000 --- a/alembic/versions/c6d9e3f7a8b2_add_annotation_failure_category_check.py +++ /dev/null @@ -1,69 +0,0 @@ -"""add annotation failure category check constraint - -Revision ID: c6d9e3f7a8b2 -Revises: b5c8d2e4f6a7 -Create Date: 2026-04-20 - -Adds a CHECK constraint on variant_annotation_status.failure_category to enforce -the AnnotationFailureCategory enum values. Also migrates existing free-text -failure_category values to their corresponding enum values. -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "c6d9e3f7a8b2" -down_revision = "b5c8d2e4f6a7" -branch_labels = None -depends_on = None - -# Mapping from old free-text values to new enum values -OLD_TO_NEW = { - "missing_clingen_allele_id": "missing_identifier", - "multi_variant_clingen_allele_id": "unsupported_identifier", - "invalid_allele_format": "unsupported_identifier", - "clingen_api_error": "external_api_error", - "not_found": "external_reference_not_found", - "clingen_allele_not_found": "external_reference_not_found", - "no_associated_clinvar_allele_id": "no_linked_allele", - "no_canonical_pa_ids": "no_linked_allele", - "no_registered_ca_ids": "no_linked_allele", -} - - -def upgrade() -> None: - # Migrate existing free-text values to enum values - for old_value, new_value in OLD_TO_NEW.items(): - op.execute( - f"UPDATE variant_annotation_status SET failure_category = '{new_value}' " - f"WHERE failure_category = '{old_value}'" - ) - - # Set any remaining non-null values that don't match known enum values to 'unknown' - valid_values = "', '".join( - [ - "missing_identifier", - "unsupported_identifier", - "external_api_error", - "external_reference_not_found", - "no_linked_allele", - "unknown", - ] - ) - op.execute( - f"UPDATE variant_annotation_status SET failure_category = 'unknown' " - f"WHERE failure_category IS NOT NULL AND failure_category NOT IN ('{valid_values}')" - ) - - # Add the check constraint - op.create_check_constraint( - "ck_variant_annotation_failure_category_valid", - "variant_annotation_status", - "failure_category IS NULL OR failure_category IN " - "('missing_identifier', 'unsupported_identifier', 'external_api_error', " - "'external_reference_not_found', 'no_linked_allele', 'unknown')", - ) - - -def downgrade() -> None: - op.drop_constraint("ck_variant_annotation_failure_category_valid", "variant_annotation_status", type_="check") diff --git a/alembic/versions/c770fa9e6e58_drop_functional_range_jsonb.py b/alembic/versions/c770fa9e6e58_drop_functional_range_jsonb.py deleted file mode 100644 index 3b1e7998c..000000000 --- a/alembic/versions/c770fa9e6e58_drop_functional_range_jsonb.py +++ /dev/null @@ -1,38 +0,0 @@ -"""drop functional range jsonb - -Revision ID: c770fa9e6e58 -Revises: 16beeb593513 -Create Date: 2025-11-17 22:19:22.440742 - -""" - -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "c770fa9e6e58" -down_revision = "16beeb593513" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column("score_calibrations", "functional_ranges_deprecated_json") - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column( - "score_calibrations", - sa.Column( - "functional_ranges_deprecated_json", - postgresql.JSONB(astext_type=sa.Text()), - autoincrement=False, - nullable=True, - ), - ) - # ### end Alembic commands ### diff --git a/alembic/versions/c9b2a4f8e1d3_index_annotation_event_score_set_id.py b/alembic/versions/c9b2a4f8e1d3_index_annotation_event_score_set_id.py deleted file mode 100644 index 13c206931..000000000 --- a/alembic/versions/c9b2a4f8e1d3_index_annotation_event_score_set_id.py +++ /dev/null @@ -1,27 +0,0 @@ -"""index annotation_event.score_set_id - -Revision ID: c9b2a4f8e1d3 -Revises: b8f2c5a1d3e4 -Create Date: 2026-06-30 - -Adds the missing foreign-key index on annotation_event.score_set_id. Every other FK on this table -is indexed; score_set_id was not. The index backs the ON DELETE SET NULL cascade fired when a score -set is deleted (an unindexed FK forces a sequential scan of the event log per deleted score set) and -any operator/BI query that filters the log by score set. -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "c9b2a4f8e1d3" -down_revision = "b8f2c5a1d3e4" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.create_index("ix_annotation_event_score_set_id", "annotation_event", ["score_set_id"], unique=False) - - -def downgrade() -> None: - op.drop_index("ix_annotation_event_score_set_id", table_name="annotation_event") diff --git a/alembic/versions/d1c9b7a3e2f4_add_job_run_id_to_target_gene_mappings.py b/alembic/versions/d1c9b7a3e2f4_add_job_run_id_to_target_gene_mappings.py deleted file mode 100644 index 744f3f72d..000000000 --- a/alembic/versions/d1c9b7a3e2f4_add_job_run_id_to_target_gene_mappings.py +++ /dev/null @@ -1,45 +0,0 @@ -"""add job_run_id to target_gene_mappings - -Revision ID: d1c9b7a3e2f4 -Revises: a3f9c2e1b7d6 -Create Date: 2026-09-02 - -Adds a nullable ``job_run_id`` (FK ``job_runs``, ``ON DELETE SET NULL``) recording the mapping job that -produced each row. Reverse translation uses it to bind a variant's cross-level transcript to its *own* run's -cdna alignment rather than to any same-day run's (#763): the day-granular ``mapped_date`` key it previously -used cannot tell two runs on one calendar day apart, so a same-day remap that emits no cdna row would bind the -earlier run's stale transcript instead of correctly skipping. - -Nullable, no backfill: rows written before this migration keep NULL and fall back to the coarser -``(target_gene_id, mapped_date)`` match. ``SET NULL`` so a pruned job_run degrades to that fallback rather -than dangling. -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "d1c9b7a3e2f4" -down_revision = "a3f9c2e1b7d6" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.add_column("target_gene_mappings", sa.Column("job_run_id", sa.Integer(), nullable=True)) - op.create_foreign_key( - "fk_target_gene_mappings_job_run_id", - "target_gene_mappings", - "job_runs", - ["job_run_id"], - ["id"], - ondelete="SET NULL", - ) - op.create_index("ix_target_gene_mappings_job_run_id", "target_gene_mappings", ["job_run_id"]) - - -def downgrade() -> None: - op.drop_index("ix_target_gene_mappings_job_run_id", table_name="target_gene_mappings") - op.drop_constraint("fk_target_gene_mappings_job_run_id", "target_gene_mappings", type_="foreignkey") - op.drop_column("target_gene_mappings", "job_run_id") diff --git a/alembic/versions/d1f4a2e9c05b_drop_job_run_priority_column.py b/alembic/versions/d1f4a2e9c05b_drop_job_run_priority_column.py deleted file mode 100644 index 413453d47..000000000 --- a/alembic/versions/d1f4a2e9c05b_drop_job_run_priority_column.py +++ /dev/null @@ -1,28 +0,0 @@ -"""drop job_run priority column - -Revision ID: d1f4a2e9c05b -Revises: c6d9e3f7a8b2 -Create Date: 2026-04-21 00:00:00.000000 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "d1f4a2e9c05b" -down_revision = "c6d9e3f7a8b2" -branch_labels = None -depends_on = None - - -def upgrade(): - op.drop_constraint("ck_job_runs_priority_positive", "job_runs", type_="check") - op.drop_column("job_runs", "priority") - - -def downgrade(): - op.add_column("job_runs", sa.Column("priority", sa.Integer(), nullable=False, server_default="0")) - op.create_check_constraint("ck_job_runs_priority_positive", "job_runs", "priority >= 0") - op.alter_column("job_runs", "priority", server_default=None) diff --git a/alembic/versions/d4e5f6a7b8c9_add_clinvar_variation_id.py b/alembic/versions/d4e5f6a7b8c9_add_clinvar_variation_id.py deleted file mode 100644 index de5758b4c..000000000 --- a/alembic/versions/d4e5f6a7b8c9_add_clinvar_variation_id.py +++ /dev/null @@ -1,29 +0,0 @@ -"""add clinvar_variation_id to clinvar_controls - -Revision ID: d4e5f6a7b8c9 -Revises: c3d4e5f6a7b8 -Create Date: 2026-06-22 - -Additive, non-breaking column for ClinVar's canonical public identifier (VariationID), captured forward -from the variant_summary TSV. db_identifier continues to hold the AlleleID (the allele-level handle used -for gnomAD cross-references); this carries the VariationID beside it for eventual external ClinVar links -(clinvar/variation/{id}). Nullable and not yet served — the dedicated clinvar_variants remodel (explicit -fields replacing the generic db_* shape, the serving/UI cutover, and backfill of existing rows) is -deferred. -""" - -import sqlalchemy as sa -from alembic import op - -revision = "d4e5f6a7b8c9" -down_revision = "c3d4e5f6a7b8" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.add_column("clinvar_controls", sa.Column("clinvar_variation_id", sa.String(), nullable=True)) - - -def downgrade() -> None: - op.drop_column("clinvar_controls", "clinvar_variation_id") diff --git a/alembic/versions/d4e6f8a0b2c3_temporal_mapping_records.py b/alembic/versions/d4e6f8a0b2c3_temporal_mapping_records.py deleted file mode 100644 index 603c171a5..000000000 --- a/alembic/versions/d4e6f8a0b2c3_temporal_mapping_records.py +++ /dev/null @@ -1,76 +0,0 @@ -"""move mapping_records onto valid-time versioning - -Revision ID: d4e6f8a0b2c3 -Revises: c3d5e7f9a1b2 -Create Date: 2026-06-05 - -Replace the stored `current` flag and the `created_at`/`updated_at` audit dates with valid-time -columns (ValidTime mixin): a mapping record is live while valid_to is NULL, and a re-map retires -the prior version (closing valid_to) instead of flipping a boolean. `current` becomes derived -(valid_to IS NULL). `mapped_date` (the date the mapping was performed) is domain data and stays. - -The partial unique index promotes to the database the "one live mapping record per variant" -invariant the mapping job previously enforced only in app code. - -Backfills from the columns being dropped, so existing rows keep their validity. Assumes no -duplicate live records per variant (true for these pre-cutover parallel tables; otherwise the -unique index creation fails and the duplicates must be retired first). -""" - -import sqlalchemy as sa -from alembic import op - -# revision identifiers, used by Alembic. -revision = "d4e6f8a0b2c3" -down_revision = "c3d5e7f9a1b2" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.add_column( - "mapping_records", - sa.Column("valid_from", sa.DateTime(timezone=True), nullable=True, server_default=sa.func.now()), - ) - op.add_column( - "mapping_records", - sa.Column("valid_to", sa.DateTime(timezone=True), nullable=True), - ) - - # Backfill validity from the columns being replaced: a record's life began at created_at, and - # a non-current record was retired at updated_at (the only in-place update it ever took). - op.execute("UPDATE mapping_records SET valid_from = created_at::timestamptz") - op.execute("UPDATE mapping_records SET valid_to = updated_at::timestamptz WHERE current = false") - - op.alter_column("mapping_records", "valid_from", nullable=False) - - op.drop_column("mapping_records", "current") - op.drop_column("mapping_records", "created_at") - op.drop_column("mapping_records", "updated_at") - - op.create_index( - "uq_mapping_records_current", - "mapping_records", - ["variant_id"], - unique=True, - postgresql_where=sa.text("valid_to IS NULL"), - ) - - -def downgrade() -> None: - op.drop_index("uq_mapping_records_current", table_name="mapping_records") - - op.add_column("mapping_records", sa.Column("current", sa.Boolean(), nullable=True)) - op.add_column("mapping_records", sa.Column("created_at", sa.Date(), nullable=True)) - op.add_column("mapping_records", sa.Column("updated_at", sa.Date(), nullable=True)) - - op.execute("UPDATE mapping_records SET current = (valid_to IS NULL)") - op.execute("UPDATE mapping_records SET created_at = valid_from::date") - op.execute("UPDATE mapping_records SET updated_at = coalesce(valid_to, valid_from)::date") - - op.alter_column("mapping_records", "current", nullable=False) - op.alter_column("mapping_records", "created_at", nullable=False) - op.alter_column("mapping_records", "updated_at", nullable=False) - - op.drop_column("mapping_records", "valid_to") - op.drop_column("mapping_records", "valid_from") diff --git a/alembic/versions/d6e5a9fde3c9_move_clingen_allele_id_to_mapped_.py b/alembic/versions/d6e5a9fde3c9_move_clingen_allele_id_to_mapped_.py deleted file mode 100644 index c6decaf6a..000000000 --- a/alembic/versions/d6e5a9fde3c9_move_clingen_allele_id_to_mapped_.py +++ /dev/null @@ -1,53 +0,0 @@ -"""move clingen allele id to mapped variants table - -Revision ID: d6e5a9fde3c9 -Revises: 695b73abe581 -Create Date: 2025-02-19 10:51:07.319962 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "d6e5a9fde3c9" -down_revision = "695b73abe581" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index("ix_variants_clingen_allele_id", table_name="variants") - op.add_column("mapped_variants", sa.Column("clingen_allele_id", sa.String(), nullable=True)) - op.execute( - """ - UPDATE mapped_variants - SET clingen_allele_id=variants.clingen_allele_id - FROM variants - WHERE variants.id=mapped_variants.variant_id - """ - ) - op.drop_column("variants", "clingen_allele_id") - op.create_index( - op.f("ix_mapped_variants_clingen_allele_id"), "mapped_variants", ["clingen_allele_id"], unique=False - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f("ix_mapped_variants_clingen_allele_id"), table_name="mapped_variants") - op.add_column("variants", sa.Column("clingen_allele_id", sa.String(), nullable=True)) - op.execute( - """ - UPDATE variants - SET clingen_allele_id=mapped_variants.clingen_allele_id - FROM mapped_variants - WHERE variants.id=mapped_variants.variant_id - """ - ) - op.drop_column("mapped_variants", "clingen_allele_id") - op.create_index("ix_variants_clingen_allele_id", "variants", ["clingen_allele_id"], unique=False) - # ### end Alembic commands ### diff --git a/alembic/versions/d7a3e9c1f5b2_cover_variant_number_index_with_urn.py b/alembic/versions/d7a3e9c1f5b2_cover_variant_number_index_with_urn.py new file mode 100644 index 000000000..75507e3a0 --- /dev/null +++ b/alembic/versions/d7a3e9c1f5b2_cover_variant_number_index_with_urn.py @@ -0,0 +1,43 @@ +"""cover the variant number index with urn + +Score set CSV pages select their variant ids in variant-number order before fetching full rows. Postgres won't use +an index-only scan on an expression index unless the expression's columns are in the index too, so without ``urn`` +every row before ``start`` is still read from the table. This replaces ``ix_variants_scoreset_number`` with the same +index plus ``INCLUDE (urn)``. + +Building it takes a lock that blocks writes to ``variants``, so in a populated database build it and drop the old one +by hand first, which makes this migration a no-op: + + CREATE INDEX CONCURRENTLY IF NOT EXISTS ix_variants_scoreset_number_covering + ON variants (scoreset_id, (CAST(split_part(urn, '#', 2) AS INTEGER)), id) INCLUDE (urn); + DROP INDEX CONCURRENTLY IF EXISTS ix_variants_scoreset_number; + +Revision ID: d7a3e9c1f5b2 +Revises: c5e1a9d4b7f2 +Create Date: 2026-10-20 + +""" + +from alembic import op + +# revision identifiers, used by Alembic. +revision = "d7a3e9c1f5b2" +down_revision = "c5e1a9d4b7f2" +branch_labels = None +depends_on = None + + +def upgrade(): + op.execute( + "CREATE INDEX IF NOT EXISTS ix_variants_scoreset_number_covering " + "ON variants (scoreset_id, (CAST(split_part(urn, '#', 2) AS INTEGER)), id) INCLUDE (urn)" + ) + op.execute("DROP INDEX IF EXISTS ix_variants_scoreset_number") + + +def downgrade(): + op.execute( + "CREATE INDEX IF NOT EXISTS ix_variants_scoreset_number " + "ON variants (scoreset_id, (CAST(split_part(urn, '#', 2) AS INTEGER)), id)" + ) + op.execute("DROP INDEX IF EXISTS ix_variants_scoreset_number_covering") diff --git a/alembic/versions/d7e6f8c3b9dc_scoreset_mapping_columns.py b/alembic/versions/d7e6f8c3b9dc_scoreset_mapping_columns.py deleted file mode 100644 index c55c1d5ac..000000000 --- a/alembic/versions/d7e6f8c3b9dc_scoreset_mapping_columns.py +++ /dev/null @@ -1,48 +0,0 @@ -"""scoreset_mapping_columns - -Revision ID: d7e6f8c3b9dc -Revises: f36cf612e029 -Create Date: 2024-08-28 09:54:08.249077 - -""" - -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "d7e6f8c3b9dc" -down_revision = "f36cf612e029" -branch_labels = None -depends_on = None - - -def upgrade(): - op.add_column( - "scoresets", - sa.Column( - "mapping_state", - sa.Enum( - "incomplete", - "processing", - "failed", - "complete", - "pending_variant_processing", - "not_attempted", - "queued", - name="mappingstate", - native_enum=False, - create_constraint=True, - length=32, - ), - nullable=True, - ), - ) - op.add_column("scoresets", sa.Column("mapping_errors", postgresql.JSONB, nullable=True)) - - -def downgrade(): - op.drop_constraint("mappingstate", table_name="scoresets") - op.drop_column("scoresets", "mapping_state") - op.drop_column("scoresets", "mapping_errors") diff --git a/alembic/versions/da9ba478647d_add_primary_publication.py b/alembic/versions/da9ba478647d_add_primary_publication.py deleted file mode 100644 index 052f2a7a5..000000000 --- a/alembic/versions/da9ba478647d_add_primary_publication.py +++ /dev/null @@ -1,65 +0,0 @@ -"""Add primary publication - -Revision ID: da9ba478647d -Revises: 5cad62af3705 -Create Date: 2023-05-10 16:45:22.869575 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "da9ba478647d" -down_revision = "5cad62af3705" -branch_labels = None -depends_on = None - - -def upgrade(): - op.add_column( - table_name="experiment_publication_identifiers", - column=sa.Column("primary", sa.Boolean, nullable=True), - ) - op.add_column( - table_name="scoreset_publication_identifiers", - column=sa.Column("primary", sa.Boolean, nullable=True), - ) - - # data migration to set the linked publication identifier of all existing - # experiments/scoresets with only one linked publication identifier to be - # the primary publication - op.execute( - """ - UPDATE experiment_publication_identifiers - SET "primary" = TRUE - WHERE - "primary" IS NULL AND - experiment_id IN ( - SELECT experiment_id - FROM experiment_publication_identifiers - GROUP BY experiment_id - HAVING Count(*) = 1 - ) - """ - ) - op.execute( - """ - UPDATE scoreset_publication_identifiers - SET "primary" = TRUE - WHERE - "primary" IS NULL AND - scoreset_id IN ( - SELECT scoreset_id - FROM scoreset_publication_identifiers - GROUP BY scoreset_id - HAVING Count(*) = 1 - ) - """ - ) - - -def downgrade(): - op.drop_column(table_name="experiment_publication_identifiers", column_name="primary") - op.drop_column(table_name="scoreset_publication_identifiers", column_name="primary") diff --git a/alembic/versions/dcf8572d3a17_add_mapped_hgnc_name_to_targets.py b/alembic/versions/dcf8572d3a17_add_mapped_hgnc_name_to_targets.py deleted file mode 100644 index 53844a3fe..000000000 --- a/alembic/versions/dcf8572d3a17_add_mapped_hgnc_name_to_targets.py +++ /dev/null @@ -1,29 +0,0 @@ -"""add mapped hgnc name to targets - -Revision ID: dcf8572d3a17 -Revises: 00dab0f5f498 -Create Date: 2025-12-12 17:32:40.147429 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "dcf8572d3a17" -down_revision = "00dab0f5f498" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column("target_genes", sa.Column("mapped_hgnc_name", sa.String(), nullable=True)) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column("target_genes", "mapped_hgnc_name") - # ### end Alembic commands ### diff --git a/alembic/versions/e1f2a3b4c5d6_add_position_column_to_collection_associations.py b/alembic/versions/e1f2a3b4c5d6_add_position_column_to_collection_associations.py deleted file mode 100644 index 1fa1839f8..000000000 --- a/alembic/versions/e1f2a3b4c5d6_add_position_column_to_collection_associations.py +++ /dev/null @@ -1,69 +0,0 @@ -"""add position column to collection associations for ordering - -Revision ID: e1f2a3b4c5d6 -Revises: dcf8572d3a17 -Create Date: 2026-02-13 10:00:00.000000 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "e1f2a3b4c5d6" -down_revision = "dcf8572d3a17" -branch_labels = None -depends_on = None - - -def upgrade(): - """ - Add position column to collection association tables to support user-controlled ordering. - Backfills existing rows with sequential positions ordered by the foreign key ID. - """ - # 1. Add column with a temporary server default so existing rows are valid. - op.add_column("collection_score_sets", sa.Column("position", sa.Integer(), nullable=False, server_default="0")) - op.add_column("collection_experiments", sa.Column("position", sa.Integer(), nullable=False, server_default="0")) - - # 2. Backfill: assign sequential positions within each collection, ordered by score_set_id / experiment_id ASC. - # This gives existing rows a deterministic order rather than all sharing position 0. - conn = op.get_bind() - conn.execute( - sa.text( - """ - UPDATE collection_score_sets AS css - SET position = sub.rn - FROM ( - SELECT collection_id, score_set_id, - ROW_NUMBER() OVER (PARTITION BY collection_id ORDER BY score_set_id) - 1 AS rn - FROM collection_score_sets - ) AS sub - WHERE css.collection_id = sub.collection_id AND css.score_set_id = sub.score_set_id - """ - ) - ) - conn.execute( - sa.text( - """ - UPDATE collection_experiments AS ce - SET position = sub.rn - FROM ( - SELECT collection_id, experiment_id, - ROW_NUMBER() OVER (PARTITION BY collection_id ORDER BY experiment_id) - 1 AS rn - FROM collection_experiments - ) AS sub - WHERE ce.collection_id = sub.collection_id AND ce.experiment_id = sub.experiment_id - """ - ) - ) - - # 3. Remove server defaults — the ORM model's `default=0` handles new inserts. - op.alter_column("collection_score_sets", "position", server_default=None) - op.alter_column("collection_experiments", "position", server_default=None) - - -def downgrade(): - """Remove position columns from collection association tables.""" - op.drop_column("collection_experiments", "position") - op.drop_column("collection_score_sets", "position") diff --git a/alembic/versions/e3a7b9f1d2c5_add_external_service_rejected_failure_category.py b/alembic/versions/e3a7b9f1d2c5_add_external_service_rejected_failure_category.py deleted file mode 100644 index 25283981f..000000000 --- a/alembic/versions/e3a7b9f1d2c5_add_external_service_rejected_failure_category.py +++ /dev/null @@ -1,52 +0,0 @@ -"""add external_service_rejected annotation failure category - -Revision ID: e3a7b9f1d2c5 -Revises: d1f4a2e9c05b -Create Date: 2026-04-24 - -Extends the failure_category CHECK constraint on variant_annotation_status to include -'external_service_rejected', which distinguishes explicit rejections by an external -service (e.g. CAR returning InvalidHGVS) from generic API errors (network failures, -timeouts, etc.). -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "e3a7b9f1d2c5" -down_revision = "d1f4a2e9c05b" -branch_labels = None -depends_on = None - -OLD_VALID_VALUES = ( - "('missing_identifier', 'unsupported_identifier', 'external_api_error', " - "'external_reference_not_found', 'no_linked_allele', 'unknown')" -) -NEW_VALID_VALUES = ( - "('missing_identifier', 'unsupported_identifier', 'external_api_error', " - "'external_service_rejected', 'external_reference_not_found', 'no_linked_allele', 'unknown')" -) - - -def upgrade() -> None: - op.drop_constraint("ck_variant_annotation_failure_category_valid", "variant_annotation_status", type_="check") - op.create_check_constraint( - "ck_variant_annotation_failure_category_valid", - "variant_annotation_status", - f"failure_category IS NULL OR failure_category IN {NEW_VALID_VALUES}", - ) - - -def downgrade() -> None: - # Reclassify any 'external_service_rejected' rows back to 'external_api_error' before - # dropping the new value from the constraint. - op.execute( - "UPDATE variant_annotation_status SET failure_category = 'external_api_error' " - "WHERE failure_category = 'external_service_rejected'" - ) - op.drop_constraint("ck_variant_annotation_failure_category_valid", "variant_annotation_status", type_="check") - op.create_check_constraint( - "ck_variant_annotation_failure_category_valid", - "variant_annotation_status", - f"failure_category IS NULL OR failure_category IN {OLD_VALID_VALUES}", - ) diff --git a/alembic/versions/e5f7a9c1b3d4_add_gnomad_allele_links.py b/alembic/versions/e5f7a9c1b3d4_add_gnomad_allele_links.py deleted file mode 100644 index 54f3e3d58..000000000 --- a/alembic/versions/e5f7a9c1b3d4_add_gnomad_allele_links.py +++ /dev/null @@ -1,71 +0,0 @@ -"""add gnomad_allele_links table - -Revision ID: e5f7a9c1b3d4 -Revises: d4e6f8a0b2c3 -Create Date: 2026-06-18 - -New valid-time link table connecting deduplicated alleles to gnomAD variants, replacing the frozen -gnomad_variants_mapped_variants association for new-model writes (Step 1 of the annotation -infrastructure migration, docs/design/annotation-infrastructure-migration.md). A link is live while -valid_to is NULL; the partial unique index enforces a single live link per (allele, gnomad variant) -pair. The existing gnomad_variants_mapped_variants table is left untouched (frozen serving). -""" - -import sqlalchemy as sa -from alembic import op - -# revision identifiers, used by Alembic. -revision = "e5f7a9c1b3d4" -down_revision = "d4e6f8a0b2c3" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.create_table( - "gnomad_allele_links", - sa.Column("id", sa.Integer(), nullable=False), - sa.Column("allele_id", sa.Integer(), nullable=False), - sa.Column("gnomad_variant_id", sa.Integer(), nullable=False), - sa.Column("valid_from", sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()), - sa.Column("valid_to", sa.DateTime(timezone=True), nullable=True), - sa.ForeignKeyConstraint( - ["allele_id"], - ["alleles.id"], - name="fk_gnomad_allele_links_allele_id", - ondelete="RESTRICT", - ), - sa.ForeignKeyConstraint( - ["gnomad_variant_id"], - ["gnomad_variants.id"], - name="fk_gnomad_allele_links_gnomad_variant_id", - ondelete="RESTRICT", - ), - sa.PrimaryKeyConstraint("id"), - ) - op.create_index( - "ix_gnomad_allele_links_allele_id", - "gnomad_allele_links", - ["allele_id"], - ) - op.create_index( - "ix_gnomad_allele_links_gnomad_variant_id", - "gnomad_allele_links", - ["gnomad_variant_id"], - ) - # One live link per allele: gnomAD frequency is a single current value, so a version bump - # supersedes the prior link rather than accumulating one live link per version. - op.create_index( - "uq_gnomad_allele_links_live", - "gnomad_allele_links", - ["allele_id"], - unique=True, - postgresql_where=sa.text("valid_to IS NULL"), - ) - - -def downgrade() -> None: - op.drop_index("uq_gnomad_allele_links_live", table_name="gnomad_allele_links") - op.drop_index("ix_gnomad_allele_links_gnomad_variant_id", table_name="gnomad_allele_links") - op.drop_index("ix_gnomad_allele_links_allele_id", table_name="gnomad_allele_links") - op.drop_table("gnomad_allele_links") diff --git a/alembic/versions/e7b2c9a1f4d3_add_projection_group_to_mapping_record_alleles.py b/alembic/versions/e7b2c9a1f4d3_add_projection_group_to_mapping_record_alleles.py deleted file mode 100644 index 6d0d0ff7a..000000000 --- a/alembic/versions/e7b2c9a1f4d3_add_projection_group_to_mapping_record_alleles.py +++ /dev/null @@ -1,37 +0,0 @@ -"""add projection_group to mapping_record_alleles - -Revision ID: e7b2c9a1f4d3 -Revises: f1a3c7e9b2d5 -Create Date: 2026-07-08 - -Adds a nullable ``projection_group`` integer column to ``mapping_record_alleles`` — a within-record -grouping key that pairs the coding and genomic links of one reverse-translation projection pair. -The two members of a pair share a value; the shared protein apex is NULL, as is every row written -before reverse translation runs. See the model and the reverse_translation worker for the full -semantics (per-record index, authoritative fold-in). - -No index is added: the per-URN serving fetch is already covered by -``ix_mapping_record_alleles_mapping_record_id`` and a record's link set is small. No backfill: -existing rows stay NULL and re-group lazily on the next re-map / reverse-translation run. -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "e7b2c9a1f4d3" -down_revision = "f1a3c7e9b2d5" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.add_column( - "mapping_record_alleles", - sa.Column("projection_group", sa.Integer(), nullable=True), - ) - - -def downgrade() -> None: - op.drop_column("mapping_record_alleles", "projection_group") diff --git a/alembic/versions/e8a3b5d8f885_add_clingen_allele_ids.py b/alembic/versions/e8a3b5d8f885_add_clingen_allele_ids.py deleted file mode 100644 index da58494a1..000000000 --- a/alembic/versions/e8a3b5d8f885_add_clingen_allele_ids.py +++ /dev/null @@ -1,27 +0,0 @@ -"""Add ClinGen allele IDs - -Revision ID: e8a3b5d8f885 -Revises: 4726e4dddde8 -Create Date: 2025-01-27 18:55:09.283855 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "e8a3b5d8f885" -down_revision = "4726e4dddde8" -branch_labels = None -depends_on = None - - -def upgrade(): - op.add_column("variants", sa.Column("clingen_allele_id", sa.String(), nullable=True)) - op.create_index(op.f("ix_variants_clingen_allele_id"), "variants", ["clingen_allele_id"], unique=False) - - -def downgrade(): - op.drop_index(op.f("ix_variants_clingen_allele_id"), table_name="variants") - op.drop_column("variants", "clingen_allele_id") diff --git a/alembic/versions/ec535fd72270_add_gnomad_variants_association_table.py b/alembic/versions/ec535fd72270_add_gnomad_variants_association_table.py deleted file mode 100644 index ea8c709fc..000000000 --- a/alembic/versions/ec535fd72270_add_gnomad_variants_association_table.py +++ /dev/null @@ -1,42 +0,0 @@ -"""add gnomad variants association table - -Revision ID: ec535fd72270 -Revises: 79b28316dd0c -Create Date: 2025-06-17 08:42:17.728564 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "ec535fd72270" -down_revision = "79b28316dd0c" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_table( - "gnomad_variants_mapped_variants", - sa.Column("mapped_variant_id", sa.Integer(), nullable=False), - sa.Column("gnomad_variant_id", sa.Integer(), nullable=False), - sa.ForeignKeyConstraint( - ["gnomad_variant_id"], - ["gnomad_variants.id"], - ), - sa.ForeignKeyConstraint( - ["mapped_variant_id"], - ["mapped_variants.id"], - ), - sa.PrimaryKeyConstraint("mapped_variant_id", "gnomad_variant_id"), - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_table("gnomad_variants_mapped_variants") - # ### end Alembic commands ### diff --git a/alembic/versions/ec5d2787bec9_external_links.py b/alembic/versions/ec5d2787bec9_external_links.py deleted file mode 100644 index 5df41872e..000000000 --- a/alembic/versions/ec5d2787bec9_external_links.py +++ /dev/null @@ -1,29 +0,0 @@ -"""External links - -Revision ID: ec5d2787bec9 -Revises: 7a345f1bf9c3 -Create Date: 2024-05-29 06:39:17.930675 - -""" - -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "ec5d2787bec9" -down_revision = "7a345f1bf9c3" -branch_labels = None -depends_on = None - - -def upgrade(): - op.add_column( - "scoresets", - sa.Column("external_links", postgresql.JSONB(astext_type=sa.Text()), nullable=False, server_default="{}"), - ) - - -def downgrade(): - op.drop_column("scoresets", "external_links") diff --git a/alembic/versions/f11fd758436e_.py b/alembic/versions/f11fd758436e_.py deleted file mode 100644 index c1be17ab5..000000000 --- a/alembic/versions/f11fd758436e_.py +++ /dev/null @@ -1,35 +0,0 @@ -"""empty message - -Revision ID: f11fd758436e -Revises: 988ca84c701b -Create Date: 2023-05-16 15:03:22.252545 - -""" - -import sqlalchemy as sa - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "f11fd758436e" -down_revision = "988ca84c701b" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column("experiment_sets", "method_text") - op.drop_column("experiment_sets", "short_description") - op.drop_column("experiment_sets", "title") - op.drop_column("experiment_sets", "abstract_text") - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column("experiment_sets", sa.Column("abstract_text", sa.VARCHAR(), autoincrement=False, nullable=False)) - op.add_column("experiment_sets", sa.Column("title", sa.VARCHAR(), autoincrement=False, nullable=False)) - op.add_column("experiment_sets", sa.Column("short_description", sa.VARCHAR(), autoincrement=False, nullable=False)) - op.add_column("experiment_sets", sa.Column("method_text", sa.VARCHAR(), autoincrement=False, nullable=False)) - # ### end Alembic commands ### diff --git a/alembic/versions/f1a3c7e9b2d5_unique_live_authoritative_link_per_record.py b/alembic/versions/f1a3c7e9b2d5_unique_live_authoritative_link_per_record.py deleted file mode 100644 index 6d7b6c989..000000000 --- a/alembic/versions/f1a3c7e9b2d5_unique_live_authoritative_link_per_record.py +++ /dev/null @@ -1,46 +0,0 @@ -"""enforce one live authoritative link per mapping record - -Revision ID: f1a3c7e9b2d5 -Revises: c9b2a4f8e1d3 -Create Date: 2026-07-07 - -Adds a partial unique index enforcing at most one live authoritative link per mapping record. The -existing uq_mapping_record_alleles_live keys on (mapping_record, allele) and so cannot prevent two -different alleles both being flagged is_authoritative for the same record. The serving layer depends -on there being exactly one: the lean whole-set view (lib/score_set_variants) joins the authoritative -link expecting it 1:1 with the variant, so a second live authoritative link would silently duplicate -the variant and double-count its score in the histogram rather than raise. This index moves that -failure to write time in the mapping job, where the bug actually lives. - -Assumes no pre-existing record with two live authoritative links — the invariant is upheld today by -the mapping job's write logic. If this ever runs against data that violates it, the unique index -creation fails and the offending duplicates must be retired first. To check before applying: - - SELECT mapping_record_id, count(*) - FROM mapping_record_alleles - WHERE is_authoritative AND valid_to IS NULL - GROUP BY mapping_record_id HAVING count(*) > 1; -""" - -import sqlalchemy as sa -from alembic import op - -# revision identifiers, used by Alembic. -revision = "f1a3c7e9b2d5" -down_revision = "c9b2a4f8e1d3" -branch_labels = None -depends_on = None - - -def upgrade() -> None: - op.create_index( - "uq_mapping_record_alleles_live_authoritative", - "mapping_record_alleles", - ["mapping_record_id"], - unique=True, - postgresql_where=sa.text("is_authoritative AND valid_to IS NULL"), - ) - - -def downgrade() -> None: - op.drop_index("uq_mapping_record_alleles_live_authoritative", table_name="mapping_record_alleles") diff --git a/alembic/versions/f2a1b3c4d5e6_add_v_variant_annotations_view.py b/alembic/versions/f2a1b3c4d5e6_add_v_variant_annotations_view.py deleted file mode 100644 index 2d377def7..000000000 --- a/alembic/versions/f2a1b3c4d5e6_add_v_variant_annotations_view.py +++ /dev/null @@ -1,52 +0,0 @@ -"""add v_variant_annotations view - -Revision ID: f2a1b3c4d5e6 -Revises: e3a7b9f1d2c5 -Create Date: 2026-05-03 - -Creates the v_variant_annotations convenience view, which joins variants, mapped_variants, -variant_annotation_status, and scoresets into a single flat row per (variant, annotation_type). -Intended for operator queries and the variant_annotations CLI script. - -The view SQL is inlined as a frozen literal rather than imported from the model. At this point in -history the view joins the (now legacy) ``mapped_variants`` table; a later migration rewrites it onto -the ``mapping_records`` / ``alleles`` substrate. Importing the live model definition here would make a -fresh replay build *that* later shape at this early revision — before the substrate tables exist — -and fail. Freezing the historical SQL keeps replay green; the rewrite happens in its own migration. -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "f2a1b3c4d5e6" -down_revision = "e3a7b9f1d2c5" -branch_labels = None -depends_on = None - -SIGNATURE = "v_variant_annotations" - -# Historical definition, frozen at this revision. Do not edit to track the model. -DEFINITION = """ -SELECT variants.urn AS variant_urn, scoresets.urn AS score_set_urn, variants.hgvs_nt, variants.hgvs_pro, - variants.hgvs_splice, mapped_variants.id AS mapped_variant_id, mapped_variants.clingen_allele_id, - mapped_variants.hgvs_assay_level, mapped_variants.hgvs_g, mapped_variants.hgvs_c, mapped_variants.hgvs_p, - mapped_variants.vep_functional_consequence, mapped_variants.vep_access_date, mapped_variants.mapped_date, - mapped_variants.mapping_api_version, mapped_variants.vrs_version, mapped_variants.error_message AS mapping_error, - variant_annotation_status.annotation_type, variant_annotation_status.status AS annotation_status, - variant_annotation_status.failure_category, variant_annotation_status.error_message AS annotation_error, - variant_annotation_status.version AS annotation_version, variant_annotation_status.annotation_metadata, - variant_annotation_status.current, variant_annotation_status.created_at AS annotation_created_at, - variant_annotation_status.updated_at AS annotation_updated_at -FROM variants JOIN scoresets ON scoresets.id = variants.scoreset_id - LEFT OUTER JOIN mapped_variants ON mapped_variants.variant_id = variants.id AND mapped_variants.current = true - LEFT OUTER JOIN variant_annotation_status - ON variant_annotation_status.variant_id = variants.id AND variant_annotation_status.current = true -""" - - -def upgrade() -> None: - op.execute(f"CREATE VIEW {SIGNATURE} AS {DEFINITION}") - - -def downgrade() -> None: - op.execute(f"DROP VIEW {SIGNATURE}") diff --git a/alembic/versions/f36cf612e029_additional_mapping_columns.py b/alembic/versions/f36cf612e029_additional_mapping_columns.py deleted file mode 100644 index 5b8c896e0..000000000 --- a/alembic/versions/f36cf612e029_additional_mapping_columns.py +++ /dev/null @@ -1,103 +0,0 @@ -"""Additional mapping columns - -Revision ID: f36cf612e029 -Revises: ec5d2787bec9 -Create Date: 2024-08-21 16:06:06.793541 - -""" - -from datetime import datetime - -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "f36cf612e029" -down_revision = "ec5d2787bec9" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column( - "mapped_variants", - sa.Column("vrs_version", sa.String(), nullable=True, server_default="1.3"), - ) - op.add_column("mapped_variants", sa.Column("error_message", sa.String(), nullable=True)) - op.add_column( - "mapped_variants", - sa.Column( - "modification_date", - sa.Date(), - nullable=False, - server_default=sa.func.current_date(), - ), - ) - op.add_column( - "mapped_variants", - sa.Column( - "mapped_date", - sa.Date(), - nullable=False, - server_default=datetime.fromisocalendar(2024, 1, 1).date().strftime("%Y-%m-%d"), - ), - ) - op.add_column( - "mapped_variants", - sa.Column("mapping_api_version", sa.String(), nullable=False, server_default="0.0.0"), - ) - op.add_column( - "mapped_variants", - sa.Column("current", sa.Boolean(), nullable=False, server_default=sa.false()), - ) - op.alter_column( - "mapped_variants", - "pre_mapped", - existing_type=postgresql.JSONB(astext_type=sa.Text()), - nullable=True, - ) - op.alter_column( - "mapped_variants", - "post_mapped", - existing_type=postgresql.JSONB(astext_type=sa.Text()), - nullable=True, - ) - - op.add_column( - "target_genes", - sa.Column("pre_mapped_metadata", postgresql.JSONB, nullable=True), - ) - op.add_column( - "target_genes", - sa.Column("post_mapped_metadata", postgresql.JSONB, nullable=True), - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.alter_column( - "mapped_variants", - "post_mapped", - existing_type=postgresql.JSONB(astext_type=sa.Text()), - nullable=False, - ) - op.alter_column( - "mapped_variants", - "pre_mapped", - existing_type=postgresql.JSONB(astext_type=sa.Text()), - nullable=False, - ) - op.drop_column("mapped_variants", "current") - op.drop_column("mapped_variants", "mapping_api_version") - op.drop_column("mapped_variants", "mapped_date") - op.drop_column("mapped_variants", "modification_date") - op.drop_column("mapped_variants", "error_message") - op.drop_column("mapped_variants", "vrs_version") - - op.drop_column("target_genes", "pre_mapped_metadata") - op.drop_column("target_genes", "post_mapped_metadata") - # ### end Alembic commands ### diff --git a/alembic/versions/f4d2a9c1b7e3_add_cross_level_translation_annotation_type.py b/alembic/versions/f4d2a9c1b7e3_add_cross_level_translation_annotation_type.py deleted file mode 100644 index 790659d08..000000000 --- a/alembic/versions/f4d2a9c1b7e3_add_cross_level_translation_annotation_type.py +++ /dev/null @@ -1,49 +0,0 @@ -"""add cross_level_translation annotation type - -Revision ID: f4d2a9c1b7e3 -Revises: a1b2c3d4e5f6 -Create Date: 2026-06-02 - -Extends ck_variant_annotation_type_valid to allow the 'cross_level_translation' -annotation type. The VRS mapping worker writes one such row per variant to record -whether cross-level translation (filling the levels the assay did not map) -succeeded, was skipped (multivariant / no transcript), or failed. -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "f4d2a9c1b7e3" -down_revision = "a1b2c3d4e5f6" -branch_labels = None -depends_on = None - -_TYPES_OLD = ( - "'vrs_mapping', 'clingen_allele_id', 'mapped_hgvs', 'variant_translation', " - "'gnomad_allele_frequency', 'clinvar_control', 'vep_functional_consequence', " - "'ldh_submission'" -) -_TYPES_NEW = "'vrs_mapping', 'cross_level_translation', " + ( - "'clingen_allele_id', 'mapped_hgvs', 'variant_translation', " - "'gnomad_allele_frequency', 'clinvar_control', 'vep_functional_consequence', " - "'ldh_submission'" -) - - -def upgrade() -> None: - op.drop_constraint("ck_variant_annotation_type_valid", "variant_annotation_status", type_="check") - op.create_check_constraint( - "ck_variant_annotation_type_valid", - "variant_annotation_status", - f"annotation_type IN ({_TYPES_NEW})", - ) - - -def downgrade() -> None: - op.execute("DELETE FROM variant_annotation_status WHERE annotation_type = 'cross_level_translation'") - op.drop_constraint("ck_variant_annotation_type_valid", "variant_annotation_status", type_="check") - op.create_check_constraint( - "ck_variant_annotation_type_valid", - "variant_annotation_status", - f"annotation_type IN ({_TYPES_OLD})", - ) diff --git a/alembic/versions/f5a72192fafd_remove_score_range_property_from_score_.py b/alembic/versions/f5a72192fafd_remove_score_range_property_from_score_.py deleted file mode 100644 index 30a96614c..000000000 --- a/alembic/versions/f5a72192fafd_remove_score_range_property_from_score_.py +++ /dev/null @@ -1,32 +0,0 @@ -"""remove score range property from score sets - -Revision ID: f5a72192fafd -Revises: 002f6f9ec7ac -Create Date: 2025-10-08 15:35:49.275162 - -""" - -from alembic import op -import sqlalchemy as sa -from sqlalchemy.dialects import postgresql - -# revision identifiers, used by Alembic. -revision = "f5a72192fafd" -down_revision = "002f6f9ec7ac" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column("scoresets", "score_ranges") - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column( - "scoresets", - sa.Column("score_ranges", postgresql.JSONB(astext_type=sa.Text()), autoincrement=False, nullable=True), - ) - # ### end Alembic commands ### diff --git a/alembic/versions/f6752571d14d_index_variants_by_variant_number.py b/alembic/versions/f6752571d14d_index_variants_by_variant_number.py deleted file mode 100644 index bc8aba1b2..000000000 --- a/alembic/versions/f6752571d14d_index_variants_by_variant_number.py +++ /dev/null @@ -1,39 +0,0 @@ -"""Index score set variants by variant number - -Score set CSV queries order rows by the number after '#' in the variant URN (``Variant.variant_number``). Without an -index on that expression, every request sorts the whole score set, and a page deep into a large score set takes -minutes. - -The index evaluates the expression for every row, so every non-null variant URN must end in '#'; an insert -that breaks that fails. No existing URN broke it when this migration was written. - -Building it takes a lock that blocks writes to ``variants``, so in a populated database build it by hand first, which -makes this migration a no-op: - - CREATE INDEX CONCURRENTLY IF NOT EXISTS ix_variants_scoreset_number - ON variants (scoreset_id, (CAST(split_part(urn, '#', 2) AS INTEGER)), id); - -Revision ID: f6752571d14d -Revises: 15c40c367731 -Create Date: 2026-09-29 00:00:00.000000 - -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "f6752571d14d" -down_revision = "15c40c367731" -branch_labels = None -depends_on = None - - -def upgrade(): - op.execute( - "CREATE INDEX IF NOT EXISTS ix_variants_scoreset_number " - "ON variants (scoreset_id, (CAST(split_part(urn, '#', 2) AS INTEGER)), id)" - ) - - -def downgrade(): - op.execute("DROP INDEX IF EXISTS ix_variants_scoreset_number") diff --git a/alembic/versions/f69b4049bc3b_add_is_base_editor_column_to_target_.py b/alembic/versions/f69b4049bc3b_add_is_base_editor_column_to_target_.py deleted file mode 100644 index bd51702a2..000000000 --- a/alembic/versions/f69b4049bc3b_add_is_base_editor_column_to_target_.py +++ /dev/null @@ -1,31 +0,0 @@ -"""Add is_base_editor column to target_accessions - -Revision ID: f69b4049bc3b -Revises: d6e5a9fde3c9 -Create Date: 2025-03-02 14:06:52.217554 - -""" - -from alembic import op -import sqlalchemy as sa - - -# revision identifiers, used by Alembic. -revision = "f69b4049bc3b" -down_revision = "d6e5a9fde3c9" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.add_column( - "target_accessions", sa.Column("is_base_editor", sa.Boolean(), nullable=False, server_default="false") - ) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_column("target_accessions", "is_base_editor") - # ### end Alembic commands ### diff --git a/alembic/versions/fecb3e0d181d_make_urns_unique.py b/alembic/versions/fecb3e0d181d_make_urns_unique.py deleted file mode 100644 index ede6a65ea..000000000 --- a/alembic/versions/fecb3e0d181d_make_urns_unique.py +++ /dev/null @@ -1,33 +0,0 @@ -"""empty message - -Revision ID: fecb3e0d181d -Revises: c6154dd7d9b9 -Create Date: 2023-11-15 19:45:42.769529 - -""" - -from alembic import op - -# revision identifiers, used by Alembic. -revision = "fecb3e0d181d" -down_revision = "c6154dd7d9b9" -branch_labels = None -depends_on = None - - -def upgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.create_index(op.f("ix_experiment_sets_urn"), "experiment_sets", ["urn"], unique=True) - op.create_index(op.f("ix_experiments_urn"), "experiments", ["urn"], unique=True) - op.create_index(op.f("ix_scoresets_urn"), "scoresets", ["urn"], unique=True) - op.create_index(op.f("ix_variants_urn"), "variants", ["urn"], unique=True) - # ### end Alembic commands ### - - -def downgrade(): - # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f("ix_variants_urn"), table_name="variants") - op.drop_index(op.f("ix_scoresets_urn"), table_name="scoresets") - op.drop_index(op.f("ix_experiments_urn"), table_name="experiments") - op.drop_index(op.f("ix_experiment_sets_urn"), table_name="experiment_sets") - # ### end Alembic commands ### diff --git a/bin/build-baseline b/bin/build-baseline new file mode 100755 index 000000000..407e6eb0c --- /dev/null +++ b/bin/build-baseline @@ -0,0 +1,85 @@ +#!/usr/bin/env python3 +"""Write the squashed migration baseline from a live database. + +Usage: bin/build-baseline [libpq connection string] + +Dumps the schema and the fixed vocabulary an empty database needs, and writes them to +``alembic/baseline/.sql``, which the baseline migration executes. Connection details come from +the connection string or the usual ``PG*`` environment variables. Needs PostgreSQL 15 client tools on +``PATH``. See ``alembic/README.md`` for when and how to squash. +""" + +import subprocess +import sys +from pathlib import Path + +# Tables copied whole, and tables of which only the rows matching a condition are copied. +SEED_TABLES = ["controlled_keywords", "licenses", "roles"] +SEED_ROWS = {"mondo_terms": "code = 'MONDO:0000001'"} + +# pg_dump emits psql meta-commands (``\restrict``) and session settings. Neither can run inside the +# migration's transaction without leaking into the rest of the upgrade; every object name in the dump is +# schema-qualified, so the empty ``search_path`` it sets is not needed either. +DROPPED_PREFIXES = ("\\", "SET ", "SELECT pg_catalog.set_config('search_path'") + + +def run(*args: str) -> str: + return subprocess.run(args, check=True, capture_output=True, text=True).stdout + + +def schema_sql(conninfo: str) -> str: + dump = run( + "pg_dump", + f"--dbname={conninfo}", + "--schema-only", + "--no-owner", + "--no-privileges", + "--exclude-table=public.alembic_version", + ) + return "\n".join(line for line in dump.splitlines() if not line.startswith(DROPPED_PREFIXES)) + + +def seed_sql(conninfo: str) -> str: + """Emit each seed row as an INSERT through ``json_populate_record``, so no column list is hard-coded.""" + conditions = {table: "true" for table in SEED_TABLES} | SEED_ROWS + statements = [] + for table, condition in conditions.items(): + query = ( + "SELECT format('INSERT INTO public.%I SELECT * FROM json_populate_record(NULL::public.%I, %L);', " + f"'{table}', '{table}', row_to_json(t)) FROM public.{table} t WHERE {condition} ORDER BY id" + ) + statements.append(run("psql", f"--dbname={conninfo}", "-X", "-v", "ON_ERROR_STOP=1", "-tA", "-c", query)) + statements.append( + f"SELECT pg_catalog.setval(pg_get_serial_sequence('public.{table}', 'id'), " + f"(SELECT coalesce(max(id), 1) FROM public.{table}));\n" + ) + return "".join(statements) + + +def refresh_sql(conninfo: str) -> str: + """Populate the materialized views a schema-only dump creates ``WITH NO DATA``. + + Reading an unpopulated view raises, so a replayed database would fail on every route that reads one. + """ + query = ( + "SELECT format('REFRESH MATERIALIZED VIEW %I.%I;', schemaname, matviewname) " + "FROM pg_matviews WHERE schemaname = 'public' AND ispopulated ORDER BY matviewname" + ) + return run("psql", f"--dbname={conninfo}", "-X", "-v", "ON_ERROR_STOP=1", "-tA", "-c", query) + + +def main() -> None: + if len(sys.argv) not in (2, 3): + sys.exit(__doc__) + revision = sys.argv[1] + conninfo = sys.argv[2] if len(sys.argv) == 3 else "" + out = Path(__file__).resolve().parent.parent / "alembic" / "baseline" / f"{revision}.sql" + out.parent.mkdir(exist_ok=True) + out.write_text( + f"{schema_sql(conninfo)}\n\n--\n-- Seed vocabulary\n--\n\n{seed_sql(conninfo)}\n{refresh_sql(conninfo)}" + ) + print(f"Wrote {out}") + + +if __name__ == "__main__": + main() diff --git a/bin/check b/bin/check new file mode 100755 index 000000000..2f250acf4 --- /dev/null +++ b/bin/check @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# Fast static checks: lint, format, types and migration rules. Tests run through bin/t. +# Runs every check before exiting so one invocation reports all failures. +set -uo pipefail +cd "$(dirname "$0")/.." + +status=0 +poetry run ruff check || status=1 +poetry run ruff format --check || status=1 +poetry run mypy src/ || status=1 +bin/check-migrations || status=1 +exit $status diff --git a/bin/check-migrations b/bin/check-migrations new file mode 100755 index 000000000..b7b436bdb --- /dev/null +++ b/bin/check-migrations @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 +"""Fail on migration code that stops the history replaying from an empty database. + +Usage: bin/check-migrations [file or directory ...] (default: alembic/versions) + +The rules are in ``alembic/README.md``. Docstrings are ignored, since they describe the build-by-hand +step for large indexes. +""" + +import ast +import sys +from pathlib import Path + +FORBIDDEN_IMPORTS = { + "mavedb": "imports application code; write views and functions as literal SQL", + "sqlalchemy.orm": "uses the ORM; migrations run SQL only", + "requests": "makes network calls", + "httpx": "makes network calls", + "urllib": "makes network calls", +} + + +def _docstrings(tree: ast.Module) -> set[int]: + ids = set() + for node in ast.walk(tree): + if isinstance(node, (ast.Module, ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef)) and node.body: + first = node.body[0] + if isinstance(first, ast.Expr) and isinstance(first.value, ast.Constant): + ids.add(id(first.value)) + return ids + + +def _forbidden_import(module: str) -> str | None: + for name, reason in FORBIDDEN_IMPORTS.items(): + if module == name or module.startswith(f"{name}."): + return reason + return None + + +def check(path: Path) -> list[str]: + tree = ast.parse(path.read_text(), filename=str(path)) + docstrings = _docstrings(tree) + problems = [] + for node in ast.walk(tree): + reason = None + if isinstance(node, ast.Import): + reason = next(filter(None, (_forbidden_import(alias.name) for alias in node.names)), None) + elif isinstance(node, ast.ImportFrom) and node.module and not node.level: + reason = _forbidden_import(node.module) + elif isinstance(node, ast.Attribute) and node.attr == "autocommit_block": + reason = "uses autocommit_block(), which commits everything before it" + elif isinstance(node, ast.Attribute) and node.attr == "commit": + reason = "commits mid-upgrade" + elif isinstance(node, ast.Constant) and isinstance(node.value, str) and id(node) not in docstrings: + text = " ".join(node.value.upper().split()) + if "CONCURRENTLY" in text: + reason = "uses CONCURRENTLY, which can't run inside a transaction" + elif "ADD VALUE" in text: + reason = "adds an enum value, which the rest of the upgrade's transaction can't use" + if reason: + problems.append(f"{path}:{node.lineno}: {reason}") + return problems + + +def main(args: list[str]) -> int: + targets = [Path(arg) for arg in args] or [Path(__file__).resolve().parent.parent / "alembic" / "versions"] + files = [f for t in targets for f in (sorted(t.glob("*.py")) if t.is_dir() else [t])] + problems = [problem for f in files for problem in check(f)] + if problems: + print("\n".join(problems), file=sys.stderr) + return 1 + return 0 + + +if __name__ == "__main__": + sys.exit(main(sys.argv[1:])) diff --git a/bin/t b/bin/t new file mode 100755 index 000000000..5fbb1d0af --- /dev/null +++ b/bin/t @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# Targeted tests: bin/t [pytest args] +# Requires a target so the full suite only runs deliberately: pass tests/ (with -n 6) to run it. +set -euo pipefail + +if [ $# -eq 0 ]; then + echo "usage: bin/t [pytest args] (pass tests/ for the full suite)" >&2 + exit 2 +fi + +# Use the tmpfs test database when bin/test-db has started it. +if [ -z "${MAVEDB_TEST_DB_PORT:-}" ] && command -v docker >/dev/null && + [ "$(docker inspect -f '{{.State.Running}}' mavedb-test-db 2>/dev/null)" = "true" ]; then + export MAVEDB_TEST_DB_PORT=5435 +fi + +exec poetry run pytest "$@" diff --git a/bin/test-db b/bin/test-db new file mode 100755 index 000000000..d745cab99 --- /dev/null +++ b/bin/test-db @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# Test Postgres on tmpfs in Docker: bin/test-db [up|down] +# While it runs, bin/t points tests at it instead of starting a server in $TMPDIR, so the thousands of +# files each test database creates and drops never touch the host filesystem (or fseventsd and +# endpoint scanners watching it). One container serves every checkout and worktree; its data is +# discarded when it stops, so restart it to clear databases left behind by interrupted runs. +set -euo pipefail + +name=mavedb-test-db +port=5435 + +case "${1:-up}" in +up) + if [ "$(docker inspect -f '{{.State.Running}}' "$name" 2>/dev/null)" != "true" ]; then + docker run -d --rm --name "$name" -p "127.0.0.1:$port:5432" \ + --tmpfs /var/lib/postgresql/data -e POSTGRES_PASSWORD=postgres \ + postgres:15 -c fsync=off -c synchronous_commit=off -c full_page_writes=off -c max_connections=300 >/dev/null + fi + for _ in $(seq 60); do + if docker exec "$name" pg_isready -U postgres -h localhost >/dev/null 2>&1; then + echo "$name is up on localhost:$port" + exit 0 + fi + sleep 0.5 + done + echo "$name didn't become ready in 30s" >&2 + docker logs "$name" 2>&1 | tail -20 >&2 || true + exit 1 + ;; +down) + docker rm -f "$name" >/dev/null 2>&1 || true + ;; +*) + echo "usage: bin/test-db [up|down]" >&2 + exit 2 + ;; +esac diff --git a/poetry.lock b/poetry.lock index f204b6ff5..6dc0abb7a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -916,14 +916,14 @@ requests = "*" [[package]] name = "certifi" -version = "2026.4.22" +version = "2026.10.19" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.7" groups = ["main", "dev"] files = [ - {file = "certifi-2026.4.22-py3-none-any.whl", hash = "sha256:3cb2210c8f88ba2318d29b0388d1023c8492ff72ecdde4ebdaddbb13a31b1c4a"}, - {file = "certifi-2026.4.22.tar.gz", hash = "sha256:8d455352a37b71bf76a79caa83a3d6c25afee4a385d632127b6afb3963f1c580"}, + {file = "certifi-2026.10.19-py3-none-any.whl", hash = "sha256:42d35340cc5b9ba78e818ddbff0c5b1c2b779de448a340fd1b989f5fa8670e1b"}, + {file = "certifi-2026.10.19.tar.gz", hash = "sha256:035c1e85572b141bf1c3a3eff0e33a8eb74917522f2559075ff8d2fea780a1ae"}, ] [[package]] @@ -1572,6 +1572,21 @@ files = [ lxml = "*" requests = "*" +[[package]] +name = "execnet" +version = "2.1.2" +description = "execnet: rapid multi-Python deployment" +optional = false +python-versions = ">=3.8" +groups = ["dev"] +files = [ + {file = "execnet-2.1.2-py3-none-any.whl", hash = "sha256:67fba928dd5a544b783f6056f449e5e3931a5c378b128bc18501f7ea79e296ec"}, + {file = "execnet-2.1.2.tar.gz", hash = "sha256:63d83bfdd9a23e35b9c6a3261412324f964c2ec8dcd8d3c6916ee9373e0befcd"}, +] + +[package.extras] +testing = ["hatch", "pre-commit", "pytest", "tox"] + [[package]] name = "executing" version = "2.2.1" @@ -1683,15 +1698,15 @@ dev = ["black", "flake8", "flake8-pyproject", "mypy", "pre-commit", "pytest"] [[package]] name = "fsspec" -version = "2026.4.0" +version = "2026.9.0" description = "File-system specification" optional = true python-versions = ">=3.10" groups = ["main"] markers = "extra == \"server\"" files = [ - {file = "fsspec-2026.4.0-py3-none-any.whl", hash = "sha256:11ef7bb35dab8a394fde6e608221d5cf3e8499401c249bebaeaad760a1a8dec2"}, - {file = "fsspec-2026.4.0.tar.gz", hash = "sha256:301d8ac70ae90ef3ad05dcf94d6c3754a097f9b5fe4667d2787aa359ec7df7e4"}, + {file = "fsspec-2026.9.0-py3-none-any.whl", hash = "sha256:8dd6e646e99ea382bd85f97a45e6b526a442d79423a7dc673f1e2756d05fcb5f"}, + {file = "fsspec-2026.9.0.tar.gz", hash = "sha256:0f08147951c8cb31d844c3547d631053b127863b60be04cf06e121333ee0e2fe"}, ] [package.extras] @@ -1702,24 +1717,24 @@ dask = ["dask", "distributed"] dev = ["pre-commit", "ruff (>=0.5)"] doc = ["numpydoc", "sphinx", "sphinx-design", "sphinx-rtd-theme", "yarl"] dropbox = ["dropbox", "dropboxdrivefs", "requests"] -full = ["adlfs", "aiohttp (!=4.0.0a0,!=4.0.0a1)", "dask", "distributed", "dropbox", "dropboxdrivefs", "fusepy", "gcsfs (>2024.2.0)", "libarchive-c", "ocifs", "panel", "paramiko", "pyarrow (>=1)", "pygit2", "requests", "s3fs (>2024.2.0)", "smbprotocol", "tqdm"] +full = ["adlfs", "aiohttp (!=4.0.0a0,!=4.0.0a1)", "dask", "distributed", "dropbox", "dropboxdrivefs", "fusepy", "gcsfs (>=2026.4.0)", "libarchive-c", "ocifs", "panel", "paramiko", "pyarrow (>=1)", "pygit2", "requests", "s3fs (>=2026.6.0)", "smbprotocol", "tqdm"] fuse = ["fusepy"] -gcs = ["gcsfs (>2024.2.0)"] +gcs = ["gcsfs (>=2026.4.0)"] git = ["pygit2"] github = ["requests"] -gs = ["gcsfs"] +gs = ["gcsfs (>=2026.4.0)"] gui = ["panel"] hdfs = ["pyarrow (>=1)"] http = ["aiohttp (!=4.0.0a0,!=4.0.0a1)"] libarchive = ["libarchive-c"] oci = ["ocifs"] -s3 = ["s3fs (>2024.2.0)"] +s3 = ["s3fs (>=2026.6.0)"] sftp = ["paramiko"] smb = ["smbprotocol"] ssh = ["paramiko"] test = ["aiohttp (!=4.0.0a0,!=4.0.0a1)", "numpy", "pytest", "pytest-asyncio (!=0.22.0)", "pytest-benchmark", "pytest-cov", "pytest-mock", "pytest-recording", "pytest-rerunfailures", "requests"] -test-downstream = ["aiobotocore (>=2.5.4,<3.0.0)", "dask[dataframe,test]", "moto[server] (>4,<5)", "pytest-timeout", "xarray"] -test-full = ["adlfs", "aiohttp (!=4.0.0a0,!=4.0.0a1)", "backports-zstd ; python_version < \"3.14\"", "cloudpickle", "dask", "distributed", "dropbox", "dropboxdrivefs", "fastparquet", "fusepy", "gcsfs", "jinja2", "kerchunk", "libarchive-c", "lz4", "notebook", "numpy", "ocifs", "pandas (<3.0.0)", "panel", "paramiko", "pyarrow", "pyarrow (>=1)", "pyftpdlib", "pygit2", "pytest", "pytest-asyncio (!=0.22.0)", "pytest-benchmark", "pytest-cov", "pytest-mock", "pytest-recording", "pytest-rerunfailures", "python-snappy", "requests", "smbprotocol", "tqdm", "urllib3", "zarr", "zstandard ; python_version < \"3.14\""] +test-downstream = ["aiobotocore (>=2.5.4,<3.0.0)", "dask[dataframe,test]", "moto[server] (>4,<5)", "pytest-timeout", "xarray", "zarr"] +test-full = ["adlfs", "aiohttp (!=4.0.0a0,!=4.0.0a1)", "backports-zstd ; python_version < \"3.14\"", "cloudpickle", "dask", "distributed", "dropbox", "dropboxdrivefs", "fastparquet", "fusepy", "gcsfs (>=2026.4.0)", "jinja2", "kerchunk", "libarchive-c", "lz4", "notebook", "numpy", "ocifs", "pandas (<3.0.0)", "panel", "paramiko", "pyarrow (>=1)", "pyftpdlib", "pygit2", "pytest", "pytest-asyncio (!=0.22.0)", "pytest-benchmark", "pytest-cov", "pytest-mock", "pytest-recording", "pytest-rerunfailures", "python-snappy", "requests", "s3fs (>=2026.6.0)", "smbprotocol", "tqdm", "urllib3", "zarr (<3.2.0)", "zstandard ; python_version < \"3.14\""] tqdm = ["tqdm"] [[package]] @@ -2672,23 +2687,23 @@ htmlsoup = ["BeautifulSoup4"] [[package]] name = "mako" -version = "1.3.12" +version = "1.4.3" description = "A super-fast templating language that borrows the best ideas from the existing templating languages." optional = true -python-versions = ">=3.8" +python-versions = ">=3.10" groups = ["main"] markers = "extra == \"server\"" files = [ - {file = "mako-1.3.12-py3-none-any.whl", hash = "sha256:8f61569480282dbf557145ce441e4ba888be453c30989f879f0d652e39f53ea9"}, - {file = "mako-1.3.12.tar.gz", hash = "sha256:9f778e93289bd410bb35daadeb4fc66d95a746f0b75777b942088b7fd7af550a"}, + {file = "mako-1.4.3-py3-none-any.whl", hash = "sha256:723296007c870bfd6b3f0c3230dba7198096e5269297ebf5e4eff9e7ffa39d4f"}, + {file = "mako-1.4.3.tar.gz", hash = "sha256:cd6537fe88d5fec315c55c2f8529bc4ce7a9a352ad7db3eeaa6a66e2dd4ec37a"}, ] [package.dependencies] -MarkupSafe = ">=0.9.2" +MarkupSafe = ">=2.0" [package.extras] babel = ["Babel"] -lingua = ["lingua"] +lingua = ["lingua (>=4.16)"] testing = ["pytest"] [[package]] @@ -3836,6 +3851,27 @@ files = [ [package.dependencies] pytest = ">=3.6.3" +[[package]] +name = "pytest-xdist" +version = "3.8.0" +description = "pytest xdist plugin for distributed testing, most importantly across multiple CPUs" +optional = false +python-versions = ">=3.9" +groups = ["dev"] +files = [ + {file = "pytest_xdist-3.8.0-py3-none-any.whl", hash = "sha256:202ca578cfeb7370784a8c33d6d05bc6e13b4f25b5053c30a152269fd10f0b88"}, + {file = "pytest_xdist-3.8.0.tar.gz", hash = "sha256:7e578125ec9bc6050861aa93f2d59f1d8d085595d6551c2c90b6f4fad8d3a9f1"}, +] + +[package.dependencies] +execnet = ">=2.1" +pytest = ">=7.0.0" + +[package.extras] +psutil = ["psutil (>=3.0)"] +setproctitle = ["setproctitle"] +testing = ["filelock"] + [[package]] name = "python-dateutil" version = "2.9.0.post0" @@ -4248,30 +4284,30 @@ pyasn1 = ">=0.1.3" [[package]] name = "ruff" -version = "0.6.8" +version = "0.17.1" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" groups = ["dev"] files = [ - {file = "ruff-0.6.8-py3-none-linux_armv6l.whl", hash = "sha256:77944bca110ff0a43b768f05a529fecd0706aac7bcce36d7f1eeb4cbfca5f0f2"}, - {file = "ruff-0.6.8-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:27b87e1801e786cd6ede4ada3faa5e254ce774de835e6723fd94551464c56b8c"}, - {file = "ruff-0.6.8-py3-none-macosx_11_0_arm64.whl", hash = "sha256:cd48f945da2a6334f1793d7f701725a76ba93bf3d73c36f6b21fb04d5338dcf5"}, - {file = "ruff-0.6.8-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:677e03c00f37c66cea033274295a983c7c546edea5043d0c798833adf4cf4c6f"}, - {file = "ruff-0.6.8-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9f1476236b3eacfacfc0f66aa9e6cd39f2a624cb73ea99189556015f27c0bdeb"}, - {file = "ruff-0.6.8-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6f5a2f17c7d32991169195d52a04c95b256378bbf0de8cb98478351eb70d526f"}, - {file = "ruff-0.6.8-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:5fd0d4b7b1457c49e435ee1e437900ced9b35cb8dc5178921dfb7d98d65a08d0"}, - {file = "ruff-0.6.8-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f8034b19b993e9601f2ddf2c517451e17a6ab5cdb1c13fdff50c1442a7171d87"}, - {file = "ruff-0.6.8-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6cfb227b932ba8ef6e56c9f875d987973cd5e35bc5d05f5abf045af78ad8e098"}, - {file = "ruff-0.6.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6ef0411eccfc3909269fed47c61ffebdcb84a04504bafa6b6df9b85c27e813b0"}, - {file = "ruff-0.6.8-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:007dee844738c3d2e6c24ab5bc7d43c99ba3e1943bd2d95d598582e9c1b27750"}, - {file = "ruff-0.6.8-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:ce60058d3cdd8490e5e5471ef086b3f1e90ab872b548814e35930e21d848c9ce"}, - {file = "ruff-0.6.8-py3-none-musllinux_1_2_i686.whl", hash = "sha256:1085c455d1b3fdb8021ad534379c60353b81ba079712bce7a900e834859182fa"}, - {file = "ruff-0.6.8-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:70edf6a93b19481affd287d696d9e311388d808671bc209fb8907b46a8c3af44"}, - {file = "ruff-0.6.8-py3-none-win32.whl", hash = "sha256:792213f7be25316f9b46b854df80a77e0da87ec66691e8f012f887b4a671ab5a"}, - {file = "ruff-0.6.8-py3-none-win_amd64.whl", hash = "sha256:ec0517dc0f37cad14a5319ba7bba6e7e339d03fbf967a6d69b0907d61be7a263"}, - {file = "ruff-0.6.8-py3-none-win_arm64.whl", hash = "sha256:8d3bb2e3fbb9875172119021a13eed38849e762499e3cfde9588e4b4d70968dc"}, - {file = "ruff-0.6.8.tar.gz", hash = "sha256:a5bf44b1aa0adaf6d9d20f86162b34f7c593bfedabc51239953e446aefc8ce18"}, + {file = "ruff-0.17.1-py3-none-linux_armv6l.whl", hash = "sha256:1796c41eafec66f4635125dd1e074a7aa27b8d20c187d484360acf11d247fc4a"}, + {file = "ruff-0.17.1-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:8eadb09a788010be29c895418bdfa513e4e1c65e64b94e5b19e4cd381f6cc7fb"}, + {file = "ruff-0.17.1-py3-none-macosx_11_0_arm64.whl", hash = "sha256:29b454f18ca3eeaf37fbf140841dcf27d36109e29dee9aae8acecb68c26c6f74"}, + {file = "ruff-0.17.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:872e03dd231744d6c5ec5c8af6be52b71323fc6ee096e4c8b34d9f844ee3b978"}, + {file = "ruff-0.17.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4c0d6cb5f8fbac77eec9af49f4fc0eaf856b05545e372b0694d24b4e76b1c640"}, + {file = "ruff-0.17.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:78beced4a3c94dfedbee4b999b95b6a27b35820fdc0afbacc6d37a8da26c1cd1"}, + {file = "ruff-0.17.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7feefc63921202894f0e158b0e32f45a5950d70a7fb693ccb9264816c25b1c05"}, + {file = "ruff-0.17.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:684154861a819bf1f433669d2a0ce9c3e54677c65b8ebb866cc2a7ec86345785"}, + {file = "ruff-0.17.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a6ef98e51de8ef38082f90653ceeb84944bd7673783eea13e1647c5b9b064189"}, + {file = "ruff-0.17.1-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:8f9aa5b5bd5fa1937803ea609c8f153b8de39bf3e0e149897ae34b0c5b52f467"}, + {file = "ruff-0.17.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:80e53b0e5faa3c5667f035daaa032893ae42b7cfe708c886d39ed131e54688ab"}, + {file = "ruff-0.17.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:056c5d5fa0ac790051ae165d7035c7bf956d02de2db557f2e9b31d877a505fca"}, + {file = "ruff-0.17.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:bd8f5a55b10f371642eacd0e8665a42a8b97da15c9a7187c79e697b77b5e0ce4"}, + {file = "ruff-0.17.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:ce05e6f3973611d9550a600e04bb531061e368baba31610eb57c1509a8f21a0a"}, + {file = "ruff-0.17.1-py3-none-win32.whl", hash = "sha256:1de0030a8aa78c65c5fecb84b2e5c390ac684c0452875a02afc7c083d49a496a"}, + {file = "ruff-0.17.1-py3-none-win_amd64.whl", hash = "sha256:5df76f16580fab58d0f6c98a3ac254a4abceb7b2489b8b678335869cff77b3d7"}, + {file = "ruff-0.17.1-py3-none-win_arm64.whl", hash = "sha256:42400b9a6ff8515ff27796f07f92e0195be011c86e81e381606f58ea5502fef4"}, + {file = "ruff-0.17.1.tar.gz", hash = "sha256:5bb796c5112e9fb9527f2ef2faa0a130d6312d19de92bcfaddd70dbb2d41020f"}, ] [[package]] @@ -5297,4 +5333,4 @@ server = ["aiocache", "alembic", "alembic-utils", "arq", "authlib", "bbi-variant [metadata] lock-version = "2.1" python-versions = "^3.11" -content-hash = "3354617968bfec911fcc172ceedfceeecf71b415356f757f2173c3ac45a4ca0d" +content-hash = "4d5a1195254e38f8f62fc0db01994510a5f2cf4aebdb258bed1518943a121fea" diff --git a/pyproject.toml b/pyproject.toml index d382064db..a68577cef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "mavedb" -version = "2026.3.1" +version = "2026.3.2" description = "API for MaveDB, the database of Multiplexed Assays of Variant Effect." license = "AGPL-3.0-only" readme = "README.md" @@ -84,13 +84,14 @@ pytest-cov = "~7.1.0" pytest-postgresql = "~8.0.0" pytest-asyncio = "~1.3.0" pytest-socket = "~0.6.0" +pytest-xdist = "~3.8" pandas-stubs = "~3.0.0" types-requests = "~2.31.0" types-python-jose = "~3.3.4" types-PyYAML = "~6.0.12.20240808" redis = "~5.0.2" requests-mock = "~1.11.0" -ruff = "0.6.8" +ruff = "~0.17.1" SQLAlchemy = { extras = ["mypy"], version = "~2.0.0" } @@ -120,7 +121,7 @@ module = "ga4gh.*" follow_untyped_imports = true [tool.pytest.ini_options] -addopts = "-v --import-mode=importlib" +addopts = "--import-mode=importlib" asyncio_mode = 'strict' testpaths = "tests/" pythonpath = "." @@ -142,5 +143,6 @@ target-version = "py311" # max line length for linting is 120 characters line-length = 120 -# Exclude these files from linting/formatting -exclude = ["alembic/manual_migrations"] +# Ruff's default rule set changes between minor releases, so it is written out here; widen it in its own commit. +[tool.ruff.lint] +select = ["E4", "E7", "E9", "F"] diff --git a/src/mavedb/__init__.py b/src/mavedb/__init__.py index 24284f227..3e157404f 100644 --- a/src/mavedb/__init__.py +++ b/src/mavedb/__init__.py @@ -6,7 +6,7 @@ logger = module_logging.getLogger(__name__) __project__ = "mavedb-api" -__version__ = "2026.3.1" +__version__ = "2026.3.2" logger.info(f"MaveDB {__version__}") diff --git a/src/mavedb/lib/authentication.py b/src/mavedb/lib/authentication.py index d10fad7ea..a66503165 100644 --- a/src/mavedb/lib/authentication.py +++ b/src/mavedb/lib/authentication.py @@ -1,3 +1,4 @@ +import hashlib import logging import os from datetime import datetime, timedelta @@ -125,6 +126,14 @@ async def get_access_token( return access_token_header or access_token_cookie +def hash_access_key(access_key: str) -> str: + """Return the hex SHA-256 digest under which an access key is stored and looked up. + + Access keys are long random tokens, so an unsalted fast hash is enough to keep stored keys unusable. + """ + return hashlib.sha256(access_key.encode()).hexdigest() + + def get_current_user_data_from_api_key( db: Session = Depends(deps.get_db), access_token: str = Depends(get_access_token) ) -> Optional[UserData]: @@ -132,7 +141,7 @@ def get_current_user_data_from_api_key( roles: list[UserRole] = [] if access_token is not None: - access_key = db.query(AccessKey).filter(AccessKey.key_id == access_token).one_or_none() + access_key = db.query(AccessKey).filter(AccessKey.key_id == hash_access_key(access_token)).one_or_none() if access_key: user = access_key.user if access_key.role is not None: diff --git a/src/mavedb/lib/csv/build_limiter.py b/src/mavedb/lib/csv/build_limiter.py index a3f8b43cb..5a995e6d0 100644 --- a/src/mavedb/lib/csv/build_limiter.py +++ b/src/mavedb/lib/csv/build_limiter.py @@ -42,7 +42,7 @@ def rows_to_build(num_variants: Optional[int], start: Optional[int], limit: Opti """The number of rows a request for ``start``/``limit`` of a score set with ``num_variants`` variants returns.""" # TODO(#372): `num_variants` is NOT NULL but typed optional. remaining = max((num_variants or 0) - (start or 0), 0) - return min(remaining, limit) if limit else remaining + return min(remaining, limit) if limit is not None else remaining @contextmanager diff --git a/src/mavedb/lib/csv/fetch.py b/src/mavedb/lib/csv/fetch.py index 60d5f2f7f..59e1f723e 100644 --- a/src/mavedb/lib/csv/fetch.py +++ b/src/mavedb/lib/csv/fetch.py @@ -39,12 +39,26 @@ class CsvFetchResult: def _scope_query( - query: Select[Any], *, score_set_id: Optional[int], variant_ids: Optional[Sequence[int]] + query: Select[Any], + *, + score_set_id: Optional[int], + variant_ids: Optional[Sequence[int]], + start: Optional[int] = None, + limit: Optional[int] = None, ) -> Select[Any]: - """Narrow *query* to one score set (ordered by variant number) or an explicit variant set.""" - if score_set_id is not None: + """Narrow *query* to one score set (ordered by variant number, optionally one ``start``/``limit`` page of + it) or an explicit variant set.""" + if score_set_id is None: + return query.where(Variant.id.in_(variant_ids or [])) + + if start is None and limit is None: return query.where(Variant.score_set_id == score_set_id).order_by(*_VARIANT_NUMBER_ORDER) - return query.where(Variant.id.in_(variant_ids or [])) + + # Joining to the page's ids, with no score set filter of its own, leaves the outer query nothing to do + # but fetch those rows. Filtered by score set, the planner could serve its ORDER BY by walking the whole + # score set in index order and reading every row, skipped ones included (#901). + page = _page_variant_ids(score_set_id, start, limit).subquery("page") + return query.join(page, page.c.id == Variant.id).order_by(*_VARIANT_NUMBER_ORDER) def _restore_variant_id_order(rows: list[Any], variant_ids: Sequence[int], key) -> list[Any]: @@ -53,18 +67,27 @@ def _restore_variant_id_order(rows: list[Any], variant_ids: Sequence[int], key) return sorted(rows, key=lambda row: position.get(key(row), len(position))) -def _apply_pagination(query: Select[Any], start: Optional[int], limit: Optional[int]) -> Select[Any]: - """Apply the shared ``start``/``limit`` window (offset/limit) to a variant query. A falsy ``start`` or - ``limit`` leaves that bound off.""" - if start: +def _page_variant_ids(score_set_id: int, start: Optional[int], limit: Optional[int]) -> Select[Any]: + """The ids of one ``start``/``limit`` page of a score set's variants. A ``None`` bound is left off. + + Selecting only ids lets the variant-number index skip the rows before ``start`` without joining them + (#901). + """ + query = select(Variant.id).where(Variant.score_set_id == score_set_id).order_by(*_VARIANT_NUMBER_ORDER) + if start is not None: query = query.offset(start) - if limit: + if limit is not None: query = query.limit(limit) return query def _substrate_query( - *, score_set_id: Optional[int], variant_ids: Optional[Sequence[int]], as_of: Optional[datetime] + *, + score_set_id: Optional[int], + variant_ids: Optional[Sequence[int]], + start: Optional[int], + limit: Optional[int], + as_of: Optional[datetime], ) -> Select[Any]: """The base per-variant query: each variant LEFT-joined to its live mapping record, its authoritative (measured) allele (digest / ClinGen id / VEP consequence), and that allele's measured projection group @@ -105,7 +128,7 @@ def _substrate_query( and_(ProjectionGroup.id == MappingRecordAllele.projection_group, ProjectionGroup.live_at(as_of)), ) ) - return _scope_query(query, score_set_id=score_set_id, variant_ids=variant_ids) + return _scope_query(query, score_set_id=score_set_id, variant_ids=variant_ids, start=start, limit=limit) def _mapped_row(row: Any) -> CsvMappedRow: @@ -194,6 +217,8 @@ def fetch_variant_csv_data( Args: score_set: every variant in a score set, ordered by URN suffix. Mutually exclusive with *variant_ids*, which returns an explicit set in the order given. Exactly one is required. + start: rows of the score set to skip. Not valid with *variant_ids*. + limit: the most rows of the score set to return. Not valid with *variant_ids*. as_of: reconstruct the mapping-derived namespaces (reference HGVS, VEP, gnomAD, ClinVar) as they stood at this instant, over the variant's immutable submitted HGVS/scores/counts. Defaults to currently-live rows. The deterministic replacement for the old ``current``-flag pinning: a @@ -202,6 +227,8 @@ def fetch_variant_csv_data( """ if (score_set is None) == (variant_ids is None): raise ValueError("exactly one of score_set or variant_ids must be provided") + if variant_ids is not None and (start is not None or limit is not None): + raise ValueError("start and limit page a score set, not an explicit variant set") # Driven by the namespaces' own descriptors, so a namespace cannot declare a relationship-backed # column and then quietly not have it loaded. @@ -224,23 +251,17 @@ def fetch_variant_csv_data( if not need_mappings: # Fast path: scores/counts (and bare core/score-set identity) are a straight paginated scan, # untouched by as_of (it only reconstructs the — absent here — mapping-derived namespaces). - query = _apply_pagination( - _scope_query(select(Variant), score_set_id=score_set_id, variant_ids=variant_ids).options( - *score_set_options - ), - start, - limit, - ) + query = _scope_query( + select(Variant), score_set_id=score_set_id, variant_ids=variant_ids, start=start, limit=limit + ).options(*score_set_options) result = list(db.scalars(query).all()) if variant_ids is not None: result = _restore_variant_id_order(result, variant_ids, key=lambda v: v.id) return CsvFetchResult(result, None, None, None) - query = _apply_pagination( - _substrate_query(score_set_id=score_set_id, variant_ids=variant_ids, as_of=as_of).options(*score_set_options), - start, - limit, - ) + query = _substrate_query( + score_set_id=score_set_id, variant_ids=variant_ids, start=start, limit=limit, as_of=as_of + ).options(*score_set_options) rows = list(db.execute(query).all()) if variant_ids is not None: rows = _restore_variant_id_order(rows, variant_ids, key=lambda row: row.Variant.id) diff --git a/src/mavedb/lib/mave/hgvs.py b/src/mavedb/lib/mave/hgvs.py index 8d253f039..6ae06783c 100644 --- a/src/mavedb/lib/mave/hgvs.py +++ b/src/mavedb/lib/mave/hgvs.py @@ -23,7 +23,7 @@ def validate_hgvs_string( value = value.decode() if not isinstance(value, str): raise ValidationError( - "Variant HGVS values input must be strings. " "'{}' has the type '{}'.".format(value, type(value).__name__) + "Variant HGVS values input must be strings. '{}' has the type '{}'.".format(value, type(value).__name__) ) if value.lower() == "_sy": @@ -48,19 +48,16 @@ def validate_hgvs_string( else: if prefix not in "cn": raise ValidationError( - f"'{value}' is not a transcript variant. The accepted " - f"transcript variant prefixes are 'c.', 'n.'." + f"'{value}' is not a transcript variant. The accepted transcript variant prefixes are 'c.', 'n.'." ) elif column in ("splice", HGVS_SPLICE_COLUMN): if prefix not in "cn": raise ValidationError( - f"'{value}' is not a transcript variant. The accepted " f"transcript variant prefixes are 'c.', 'n.'." + f"'{value}' is not a transcript variant. The accepted transcript variant prefixes are 'c.', 'n.'." ) elif column in ("p", HGVS_PRO_COLUMN): if prefix not in "p": - raise ValidationError( - f"'{value}' is not a protein variant. The accepted " f"protein variant prefix is 'p.'." - ) + raise ValidationError(f"'{value}' is not a protein variant. The accepted protein variant prefix is 'p.'.") else: raise ValueError("Unknown column '{}'. Expected nt, splice or p".format(column)) diff --git a/src/mavedb/lib/permissions/collection.py b/src/mavedb/lib/permissions/collection.py index a629a45e1..f732470a8 100644 --- a/src/mavedb/lib/permissions/collection.py +++ b/src/mavedb/lib/permissions/collection.py @@ -73,8 +73,7 @@ def has_permission(user_data: Optional[UserData], entity: Collection, action: Ac if action not in handlers: supported_actions = ", ".join(a.value for a in handlers.keys()) raise NotImplementedError( - f"Action '{action.value}' is not supported for collection entities. " - f"Supported actions: {supported_actions}" + f"Action '{action.value}' is not supported for collection entities. Supported actions: {supported_actions}" ) return handlers[action]( diff --git a/src/mavedb/lib/permissions/experiment.py b/src/mavedb/lib/permissions/experiment.py index 91f8f6176..2c7e6bdbb 100644 --- a/src/mavedb/lib/permissions/experiment.py +++ b/src/mavedb/lib/permissions/experiment.py @@ -58,8 +58,7 @@ def has_permission(user_data: Optional[UserData], entity: Experiment, action: Ac if action not in handlers: supported_actions = ", ".join(a.value for a in handlers.keys()) raise NotImplementedError( - f"Action '{action.value}' is not supported for experiment entities. " - f"Supported actions: {supported_actions}" + f"Action '{action.value}' is not supported for experiment entities. Supported actions: {supported_actions}" ) return handlers[action]( diff --git a/src/mavedb/lib/permissions/score_set.py b/src/mavedb/lib/permissions/score_set.py index cb61a6ad6..e54b6b87f 100644 --- a/src/mavedb/lib/permissions/score_set.py +++ b/src/mavedb/lib/permissions/score_set.py @@ -60,8 +60,7 @@ def has_permission(user_data: Optional[UserData], entity: ScoreSet, action: Acti if action not in handlers: supported_actions = ", ".join(a.value for a in handlers.keys()) raise NotImplementedError( - f"Action '{action.value}' is not supported for score set entities. " - f"Supported actions: {supported_actions}" + f"Action '{action.value}' is not supported for score set entities. Supported actions: {supported_actions}" ) return handlers[action]( diff --git a/src/mavedb/lib/validation/identifier.py b/src/mavedb/lib/validation/identifier.py index 077b13fc0..7f0d8eb45 100644 --- a/src/mavedb/lib/validation/identifier.py +++ b/src/mavedb/lib/validation/identifier.py @@ -47,7 +47,7 @@ def validate_sra_identifier(identifier: str): or idutils.is_arrayexpress_array(identifier) or idutils.is_arrayexpress_experiment(identifier) ): - raise ValidationError(f"'{identifier} is not a valid SRA, GEO, ArrayExpress or BioProject " "accession.") + raise ValidationError(f"'{identifier} is not a valid SRA, GEO, ArrayExpress or BioProject accession.") def validate_ensembl_identifier(identifier: str): diff --git a/src/mavedb/lib/validation/utilities.py b/src/mavedb/lib/validation/utilities.py index 2712c886a..8c61215e6 100644 --- a/src/mavedb/lib/validation/utilities.py +++ b/src/mavedb/lib/validation/utilities.py @@ -89,13 +89,13 @@ def construct_hgvs_pro(wt: str, mutant: str, position: int, target_seq: Optional # check that the provided 3 letter amino acid codes are valid if wt not in aa_dict_key_1.values(): raise ValueError( - "wt 3 letter amino acid code {} is invalid, " "must be one of the following: {}".format( + "wt 3 letter amino acid code {} is invalid, must be one of the following: {}".format( wt, list(aa_dict_key_1.values()) ) ) if mutant not in aa_dict_key_1.values(): raise ValueError( - "wt 3 letter amino acid code {} is invalid, " "must be one of the following: {}".format( + "wt 3 letter amino acid code {} is invalid, must be one of the following: {}".format( mutant, list(aa_dict_key_1.values()) ) ) diff --git a/src/mavedb/lib/validation/variant.py b/src/mavedb/lib/validation/variant.py index 2d0f5bcf5..f8653b887 100644 --- a/src/mavedb/lib/validation/variant.py +++ b/src/mavedb/lib/validation/variant.py @@ -62,7 +62,7 @@ def validate_hgvs_string( value = value.decode() if not isinstance(value, str): raise ValidationError( - "Variant HGVS values input must be strings. " "'{}' has the type '{}'.".format(value, type(value).__name__) + "Variant HGVS values input must be strings. '{}' has the type '{}'.".format(value, type(value).__name__) ) if value.lower() == "_sy": @@ -87,19 +87,16 @@ def validate_hgvs_string( else: if prefix not in "cn": raise ValidationError( - f"'{value}' is not a transcript variant. The accepted " - f"transcript variant prefixes are 'c.', 'n.'." + f"'{value}' is not a transcript variant. The accepted transcript variant prefixes are 'c.', 'n.'." ) elif column in ("splice", hgvs_splice_column): if prefix not in "cn": raise ValidationError( - f"'{value}' is not a transcript variant. The accepted " f"transcript variant prefixes are 'c.', 'n.'." + f"'{value}' is not a transcript variant. The accepted transcript variant prefixes are 'c.', 'n.'." ) elif column in ("p", hgvs_pro_column): if prefix not in "p": - raise ValidationError( - f"'{value}' is not a protein variant. The accepted " f"protein variant prefix is 'p.'." - ) + raise ValidationError(f"'{value}' is not a protein variant. The accepted protein variant prefix is 'p.'.") else: raise ValueError("Unknown column '{}'. Expected nt, splice or p".format(column)) diff --git a/src/mavedb/models/access_key.py b/src/mavedb/models/access_key.py index 046a7e34f..41092beb2 100644 --- a/src/mavedb/models/access_key.py +++ b/src/mavedb/models/access_key.py @@ -20,7 +20,9 @@ class AccessKey(Base): user: Mapped[User] = relationship(back_populates="access_keys") role_id = Column(Integer, ForeignKey("roles.id"), nullable=True) role_obj: Mapped[Role] = relationship(Role) + # Hex SHA-256 of the access key; the key itself is never stored. key_id = Column(String, unique=True, index=True, nullable=False) + key_hint = Column(String, nullable=True) public_key = Column(String, nullable=False) name = Column(String, nullable=True) expiration_date = Column(Date, nullable=True) diff --git a/src/mavedb/models/variant.py b/src/mavedb/models/variant.py index 773589788..2643d5127 100644 --- a/src/mavedb/models/variant.py +++ b/src/mavedb/models/variant.py @@ -63,4 +63,13 @@ def _variant_number_expression(cls) -> ColumnElement[int]: # Serves ordering a score set's variants by number, so deep pages of a large score set skip the full sort. -Index("ix_variants_scoreset_number", Variant.score_set_id, Variant.variant_number, Variant.id) +# Including urn lets a page's ids come from an index-only scan: Postgres won't use one for an expression +# index unless the expression's columns are in the index too. +# TODO(#939): index a stored variant_number column instead, which needs no INCLUDE. +Index( + "ix_variants_scoreset_number_covering", + Variant.score_set_id, + Variant.variant_number, + Variant.id, + postgresql_include=["urn"], +) diff --git a/src/mavedb/routers/access_keys.py b/src/mavedb/routers/access_keys.py index 275fc437c..d6762cbf2 100644 --- a/src/mavedb/routers/access_keys.py +++ b/src/mavedb/routers/access_keys.py @@ -12,12 +12,14 @@ from sqlalchemy.orm import Session from mavedb import deps +from mavedb.lib.authentication import hash_access_key from mavedb.lib.authorization import require_current_user from mavedb.lib.logging import LoggedRoute from mavedb.lib.logging.context import logging_context, save_to_logging_context from mavedb.lib.types.authentication import UserData from mavedb.models.access_key import AccessKey from mavedb.models.enums.user_role import UserRole +from mavedb.models.user import User from mavedb.routers.shared import ACCESS_CONTROL_ERROR_RESPONSES, PUBLIC_ERROR_RESPONSES, ROUTER_BASE_PREFIX from mavedb.view_models import access_key @@ -58,6 +60,18 @@ def generate_key_pair(): return private_key, public_key +def new_access_key(user: User) -> tuple[str, bytes, AccessKey]: + """Generate an access key for a user. + + Returns the key, the private half of its key pair, and an unsaved ``AccessKey`` that stores only the + key's hash and hint. The key can't be recovered afterwards, so the caller must return it to the user now. + """ + private_key, public_key = generate_key_pair() + key = secrets.token_urlsafe(32) + item = AccessKey(user=user, key_id=hash_access_key(key), key_hint=key[-4:], public_key=public_key) + return key, private_key, item + + @router.get( "/users/me/access-keys", status_code=200, @@ -87,16 +101,12 @@ def create_my_access_key( """ Create a new access key for the current user, with the default user role. """ - private_key, public_key = generate_key_pair() - - item = AccessKey(user=user_data.user, key_id=secrets.token_urlsafe(32), public_key=public_key) + key, private_key, item = new_access_key(user_data.user) db.add(item) db.commit() db.refresh(item) - response_item = access_key.NewAccessKey(**jsonable_encoder(item, by_alias=False), private_key=private_key) - response_item.private_key = private_key - return response_item + return access_key.NewAccessKey(**{**jsonable_encoder(item, by_alias=False), "key_id": key}, private_key=private_key) @router.post( @@ -128,28 +138,24 @@ async def create_my_access_key_with_role( detail="User cannot create an API key for a role they do not have.", ) - private_key, public_key = generate_key_pair() - - item = AccessKey(user=user_data.user, key_id=secrets.token_urlsafe(32), public_key=public_key) + key, private_key, item = new_access_key(user_data.user) await item.set_role(db, role) db.add(item) db.commit() db.refresh(item) - response_item = access_key.NewAccessKey(**jsonable_encoder(item, by_alias=False), private_key=private_key) - response_item.private_key = private_key - return response_item + return access_key.NewAccessKey(**{**jsonable_encoder(item, by_alias=False), "key_id": key}, private_key=private_key) @router.delete( - "/users/me/access-keys/{key_id}", + "/users/me/access-keys/{access_key_id}", status_code=200, responses={**ACCESS_CONTROL_ERROR_RESPONSES}, summary="Delete one of my access keys", ) def delete_my_access_key( *, - key_id: str, + access_key_id: int, db: Session = Depends(deps.get_db), user_data: UserData = Depends(require_current_user), ) -> Any: @@ -158,7 +164,7 @@ def delete_my_access_key( """ item = ( db.query(AccessKey) - .filter(and_(AccessKey.key_id == key_id, AccessKey.user_id == user_data.user.id)) + .filter(and_(AccessKey.id == access_key_id, AccessKey.user_id == user_data.user.id)) .one_or_none() ) @@ -168,7 +174,7 @@ def delete_my_access_key( extra=logging_context(), ) # Never acknowledge the existence of an access key that doesn't belong to the user. - raise HTTPException(status_code=404, detail=f"Access key with ID {key_id} not found.") + raise HTTPException(status_code=404, detail=f"Access key with ID {access_key_id} not found.") db.delete(item) db.commit() diff --git a/src/mavedb/routers/score_calibrations.py b/src/mavedb/routers/score_calibrations.py index 484575381..f8f43e4af 100644 --- a/src/mavedb/routers/score_calibrations.py +++ b/src/mavedb/routers/score_calibrations.py @@ -1,6 +1,7 @@ import logging from typing import Optional +import pandas as pd from fastapi import APIRouter, Depends, File, HTTPException, Query, UploadFile from sqlalchemy.orm import Session, selectinload @@ -360,6 +361,10 @@ async def create_score_calibration_route( raise HTTPException( status_code=400, detail=f"Error decoding file: {e}. Ensure the file has correct values." ) + except pd.errors.ParserError as e: + raise HTTPException( + status_code=400, detail=f"Error parsing classes file: {e}. Ensure the file is a valid CSV." + ) try: standardized_classes_df, index_column = validate_and_standardize_calibration_classes_dataframe( @@ -386,6 +391,10 @@ async def create_score_calibration_route( raise HTTPException( status_code=400, detail=f"Error decoding file: {e}. Ensure the file has correct values." ) + except pd.errors.ParserError as e: + raise HTTPException( + status_code=400, detail=f"Error parsing controls file: {e}. Ensure the file is a valid CSV." + ) try: calibration.controls = validate_and_standardize_calibration_controls_dataframe(db, score_set, controls_df) @@ -577,6 +586,10 @@ async def modify_score_calibration_route( raise HTTPException( status_code=400, detail=f"Error decoding file: {e}. Ensure the file has correct values." ) + except pd.errors.ParserError as e: + raise HTTPException( + status_code=400, detail=f"Error parsing classes file: {e}. Ensure the file is a valid CSV." + ) try: standardized_classes_df, index_column = validate_and_standardize_calibration_classes_dataframe( @@ -604,6 +617,10 @@ async def modify_score_calibration_route( raise HTTPException( status_code=400, detail=f"Error decoding file: {e}. Ensure the file has correct values." ) + except pd.errors.ParserError as e: + raise HTTPException( + status_code=400, detail=f"Error parsing controls file: {e}. Ensure the file is a valid CSV." + ) try: calibration_update.controls = validate_and_standardize_calibration_controls_dataframe( diff --git a/src/mavedb/routers/score_sets.py b/src/mavedb/routers/score_sets.py index 425b1f49c..01ed631dc 100644 --- a/src/mavedb/routers/score_sets.py +++ b/src/mavedb/routers/score_sets.py @@ -527,6 +527,10 @@ async def parse_score_set_variants_uploads( raise HTTPException( status_code=400, detail=f"Error decoding file: {e}. Ensure the file has correct values." ) + except pd.errors.ParserError as e: + raise HTTPException( + status_code=400, detail=f"Error parsing scores file: {e}. Ensure the file is a valid CSV." + ) else: scores_df = None @@ -538,6 +542,10 @@ async def parse_score_set_variants_uploads( raise HTTPException( status_code=400, detail=f"Error decoding file: {e}. Ensure the file has correct values." ) + except pd.errors.ParserError as e: + raise HTTPException( + status_code=400, detail=f"Error parsing counts file: {e}. Ensure the file is a valid CSV." + ) else: counts_df = None diff --git a/src/mavedb/scripts/audit_allele_identifiers.py b/src/mavedb/scripts/audit_allele_identifiers.py index fd0d1128d..ca806d9a7 100644 --- a/src/mavedb/scripts/audit_allele_identifiers.py +++ b/src/mavedb/scripts/audit_allele_identifiers.py @@ -16,7 +16,7 @@ written earlier can carry an identifier minted before their own normalization. `audit` reports them, and `--repair` corrects the ones that can be corrected safely. Run this before and after -`alembic/manual_migrations/migrate_mapped_variants_to_allele_substrate.py`. That migration now +`src/mavedb/scripts/migrate_mapped_variants_to_allele_substrate.py`. That migration now recomputes identity as it writes, so it will not import drift — but `vrs_digest` is a UNIQUE dedup key on an immutable, ValidTime-less table, so a wrong value there cannot be corrected in place afterwards. Measuring before and expecting zero after is how that is kept honest. diff --git a/src/mavedb/scripts/backfill_campaign.py b/src/mavedb/scripts/backfill_campaign.py index 61f8ba8be..48b6cbe7c 100644 --- a/src/mavedb/scripts/backfill_campaign.py +++ b/src/mavedb/scripts/backfill_campaign.py @@ -1,6 +1,6 @@ """Read-only campaign map and safe-to-drop gate for the MappedVariant → allele-substrate backfill. -The backfill has two halves (see ``alembic/manual_migrations/migrate_mapped_variants_to_allele_substrate.py`` +The backfill has two halves (see ``src/mavedb/scripts/migrate_mapped_variants_to_allele_substrate.py`` for the reshape and ``run_score_set_pipelines.py`` for the enrichment): a deterministic *reshape* that reconstructs the measured-level spine and source-annotation links from the frozen ``mapped_variants`` rows, and a decoupled *enrichment* that runs reverse translation (the cross-level fan-out) and re-runs the source diff --git a/src/mavedb/scripts/job_runs.py b/src/mavedb/scripts/job_runs.py index 1ff0fdce7..3d71e4285 100644 --- a/src/mavedb/scripts/job_runs.py +++ b/src/mavedb/scripts/job_runs.py @@ -96,7 +96,7 @@ def list_job_runs( click.echo("No job runs match the given filters.") return - click.echo(f"{'ID':>6} {'STATUS':<10} {'TYPE':<24} {'FUNCTION':<36} " f"{'RETRIES':<8} {'CREATED':<26} URN") + click.echo(f"{'ID':>6} {'STATUS':<10} {'TYPE':<24} {'FUNCTION':<36} {'RETRIES':<8} {'CREATED':<26} URN") for j in job_runs: click.echo( f"{j.id:>6} {str(j.status):<10} {j.job_type[:24]:<24} " diff --git a/alembic/manual_migrations/migrate_mapped_variants_to_allele_substrate.py b/src/mavedb/scripts/migrate_mapped_variants_to_allele_substrate.py similarity index 97% rename from alembic/manual_migrations/migrate_mapped_variants_to_allele_substrate.py rename to src/mavedb/scripts/migrate_mapped_variants_to_allele_substrate.py index 3d2de474d..ce39fdb6a 100644 --- a/alembic/manual_migrations/migrate_mapped_variants_to_allele_substrate.py +++ b/src/mavedb/scripts/migrate_mapped_variants_to_allele_substrate.py @@ -107,12 +107,12 @@ ----- :: - python -m alembic.manual_migrations.migrate_mapped_variants_to_allele_substrate # run - python -m alembic.manual_migrations.migrate_mapped_variants_to_allele_substrate verify # inspect without writing - python -m alembic.manual_migrations.migrate_mapped_variants_to_allele_substrate rollback # remove backfilled records (destructive) - python -m alembic.manual_migrations.migrate_mapped_variants_to_allele_substrate rebuild-annotations # (re)build annotation links for already-migrated variants - python -m alembic.manual_migrations.migrate_mapped_variants_to_allele_substrate migrate --score-set urn:mavedb:00000001-a-1 - python -m alembic.manual_migrations.migrate_mapped_variants_to_allele_substrate migrate --batch-size 1000 --dry-run + python -m mavedb.scripts.migrate_mapped_variants_to_allele_substrate # run + python -m mavedb.scripts.migrate_mapped_variants_to_allele_substrate verify # inspect without writing + python -m mavedb.scripts.migrate_mapped_variants_to_allele_substrate rollback # remove backfilled records (destructive) + python -m mavedb.scripts.migrate_mapped_variants_to_allele_substrate rebuild-annotations # (re)build annotation links for already-migrated variants + python -m mavedb.scripts.migrate_mapped_variants_to_allele_substrate migrate --score-set urn:mavedb:00000001-a-1 + python -m mavedb.scripts.migrate_mapped_variants_to_allele_substrate migrate --batch-size 1000 --dry-run """ from __future__ import annotations @@ -123,7 +123,7 @@ from dataclasses import dataclass from datetime import date, datetime, time, timezone from time import perf_counter # `time` above is datetime.time; import the timer directly -from typing import Optional +from typing import Optional, cast import sqlalchemy as sa from biocommons.seqrepo import SeqRepo @@ -347,21 +347,21 @@ def _reconstruct_windows(mvs: list[MappedVariant]) -> Optional[_WindowResult]: else: # Multiple live rows is a source anomaly; keep the newest live and demote # the rest into history so no data is dropped. - current.sort(key=lambda m: (m.mapped_date, m.id)) + current.sort(key=lambda m: (cast(date, m.mapped_date), m.id)) live = current[-1] history.extend(current[:-1]) logger.warning("Variant %s has %d current mapped_variants; keeping newest live.", live.variant_id, len(current)) - history.sort(key=lambda m: (m.mapped_date, m.id)) + history.sort(key=lambda m: (cast(date, m.mapped_date), m.id)) ordered = history + [live] - live_precedes_history = bool(history) and live.mapped_date < history[-1].mapped_date + live_precedes_history = bool(history) and cast(date, live.mapped_date) < cast(date, history[-1].mapped_date) windows: list[tuple[MappedVariant, datetime, Optional[datetime]]] = [] for i, m in enumerate(ordered): - valid_from = _as_dt(m.mapped_date) + valid_from = _as_dt(cast(date, m.mapped_date)) valid_to: Optional[datetime] = None if i + 1 < len(ordered): - successor = _as_dt(ordered[i + 1].mapped_date) + successor = _as_dt(cast(date, ordered[i + 1].mapped_date)) # Same-day or out-of-order successor: clamp so the window is never # inverted (a zero-width [t, t) window is simply invisible to as_of). valid_to = max(successor, valid_from) @@ -563,7 +563,9 @@ def _merge_intervals( return merged -def _allele_has_live_link(db: Session, model: type, allele_id: int) -> bool: +def _allele_has_live_link( + db: Session, model: type[GnomadAlleleLink] | type[VepAlleleConsequence], allele_id: int +) -> bool: """Whether ``allele_id`` already has a live (``valid_to IS NULL``) link in ``model``. Sees **committed** rows only — the session runs ``autoflush=False``, so this does not observe @@ -805,7 +807,7 @@ def _observations_for_alleles(db: Session, allele_ids: list[int]) -> dict[int, l variant_ids = {variant_id for _, variant_id, _, _, _ in links} mv_by_key: dict[tuple[int, date], MappedVariant] = { - (mv.variant_id, mv.mapped_date): mv + (cast(int, mv.variant_id), cast(date, mv.mapped_date)): mv for mv in db.scalars(sa.select(MappedVariant).where(MappedVariant.variant_id.in_(variant_ids))).all() } @@ -955,7 +957,7 @@ def _migrate_variant( if (mv.pre_mapped or {}).get("id"): try: pre_mapped_document, pre_mapped_digest = canonical_variation_document( - mv.pre_mapped, subject=f"mapped_variant {mv.id} pre_mapped" + cast(dict, mv.pre_mapped), subject=f"mapped_variant {mv.id} pre_mapped" ) except (ValidationError, ValueError): logger.exception(f"Could not canonicalize pre_mapped for mapped_variant {mv.id}; storing it unkeyed.") @@ -1144,7 +1146,7 @@ def do_migration( stats: Counter = Counter() # Wall-clock spent in each phase, so a run reports where the time goes (batch build vs. the # final annotation pass) and whether the per-batch rate degrades as the tables grow. - phase_seconds: Counter = Counter() + phase_seconds: dict[str, float] = defaultdict(float) # Ids only — a deduped allele can be shared by variants in different chunks, so its annotation # timeline can only be assembled once every contributing variant has been migrated, but the actual # gnomAD/ClinVar/VEP payload doesn't need to ride along in memory to get there: it's re-read fresh @@ -1164,7 +1166,7 @@ def do_migration( mark = perf_counter() mvs_by_variant: dict[int, list[MappedVariant]] = {vid: [] for vid in chunk} for mv in db.scalars(sa.select(MappedVariant).where(MappedVariant.variant_id.in_(chunk))).all(): - mvs_by_variant[mv.variant_id].append(mv) + mvs_by_variant[cast(int, mv.variant_id)].append(mv) phase_seconds["fetch_mapped_variants"] += perf_counter() - mark # Bulk pre-fetch, once per chunk instead of once per window — this (not query execution time) @@ -1172,12 +1174,15 @@ def do_migration( # another for "does this allele already exist" dominates wall-clock at millions-of-rows scale, # far more than the cost of the queries themselves. mark = perf_counter() - existing_records: set[tuple[int, date]] = set( - db.execute( - sa.select(MappingRecord.variant_id, MappingRecord.mapped_date).where( - MappingRecord.variant_id.in_(chunk) - ) - ).all() + existing_records = cast( + set[tuple[int, date]], + set( + db.execute( + sa.select(MappingRecord.variant_id, MappingRecord.mapped_date).where( + MappingRecord.variant_id.in_(chunk) + ) + ).all() + ), ) score_set_ids: dict[int, int] = dict( db.execute(sa.select(Variant.id, Variant.score_set_id).where(Variant.id.in_(chunk))).tuples().all() diff --git a/src/mavedb/scripts/pipelines.py b/src/mavedb/scripts/pipelines.py index 8e7795bb9..c5033c860 100644 --- a/src/mavedb/scripts/pipelines.py +++ b/src/mavedb/scripts/pipelines.py @@ -92,9 +92,7 @@ def list_pipelines( click.echo(f"{'ID':>6} {'STATUS':<12} {'NAME':<32} {'CREATED':<26} URN") for p in pipelines: - click.echo( - f"{p.id:>6} {str(p.status):<12} {p.name[:32]:<32} " f"{_format_dt(p.created_at):<26} {p.urn or '-'}" - ) + click.echo(f"{p.id:>6} {str(p.status):<12} {p.name[:32]:<32} {_format_dt(p.created_at):<26} {p.urn or '-'}") @script_environment.command(name="show-pipeline") diff --git a/src/mavedb/view_models/access_key.py b/src/mavedb/view_models/access_key.py index 8962e82f9..34de2f08d 100644 --- a/src/mavedb/view_models/access_key.py +++ b/src/mavedb/view_models/access_key.py @@ -7,7 +7,7 @@ class AccessKeyBase(BaseModel): - key_id: str + key_hint: Optional[str] = None name: Optional[str] = None expiration_date: Optional[date] = None creation_time: Optional[datetime] = None @@ -15,6 +15,7 @@ class AccessKeyBase(BaseModel): # Properties shared by models stored in DB class SavedAccessKey(AccessKeyBase): + id: int record_type: str = None # type: ignore role: Optional[UserRole] = None @@ -29,6 +30,7 @@ class AccessKey(SavedAccessKey): pass -# Properties to return when an access key has just been created +# Properties to return when an access key has just been created. This is the only response that carries the key. class NewAccessKey(SavedAccessKey): + key_id: str private_key: str diff --git a/src/mavedb/worker/best_practices.md b/src/mavedb/worker/best_practices.md index 92b672617..13c521e6c 100644 --- a/src/mavedb/worker/best_practices.md +++ b/src/mavedb/worker/best_practices.md @@ -17,21 +17,21 @@ async def my_job(ctx: dict, job_id: int, job_manager: JobManager) -> JobExecutio score_set_id = job.job_params["score_set_id"] correlation_id = job.job_params["correlation_id"] - job_manager.save_to_context({ - "application": "mavedb-worker", - "function": "my_job", - "resource": score_set_id, - "correlation_id": correlation_id, - }) + job_manager.save_to_context( + { + "application": "mavedb-worker", + "function": "my_job", + "resource": score_set_id, + "correlation_id": correlation_id, + } + ) # 3. Initialize progress job_manager.update_progress(0, 100, "Starting my job.") logger.info("Starting my job", extra=job_manager.logging_context()) # 4. Load domain objects and do work - score_set = job_manager.db.scalars( - select(ScoreSet).where(ScoreSet.id == score_set_id) - ).one() + score_set = job_manager.db.scalars(select(ScoreSet).where(ScoreSet.id == score_set_id)).one() # ... business logic ... @@ -68,8 +68,7 @@ return JobExecutionOutcome.succeeded(data={"variants_created": count}) # Missing data, validation failure, precondition not met if not mapping_records: return JobExecutionOutcome.failed( - reason="No mapping records found for score set", - data={"score_set_id": score_set_id} + reason="No mapping records found for score set", data={"score_set_id": score_set_id} ) ``` @@ -133,12 +132,14 @@ Until then, the interim pattern (see `map_variants_for_score_set`) is a **livene Always set up logging context early in the job function: ```python -job_manager.save_to_context({ - "application": "mavedb-worker", - "function": "my_job_name", - "resource": score_set.urn, - "correlation_id": correlation_id, -}) +job_manager.save_to_context( + { + "application": "mavedb-worker", + "function": "my_job_name", + "resource": score_set.urn, + "correlation_id": correlation_id, + } +) ``` Then use `job_manager.logging_context()` with every log call: @@ -165,9 +166,7 @@ async def submit_to_external_service(ctx: dict, job_id: int, job_manager: JobMan return JobExecutionOutcome.skipped(data={"reason": "Service submissions disabled"}) # 2. Load required data - score_set = job_manager.db.scalars( - select(ScoreSet).where(ScoreSet.id == job.job_params["score_set_id"]) - ).one() + score_set = job_manager.db.scalars(select(ScoreSet).where(ScoreSet.id == job.job_params["score_set_id"])).one() # 3. Check preconditions has_mappings = job_manager.db.scalar( @@ -349,7 +348,7 @@ assert result.status == "succeeded" ### Use fixtures for job setup The test `conftest.py` provides fixtures for creating `JobRun` records with the right params structure. Use these rather than constructing records manually. -For complete testing guidelines, see `.github/instructions/testing.instructions.md`. +For the rest of the testing conventions, see `.claude/rules/tests.md` and `.claude/rules/worker.md` at the repository root. ## See Also diff --git a/src/mavedb/worker/job_decorators.md b/src/mavedb/worker/job_decorators.md index eafe3fc02..a150d5437 100644 --- a/src/mavedb/worker/job_decorators.md +++ b/src/mavedb/worker/job_decorators.md @@ -11,6 +11,7 @@ Decorators are the bridge between the infrastructure layer and business layer. T ```python from mavedb.worker.lib.decorators.pipeline_management import with_pipeline_management + @with_pipeline_management async def my_job(ctx: dict, job_id: int, job_manager: JobManager) -> JobExecutionOutcome: # Business logic here @@ -35,6 +36,7 @@ async def my_job(ctx: dict, job_id: int, job_manager: JobManager) -> JobExecutio ```python from mavedb.worker.lib.decorators.job_management import with_job_management + @with_job_management async def my_standalone_job(ctx: dict, job_id: int, job_manager: JobManager) -> JobExecutionOutcome: # Business logic here @@ -65,6 +67,7 @@ async def my_standalone_job(ctx: dict, job_id: int, job_manager: JobManager) -> from mavedb.worker.lib.decorators.job_guarantee import with_guaranteed_job_run_record from mavedb.worker.lib.decorators.job_management import with_job_management + @with_guaranteed_job_run_record("cron_job") @with_job_management async def cleanup_stalled_jobs(ctx: dict, job_id: int, job_manager: JobManager) -> JobExecutionOutcome: diff --git a/src/mavedb/worker/job_managers.md b/src/mavedb/worker/job_managers.md index 60f2f3287..6ab9f2ff2 100644 --- a/src/mavedb/worker/job_managers.md +++ b/src/mavedb/worker/job_managers.md @@ -34,11 +34,13 @@ job_manager.update_progress(75, 100, "Annotating", commit=False) # Skip checkpo job_manager.update_status_message("Connecting to ClinGen API...") # Add context for structured logging -job_manager.save_to_context({ - "score_set_id": score_set.id, - "correlation_id": correlation_id, - "function": "create_variants_for_score_set", -}) +job_manager.save_to_context( + { + "score_set_id": score_set.id, + "correlation_id": correlation_id, + "function": "create_variants_for_score_set", + } +) logger.info("Started processing", extra=job_manager.logging_context()) ``` diff --git a/src/mavedb/worker/job_registry.md b/src/mavedb/worker/job_registry.md index 3b7deb5d9..87a82b3d2 100644 --- a/src/mavedb/worker/job_registry.md +++ b/src/mavedb/worker/job_registry.md @@ -37,7 +37,8 @@ BACKGROUND_CRONJOBS: List[CronJob] = [ cron( refresh_materialized_views, name="refresh_all_materialized_views", - hour=20, minute=0, + hour=20, + minute=0, keep_result=timedelta(minutes=2).total_seconds(), ), cron( @@ -103,17 +104,17 @@ async def submit_to_new_service(ctx: dict, job_id: int, job_manager: JobManager) _job_required_params = ["score_set_id", "correlation_id"] validate_job_params(_job_required_params, job) - score_set = job_manager.db.scalars( - select(ScoreSet).where(ScoreSet.id == job.job_params["score_set_id"]) - ).one() + score_set = job_manager.db.scalars(select(ScoreSet).where(ScoreSet.id == job.job_params["score_set_id"])).one() correlation_id = job.job_params["correlation_id"] - job_manager.save_to_context({ - "application": "mavedb-worker", - "function": "submit_to_new_service", - "resource": score_set.urn, - "correlation_id": correlation_id, - }) + job_manager.save_to_context( + { + "application": "mavedb-worker", + "function": "submit_to_new_service", + "resource": score_set.urn, + "correlation_id": correlation_id, + } + ) job_manager.update_progress(0, 100, "Starting NewService submission.") logger.info("Started NewService submission", extra=job_manager.logging_context()) @@ -148,16 +149,18 @@ BACKGROUND_FUNCTIONS: List[Callable] = [ In `src/mavedb/lib/workflow/definitions.py`, add a `JobDefinition` to the appropriate pipeline: ```python -{ - "key": "submit_to_new_service", - "function": "submit_to_new_service", - "type": JobType.MAPPED_VARIANT_ANNOTATION, - "params": { - "correlation_id": None, - "score_set_id": None, +( + { + "key": "submit_to_new_service", + "function": "submit_to_new_service", + "type": JobType.MAPPED_VARIANT_ANNOTATION, + "params": { + "correlation_id": None, + "score_set_id": None, + }, + "dependencies": [("map_variants_for_score_set", DependencyType.SUCCESS_REQUIRED)], }, - "dependencies": [("map_variants_for_score_set", DependencyType.SUCCESS_REQUIRED)], -}, +) ``` ### 5. Write tests @@ -203,7 +206,8 @@ BACKGROUND_CRONJOBS: List[CronJob] = [ cron( my_maintenance_job, name="my_maintenance_job_cron", - hour=4, minute=0, # Run daily at 4:00 AM + hour=4, + minute=0, # Run daily at 4:00 AM keep_result=timedelta(minutes=5).total_seconds(), ), ] @@ -232,17 +236,17 @@ The `ArqWorkerSettings` class (in `settings/worker.py`) brings everything togeth ```python class ArqWorkerSettings: - on_startup = startup # Create ProcessPoolExecutor + on_startup = startup # Create ProcessPoolExecutor on_shutdown = shutdown - on_job_start = on_job_start # Initialize hdp (HGVS data provider), state dict + on_job_start = on_job_start # Initialize hdp (HGVS data provider), state dict on_job_end = on_job_end - after_job_end = log_job # Canonical job logging + after_job_end = log_job # Canonical job logging redis_settings = RedisWorkerSettings functions = BACKGROUND_FUNCTIONS cron_jobs = BACKGROUND_CRONJOBS - max_jobs = MAX_JOBS # 2; limits event-loop starvation from sync DB calls + max_jobs = MAX_JOBS # 2; limits event-loop starvation from sync DB calls job_timeout = JOB_TIMEOUT_SECONDS # 24 hours - allow_abort_jobs = True # Lets cleanup_stalled_jobs abort a wedged RUNNING job + allow_abort_jobs = True # Lets cleanup_stalled_jobs abort a wedged RUNNING job ``` ### Fast-lane worker diff --git a/src/mavedb/worker/lib/managers/job_manager.py b/src/mavedb/worker/lib/managers/job_manager.py index 0425d155e..32012939c 100644 --- a/src/mavedb/worker/lib/managers/job_manager.py +++ b/src/mavedb/worker/lib/managers/job_manager.py @@ -33,7 +33,7 @@ import logging import traceback -from datetime import datetime +from datetime import datetime, timezone from typing import Any, Optional from arq import ArqRedis @@ -222,7 +222,7 @@ def start_job(self) -> None: try: job_run.status = JobStatus.RUNNING - job_run.started_at = datetime.now() + job_run.started_at = datetime.now(timezone.utc) job_run.progress_message = "Job began execution" except (AttributeError, TypeError, KeyError, ValueError) as e: self.save_to_context(format_raised_exception_info_as_dict(e)) @@ -267,7 +267,7 @@ def complete_job(self, status: JobStatus, result: JobExecutionOutcome) -> None: if result.exception else None, } - job_run.finished_at = datetime.now() + job_run.finished_at = datetime.now(timezone.utc) if status in (JobStatus.FAILED, JobStatus.ERRORED): if result.failure_category: diff --git a/src/mavedb/worker/lib/managers/pipeline_manager.py b/src/mavedb/worker/lib/managers/pipeline_manager.py index 8c0f6c418..f2507d522 100644 --- a/src/mavedb/worker/lib/managers/pipeline_manager.py +++ b/src/mavedb/worker/lib/managers/pipeline_manager.py @@ -1246,7 +1246,7 @@ def set_pipeline_status(self, new_status: PipelineStatus) -> None: # Ensure finished_at is set/cleared appropriately if new_status in TERMINAL_PIPELINE_STATUSES: - pipeline.finished_at = datetime.now() + pipeline.finished_at = datetime.now(timezone.utc) else: pipeline.finished_at = None @@ -1254,7 +1254,7 @@ def set_pipeline_status(self, new_status: PipelineStatus) -> None: if new_status == PipelineStatus.CREATED: pipeline.started_at = None elif new_status == PipelineStatus.RUNNING and pipeline.started_at is None: - pipeline.started_at = datetime.now() + pipeline.started_at = datetime.now(timezone.utc) except (AttributeError, TypeError, KeyError, ValueError) as e: logger.debug(f"Object manipulation failed setting status for pipeline {self.pipeline_id}: {e}") diff --git a/src/mavedb/worker/lib/managers/utils.py b/src/mavedb/worker/lib/managers/utils.py index 49135599c..a16737977 100644 --- a/src/mavedb/worker/lib/managers/utils.py +++ b/src/mavedb/worker/lib/managers/utils.py @@ -160,8 +160,7 @@ def job_should_be_skipped_due_to_unfulfillable_dependency( if dependency_type == DependencyType.SUCCESS_REQUIRED: if dependent_job_status in (JobStatus.FAILED, JobStatus.ERRORED, JobStatus.SKIPPED, JobStatus.CANCELLED): logger.debug( - f"Job should be skipped due to unfulfillable 'success_required' dependency " - f"({dependent_job_status})." + f"Job should be skipped due to unfulfillable 'success_required' dependency ({dependent_job_status})." ) return True, f"Dependency did not succeed ({dependent_job_status})" @@ -169,8 +168,7 @@ def job_should_be_skipped_due_to_unfulfillable_dependency( if dependency_type == DependencyType.COMPLETION_REQUIRED: if dependent_job_status in (JobStatus.CANCELLED, JobStatus.SKIPPED): logger.debug( - f"Job should be skipped due to unfulfillable 'completion_required' dependency " - f"({dependent_job_status})." + f"Job should be skipped due to unfulfillable 'completion_required' dependency ({dependent_job_status})." ) return True, f"Dependency was not completed successfully ({dependent_job_status})" diff --git a/src/mavedb/worker/pipeline_management.md b/src/mavedb/worker/pipeline_management.md index 9064fdb74..7b68e8f2c 100644 --- a/src/mavedb/worker/pipeline_management.md +++ b/src/mavedb/worker/pipeline_management.md @@ -43,14 +43,14 @@ PIPELINE_DEFINITIONS: dict[str, PipelineDefinition] = { "description": "Human-readable description of what this pipeline does", "job_definitions": [ { - "key": "first_job", # Unique key within pipeline - "function": "first_job_function_name", # Must match registered function name - "type": JobType.VARIANT_CREATION, # Job category enum + "key": "first_job", # Unique key within pipeline + "function": "first_job_function_name", # Must match registered function name + "type": JobType.VARIANT_CREATION, # Job category enum "params": { - "score_set_id": None, # None = filled at runtime from pipeline_params + "score_set_id": None, # None = filled at runtime from pipeline_params "correlation_id": None, }, - "dependencies": [], # No dependencies = runs first + "dependencies": [], # No dependencies = runs first }, { "key": "second_job", diff --git a/tests/bin/__init__.py b/tests/bin/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/bin/test_check_migrations.py b/tests/bin/test_check_migrations.py new file mode 100644 index 000000000..bda6be59a --- /dev/null +++ b/tests/bin/test_check_migrations.py @@ -0,0 +1,75 @@ +"""Tests for bin/check-migrations, the CI guard that keeps the migration history replayable.""" + +import importlib.util +from importlib.machinery import SourceFileLoader +from pathlib import Path + +import pytest + +# bin/check-migrations has no .py suffix, so it needs an explicit loader. +_loader = SourceFileLoader("check_migrations", str(Path(__file__).resolve().parents[2] / "bin" / "check-migrations")) +_spec = importlib.util.spec_from_loader(_loader.name, _loader) +assert _spec is not None +check_migrations = importlib.util.module_from_spec(_spec) +_loader.exec_module(check_migrations) + + +def problems_in(tmp_path: Path, source: str) -> list[str]: + migration = tmp_path / "abc123_example.py" + migration.write_text(source) + return check_migrations.check(migration) + + +@pytest.mark.unit +@pytest.mark.parametrize( + "source, reason", + [ + ("from mavedb.models.variant import Variant\n", "imports application code"), + ("import mavedb.lib.urns\n", "imports application code"), + ("from sqlalchemy.orm import Session\n", "uses the ORM"), + ("import requests\n", "makes network calls"), + ("def upgrade():\n with op.get_context().autocommit_block():\n pass\n", "autocommit_block"), + ("def upgrade():\n op.execute('CREATE INDEX concurrently ix ON t (c)')\n", "CONCURRENTLY"), + ("def upgrade():\n op.get_bind().commit()\n", "commits mid-upgrade"), + ("def upgrade():\n op.execute(\"ALTER TYPE state ADD value 'done'\")\n", "adds an enum value"), + ], + ids=[ + "mavedb-from-import", + "mavedb-import", + "orm", + "network", + "autocommit-block", + "concurrently", + "commit", + "enum-add-value", + ], +) +def test_check_forbidden_pattern_reports_one_problem(tmp_path, source, reason): + problems = problems_in(tmp_path, source) + + assert len(problems) == 1 + assert reason in problems[0] + + +@pytest.mark.unit +def test_check_concurrently_in_docstrings_passes(tmp_path): + source = ( + '"""Build by hand first: CREATE INDEX CONCURRENTLY ix ON t (c)."""\n' + "def upgrade():\n" + ' """Then CONCURRENTLY is skipped here."""\n' + " op.execute('CREATE INDEX IF NOT EXISTS ix ON t (c)')\n" + ) + + assert problems_in(tmp_path, source) == [] + + +@pytest.mark.unit +def test_check_alembic_and_sqlalchemy_core_imports_pass(tmp_path): + source = "import sqlalchemy as sa\nfrom alembic import op\nfrom sqlalchemy.dialects import postgresql\n" + + assert problems_in(tmp_path, source) == [] + + +@pytest.mark.unit +def test_main_current_migrations_pass(): + assert check_migrations.main([]) == 0 diff --git a/tests/conftest.py b/tests/conftest.py index d2825fcdb..0bbd66648 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -9,7 +9,8 @@ import pytest import pytest_postgresql import pytest_socket -from sqlalchemy import create_engine, text +from pytest_postgresql import factories +from sqlalchemy import URL, create_engine, text from sqlalchemy.orm import sessionmaker from sqlalchemy.pool import NullPool @@ -64,6 +65,45 @@ email_validator.TEST_ENVIRONMENT = True +def _load_schema(host, port, user, dbname, password): + """Build the schema once into the server's template database, which each test's database is cloned from.""" + engine = create_engine( + URL.create("postgresql+psycopg2", username=user, password=password, host=host, port=port, database=dbname), + poolclass=NullPool, + ) + Base.metadata.create_all(bind=engine) + + # Create a unique index for the published_variants_materialized_view to + # enforce uniqueness on (variant_id, mapping_record_id, score_set_id). This + # allows us to test mat view refreshes that require this constraint. + with engine.begin() as conn: + conn.execute( + text("""CREATE UNIQUE INDEX IF NOT EXISTS published_variants_mv_unique_idx + ON published_variants_materialized_view (variant_id, mapping_record_id, score_set_id)"""), + ) + engine.dispose() + + +# With MAVEDB_TEST_DB_PORT set (bin/t sets it when bin/test-db is running), tests use that tmpfs-backed +# server instead of starting one in $TMPDIR, keeping per-test database churn off the host filesystem. +# The run id keeps concurrent runs against the shared server from colliding on database names; it is +# set before xdist starts its workers so they all inherit the same one. +if os.environ.get("MAVEDB_TEST_DB_PORT"): + _run_id = os.environ.setdefault("MAVEDB_TEST_RUN_ID", os.urandom(4).hex()) + postgresql_server = factories.postgresql_noproc( + host="127.0.0.1", + port=os.environ["MAVEDB_TEST_DB_PORT"], + user="postgres", + password="postgres", + dbname=f"mavedb_test_{_run_id}", + load=[_load_schema], + ) +else: + postgresql_server = factories.postgresql_proc(load=[_load_schema]) + +postgresql = factories.postgresql("postgresql_server") + + def pytest_runtest_setup(item): # Only block sockets for tests not marked with 'network' if "network" not in item.keywords: @@ -84,30 +124,26 @@ def session(postgresql): # Un-comment this line to log all database queries: # logging.getLogger("sqlalchemy.engine").setLevel(logging.INFO) - connection = ( - f"postgresql+psycopg2://{postgresql.info.user}:" - f"@{postgresql.info.host}:{postgresql.info.port}/{postgresql.info.dbname}" + connection = URL.create( + "postgresql+psycopg2", + username=postgresql.info.user, + password=postgresql.info.password or None, + host=postgresql.info.host, + port=postgresql.info.port, + database=postgresql.info.dbname, ) - engine = create_engine(connection, echo=False, poolclass=NullPool) + # The database is a fresh clone of the schema template and is dropped after the test, so there's + # no create_all or drop_all here. A pooled engine reuses one connection across commits instead of + # reconnecting after each; under xdist, reconnecting overwhelms Docker's port forwarding. + engine = create_engine(connection, echo=False) session = sessionmaker(autocommit=False, autoflush=False, bind=engine)() - Base.metadata.create_all(bind=engine) - - # Create a unique index for the published_variants_materialized_view to - # enforce uniqueness on (variant_id, mapping_record_id, score_set_id). This - # allows us to test mat view refreshes that require this constraint. - session.execute( - text("""CREATE UNIQUE INDEX IF NOT EXISTS published_variants_mv_unique_idx - ON published_variants_materialized_view (variant_id, mapping_record_id, score_set_id)"""), - ) - session.commit() - try: yield session finally: session.close() - Base.metadata.drop_all(bind=engine) + engine.dispose() @pytest.fixture diff --git a/tests/conftest_optional.py b/tests/conftest_optional.py index d61b07c52..38395d54b 100644 --- a/tests/conftest_optional.py +++ b/tests/conftest_optional.py @@ -101,6 +101,9 @@ async def worker_test(arq_redis, arq_worker): ``` """ + # One pool for the fixture, shut down on teardown, so jobs don't each leave worker processes behind. + pool = futures.ProcessPoolExecutor() + async def on_startup(ctx): pass @@ -109,7 +112,7 @@ async def on_job(ctx): ctx["hdp"] = data_provider ctx["seqrepo"] = Mock(spec=SeqRepoDataProxy) # mirrors lifecycle.on_job_start ctx["state"] = {} - ctx["pool"] = futures.ProcessPoolExecutor() + ctx["pool"] = pool worker_ = Worker( functions=BACKGROUND_FUNCTIONS + [dummy_arq_function], @@ -127,18 +130,23 @@ async def on_job(ctx): yield worker_ finally: await worker_.close() + pool.shutdown(cancel_futures=True) @pytest.fixture def standalone_worker_context(data_provider, arq_redis): - yield { - "hdp": data_provider, - "seqrepo": Mock(spec=SeqRepoDataProxy), # mirrors lifecycle.on_job_start - "state": {}, - "job_id": "test_job", - "redis": arq_redis, - "pool": futures.ProcessPoolExecutor(), - } + pool = futures.ProcessPoolExecutor() + try: + yield { + "hdp": data_provider, + "seqrepo": Mock(spec=SeqRepoDataProxy), # mirrors lifecycle.on_job_start + "state": {}, + "job_id": "test_job", + "redis": arq_redis, + "pool": pool, + } + finally: + pool.shutdown(cancel_futures=True) #################################################################################################### diff --git a/tests/helpers/mocks/README.md b/tests/helpers/mocks/README.md index 68a0d5d87..c6849e238 100644 --- a/tests/helpers/mocks/README.md +++ b/tests/helpers/mocks/README.md @@ -38,7 +38,7 @@ score_set = create_mock_score_set(created_by=user) from tests.helpers.mocks.factories import ( create_mock_functional_classification, create_mock_score_calibration, - create_mock_mapped_variant_with_functional_calibration_score_set + create_mock_mapped_variant_with_functional_calibration_score_set, ) classification = create_mock_functional_classification() @@ -48,17 +48,12 @@ mapped_variant = create_mock_mapped_variant_with_functional_calibration_score_se ### For Custom Mock Behavior ```python -from tests.helpers.mocks.mock_utilities import ( - MockObjectWithPydanticFunctionality, - MockVariantCollection -) +from tests.helpers.mocks.mock_utilities import MockObjectWithPydanticFunctionality, MockVariantCollection # Mock that works with both Pydantic validation and attribute access -mock_data = MockObjectWithPydanticFunctionality({ - "camelCaseKey": "value" -}) +mock_data = MockObjectWithPydanticFunctionality({"camelCaseKey": "value"}) assert mock_data["camelCaseKey"] == "value" # Dict access -assert mock_data.camel_case_key == "value" # Attribute access (snake_case) +assert mock_data.camel_case_key == "value" # Attribute access (snake_case) # Mock collection for controlling variant membership tests variants = MockVariantCollection(contains_result=True) diff --git a/tests/helpers/util/access_key.py b/tests/helpers/util/access_key.py index 3058a24cb..8515ea830 100644 --- a/tests/helpers/util/access_key.py +++ b/tests/helpers/util/access_key.py @@ -1,47 +1,27 @@ -import secrets - +from fastapi.testclient import TestClient from sqlalchemy import select from sqlalchemy.orm import Session -from fastapi.testclient import TestClient -from mavedb.models.access_key import AccessKey from mavedb.models.user import User -from mavedb.models.enums.user_role import UserRole - -from mavedb.routers.access_keys import generate_key_pair +from mavedb.routers.access_keys import new_access_key def create_api_key_for_user(db: Session, username: str) -> str: user = db.scalars(select(User).where(User.username == username)).one() - private_key, public_key = generate_key_pair() - - item = AccessKey(user=user, key_id=secrets.token_urlsafe(32), public_key=public_key) - db.add(item) - db.commit() - db.refresh(item) - - return item.key_id - - -def create_admin_key_for_user(db: Session, username: str) -> str: - user = db.scalars(select(User).where(User.username == username)).one() - private_key, public_key = generate_key_pair() - - item = AccessKey(user=user, key_id=secrets.token_urlsafe(32), public_key=public_key, role=UserRole.admin) + key, _, item = new_access_key(user) db.add(item) db.commit() - db.refresh(item) - return item.public_key + return key -def create_api_key_for_current_user(client: TestClient) -> str: +def create_api_key_for_current_user(client: TestClient) -> dict: response = client.post("api/v1/users/me/access-keys") assert response.status_code == 200 - return response.json()["keyId"] + return response.json() -def create_admin_key_for_current_user(client: TestClient) -> str: +def create_admin_key_for_current_user(client: TestClient) -> dict: response = client.post("api/v1/users/me/access-keys/admin") assert response.status_code == 200 - return response.json()["keyId"] + return response.json() diff --git a/tests/helpers/util/score_set.py b/tests/helpers/util/score_set.py index 7a0f3df46..855132d96 100644 --- a/tests/helpers/util/score_set.py +++ b/tests/helpers/util/score_set.py @@ -165,9 +165,9 @@ def create_seq_score_set_with_variants( count_columns_metadata_json_path, ) - assert ( - score_set["numVariants"] == 3 - ), f"Could not create sequence based score set with variants within experiment {experiment_urn}" + assert score_set["numVariants"] == 3, ( + f"Could not create sequence based score set with variants within experiment {experiment_urn}" + ) jsonschema.validate(instance=score_set, schema=ScoreSet.model_json_schema()) return score_set @@ -196,9 +196,9 @@ def create_acc_score_set_with_variants( count_columns_metadata_json_path, ) - assert ( - score_set["numVariants"] == 3 - ), f"Could not create sequence based score set with variants within experiment {experiment_urn}" + assert score_set["numVariants"] == 3, ( + f"Could not create sequence based score set with variants within experiment {experiment_urn}" + ) jsonschema.validate(instance=score_set, schema=ScoreSet.model_json_schema()) return score_set diff --git a/tests/lib/annotation/test_annotate.py b/tests/lib/annotation/test_annotate.py index c7e2215ad..363605b5d 100644 --- a/tests/lib/annotation/test_annotate.py +++ b/tests/lib/annotation/test_annotate.py @@ -342,9 +342,9 @@ def test_pathogenicity_evidence_line_has_evidence_items_are_statement_instances( assert evidence_line.hasEvidenceItems is not None for evidence_item in evidence_line.hasEvidenceItems: # Must be a model instance, not a raw dict - assert not isinstance( - evidence_item, dict - ), "hasEvidenceItems contained a raw dict instead of a model instance" + assert not isinstance(evidence_item, dict), ( + "hasEvidenceItems contained a raw dict instead of a model instance" + ) assert evidence_item.type == "Statement" def test_no_statement_is_built_from_a_private_calibration( diff --git a/tests/lib/csv/test_build_limiter.py b/tests/lib/csv/test_build_limiter.py index 8c69ddae5..c4662de30 100644 --- a/tests/lib/csv/test_build_limiter.py +++ b/tests/lib/csv/test_build_limiter.py @@ -25,7 +25,13 @@ def one_slot(monkeypatch): @pytest.mark.unit @pytest.mark.parametrize( "num_variants, start, limit, expected", - [(648022, None, None, 648022), (648022, 600000, 50000, 48022), (648022, None, 5, 5), (10, 20, None, 0)], + [ + (648022, None, None, 648022), + (648022, 600000, 50000, 48022), + (648022, None, 5, 5), + (10, 20, None, 0), + (10, None, 0, 0), + ], ) def test_rows_to_build(num_variants, start, limit, expected): assert rows_to_build(num_variants, start, limit) == expected diff --git a/tests/lib/csv/test_fetch.py b/tests/lib/csv/test_fetch.py index b7febd43f..cd26c35a4 100644 --- a/tests/lib/csv/test_fetch.py +++ b/tests/lib/csv/test_fetch.py @@ -12,7 +12,18 @@ from mavedb.lib.csv.fetch import fetch_variant_csv_data from tests.helpers.util.query_plan import captured_statements -VARIANT_NUMBER_INDEX = "ix_variants_scoreset_number" +VARIANT_NUMBER_INDEX = "ix_variants_scoreset_number_covering" + + +def _plan_nodes(node, ancestors=()): + """Every node of an ``EXPLAIN (FORMAT JSON)`` plan, with the node types above it.""" + yield node, ancestors + for child in node.get("Plans", []): + yield from _plan_nodes(child, (*ancestors, node["Node Type"])) + + +def _conditions(node) -> str: + return " ".join(str(node.get(key, "")) for key in ("Index Cond", "Filter", "Recheck Cond")) def _captured_variant_query(session, namespaces, start=None, limit=None): @@ -35,7 +46,7 @@ def _captured_variant_query(session, namespaces, start=None, limit=None): class TestVariantNumberOrdering: @pytest.mark.parametrize("namespaces", [["scores"], ["scores", "mavedb"]], ids=["scores", "with_mappings"]) def test_score_set_query_is_served_by_the_variant_number_index(self, session, namespaces): - statement, parameters = _captured_variant_query(session, namespaces, start=250000, limit=50000) + statement, parameters = _captured_variant_query(session, namespaces) # Rule out the alternatives so the plan shows whether the index can serve the ORDER BY at all. session.execute(text("SET LOCAL enable_seqscan = off")) @@ -46,3 +57,38 @@ def test_score_set_query_is_served_by_the_variant_number_index(self, session, na assert VARIANT_NUMBER_INDEX in plan assert "Sort" not in plan + + @pytest.mark.parametrize("namespaces", [["scores"], ["scores", "mavedb"]], ids=["scores", "with_mappings"]) + def test_fetch_variant_csv_data_score_set_page_scans_the_score_set_only_for_its_ids(self, session, namespaces): + statement, parameters = _captured_variant_query(session, namespaces, start=250000, limit=50000) + + # Rule out the alternatives, so a query that still lets the planner walk the score set for its full + # rows, or sort the whole score set, gets that plan. + session.execute(text("SET LOCAL enable_seqscan = off")) + session.execute(text("SET LOCAL enable_bitmapscan = off")) + session.execute(text("SET LOCAL enable_sort = off")) + cursor = session.connection().connection.cursor() + cursor.execute("EXPLAIN (FORMAT JSON) " + statement, parameters) + nodes = list(_plan_nodes(cursor.fetchone()[0][0]["Plan"])) + + assert any( + node["Node Type"] == "Index Only Scan" and node.get("Index Name") == VARIANT_NUMBER_INDEX + for node, _ in nodes + ) + # Only the page's id selection may scan the score set; everything else is driven by the page's ids. + score_set_scans = [ + (node, ancestors) + for node, ancestors in nodes + if node.get("Relation Name") == "variants" and "scoreset_id" in _conditions(node) + ] + assert score_set_scans + for node, ancestors in score_set_scans: + assert "Limit" in ancestors, f"{node['Node Type']} over the whole score set outside the page's LIMIT" + + @pytest.mark.parametrize("start,limit", [(1, 1), (0, None), (None, 0)], ids=["page", "zero_start", "zero_limit"]) + def test_fetch_variant_csv_data_paged_variant_set_raises(self, session, start, limit): + plan = plan_csv_columns({"score_columns": ["score"]}, ["scores"]) + with pytest.raises(ValueError, match="start and limit"): + fetch_variant_csv_data( + session, plan.namespaced_columns, plan.clinvar_namespaces, variant_ids=[1], start=start, limit=limit + ) diff --git a/tests/lib/csv/test_variant.py b/tests/lib/csv/test_variant.py index 0b67aec3d..62ca3196d 100644 --- a/tests/lib/csv/test_variant.py +++ b/tests/lib/csv/test_variant.py @@ -847,9 +847,9 @@ def test_namespace_discovery_does_not_scan_score_set_variants(self, session, set for statement in statements if "score_calibrations" in statement and " variants" in statement.replace("\n", " ") ] - assert ( - calibration_scans == [] - ), "calibration discovery joined the variants table; it should filter on score_set_id" + assert calibration_scans == [], ( + "calibration discovery joined the variants table; it should filter on score_set_id" + ) def test_base_namespaces_are_all_present_by_default(self, session, setup_lib_db_with_mapped_variant): variant = setup_lib_db_with_mapped_variant.variant diff --git a/tests/lib/permissions/test_collection.py b/tests/lib/permissions/test_collection.py index b9852b611..6e0b3f308 100644 --- a/tests/lib/permissions/test_collection.py +++ b/tests/lib/permissions/test_collection.py @@ -56,9 +56,9 @@ def test_collection_handles_all_actions() -> None: supported = set(COLLECTION_SUPPORTED_ACTIONS) unsupported = set(COLLECTION_UNSUPPORTED_ACTIONS) - assert ( - supported.union(unsupported) == all_actions - ), "Some actions are not categorized as supported or unsupported for collections." + assert supported.union(unsupported) == all_actions, ( + "Some actions are not categorized as supported or unsupported for collections." + ) class TestCollectionHasPermission: @@ -168,7 +168,9 @@ class TestCollectionReadActionHandler: PermissionTest("Collection", "published", "anonymous", Action.READ, True), PermissionTest("Collection", "private", "anonymous", Action.READ, False, 404), ], - ids=lambda tc: f"{tc.user_type}_{tc.collection_role if tc.collection_role else 'no_role'}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.collection_role if tc.collection_role else 'no_role'}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_read_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_read_action helper function directly.""" @@ -233,7 +235,9 @@ class TestCollectionUpdateActionHandler: PermissionTest("Collection", "private", "anonymous", Action.UPDATE, False, 404), PermissionTest("Collection", "published", "anonymous", Action.UPDATE, False, 401), ], - ids=lambda tc: f"{tc.user_type}_{tc.collection_role if tc.collection_role else 'no_role'}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.collection_role if tc.collection_role else 'no_role'}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_update_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_update_action helper function directly.""" @@ -300,7 +304,9 @@ class TestCollectionDeleteActionHandler: PermissionTest("Collection", "private", "anonymous", Action.DELETE, False, 404), PermissionTest("Collection", "published", "anonymous", Action.DELETE, False, 401), ], - ids=lambda tc: f"{tc.user_type}_{tc.collection_role if tc.collection_role else 'no_role'}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.collection_role if tc.collection_role else 'no_role'}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_delete_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_delete_action helper function directly.""" @@ -377,7 +383,9 @@ class TestCollectionPublishActionHandler: PermissionTest("Collection", "private", "anonymous", Action.PUBLISH, False, 404), PermissionTest("Collection", "published", "anonymous", Action.PUBLISH, False, 401), ], - ids=lambda tc: f"{tc.user_type}_{tc.collection_role if tc.collection_role else 'no_role'}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.collection_role if tc.collection_role else 'no_role'}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_publish_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_publish_action helper function directly.""" @@ -462,7 +470,9 @@ class TestCollectionAddExperimentActionHandler: PermissionTest("Collection", "private", "anonymous", Action.ADD_EXPERIMENT, False, 404), PermissionTest("Collection", "published", "anonymous", Action.ADD_EXPERIMENT, False, 401), ], - ids=lambda tc: f"{tc.user_type}_{tc.collection_role if tc.collection_role else 'no_role'}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.collection_role if tc.collection_role else 'no_role'}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_add_experiment_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_add_experiment_action helper function directly.""" @@ -542,7 +552,9 @@ class TestCollectionAddScoreSetActionHandler: PermissionTest("Collection", "private", "anonymous", Action.ADD_SCORE_SET, False, 404), PermissionTest("Collection", "published", "anonymous", Action.ADD_SCORE_SET, False, 401), ], - ids=lambda tc: f"{tc.user_type}_{tc.collection_role if tc.collection_role else 'no_role'}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.collection_role if tc.collection_role else 'no_role'}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_add_score_set_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_add_score_set_action helper function directly.""" @@ -617,7 +629,9 @@ class TestCollectionAddRoleActionHandler: PermissionTest("Collection", "private", "anonymous", Action.ADD_ROLE, False, 404), PermissionTest("Collection", "published", "anonymous", Action.ADD_ROLE, False, 401), ], - ids=lambda tc: f"{tc.user_type}_{tc.collection_role if tc.collection_role else 'no_role'}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.collection_role if tc.collection_role else 'no_role'}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_add_role_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_add_role_action helper function directly.""" @@ -710,7 +724,9 @@ class TestCollectionAddBadgeActionHandler: PermissionTest("Collection", "private", "anonymous", Action.ADD_BADGE, False, 404), PermissionTest("Collection", "published", "anonymous", Action.ADD_BADGE, False, 401), ], - ids=lambda tc: f"{tc.user_type}_{tc.collection_role if tc.collection_role else 'no_role'}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.collection_role if tc.collection_role else 'no_role'}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_add_badge_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_add_badge_action helper function directly.""" diff --git a/tests/lib/permissions/test_experiment.py b/tests/lib/permissions/test_experiment.py index 1ea5a6399..d1d11b2b7 100644 --- a/tests/lib/permissions/test_experiment.py +++ b/tests/lib/permissions/test_experiment.py @@ -45,9 +45,9 @@ def test_experiment_handles_all_actions() -> None: supported = set(EXPERIMENT_SUPPORTED_ACTIONS) unsupported = set(EXPERIMENT_UNSUPPORTED_ACTIONS) - assert ( - supported.union(unsupported) == all_actions - ), "Some actions are not categorized as supported or unsupported for experiments." + assert supported.union(unsupported) == all_actions, ( + "Some actions are not categorized as supported or unsupported for experiments." + ) class TestExperimentHasPermission: @@ -122,7 +122,9 @@ class TestExperimentReadActionHandler: PermissionTest("Experiment", "published", "anonymous", Action.READ, True), PermissionTest("Experiment", "private", "anonymous", Action.READ, False, 404), ], - ids=lambda tc: f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_read_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_read_action helper function directly.""" @@ -169,7 +171,9 @@ class TestExperimentUpdateActionHandler: PermissionTest("Experiment", "private", "anonymous", Action.UPDATE, False, 404), PermissionTest("Experiment", "published", "anonymous", Action.UPDATE, False, 401), ], - ids=lambda tc: f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_update_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_update_action helper function directly.""" @@ -214,7 +218,9 @@ class TestExperimentDeleteActionHandler: PermissionTest("Experiment", "private", "mapper", Action.DELETE, False, 404), PermissionTest("Experiment", "published", "mapper", Action.DELETE, False, 403), ], - ids=lambda tc: f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_delete_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_delete_action helper function directly.""" @@ -259,7 +265,9 @@ class TestExperimentAddScoreSetActionHandler: PermissionTest("Experiment", "private", "anonymous", Action.ADD_SCORE_SET, False, 404), PermissionTest("Experiment", "published", "anonymous", Action.ADD_SCORE_SET, False, 401), ], - ids=lambda tc: f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_add_score_set_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_add_score_set_action helper function directly.""" diff --git a/tests/lib/permissions/test_experiment_set.py b/tests/lib/permissions/test_experiment_set.py index 9e7c42b20..b47d08e16 100644 --- a/tests/lib/permissions/test_experiment_set.py +++ b/tests/lib/permissions/test_experiment_set.py @@ -45,9 +45,9 @@ def test_experiment_set_handles_all_actions() -> None: supported = set(EXPERIMENT_SET_SUPPORTED_ACTIONS) unsupported = set(EXPERIMENT_SET_UNSUPPORTED_ACTIONS) - assert ( - supported.union(unsupported) == all_actions - ), "Some actions are not categorized as supported or unsupported for experiment sets." + assert supported.union(unsupported) == all_actions, ( + "Some actions are not categorized as supported or unsupported for experiment sets." + ) class TestExperimentSetHasPermission: @@ -122,7 +122,9 @@ class TestExperimentSetReadActionHandler: PermissionTest("ExperimentSet", "published", "anonymous", Action.READ, True), PermissionTest("ExperimentSet", "private", "anonymous", Action.READ, False, 404), ], - ids=lambda tc: f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_read_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_read_action helper function directly.""" @@ -171,7 +173,9 @@ class TestExperimentSetUpdateActionHandler: PermissionTest("ExperimentSet", "private", "anonymous", Action.UPDATE, False, 404), PermissionTest("ExperimentSet", "published", "anonymous", Action.UPDATE, False, 401), ], - ids=lambda tc: f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_update_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_update_action helper function directly.""" @@ -218,7 +222,9 @@ class TestExperimentSetDeleteActionHandler: PermissionTest("ExperimentSet", "private", "mapper", Action.DELETE, False, 404), PermissionTest("ExperimentSet", "published", "mapper", Action.DELETE, False, 403), ], - ids=lambda tc: f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_delete_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_delete_action helper function directly.""" @@ -265,7 +271,9 @@ class TestExperimentSetAddExperimentActionHandler: PermissionTest("ExperimentSet", "private", "anonymous", Action.ADD_EXPERIMENT, False, 404), PermissionTest("ExperimentSet", "published", "anonymous", Action.ADD_EXPERIMENT, False, 401), ], - ids=lambda tc: f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_add_experiment_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_add_experiment_action helper function directly.""" diff --git a/tests/lib/permissions/test_score_calibration.py b/tests/lib/permissions/test_score_calibration.py index 75120c6fa..e03be8944 100644 --- a/tests/lib/permissions/test_score_calibration.py +++ b/tests/lib/permissions/test_score_calibration.py @@ -47,9 +47,9 @@ def test_score_calibration_handles_all_actions() -> None: supported = set(SCORE_CALIBRATION_SUPPORTED_ACTIONS) unsupported = set(SCORE_CALIBRATION_UNSUPPORTED_ACTIONS) - assert ( - supported.union(unsupported) == all_actions - ), "Some actions are not categorized as supported or unsupported for score calibrations." + assert supported.union(unsupported) == all_actions, ( + "Some actions are not categorized as supported or unsupported for score calibrations." + ) class TestScoreCalibrationHasPermission: diff --git a/tests/lib/permissions/test_score_set.py b/tests/lib/permissions/test_score_set.py index 2d5a0c497..fd004b90f 100644 --- a/tests/lib/permissions/test_score_set.py +++ b/tests/lib/permissions/test_score_set.py @@ -47,9 +47,9 @@ def test_score_set_handles_all_actions() -> None: supported = set(SCORE_SET_SUPPORTED_ACTIONS) unsupported = set(SCORE_SET_UNSUPPORTED_ACTIONS) - assert ( - supported.union(unsupported) == all_actions - ), "Some actions are not categorized as supported or unsupported for score sets." + assert supported.union(unsupported) == all_actions, ( + "Some actions are not categorized as supported or unsupported for score sets." + ) class TestScoreSetHasPermission: @@ -124,7 +124,9 @@ class TestScoreSetReadActionHandler: PermissionTest("ScoreSet", "published", "anonymous", Action.READ, True), PermissionTest("ScoreSet", "private", "anonymous", Action.READ, False, 404), ], - ids=lambda tc: f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_read_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_read_action helper function directly.""" @@ -171,7 +173,9 @@ class TestScoreSetUpdateActionHandler: PermissionTest("ScoreSet", "private", "anonymous", Action.UPDATE, False, 404), PermissionTest("ScoreSet", "published", "anonymous", Action.UPDATE, False, 401), ], - ids=lambda tc: f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_update_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_update_action helper function directly.""" @@ -216,7 +220,9 @@ class TestScoreSetDeleteActionHandler: PermissionTest("ScoreSet", "private", "mapper", Action.DELETE, False, 404), PermissionTest("ScoreSet", "published", "mapper", Action.DELETE, False, 403), ], - ids=lambda tc: f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_delete_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_delete_action helper function directly.""" @@ -261,7 +267,9 @@ class TestScoreSetSetScoresActionHandler: PermissionTest("ScoreSet", "private", "anonymous", Action.SET_SCORES, False, 404), PermissionTest("ScoreSet", "published", "anonymous", Action.SET_SCORES, False, 401), ], - ids=lambda tc: f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_set_scores_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_set_scores_action helper function directly.""" @@ -308,7 +316,9 @@ class TestScoreSetPublishActionHandler: PermissionTest("ScoreSet", "private", "anonymous", Action.PUBLISH, False, 404), PermissionTest("ScoreSet", "published", "anonymous", Action.PUBLISH, False, 401), ], - ids=lambda tc: f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_publish_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_publish_action helper function directly.""" @@ -353,7 +363,9 @@ class TestScoreSetAddCalibrationActionHandler: PermissionTest("ScoreSet", "private", "anonymous", Action.ADD_CALIBRATION, False, 404), PermissionTest("ScoreSet", "published", "anonymous", Action.ADD_CALIBRATION, False, 401), ], - ids=lambda tc: f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}", + ids=lambda tc: ( + f"{tc.user_type}_{tc.entity_state}_{tc.action.value}_{'permitted' if tc.should_be_permitted else 'denied'}" + ), ) def test_handle_add_calibration_action(self, test_case: PermissionTest, entity_helper: EntityTestHelper) -> None: """Test _handle_add_calibration_action helper function directly.""" diff --git a/tests/lib/permissions/test_user.py b/tests/lib/permissions/test_user.py index d68f96964..b23cb132e 100644 --- a/tests/lib/permissions/test_user.py +++ b/tests/lib/permissions/test_user.py @@ -45,9 +45,9 @@ def test_user_handles_all_actions() -> None: supported = set(USER_SUPPORTED_ACTIONS) unsupported = set(USER_UNSUPPORTED_ACTIONS) - assert ( - supported.union(unsupported) == all_actions - ), "Some actions are not categorized as supported or unsupported for users." + assert supported.union(unsupported) == all_actions, ( + "Some actions are not categorized as supported or unsupported for users." + ) class TestUserHasPermission: diff --git a/tests/lib/test_authentication.py b/tests/lib/test_authentication.py index 248e34642..1300fc371 100644 --- a/tests/lib/test_authentication.py +++ b/tests/lib/test_authentication.py @@ -1,9 +1,13 @@ # ruff: noqa: E402 +import importlib.util +import secrets from datetime import datetime, timedelta +from pathlib import Path from unittest.mock import patch import pytest +from sqlalchemy import text from sqlalchemy.exc import IntegrityError arq = pytest.importorskip("arq") @@ -15,6 +19,7 @@ get_current_user, get_current_user_data_from_api_key, ) +from mavedb.models.access_key import AccessKey from mavedb.models.enums.user_role import UserRole from mavedb.models.user import User from tests.helpers.constants import ADMIN_USER, ADMIN_USER_DECODED_JWT, TEST_USER, TEST_USER_DECODED_JWT @@ -34,6 +39,28 @@ def test_get_current_user_data_from_key_invalid_token(session, setup_lib_db): assert user_data is None +def test_get_current_user_data_from_key_pre_migration_key_authenticates_after_hashing(session, setup_lib_db): + migration_path = Path(__file__).parents[2] / "alembic" / "versions" / "6987f253e02a_store_access_keys_as_hashes.py" + spec = importlib.util.spec_from_file_location("store_access_keys_as_hashes", migration_path) + migration = importlib.util.module_from_spec(spec) + spec.loader.exec_module(migration) + + user = session.query(User).filter(User.username == TEST_USER["username"]).one() + key = secrets.token_urlsafe(32) + session.add(AccessKey(user=user, key_id=key, public_key="unused")) + session.commit() + + session.execute(text(migration.HASH_ACCESS_KEYS)) + session.commit() + session.expire_all() + + stored = session.query(AccessKey).filter(AccessKey.user == user).one() + assert stored.key_id != key + assert stored.key_hint == key[-4:] + user_data = get_current_user_data_from_api_key(session, key) + assert user_data.user.username == TEST_USER["username"] + + def test_get_current_user_data_from_key_nonetype_token(session, setup_lib_db): create_api_key_for_user(session, TEST_USER["username"]) user_data = get_current_user_data_from_api_key(session, None) diff --git a/tests/lib/test_odds_paths.py b/tests/lib/test_odds_paths.py index ce44546b4..9b7673c2c 100644 --- a/tests/lib/test_odds_paths.py +++ b/tests/lib/test_odds_paths.py @@ -66,9 +66,9 @@ def test_each_interval_is_exclusive(): upper_result = oddspaths_evidence_strength_equivalent(r[1]) assert lower_result == upper_result, f"Mismatch at interval {r}" - assert all( - result not in seen for result in [lower_result, upper_result] - ), f"Duplicate classification for ratio {r}" + assert all(result not in seen for result in [lower_result, upper_result]), ( + f"Duplicate classification for ratio {r}" + ) seen.add(lower_result) diff --git a/tests/lib/workflow/test_pipeline_definitions.py b/tests/lib/workflow/test_pipeline_definitions.py index c57875d8d..551e29a58 100644 --- a/tests/lib/workflow/test_pipeline_definitions.py +++ b/tests/lib/workflow/test_pipeline_definitions.py @@ -69,9 +69,9 @@ def test_pipeline_has_description(self, pipeline_name: str) -> None: @pytest.mark.parametrize("pipeline_name", list(PIPELINE_DEFINITIONS)) def test_pipeline_has_at_least_one_job(self, pipeline_name: str) -> None: """Every pipeline must define at least one job.""" - assert PIPELINE_DEFINITIONS[pipeline_name][ - "job_definitions" - ], f"Pipeline '{pipeline_name}' has no job definitions." + assert PIPELINE_DEFINITIONS[pipeline_name]["job_definitions"], ( + f"Pipeline '{pipeline_name}' has no job definitions." + ) # --- job field validity -------------------------------------------------- diff --git a/tests/routers/conftest.py b/tests/routers/conftest.py index 0971bde47..ee5b49ed5 100644 --- a/tests/routers/conftest.py +++ b/tests/routers/conftest.py @@ -1,5 +1,4 @@ from pathlib import Path -from shutil import copytree import pytest @@ -60,6 +59,6 @@ def setup_router_db(session): @pytest.fixture -def data_files(tmp_path): - copytree(Path(__file__).absolute().parent / "data", tmp_path / "data") - return tmp_path / "data" +def data_files(): + """The shared test data directory. Tests read it in place; copy a file into tmp_path before changing it.""" + return Path(__file__).absolute().parent / "data" diff --git a/tests/routers/test_access_keys.py b/tests/routers/test_access_keys.py index 467aba08a..637d243e6 100644 --- a/tests/routers/test_access_keys.py +++ b/tests/routers/test_access_keys.py @@ -6,19 +6,55 @@ cdot = pytest.importorskip("cdot") fastapi = pytest.importorskip("fastapi") +from mavedb.lib.authentication import get_current_user_data_from_api_key, hash_access_key from mavedb.models.access_key import AccessKey from mavedb.models.enums.user_role import UserRole from mavedb.models.user import User -from tests.helpers.constants import EXTRA_USER +from tests.helpers.constants import EXTRA_USER, TEST_USER from tests.helpers.dependency_overrider import DependencyOverrider from tests.helpers.util.access_key import create_admin_key_for_current_user, create_api_key_for_current_user -def test_create_user_access_key(client, setup_router_db, session): - key_id = create_api_key_for_current_user(client) +def test_create_my_access_key_stores_hash_and_hint_not_key(client, setup_router_db, session): + created = create_api_key_for_current_user(client) + key = created["keyId"] - saved_access_key = session.query(AccessKey).filter(AccessKey.key_id == key_id).one_or_none() + saved_access_key = session.query(AccessKey).filter(AccessKey.key_id == hash_access_key(key)).one_or_none() assert saved_access_key is not None + assert saved_access_key.key_hint == key[-4:] + assert created["keyHint"] == key[-4:] + assert created["id"] == saved_access_key.id + assert session.query(AccessKey).filter(AccessKey.key_id == key).one_or_none() is None + + # Some lingering db transaction holds this test open unless it is explicitly closed. + session.commit() + + +def test_create_my_access_key_returns_key_that_authenticates(client, setup_router_db, session): + key = create_api_key_for_current_user(client)["keyId"] + + user_data = get_current_user_data_from_api_key(session, key) + assert user_data is not None + assert user_data.user.username == TEST_USER["username"] + + # Some lingering db transaction holds this test open unless it is explicitly closed. + session.commit() + + +def test_list_my_access_keys_shows_hint_never_key_or_hash(client, setup_router_db, session): + created = create_api_key_for_current_user(client) + + response = client.get("api/v1/users/me/access-keys") + assert response.status_code == 200 + listed = response.json() + assert [k["id"] for k in listed] == [created["id"]] + assert listed[0]["keyHint"] == created["keyId"][-4:] + assert "keyId" not in listed[0] + assert created["keyId"] not in response.text + assert hash_access_key(created["keyId"]) not in response.text + + # Some lingering db transaction holds this test open unless it is explicitly closed. + session.commit() # Some lingering db transaction holds this test open unless it is explicitly closed. session.commit() @@ -48,9 +84,9 @@ def test_user_cannot_create_access_key_for_role_they_dont_have(client, setup_rou def test_admin_can_create_admin_key(client, setup_router_db, session, admin_app_overrides): with DependencyOverrider(admin_app_overrides): - key_id = create_admin_key_for_current_user(client) + key = create_admin_key_for_current_user(client)["keyId"] - saved_access_key = session.query(AccessKey).filter(AccessKey.key_id == key_id).one_or_none() + saved_access_key = session.query(AccessKey).filter(AccessKey.key_id == hash_access_key(key)).one_or_none() assert saved_access_key is not None assert saved_access_key.role is UserRole.admin @@ -59,26 +95,26 @@ def test_admin_can_create_admin_key(client, setup_router_db, session, admin_app_ def test_user_can_delete_access_key(client, setup_router_db, session): - key_id = create_api_key_for_current_user(client) - saved_access_key = session.query(AccessKey).filter(AccessKey.key_id == key_id).one_or_none() + access_key_id = create_api_key_for_current_user(client)["id"] + saved_access_key = session.get(AccessKey, access_key_id) assert saved_access_key is not None - del_response = client.delete(f"api/v1/users/me/access-keys/{key_id}") + del_response = client.delete(f"api/v1/users/me/access-keys/{access_key_id}") assert del_response.status_code == 200 - saved_access_key = session.query(AccessKey).filter(AccessKey.key_id == key_id).one_or_none() - assert saved_access_key is None + session.expire_all() + assert session.get(AccessKey, access_key_id) is None # Some lingering db transaction holds this test open unless it is explicitly closed. session.commit() def test_anonymous_user_cannot_delete_access_key(client, setup_router_db, session, anonymous_app_overrides): - key_id = create_api_key_for_current_user(client) - saved_access_key = session.query(AccessKey).filter(AccessKey.key_id == key_id).one_or_none() + access_key_id = create_api_key_for_current_user(client)["id"] + saved_access_key = session.get(AccessKey, access_key_id) assert saved_access_key is not None with DependencyOverrider(anonymous_app_overrides): - del_response = client.delete(f"api/v1/users/me/access-keys/{key_id}") + del_response = client.delete(f"api/v1/users/me/access-keys/{access_key_id}") assert del_response.status_code == 401 response_value = del_response.json() @@ -89,8 +125,8 @@ def test_anonymous_user_cannot_delete_access_key(client, setup_router_db, sessio def test_user_cannot_delete_other_users_access_key(client, setup_router_db, session): - key_id = create_api_key_for_current_user(client) - saved_access_key = session.query(AccessKey).filter(AccessKey.key_id == key_id).one_or_none() + access_key_id = create_api_key_for_current_user(client)["id"] + saved_access_key = session.get(AccessKey, access_key_id) assert saved_access_key is not None extra_user = session.query(User).filter(User.username == EXTRA_USER["username"]).one_or_none() @@ -99,10 +135,10 @@ def test_user_cannot_delete_other_users_access_key(client, setup_router_db, sess session.add(saved_access_key) session.commit() - del_response = client.delete(f"api/v1/users/me/access-keys/{key_id}") + del_response = client.delete(f"api/v1/users/me/access-keys/{access_key_id}") assert del_response.status_code == 404 - saved_access_key = session.query(AccessKey).filter(AccessKey.key_id == key_id).one_or_none() - assert saved_access_key is not None + session.expire_all() + assert session.get(AccessKey, access_key_id) is not None # Some lingering db transaction holds this test open unless it is explicitly closed. session.commit() diff --git a/tests/routers/test_score_calibrations.py b/tests/routers/test_score_calibrations.py index c142ba8e0..c9045ef72 100644 --- a/tests/routers/test_score_calibrations.py +++ b/tests/routers/test_score_calibrations.py @@ -11,6 +11,7 @@ import json from unittest.mock import patch +import pandas as pd from arq import ArqRedis from sqlalchemy import select @@ -1443,6 +1444,51 @@ def test_cannot_create_score_calibration_when_csv_file_fails_decoding( assert "Error decoding file:" in str(error["detail"]) +@pytest.mark.parametrize( + "mock_publication_fetch", + [ + [ + {"dbName": "PubMed", "identifier": TEST_PUBMED_IDENTIFIER}, + {"dbName": "bioRxiv", "identifier": TEST_BIORXIV_IDENTIFIER}, + ] + ], + indirect=["mock_publication_fetch"], +) +def test_cannot_create_score_calibration_when_csv_file_fails_parsing( + client, setup_router_db, session, data_provider, data_files, mock_publication_fetch +): + experiment = create_experiment(client) + score_set = create_seq_score_set_with_mapped_variants( + client, + session, + data_provider, + experiment["urn"], + data_files / "scores.csv", + ) + + calibration_csv_path = data_files / "calibration_classes_by_urn.csv" + with ( + open(calibration_csv_path, "rb") as class_file, + patch( + "mavedb.routers.score_calibrations.csv_data_to_df", + side_effect=pd.errors.ParserError("Error tokenizing data. C error: Expected 1 fields in line 17, saw 4"), + ), + ): + response = client.post( + "/api/v1/score-calibrations", + files={"classes_file": (calibration_csv_path.name, class_file, "text/csv")}, + data={ + "calibration_json": json.dumps( + {"scoreSetUrn": score_set["urn"], **deepcamelize(TEST_BRNICH_SCORE_CALIBRATION_CLASS_BASED)} + ), + }, + ) + + assert response.status_code == 400 + error = response.json() + assert "Error parsing classes file:" in str(error["detail"]) + + @pytest.mark.parametrize( "mock_publication_fetch", [ @@ -2013,6 +2059,57 @@ def test_cannot_update_score_calibration_when_csv_file_fails_decoding( assert "Error decoding file:" in str(error["detail"]) +@pytest.mark.parametrize( + "mock_publication_fetch", + [ + [ + {"dbName": "PubMed", "identifier": TEST_PUBMED_IDENTIFIER}, + {"dbName": "bioRxiv", "identifier": TEST_BIORXIV_IDENTIFIER}, + ] + ], + indirect=["mock_publication_fetch"], +) +def test_cannot_update_score_calibration_when_csv_file_fails_parsing( + client, setup_router_db, session, data_provider, data_files, mock_publication_fetch +): + experiment = create_experiment(client) + score_set = create_seq_score_set_with_mapped_variants( + client, + session, + data_provider, + experiment["urn"], + data_files / "scores.csv", + ) + calibration = create_test_score_calibration_in_score_set_via_client( + client, score_set["urn"], deepcamelize(TEST_BRNICH_SCORE_CALIBRATION_RANGE_BASED) + ) + + calibration_csv_path = data_files / "calibration_classes_by_urn.csv" + with ( + open(calibration_csv_path, "rb") as class_file, + patch( + "mavedb.routers.score_calibrations.csv_data_to_df", + side_effect=pd.errors.ParserError("Error tokenizing data. C error: Expected 1 fields in line 17, saw 4"), + ), + ): + response = client.put( + f"/api/v1/score-calibrations/{calibration['urn']}", + files={"classes_file": (calibration_csv_path.name, class_file, "text/csv")}, + data={ + "calibration_json": json.dumps( + { + "scoreSetUrn": score_set["urn"], + **deepcamelize(TEST_BRNICH_SCORE_CALIBRATION_CLASS_BASED), + } + ), + }, + ) + + assert response.status_code == 400 + error = response.json() + assert "Error parsing classes file:" in str(error["detail"]) + + @pytest.mark.parametrize( "mock_publication_fetch", [ diff --git a/tests/routers/test_score_set.py b/tests/routers/test_score_set.py index fae869f33..b17e29fd9 100644 --- a/tests/routers/test_score_set.py +++ b/tests/routers/test_score_set.py @@ -11,6 +11,7 @@ from unittest.mock import patch import jsonschema +import pandas as pd import pytest from humps import camelize from sqlalchemy import select @@ -3963,6 +3964,56 @@ def test_upload_a_non_utf8_file(session, client, setup_router_db, data_files): ) +def test_upload_a_malformed_scores_csv_file(session, client, setup_router_db, data_files): + experiment = create_experiment(client) + score_set = create_seq_score_set(client, experiment["urn"]) + scores_csv_path = data_files / "scores.csv" + with ( + open(scores_csv_path, "rb") as scores_file, + patch( + "mavedb.routers.score_sets.csv_data_to_df", + side_effect=pd.errors.ParserError("Error tokenizing data. C error: Expected 1 fields in line 17, saw 4"), + ), + ): + response = client.post( + f"/api/v1/score-sets/{score_set['urn']}/variants/data", + files={"scores_file": (scores_csv_path.name, scores_file, "text/csv")}, + ) + assert response.status_code == 422 + response_data = response.json() + assert "Error parsing scores file:" in response_data["detail"] + assert "Ensure the file is a valid CSV." in response_data["detail"] + + +def test_upload_a_malformed_counts_csv_file(session, client, setup_router_db, data_files): + experiment = create_experiment(client) + score_set = create_seq_score_set(client, experiment["urn"]) + scores_csv_path = data_files / "scores.csv" + counts_csv_path = data_files / "scores.csv" + with ( + open(scores_csv_path, "rb") as scores_file, + open(counts_csv_path, "rb") as counts_file, + patch( + "mavedb.routers.score_sets.csv_data_to_df", + side_effect=[ + pd.read_csv(scores_csv_path), + pd.errors.ParserError("Error tokenizing data. C error: Expected 1 fields in line 17, saw 4"), + ], + ), + ): + response = client.post( + f"/api/v1/score-sets/{score_set['urn']}/variants/data", + files={ + "scores_file": (scores_csv_path.name, scores_file, "text/csv"), + "counts_file": (counts_csv_path.name, counts_file, "text/csv"), + }, + ) + assert response.status_code == 422 + response_data = response.json() + assert "Error parsing counts file:" in response_data["detail"] + assert "Ensure the file is a valid CSV." in response_data["detail"] + + ######################################################################################################################## # Score set download files ######################################################################################################################## @@ -4045,6 +4096,45 @@ def test_download_variants_data_file( assert row["mavedb.post_mapped_hgvs_at_assay_level"] == "NA" +@pytest.mark.parametrize( + "namespaces", ["namespaces=scores", "namespaces=scores&namespaces=mavedb"], ids=["scores", "with_mappings"] +) +@pytest.mark.parametrize( + "start,limit", + [(1, 1), (1, None), (None, 2), (2, 5), (0, 2)], + ids=["middle_page", "start_only", "limit_only", "limit_past_end", "zero_start"], +) +def test_download_variants_data_file_paged_matches_the_full_download( + session, data_provider, client, setup_router_db, data_files, namespaces, start, limit +): + experiment = create_experiment(client) + score_set = create_seq_score_set(client, experiment["urn"]) + score_set = mock_worker_variant_insertion(client, session, data_provider, score_set, data_files / "scores.csv") + seed_csv_substrate( + session, + score_set, + assay_level="genomic", + hgvs_g=TEST_MAPPED_VARIANT_WITH_HGVS_G_EXPRESSION["hgvs_g"], + hgvs_c=TEST_MAPPED_VARIANT_WITH_HGVS_G_EXPRESSION["hgvs_c"], + hgvs_p=TEST_MAPPED_VARIANT_WITH_HGVS_G_EXPRESSION["hgvs_p"], + ) + + url = f"/api/v1/score-sets/{score_set['urn']}/variants/data?{namespaces}" + full_response = client.get(url) + page_params = "".join( + f"&{name}={value}" for name, value in (("start", start), ("limit", limit)) if value is not None + ) + paged_response = client.get(url + page_params) + + assert full_response.status_code == 200 + assert paged_response.status_code == 200 + header, *full_rows = full_response.text.splitlines() + paged_header, *paged_rows = paged_response.text.splitlines() + first = start or 0 + assert paged_header == header + assert paged_rows == full_rows[first : first + limit if limit is not None else None] + + # Test file doesn't have hgvs_splice so its values are all NA. def test_download_scores_file(session, data_provider, client, setup_router_db, data_files): experiment = create_experiment(client) diff --git a/tests/routers/test_statistics.py b/tests/routers/test_statistics.py index 21ae62676..6618eaf76 100644 --- a/tests/routers/test_statistics.py +++ b/tests/routers/test_statistics.py @@ -96,12 +96,12 @@ def assert_statistic(desired_field_value, response): # Assert the GET request succeeded, that the desired field was present in the response, and that the number of times the field # appears in the database is 1. Tests calling this method should have created one score set containing the desired field. assert response.status_code == 200 - assert ( - desired_field_value in response.json() - ), f"Target accession statistic {desired_field_value} not present in statistic response." - assert ( - response.json()[desired_field_value] == 1 - ), f"Target accession statistic {desired_field_value} should appear on one (and only one) test score set." + assert desired_field_value in response.json(), ( + f"Target accession statistic {desired_field_value} not present in statistic response." + ) + assert response.json()[desired_field_value] == 1, ( + f"Target accession statistic {desired_field_value} should appear on one (and only one) test score set." + ) def add_query_param(url, query_name, query_value): diff --git a/tests/validation/dataframe/test_variant.py b/tests/validation/dataframe/test_variant.py index 134b2e8a0..7fa167833 100644 --- a/tests/validation/dataframe/test_variant.py +++ b/tests/validation/dataframe/test_variant.py @@ -50,6 +50,11 @@ def __init__(self): self.sequence_type = "protein" +def _label(column: pd.Series) -> str: + """Subtest label for a column; pytest-xdist can't send a pandas Series between processes.""" + return f"{column.name}: {column.tolist()}" + + class TestValidateTransgenicColumn(DfTestCase): def setUp(self): super().setUp() @@ -172,14 +177,14 @@ def setUp(self): def test_valid_columns_single_target(self): for column in self.valid_hgvs_columns: - with self.subTest(column=column): + with self.subTest(column=_label(column)): validate_hgvs_transgenic_column( column, is_index=False, targets={"test_nt": self.nt_sequence_test_case}, # type: ignore ) for column in self.valid_hgvs_columns_invalid_for_index: - with self.subTest(column=column): + with self.subTest(column=_label(column)): validate_hgvs_transgenic_column( column, is_index=False, @@ -188,14 +193,14 @@ def test_valid_columns_single_target(self): def test_valid_columns_multi_target(self): for column in self.valid_hgvs_columns_multi_target: - with self.subTest(column=column): + with self.subTest(column=_label(column)): validate_hgvs_transgenic_column( column, is_index=False, targets={"test_nt": self.nt_sequence_test_case, "test_pt": self.pt_sequence_test_case}, # type: ignore ) for column in self.valid_hgvs_columns_invalid_for_index_multi_target: - with self.subTest(column=column): + with self.subTest(column=_label(column)): validate_hgvs_transgenic_column( column, is_index=False, @@ -205,7 +210,7 @@ def test_valid_columns_multi_target(self): # Test when supplied targets do not contain a DNA sequence (only valid for hgvs_nt col) def test_valid_columns_invalid_supplied_targets(self): for column in self.valid_hgvs_columns_nt_only: - with self.subTest(column=column): + with self.subTest(column=_label(column)): with self.assertRaises(ValueError): validate_hgvs_transgenic_column( column, @@ -216,7 +221,7 @@ def test_valid_columns_invalid_supplied_targets(self): # Test when multiple supplied targets do not contain a DNA sequence (only valid for hgvs_nt col) def test_valid_columns_invalid_supplied_targets_multi_target(self): for column in self.valid_hgvs_columns_nt_only_multi_target: - with self.subTest(column=column): + with self.subTest(column=_label(column)): with self.assertRaises(ValueError): validate_hgvs_transgenic_column( column, @@ -226,7 +231,7 @@ def test_valid_columns_invalid_supplied_targets_multi_target(self): def test_valid_columns_invalid_column_name(self): for column in self.valid_hgvs_columns_invalid_names: - with self.subTest(column=column): + with self.subTest(column=_label(column)): with self.assertRaises(ValueError): validate_hgvs_transgenic_column( column, @@ -236,7 +241,7 @@ def test_valid_columns_invalid_column_name(self): def test_valid_columns_invalid_column_name_multi_target(self): for column in self.valid_hgvs_columns_invalid_names_multi_target: - with self.subTest(column=column): + with self.subTest(column=_label(column)): with self.assertRaises(ValueError): validate_hgvs_transgenic_column( column, @@ -246,14 +251,14 @@ def test_valid_columns_invalid_column_name_multi_target(self): def test_index_columns(self): for column in self.valid_hgvs_columns: - with self.subTest(column=column): + with self.subTest(column=_label(column)): validate_hgvs_transgenic_column( column, is_index=True, targets={"test_nt": self.nt_sequence_test_case}, # type: ignore ) for column in self.valid_hgvs_columns_invalid_for_index: - with self.subTest(column=column): + with self.subTest(column=_label(column)): with self.assertRaises(ValidationError): validate_hgvs_transgenic_column( column, @@ -263,14 +268,14 @@ def test_index_columns(self): def test_index_columns_multi_target(self): for column in self.valid_hgvs_columns_multi_target: - with self.subTest(column=column): + with self.subTest(column=_label(column)): validate_hgvs_transgenic_column( column, is_index=True, targets={"test_nt": self.nt_sequence_test_case, "test_pt": self.pt_sequence_test_case}, # type: ignore ) for column in self.valid_hgvs_columns_invalid_for_index_multi_target: - with self.subTest(column=column): + with self.subTest(column=_label(column)): with self.assertRaises(ValidationError): validate_hgvs_transgenic_column( column, @@ -280,7 +285,7 @@ def test_index_columns_multi_target(self): def test_invalid_column_values(self): for column in self.invalid_hgvs_columns_by_contents: - with self.subTest(column=column): + with self.subTest(column=_label(column)): with self.assertRaises(ValidationError): validate_hgvs_transgenic_column( column, @@ -288,7 +293,7 @@ def test_invalid_column_values(self): targets={"test_nt": self.nt_sequence_test_case}, # type: ignore ) for column in self.invalid_hgvs_columns_by_contents: - with self.subTest(column=column): + with self.subTest(column=_label(column)): with self.assertRaises(ValidationError): validate_hgvs_transgenic_column( column, @@ -298,7 +303,7 @@ def test_invalid_column_values(self): def test_invalid_column_values_multi_target(self): for column in self.invalid_hgvs_columns_by_contents_multi_target: - with self.subTest(column=column): + with self.subTest(column=_label(column)): with self.assertRaises(ValidationError): validate_hgvs_transgenic_column( column, @@ -306,7 +311,7 @@ def test_invalid_column_values_multi_target(self): targets={"test_nt": self.nt_sequence_test_case, "test_pt": self.pt_sequence_test_case}, # type: ignore ) for column in self.invalid_hgvs_columns_by_contents_multi_target: - with self.subTest(column=column): + with self.subTest(column=_label(column)): with self.assertRaises(ValidationError): validate_hgvs_transgenic_column( column, @@ -316,7 +321,7 @@ def test_invalid_column_values_multi_target(self): def test_valid_column_values_wrong_column_name(self): for column in self.invalid_hgvs_columns_by_name: - with self.subTest(column=column): + with self.subTest(column=_label(column)): with self.assertRaises(ValidationError): validate_hgvs_transgenic_column( column, @@ -324,7 +329,7 @@ def test_valid_column_values_wrong_column_name(self): targets={"test_nt": self.nt_sequence_test_case}, # type: ignore ) for column in self.invalid_hgvs_columns_by_name: - with self.subTest(column=column): + with self.subTest(column=_label(column)): with self.assertRaises(ValidationError): validate_hgvs_transgenic_column( column, @@ -334,7 +339,7 @@ def test_valid_column_values_wrong_column_name(self): def test_valid_column_values_wrong_column_name_multi_target(self): for column in self.invalid_hgvs_columns_by_name: - with self.subTest(column=column): + with self.subTest(column=_label(column)): with self.assertRaises(ValidationError): validate_hgvs_transgenic_column( column, @@ -342,7 +347,7 @@ def test_valid_column_values_wrong_column_name_multi_target(self): targets={"test_nt": self.nt_sequence_test_case, "test_pt": self.pt_sequence_test_case}, # type: ignore ) for column in self.invalid_hgvs_columns_by_name: - with self.subTest(column=column): + with self.subTest(column=_label(column)): with self.assertRaises(ValidationError): validate_hgvs_transgenic_column( column, @@ -528,7 +533,7 @@ def test_invalid_column_values(self): self.invalid_hgvs_columns_by_contents + self.invalid_hgvs_columns_by_contents_under_strict_validation ): with ( - self.subTest(column=column), + self.subTest(column=_label(column)), self.assertRaises(ValidationError), patch.object( cdot.hgvs.dataproviders.RESTDataProvider, "_get_transcript", return_value=TEST_NT_CDOT_TRANSCRIPT @@ -544,7 +549,7 @@ def test_invalid_column_values(self): self.invalid_hgvs_columns_by_contents + self.invalid_hgvs_columns_by_contents_under_strict_validation ): with ( - self.subTest(column=column), + self.subTest(column=_label(column)), self.assertRaises(ValidationError), patch.object( cdot.hgvs.dataproviders.RESTDataProvider, "_get_transcript", return_value=TEST_NT_CDOT_TRANSCRIPT @@ -560,7 +565,7 @@ def test_invalid_column_values(self): def test_valid_column_values_wrong_column_name(self): for column in self.invalid_hgvs_columns_by_name: with ( - self.subTest(column=column), + self.subTest(column=_label(column)), self.assertRaises(ValidationError), patch.object( cdot.hgvs.dataproviders.RESTDataProvider, "_get_transcript", return_value=TEST_NT_CDOT_TRANSCRIPT @@ -574,7 +579,7 @@ def test_valid_column_values_wrong_column_name(self): ) for column in self.invalid_hgvs_columns_by_name: with ( - self.subTest(column=column), + self.subTest(column=_label(column)), self.assertRaises(ValidationError), patch.object( cdot.hgvs.dataproviders.RESTDataProvider, "_get_transcript", return_value=TEST_NT_CDOT_TRANSCRIPT @@ -611,7 +616,7 @@ def test_valid_variant_strict_validation(self): def test_valid_variant_limited_validation(self): for column in [self.valid_hgvs_nt_column, self.valid_hgvs_pro_column]: - with self.subTest(column=column): + with self.subTest(column=_label(column)): validate_hgvs_genomic_column(column, is_index=False, targets=self.accession_test_case, hdp=None) def test_valid_variant_valid_missing_strict_validation(self): @@ -657,14 +662,14 @@ def test_valid_variant_index_strict_validation(self): def test_valid_variant_index_limited_validation(self): for column in [self.valid_hgvs_nt_column, self.valid_hgvs_pro_column]: - with self.subTest(column=column): + with self.subTest(column=_label(column)): validate_hgvs_genomic_column(column, is_index=True, targets=self.accession_test_case, hdp=None) def test_invalid_column_values_strict_validation(self): for column in ( self.invalid_hgvs_columns_by_contents + self.invalid_hgvs_columns_by_contents_under_strict_validation ): - with self.subTest(column=column), self.assertRaises((ValidationError, ModuleNotFoundError)): + with self.subTest(column=_label(column)), self.assertRaises((ValidationError, ModuleNotFoundError)): validate_hgvs_genomic_column( column, is_index=False, @@ -674,7 +679,7 @@ def test_invalid_column_values_strict_validation(self): for column in ( self.invalid_hgvs_columns_by_contents + self.invalid_hgvs_columns_by_contents_under_strict_validation ): - with self.subTest(column=column), self.assertRaises((ValidationError, ModuleNotFoundError)): + with self.subTest(column=_label(column)), self.assertRaises((ValidationError, ModuleNotFoundError)): validate_hgvs_genomic_column( column, is_index=True, @@ -684,7 +689,7 @@ def test_invalid_column_values_strict_validation(self): def test_invalid_column_values_limited_validation(self): for column in self.invalid_hgvs_columns_by_contents: - with self.subTest(column=column), self.assertRaises(ValidationError): + with self.subTest(column=_label(column)), self.assertRaises(ValidationError): validate_hgvs_genomic_column( column, is_index=False, @@ -692,7 +697,7 @@ def test_invalid_column_values_limited_validation(self): hdp=None, # type: ignore ) for column in self.invalid_hgvs_columns_by_contents: - with self.subTest(column=column), self.assertRaises(ValidationError): + with self.subTest(column=_label(column)), self.assertRaises(ValidationError): validate_hgvs_genomic_column( column, is_index=True, @@ -700,7 +705,7 @@ def test_invalid_column_values_limited_validation(self): hdp=None, # type: ignore ) for column in self.invalid_hgvs_columns_by_contents_under_strict_validation: - with self.subTest(column=column): + with self.subTest(column=_label(column)): validate_hgvs_genomic_column( column, is_index=True, @@ -710,7 +715,7 @@ def test_invalid_column_values_limited_validation(self): def test_valid_column_values_wrong_column_name_strict_validation(self): for column in self.invalid_hgvs_columns_by_name: - with self.subTest(column=column), self.assertRaises(ValidationError): + with self.subTest(column=_label(column)), self.assertRaises(ValidationError): validate_hgvs_genomic_column( column, is_index=False, @@ -718,7 +723,7 @@ def test_valid_column_values_wrong_column_name_strict_validation(self): hdp=self.mocked_nt_human_data_provider, # type: ignore ) for column in self.invalid_hgvs_columns_by_name: - with self.subTest(column=column), self.assertRaises(ValidationError): + with self.subTest(column=_label(column)), self.assertRaises(ValidationError): validate_hgvs_genomic_column( column, is_index=True, @@ -728,7 +733,7 @@ def test_valid_column_values_wrong_column_name_strict_validation(self): def test_valid_column_values_wrong_column_name_limited_validation(self): for column in self.invalid_hgvs_columns_by_name: - with self.subTest(column=column), self.assertRaises(ValidationError): + with self.subTest(column=_label(column)), self.assertRaises(ValidationError): validate_hgvs_genomic_column( column, is_index=False, @@ -736,7 +741,7 @@ def test_valid_column_values_wrong_column_name_limited_validation(self): hdp=None, # type: ignore ) for column in self.invalid_hgvs_columns_by_name: - with self.subTest(column=column), self.assertRaises(ValidationError): + with self.subTest(column=_label(column)), self.assertRaises(ValidationError): validate_hgvs_genomic_column( column, is_index=True, @@ -820,14 +825,14 @@ def test_validate_valid_hgvs_variant(self): for idx, variant_string in enumerate( [column for column in [self.valid_hgvs_nt_column + self.valid_hgvs_pro_column]] ): - with self.subTest(variant_string=variant_string), self.assertRaises(ModuleNotFoundError): + with self.subTest(variant_string=_label(variant_string)), self.assertRaises(ModuleNotFoundError): validate_genomic_variant(idx, variant_string, self.parser, self.validator) def test_validate_invalid_hgvs_variant(self): for idx, variant_string in enumerate( [column for column in [self.invalid_hgvs_nt_column + self.invalid_hgvs_pro_column]] ): - with self.subTest(variant_string=variant_string), self.assertRaises(ModuleNotFoundError): + with self.subTest(variant_string=_label(variant_string)), self.assertRaises(ModuleNotFoundError): validate_genomic_variant(idx, variant_string, self.parser, self.validator) @@ -914,7 +919,7 @@ def setUp(self): def test_valid_guide_sequences(self): for column in self.valid_guide_sequences + self.invalid_index_guide_sequences: - with self.subTest(column=column): + with self.subTest(column=_label(column)): validate_guide_sequence_column( column, is_index=False, @@ -922,7 +927,7 @@ def test_valid_guide_sequences(self): def test_invalid_guide_sequences(self): for column in self.invalid_guide_sequences: - with self.subTest(column=column): + with self.subTest(column=_label(column)): with self.assertRaises(ValidationError): validate_guide_sequence_column( column, @@ -931,7 +936,7 @@ def test_invalid_guide_sequences(self): def test_valid_guide_sequences_index(self): for column in self.valid_guide_sequences: - with self.subTest(column=column): + with self.subTest(column=_label(column)): validate_guide_sequence_column( column, is_index=True, @@ -939,7 +944,7 @@ def test_valid_guide_sequences_index(self): def test_invalid_guide_sequences_index(self): for column in self.invalid_guide_sequences + self.invalid_index_guide_sequences: - with self.subTest(column=column): + with self.subTest(column=_label(column)): with self.assertRaises(ValidationError): validate_guide_sequence_column( column, diff --git a/tests/view_models/test_access_key.py b/tests/view_models/test_access_key.py index 19126d39d..3b4344e0d 100644 --- a/tests/view_models/test_access_key.py +++ b/tests/view_models/test_access_key.py @@ -4,8 +4,9 @@ def test_minimal_access_key(): - key_id = "test_access_key" - access_key = dummy_attributed_object_from_dict({"key_id": key_id}) + access_key = dummy_attributed_object_from_dict({"id": 1, "key_id": "stored hash", "key_hint": "wxyz"}) saved_access_key = SavedAccessKey.model_validate(access_key) - assert saved_access_key.key_id == key_id + assert saved_access_key.id == 1 + assert saved_access_key.key_hint == "wxyz" + assert not hasattr(saved_access_key, "key_id") diff --git a/tests/worker/conftest.py b/tests/worker/conftest.py index eaf613683..8ea00144b 100644 --- a/tests/worker/conftest.py +++ b/tests/worker/conftest.py @@ -4,7 +4,6 @@ from datetime import datetime from pathlib import Path -from shutil import copytree from unittest.mock import Mock import pandas as pd @@ -282,9 +281,9 @@ def mock_job_run(mock_pipeline): @pytest.fixture -def data_files(tmp_path): - copytree(Path(__file__).absolute().parent / "data", tmp_path / "data") - return tmp_path / "data" +def data_files(): + """The shared test data directory. Tests read it in place; copy a file into tmp_path before changing it.""" + return Path(__file__).absolute().parent / "data" @pytest.fixture diff --git a/tests/worker/lib/managers/test_pipeline_manager.py b/tests/worker/lib/managers/test_pipeline_manager.py index d66a3a649..8d2b61ebe 100644 --- a/tests/worker/lib/managers/test_pipeline_manager.py +++ b/tests/worker/lib/managers/test_pipeline_manager.py @@ -3349,9 +3349,9 @@ def test_set_pipeline_status_sets_finished_at_property_for_terminal_status( mock_pipeline.finished_at = None with TransactionSpy.spy(mock_pipeline_manager.db): - before_update = datetime.datetime.now() + before_update = datetime.datetime.now(tz=datetime.timezone.utc) mock_pipeline_manager.set_pipeline_status(pipeline_status) - after_update = datetime.datetime.now() + after_update = datetime.datetime.now(tz=datetime.timezone.utc) assert mock_pipeline.status == pipeline_status assert mock_pipeline.finished_at is not None @@ -3377,9 +3377,9 @@ def test_set_pipeline_status_sets_started_at_property_for_running_status( """Test that setting status to RUNNING sets the started_at property if not already set.""" mock_pipeline.started_at = initial_started_at with TransactionSpy.spy(mock_pipeline_manager.db): - before_update = datetime.datetime.now() + before_update = datetime.datetime.now(tz=datetime.timezone.utc) mock_pipeline_manager.set_pipeline_status(PipelineStatus.RUNNING) - after_update = datetime.datetime.now() + after_update = datetime.datetime.now(tz=datetime.timezone.utc) assert mock_pipeline.status == PipelineStatus.RUNNING