loqusdb 2.7.10__py3-none-any.whl → 2.7.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- loqusdb/__init__.py +1 -1
- loqusdb/build_models/variant.py +9 -4
- loqusdb/commands/load.py +10 -4
- loqusdb/commands/view.py +1 -2
- loqusdb/plugins/mongo/structural_variant.py +2 -2
- loqusdb/utils/load.py +6 -6
- loqusdb/utils/variant.py +5 -6
- {loqusdb-2.7.10.dist-info → loqusdb-2.7.11.dist-info}/METADATA +1 -1
- {loqusdb-2.7.10.dist-info → loqusdb-2.7.11.dist-info}/RECORD +15 -15
- tests/commands/test_export.py +2 -2
- tests/commands/test_identity.py +2 -5
- tests/commands/test_view.py +6 -4
- {loqusdb-2.7.10.dist-info → loqusdb-2.7.11.dist-info}/LICENSE +0 -0
- {loqusdb-2.7.10.dist-info → loqusdb-2.7.11.dist-info}/WHEEL +0 -0
- {loqusdb-2.7.10.dist-info → loqusdb-2.7.11.dist-info}/entry_points.txt +0 -0
loqusdb/__init__.py
CHANGED
loqusdb/build_models/variant.py
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
import logging
|
2
2
|
from collections import namedtuple
|
3
|
+
from typing import Optional
|
3
4
|
|
4
5
|
import cyvcf2
|
5
6
|
|
6
|
-
from typing import Optional
|
7
|
-
|
8
7
|
from loqusdb.constants import CHROM_TO_INT, GENOTYPE_MAP, GRCH37, PAR
|
9
8
|
from loqusdb.models import Case, Variant
|
10
9
|
|
@@ -143,7 +142,14 @@ def get_coords(variant):
|
|
143
142
|
return coordinates
|
144
143
|
|
145
144
|
|
146
|
-
def build_variant(
|
145
|
+
def build_variant(
|
146
|
+
variant: cyvcf2.Variant,
|
147
|
+
case_obj: Case,
|
148
|
+
case_id: Optional[str] = None,
|
149
|
+
gq_threshold: Optional[int] = None,
|
150
|
+
gq_qual: Optional[bool] = False,
|
151
|
+
genome_build: Optional[str] = None,
|
152
|
+
) -> Variant:
|
147
153
|
"""Return a Variant object
|
148
154
|
|
149
155
|
Take a cyvcf2 formated variant line and return a models.Variant.
|
@@ -191,7 +197,6 @@ def build_variant(variant: cyvcf2.Variant, case_obj: Case, case_id: Optional[str
|
|
191
197
|
else:
|
192
198
|
found_variant = False
|
193
199
|
for ind_obj in case_obj["individuals"]:
|
194
|
-
ind_id = ind_obj["ind_id"]
|
195
200
|
# Get the index position for the individual in the VCF
|
196
201
|
ind_pos = ind_obj["ind_index"]
|
197
202
|
|
loqusdb/commands/load.py
CHANGED
@@ -3,10 +3,10 @@ import os
|
|
3
3
|
from datetime import datetime
|
4
4
|
|
5
5
|
import click
|
6
|
-
from loqusdb.exceptions import CaseError
|
7
|
-
from loqusdb.utils.load import load_database
|
8
6
|
|
9
7
|
from loqusdb.commands.cli import cli as base_command
|
8
|
+
from loqusdb.exceptions import CaseError
|
9
|
+
from loqusdb.utils.load import load_database
|
10
10
|
|
11
11
|
LOG = logging.getLogger(__name__)
|
12
12
|
|
@@ -55,7 +55,13 @@ def validate_profile_threshold(ctx, param, value):
|
|
55
55
|
)
|
56
56
|
@click.option("--ensure-index", is_flag=True, help="Make sure that the indexes are in place")
|
57
57
|
@click.option("--gq-threshold", default=20, show_default=True, help="Threshold to consider variant")
|
58
|
-
@click.option(
|
58
|
+
@click.option(
|
59
|
+
"--qual-gq",
|
60
|
+
is_flag=True,
|
61
|
+
default=False,
|
62
|
+
show_default=True,
|
63
|
+
help="Use QUAL tag instead of GQ value for quality filter",
|
64
|
+
)
|
59
65
|
@click.option(
|
60
66
|
"--max-window",
|
61
67
|
"-m",
|
@@ -97,7 +103,7 @@ def load(
|
|
97
103
|
check_profile,
|
98
104
|
hard_threshold,
|
99
105
|
soft_threshold,
|
100
|
-
qual_gq
|
106
|
+
qual_gq,
|
101
107
|
):
|
102
108
|
"""Load the variants of a case
|
103
109
|
|
loqusdb/commands/view.py
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
import json
|
3
3
|
import logging
|
4
4
|
from pprint import pprint as pp
|
5
|
-
from pymongo.cursor import Cursor
|
6
5
|
|
7
6
|
import click
|
7
|
+
from pymongo.cursor import Cursor
|
8
8
|
|
9
9
|
from loqusdb.commands.cli import cli as base_command
|
10
10
|
|
@@ -49,7 +49,6 @@ def cases(ctx, case_id, to_json, count, case_type):
|
|
49
49
|
ctx.abort()
|
50
50
|
cases: Cursor = adapter.cases()
|
51
51
|
|
52
|
-
|
53
52
|
if to_json:
|
54
53
|
click.echo(json.dumps(cases))
|
55
54
|
return
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import logging
|
2
2
|
|
3
|
-
from loqusdb.models import Identity
|
4
3
|
from pymongo import ASCENDING
|
5
4
|
|
5
|
+
from loqusdb.models import Identity
|
6
|
+
|
6
7
|
LOG = logging.getLogger(__name__)
|
7
8
|
|
8
9
|
|
@@ -175,7 +176,6 @@ class SVMixin:
|
|
175
176
|
self.db.identity.delete_one(dict(identity_obj))
|
176
177
|
|
177
178
|
def _update_sv_metrics(self, sv_type, pos_mean, end_mean, max_window):
|
178
|
-
|
179
179
|
"""
|
180
180
|
calculates cluster length, and interval size for SV based on
|
181
181
|
mean start position and mean end position.
|
loqusdb/utils/load.py
CHANGED
@@ -11,15 +11,14 @@ import logging
|
|
11
11
|
|
12
12
|
import click
|
13
13
|
|
14
|
+
from loqusdb.build_models.case import build_case
|
15
|
+
from loqusdb.build_models.profile_variant import build_profile_variant
|
16
|
+
from loqusdb.build_models.variant import build_variant
|
14
17
|
from loqusdb.exceptions import CaseError, VcfError
|
15
|
-
|
16
18
|
from loqusdb.utils.case import get_case, update_case
|
17
19
|
from loqusdb.utils.delete import delete
|
18
20
|
from loqusdb.utils.profiling import get_profiles, profile_match
|
19
21
|
from loqusdb.utils.vcf import check_vcf, get_vcf
|
20
|
-
from loqusdb.build_models.case import build_case
|
21
|
-
from loqusdb.build_models.profile_variant import build_profile_variant
|
22
|
-
from loqusdb.build_models.variant import build_variant
|
23
22
|
|
24
23
|
LOG = logging.getLogger(__name__)
|
25
24
|
|
@@ -226,7 +225,9 @@ def load_variants(
|
|
226
225
|
with click.progressbar(vcf_obj, label="Inserting variants", length=nr_variants) as bar:
|
227
226
|
|
228
227
|
variants = (
|
229
|
-
build_variant(
|
228
|
+
build_variant(
|
229
|
+
variant, case_obj, case_id, gq_threshold, qual_gq, genome_build=genome_build
|
230
|
+
)
|
230
231
|
for variant in bar
|
231
232
|
)
|
232
233
|
|
@@ -258,7 +259,6 @@ def load_profile_variants(adapter, variant_file):
|
|
258
259
|
"""
|
259
260
|
|
260
261
|
vcf_info = check_vcf(variant_file)
|
261
|
-
nr_variants = vcf_info["nr_variants"]
|
262
262
|
variant_type = vcf_info["variant_type"]
|
263
263
|
|
264
264
|
if variant_type != "snv":
|
loqusdb/utils/variant.py
CHANGED
@@ -32,14 +32,13 @@ def format_info(variant, variant_type="snv", nr_cases=None, add_freq=False):
|
|
32
32
|
|
33
33
|
# This is SV specific
|
34
34
|
if variant_type == "sv":
|
35
|
-
pos= int((variant["pos_left"] + variant["pos_right"]) / 2)
|
35
|
+
pos = int((variant["pos_left"] + variant["pos_right"]) / 2)
|
36
36
|
end = int((variant["end_left"] + variant["end_right"]) / 2)
|
37
37
|
|
38
|
-
if not variant[
|
38
|
+
if not variant["sv_type"] == "BND":
|
39
39
|
vcf_info += f";SVTYPE={variant['sv_type']};END={end};SVLEN={variant['length']}"
|
40
40
|
else:
|
41
|
-
vcf_info +=
|
42
|
-
|
41
|
+
vcf_info += ";SVTYPE=BND"
|
43
42
|
|
44
43
|
return vcf_info
|
45
44
|
|
@@ -63,10 +62,10 @@ def format_variant(variant, variant_type="snv", nr_cases=None, add_freq=False):
|
|
63
62
|
|
64
63
|
if variant_type == "sv":
|
65
64
|
pos = int((variant["pos_left"] + variant["pos_right"]) / 2)
|
66
|
-
end=
|
65
|
+
end = int((variant["end_left"] + variant["end_right"]) / 2)
|
67
66
|
ref = "N"
|
68
67
|
|
69
|
-
if not variant[
|
68
|
+
if not variant["sv_type"] == "BND":
|
70
69
|
alt = f"<{variant['sv_type']}>"
|
71
70
|
else:
|
72
71
|
alt = f"N]{variant['end_chrom']}:{end}]"
|
@@ -1,22 +1,22 @@
|
|
1
1
|
README.md,sha256=0-XD0EEYvCnenT07wkO0ZX6lJbzN8OC1cV3M9G47nps,4648
|
2
|
-
loqusdb/__init__.py,sha256=
|
2
|
+
loqusdb/__init__.py,sha256=tVCT5pNoMl8Zuqcc32Dbade0bG0SS7s05LMGyRM2gL0,1688
|
3
3
|
loqusdb/__main__.py,sha256=8FGKySAGaWSzAYMj6HRsxeyiME3V01Idt7HrmN7pSYY,397
|
4
4
|
loqusdb/build_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
loqusdb/build_models/case.py,sha256=AByutEYK2N3kS9JFvyZfPKNZdCpZHCSD0nNHAgaU1Cs,4127
|
6
6
|
loqusdb/build_models/profile_variant.py,sha256=TbSxfVjESstS_FgbkOW4NQwMQVeTyhn9oc9yPZmDhzI,1021
|
7
|
-
loqusdb/build_models/variant.py,sha256=
|
7
|
+
loqusdb/build_models/variant.py,sha256=2ate8viYhHK1yX7UvCzEPgfuuXwTgAApU_2E5jl1ZO4,6934
|
8
8
|
loqusdb/commands/__init__.py,sha256=BXAN3UADgqPrkGczzjlLO9GyyQ96dnLnP7n92JlYHgo,603
|
9
9
|
loqusdb/commands/annotate.py,sha256=748kImopE5WbaO1nuv3WUgIqezWFSsi7SBeWhOz26-s,1384
|
10
10
|
loqusdb/commands/cli.py,sha256=wJD5S1BoCxtRTAobd1QtmQpzlngJg-mt1nsyD92fDD4,3176
|
11
11
|
loqusdb/commands/delete.py,sha256=R6ysHKSMw1mmL4ZbktoUIKzdzDLQ3314YPYhIy1myic,1979
|
12
12
|
loqusdb/commands/export.py,sha256=-9SHgvr0G8FlyW0FGSfe1dmNDnjx4HKAaa-xYzSkvNc,3238
|
13
13
|
loqusdb/commands/identity.py,sha256=KLA9c8e6cJFDxtqIa1G6zdHTHK1sz2b3v1Utdtik_4k,787
|
14
|
-
loqusdb/commands/load.py,sha256=
|
14
|
+
loqusdb/commands/load.py,sha256=sDGCOGbukdfebLn1iBGyWoI6t3tijLzywP1tg3WheQI,4431
|
15
15
|
loqusdb/commands/load_profile.py,sha256=cflCbF9f77_HCH8xPnN8zSSocvIffRMnC2LPE0j7Xq8,3336
|
16
16
|
loqusdb/commands/migrate.py,sha256=2C8YL-zVqnpnqg3JIyUr0rbVnb8-AGPVWNhicHnPKLo,667
|
17
17
|
loqusdb/commands/restore.py,sha256=eqPX0yao0IAYS5SbjCdlsfSJRBbRByBLISUU2hTzqqs,1492
|
18
18
|
loqusdb/commands/update.py,sha256=zz3wueaJVqJ1FKact-rpY2az__5oa1LnZKf7mgqNGPk,3211
|
19
|
-
loqusdb/commands/view.py,sha256=
|
19
|
+
loqusdb/commands/view.py,sha256=PkwyvzQgq5ArrEakI-lKQThrhjBLLl2gYejHI2g13WU,5197
|
20
20
|
loqusdb/commands/wipe.py,sha256=WTOjyNooCUhtmZ6pdcPFa0PZrFc9E_pkLbnat_zP96M,553
|
21
21
|
loqusdb/constants/__init__.py,sha256=r6y2TN8BqbKuh2Uyxq0trh-3A9xiWeStqWlvEPp-rSA,1645
|
22
22
|
loqusdb/exceptions/__init__.py,sha256=Fq0UQg9TepWh19D7WT3dARyAHvorwJF6phhnZi2AkxE,88
|
@@ -34,7 +34,7 @@ loqusdb/plugins/mongo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
|
|
34
34
|
loqusdb/plugins/mongo/adapter.py,sha256=rRUQ2y_bZwjINbdTtfzJ_1JwE0Ns0usyAJ3o0O1Y10I,2593
|
35
35
|
loqusdb/plugins/mongo/case.py,sha256=zKnaaam8Ey1AEH-1GofXp6iNqgmSvWWxZZWsx7dAO0Y,3006
|
36
36
|
loqusdb/plugins/mongo/profile_variant.py,sha256=madOBa3HacIN_T1V8mp7NEC4QOpqQBqSY6pKTObkMLA,600
|
37
|
-
loqusdb/plugins/mongo/structural_variant.py,sha256=
|
37
|
+
loqusdb/plugins/mongo/structural_variant.py,sha256=7NjdRxRVzp4huTTEPI-buKoG7N5d_5LH11GHcncwboE,12955
|
38
38
|
loqusdb/plugins/mongo/variant.py,sha256=NS3N8bhRap1b2ZSGjOw2LO6l7q_CzD00GZs499l38Tg,8715
|
39
39
|
loqusdb/resources/__init__.py,sha256=JOx3Ppgtghx55cOJN0bfBonSXM5DM_v0OFdlT-Qybg4,639
|
40
40
|
loqusdb/resources/loqusdb.20181005.gz,sha256=DI8CLI7fPnIAjM25Avraz-C7KQkOKsfnhgZWguGat9Y,12172904
|
@@ -44,18 +44,18 @@ loqusdb/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
44
|
loqusdb/utils/annotate.py,sha256=cPNWlhsv6yoe3lxNfa9DytO5eACuM_mOJJw_mglVMN0,2646
|
45
45
|
loqusdb/utils/case.py,sha256=aeTvyACJTDjzl-aOjAZaUzFMLisgFKMfcoXSvNAZz4s,2168
|
46
46
|
loqusdb/utils/delete.py,sha256=-ddBM_QXKzlUN6egEJggKzXX1P-WEdi92HgaD1DJRtg,4843
|
47
|
-
loqusdb/utils/load.py,sha256=
|
47
|
+
loqusdb/utils/load.py,sha256=ZdsnmHTVGOjwG24Fm5gcUu7tcLwYSqvh3W9j6ixqyF0,8239
|
48
48
|
loqusdb/utils/migrate.py,sha256=9Q6kdIi9TpFVzDYptlEE8RqPPS5wyzfM3F8egzmmBBk,1113
|
49
49
|
loqusdb/utils/profiling.py,sha256=3OizF7CpYvSl9kyl2g4KGJxbIRUqWfmfLxn3843XYDk,9164
|
50
50
|
loqusdb/utils/update.py,sha256=1edJG-u24FgOSxyXAQEiyTG4IyK-Uo3lSIl5qyzcXsI,4433
|
51
|
-
loqusdb/utils/variant.py,sha256=
|
51
|
+
loqusdb/utils/variant.py,sha256=U6nMZRUf5NDDQ74nG0HBCLMnFQVgFAT6eHll_F2uiwc,2087
|
52
52
|
loqusdb/utils/vcf.py,sha256=ybmrTBEPYa0FbUXo8ttlwATk13RnKjX9eIDbRDwCiVE,5175
|
53
53
|
tests/build_models/test_build_case.py,sha256=4CzykSmiBgAVZWlqzjLTjBmY9NafzmPol7LiEu4003U,4404
|
54
54
|
tests/build_models/test_build_variant.py,sha256=-9ulYBNBIxAGt_FiyaADWLuTJ4bWwRVVfMbjzummMZA,537
|
55
55
|
tests/build_models/test_is_greater.py,sha256=sAz_UB6oGr72Pqc7ZEbPTw6N07E0QR-Yvn8UCEi0yP8,1360
|
56
|
-
tests/commands/test_export.py,sha256=
|
57
|
-
tests/commands/test_identity.py,sha256=
|
58
|
-
tests/commands/test_view.py,sha256=
|
56
|
+
tests/commands/test_export.py,sha256=Xdivbs_hDJzoJKNP60gnb6AgGfNdOqVTyk0lAkMFwPg,440
|
57
|
+
tests/commands/test_identity.py,sha256=6yCD4m6ezGTsoW5lk7t7MQ5gxOi2u86ZcWtz-ghtsHk,564
|
58
|
+
tests/commands/test_view.py,sha256=036iug8YB67ZYi_qtSU_VBBAIcJZEj_EolNDRsOaVCM,662
|
59
59
|
tests/conftest.py,sha256=F7teEGvH3mD1zO5tqd_yEWneFrmW5U8d74-IDDSAXoI,10531
|
60
60
|
tests/fixtures/643594.clinical.SV.vcf,sha256=e-RVC96kxwrohNmiZ7xHAHcTcnWI5-NSpOVMX2zGsXA,59626
|
61
61
|
tests/fixtures/643594.clinical.vcf.gz,sha256=CuGqNRVLnkPDy8JM9i8JhYQZn28CDM1eGenECi2dD4E,413153
|
@@ -90,8 +90,8 @@ tests/vcf_tools/test_check_vcf.py,sha256=bTZQOSbhXthRDwTmcfvf4sW-DMUdlpM7bBSDsmX
|
|
90
90
|
tests/vcf_tools/test_format_sv_variant.py,sha256=eeQ6XI6X2lNpsVaWecu5lfdRHrDh1XZvcz9UhL7j3qo,4375
|
91
91
|
tests/vcf_tools/test_format_variant.py,sha256=CfgCnrS5OvuIcUOCTUGCiDRUelk3fZgT7YQAytNPvvM,4176
|
92
92
|
tests/vcf_tools/test_vcf.py,sha256=Fc9tO1IgKFo_DCfj_GrsXGx9t_69xkWhn1ZCL7IXqLU,1563
|
93
|
-
loqusdb-2.7.
|
94
|
-
loqusdb-2.7.
|
95
|
-
loqusdb-2.7.
|
96
|
-
loqusdb-2.7.
|
97
|
-
loqusdb-2.7.
|
93
|
+
loqusdb-2.7.11.dist-info/LICENSE,sha256=urpFcJXw3elN9kV2fFutc-lXegjuu2lqP_GSy8_CAbs,1054
|
94
|
+
loqusdb-2.7.11.dist-info/METADATA,sha256=Kcjp_pYPIFrSDYb5sQYxHfTJY5z1ql99WYlGQSWB0SY,5270
|
95
|
+
loqusdb-2.7.11.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
96
|
+
loqusdb-2.7.11.dist-info/entry_points.txt,sha256=wFoWzEFjsSgXkj9FMQA8C9ihZoJ9R1XvbGuX9hEEI6E,52
|
97
|
+
loqusdb-2.7.11.dist-info/RECORD,,
|
tests/commands/test_export.py
CHANGED
@@ -2,7 +2,8 @@ from click.testing import CliRunner
|
|
2
2
|
|
3
3
|
from loqusdb.commands.cli import cli as base_command
|
4
4
|
|
5
|
-
|
5
|
+
|
6
|
+
def test_export_base(real_db_name: str):
|
6
7
|
"""Test the base command that exports variants."""
|
7
8
|
|
8
9
|
runner = CliRunner()
|
@@ -13,4 +14,3 @@ def test_export_base(real_db_name:str):
|
|
13
14
|
## THEN it should return success
|
14
15
|
result = runner.invoke(base_command, command)
|
15
16
|
assert result.exit_code == 0
|
16
|
-
|
tests/commands/test_identity.py
CHANGED
@@ -2,7 +2,8 @@ from click.testing import CliRunner
|
|
2
2
|
|
3
3
|
from loqusdb.commands.cli import cli as base_command
|
4
4
|
|
5
|
-
|
5
|
+
|
6
|
+
def test_identity(real_db_name: str):
|
6
7
|
"""Test the SV identity base command."""
|
7
8
|
|
8
9
|
runner = CliRunner()
|
@@ -16,7 +17,3 @@ def test_identity(real_db_name:str):
|
|
16
17
|
|
17
18
|
# AND no variant found message
|
18
19
|
assert "No hits for variant" in result.output
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
tests/commands/test_view.py
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
from click.testing import CliRunner
|
2
|
-
|
2
|
+
|
3
3
|
from loqusdb.commands.cli import cli as base_command
|
4
|
+
from loqusdb.plugins.mongo.adapter import MongoAdapter
|
5
|
+
|
4
6
|
|
5
|
-
def test_view_cases_base(real_mongo_adapter: MongoAdapter, real_db_name:str):
|
7
|
+
def test_view_cases_base(real_mongo_adapter: MongoAdapter, real_db_name: str):
|
6
8
|
"""Test the base command that returns database cases."""
|
7
9
|
|
8
10
|
## GIVEN an empty database
|
@@ -11,7 +13,7 @@ def test_view_cases_base(real_mongo_adapter: MongoAdapter, real_db_name:str):
|
|
11
13
|
runner = CliRunner()
|
12
14
|
|
13
15
|
# THEN the case command should return No cases found error
|
14
|
-
command = ["--database", real_db_name, "cases"
|
16
|
+
command = ["--database", real_db_name, "cases"]
|
15
17
|
result = runner.invoke(base_command, command)
|
16
18
|
assert result.exit_code == 1
|
17
|
-
assert "No cases found in database" in result.output
|
19
|
+
assert "No cases found in database" in result.output
|
File without changes
|
File without changes
|
File without changes
|