diff --git a/src/tinypeel/Peeling/PeelingIO.py b/src/tinypeel/Peeling/PeelingIO.py index 8f29dd6..b765157 100644 --- a/src/tinypeel/Peeling/PeelingIO.py +++ b/src/tinypeel/Peeling/PeelingIO.py @@ -1,6 +1,7 @@ import numpy as np from numba import jit from ..tinyhouse import InputOutput +import warnings def readInSeg(pedigree, fileName, start=None, stop=None): @@ -58,7 +59,9 @@ def readInSeg(pedigree, fileName, start=None, stop=None): ) if idx not in pedigree.individuals: - print(f"Individual {idx} is not found in pedigree. Individual ignored.") + warnings.warn( + f"Individual {idx} is not found in pedigree. Individual ignored." + ) else: ind = pedigree.individuals[idx] if e == 0: @@ -74,7 +77,9 @@ def readInSeg(pedigree, fileName, start=None, stop=None): indHit[ind.idn] += 1 for ind in pedigree: if indHit[ind.idn] != 4: - print(f"No segregation information found for individual {ind.idx}") + warnings.warn( + f"No segregation information found for individual {ind.idx}" + ) return seg diff --git a/src/tinypeel/Peeling/PeelingInfo.py b/src/tinypeel/Peeling/PeelingInfo.py index bf1bbe8..23240bb 100644 --- a/src/tinypeel/Peeling/PeelingInfo.py +++ b/src/tinypeel/Peeling/PeelingInfo.py @@ -2,6 +2,7 @@ from numba.experimental import jitclass import numpy as np from collections import OrderedDict +import warnings from ..tinyhouse import ProbMath from ..tinyhouse import HaplotypeOperations @@ -149,18 +150,18 @@ def createPeelingInfo(pedigree, args, createSeg=True, phaseFounder=False): if args.penetrance is not None: if peelingInfo.isXChr: - print( + warnings.warn( "Using an external penetrance file and the x_chr option is highly discouraged. Please do not use." ) if args.est_geno_error_prob: - print( + warnings.warn( "External penetrance file included, but est_geno_error_prob flag used. The two options are incompatible. est_geno_error_prob set to false." ) args.est_geno_error_prob = False if args.est_seq_error_prob: - print( + warnings.warn( "External penetrance file included, but est_seq_error_prob flag used. The two options are incompatible. est_seq_error_prob set to false." ) args.est_seq_error_prob = False @@ -265,7 +266,9 @@ def addPenetranceFromExternalFile(pedigree, peelingInfo, fileName, args): penetranceLine = np.array([float(val) for val in parts], dtype=np.float32) if idx not in pedigree.individuals: - print("Individual", idx, "not found in pedigree. Individual ignored.") + warnings.warn( + "Individual", idx, "not found in pedigree. Individual ignored." + ) else: ind = pedigree.individuals[idx] peelingInfo.penetrance[ind.idn, e, :] *= penetranceLine diff --git a/src/tinypeel/Peeling/PeelingUpdates.py b/src/tinypeel/Peeling/PeelingUpdates.py index 16d6258..8a0fa9a 100644 --- a/src/tinypeel/Peeling/PeelingUpdates.py +++ b/src/tinypeel/Peeling/PeelingUpdates.py @@ -5,6 +5,8 @@ from . import PeelingInfo +import warnings + ######################################################################################### # In this module we will update 3 things: # # 1) Our estimate for the MAF (both prior to peeling and after each peeling cycle) . # @@ -30,7 +32,7 @@ def updateMaf(pedigree, peelingInfo): :return: None. The function updates the pedigree.AAP attribute with the new alternative allele frequencies. """ if peelingInfo.isXChr: - print( + warnings.warn( "Updating error rates and alternative allele frequencies for X chromosomes are not well test and will break in interesting ways. Recommend running without that option." ) MF = list(pedigree.AAP.keys()) @@ -256,7 +258,7 @@ def updatePenetrance(pedigree, peelingInfo, args): peelingInfo.seqError = updateSeqError(pedigree, peelingInfo) if peelingInfo.isXChr: - print( + warnings.warn( "Updating error rates and minor allele frequencies for X chromosomes are not well test and will break in interesting ways. Recommend running without that option." ) phaseFounder = not args.no_phase_founder diff --git a/src/tinypeel/tinypeel.py b/src/tinypeel/tinypeel.py index 22bef29..c223c91 100644 --- a/src/tinypeel/tinypeel.py +++ b/src/tinypeel/tinypeel.py @@ -859,7 +859,7 @@ def main(): singleLocusMode = args.method == "single" if args.method == "multi" and args.segfile: - print("Running in multi-locus mode, external segfile ignored") + warnings.warn("Running in multi-locus mode, external segfile ignored") # For now, only support a single phenotype (will remove in future) if args.phenotype is not None and pedigree.nPheno > 1: