scout-browser 4.98.0__py3-none-any.whl → 4.100.0__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.
Files changed (91) hide show
  1. scout/adapter/mongo/case.py +30 -15
  2. scout/adapter/mongo/clinvar.py +23 -31
  3. scout/adapter/mongo/event.py +14 -4
  4. scout/adapter/mongo/institute.py +42 -55
  5. scout/adapter/mongo/omics_variant.py +14 -1
  6. scout/adapter/mongo/query.py +24 -1
  7. scout/adapter/mongo/variant.py +44 -22
  8. scout/adapter/mongo/variant_loader.py +169 -186
  9. scout/build/individual.py +5 -1
  10. scout/build/variant/variant.py +8 -0
  11. scout/commands/download/ensembl.py +18 -3
  12. scout/commands/load/research.py +2 -3
  13. scout/commands/update/individual.py +3 -0
  14. scout/commands/update/panelapp.py +15 -2
  15. scout/constants/__init__.py +6 -2
  16. scout/constants/clnsig.py +2 -0
  17. scout/constants/file_types.py +12 -0
  18. scout/constants/igv_tracks.py +9 -6
  19. scout/constants/indexes.py +5 -4
  20. scout/constants/panels.py +3 -0
  21. scout/constants/query_terms.py +1 -0
  22. scout/constants/variant_tags.py +6 -6
  23. scout/demo/643594.config.yaml +1 -0
  24. scout/load/panelapp.py +11 -5
  25. scout/models/case/case.py +1 -0
  26. scout/models/case/case_loading_models.py +7 -1
  27. scout/parse/ensembl.py +8 -3
  28. scout/parse/variant/clnsig.py +38 -0
  29. scout/parse/variant/genotype.py +4 -10
  30. scout/parse/variant/models.py +5 -11
  31. scout/parse/variant/rank_score.py +5 -13
  32. scout/parse/variant/variant.py +90 -111
  33. scout/server/app.py +39 -22
  34. scout/server/blueprints/alignviewers/controllers.py +29 -10
  35. scout/server/blueprints/alignviewers/templates/alignviewers/igv_viewer.html +51 -11
  36. scout/server/blueprints/cases/controllers.py +9 -3
  37. scout/server/blueprints/cases/templates/cases/case_report.html +25 -13
  38. scout/server/blueprints/cases/templates/cases/chanjo2_form.html +1 -1
  39. scout/server/blueprints/cases/templates/cases/collapsible_actionbar.html +1 -1
  40. scout/server/blueprints/cases/templates/cases/gene_panel.html +1 -1
  41. scout/server/blueprints/cases/templates/cases/utils.html +25 -6
  42. scout/server/blueprints/clinvar/controllers.py +34 -15
  43. scout/server/blueprints/clinvar/templates/clinvar/clinvar_submissions.html +34 -12
  44. scout/server/blueprints/clinvar/templates/clinvar/multistep_add_variant.html +14 -5
  45. scout/server/blueprints/clinvar/views.py +14 -2
  46. scout/server/blueprints/diagnoses/static/diagnoses.js +8 -1
  47. scout/server/blueprints/institutes/controllers.py +10 -2
  48. scout/server/blueprints/institutes/static/variants_list_scripts.js +9 -1
  49. scout/server/blueprints/institutes/templates/overview/institute_sidebar.html +9 -1
  50. scout/server/blueprints/login/controllers.py +112 -12
  51. scout/server/blueprints/login/views.py +38 -60
  52. scout/server/blueprints/mme/__init__.py +1 -0
  53. scout/server/blueprints/mme/controllers.py +18 -0
  54. scout/server/blueprints/mme/templates/mme/mme_submissions.html +153 -0
  55. scout/server/blueprints/mme/views.py +34 -0
  56. scout/server/blueprints/panels/templates/panels/panel.html +19 -6
  57. scout/server/blueprints/phenotypes/templates/phenotypes/hpo_terms.html +8 -1
  58. scout/server/blueprints/public/templates/public/index.html +5 -1
  59. scout/server/blueprints/variant/controllers.py +19 -10
  60. scout/server/blueprints/variant/templates/variant/acmg.html +15 -2
  61. scout/server/blueprints/variant/templates/variant/cancer-variant.html +1 -1
  62. scout/server/blueprints/variant/templates/variant/components.html +38 -16
  63. scout/server/blueprints/variant/templates/variant/sv-variant.html +2 -2
  64. scout/server/blueprints/variant/templates/variant/utils.html +23 -11
  65. scout/server/blueprints/variant/templates/variant/variant.html +42 -1
  66. scout/server/blueprints/variant/views.py +12 -0
  67. scout/server/blueprints/variants/controllers.py +20 -3
  68. scout/server/blueprints/variants/forms.py +8 -3
  69. scout/server/blueprints/variants/templates/variants/components.html +34 -0
  70. scout/server/blueprints/variants/templates/variants/indicators.html +11 -13
  71. scout/server/blueprints/variants/templates/variants/mei-variants.html +8 -6
  72. scout/server/blueprints/variants/templates/variants/sv-variants.html +9 -7
  73. scout/server/blueprints/variants/templates/variants/utils.html +35 -34
  74. scout/server/blueprints/variants/templates/variants/variants.html +4 -25
  75. scout/server/config.py +8 -0
  76. scout/server/extensions/bionano_extension.py +0 -1
  77. scout/server/extensions/chanjo2_extension.py +54 -13
  78. scout/server/links.py +15 -0
  79. scout/server/static/bs_styles.css +34 -6
  80. scout/server/templates/utils.html +9 -10
  81. scout/server/utils.py +40 -5
  82. scout/utils/acmg.py +25 -26
  83. scout/utils/ensembl_biomart_clients.py +2 -1
  84. scout/utils/ensembl_rest_clients.py +25 -32
  85. scout/utils/hgvs.py +1 -1
  86. scout/utils/scout_requests.py +1 -3
  87. {scout_browser-4.98.0.dist-info → scout_browser-4.100.0.dist-info}/METADATA +10 -14
  88. {scout_browser-4.98.0.dist-info → scout_browser-4.100.0.dist-info}/RECORD +91 -87
  89. {scout_browser-4.98.0.dist-info → scout_browser-4.100.0.dist-info}/WHEEL +0 -0
  90. {scout_browser-4.98.0.dist-info → scout_browser-4.100.0.dist-info}/entry_points.txt +0 -0
  91. {scout_browser-4.98.0.dist-info → scout_browser-4.100.0.dist-info}/licenses/LICENSE +0 -0
@@ -4,9 +4,10 @@ from typing import Dict, Iterator
4
4
  import requests
5
5
 
6
6
  LOG = logging.getLogger(__name__)
7
- SCHUG_BASE = "https://schug-stage.scilifelab.se"
7
+ SCHUG_BASE = "https://schug.scilifelab.se"
8
8
 
9
9
  BUILDS: Dict[str, str] = {"37": "GRCh37", "38": "GRCh38"}
10
+ CHROM_SEPARATOR = "[success]"
10
11
 
11
12
  SCHUG_RESOURCE_URL: Dict[str, str] = {
12
13
  "genes": "/genes/ensembl_genes/?build=",
@@ -1,30 +1,27 @@
1
1
  """Code for talking to ensembl rest API"""
2
2
 
3
3
  import logging
4
+ from typing import Optional
4
5
  from urllib.parse import urlencode
5
6
 
6
7
  import requests
8
+ from flask import flash
7
9
 
8
10
  LOG = logging.getLogger(__name__)
9
11
 
10
12
  HEADERS = {"Content-type": "application/json"}
11
- RESTAPI_37 = "https://grch37.rest.ensembl.org"
12
- RESTAPI_38 = "https://rest.ensembl.org"
13
+ RESTAPI_URL = "https://rest.ensembl.org"
13
14
 
14
15
 
15
16
  class EnsemblRestApiClient:
16
17
  """A class handling requests and responses to and from the Ensembl REST APIs.
17
- Endpoints for human build 37: https://grch37.rest.ensembl.org
18
- Endpoints for human build 38: http://rest.ensembl.org/
18
+ Endpoint: http://rest.ensembl.org/
19
19
  Documentation: https://github.com/Ensembl/ensembl-rest/wiki
20
20
  doi:10.1093/bioinformatics/btu613
21
21
  """
22
22
 
23
- def __init__(self, build="37"):
24
- if build == "38":
25
- self.server = RESTAPI_38
26
- else:
27
- self.server = RESTAPI_37
23
+ def __init__(self):
24
+ self.server = RESTAPI_URL
28
25
 
29
26
  def build_url(self, endpoint, params=None):
30
27
  """Build an url to query ensembml"""
@@ -34,7 +31,7 @@ class EnsemblRestApiClient:
34
31
  return "".join([self.server, endpoint])
35
32
 
36
33
  @staticmethod
37
- def send_request(url):
34
+ def send_request(url) -> Optional[dict]:
38
35
  """Sends the actual request to the server and returns the response
39
36
 
40
37
  Accepts:
@@ -43,33 +40,29 @@ class EnsemblRestApiClient:
43
40
  Returns:
44
41
  data(dict): dictionary from json response
45
42
  """
46
- data = {}
43
+ error = None
44
+ data = None
47
45
  try:
48
46
  response = requests.get(url, headers=HEADERS)
49
- if response.status_code == 404:
50
- LOG.info("Request failed for url %s\n", url)
51
- response.raise_for_status()
52
- data = response.json()
53
- except requests.exceptions.MissingSchema as err:
54
- LOG.info("Request failed for url %s: Error: %s\n", url, err)
55
- data = err
56
- except requests.exceptions.HTTPError as err:
57
- LOG.info("Request failed for url %s: Error: %s\n", url, err)
58
- data = err
47
+ if response.status_code not in [404, 500]:
48
+
49
+ data = response.json()
50
+ else:
51
+ error = f"Ensembl request failed with code:{response.status_code} for url {url}"
52
+ except requests.exceptions.MissingSchema:
53
+ error = f"Ensembl request failed with MissingSchema error for url {url}"
54
+ except requests.exceptions.HTTPError:
55
+ error = f"Ensembl request failed with HTTPError error for url {url}"
56
+
57
+ if error:
58
+ flash(error)
59
59
  return data
60
60
 
61
- def liftover(self, build, chrom, start, end=None):
61
+ def liftover(
62
+ self, build: str, chrom: str, start: int, end: Optional[int] = None
63
+ ) -> Optional[dict]:
62
64
  """Perform variant liftover using Ensembl REST API
63
-
64
- Args:
65
- build(str): genome build: "37" or "38"
66
- chrom(str): 1-22,X,Y,MT,M
67
- start(int): start coordinate
68
- stop(int): stop coordinate or None
69
-
70
- Returns:
71
- mappings(list of dict): example:
72
- example: https://rest.ensembl.org/map/human/GRCh37/X:1000000..1000100:1/GRCh38?content-type=application/json
65
+ example: https://rest.ensembl.org/map/human/GRCh37/X:1000000..1000100:1/GRCh38?content-type=application/json
73
66
  """
74
67
 
75
68
  build = "GRCh38" if "38" in str(build) else "GRCh37"
scout/utils/hgvs.py CHANGED
@@ -6,7 +6,7 @@ LOG = logging.getLogger(__name__)
6
6
  VALIDATOR_URL = "https://rest.variantvalidator.org/VariantValidator/variantvalidator/{}/{}/select?content-type=application%2Fjson"
7
7
 
8
8
 
9
- def validate_hgvs(build, desc):
9
+ def validate_hgvs(build: str, desc: str) -> bool:
10
10
  """Validates a simple hgvs descriptor using the VariantValidator API (https://rest.variantvalidator.org/)
11
11
 
12
12
  Args:
@@ -8,7 +8,6 @@ from urllib.error import HTTPError
8
8
 
9
9
  import requests
10
10
  from defusedxml import ElementTree
11
- from flask import flash
12
11
 
13
12
  from scout.constants import HPO_URL, HPOTERMS_URL, ORPHA_URLS
14
13
 
@@ -344,7 +343,7 @@ def fetch_constraint():
344
343
  return exac_lines
345
344
 
346
345
 
347
- def fetch_refseq_version(refseq_acc):
346
+ def fetch_refseq_version(refseq_acc: str) -> str:
348
347
  """Fetch refseq version from entrez and return refseq version
349
348
 
350
349
  Args:
@@ -362,7 +361,6 @@ def fetch_refseq_version(refseq_acc):
362
361
  try:
363
362
  resp = get_request(base_url.format(refseq_acc))
364
363
  if resp is None:
365
- flash(f"Error: could not retrieve HGVS version for {refseq_acc} from Entrez eutils!")
366
364
  return version
367
365
  tree = ElementTree.fromstring(resp.content)
368
366
  version = tree.find("IdList").find("Id").text or version
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scout-browser
3
- Version: 4.98.0
3
+ Version: 4.100.0
4
4
  Summary: Clinical DNA variant visualizer and browser
5
5
  Project-URL: Repository, https://github.com/Clinical-Genomics/scout
6
6
  Project-URL: Changelog, https://github.com/Clinical-Genomics/scout/blob/main/CHANGELOG.md
@@ -124,29 +124,25 @@ Instructions on how to run a Scout image connected to your local database or a c
124
124
 
125
125
  ## Installation
126
126
 
127
- <!-- You can install the latest release of Scout using `pip`:
128
-
129
- ```bash
130
- pip install scout-browser
131
-
132
- # ... to include optional coverage tools you would use:
133
- pip install scout-browser[coverage]
134
- ```
135
-
136
- If you would like to install Scout for local development: -->
127
+ Here is a quick start. Please see e.g. the [Installation instructions](docs/install.md) for more details.
137
128
 
138
129
  ```bash
139
130
  git clone https://github.com/Clinical-Genomics/scout
140
131
  cd scout
141
- pip install --editable .
142
132
  ```
143
133
 
144
- Scout is configured to use `uv` if you like; either run, install, install as a tool or
145
- ```
134
+ Scout is configured to use `uv`; either run, install, or install as a tool.
135
+
136
+ ```bash
146
137
  uv sync --frozen
147
138
  uv run scout
148
139
  ```
149
140
 
141
+ You can also install using pip:
142
+
143
+ ```
144
+ pip install --editable .
145
+ ```
150
146
 
151
147
  Scout PDF reports are created using [Flask-WeasyPrint](https://pythonhosted.org/Flask-WeasyPrint/). This library requires external dependencies which need be installed separately (namely Cairo and Pango). See platform-specific instructions for Linux, macOS and Windows available on the WeasyPrint installation [pages](https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#installation).
152
148