precursorAlleleACount = int(settings.general['precursorAlleleACount']) precursorAlleleBCount = int(settings.general['precursorAlleleBCount']) #Check if the ploidy is correct totalPloidy = precursorAlleleACount + precursorAlleleBCount precursorTumorFrequency = 100 #Check if the ploidy is different from 2 (or allele balance). If true, then the precursor is not a healthy cell and we have 100% tumor if precursorAlleleACount != 1 or precursorAlleleBCount != 1 or precursorPloidy != 2: precursorTumorFrequency = 0 #In this case we have 100% tumor in the precursor. Only if the precursor it is normal it is 0% tumor. #Initialize the 'healthy' sample, this can now also be a precursor healthySample = Sample(None, None) healthySample.C = [C([2, precursorPloidy])] * measurementLength healthySample.A = [Alleles(precursorAlleleACount, precursorAlleleBCount) ] * measurementLength healthySample.Mu = [Mu(precursorTumorFrequency)] #obtain the chromosome, start and end information from the other samples healthySample.measurements = LAF([0.5] * measurementLength, tmpSamples[0].measurements.chromosomes, tmpSamples[0].measurements.starts, tmpSamples[0].measurements.ends) healthySample.somaticVariants = [0] * somVarNum healthySample.somaticVariantsInd = tmpSamples[0].somaticVariantsInd healthySample.setParent(None) healthySample.name = 'Precursor' #do not call it healthy, it may also be a 4N precursor. #Make a dummy bestCMu for the healthy sample eventDistances = targetClone.eventDistances bestCMuHealthy = CMuCombination(C([2, precursorPloidy]), Mu(precursorTumorFrequency), eventDistances)