Skip to content

Commit

Permalink
Reformat with the latest black
Browse files Browse the repository at this point in the history
  • Loading branch information
Chiara Rasi committed Feb 9, 2024
1 parent 9bf98ee commit 196652a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 43 deletions.
6 changes: 3 additions & 3 deletions src/chanjo2/endpoints/overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ async def gene_overview(
form_dict: dict = jsonable_encoder(form_data)
validated_form = GeneReportForm(**form_dict)

gene_overview_content: Dict[
str, List[GeneCoverage]
] = get_gene_overview_coverage_stats(form_data=validated_form, session=db)
gene_overview_content: Dict[str, List[GeneCoverage]] = (
get_gene_overview_coverage_stats(form_data=validated_form, session=db)
)

return templates.TemplateResponse(
"gene-overview.html",
Expand Down
6 changes: 3 additions & 3 deletions src/chanjo2/meta/handle_load_intervals.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ async def update_transcripts(
refseq_mrna_pred=items[6],
refseq_ncrna=items[7],
refseq_mane_select=items[8] if build == Builds.build_38 else None,
refseq_mane_plus_clinical=items[9]
if build == Builds.build_38
else None,
refseq_mane_plus_clinical=(
items[9] if build == Builds.build_38 else None
),
build=build,
)
transcripts_bulk.append(transcript)
Expand Down
38 changes: 19 additions & 19 deletions src/chanjo2/meta/handle_report_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,14 @@ def get_genes_overview_incomplete_coverage_rows(
completeness_at_level: float = gene_cov_stats.completeness.get(
cov_level
)
overview_line: Optional[
List[str]
] = _get_incomplete_gene_coverage_overview_line(
hgnc_symbol=gene_cov_stats.hgnc_symbol,
hgnc_id=gene_cov_stats.hgnc_id,
interval_id=gene_cov_stats.hgnc_id,
sample=sample_name,
completeness=completeness_at_level,
overview_line: Optional[List[str]] = (
_get_incomplete_gene_coverage_overview_line(
hgnc_symbol=gene_cov_stats.hgnc_symbol,
hgnc_id=gene_cov_stats.hgnc_id,
interval_id=gene_cov_stats.hgnc_id,
sample=sample_name,
completeness=completeness_at_level,
)
)

genes_overview_rows.append(overview_line)
Expand All @@ -305,14 +305,14 @@ def get_genes_overview_incomplete_coverage_rows(
completeness_at_level: float = (
inner_interval_stats.completeness.get(cov_level)
)
overview_line: Optional[
List[str]
] = _get_incomplete_gene_coverage_overview_line(
hgnc_symbol=gene_cov_stats.hgnc_symbol,
hgnc_id=gene_cov_stats.hgnc_id,
interval_id=inner_interval_stats.interval_id,
sample=sample_name,
completeness=completeness_at_level,
overview_line: Optional[List[str]] = (
_get_incomplete_gene_coverage_overview_line(
hgnc_symbol=gene_cov_stats.hgnc_symbol,
hgnc_id=gene_cov_stats.hgnc_id,
interval_id=inner_interval_stats.interval_id,
sample=sample_name,
completeness=completeness_at_level,
)
)

genes_overview_rows.append(overview_line)
Expand Down Expand Up @@ -357,9 +357,9 @@ def get_gene_overview_coverage_stats(form_data: GeneReportForm, session: Session
)
for sample, d4_file in samples_d4_files
}
gene_stats[
"samples_coverage_stats_by_interval"
] = get_gene_coverage_stats_by_interval(coverage_by_sample=samples_coverage_stats)
gene_stats["samples_coverage_stats_by_interval"] = (
get_gene_coverage_stats_by_interval(coverage_by_sample=samples_coverage_stats)
)
return gene_stats


Expand Down
36 changes: 18 additions & 18 deletions tests/src/chanjo2/meta/test_handle_report_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ def test_get_report_level_completeness_rows(
assert samples_coverage_stats

# THEN it should be possible to retrieve stats for the default coverage level:
default_level_samples_coverage_stats: List[
Tuple[str, float, str]
] = get_report_level_completeness_rows(
samples_coverage_stats=samples_coverage_stats, level=DEFAULT_COVERAGE_LEVEL
default_level_samples_coverage_stats: List[Tuple[str, float, str]] = (
get_report_level_completeness_rows(
samples_coverage_stats=samples_coverage_stats, level=DEFAULT_COVERAGE_LEVEL
)
)
for (
sample,
Expand Down Expand Up @@ -76,11 +76,11 @@ def test_get_report_completeness_rows(
assert samples_coverage_stats

# THEN completeness rows should contain the expected stats for each sample
samples_completeness_rows: List[
Tuple[str, Dict[str, float]]
] = get_report_completeness_rows(
samples_coverage_stats=samples_coverage_stats,
levels=DEFAULT_COMPLETENESS_LEVELS,
samples_completeness_rows: List[Tuple[str, Dict[str, float]]] = (
get_report_completeness_rows(
samples_coverage_stats=samples_coverage_stats,
levels=DEFAULT_COMPLETENESS_LEVELS,
)
)
for sample, stats in samples_completeness_rows:
assert sample == samples_d4_list[0][0]
Expand Down Expand Up @@ -125,12 +125,12 @@ def test_get_genes_overview_incomplete_coverage_rows(
assert samples_coverage_stats

# THEN it should be possible to retrieve stats for the transcripts that are not fully covered at the given threshold
genes_overview_lines: List[
Tuple[Union[str, int, float]]
] = get_genes_overview_incomplete_coverage_rows(
samples_coverage_stats=samples_coverage_stats,
interval_type=SQLTranscript,
cov_level=DEFAULT_COMPLETENESS_LEVELS[0],
genes_overview_lines: List[Tuple[Union[str, int, float]]] = (
get_genes_overview_incomplete_coverage_rows(
samples_coverage_stats=samples_coverage_stats,
interval_type=SQLTranscript,
cov_level=DEFAULT_COMPLETENESS_LEVELS[0],
)
)

# THEN each transcript line should contain the expected values
Expand Down Expand Up @@ -168,9 +168,9 @@ def test_get_gene_coverage_stats_by_interval(
}

# WHEN passed to the get_gene_coverage_stats_by_interval function:
intervals_coverage_stats: Dict[
str, List[Tuple]
] = get_gene_coverage_stats_by_interval(coverage_by_sample=samples_coverage_stats)
intervals_coverage_stats: Dict[str, List[Tuple]] = (
get_gene_coverage_stats_by_interval(coverage_by_sample=samples_coverage_stats)
)

# THEN the returned data should have the expected format
for interval_id, stats_tuples in intervals_coverage_stats.items():
Expand Down

0 comments on commit 196652a

Please sign in to comment.