Skip to content

Commit ed43275

Browse files
authored
Merge branch 'master' into feat/haplotype-sharing-arc-chord
2 parents c2b6fd7 + db8e6df commit ed43275

3 files changed

Lines changed: 17 additions & 10 deletions

File tree

malariagen_data/anoph/dipclust.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import warnings
12
from typing import Optional, Tuple
23

34
import allel # type: ignore
@@ -540,8 +541,9 @@ def _insert_dipclust_snp_trace(
540541
figures.append(snp_trace)
541542
subplot_heights.append(snp_row_height * n_snps_transcript)
542543
else:
543-
print(
544-
f"No SNPs were found below {snp_filter_min_maf} allele frequency. Omitting SNP genotype plot."
544+
warnings.warn(
545+
f"No SNPs were found below {snp_filter_min_maf} allele frequency. Omitting SNP genotype plot.",
546+
stacklevel=2,
545547
)
546548
return figures, subplot_heights, n_snps_transcript
547549

@@ -607,8 +609,9 @@ def plot_diplotype_clustering_advanced(
607609
cnv_colorscale = cnv_params.colorscale_default
608610
if cohort_size and snp_transcript:
609611
cohort_size = None
610-
print(
611-
"Cohort size is not supported with amino acid heatmap. Overriding cohort size to None."
612+
warnings.warn(
613+
"Cohort size is not supported with amino acid heatmap. Overriding cohort size to None.",
614+
stacklevel=2,
612615
)
613616

614617
res = self.plot_diplotype_clustering(

malariagen_data/anoph/hapclust.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import warnings
12
from typing import Optional, Tuple
23

34
import allel # type: ignore
@@ -402,8 +403,9 @@ def plot_haplotype_clustering_advanced(
402403

403404
if cohort_size and snp_transcript:
404405
cohort_size = None
405-
print(
406-
"Cohort size is not supported with amino acid heatmap. Overriding cohort size to None."
406+
warnings.warn(
407+
"Cohort size is not supported with amino acid heatmap. Overriding cohort size to None.",
408+
stacklevel=2,
407409
)
408410

409411
res = self.plot_haplotype_clustering(
@@ -709,8 +711,9 @@ def _insert_hapclust_snp_trace(
709711
figures.append(snp_trace)
710712
subplot_heights.append(snp_row_height * df_haps.shape[0])
711713
else:
712-
print(
713-
f"No SNPs were found below {snp_filter_min_maf} allele frequency. Omitting SNP genotype plot."
714+
warnings.warn(
715+
f"No SNPs were found below {snp_filter_min_maf} allele frequency. Omitting SNP genotype plot.",
716+
stacklevel=2,
714717
)
715718
return figures, subplot_heights, n_snps_transcript
716719

malariagen_data/anoph/sample_metadata.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,8 +1534,9 @@ def _setup_cohort_queries(
15341534
if min_cohort_size is not None:
15351535
cohort_size = min_cohort_size
15361536
if cohort_size is not None and n_samples < cohort_size:
1537-
print(
1538-
f"Cohort ({cohort_label}) has insufficient samples ({n_samples}) for requested cohort size ({cohort_size}), dropping."
1537+
warnings.warn(
1538+
f"Cohort ({cohort_label}) has insufficient samples ({n_samples}) for requested cohort size ({cohort_size}), dropping.",
1539+
stacklevel=2,
15391540
)
15401541
else:
15411542
cohort_queries_checked[cohort_label] = cohort_query

0 commit comments

Comments
 (0)