Skip to content

Commit

Permalink
Merge pull request #33 from TRON-Bioinformatics/bugfix-recurrent-vari…
Browse files Browse the repository at this point in the history
…ants-tab

Bugfix recurrent variants tab
  • Loading branch information
priesgo authored May 30, 2022
2 parents ac1148d + 2020b2c commit a1265d0
Show file tree
Hide file tree
Showing 7 changed files with 383 additions and 130 deletions.
2 changes: 1 addition & 1 deletion covigator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = "v0.6.4"
VERSION = "v0.6.6"
ANALYSIS_PIPELINE_VERSION = "v0.9.3"

MISSENSE_VARIANT = "missense_variant"
Expand Down
263 changes: 137 additions & 126 deletions covigator/dashboard/figures/recurrent_mutations.py

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions covigator/dashboard/tabs/recurrent_mutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,14 @@ def update_top_occurring_variants(_, top_variants, gene_name, domain, date_range
state=[
State(ID_DROPDOWN_GENE, 'value'),
State(ID_DROPDOWN_DOMAIN, 'value'),
State(ID_TOP_OCCURRING_VARIANTS, "value"), # this param is needed to ensure order of callbacks
State(ID_TOP_OCCURRING_VARIANTS_TABLE, "derived_virtual_data"),
State(ID_TOP_OCCURRING_VARIANTS_TABLE, "derived_virtual_selected_rows"),
State(ID_SLIDER_BIN_SIZE, 'value'),
State(ID_DROPDOWN_DATA_SOURCE, 'value'),
]
)
def update_needle_plot(_, gene_name, domain, rows, selected_rows_indices, bin_size, source):
def update_needle_plot(_, gene_name, domain, dummy, rows, selected_rows_indices, bin_size, source):
if gene_name is not None or domain is not None:
selected_rows = [rows[s] for s in selected_rows_indices] if selected_rows_indices else None
plot = html.Div(
Expand All @@ -286,6 +287,7 @@ def update_needle_plot(_, gene_name, domain, rows, selected_rows_indices, bin_si
state=[
State(ID_DROPDOWN_GENE, 'value'),
State(ID_DROPDOWN_DOMAIN, 'value'),
State(ID_TOP_OCCURRING_VARIANTS, "value"), # this param is needed to ensure order of callbacks
State(ID_TOP_OCCURRING_VARIANTS_TABLE, "derived_virtual_data"),
State(ID_TOP_OCCURRING_VARIANTS_TABLE, "derived_virtual_selected_rows"),
State(ID_DROPDOWN_SIMILARITY_METRIC, 'value'),
Expand All @@ -295,12 +297,12 @@ def update_needle_plot(_, gene_name, domain, rows, selected_rows_indices, bin_si
]
)
def update_cooccurrence_heatmap(
_, gene_name, domain, rows, selected_rows_indices, metric, min_cooccurrences, min_samples, source):
_, gene_name, domain, dummy, rows, selected_rows_indices, metric, min_cooccurrences, min_samples, source):
if source != DataSource.ENA.name:
plot = html.Div(
children=[dcc.Markdown(
"""**The co-occurrence analysis is currently only available for the ENA dataset**""")])
elif gene_name is None:
elif gene_name is None and domain is None:
plot = html.Div(
children=[dcc.Markdown(
"""**Please, select a gene or domain to explore the co-occurrence analysis**""")])
Expand Down
1 change: 1 addition & 0 deletions covigator/processor/abstract_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ def load_pangolin(sample: typing.Union[SampleGisaid, SampleEna], path: str) -> t

# fill NA values on a per column basis...
data.lineage.fillna(value="", inplace=True)
data.lineage = data.lineage.transform(lambda x: "" if x == 'None' else x) # replace "None" values
data.scorpio_call.fillna(value="", inplace=True)
data.version.fillna(value="", inplace=True)
data.pangolin_version.fillna(value="", inplace=True)
Expand Down
2 changes: 2 additions & 0 deletions covigator/tests/resources/test.lofreq.pangolin.with_none.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
taxon,lineage,conflict,ambiguity_score,scorpio_call,scorpio_support,scorpio_conflict,version,pangolin_version,pangoLEARN_version,pango_version,status,note
MN908947.3_dna:primary_assembly_primary_assembly:ASM985889v3:MN908947.3:1:29903:1_REF,None,0.0,1.0,,,,PLEARN-v1.2.123,3.1.19,2022-01-20,v1.2.123,passed_qc,
9 changes: 9 additions & 0 deletions covigator/tests/unit_tests/test_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ def test_load_pangolin_from_ena(self):
self.session.add(sample)
self.session.commit()

def test_load_pangolin_with_none(self):
pangolin_path = pkg_resources.resource_filename(covigator.tests.__name__, "resources/test.lofreq.pangolin.with_none.csv")
sample = SampleEna(run_accession="TEST", fastq_ftp="", fastq_md5="", num_fastqs=1)
EnaProcessor.load_pangolin(sample, path=pangolin_path)
self.assertEqual(sample.pangolin_lineage, "")

self.session.add(sample)
self.session.commit()

def test_load_pangolin_from_gisaid(self):
pangolin_path = pkg_resources.resource_filename(covigator.tests.__name__, "resources/test.lofreq.pangolin.csv")
sample = SampleGisaid(run_accession="TEST")
Expand Down
Loading

0 comments on commit a1265d0

Please sign in to comment.