scout-browser 4.96.0__py3-none-any.whl → 4.98.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 (86) hide show
  1. scout/adapter/mongo/case.py +51 -47
  2. scout/adapter/mongo/filter.py +28 -11
  3. scout/adapter/mongo/institute.py +2 -0
  4. scout/adapter/mongo/omics_variant.py +20 -5
  5. scout/adapter/mongo/query.py +104 -95
  6. scout/adapter/mongo/variant.py +0 -5
  7. scout/adapter/mongo/variant_loader.py +10 -12
  8. scout/build/individual.py +3 -11
  9. scout/commands/delete/delete_command.py +87 -49
  10. scout/commands/load/research.py +4 -4
  11. scout/commands/load/variants.py +25 -8
  12. scout/commands/setup/setup_scout.py +1 -1
  13. scout/commands/update/case.py +12 -0
  14. scout/commands/update/individual.py +1 -2
  15. scout/constants/__init__.py +7 -2
  16. scout/constants/file_types.py +68 -119
  17. scout/constants/filters.py +2 -1
  18. scout/constants/gene_tags.py +3 -3
  19. scout/constants/igv_tracks.py +7 -11
  20. scout/constants/query_terms.py +2 -2
  21. scout/demo/643594.config.yaml +6 -0
  22. scout/demo/643594.peddy.ped +1 -1
  23. scout/demo/643594.somalier.ancestry.tsv +4 -0
  24. scout/demo/643594.somalier.pairs.tsv +4 -0
  25. scout/demo/643594.somalier.samples.tsv +4 -0
  26. scout/demo/cancer.load_config.yaml +1 -0
  27. scout/demo/resources/__init__.py +1 -1
  28. scout/demo/resources/gnomad.v4.1.constraint_metrics_reduced.tsv +3755 -0
  29. scout/exceptions/database.py +1 -1
  30. scout/load/all.py +8 -16
  31. scout/models/case/case.py +1 -0
  32. scout/models/case/case_loading_models.py +12 -5
  33. scout/models/managed_variant.py +3 -3
  34. scout/models/omics_variant.py +3 -3
  35. scout/parse/case.py +112 -5
  36. scout/parse/pedqc.py +127 -0
  37. scout/parse/variant/frequency.py +9 -6
  38. scout/parse/variant/variant.py +71 -39
  39. scout/server/app.py +2 -0
  40. scout/server/blueprints/alignviewers/controllers.py +2 -0
  41. scout/server/blueprints/alignviewers/templates/alignviewers/igv_viewer.html +3 -0
  42. scout/server/blueprints/alignviewers/templates/alignviewers/utils.html +1 -1
  43. scout/server/blueprints/cases/controllers.py +23 -3
  44. scout/server/blueprints/cases/templates/cases/case.html +3 -0
  45. scout/server/blueprints/cases/templates/cases/chanjo2_form.html +2 -2
  46. scout/server/blueprints/cases/templates/cases/gene_panel.html +9 -3
  47. scout/server/blueprints/cases/templates/cases/individuals_table.html +4 -1
  48. scout/server/blueprints/cases/templates/cases/utils.html +23 -19
  49. scout/server/blueprints/cases/views.py +5 -9
  50. scout/server/blueprints/clinvar/controllers.py +11 -11
  51. scout/server/blueprints/clinvar/templates/clinvar/multistep_add_variant.html +15 -7
  52. scout/server/blueprints/institutes/controllers.py +20 -1
  53. scout/server/blueprints/institutes/forms.py +5 -1
  54. scout/server/blueprints/institutes/templates/overview/filters.html +14 -1
  55. scout/server/blueprints/institutes/templates/overview/institute_settings.html +7 -0
  56. scout/server/blueprints/institutes/templates/overview/utils.html +20 -1
  57. scout/server/blueprints/omics_variants/templates/omics_variants/outliers.html +9 -2
  58. scout/server/blueprints/omics_variants/views.py +8 -10
  59. scout/server/blueprints/variant/controllers.py +30 -1
  60. scout/server/blueprints/variant/templates/variant/cancer-variant.html +19 -3
  61. scout/server/blueprints/variant/templates/variant/components.html +26 -9
  62. scout/server/blueprints/variant/templates/variant/variant.html +4 -2
  63. scout/server/blueprints/variant/utils.py +2 -0
  64. scout/server/blueprints/variants/controllers.py +29 -3
  65. scout/server/blueprints/variants/forms.py +37 -10
  66. scout/server/blueprints/variants/templates/variants/components.html +12 -10
  67. scout/server/blueprints/variants/templates/variants/utils.html +59 -36
  68. scout/server/blueprints/variants/views.py +45 -60
  69. scout/server/extensions/beacon_extension.py +1 -1
  70. scout/server/extensions/bionano_extension.py +5 -5
  71. scout/server/extensions/chanjo2_extension.py +40 -1
  72. scout/server/extensions/chanjo_extension.py +1 -1
  73. scout/server/extensions/matchmaker_extension.py +1 -1
  74. scout/server/static/bs_styles.css +2 -0
  75. scout/server/templates/layout.html +1 -0
  76. scout/server/utils.py +5 -0
  77. scout/utils/ensembl_biomart_clients.py +2 -11
  78. scout/utils/scout_requests.py +1 -1
  79. {scout_browser-4.96.0.dist-info → scout_browser-4.98.0.dist-info}/METADATA +1 -1
  80. {scout_browser-4.96.0.dist-info → scout_browser-4.98.0.dist-info}/RECORD +83 -81
  81. scout/demo/resources/gnomad.v4.0.constraint_metrics_reduced.tsv +0 -3755
  82. scout/parse/peddy.py +0 -149
  83. scout/utils/sort.py +0 -21
  84. {scout_browser-4.96.0.dist-info → scout_browser-4.98.0.dist-info}/WHEEL +0 -0
  85. {scout_browser-4.96.0.dist-info → scout_browser-4.98.0.dist-info}/entry_points.txt +0 -0
  86. {scout_browser-4.96.0.dist-info → scout_browser-4.98.0.dist-info}/licenses/LICENSE +0 -0
scout/parse/peddy.py DELETED
@@ -1,149 +0,0 @@
1
- from scout.utils.convert import convert_number, make_bool
2
-
3
-
4
- def parse_peddy_ped(lines):
5
- """Parse a peddy.ped file
6
-
7
- Args:
8
- lines(iterable(str))
9
-
10
- Returns:
11
- peddy_ped(list(dict))
12
- """
13
- peddy_ped = []
14
- header = []
15
- for i, line in enumerate(lines):
16
- line = line.rstrip()
17
- if i == 0:
18
- # Header line
19
- header = line.lstrip("#").split("\t")
20
- else:
21
- ind_info = dict(zip(header, line.split("\t")))
22
-
23
- # PC1/PC2/PC3/PC4: the first 4 values after this sample was
24
- # projected onto the thousand genomes principle components.
25
- ind_info["PC1"] = convert_number(ind_info["PC1"])
26
- ind_info["PC2"] = convert_number(ind_info["PC2"])
27
- ind_info["PC3"] = convert_number(ind_info["PC3"])
28
- # ancestry-prediction one of AFR AMR EAS EUR SAS UNKNOWN
29
-
30
- ind_info["het_call_rate"] = convert_number(ind_info["het_call_rate"])
31
-
32
- # idr_baf: inter-decile range (90th percentile - 10th percentile)
33
- # of b-allele frequency. We make a distribution of all sites of
34
- # alts / (ref + alts) and then report the difference between the
35
- # 90th and the 10th percentile.
36
- # Large values indicated likely sample contamination.
37
- ind_info["het_idr_baf"] = convert_number(ind_info["het_idr_baf"])
38
-
39
- ind_info["het_mean_depth"] = convert_number(ind_info["het_mean_depth"])
40
-
41
- peddy_ped.append(ind_info)
42
- return peddy_ped
43
-
44
-
45
- def parse_peddy_ped_check(lines):
46
- """Parse a .ped_check.csv file
47
-
48
- Args:
49
- lines(iterable(str))
50
-
51
- Returns:
52
- ped_check(list(dict))
53
- """
54
- ped_check = []
55
- header = []
56
- for i, line in enumerate(lines):
57
- line = line.rstrip()
58
- if i == 0:
59
- # Header line
60
- header = line.lstrip("#").split(",")
61
- else:
62
- pair_info = dict(zip(header, line.split(",")))
63
-
64
- # the number of sites at which sample_a was heterozygous
65
- pair_info["hets_a"] = convert_number(pair_info["hets_a"])
66
-
67
- # the number of sites at which sample_b was heterozygous
68
- pair_info["hets_b"] = convert_number(pair_info["hets_b"])
69
-
70
- # the number of sites at which the 2 samples shared no alleles
71
- # (should approach 0 for parent-child pairs).
72
- pair_info["ibs0"] = convert_number(pair_info["ibs0"])
73
-
74
- # the number of sites and which the 2 samples where both
75
- # hom-ref, both het, or both hom-alt.
76
- pair_info["ibs2"] = convert_number(pair_info["ibs2"])
77
-
78
- # the number of sites that was used to predict the relatedness.
79
- pair_info["n"] = convert_number(pair_info["n"])
80
-
81
- # the relatedness reported in the ped file.
82
- pair_info["rel"] = convert_number(pair_info["rel"])
83
-
84
- # the relatedness reported in the ped file.
85
- pair_info["pedigree_relatedness"] = convert_number(pair_info["pedigree_relatedness"])
86
-
87
- # difference between the preceding 2 colummns.
88
- pair_info["rel_difference"] = convert_number(pair_info["rel_difference"])
89
-
90
- # the number of sites at which both samples were hets.
91
- pair_info["shared_hets"] = convert_number(pair_info["shared_hets"])
92
-
93
- # boolean indicating that this pair is a parent-child pair
94
- # according to the ped file.
95
- pair_info["pedigree_parents"] = make_bool(pair_info.get("pedigree_parents"))
96
-
97
- # boolean indicating that this pair is expected to be a parent-child
98
- # pair according to the ibs0 (< 0.012) calculated from the genotypes.
99
- pair_info["predicted_parents"] = make_bool(pair_info.get("predicted_parents"))
100
-
101
- # boolean indicating that the preceding 2 columns do not match
102
- pair_info["parent_error"] = make_bool(pair_info.get("parent_error"))
103
-
104
- # boolean indicating that rel > 0.75 and ibs0 < 0.012
105
- pair_info["sample_duplication_error"] = make_bool(
106
- pair_info.get("sample_duplication_error")
107
- )
108
-
109
- ped_check.append(pair_info)
110
-
111
- return ped_check
112
-
113
-
114
- def parse_peddy_sex_check(lines):
115
- """Parse a .ped_check.csv file
116
-
117
- Args:
118
- lines(iterable(str))
119
-
120
- Returns:
121
- sex_check(list(dict))
122
- """
123
- sex_check = []
124
- header = []
125
- for i, line in enumerate(lines):
126
- line = line.rstrip()
127
- if i == 0:
128
- # Header line
129
- header = line.lstrip("#").split(",")
130
- else:
131
- ind_info = dict(zip(header, line.split(",")))
132
-
133
- # boolean indicating wether there is a mismatch between X
134
- # genotypes and ped sex.
135
- ind_info["error"] = make_bool(ind_info.get("error"))
136
-
137
- # number of homozygous-alternate calls
138
- ind_info["hom_alt_count"] = convert_number(ind_info["hom_alt_count"])
139
- # number of homozygous-reference calls
140
- ind_info["hom_ref_count"] = convert_number(ind_info["hom_ref_count"])
141
- # number of heterozygote calls
142
- ind_info["het_count"] = convert_number(ind_info["het_count"])
143
-
144
- # ratio of het_count / hom_alt_count. Low for males, high for females
145
- ind_info["het_ratio"] = convert_number(ind_info["het_ratio"])
146
-
147
- sex_check.append(ind_info)
148
-
149
- return sex_check
scout/utils/sort.py DELETED
@@ -1,21 +0,0 @@
1
- from scout.constants import FILE_TYPE_MAP
2
-
3
-
4
- def get_load_priority(category: str = None, variant_type: str = None, file_type: str = None) -> int:
5
- """
6
- Returns most urgent, highest load priority (numerically the lowest prio number) for the given variables
7
- from a FILE_TYPE_MAP dict of dicts. Helper useful in a sort function.
8
- """
9
- ordered_file_type_map = sorted(FILE_TYPE_MAP.items(), key=lambda ftm: ftm[1]["load_priority"])
10
-
11
- for ftm in ordered_file_type_map:
12
- if file_type and file_type != ftm[0]:
13
- continue
14
-
15
- if category and category != ftm[1]["category"]:
16
- continue
17
-
18
- if variant_type and variant_type != ftm[1]["variant_type"]:
19
- continue
20
-
21
- return ftm[1]["load_priority"]