loqusdb 2.7.16__tar.gz → 2.7.18__tar.gz
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-2.7.16 → loqusdb-2.7.18}/PKG-INFO +1 -1
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/__init__.py +1 -1
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/build_models/variant.py +6 -2
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/commands/load.py +18 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/utils/load.py +23 -6
- {loqusdb-2.7.16 → loqusdb-2.7.18}/pyproject.toml +1 -1
- {loqusdb-2.7.16 → loqusdb-2.7.18}/LICENSE +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/README.md +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/__main__.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/build_models/__init__.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/build_models/case.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/build_models/profile_variant.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/commands/__init__.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/commands/annotate.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/commands/cli.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/commands/delete.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/commands/export.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/commands/identity.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/commands/load_profile.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/commands/migrate.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/commands/restore.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/commands/update.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/commands/view.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/commands/wipe.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/constants/__init__.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/exceptions/__init__.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/exceptions/case.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/exceptions/profile.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/exceptions/vcf.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/log.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/models/__init__.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/models/case.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/models/identity.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/models/profile_variant.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/models/variant.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/plugins/__init__.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/plugins/mongo/__init__.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/plugins/mongo/adapter.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/plugins/mongo/case.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/plugins/mongo/profile_variant.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/plugins/mongo/structural_variant.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/plugins/mongo/variant.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/resources/__init__.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/resources/loqusdb.20181005.gz +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/resources/maf_50_sites_GRCh37.vcf.gz +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/resources/maf_50_sites_GRCh38.vcf.gz +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/utils/__init__.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/utils/annotate.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/utils/case.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/utils/delete.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/utils/migrate.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/utils/profiling.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/utils/update.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/utils/variant.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/loqusdb/utils/vcf.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/build_models/test_build_case.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/build_models/test_build_variant.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/build_models/test_is_greater.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/commands/test_export.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/commands/test_identity.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/commands/test_view.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/conftest.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/fixtures/643594.clinical.SV.vcf +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/fixtures/643594.clinical.vcf.gz +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/fixtures/double_variant.vcf +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/fixtures/funny_trio.ped +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/fixtures/profile_snv.vcf +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/fixtures/recessive_trio.ped +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/fixtures/test.SV.vcf +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/fixtures/test.vcf +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/fixtures/test.vcf.gz +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/fixtures/test.vcf.gz.tbi +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/fixtures/unsorted.vcf +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/functional/test_cli.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/plugins/mongo/test_case_operations.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/plugins/mongo/test_connect.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/plugins/mongo/test_flask_extension.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/plugins/mongo/test_get_sv.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/plugins/mongo/test_load_svs.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/plugins/mongo/test_variant_operations.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/utils/test_case.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/utils/test_delete.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/utils/test_delete_family.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/utils/test_delete_variant.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/utils/test_get_family.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/utils/test_load_database.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/utils/test_load_family.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/utils/test_load_variants.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/utils/test_migrate.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/utils/test_profiling.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/vcf_tools/test_check_par.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/vcf_tools/test_check_vcf.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/vcf_tools/test_format_sv_variant.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/vcf_tools/test_format_variant.py +0 -0
- {loqusdb-2.7.16 → loqusdb-2.7.18}/tests/vcf_tools/test_vcf.py +0 -0
@@ -148,6 +148,7 @@ def build_variant(
|
|
148
148
|
case_id: Optional[str] = None,
|
149
149
|
gq_threshold: Optional[int] = None,
|
150
150
|
gq_qual: Optional[bool] = False,
|
151
|
+
ignore_gq_if_unset: Optional[bool] = False,
|
151
152
|
genome_build: Optional[str] = None,
|
152
153
|
) -> Variant:
|
153
154
|
"""Return a Variant object
|
@@ -164,6 +165,8 @@ def build_variant(
|
|
164
165
|
case_id(str): The case id
|
165
166
|
gq_threshold(int): Genotype Quality threshold
|
166
167
|
gq_qual(bool): Use variant.QUAL for quality instead of GQ
|
168
|
+
ignore_gq_if_unset(bool): Ignore GQ threshold check for variants that do not have GQ or QUAL set.
|
169
|
+
genome_build(str): Genome build. Ex. GRCh37 or GRCh38
|
167
170
|
|
168
171
|
Return:
|
169
172
|
formated_variant(models.Variant): A variant dictionary
|
@@ -201,14 +204,15 @@ def build_variant(
|
|
201
204
|
ind_pos = ind_obj["ind_index"]
|
202
205
|
|
203
206
|
if gq_qual:
|
204
|
-
gq =
|
207
|
+
gq = -1
|
205
208
|
if variant.QUAL:
|
206
209
|
gq = int(variant.QUAL)
|
207
210
|
|
208
211
|
if not gq_qual:
|
209
212
|
gq = int(variant.gt_quals[ind_pos])
|
210
213
|
|
211
|
-
|
214
|
+
# When gq is missing in FORMAT cyvcf2 assigns a score of -1
|
215
|
+
if (gq_threshold and 0 <= gq < gq_threshold) or (gq == -1 and not ignore_gq_if_unset):
|
212
216
|
continue
|
213
217
|
|
214
218
|
genotype = GENOTYPE_MAP[variant.gt_types[ind_pos]]
|
@@ -88,6 +88,20 @@ def validate_profile_threshold(ctx, param, value):
|
|
88
88
|
callback=validate_profile_threshold,
|
89
89
|
help="profile hamming distance to store similar individuals (0-1)",
|
90
90
|
)
|
91
|
+
@click.option(
|
92
|
+
"--snv-gq-only",
|
93
|
+
is_flag=True,
|
94
|
+
default=False,
|
95
|
+
show_default=True,
|
96
|
+
help="Apply GQ threshold only to SNV variants",
|
97
|
+
)
|
98
|
+
@click.option(
|
99
|
+
"--ignore-gq-if-unset",
|
100
|
+
is_flag=True,
|
101
|
+
default=False,
|
102
|
+
show_default=True,
|
103
|
+
help="Ignore GQ threshold if GQ (or the QUAL field for --qual-gq) is unset in VCF",
|
104
|
+
)
|
91
105
|
@click.pass_context
|
92
106
|
def load(
|
93
107
|
ctx,
|
@@ -104,6 +118,8 @@ def load(
|
|
104
118
|
hard_threshold,
|
105
119
|
soft_threshold,
|
106
120
|
qual_gq,
|
121
|
+
snv_gq_only,
|
122
|
+
ignore_gq_if_unset,
|
107
123
|
):
|
108
124
|
"""Load the variants of a case
|
109
125
|
|
@@ -145,12 +161,14 @@ def load(
|
|
145
161
|
skip_case_id=skip_case_id,
|
146
162
|
case_id=case_id,
|
147
163
|
gq_threshold=gq_threshold,
|
164
|
+
snv_gq_only=snv_gq_only,
|
148
165
|
qual_gq=qual_gq,
|
149
166
|
max_window=max_window,
|
150
167
|
profile_file=variant_profile_path,
|
151
168
|
hard_threshold=hard_threshold,
|
152
169
|
soft_threshold=soft_threshold,
|
153
170
|
genome_build=genome_build,
|
171
|
+
ignore_gq_if_unset=ignore_gq_if_unset,
|
154
172
|
)
|
155
173
|
except (SyntaxError, CaseError, IOError) as error:
|
156
174
|
LOG.warning(error)
|
@@ -31,6 +31,7 @@ def load_database(
|
|
31
31
|
family_type="ped",
|
32
32
|
skip_case_id=False,
|
33
33
|
gq_threshold=None,
|
34
|
+
snv_gq_only=False,
|
34
35
|
qual_gq=False,
|
35
36
|
case_id=None,
|
36
37
|
max_window=3000,
|
@@ -38,6 +39,7 @@ def load_database(
|
|
38
39
|
hard_threshold=0.95,
|
39
40
|
soft_threshold=0.9,
|
40
41
|
genome_build=None,
|
42
|
+
ignore_gq_if_unset=False,
|
41
43
|
):
|
42
44
|
"""Load the database with a case and its variants
|
43
45
|
|
@@ -55,6 +57,8 @@ def load_database(
|
|
55
57
|
check_profile(bool): Does profile check if True
|
56
58
|
hard_threshold(float): Rejects load if hamming distance above this is found
|
57
59
|
soft_threshold(float): Stores similar samples if hamming distance above this is found
|
60
|
+
genome_build(str): Store the genome version
|
61
|
+
ignore_gq_if_unset(str): Ignore the gq threhsold check for variants that do not have a GQ or QUAL set
|
58
62
|
|
59
63
|
Returns:
|
60
64
|
nr_inserted(int)
|
@@ -88,11 +92,13 @@ def load_database(
|
|
88
92
|
adapter, profiles, hard_threshold=hard_threshold, soft_threshold=soft_threshold
|
89
93
|
)
|
90
94
|
|
91
|
-
# If a gq threshold is used the variants
|
95
|
+
# If a gq threshold is used the variants need to have GQ (only SNVs if snv_gq_only)
|
92
96
|
for _vcf_file in vcf_files:
|
93
|
-
|
94
|
-
|
97
|
+
is_sv = _vcf_file == sv_file
|
98
|
+
if snv_gq_only and is_sv:
|
99
|
+
continue # skip GQ check for SV VCF
|
95
100
|
|
101
|
+
vcf = get_vcf(_vcf_file)
|
96
102
|
if gq_threshold and not vcf.contains("GQ") and not qual_gq:
|
97
103
|
LOG.warning("Set gq-threshold to 0 or add info to vcf {0}".format(_vcf_file))
|
98
104
|
raise SyntaxError("GQ is not defined in vcf header")
|
@@ -144,11 +150,12 @@ def load_database(
|
|
144
150
|
vcf_obj=vcf_obj,
|
145
151
|
case_obj=case_obj,
|
146
152
|
skip_case_id=skip_case_id,
|
147
|
-
gq_threshold=gq_threshold,
|
153
|
+
gq_threshold=gq_threshold if not snv_gq_only or variant_type == "snv" else None,
|
148
154
|
qual_gq=qual_gq,
|
149
155
|
max_window=max_window,
|
150
156
|
variant_type=variant_type,
|
151
157
|
genome_build=genome_build,
|
158
|
+
ignore_gq_if_unset=ignore_gq_if_unset,
|
152
159
|
)
|
153
160
|
except Exception as err:
|
154
161
|
# If something went wrong do a rollback
|
@@ -196,18 +203,22 @@ def load_variants(
|
|
196
203
|
max_window=3000,
|
197
204
|
variant_type="snv",
|
198
205
|
genome_build=None,
|
206
|
+
ignore_gq_if_unset=False,
|
199
207
|
):
|
200
208
|
"""Load variants for a family into the database.
|
201
209
|
|
202
210
|
Args:
|
203
211
|
adapter (loqusdb.plugins.Adapter): initialized plugin
|
212
|
+
vcf_obj(cyvcf2.VCF): Iterable with cyvcf2.Variant
|
204
213
|
case_obj(Case): dict with case information
|
205
|
-
nr_variants(int)
|
206
214
|
skip_case_id (bool): whether to include the case id on variant level
|
207
215
|
or not
|
208
216
|
gq_threshold(int)
|
217
|
+
qual_gq(bool): whether to use QUAL instead of GQ
|
209
218
|
max_window(int): Specify the max size for sv windows
|
210
219
|
variant_type(str): 'sv' or 'snv'
|
220
|
+
genome_build(str): Genome version. Ex. GRCH37
|
221
|
+
ignore_gq_if_unset (bool): whether to add entries that have missing GQ or QUAL field
|
211
222
|
|
212
223
|
Returns:
|
213
224
|
nr_inserted(int)
|
@@ -226,7 +237,13 @@ def load_variants(
|
|
226
237
|
|
227
238
|
variants = (
|
228
239
|
build_variant(
|
229
|
-
variant,
|
240
|
+
variant,
|
241
|
+
case_obj,
|
242
|
+
case_id,
|
243
|
+
gq_threshold,
|
244
|
+
qual_gq,
|
245
|
+
ignore_gq_if_unset,
|
246
|
+
genome_build=genome_build,
|
230
247
|
)
|
231
248
|
for variant in bar
|
232
249
|
)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|