Skip to content

Commit

Permalink
Adding fields to Hgnc.
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe committed Oct 20, 2021
1 parent e3735c6 commit 161c0da
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 2 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Expand Up @@ -28,6 +28,7 @@ Full Change List
It is currently not possible to migrate a GRCh37 case to GRCh38.
- Setting ``VARFISH_CADD_SUBMISSION_RELEASE`` is called ``VARFISH_CADD_SUBMISSION_VERSION`` now (**breaking change**).
- ``import_info.tsv`` expected as in data release from ``20210728`` as built from varfish-db-downloader ``1b03e97`` or later.
- Extending columns of ``Hgnc`` to upstream update.

-------
v0.23.9
Expand Down
22 changes: 22 additions & 0 deletions geneinfo/migrations/0025_auto_20211019_0829.py
@@ -0,0 +1,22 @@
# Generated by Django 3.2.7 on 2021-10-19 08:29

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("geneinfo", "0024_alter_ncbigenerif_pubmed_ids"),
]

operations = [
migrations.AddField(
model_name="hgnc", name="agr", field=models.CharField(max_length=32, null=True),
),
migrations.AddField(
model_name="hgnc", name="lncipedia", field=models.CharField(max_length=32, null=True),
),
migrations.AddField(
model_name="hgnc", name="mane_select", field=models.CharField(max_length=64, null=True),
),
]
16 changes: 16 additions & 0 deletions geneinfo/migrations/0026_hgnc_gtrnadb.py
@@ -0,0 +1,16 @@
# Generated by Django 3.2.7 on 2021-10-20 07:15

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("geneinfo", "0025_auto_20211019_0829"),
]

operations = [
migrations.AddField(
model_name="hgnc", name="gtrnadb", field=models.CharField(max_length=32, null=True),
),
]
8 changes: 8 additions & 0 deletions geneinfo/models.py
Expand Up @@ -107,6 +107,14 @@ class Hgnc(models.Model):
intermediate_filament_db = models.CharField(max_length=32, null=True)
#: RNACentral ID (rnacentral.org database)
rna_central_ids = models.CharField(max_length=32, null=True)
#: gtrna DB ID
gtrnadb = models.CharField(max_length=32, null=True)
#: lcipedia.org IDs
lncipedia = models.CharField(max_length=32, null=True)
#: Alliance of genome resources.
agr = models.CharField(max_length=32, null=True)
#: MANE collected ID.
mane_select = models.CharField(max_length=64, null=True)

#: Allow bulk import
objects = CopyManager()
Expand Down
7 changes: 5 additions & 2 deletions importer/management/commands/import_tables.py
Expand Up @@ -302,6 +302,7 @@ def _handle_import(self, import_info, options):
TABLES[import_info["build"]][table_group],
force=options["force"],
truncate=options["truncate"],
release=import_info["build"],
)
# Special import routine for gene intervals
elif table_group in ("ensembl_genes", "refseq_genes"):
Expand Down Expand Up @@ -549,6 +550,7 @@ def _import(
self.stderr.write(
"Error during import to table %s:\n%s" % (table._meta.db_table, e)
)
traceback.print_exc(file=self.stderr)
# Remove already imported data.
sa_table = get_meta().tables[table._meta.db_table]
if "release" in sa_table.c:
Expand Down Expand Up @@ -639,9 +641,10 @@ def _replace_pk_in_kegg_and_import(self, mapping, path, release_info, table, for
def _import_gnomad(self, path, tables, force, truncate):
self._import_chromosome_wise(path, tables, force, truncate, list(range(1, 23)) + ["X"])

def _import_dbsnp(self, path, tables, force, truncate):
def _import_dbsnp(self, path, tables, force, truncate, release):
chr_mt = ["MT"] if release == "GRCh37" else ["M"]
self._import_chromosome_wise(
path, tables, force, truncate, list(range(1, 23)) + ["X", "Y", "MT"]
path, tables, force, truncate, list(range(1, 23)) + ["X", "Y"] + chr_mt
)

def _import_chromosome_wise(self, path, tables, force, truncate, chroms):
Expand Down

0 comments on commit 161c0da

Please sign in to comment.