loqusdb 2.7.3__py3-none-any.whl → 2.7.9__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.
- README.md +148 -0
- loqusdb/__init__.py +5 -3
- loqusdb/__main__.py +0 -0
- loqusdb/build_models/case.py +3 -10
- loqusdb/build_models/variant.py +12 -4
- loqusdb/resources/loqusdb.20181005.gz +0 -0
- loqusdb/resources/maf_50_sites_GRCh37.vcf.gz +0 -0
- loqusdb/resources/maf_50_sites_GRCh38.vcf.gz +0 -0
- {loqusdb-2.7.3.dist-info → loqusdb-2.7.9.dist-info}/METADATA +27 -42
- loqusdb-2.7.9.dist-info/RECORD +97 -0
- {loqusdb-2.7.3.dist-info → loqusdb-2.7.9.dist-info}/WHEEL +1 -2
- loqusdb-2.7.9.dist-info/entry_points.txt +3 -0
- tests/build_models/test_build_case.py +150 -0
- tests/build_models/test_build_variant.py +15 -0
- tests/build_models/test_is_greater.py +49 -0
- tests/commands/test_export.py +16 -0
- tests/commands/test_identity.py +22 -0
- tests/commands/test_view.py +17 -0
- tests/conftest.py +438 -0
- tests/fixtures/643594.clinical.SV.vcf +178 -0
- tests/fixtures/643594.clinical.vcf.gz +0 -0
- tests/fixtures/double_variant.vcf +21 -0
- tests/fixtures/funny_trio.ped +4 -0
- tests/fixtures/profile_snv.vcf +47 -0
- tests/fixtures/recessive_trio.ped +4 -0
- tests/fixtures/test.SV.vcf +178 -0
- tests/fixtures/test.vcf +26 -0
- tests/fixtures/test.vcf.gz +0 -0
- tests/fixtures/test.vcf.gz.tbi +0 -0
- tests/fixtures/unsorted.vcf +20 -0
- tests/functional/test_cli.py +213 -0
- tests/plugins/mongo/test_case_operations.py +143 -0
- tests/plugins/mongo/test_connect.py +8 -0
- tests/plugins/mongo/test_flask_extension.py +27 -0
- tests/plugins/mongo/test_get_sv.py +27 -0
- tests/plugins/mongo/test_load_svs.py +74 -0
- tests/plugins/mongo/test_variant_operations.py +278 -0
- tests/utils/test_case.py +34 -0
- tests/utils/test_delete.py +73 -0
- tests/utils/test_delete_family.py +30 -0
- tests/utils/test_delete_variant.py +74 -0
- tests/utils/test_get_family.py +13 -0
- tests/utils/test_load_database.py +52 -0
- tests/utils/test_load_family.py +69 -0
- tests/utils/test_load_variants.py +225 -0
- tests/utils/test_migrate.py +38 -0
- tests/utils/test_profiling.py +68 -0
- tests/vcf_tools/test_check_par.py +67 -0
- tests/vcf_tools/test_check_vcf.py +64 -0
- tests/vcf_tools/test_format_sv_variant.py +102 -0
- tests/vcf_tools/test_format_variant.py +113 -0
- tests/vcf_tools/test_vcf.py +63 -0
- loqusdb-2.7.3.dist-info/RECORD +0 -54
- loqusdb-2.7.3.dist-info/entry_points.txt +0 -3
- loqusdb-2.7.3.dist-info/top_level.txt +0 -1
- {loqusdb-2.7.3.dist-info → loqusdb-2.7.9.dist-info}/LICENSE +0 -0
README.md
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
# loqusdb
|
2
|
+
[](https://github.com/moonso/loqusdb/actions/workflows/build_and_publish.yml)
|
3
|
+
[](https://coveralls.io/github/moonso/loqusdb?branch=master)
|
4
|
+
[![PyPI Version][pypi-img]][pypi-url]
|
5
|
+
|
6
|
+
Small tool to set up a local variant database.
|
7
|
+
If you find Loqusdb useful in your work, please cite the [article][publication].
|
8
|
+
|
9
|
+
Right now **Locusdb** uses [mongodb][mongodb] as backend for
|
10
|
+
storing variants, but there should not be a huge difference to use another
|
11
|
+
database manager.
|
12
|
+
|
13
|
+
## Installation ##
|
14
|
+
|
15
|
+
|
16
|
+
`poetry install`
|
17
|
+
|
18
|
+
or
|
19
|
+
|
20
|
+
```
|
21
|
+
$git clone https://github.com/moonso/loqusdb
|
22
|
+
$cd loqusdb
|
23
|
+
$poetry install
|
24
|
+
```
|
25
|
+
|
26
|
+
## Idea ##
|
27
|
+
|
28
|
+
Tool to keep track of what variants that have been seen and in what families they have been observed.
|
29
|
+
This is **NOT** a tool to create a true frequency database.
|
30
|
+
It will basically count the number of times we have seen a variant in any individual.
|
31
|
+
We will also keep track of the variants that have been seen in a homozygous or hemizygous state.
|
32
|
+
|
33
|
+
Variants are stored by providing a VCF file and a (ped or ped like) family file.
|
34
|
+
|
35
|
+
Loqusdb will first check if the VCF file adheres to the VCF format.
|
36
|
+
|
37
|
+
The tool will then check all variants if they have been observed in any of the individuals in the family.
|
38
|
+
|
39
|
+
When the variants are added:
|
40
|
+
|
41
|
+
- Either the variant exists, in this case we increase the number of observations with one
|
42
|
+
- Or this variant has not been seen before, then the variant is added to the database
|
43
|
+
|
44
|
+
|
45
|
+
## Command Line Interface ##
|
46
|
+
|
47
|
+
```
|
48
|
+
$ loqusdb
|
49
|
+
Usage: loqusdb [OPTIONS] COMMAND [ARGS]...
|
50
|
+
|
51
|
+
loqusdb: manage a local variant count database.
|
52
|
+
|
53
|
+
Options:
|
54
|
+
-db, --database TEXT Defaults to 'loqusdb' if not specified
|
55
|
+
-u, --username TEXT
|
56
|
+
-p, --password TEXT
|
57
|
+
-a, --authdb TEXT If authentication should be done against
|
58
|
+
another database than --database
|
59
|
+
|
60
|
+
-port, --port INTEGER Specify the port where to look for the mongo
|
61
|
+
database. [default: 27017]
|
62
|
+
|
63
|
+
-h, --host TEXT Specify the host where to look for the mongo
|
64
|
+
database. [default: localhost]
|
65
|
+
|
66
|
+
--uri TEXT Specify a mongodb uri
|
67
|
+
-c, --config FILENAME Use a config with db information
|
68
|
+
-t, --test Used for testing. This will use a mongomock
|
69
|
+
database.
|
70
|
+
|
71
|
+
-g, --genome-build [GRCh37|GRCh38]
|
72
|
+
Specify what genome build to use
|
73
|
+
-v, --verbose
|
74
|
+
--version Show the version and exit.
|
75
|
+
--help Show this message and exit.
|
76
|
+
|
77
|
+
Commands:
|
78
|
+
annotate Annotate a VCF with observations
|
79
|
+
cases Display cases in database
|
80
|
+
delete Delete the variants of a family
|
81
|
+
dump Dump the database
|
82
|
+
export Export variants to VCF format
|
83
|
+
identity Search identity collection
|
84
|
+
index Add indexes to database
|
85
|
+
load Load the variants of a family
|
86
|
+
migrate Migrate an old loqusdb instance
|
87
|
+
profile Loads variants to be used in profiling
|
88
|
+
restore Restore database from dump
|
89
|
+
update Update an existing case with a new type of variants
|
90
|
+
variants Display variants in database
|
91
|
+
wipe Wipe a loqusdb instance
|
92
|
+
```
|
93
|
+
|
94
|
+
|
95
|
+
## Database ##
|
96
|
+
|
97
|
+
### Connecting ###
|
98
|
+
|
99
|
+
Connection can be specified on command line with `--database`, `--username`, `--password`, `--port`, `--host` and/or `--uri`. Or these options can be sent with a config file that can take the same options:
|
100
|
+
|
101
|
+
```yaml
|
102
|
+
uri: mongodb://loqusdb-username:loqusdb-pwd@localhost:27030/loqusdb-rd?authSource=admin
|
103
|
+
db_name: loqusdb_test
|
104
|
+
```
|
105
|
+
or
|
106
|
+
```yaml
|
107
|
+
host: localhost
|
108
|
+
port: 27030
|
109
|
+
username: loqusdb-username
|
110
|
+
password: loqusdb-pwd
|
111
|
+
authdb: admin
|
112
|
+
db_name: loqusdb_test
|
113
|
+
```
|
114
|
+
|
115
|
+
### Mongo ###
|
116
|
+
|
117
|
+
The collections are defined as follows:
|
118
|
+
|
119
|
+
**Case**
|
120
|
+
|
121
|
+
```python
|
122
|
+
{
|
123
|
+
'case_id': 'case_id',
|
124
|
+
'vcf_path': 'path_to_vcf'
|
125
|
+
}
|
126
|
+
```
|
127
|
+
|
128
|
+
**Variant**
|
129
|
+
|
130
|
+
```python
|
131
|
+
{
|
132
|
+
'_id': 'variant_id',
|
133
|
+
'chrom': 'CHROM',
|
134
|
+
'start': postition,
|
135
|
+
'end': end postition,
|
136
|
+
'ref': reference base(s),
|
137
|
+
'alt': alternative base(s),
|
138
|
+
'homozygote': number_of_homozygotes,
|
139
|
+
'hemizygote': number_of_hemizygotes,
|
140
|
+
'observations': number_of_observations,
|
141
|
+
'families': ['family_id', ...]
|
142
|
+
}
|
143
|
+
```
|
144
|
+
|
145
|
+
[mongodb]: https://www.mongodb.org
|
146
|
+
[publication]: https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-020-03609-z
|
147
|
+
[pypi-img]: https://img.shields.io/pypi/v/loqusdb.svg?style=flat-square
|
148
|
+
[pypi-url]: https://pypi.python.org/pypi/loqusdb/
|
loqusdb/__init__.py
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
import logging
|
2
2
|
|
3
|
-
from pkg_resources import get_distribution
|
4
3
|
from pymongo import ASCENDING, IndexModel
|
5
4
|
|
6
5
|
logger = logging.getLogger(__name__)
|
7
6
|
|
8
|
-
__version__ =
|
7
|
+
__version__ = "2.7.9"
|
9
8
|
|
10
9
|
INDEXES = {
|
11
10
|
"variant": [
|
@@ -28,12 +27,14 @@ INDEXES = {
|
|
28
27
|
"structural_variant": [
|
29
28
|
IndexModel(
|
30
29
|
[
|
30
|
+
("sv_type", ASCENDING),
|
31
31
|
("chrom", ASCENDING),
|
32
32
|
("end_chrom", ASCENDING),
|
33
|
-
("sv_type", ASCENDING),
|
34
33
|
("pos_left", ASCENDING),
|
34
|
+
("pos_right", ASCENDING),
|
35
35
|
],
|
36
36
|
name="coordinates",
|
37
|
+
background=True,
|
37
38
|
),
|
38
39
|
IndexModel(
|
39
40
|
[
|
@@ -42,6 +43,7 @@ INDEXES = {
|
|
42
43
|
("end_right", ASCENDING),
|
43
44
|
],
|
44
45
|
name="short_coordinates",
|
46
|
+
background=True,
|
45
47
|
),
|
46
48
|
],
|
47
49
|
"identity": [
|
loqusdb/__main__.py
CHANGED
File without changes
|
loqusdb/build_models/case.py
CHANGED
@@ -6,15 +6,8 @@ from loqusdb.models import Case, Individual
|
|
6
6
|
LOG = logging.getLogger(__name__)
|
7
7
|
|
8
8
|
|
9
|
-
def get_individual_positions(individuals):
|
10
|
-
"""Return a dictionary with individual positions
|
11
|
-
|
12
|
-
Args:
|
13
|
-
individuals(list): A list with vcf individuals in correct order
|
14
|
-
|
15
|
-
Returns:
|
16
|
-
ind_pos(dict): Map from ind_id -> index position
|
17
|
-
"""
|
9
|
+
def get_individual_positions(individuals: list[str]) -> dict[str, int]:
|
10
|
+
"""Return a dictionary with individual positions."""
|
18
11
|
ind_pos = {}
|
19
12
|
if individuals:
|
20
13
|
for i, ind in enumerate(individuals):
|
@@ -35,7 +28,7 @@ def build_case(
|
|
35
28
|
matches=None,
|
36
29
|
profile_path=None,
|
37
30
|
):
|
38
|
-
"""Build a Case from the given information
|
31
|
+
"""Build a Case from the given information.
|
39
32
|
|
40
33
|
Args:
|
41
34
|
case(ped_parser.Family): A family object
|
loqusdb/build_models/variant.py
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
import logging
|
2
2
|
from collections import namedtuple
|
3
3
|
|
4
|
+
import cyvcf2
|
5
|
+
|
6
|
+
from typing import Optional
|
7
|
+
|
4
8
|
from loqusdb.constants import CHROM_TO_INT, GENOTYPE_MAP, GRCH37, PAR
|
5
|
-
from loqusdb.models import Variant
|
9
|
+
from loqusdb.models import Case, Variant
|
6
10
|
|
7
11
|
LOG = logging.getLogger(__name__)
|
8
12
|
|
@@ -139,19 +143,21 @@ def get_coords(variant):
|
|
139
143
|
return coordinates
|
140
144
|
|
141
145
|
|
142
|
-
def build_variant(variant, case_obj, case_id=None, gq_threshold=None, gq_qual=False, genome_build=None):
|
146
|
+
def build_variant(variant: cyvcf2.Variant, case_obj: Case, case_id: Optional[str]=None, gq_threshold: Optional[int]=None, gq_qual: Optional[bool]=False, genome_build: Optional[str]=None) -> Variant:
|
143
147
|
"""Return a Variant object
|
144
148
|
|
145
149
|
Take a cyvcf2 formated variant line and return a models.Variant.
|
146
150
|
|
147
|
-
If
|
151
|
+
If criteria are not fulfilled, eg variant has no GT call or quality.
|
148
152
|
is below gq threshold then return None.
|
149
153
|
|
154
|
+
|
150
155
|
Args:
|
151
156
|
variant(cyvcf2.Variant)
|
152
157
|
case_obj(Case): We need the case object to check individuals sex
|
153
158
|
case_id(str): The case id
|
154
159
|
gq_threshold(int): Genotype Quality threshold
|
160
|
+
gq_qual(bool): Use variant.QUAL for quality instead of GQ
|
155
161
|
|
156
162
|
Return:
|
157
163
|
formated_variant(models.Variant): A variant dictionary
|
@@ -190,7 +196,9 @@ def build_variant(variant, case_obj, case_id=None, gq_threshold=None, gq_qual=Fa
|
|
190
196
|
ind_pos = ind_obj["ind_index"]
|
191
197
|
|
192
198
|
if gq_qual:
|
193
|
-
gq =
|
199
|
+
gq = 0
|
200
|
+
if variant.QUAL:
|
201
|
+
gq = int(variant.QUAL)
|
194
202
|
|
195
203
|
if not gq_qual:
|
196
204
|
gq = int(variant.gt_quals[ind_pos])
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,63 +1,49 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: loqusdb
|
3
|
-
Version: 2.7.
|
4
|
-
Summary:
|
5
|
-
Home-page: https://github.com/moonso/loqusdb
|
6
|
-
Author: Måns Magnusson
|
7
|
-
Author-email: mans.magnusson@scilifelab.com
|
3
|
+
Version: 2.7.9
|
4
|
+
Summary: A simple observation count database
|
8
5
|
License: MIT
|
9
|
-
|
10
|
-
|
6
|
+
Author: Your Name
|
7
|
+
Author-email: you@example.com
|
8
|
+
Requires-Python: >=3.12,<4.0
|
11
9
|
Classifier: License :: OSI Approved :: MIT License
|
12
|
-
Classifier: Programming Language :: Python
|
13
10
|
Classifier: Programming Language :: Python :: 3
|
14
|
-
Classifier: Programming Language :: Python :: 3.
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
20
|
-
Requires-Python: >=3.7.0
|
21
|
-
Description-Content-Type: text/markdown
|
22
|
-
License-File: LICENSE
|
23
|
-
Requires-Dist: pytest ==5.4.3
|
24
|
-
Requires-Dist: cyvcf2 ==0.30.12
|
25
|
-
Requires-Dist: mongomock
|
26
|
-
Requires-Dist: click ==7.1.2
|
27
|
-
Requires-Dist: pymongo
|
28
|
-
Requires-Dist: numpy ==1.21.4
|
29
|
-
Requires-Dist: coloredlogs ==14.0
|
30
|
-
Requires-Dist: pyyaml >=5.4.1
|
31
|
-
Requires-Dist: vcftoolbox ==1.5
|
32
|
-
Requires-Dist: pip ==23.1.2
|
33
|
-
Requires-Dist: setuptools ==65.5.1
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
12
|
+
Requires-Dist: PyYAML
|
13
|
+
Requires-Dist: click
|
14
|
+
Requires-Dist: coloredlogs
|
15
|
+
Requires-Dist: cyvcf2
|
34
16
|
Requires-Dist: mongo-adapter
|
35
|
-
Requires-Dist:
|
36
|
-
|
17
|
+
Requires-Dist: numpy
|
18
|
+
Requires-Dist: ped_parser
|
19
|
+
Requires-Dist: pymongo
|
20
|
+
Requires-Dist: setuptools
|
21
|
+
Requires-Dist: vcftoolbox
|
22
|
+
Description-Content-Type: text/markdown
|
37
23
|
|
38
24
|
# loqusdb
|
39
25
|
[](https://github.com/moonso/loqusdb/actions/workflows/build_and_publish.yml)
|
40
26
|
[](https://coveralls.io/github/moonso/loqusdb?branch=master)
|
41
27
|
[![PyPI Version][pypi-img]][pypi-url]
|
42
28
|
|
43
|
-
Small tool to
|
29
|
+
Small tool to set up a local variant database.
|
30
|
+
If you find Loqusdb useful in your work, please cite the [article][publication].
|
44
31
|
|
45
|
-
Right now **
|
46
|
-
storing variants but there should not be a huge difference to use another
|
32
|
+
Right now **Locusdb** uses [mongodb][mongodb] as backend for
|
33
|
+
storing variants, but there should not be a huge difference to use another
|
47
34
|
database manager.
|
48
35
|
|
49
36
|
## Installation ##
|
50
37
|
|
51
|
-
These instructions were written and tested using a conda environment with a version of **Python >=3.9**, which is required by the installer file (setup.py).
|
52
38
|
|
53
|
-
`
|
39
|
+
`poetry install`
|
54
40
|
|
55
41
|
or
|
56
42
|
|
57
43
|
```
|
58
44
|
$git clone https://github.com/moonso/loqusdb
|
59
45
|
$cd loqusdb
|
60
|
-
$
|
46
|
+
$poetry install
|
61
47
|
```
|
62
48
|
|
63
49
|
## Idea ##
|
@@ -67,16 +53,16 @@ This is **NOT** a tool to create a true frequency database.
|
|
67
53
|
It will basically count the number of times we have seen a variant in any individual.
|
68
54
|
We will also keep track of the variants that have been seen in a homozygous or hemizygous state.
|
69
55
|
|
70
|
-
Variants are stored by providing a
|
56
|
+
Variants are stored by providing a VCF file and a (ped or ped like) family file.
|
71
57
|
|
72
|
-
Loqusdb will first check if the
|
58
|
+
Loqusdb will first check if the VCF file adheres to the VCF format.
|
73
59
|
|
74
60
|
The tool will then check all variants if they have been observed in any of the individuals in the family.
|
75
61
|
|
76
62
|
When the variants are added:
|
77
63
|
|
78
64
|
- Either the variant exists, in this case we increase the number of observations with one
|
79
|
-
- Or this variant has not
|
65
|
+
- Or this variant has not been seen before, then the variant is added to the database
|
80
66
|
|
81
67
|
|
82
68
|
## Command Line Interface ##
|
@@ -133,7 +119,7 @@ Commands:
|
|
133
119
|
|
134
120
|
### Connecting ###
|
135
121
|
|
136
|
-
Connection can be specified on command line with `--database`, `--username`, `--password`, `--port`, `--host` and/or `--uri`. Or these options can be sent with a config file that can take the same options
|
122
|
+
Connection can be specified on command line with `--database`, `--username`, `--password`, `--port`, `--host` and/or `--uri`. Or these options can be sent with a config file that can take the same options:
|
137
123
|
|
138
124
|
```yaml
|
139
125
|
uri: mongodb://loqusdb-username:loqusdb-pwd@localhost:27030/loqusdb-rd?authSource=admin
|
@@ -151,7 +137,7 @@ db_name: loqusdb_test
|
|
151
137
|
|
152
138
|
### Mongo ###
|
153
139
|
|
154
|
-
The collections
|
140
|
+
The collections are defined as follows:
|
155
141
|
|
156
142
|
**Case**
|
157
143
|
|
@@ -184,4 +170,3 @@ The collections looks like:
|
|
184
170
|
[pypi-img]: https://img.shields.io/pypi/v/loqusdb.svg?style=flat-square
|
185
171
|
[pypi-url]: https://pypi.python.org/pypi/loqusdb/
|
186
172
|
|
187
|
-
|
@@ -0,0 +1,97 @@
|
|
1
|
+
README.md,sha256=0-XD0EEYvCnenT07wkO0ZX6lJbzN8OC1cV3M9G47nps,4648
|
2
|
+
loqusdb/__init__.py,sha256=bPrTjntIZhomIrT7e5Ccqec_JGJu12lqU47CIxDKBuY,1687
|
3
|
+
loqusdb/__main__.py,sha256=8FGKySAGaWSzAYMj6HRsxeyiME3V01Idt7HrmN7pSYY,397
|
4
|
+
loqusdb/build_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
+
loqusdb/build_models/case.py,sha256=AByutEYK2N3kS9JFvyZfPKNZdCpZHCSD0nNHAgaU1Cs,4127
|
6
|
+
loqusdb/build_models/profile_variant.py,sha256=TbSxfVjESstS_FgbkOW4NQwMQVeTyhn9oc9yPZmDhzI,1021
|
7
|
+
loqusdb/build_models/variant.py,sha256=LviEaovB_s_-jaLM64x0NzqzilFr__NPgv4Vf49Rhbk,6939
|
8
|
+
loqusdb/commands/__init__.py,sha256=BXAN3UADgqPrkGczzjlLO9GyyQ96dnLnP7n92JlYHgo,603
|
9
|
+
loqusdb/commands/annotate.py,sha256=748kImopE5WbaO1nuv3WUgIqezWFSsi7SBeWhOz26-s,1384
|
10
|
+
loqusdb/commands/cli.py,sha256=wJD5S1BoCxtRTAobd1QtmQpzlngJg-mt1nsyD92fDD4,3176
|
11
|
+
loqusdb/commands/delete.py,sha256=R6ysHKSMw1mmL4ZbktoUIKzdzDLQ3314YPYhIy1myic,1979
|
12
|
+
loqusdb/commands/export.py,sha256=-9SHgvr0G8FlyW0FGSfe1dmNDnjx4HKAaa-xYzSkvNc,3238
|
13
|
+
loqusdb/commands/identity.py,sha256=KLA9c8e6cJFDxtqIa1G6zdHTHK1sz2b3v1Utdtik_4k,787
|
14
|
+
loqusdb/commands/load.py,sha256=cVDdY7meBfcv8nMEGsjAX6aE-SKDOceGqM2vAvXPhko,4407
|
15
|
+
loqusdb/commands/load_profile.py,sha256=cflCbF9f77_HCH8xPnN8zSSocvIffRMnC2LPE0j7Xq8,3336
|
16
|
+
loqusdb/commands/migrate.py,sha256=2C8YL-zVqnpnqg3JIyUr0rbVnb8-AGPVWNhicHnPKLo,667
|
17
|
+
loqusdb/commands/restore.py,sha256=eqPX0yao0IAYS5SbjCdlsfSJRBbRByBLISUU2hTzqqs,1492
|
18
|
+
loqusdb/commands/update.py,sha256=zz3wueaJVqJ1FKact-rpY2az__5oa1LnZKf7mgqNGPk,3211
|
19
|
+
loqusdb/commands/view.py,sha256=kQ_HuFhIX5wTHoEFC6atH-5unQFkRtopzD2_GqHNPKY,5198
|
20
|
+
loqusdb/commands/wipe.py,sha256=WTOjyNooCUhtmZ6pdcPFa0PZrFc9E_pkLbnat_zP96M,553
|
21
|
+
loqusdb/constants/__init__.py,sha256=r6y2TN8BqbKuh2Uyxq0trh-3A9xiWeStqWlvEPp-rSA,1645
|
22
|
+
loqusdb/exceptions/__init__.py,sha256=Fq0UQg9TepWh19D7WT3dARyAHvorwJF6phhnZi2AkxE,88
|
23
|
+
loqusdb/exceptions/case.py,sha256=n3mGF7RIc1imQFxnNJ1TWxeJeMWN4MHsKxoZb0m1-Os,92
|
24
|
+
loqusdb/exceptions/profile.py,sha256=TVkRXh3ZbkNCmFHzZTCuhPP3iFWBwP1YQGD8IlSoCTo,98
|
25
|
+
loqusdb/exceptions/vcf.py,sha256=QMpr9oRzYtMaHzP8wtSU5HiXGmi4k48YnjCilNZ0j2M,95
|
26
|
+
loqusdb/log.py,sha256=CDcrCjzs9ef-d5Wg8Q_41bCOZRM5j8PyP06kNcynTj0,1691
|
27
|
+
loqusdb/models/__init__.py,sha256=yf0wONlDuGkztsOv15BFulYyQxdzqhuUKpL-R_clDVM,139
|
28
|
+
loqusdb/models/case.py,sha256=EJOkrAMJfS6eID3E7QtWkoa_tMMf21KV3Z5B-U0c-Wk,1660
|
29
|
+
loqusdb/models/identity.py,sha256=3DBlaZtrEtoiSU6nMXs7zY-mvy-9ew08-ZPjr_F3x3c,511
|
30
|
+
loqusdb/models/profile_variant.py,sha256=7Y7HRnoOfhvThAuuaXWe2tOr0u2wktSFr5GmoLuDhg8,409
|
31
|
+
loqusdb/models/variant.py,sha256=9QpM0ojJ24tKY9RrcgC411Wjnl3uRUawVYo6RWz1gXY,1068
|
32
|
+
loqusdb/plugins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
|
+
loqusdb/plugins/mongo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
34
|
+
loqusdb/plugins/mongo/adapter.py,sha256=rRUQ2y_bZwjINbdTtfzJ_1JwE0Ns0usyAJ3o0O1Y10I,2593
|
35
|
+
loqusdb/plugins/mongo/case.py,sha256=zKnaaam8Ey1AEH-1GofXp6iNqgmSvWWxZZWsx7dAO0Y,3006
|
36
|
+
loqusdb/plugins/mongo/profile_variant.py,sha256=madOBa3HacIN_T1V8mp7NEC4QOpqQBqSY6pKTObkMLA,600
|
37
|
+
loqusdb/plugins/mongo/structural_variant.py,sha256=RPc3GF37-O3GqRS9Z5PRxsBXACljfRT4KFsrEl0jCu0,12955
|
38
|
+
loqusdb/plugins/mongo/variant.py,sha256=NS3N8bhRap1b2ZSGjOw2LO6l7q_CzD00GZs499l38Tg,8715
|
39
|
+
loqusdb/resources/__init__.py,sha256=JOx3Ppgtghx55cOJN0bfBonSXM5DM_v0OFdlT-Qybg4,639
|
40
|
+
loqusdb/resources/loqusdb.20181005.gz,sha256=DI8CLI7fPnIAjM25Avraz-C7KQkOKsfnhgZWguGat9Y,12172904
|
41
|
+
loqusdb/resources/maf_50_sites_GRCh37.vcf.gz,sha256=BoD1_xZ-Rr8DTWCMNlQGh7gz1K8FA-j2nC4jKn_eB2A,5260
|
42
|
+
loqusdb/resources/maf_50_sites_GRCh38.vcf.gz,sha256=6T4iyrIr6yx1HpgobzAsh305BO1JX0oGj48nFiYt2QM,9037
|
43
|
+
loqusdb/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
44
|
+
loqusdb/utils/annotate.py,sha256=cPNWlhsv6yoe3lxNfa9DytO5eACuM_mOJJw_mglVMN0,2646
|
45
|
+
loqusdb/utils/case.py,sha256=aeTvyACJTDjzl-aOjAZaUzFMLisgFKMfcoXSvNAZz4s,2168
|
46
|
+
loqusdb/utils/delete.py,sha256=-ddBM_QXKzlUN6egEJggKzXX1P-WEdi92HgaD1DJRtg,4843
|
47
|
+
loqusdb/utils/load.py,sha256=rujUk89lL5jO35QfO8NKGJkjEJmN6PQxohKkxtpnw6Y,8252
|
48
|
+
loqusdb/utils/migrate.py,sha256=9Q6kdIi9TpFVzDYptlEE8RqPPS5wyzfM3F8egzmmBBk,1113
|
49
|
+
loqusdb/utils/profiling.py,sha256=3OizF7CpYvSl9kyl2g4KGJxbIRUqWfmfLxn3843XYDk,9164
|
50
|
+
loqusdb/utils/update.py,sha256=1edJG-u24FgOSxyXAQEiyTG4IyK-Uo3lSIl5qyzcXsI,4433
|
51
|
+
loqusdb/utils/variant.py,sha256=Lq5x9egVB-3rExBiRceF67TaL4Hp2gGoWMSRBEcnm4Q,2088
|
52
|
+
loqusdb/utils/vcf.py,sha256=ybmrTBEPYa0FbUXo8ttlwATk13RnKjX9eIDbRDwCiVE,5175
|
53
|
+
tests/build_models/test_build_case.py,sha256=4CzykSmiBgAVZWlqzjLTjBmY9NafzmPol7LiEu4003U,4404
|
54
|
+
tests/build_models/test_build_variant.py,sha256=-9ulYBNBIxAGt_FiyaADWLuTJ4bWwRVVfMbjzummMZA,537
|
55
|
+
tests/build_models/test_is_greater.py,sha256=sAz_UB6oGr72Pqc7ZEbPTw6N07E0QR-Yvn8UCEi0yP8,1360
|
56
|
+
tests/commands/test_export.py,sha256=PGLtmxbOzEgWsS9AqAQkjBY9NlQiHdWfrt7DAPUSzrY,439
|
57
|
+
tests/commands/test_identity.py,sha256=uEYPNkBvyQScrMRGpBqpINLDN3MgGt2nqXXjAkowQvc,566
|
58
|
+
tests/commands/test_view.py,sha256=wUM5DXqDBs0OP-KsWh1_Lizhizvt5-GFawgOKgN4FDM,659
|
59
|
+
tests/conftest.py,sha256=F7teEGvH3mD1zO5tqd_yEWneFrmW5U8d74-IDDSAXoI,10531
|
60
|
+
tests/fixtures/643594.clinical.SV.vcf,sha256=e-RVC96kxwrohNmiZ7xHAHcTcnWI5-NSpOVMX2zGsXA,59626
|
61
|
+
tests/fixtures/643594.clinical.vcf.gz,sha256=CuGqNRVLnkPDy8JM9i8JhYQZn28CDM1eGenECi2dD4E,413153
|
62
|
+
tests/fixtures/double_variant.vcf,sha256=LlVy4mW1-HAw0dyJpWPJTbAGQm5LZOtOuD2uLkbJE7w,2165
|
63
|
+
tests/fixtures/funny_trio.ped,sha256=t4Mroxg51i5zhLPnbbWSXaC2aKgETMvNcfQc-ArjFpk,130
|
64
|
+
tests/fixtures/profile_snv.vcf,sha256=SdQA2CCzCLCrwYEEod2yuZsVt6--8dHppUVyaIKxan0,5420
|
65
|
+
tests/fixtures/recessive_trio.ped,sha256=leXtMPWrwXeDQY557R_sL5QLcewu1uwHFsn8moOjMCY,148
|
66
|
+
tests/fixtures/test.SV.vcf,sha256=OqNrkQQpgbXs2L1en7S6C8A0KFCKDn4w1czRRAU-lEY,59618
|
67
|
+
tests/fixtures/test.vcf,sha256=AGTIHfmy_c2R0CUSwia7HjvyEYUWLi-uZVam38k9hg8,2393
|
68
|
+
tests/fixtures/test.vcf.gz,sha256=3XRv5PmJro-Dm8duXrByuAqrBSfsM9dnQjZuRE4Rru8,652
|
69
|
+
tests/fixtures/test.vcf.gz.tbi,sha256=ew7qzOaJQlmMyI8Oq-kmnba4mFnCtD2INpN4RXhKgVQ,267
|
70
|
+
tests/fixtures/unsorted.vcf,sha256=NSsdgsVVJuJwd3udD__GBrZaregz4qa_egDg4OzBLF4,2049
|
71
|
+
tests/functional/test_cli.py,sha256=XO7toMozpFU3MrqxSqsqKjUgeLSbeEmNtLSmGePWuXg,8095
|
72
|
+
tests/plugins/mongo/test_case_operations.py,sha256=SJ9KHiDV7iHRtxu-4C9mp9uSKQ5wen3hoqK0W7JULGA,4271
|
73
|
+
tests/plugins/mongo/test_connect.py,sha256=RsyDY5T9BkkgZANyOrMZ3-nXRZX8sjvBH7E1BD5noYU,199
|
74
|
+
tests/plugins/mongo/test_flask_extension.py,sha256=UtvMJbRqVcVn82b9sGL-IQCK5GBW2KdnhckLuB9Dqkk,738
|
75
|
+
tests/plugins/mongo/test_get_sv.py,sha256=9LBnCv7zLjKuioNMhSBMo0zJ3Md3wpEUa395Gz_18ms,1029
|
76
|
+
tests/plugins/mongo/test_load_svs.py,sha256=zkDiowbG2p6uiUC5nzajDp_QDky5lyKAnyr_sir8Pic,2670
|
77
|
+
tests/plugins/mongo/test_variant_operations.py,sha256=Th42H-rHuN8oa-e8Sug29-_8tJtezevjmD4rM3543kM,9687
|
78
|
+
tests/utils/test_case.py,sha256=DTbdiTn5myeE1K91wXtJwiDeLfmYOU8uqooSAq_B56o,1317
|
79
|
+
tests/utils/test_delete.py,sha256=Gzatf_WpqdtRhkELEt2WgVuKF-UwiPUuycS7cjtKcgg,1872
|
80
|
+
tests/utils/test_delete_family.py,sha256=ym0ffeCf8IvNy9-AUL2ix1BWBapxZo4P4ZuLtQfQNtQ,845
|
81
|
+
tests/utils/test_delete_variant.py,sha256=bRNFmV9OvQJ-Ao6eq2yKIhjz3-FOH75OCqclKTu9c8A,2171
|
82
|
+
tests/utils/test_get_family.py,sha256=WLIqNHCfmHbZoL-TMLf6wFGxf_vBeEBE9ndWOE2iHTQ,329
|
83
|
+
tests/utils/test_load_database.py,sha256=gZOLSTrRYsTq8q3in0gazmZJxZVreoFN1_o9EzXD_1s,1473
|
84
|
+
tests/utils/test_load_family.py,sha256=DWDqC9UCMVMwVKoYToL_KGc0kpsn9DVFFZovD3zOCMc,2376
|
85
|
+
tests/utils/test_load_variants.py,sha256=CAo8oDw9mz8oTszscIS38yl7jKUPVapJIH_Y4MUBZHs,6278
|
86
|
+
tests/utils/test_migrate.py,sha256=DM4RC_sY6C3aCbE0-Rzg5Yi5pp0BgKNefP1OCaviPSw,1177
|
87
|
+
tests/utils/test_profiling.py,sha256=tehPKrE0tNbaz26On8lp4MeDTMwTpw_iyQdW1cW5iMo,2658
|
88
|
+
tests/vcf_tools/test_check_par.py,sha256=zmG3HKWy6omyofqK4WjzmcbkVEvkncUm26GeMtnxHiI,1155
|
89
|
+
tests/vcf_tools/test_check_vcf.py,sha256=bTZQOSbhXthRDwTmcfvf4sW-DMUdlpM7bBSDsmXSDrU,1966
|
90
|
+
tests/vcf_tools/test_format_sv_variant.py,sha256=eeQ6XI6X2lNpsVaWecu5lfdRHrDh1XZvcz9UhL7j3qo,4375
|
91
|
+
tests/vcf_tools/test_format_variant.py,sha256=CfgCnrS5OvuIcUOCTUGCiDRUelk3fZgT7YQAytNPvvM,4176
|
92
|
+
tests/vcf_tools/test_vcf.py,sha256=Fc9tO1IgKFo_DCfj_GrsXGx9t_69xkWhn1ZCL7IXqLU,1563
|
93
|
+
loqusdb-2.7.9.dist-info/LICENSE,sha256=urpFcJXw3elN9kV2fFutc-lXegjuu2lqP_GSy8_CAbs,1054
|
94
|
+
loqusdb-2.7.9.dist-info/METADATA,sha256=MgxOiQRfJGXtgPKUeJuYLBKRJP6KMY0T9nMpZ4oM6a4,5269
|
95
|
+
loqusdb-2.7.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
96
|
+
loqusdb-2.7.9.dist-info/entry_points.txt,sha256=wFoWzEFjsSgXkj9FMQA8C9ihZoJ9R1XvbGuX9hEEI6E,52
|
97
|
+
loqusdb-2.7.9.dist-info/RECORD,,
|
@@ -0,0 +1,150 @@
|
|
1
|
+
import pytest
|
2
|
+
|
3
|
+
from loqusdb.build_models.case import build_case, get_individual_positions
|
4
|
+
from loqusdb.exceptions import CaseError
|
5
|
+
|
6
|
+
|
7
|
+
def test_get_individual_positions():
|
8
|
+
## GIVEN a list with ids
|
9
|
+
inds = ["1", "2", "3"]
|
10
|
+
## WHEN getting the individual positions
|
11
|
+
ind_pos = get_individual_positions(inds)
|
12
|
+
## THEN assert they where given the correct position
|
13
|
+
assert ind_pos["1"] == 0
|
14
|
+
assert ind_pos["2"] == 1
|
15
|
+
assert ind_pos["3"] == 2
|
16
|
+
|
17
|
+
|
18
|
+
def test_get_individual_positions_no_inds():
|
19
|
+
## GIVEN a list with ids
|
20
|
+
inds = None
|
21
|
+
## WHEN getting the individual positions
|
22
|
+
ind_pos = get_individual_positions(inds)
|
23
|
+
## THEN assert an empty dict is returned
|
24
|
+
assert ind_pos == {}
|
25
|
+
|
26
|
+
|
27
|
+
def test_build_case_no_ped():
|
28
|
+
## GIVEN some vcf individuals
|
29
|
+
|
30
|
+
vcf_individuals = ["mother", "proband"]
|
31
|
+
case_id = "test"
|
32
|
+
|
33
|
+
## WHEN building a case object
|
34
|
+
case_obj = build_case(
|
35
|
+
case=None,
|
36
|
+
vcf_individuals=vcf_individuals,
|
37
|
+
case_id=case_id,
|
38
|
+
)
|
39
|
+
|
40
|
+
## THEN assert that the case got the right ID
|
41
|
+
assert case_obj["case_id"] == case_id
|
42
|
+
for ind_obj in case_obj["individuals"]:
|
43
|
+
assert ind_obj["name"] in vcf_individuals
|
44
|
+
assert ind_obj["ind_id"] in vcf_individuals
|
45
|
+
|
46
|
+
|
47
|
+
def test_build_case_no_ped_no_case_id():
|
48
|
+
## WHEN building a case object
|
49
|
+
|
50
|
+
## THEN assert a CaseError is raised
|
51
|
+
with pytest.raises(CaseError):
|
52
|
+
## GIVEN some vcf individuals
|
53
|
+
|
54
|
+
vcf_individuals = ["mother", "proband"]
|
55
|
+
|
56
|
+
case_obj = build_case(
|
57
|
+
case=None,
|
58
|
+
vcf_individuals=vcf_individuals,
|
59
|
+
)
|
60
|
+
|
61
|
+
|
62
|
+
def test_build_case_ped(family_obj, vcf_path):
|
63
|
+
## GIVEN a ped parser family_obj
|
64
|
+
vcf_inds = [ind_id for ind_id in family_obj.individuals]
|
65
|
+
nr_variants = 10
|
66
|
+
|
67
|
+
## WHEN building a case object
|
68
|
+
case_obj = build_case(
|
69
|
+
case=family_obj,
|
70
|
+
vcf_individuals=vcf_inds,
|
71
|
+
vcf_path=vcf_path,
|
72
|
+
nr_variants=nr_variants,
|
73
|
+
)
|
74
|
+
|
75
|
+
## THEN assert that the case has the correct id
|
76
|
+
assert case_obj["case_id"] == family_obj.family_id
|
77
|
+
|
78
|
+
for ind_obj in case_obj["individuals"]:
|
79
|
+
assert ind_obj["ind_id"] in vcf_inds
|
80
|
+
|
81
|
+
## THEN assert that the vcf_path was added
|
82
|
+
assert case_obj["vcf_path"] == vcf_path
|
83
|
+
|
84
|
+
## THEN assert that the nr variants is correct
|
85
|
+
assert case_obj["nr_variants"] == nr_variants
|
86
|
+
|
87
|
+
|
88
|
+
def test_build_case_ped_sv(family_obj, sv_vcf_path):
|
89
|
+
## GIVEN a ped parser family_obj
|
90
|
+
vcf_inds = [ind_id for ind_id in family_obj.individuals]
|
91
|
+
nr_sv_variants = 10
|
92
|
+
|
93
|
+
## WHEN building a case object
|
94
|
+
case_obj = build_case(
|
95
|
+
case=family_obj,
|
96
|
+
sv_individuals=vcf_inds,
|
97
|
+
vcf_sv_path=sv_vcf_path,
|
98
|
+
nr_sv_variants=nr_sv_variants,
|
99
|
+
)
|
100
|
+
|
101
|
+
## THEN assert that the case has the correct id
|
102
|
+
assert case_obj["case_id"] == family_obj.family_id
|
103
|
+
|
104
|
+
case_obj["individuals"] == []
|
105
|
+
for ind_obj in case_obj["sv_individuals"]:
|
106
|
+
assert ind_obj["ind_id"] in vcf_inds
|
107
|
+
|
108
|
+
## THEN assert that the vcf_path was added
|
109
|
+
assert case_obj["vcf_path"] is None
|
110
|
+
assert case_obj["vcf_sv_path"] == sv_vcf_path
|
111
|
+
|
112
|
+
## THEN assert that the nr variants is correct
|
113
|
+
assert case_obj["nr_variants"] is None
|
114
|
+
assert case_obj["nr_sv_variants"] == nr_sv_variants
|
115
|
+
|
116
|
+
|
117
|
+
def test_build_case_ped_sv_and_snv(family_obj, sv_vcf_path, vcf_path):
|
118
|
+
## GIVEN a ped parser family_obj
|
119
|
+
vcf_inds = [ind_id for ind_id in family_obj.individuals]
|
120
|
+
sv_vcf_inds = [ind_id for ind_id in family_obj.individuals]
|
121
|
+
nr_sv_variants = 10
|
122
|
+
nr_variants = 20
|
123
|
+
|
124
|
+
## WHEN building a case object
|
125
|
+
case_obj = build_case(
|
126
|
+
case=family_obj,
|
127
|
+
sv_individuals=vcf_inds,
|
128
|
+
vcf_sv_path=sv_vcf_path,
|
129
|
+
nr_sv_variants=nr_sv_variants,
|
130
|
+
vcf_individuals=vcf_inds,
|
131
|
+
vcf_path=vcf_path,
|
132
|
+
nr_variants=nr_variants,
|
133
|
+
)
|
134
|
+
|
135
|
+
## THEN assert that the case has the correct id
|
136
|
+
assert case_obj["case_id"] == family_obj.family_id
|
137
|
+
|
138
|
+
for ind_obj in case_obj["individuals"]:
|
139
|
+
assert ind_obj["ind_id"] in vcf_inds
|
140
|
+
|
141
|
+
for ind_obj in case_obj["sv_individuals"]:
|
142
|
+
assert ind_obj["ind_id"] in sv_vcf_inds
|
143
|
+
|
144
|
+
## THEN assert that the vcf_path was added
|
145
|
+
assert case_obj["vcf_path"] == vcf_path
|
146
|
+
assert case_obj["vcf_sv_path"] == sv_vcf_path
|
147
|
+
|
148
|
+
## THEN assert that the nr variants is correct
|
149
|
+
assert case_obj["nr_variants"] == nr_variants
|
150
|
+
assert case_obj["nr_sv_variants"] == nr_sv_variants
|
@@ -0,0 +1,15 @@
|
|
1
|
+
from loqusdb.build_models.variant import get_coords, build_variant
|
2
|
+
|
3
|
+
|
4
|
+
def test_build_het_variant(het_variant, case_obj):
|
5
|
+
variant_obj = build_variant(variant=het_variant, case_obj=case_obj)
|
6
|
+
assert variant_obj["chrom"] == het_variant.CHROM
|
7
|
+
assert variant_obj["homozygote"] == 0
|
8
|
+
assert variant_obj["hemizygote"] == 0
|
9
|
+
|
10
|
+
|
11
|
+
def test_get_coords_for_BND(bnd_variant):
|
12
|
+
coords = get_coords(bnd_variant)
|
13
|
+
assert coords["pos"] == coords["end"]
|
14
|
+
assert coords["sv_length"] == float("inf")
|
15
|
+
assert coords["sv_type"] == "BND"
|