loqusdb 2.7.20__py3-none-any.whl → 2.7.21__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
loqusdb/__init__.py CHANGED
@@ -4,7 +4,7 @@ from pymongo import ASCENDING, IndexModel
4
4
 
5
5
  logger = logging.getLogger(__name__)
6
6
 
7
- __version__ = "2.7.20"
7
+ __version__ = "2.7.21"
8
8
 
9
9
  INDEXES = {
10
10
  "variant": [
loqusdb/commands/view.py CHANGED
@@ -117,16 +117,40 @@ def variants(
117
117
  sv_cases = True
118
118
  nr_cases = adapter.nr_cases(snv_cases=snv_cases, sv_cases=sv_cases)
119
119
 
120
+ if chromosome:
121
+ if chromosome.startswith("chr"):
122
+ chromosomes = [chromosome, chromosome[3:]]
123
+ elif not chromosome.startswith("chr"):
124
+ chromosomes = [chromosome, "chr" + chromosome]
125
+
126
+ if end_chromosome:
127
+ if end_chromosome.startswith("chr"):
128
+ end_chromosomes = [end_chromosome, end_chromosome[3:]]
129
+ elif not end_chromosome.startswith("chr"):
130
+ end_chromosomes = [end_chromosome, "chr" + end_chromosome]
131
+ else:
132
+ end_chromosomes = [None, None]
133
+
120
134
  if variant_id:
121
135
  if variant_type == "sv":
122
136
  variant_query = {
123
- "chrom": chromosome,
124
- "end_chrom": end_chromosome or chromosome,
137
+ "chrom": chromosomes[0],
138
+ "end_chrom": end_chromosomes[0] or chromosomes[0],
125
139
  "sv_type": sv_type,
126
140
  "pos": start,
127
141
  "end": end,
128
142
  }
129
- variant = adapter.get_structural_variant(variant_query)
143
+ variant = list(adapter.get_structural_variant(variant_query))
144
+ if len(variant) == 0:
145
+ variant_query = {
146
+ "chrom": chromosomes[1],
147
+ "end_chrom": end_chromosomes[1] or chromosomes[1],
148
+ "sv_type": sv_type,
149
+ "pos": start,
150
+ "end": end,
151
+ }
152
+ variant = adapter.get_structural_variant(variant_query)
153
+
130
154
  else:
131
155
  variant = adapter.get_variant({"_id": variant_id})
132
156
 
@@ -145,18 +169,29 @@ def variants(
145
169
 
146
170
  click.echo(variant)
147
171
  return
148
-
149
172
  if variant_type == "snv":
150
- result = adapter.get_variants(chromosome=chromosome, start=start, end=end)
173
+ result = list(adapter.get_variants(chromosome=chromosomes[0], start=start, end=end))
174
+ if len(result) == 0:
175
+ result = adapter.get_variants(chromosome=chromosomes[1], start=start, end=end)
151
176
  else:
152
177
  LOG.info("Search for svs")
153
- result = adapter.get_sv_variants(
154
- chromosome=chromosome,
155
- end_chromosome=end_chromosome,
156
- sv_type=sv_type,
157
- pos=start,
158
- end=end,
178
+ result = list(
179
+ adapter.get_sv_variants(
180
+ chromosome=chromosomes[0],
181
+ end_chromosome=end_chromosomes[0],
182
+ sv_type=sv_type,
183
+ pos=start,
184
+ end=end,
185
+ )
159
186
  )
187
+ if len(result) == 0:
188
+ result = adapter.get_sv_variants(
189
+ chromosome=chromosomes[1],
190
+ end_chromosome=end_chromosomes[1],
191
+ sv_type=sv_type,
192
+ pos=start,
193
+ end=end,
194
+ )
160
195
 
161
196
  if to_json:
162
197
  json.dumps(variant)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: loqusdb
3
- Version: 2.7.20
3
+ Version: 2.7.21
4
4
  Summary: A simple observation count database
5
5
  License: MIT
6
6
  Author: Your Name
@@ -1,4 +1,4 @@
1
- loqusdb/__init__.py,sha256=HCx0k7_ndzjGnRnnEFruQxC4eQlKosO4gSJ2TP86I1g,1415
1
+ loqusdb/__init__.py,sha256=XVjdPPoBf9nwKTdk1RIKAPlBUf5K9iI1qNNMjggiOXU,1415
2
2
  loqusdb/__main__.py,sha256=8FGKySAGaWSzAYMj6HRsxeyiME3V01Idt7HrmN7pSYY,397
3
3
  loqusdb/build_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  loqusdb/build_models/case.py,sha256=AByutEYK2N3kS9JFvyZfPKNZdCpZHCSD0nNHAgaU1Cs,4127
@@ -15,7 +15,7 @@ loqusdb/commands/load_profile.py,sha256=x-T2bzi2SL5kwZhY_3hHQCtGDLao1xkxj1pZaOnz
15
15
  loqusdb/commands/migrate.py,sha256=2C8YL-zVqnpnqg3JIyUr0rbVnb8-AGPVWNhicHnPKLo,667
16
16
  loqusdb/commands/restore.py,sha256=eqPX0yao0IAYS5SbjCdlsfSJRBbRByBLISUU2hTzqqs,1492
17
17
  loqusdb/commands/update.py,sha256=zz3wueaJVqJ1FKact-rpY2az__5oa1LnZKf7mgqNGPk,3211
18
- loqusdb/commands/view.py,sha256=PkwyvzQgq5ArrEakI-lKQThrhjBLLl2gYejHI2g13WU,5197
18
+ loqusdb/commands/view.py,sha256=JOpgRnlkWRToD9Y5DfPWJ9x1HvIPFHXpi_dZWt29co4,6582
19
19
  loqusdb/commands/wipe.py,sha256=WTOjyNooCUhtmZ6pdcPFa0PZrFc9E_pkLbnat_zP96M,553
20
20
  loqusdb/constants/__init__.py,sha256=BpZQYpUF-B9AqoXE2R5XMFuURxH5iNLt1kUJSKMqZGY,2265
21
21
  loqusdb/exceptions/__init__.py,sha256=Fq0UQg9TepWh19D7WT3dARyAHvorwJF6phhnZi2AkxE,88
@@ -49,8 +49,8 @@ loqusdb/utils/profiling.py,sha256=uISq4xfRNPPedoYXS_D4dXphq8odDogfMBm_XfHBTpE,92
49
49
  loqusdb/utils/update.py,sha256=1edJG-u24FgOSxyXAQEiyTG4IyK-Uo3lSIl5qyzcXsI,4433
50
50
  loqusdb/utils/variant.py,sha256=U6nMZRUf5NDDQ74nG0HBCLMnFQVgFAT6eHll_F2uiwc,2087
51
51
  loqusdb/utils/vcf.py,sha256=og8JBYock31v_0CnsoRhuKIJCurLCIFW8PCCQIRWF-Q,5207
52
- loqusdb-2.7.20.dist-info/LICENSE,sha256=urpFcJXw3elN9kV2fFutc-lXegjuu2lqP_GSy8_CAbs,1054
53
- loqusdb-2.7.20.dist-info/METADATA,sha256=efArcCfHQNeSsFf5C2EPYII5cYFYTf80nmIIpLLFanM,5321
54
- loqusdb-2.7.20.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
55
- loqusdb-2.7.20.dist-info/entry_points.txt,sha256=wFoWzEFjsSgXkj9FMQA8C9ihZoJ9R1XvbGuX9hEEI6E,52
56
- loqusdb-2.7.20.dist-info/RECORD,,
52
+ loqusdb-2.7.21.dist-info/LICENSE,sha256=urpFcJXw3elN9kV2fFutc-lXegjuu2lqP_GSy8_CAbs,1054
53
+ loqusdb-2.7.21.dist-info/METADATA,sha256=O3-3dPE2wqMdn26vDR9HImJ92dG8sOS2kLhmMKpqBOs,5321
54
+ loqusdb-2.7.21.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
55
+ loqusdb-2.7.21.dist-info/entry_points.txt,sha256=wFoWzEFjsSgXkj9FMQA8C9ihZoJ9R1XvbGuX9hEEI6E,52
56
+ loqusdb-2.7.21.dist-info/RECORD,,