loqusdb 2.7.3__tar.gz → 2.7.8__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.
Files changed (106) hide show
  1. {loqusdb-2.7.3 → loqusdb-2.7.8}/PKG-INFO +27 -29
  2. {loqusdb-2.7.3 → loqusdb-2.7.8}/README.md +11 -11
  3. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/__init__.py +5 -3
  4. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/build_models/variant.py +12 -4
  5. loqusdb-2.7.8/loqusdb/resources/loqusdb.20181005.gz +0 -0
  6. loqusdb-2.7.8/loqusdb/resources/maf_50_sites_GRCh37.vcf.gz +0 -0
  7. loqusdb-2.7.8/loqusdb/resources/maf_50_sites_GRCh38.vcf.gz +0 -0
  8. loqusdb-2.7.8/pyproject.toml +38 -0
  9. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/conftest.py +2 -2
  10. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/fixtures/profile_snv.vcf +1 -1
  11. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/vcf_tools/test_format_variant.py +14 -0
  12. loqusdb-2.7.3/CHANGELOG.md +0 -73
  13. loqusdb-2.7.3/CONTRIBUTING.md +0 -5
  14. loqusdb-2.7.3/MANIFEST.in +0 -10
  15. loqusdb-2.7.3/loqusdb.egg-info/PKG-INFO +0 -174
  16. loqusdb-2.7.3/loqusdb.egg-info/SOURCES.txt +0 -100
  17. loqusdb-2.7.3/loqusdb.egg-info/dependency_links.txt +0 -1
  18. loqusdb-2.7.3/loqusdb.egg-info/entry_points.txt +0 -3
  19. loqusdb-2.7.3/loqusdb.egg-info/requires.txt +0 -13
  20. loqusdb-2.7.3/loqusdb.egg-info/top_level.txt +0 -1
  21. loqusdb-2.7.3/setup.cfg +0 -4
  22. loqusdb-2.7.3/setup.py +0 -83
  23. {loqusdb-2.7.3 → loqusdb-2.7.8}/LICENSE +0 -0
  24. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/__main__.py +0 -0
  25. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/build_models/__init__.py +0 -0
  26. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/build_models/case.py +0 -0
  27. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/build_models/profile_variant.py +0 -0
  28. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/commands/__init__.py +0 -0
  29. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/commands/annotate.py +0 -0
  30. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/commands/cli.py +0 -0
  31. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/commands/delete.py +0 -0
  32. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/commands/export.py +0 -0
  33. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/commands/identity.py +0 -0
  34. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/commands/load.py +0 -0
  35. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/commands/load_profile.py +0 -0
  36. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/commands/migrate.py +0 -0
  37. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/commands/restore.py +0 -0
  38. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/commands/update.py +0 -0
  39. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/commands/view.py +0 -0
  40. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/commands/wipe.py +0 -0
  41. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/constants/__init__.py +0 -0
  42. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/exceptions/__init__.py +0 -0
  43. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/exceptions/case.py +0 -0
  44. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/exceptions/profile.py +0 -0
  45. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/exceptions/vcf.py +0 -0
  46. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/log.py +0 -0
  47. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/models/__init__.py +0 -0
  48. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/models/case.py +0 -0
  49. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/models/identity.py +0 -0
  50. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/models/profile_variant.py +0 -0
  51. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/models/variant.py +0 -0
  52. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/plugins/__init__.py +0 -0
  53. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/plugins/mongo/__init__.py +0 -0
  54. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/plugins/mongo/adapter.py +0 -0
  55. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/plugins/mongo/case.py +0 -0
  56. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/plugins/mongo/profile_variant.py +0 -0
  57. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/plugins/mongo/structural_variant.py +0 -0
  58. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/plugins/mongo/variant.py +0 -0
  59. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/resources/__init__.py +0 -0
  60. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/utils/__init__.py +0 -0
  61. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/utils/annotate.py +0 -0
  62. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/utils/case.py +0 -0
  63. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/utils/delete.py +0 -0
  64. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/utils/load.py +0 -0
  65. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/utils/migrate.py +0 -0
  66. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/utils/profiling.py +0 -0
  67. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/utils/update.py +0 -0
  68. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/utils/variant.py +0 -0
  69. {loqusdb-2.7.3 → loqusdb-2.7.8}/loqusdb/utils/vcf.py +0 -0
  70. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/build_models/test_build_case.py +0 -0
  71. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/build_models/test_build_variant.py +0 -0
  72. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/build_models/test_is_greater.py +0 -0
  73. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/commands/test_export.py +0 -0
  74. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/commands/test_identity.py +0 -0
  75. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/commands/test_view.py +0 -0
  76. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/fixtures/643594.clinical.SV.vcf +0 -0
  77. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/fixtures/643594.clinical.vcf.gz +0 -0
  78. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/fixtures/double_variant.vcf +0 -0
  79. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/fixtures/funny_trio.ped +0 -0
  80. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/fixtures/recessive_trio.ped +0 -0
  81. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/fixtures/test.SV.vcf +0 -0
  82. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/fixtures/test.vcf +0 -0
  83. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/fixtures/test.vcf.gz +0 -0
  84. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/fixtures/test.vcf.gz.tbi +0 -0
  85. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/fixtures/unsorted.vcf +0 -0
  86. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/functional/test_cli.py +0 -0
  87. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/plugins/mongo/test_case_operations.py +0 -0
  88. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/plugins/mongo/test_connect.py +0 -0
  89. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/plugins/mongo/test_flask_extension.py +0 -0
  90. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/plugins/mongo/test_get_sv.py +0 -0
  91. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/plugins/mongo/test_load_svs.py +0 -0
  92. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/plugins/mongo/test_variant_operations.py +0 -0
  93. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/utils/test_case.py +0 -0
  94. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/utils/test_delete.py +0 -0
  95. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/utils/test_delete_family.py +0 -0
  96. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/utils/test_delete_variant.py +0 -0
  97. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/utils/test_get_family.py +0 -0
  98. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/utils/test_load_database.py +0 -0
  99. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/utils/test_load_family.py +0 -0
  100. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/utils/test_load_variants.py +0 -0
  101. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/utils/test_migrate.py +0 -0
  102. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/utils/test_profiling.py +0 -0
  103. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/vcf_tools/test_check_par.py +0 -0
  104. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/vcf_tools/test_check_vcf.py +0 -0
  105. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/vcf_tools/test_format_sv_variant.py +0 -0
  106. {loqusdb-2.7.3 → loqusdb-2.7.8}/tests/vcf_tools/test_vcf.py +0 -0
@@ -1,50 +1,49 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: loqusdb
3
- Version: 2.7.3
4
- Summary: Store observations of vcf variants in a mongodb
5
- Home-page: https://github.com/moonso/loqusdb
6
- Author: Måns Magnusson
7
- Author-email: mans.magnusson@scilifelab.com
3
+ Version: 2.7.8
4
+ Summary: A simple observation count database
8
5
  License: MIT
9
- Keywords: vcf,variants
10
- Platform: UNKNOWN
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.6
15
- Classifier: Programming Language :: Python :: Implementation :: CPython
16
- Classifier: Operating System :: MacOS :: MacOS X
17
- Classifier: Operating System :: Unix
18
- Classifier: Intended Audience :: Science/Research
19
- Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
20
- Requires-Python: >=3.7.0
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Requires-Dist: PyYAML
13
+ Requires-Dist: click
14
+ Requires-Dist: coloredlogs
15
+ Requires-Dist: cyvcf2
16
+ Requires-Dist: mongo-adapter
17
+ Requires-Dist: numpy
18
+ Requires-Dist: ped_parser
19
+ Requires-Dist: pymongo
20
+ Requires-Dist: setuptools
21
+ Requires-Dist: vcftoolbox
21
22
  Description-Content-Type: text/markdown
22
- License-File: LICENSE
23
-
24
23
 
25
24
  # loqusdb
26
25
  [![Publish to PyPI](https://github.com/moonso/loqusdb/actions/workflows/build_and_publish.yml/badge.svg)](https://github.com/moonso/loqusdb/actions/workflows/build_and_publish.yml)
27
26
  [![Coverage Status](https://coveralls.io/repos/github/moonso/loqusdb/badge.svg?branch=master)](https://coveralls.io/github/moonso/loqusdb?branch=master)
28
27
  [![PyPI Version][pypi-img]][pypi-url]
29
28
 
30
- Small tool to setup a local variant database. If you find loqusdb useful in your work, please cite the [article][publication].
29
+ Small tool to set up a local variant database.
30
+ If you find Loqusdb useful in your work, please cite the [article][publication].
31
31
 
32
- Right now **locusdb** uses [mongodb][mongodb] as backend for
33
- 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
34
34
  database manager.
35
35
 
36
36
  ## Installation ##
37
37
 
38
- 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).
39
38
 
40
- `pip install loqusdb`
39
+ `poetry install`
41
40
 
42
41
  or
43
42
 
44
43
  ```
45
44
  $git clone https://github.com/moonso/loqusdb
46
45
  $cd loqusdb
47
- $pip install --editable .
46
+ $poetry install
48
47
  ```
49
48
 
50
49
  ## Idea ##
@@ -54,16 +53,16 @@ This is **NOT** a tool to create a true frequency database.
54
53
  It will basically count the number of times we have seen a variant in any individual.
55
54
  We will also keep track of the variants that have been seen in a homozygous or hemizygous state.
56
55
 
57
- Variants are stored by providing a vcf file and a (ped or ped like)family file.
56
+ Variants are stored by providing a VCF file and a (ped or ped like) family file.
58
57
 
59
- Loqusdb will first check if the vcf file looks ok.
58
+ Loqusdb will first check if the VCF file adheres to the VCF format.
60
59
 
61
60
  The tool will then check all variants if they have been observed in any of the individuals in the family.
62
61
 
63
62
  When the variants are added:
64
63
 
65
64
  - Either the variant exists, in this case we increase the number of observations with one
66
- - Or this variant has not ben seen before, then the variant is added to database
65
+ - Or this variant has not been seen before, then the variant is added to the database
67
66
 
68
67
 
69
68
  ## Command Line Interface ##
@@ -120,7 +119,7 @@ Commands:
120
119
 
121
120
  ### Connecting ###
122
121
 
123
- 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, looks like:
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:
124
123
 
125
124
  ```yaml
126
125
  uri: mongodb://loqusdb-username:loqusdb-pwd@localhost:27030/loqusdb-rd?authSource=admin
@@ -138,7 +137,7 @@ db_name: loqusdb_test
138
137
 
139
138
  ### Mongo ###
140
139
 
141
- The collections looks like:
140
+ The collections are defined as follows:
142
141
 
143
142
  **Case**
144
143
 
@@ -171,4 +170,3 @@ The collections looks like:
171
170
  [pypi-img]: https://img.shields.io/pypi/v/loqusdb.svg?style=flat-square
172
171
  [pypi-url]: https://pypi.python.org/pypi/loqusdb/
173
172
 
174
-
@@ -3,24 +3,24 @@
3
3
  [![Coverage Status](https://coveralls.io/repos/github/moonso/loqusdb/badge.svg?branch=master)](https://coveralls.io/github/moonso/loqusdb?branch=master)
4
4
  [![PyPI Version][pypi-img]][pypi-url]
5
5
 
6
- Small tool to setup a local variant database. If you find loqusdb useful in your work, please cite the [article][publication].
6
+ Small tool to set up a local variant database.
7
+ If you find Loqusdb useful in your work, please cite the [article][publication].
7
8
 
8
- Right now **locusdb** uses [mongodb][mongodb] as backend for
9
- storing variants but there should not be a huge difference to use another
9
+ Right now **Locusdb** uses [mongodb][mongodb] as backend for
10
+ storing variants, but there should not be a huge difference to use another
10
11
  database manager.
11
12
 
12
13
  ## Installation ##
13
14
 
14
- 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).
15
15
 
16
- `pip install loqusdb`
16
+ `poetry install`
17
17
 
18
18
  or
19
19
 
20
20
  ```
21
21
  $git clone https://github.com/moonso/loqusdb
22
22
  $cd loqusdb
23
- $pip install --editable .
23
+ $poetry install
24
24
  ```
25
25
 
26
26
  ## Idea ##
@@ -30,16 +30,16 @@ This is **NOT** a tool to create a true frequency database.
30
30
  It will basically count the number of times we have seen a variant in any individual.
31
31
  We will also keep track of the variants that have been seen in a homozygous or hemizygous state.
32
32
 
33
- Variants are stored by providing a vcf file and a (ped or ped like)family file.
33
+ Variants are stored by providing a VCF file and a (ped or ped like) family file.
34
34
 
35
- Loqusdb will first check if the vcf file looks ok.
35
+ Loqusdb will first check if the VCF file adheres to the VCF format.
36
36
 
37
37
  The tool will then check all variants if they have been observed in any of the individuals in the family.
38
38
 
39
39
  When the variants are added:
40
40
 
41
41
  - Either the variant exists, in this case we increase the number of observations with one
42
- - Or this variant has not ben seen before, then the variant is added to database
42
+ - Or this variant has not been seen before, then the variant is added to the database
43
43
 
44
44
 
45
45
  ## Command Line Interface ##
@@ -96,7 +96,7 @@ Commands:
96
96
 
97
97
  ### Connecting ###
98
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, looks like:
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
100
 
101
101
  ```yaml
102
102
  uri: mongodb://loqusdb-username:loqusdb-pwd@localhost:27030/loqusdb-rd?authSource=admin
@@ -114,7 +114,7 @@ db_name: loqusdb_test
114
114
 
115
115
  ### Mongo ###
116
116
 
117
- The collections looks like:
117
+ The collections are defined as follows:
118
118
 
119
119
  **Case**
120
120
 
@@ -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__ = get_distribution("loqusdb").version
7
+ __version__ = "2.7.7"
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": [
@@ -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 criterias are not fullfilled, eg. variant have no gt call or quality
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 = int(variant.QUAL)
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])
@@ -0,0 +1,38 @@
1
+ [tool.poetry]
2
+ name = "loqusdb"
3
+ version = "2.7.8"
4
+ description = "A simple observation count database"
5
+ authors = ["Your Name <you@example.com>"]
6
+ license = "MIT"
7
+ readme = "README.md"
8
+ include = [
9
+ "README.md",
10
+ "loqusdb/**/*",
11
+ "tests/**/*"
12
+ ]
13
+
14
+ [tool.poetry.dependencies]
15
+ python = "^3.12"
16
+ cyvcf2 = "*"
17
+ click = "*"
18
+ pymongo = "*"
19
+ numpy = "*"
20
+ coloredlogs = "*"
21
+ PyYAML = "*"
22
+ vcftoolbox = "*"
23
+ setuptools = "*"
24
+ mongo-adapter = "*"
25
+ ped_parser = "*"
26
+
27
+ [tool.poetry.group.dev.dependencies]
28
+ coveralls = "^3"
29
+ mongomock = "*"
30
+ pytest = "*"
31
+ pytest-cov = "*"
32
+
33
+ [tool.poetry.scripts]
34
+ loqusdb = "loqusdb.commands.cli:cli"
35
+
36
+ [build-system]
37
+ requires = ["poetry-core"]
38
+ build-backend = "poetry.core.masonry.api"
@@ -65,14 +65,14 @@ def real_db_name(request):
65
65
  @pytest.fixture(scope="function")
66
66
  def mongo_client(request):
67
67
  """Return a mongomock client"""
68
- client = MockClient()
68
+ client = MockClient(directConnection=True)
69
69
  return client
70
70
 
71
71
 
72
72
  @pytest.fixture(scope="function")
73
73
  def real_mongo_client(request):
74
74
  """Return a mongomock client"""
75
- client = MongoClient()
75
+ client = MongoClient(directConnection=True)
76
76
 
77
77
  def teardown():
78
78
  print("\n")
@@ -25,7 +25,7 @@
25
25
  ##contig=<ID=Y,length=59373566>
26
26
  ##contig=<ID=MT,length=16569>
27
27
  ##reference=file:///humgen/gsa-hpprojects/GATK/bundle/current/b37/human_g1k_v37.fasta
28
- #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT proband_2
28
+ #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT proband_2
29
29
  1 44072018 rs1065772 C T . . CAF=[0.7121,0.2879];COMMON=1;G5;GNO;HD;KGPROD;KGPhase1;OTHERKG;PH3;REF;RS=1065772;RSPOS=44072018;SAO=0;SLO;SSR=0;SYN;VC=SNV;VLD;VP=0x050100000301150517000100;WGT=1;dbSNPBuildID=86 GT ./.
30
30
  1 183072590 rs2296288 T C . . CAF=[0.4656,0.5344];COMMON=1;G5;G5A;GNO;HD;KGPROD;KGPhase1;KGPilot123;OTHERKG;PH3;REF;RS=2296288;RSPOS=183072590;SAO=0;SLO;SSR=0;SYN;VC=SNV;VLD;VP=0x05010000030117051f000100;WGT=1;dbSNPBuildID=100 GT ./.
31
31
  1 212619339 rs4804 T C . . CAF=[0.5069,0.4931];COMMON=1;G5;G5A;GNO;HD;KGPROD;KGPhase1;KGPilot123;OTHERKG;PH3;REF;RS=4804;RSPOS=212619339;SAO=0;SLO;SSR=0;SYN;VC=SNV;VLD;VP=0x05010000030117051f000101;WGT=1;dbSNPBuildID=52 GT ./.
@@ -21,6 +21,20 @@ def test_format_variant(het_variant, case_obj):
21
21
  assert formated_variant["homozygote"] == 0
22
22
 
23
23
 
24
+ def test_format_variant_no_qual(variant_no_gq, case_obj):
25
+ ## GIVEN a variant without GQ
26
+ variant = variant_no_gq
27
+ ## And that has a missing QUAL value
28
+ variant.QUAL = None
29
+ case_id = case_obj["case_id"]
30
+ ## WHEN parsing the variant using a QUAL threshold
31
+ formated_variant = build_variant(
32
+ variant=variant, case_obj=case_obj, case_id=case_id, gq_qual=True, gq_threshold=20
33
+ )
34
+ ## THEN assert that None is returned since requirements are not fulfilled
35
+ assert formated_variant is None
36
+
37
+
24
38
  def test_format_variant_no_gq(variant_no_gq, case_obj):
25
39
  ## GIVEN a variant without GQ
26
40
  variant = variant_no_gq
@@ -1,73 +0,0 @@
1
- # Change Log
2
- All notable changes to this project will be documented in this file.
3
- This project adheres to [Semantic Versioning](http://semver.org/).
4
-
5
- About changelog [here](https://keepachangelog.com/en/1.0.0/)
6
-
7
- ## [2.8]
8
- ### Added
9
- - Basic cli tests touching fixed deprecated code
10
- ### Changed
11
- - Unfreezed PyMongo in requirements.txt
12
- - Replaced deprecated pymongo `.count()` function with `count_documents()` in code.
13
-
14
- ## [2.7.2]
15
- ### Fixed
16
- - `Deprecated config in setup.cfg` error when installing the package
17
-
18
- ## [2.7.1]
19
- ### Added
20
- - Script to correct contig name
21
- - Expanded instructions on how to set up an instance and load data into database
22
- ### Changed
23
- - GitHub actions run tests using MongoDB versions 3.2, 4.4 and 5.0
24
- ### Fixed
25
- - Restore command accepts custom database name
26
- - Restore command uses either database URI or host:port params
27
-
28
- ## [2.5.2]
29
-
30
- ### Changed
31
- - Convert version to string
32
- - Use Github Actions for running CI instead of Travis
33
-
34
- ## [2.5.1]
35
-
36
- ### Added
37
- - Option to add observation frequencies to exported VCF (--freq)
38
-
39
- ## [2.5]
40
-
41
- ### Added
42
- - Profiling feature added. Each sample gets a profile based on the genotypes for
43
- a set of high maf variants.
44
- - High maf variants used in profiling is loaded into DB via CLI
45
- - Reject loading a case if a similar profile already exists for any of the samples
46
- - Statistics of the profiles in DB can be generated through CLI
47
- - use bulk operations when deleting variants
48
- - Compatible with GRCh38
49
- - Option to include case count when querying for a variant
50
-
51
- ### Fixed
52
- - Use correct fields in index
53
-
54
- ## [2.3]
55
-
56
- ### Added
57
- - Use bulk updates when inserting snvs
58
-
59
- ## [2.2]
60
-
61
- ### Added
62
- - CLI function to annotate variants
63
- - CLI functionality to dump and restore a database
64
-
65
- ## [2.1]
66
-
67
- ### Fixed
68
- - Fix bug with inserting variants
69
-
70
- ### [2.0]
71
-
72
- ### Added
73
- - Adds structural variants to loqus
@@ -1,5 +0,0 @@
1
- ## Versioning
2
- LoqusDB adheres to [semantic versioning](https://semver.org/).
3
-
4
- ## Branching model
5
- LoqusDB follows a githubflow [branching model](https://guides.github.com/introduction/flow/).
loqusdb-2.7.3/MANIFEST.in DELETED
@@ -1,10 +0,0 @@
1
- include AUTHORS
2
- include CONTRIBUTING.md
3
- include CHANGELOG.md
4
- include LICENSE
5
- include README.md
6
-
7
- recursive-include tests *
8
- recursive-exclude * __pycache__
9
- recursive-exclude * *.py[co]
10
- recursive-exclude * *.db
@@ -1,174 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: loqusdb
3
- Version: 2.7.3
4
- Summary: Store observations of vcf variants in a mongodb
5
- Home-page: https://github.com/moonso/loqusdb
6
- Author: Måns Magnusson
7
- Author-email: mans.magnusson@scilifelab.com
8
- License: MIT
9
- Keywords: vcf,variants
10
- Platform: UNKNOWN
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Programming Language :: Python
13
- Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.6
15
- Classifier: Programming Language :: Python :: Implementation :: CPython
16
- Classifier: Operating System :: MacOS :: MacOS X
17
- Classifier: Operating System :: Unix
18
- Classifier: Intended Audience :: Science/Research
19
- Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
20
- Requires-Python: >=3.7.0
21
- Description-Content-Type: text/markdown
22
- License-File: LICENSE
23
-
24
-
25
- # loqusdb
26
- [![Publish to PyPI](https://github.com/moonso/loqusdb/actions/workflows/build_and_publish.yml/badge.svg)](https://github.com/moonso/loqusdb/actions/workflows/build_and_publish.yml)
27
- [![Coverage Status](https://coveralls.io/repos/github/moonso/loqusdb/badge.svg?branch=master)](https://coveralls.io/github/moonso/loqusdb?branch=master)
28
- [![PyPI Version][pypi-img]][pypi-url]
29
-
30
- Small tool to setup a local variant database. If you find loqusdb useful in your work, please cite the [article][publication].
31
-
32
- Right now **locusdb** uses [mongodb][mongodb] as backend for
33
- storing variants but there should not be a huge difference to use another
34
- database manager.
35
-
36
- ## Installation ##
37
-
38
- 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).
39
-
40
- `pip install loqusdb`
41
-
42
- or
43
-
44
- ```
45
- $git clone https://github.com/moonso/loqusdb
46
- $cd loqusdb
47
- $pip install --editable .
48
- ```
49
-
50
- ## Idea ##
51
-
52
- Tool to keep track of what variants that have been seen and in what families they have been observed.
53
- This is **NOT** a tool to create a true frequency database.
54
- It will basically count the number of times we have seen a variant in any individual.
55
- We will also keep track of the variants that have been seen in a homozygous or hemizygous state.
56
-
57
- Variants are stored by providing a vcf file and a (ped or ped like)family file.
58
-
59
- Loqusdb will first check if the vcf file looks ok.
60
-
61
- The tool will then check all variants if they have been observed in any of the individuals in the family.
62
-
63
- When the variants are added:
64
-
65
- - Either the variant exists, in this case we increase the number of observations with one
66
- - Or this variant has not ben seen before, then the variant is added to database
67
-
68
-
69
- ## Command Line Interface ##
70
-
71
- ```
72
- $ loqusdb
73
- Usage: loqusdb [OPTIONS] COMMAND [ARGS]...
74
-
75
- loqusdb: manage a local variant count database.
76
-
77
- Options:
78
- -db, --database TEXT Defaults to 'loqusdb' if not specified
79
- -u, --username TEXT
80
- -p, --password TEXT
81
- -a, --authdb TEXT If authentication should be done against
82
- another database than --database
83
-
84
- -port, --port INTEGER Specify the port where to look for the mongo
85
- database. [default: 27017]
86
-
87
- -h, --host TEXT Specify the host where to look for the mongo
88
- database. [default: localhost]
89
-
90
- --uri TEXT Specify a mongodb uri
91
- -c, --config FILENAME Use a config with db information
92
- -t, --test Used for testing. This will use a mongomock
93
- database.
94
-
95
- -g, --genome-build [GRCh37|GRCh38]
96
- Specify what genome build to use
97
- -v, --verbose
98
- --version Show the version and exit.
99
- --help Show this message and exit.
100
-
101
- Commands:
102
- annotate Annotate a VCF with observations
103
- cases Display cases in database
104
- delete Delete the variants of a family
105
- dump Dump the database
106
- export Export variants to VCF format
107
- identity Search identity collection
108
- index Add indexes to database
109
- load Load the variants of a family
110
- migrate Migrate an old loqusdb instance
111
- profile Loads variants to be used in profiling
112
- restore Restore database from dump
113
- update Update an existing case with a new type of variants
114
- variants Display variants in database
115
- wipe Wipe a loqusdb instance
116
- ```
117
-
118
-
119
- ## Database ##
120
-
121
- ### Connecting ###
122
-
123
- 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, looks like:
124
-
125
- ```yaml
126
- uri: mongodb://loqusdb-username:loqusdb-pwd@localhost:27030/loqusdb-rd?authSource=admin
127
- db_name: loqusdb_test
128
- ```
129
- or
130
- ```yaml
131
- host: localhost
132
- port: 27030
133
- username: loqusdb-username
134
- password: loqusdb-pwd
135
- authdb: admin
136
- db_name: loqusdb_test
137
- ```
138
-
139
- ### Mongo ###
140
-
141
- The collections looks like:
142
-
143
- **Case**
144
-
145
- ```python
146
- {
147
- 'case_id': 'case_id',
148
- 'vcf_path': 'path_to_vcf'
149
- }
150
- ```
151
-
152
- **Variant**
153
-
154
- ```python
155
- {
156
- '_id': 'variant_id',
157
- 'chrom': 'CHROM',
158
- 'start': postition,
159
- 'end': end postition,
160
- 'ref': reference base(s),
161
- 'alt': alternative base(s),
162
- 'homozygote': number_of_homozygotes,
163
- 'hemizygote': number_of_hemizygotes,
164
- 'observations': number_of_observations,
165
- 'families': ['family_id', ...]
166
- }
167
- ```
168
-
169
- [mongodb]: https://www.mongodb.org
170
- [publication]: https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-020-03609-z
171
- [pypi-img]: https://img.shields.io/pypi/v/loqusdb.svg?style=flat-square
172
- [pypi-url]: https://pypi.python.org/pypi/loqusdb/
173
-
174
-
@@ -1,100 +0,0 @@
1
- CHANGELOG.md
2
- CONTRIBUTING.md
3
- LICENSE
4
- MANIFEST.in
5
- README.md
6
- setup.py
7
- loqusdb/__init__.py
8
- loqusdb/__main__.py
9
- loqusdb/log.py
10
- loqusdb.egg-info/PKG-INFO
11
- loqusdb.egg-info/SOURCES.txt
12
- loqusdb.egg-info/dependency_links.txt
13
- loqusdb.egg-info/entry_points.txt
14
- loqusdb.egg-info/requires.txt
15
- loqusdb.egg-info/top_level.txt
16
- loqusdb/build_models/__init__.py
17
- loqusdb/build_models/case.py
18
- loqusdb/build_models/profile_variant.py
19
- loqusdb/build_models/variant.py
20
- loqusdb/commands/__init__.py
21
- loqusdb/commands/annotate.py
22
- loqusdb/commands/cli.py
23
- loqusdb/commands/delete.py
24
- loqusdb/commands/export.py
25
- loqusdb/commands/identity.py
26
- loqusdb/commands/load.py
27
- loqusdb/commands/load_profile.py
28
- loqusdb/commands/migrate.py
29
- loqusdb/commands/restore.py
30
- loqusdb/commands/update.py
31
- loqusdb/commands/view.py
32
- loqusdb/commands/wipe.py
33
- loqusdb/constants/__init__.py
34
- loqusdb/exceptions/__init__.py
35
- loqusdb/exceptions/case.py
36
- loqusdb/exceptions/profile.py
37
- loqusdb/exceptions/vcf.py
38
- loqusdb/models/__init__.py
39
- loqusdb/models/case.py
40
- loqusdb/models/identity.py
41
- loqusdb/models/profile_variant.py
42
- loqusdb/models/variant.py
43
- loqusdb/plugins/__init__.py
44
- loqusdb/plugins/mongo/__init__.py
45
- loqusdb/plugins/mongo/adapter.py
46
- loqusdb/plugins/mongo/case.py
47
- loqusdb/plugins/mongo/profile_variant.py
48
- loqusdb/plugins/mongo/structural_variant.py
49
- loqusdb/plugins/mongo/variant.py
50
- loqusdb/resources/__init__.py
51
- loqusdb/utils/__init__.py
52
- loqusdb/utils/annotate.py
53
- loqusdb/utils/case.py
54
- loqusdb/utils/delete.py
55
- loqusdb/utils/load.py
56
- loqusdb/utils/migrate.py
57
- loqusdb/utils/profiling.py
58
- loqusdb/utils/update.py
59
- loqusdb/utils/variant.py
60
- loqusdb/utils/vcf.py
61
- tests/conftest.py
62
- tests/build_models/test_build_case.py
63
- tests/build_models/test_build_variant.py
64
- tests/build_models/test_is_greater.py
65
- tests/commands/test_export.py
66
- tests/commands/test_identity.py
67
- tests/commands/test_view.py
68
- tests/fixtures/643594.clinical.SV.vcf
69
- tests/fixtures/643594.clinical.vcf.gz
70
- tests/fixtures/double_variant.vcf
71
- tests/fixtures/funny_trio.ped
72
- tests/fixtures/profile_snv.vcf
73
- tests/fixtures/recessive_trio.ped
74
- tests/fixtures/test.SV.vcf
75
- tests/fixtures/test.vcf
76
- tests/fixtures/test.vcf.gz
77
- tests/fixtures/test.vcf.gz.tbi
78
- tests/fixtures/unsorted.vcf
79
- tests/functional/test_cli.py
80
- tests/plugins/mongo/test_case_operations.py
81
- tests/plugins/mongo/test_connect.py
82
- tests/plugins/mongo/test_flask_extension.py
83
- tests/plugins/mongo/test_get_sv.py
84
- tests/plugins/mongo/test_load_svs.py
85
- tests/plugins/mongo/test_variant_operations.py
86
- tests/utils/test_case.py
87
- tests/utils/test_delete.py
88
- tests/utils/test_delete_family.py
89
- tests/utils/test_delete_variant.py
90
- tests/utils/test_get_family.py
91
- tests/utils/test_load_database.py
92
- tests/utils/test_load_family.py
93
- tests/utils/test_load_variants.py
94
- tests/utils/test_migrate.py
95
- tests/utils/test_profiling.py
96
- tests/vcf_tools/test_check_par.py
97
- tests/vcf_tools/test_check_vcf.py
98
- tests/vcf_tools/test_format_sv_variant.py
99
- tests/vcf_tools/test_format_variant.py
100
- tests/vcf_tools/test_vcf.py
@@ -1,3 +0,0 @@
1
- [console_scripts]
2
- loqusdb = loqusdb.__main__:base_command
3
-
@@ -1,13 +0,0 @@
1
- pytest==5.4.3
2
- cyvcf2==0.30.12
3
- mongomock
4
- click==7.1.2
5
- pymongo
6
- numpy==1.21.4
7
- coloredlogs==14.0
8
- pyyaml>=5.4.1
9
- vcftoolbox==1.5
10
- pip==23.1.2
11
- setuptools==65.5.1
12
- mongo_adapter
13
- ped_parser
@@ -1 +0,0 @@
1
- loqusdb
loqusdb-2.7.3/setup.cfg DELETED
@@ -1,4 +0,0 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
loqusdb-2.7.3/setup.py DELETED
@@ -1,83 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- #!/usr/bin/env python
4
- # -*- coding: utf-8 -*-
5
-
6
- # Note: To use the 'upload' functionality of this file, you must:
7
- # $ pip install twine
8
- """Based on https://github.com/kennethreitz/setup.py"""
9
-
10
- import io
11
- import os
12
-
13
- from setuptools import find_packages, setup
14
-
15
- # Package meta-data.
16
- NAME = "loqusdb"
17
- DESCRIPTION = "Store observations of vcf variants in a mongodb"
18
- URL = "https://github.com/moonso/loqusdb"
19
- EMAIL = "mans.magnusson@scilifelab.com"
20
- AUTHOR = "Måns Magnusson"
21
- REQUIRES_PYTHON = ">=3.7.0"
22
- VERSION = "2.7.3"
23
-
24
- with open('requirements.txt') as f:
25
- install_requires = f.read().strip().split('\n')
26
-
27
- # The rest you shouldn't have to touch too much :)
28
- # ------------------------------------------------
29
- # Except, perhaps the License and Trove Classifiers!
30
- # If you do change the License, remember to change the Trove Classifier for that!
31
-
32
- here = os.path.abspath(os.path.dirname(__file__))
33
-
34
- # Import the README and use it as the long-description.
35
- # Note: this will only work if 'README.md' is present in your MANIFEST.in file!
36
- try:
37
- with io.open(os.path.join(here, "README.md"), encoding="utf-8") as f:
38
- long_description = "\n" + f.read()
39
- except FileNotFoundError:
40
- long_description = DESCRIPTION
41
-
42
- # Load the package's __version__.py module as a dictionary.
43
- about = {}
44
- if not VERSION:
45
- with open(os.path.join(here, NAME, "__version__.py")) as f:
46
- exec(f.read(), about)
47
- else:
48
- about["__version__"] = VERSION
49
-
50
-
51
- # Where the magic happens:
52
- setup(
53
- name=NAME,
54
- version=about["__version__"],
55
- description=DESCRIPTION,
56
- long_description=long_description,
57
- long_description_content_type="text/markdown",
58
- author=AUTHOR,
59
- author_email=EMAIL,
60
- python_requires=REQUIRES_PYTHON,
61
- url=URL,
62
- packages=find_packages(exclude=("tests",)),
63
- entry_points={
64
- "console_scripts": ["loqusdb = loqusdb.__main__:base_command"],
65
- },
66
- install_requires=install_requires,
67
- include_package_data=True,
68
- license="MIT",
69
- keywords=["vcf", "variants"],
70
- classifiers=[
71
- # Trove classifiers
72
- # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
73
- "License :: OSI Approved :: MIT License",
74
- "Programming Language :: Python",
75
- "Programming Language :: Python :: 3",
76
- "Programming Language :: Python :: 3.6",
77
- "Programming Language :: Python :: Implementation :: CPython",
78
- "Operating System :: MacOS :: MacOS X",
79
- "Operating System :: Unix",
80
- "Intended Audience :: Science/Research",
81
- "Topic :: Scientific/Engineering :: Bio-Informatics",
82
- ],
83
- )
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