Skip to content

Commit

Permalink
Merge branch 'master' into refactor-enums-sex-phenotypestatus
Browse files Browse the repository at this point in the history
# Conflicts:
#	cg/cli/add.py
#	tests/conftest.py
  • Loading branch information
henrikstranneheim committed May 23, 2024
2 parents 9cf75d5 + 07d7456 commit b432451
Show file tree
Hide file tree
Showing 160 changed files with 3,166 additions and 1,431 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 60.7.18
current_version = 60.8.7
commit = True
tag = True
tag_name = v{new_version}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests_and_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
tests-coverage:
runs-on: ubuntu-latest
runs-on: 8_core_linux

steps:
- name: Checkout Repository
Expand Down Expand Up @@ -37,7 +37,7 @@ jobs:

- name: Test with pytest & Coveralls
run: |
pytest -n auto --cov=cg/
pytest -n logical --cov=cg/
coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""add_illumina_run_metrics
Revision ID: 6e6c36d5157b
Revises: 5c6de08c4aca
Create Date: 2024-05-16 13:40:36.754552
"""

from enum import StrEnum

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "6e6c36d5157b"
down_revision = "5c6de08c4aca"
branch_labels = None
depends_on = None


def upgrade():
op.create_table(
"illumina_sequencing_metrics",
sa.Column(
"id", sa.Integer(), sa.ForeignKey("run_metrics.id"), nullable=False, primary_key=True
),
sa.Column("sequencer_type", sa.String(length=32), nullable=True),
sa.Column("sequencer_name", sa.String(length=32), nullable=True),
sa.Column("sequenced_at", sa.DateTime(), nullable=True),
sa.Column("data_availability", sa.String(length=32), nullable=True),
sa.Column("archived_at", sa.DateTime(), nullable=True),
sa.Column("has_backup", sa.Boolean(), nullable=False),
sa.Column("total_reads", sa.BigInteger(), nullable=True),
sa.Column("total_undetermined_reads", sa.BigInteger(), nullable=True),
sa.Column("percent_q30", sa.Numeric(precision=6, scale=2), nullable=True),
sa.Column("mean_quality_score", sa.Numeric(precision=6, scale=2), nullable=True),
sa.Column("total_yield", sa.BigInteger(), nullable=True),
sa.Column("yield_q30", sa.Numeric(precision=6, scale=2), nullable=True),
sa.Column("cycles", sa.Integer(), nullable=True),
sa.Column("demultiplexing_software", sa.String(length=32), nullable=True),
sa.Column("demultiplexing_software_version", sa.String(length=32), nullable=True),
sa.Column("sequencing_started_at", sa.DateTime(), nullable=True),
sa.Column("sequencing_completed_at", sa.DateTime(), nullable=True),
sa.Column("demultiplexing_started_at", sa.DateTime(), nullable=True),
sa.Column("demultiplexing_completed_at", sa.DateTime(), nullable=True),
)


def downgrade():

op.drop_table("illumina_run_metrics")
31 changes: 31 additions & 0 deletions alembic/versions/2024_05_17_fe23de4ed528_add_illumina_flow_cell.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""add_illumina_flow_cell
Revision ID: fe23de4ed528
Revises: 6e6c36d5157b
Create Date: 2024-05-17 15:09:12.088324
"""

import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "fe23de4ed528"
down_revision = "6e6c36d5157b"
branch_labels = None
depends_on = None


def upgrade():
op.create_table(
"illumina_flow_cell",
sa.Column(
"id", sa.Integer(), sa.ForeignKey("run_device.id"), nullable=False, primary_key=True
),
sa.Column("model", sa.String(length=32), nullable=False),
)


def downgrade():
op.drop_table("illumina_flow_cell")
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
"""add_autoincrement_to_device_tables
Revision ID: 5fd7e8758fb1
Revises: fe23de4ed528
Create Date: 2024-05-21 09:25:47.751986
"""

import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "5fd7e8758fb1"
down_revision = "fe23de4ed528"
branch_labels = None
depends_on = None


def upgrade():
# Modify illumina flow cell primary key
op.drop_constraint(
constraint_name="illumina_flow_cell_ibfk_1",
table_name="illumina_flow_cell",
type_="foreignkey",
)
op.drop_constraint(constraint_name="fk_device_id", table_name="run_metrics", type_="foreignkey")
op.execute("ALTER TABLE run_device MODIFY COLUMN id INT NOT NULL AUTO_INCREMENT")
op.alter_column(
"illumina_flow_cell", "model", existing_type=sa.String(length=32), nullable=True
)
op.create_foreign_key(
constraint_name="fk_device_id",
source_table="run_metrics",
referent_table="run_device",
local_cols=["device_id"],
remote_cols=["id"],
)
op.create_foreign_key(
constraint_name="illumina_flow_cell_ibfk_1",
source_table="illumina_flow_cell",
referent_table="run_device",
local_cols=["id"],
remote_cols=["id"],
)

# Modify run metrics primary key
op.drop_constraint(
constraint_name="illumina_sequencing_metrics_ibfk_1",
table_name="illumina_sequencing_metrics",
type_="foreignkey",
)
op.execute("ALTER TABLE run_metrics MODIFY COLUMN id INT NOT NULL AUTO_INCREMENT")
op.create_foreign_key(
constraint_name="illumina_sequencing_metrics_ibfk_1",
source_table="illumina_sequencing_metrics",
referent_table="run_metrics",
local_cols=["id"],
remote_cols=["id"],
)
op.create_foreign_key(
constraint_name="fk_run_metrics_id",
source_table="sample_run_metrics",
referent_table="run_metrics",
local_cols=["run_metrics_id"],
remote_cols=["id"],
)

# Modify sample run metrics primary key
op.drop_constraint(
constraint_name="illumina_sample_run_metrics_ibfk_1",
table_name="illumina_sample_run_metrics",
type_="foreignkey",
)
op.execute("ALTER TABLE sample_run_metrics MODIFY COLUMN id INT NOT NULL AUTO_INCREMENT")
op.create_foreign_key(
constraint_name="illumina_sample_run_metrics_ibfk_1",
source_table="illumina_sample_run_metrics",
referent_table="sample_run_metrics",
local_cols=["id"],
remote_cols=["id"],
)


def downgrade():
# Downgrade illumina flow cell primary key
op.drop_constraint(
constraint_name="illumina_flow_cell_ibfk_1",
table_name="illumina_flow_cell",
type_="foreignkey",
)
op.drop_constraint(constraint_name="fk_device_id", table_name="run_metrics", type_="foreignkey")
op.alter_column(
"illumina_flow_cell", "model", existing_type=sa.String(length=32), nullable=False
)
op.execute("ALTER TABLE run_device MODIFY COLUMN id INT NOT NULL")
op.create_foreign_key(
constraint_name="fk_device_id",
source_table="run_metrics",
referent_table="run_device",
local_cols=["device_id"],
remote_cols=["id"],
)
op.create_foreign_key(
constraint_name="illumina_flow_cell_ibfk_1",
source_table="illumina_flow_cell",
referent_table="run_device",
local_cols=["id"],
remote_cols=["id"],
)

# Downgrade illumina run metrics primary key
op.drop_constraint(
constraint_name="fk_run_metrics_id", table_name="sample_run_metrics", type_="foreignkey"
)
op.drop_constraint(
constraint_name="illumina_sequencing_metrics_ibfk_1",
table_name="illumina_sequencing_metrics",
type_="foreignkey",
)
op.execute("ALTER TABLE run_metrics MODIFY COLUMN id INT NOT NULL")
op.create_foreign_key(
constraint_name="illumina_sequencing_metrics_ibfk_1",
source_table="illumina_sequencing_metrics",
referent_table="run_metrics",
local_cols=["id"],
remote_cols=["id"],
)

# Downgrade illumina run sample metrics primary key
op.drop_constraint(
constraint_name="illumina_sample_run_metrics_ibfk_1",
table_name="illumina_sample_run_metrics",
type_="foreignkey",
)
op.execute("ALTER TABLE sample_run_metrics MODIFY COLUMN id INT NOT NULL")
op.create_foreign_key(
constraint_name="illumina_sample_run_metrics_ibfk_1",
source_table="illumina_sample_run_metrics",
referent_table="sample_run_metrics",
local_cols=["id"],
remote_cols=["id"],
)
84 changes: 84 additions & 0 deletions alembic/versions/2024_05_22_18e3b2aba252_add_yield_columns.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
"""2024_05_22_add_yield_columns
Revision ID: 18e3b2aba252
Revises: 5fd7e8758fb1
Create Date: 2024-05-22 14:01:15.197675
"""

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "18e3b2aba252"
down_revision = "5fd7e8758fb1"
branch_labels = None
depends_on = None


def upgrade():

# rename table IlluminaSampleRunMetrics to IlluminaSampleSequencingMetrics
op.rename_table(
old_table_name="illumina_sample_run_metrics",
new_table_name="illumina_sample_sequencing_metrics",
)
# add column yield
op.add_column(
table_name="illumina_sample_sequencing_metrics",
column=sa.Column("yield", sa.Integer(), nullable=True),
)
# add column yield_q30
op.add_column(
table_name="illumina_sample_sequencing_metrics",
column=sa.Column("yield_q30", sa.Float(), nullable=True),
)
# rename table run metrics to InstrumentRun
op.rename_table(
old_table_name="run_metrics",
new_table_name="instrument_run",
)
# on SampleRunMetrics change run_metrics_id to instrument_run_id
op.alter_column(
table_name="sample_run_metrics",
column_name="run_metrics_id",
new_column_name="instrument_run_id",
type_=sa.Integer(),
)
# rename illumina_sequencing_metrics to illumina_sequencing_run
op.rename_table(
old_table_name="illumina_sequencing_metrics",
new_table_name="illumina_sequencing_run",
)


def downgrade():
# rename illumina_sequencing_metrics to illumina_sequencing_run
op.rename_table(
new_table_name="illumina_sequencing_metrics",
old_table_name="illumina_sequencing_run",
)

# on SampleRunMetrics change run_metrics_id to instrument_run_id
op.alter_column(
table_name="sample_run_metrics",
new_column_name="run_metrics_id",
column_name="instrument_run_id",
type_=sa.Integer(),
)
# rename run metrics -> InstrumentRun
op.rename_table(
new_table_name="run_metrics",
old_table_name="instrument_run",
)

# drop columns yield and yield_q30
op.drop_column(table_name="illumina_sample_sequencing_metrics", column_name="yield")
op.drop_column(table_name="illumina_sample_sequencing_metrics", column_name="yield_q30")

# rename table IlluminaSampleSequencingMetrics to IlluminaSampleRunMetrics
op.rename_table(
new_table_name="illumina_sample_run_metrics",
old_table_name="illumina_sample_sequencing_metrics",
)
2 changes: 1 addition & 1 deletion cg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__title__ = "cg"
__version__ = "60.7.18"
__version__ = "60.8.7"
2 changes: 1 addition & 1 deletion cg/apps/loqus.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ def get_nr_of_variants_in_file(self) -> dict[str, int]:
return {"variants": nr_of_variants}

def __repr__(self):
return f"LoqusdbAPI(binary_path={Path(self.binary_path).stem}, config_path={Path(self.config_path).stem})"
return f"LoqusdbAPI(binary_path={Path(self.binary_path).name}, config_path={Path(self.config_path).name})"
Loading

0 comments on commit b432451

Please sign in to comment.