loqusdb 2.7.17__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.17 → loqusdb-2.7.18}/PKG-INFO +1 -1
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/__init__.py +1 -1
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/build_models/variant.py +6 -2
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/commands/load.py +9 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/utils/load.py +16 -2
- {loqusdb-2.7.17 → loqusdb-2.7.18}/pyproject.toml +1 -1
- {loqusdb-2.7.17 → loqusdb-2.7.18}/LICENSE +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/README.md +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/__main__.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/build_models/__init__.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/build_models/case.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/build_models/profile_variant.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/commands/__init__.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/commands/annotate.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/commands/cli.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/commands/delete.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/commands/export.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/commands/identity.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/commands/load_profile.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/commands/migrate.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/commands/restore.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/commands/update.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/commands/view.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/commands/wipe.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/constants/__init__.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/exceptions/__init__.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/exceptions/case.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/exceptions/profile.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/exceptions/vcf.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/log.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/models/__init__.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/models/case.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/models/identity.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/models/profile_variant.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/models/variant.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/plugins/__init__.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/plugins/mongo/__init__.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/plugins/mongo/adapter.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/plugins/mongo/case.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/plugins/mongo/profile_variant.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/plugins/mongo/structural_variant.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/plugins/mongo/variant.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/resources/__init__.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/resources/loqusdb.20181005.gz +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/resources/maf_50_sites_GRCh37.vcf.gz +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/resources/maf_50_sites_GRCh38.vcf.gz +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/utils/__init__.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/utils/annotate.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/utils/case.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/utils/delete.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/utils/migrate.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/utils/profiling.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/utils/update.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/utils/variant.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/loqusdb/utils/vcf.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/build_models/test_build_case.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/build_models/test_build_variant.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/build_models/test_is_greater.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/commands/test_export.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/commands/test_identity.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/commands/test_view.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/conftest.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/fixtures/643594.clinical.SV.vcf +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/fixtures/643594.clinical.vcf.gz +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/fixtures/double_variant.vcf +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/fixtures/funny_trio.ped +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/fixtures/profile_snv.vcf +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/fixtures/recessive_trio.ped +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/fixtures/test.SV.vcf +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/fixtures/test.vcf +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/fixtures/test.vcf.gz +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/fixtures/test.vcf.gz.tbi +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/fixtures/unsorted.vcf +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/functional/test_cli.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/plugins/mongo/test_case_operations.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/plugins/mongo/test_connect.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/plugins/mongo/test_flask_extension.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/plugins/mongo/test_get_sv.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/plugins/mongo/test_load_svs.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/plugins/mongo/test_variant_operations.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/utils/test_case.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/utils/test_delete.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/utils/test_delete_family.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/utils/test_delete_variant.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/utils/test_get_family.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/utils/test_load_database.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/utils/test_load_family.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/utils/test_load_variants.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/utils/test_migrate.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/utils/test_profiling.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/vcf_tools/test_check_par.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/vcf_tools/test_check_vcf.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/vcf_tools/test_format_sv_variant.py +0 -0
- {loqusdb-2.7.17 → loqusdb-2.7.18}/tests/vcf_tools/test_format_variant.py +0 -0
- {loqusdb-2.7.17 → 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]]
|
@@ -95,6 +95,13 @@ def validate_profile_threshold(ctx, param, value):
|
|
95
95
|
show_default=True,
|
96
96
|
help="Apply GQ threshold only to SNV variants",
|
97
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
|
+
)
|
98
105
|
@click.pass_context
|
99
106
|
def load(
|
100
107
|
ctx,
|
@@ -112,6 +119,7 @@ def load(
|
|
112
119
|
soft_threshold,
|
113
120
|
qual_gq,
|
114
121
|
snv_gq_only,
|
122
|
+
ignore_gq_if_unset,
|
115
123
|
):
|
116
124
|
"""Load the variants of a case
|
117
125
|
|
@@ -160,6 +168,7 @@ def load(
|
|
160
168
|
hard_threshold=hard_threshold,
|
161
169
|
soft_threshold=soft_threshold,
|
162
170
|
genome_build=genome_build,
|
171
|
+
ignore_gq_if_unset=ignore_gq_if_unset,
|
163
172
|
)
|
164
173
|
except (SyntaxError, CaseError, IOError) as error:
|
165
174
|
LOG.warning(error)
|
@@ -39,6 +39,7 @@ def load_database(
|
|
39
39
|
hard_threshold=0.95,
|
40
40
|
soft_threshold=0.9,
|
41
41
|
genome_build=None,
|
42
|
+
ignore_gq_if_unset=False,
|
42
43
|
):
|
43
44
|
"""Load the database with a case and its variants
|
44
45
|
|
@@ -56,6 +57,8 @@ def load_database(
|
|
56
57
|
check_profile(bool): Does profile check if True
|
57
58
|
hard_threshold(float): Rejects load if hamming distance above this is found
|
58
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
|
59
62
|
|
60
63
|
Returns:
|
61
64
|
nr_inserted(int)
|
@@ -152,6 +155,7 @@ def load_database(
|
|
152
155
|
max_window=max_window,
|
153
156
|
variant_type=variant_type,
|
154
157
|
genome_build=genome_build,
|
158
|
+
ignore_gq_if_unset=ignore_gq_if_unset,
|
155
159
|
)
|
156
160
|
except Exception as err:
|
157
161
|
# If something went wrong do a rollback
|
@@ -199,18 +203,22 @@ def load_variants(
|
|
199
203
|
max_window=3000,
|
200
204
|
variant_type="snv",
|
201
205
|
genome_build=None,
|
206
|
+
ignore_gq_if_unset=False,
|
202
207
|
):
|
203
208
|
"""Load variants for a family into the database.
|
204
209
|
|
205
210
|
Args:
|
206
211
|
adapter (loqusdb.plugins.Adapter): initialized plugin
|
212
|
+
vcf_obj(cyvcf2.VCF): Iterable with cyvcf2.Variant
|
207
213
|
case_obj(Case): dict with case information
|
208
|
-
nr_variants(int)
|
209
214
|
skip_case_id (bool): whether to include the case id on variant level
|
210
215
|
or not
|
211
216
|
gq_threshold(int)
|
217
|
+
qual_gq(bool): whether to use QUAL instead of GQ
|
212
218
|
max_window(int): Specify the max size for sv windows
|
213
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
|
214
222
|
|
215
223
|
Returns:
|
216
224
|
nr_inserted(int)
|
@@ -229,7 +237,13 @@ def load_variants(
|
|
229
237
|
|
230
238
|
variants = (
|
231
239
|
build_variant(
|
232
|
-
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,
|
233
247
|
)
|
234
248
|
for variant in bar
|
235
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
|