/// <summary> /// Write out the ploidy bed file if ploidy information is available from the vcf header /// Only create the normal XX or XY ploidy bed file so that Canvas can properly classify any abnormalities as variant. /// If ploidy Y is > 1 produce the XY ploidy bed file, otherwise produce the XX ploidy bed file /// </summary> public IFileLocation CreateGermlinePloidyBed(Vcf vcf, GenomeMetadata genomeMetadata, IDirectoryLocation sampleSandbox) { string sexKaryotype = PloidyCorrector.GetSexChromosomeKaryotypeFromVcfHeader(vcf.VcfFile.FullName); if (sexKaryotype == null) { _logger.Warn($"Sex chromosome ploidy not found in {vcf.VcfFile} header. No ploidy will be provided to Canvas."); return(null); } _logger.Info($"Found sex chromosome ploidy {PloidyCorrector.PrintPloidy(sexKaryotype)} in {vcf.VcfFile}"); var ploidyInfo = new SamplePloidyInfo(); IFileLocation ploidyBed = sampleSandbox.GetFileLocation("ploidy.bed.gz"); if (sexKaryotype.ToLower().Contains("y")) { ploidyInfo.ProvidedPloidy = SexPloidyInfo.NormalMale; _logger.Info($"Creating male ploidy bed file at {ploidyBed}."); } else { ploidyInfo.ProvidedPloidy = SexPloidyInfo.NormalFemale; _logger.Info($"Creating female ploidy bed file at {ploidyBed}."); } string headerLine = $"{PloidyCorrector.ReferenceSexChromosomeKaryotype}={PloidyCorrector.PrettyPrintPloidy(ploidyInfo.ProvidedPloidyX.Value, ploidyInfo.ProvidedPloidyY.Value)}"; _ploidyFixer.WritePloidyBedFile(ploidyInfo, genomeMetadata, _ploidyFixer.GetParRegions(genomeMetadata), ploidyBed.FullName, headerLine, ploidy => true); return(ploidyBed); }
public CanvasEnrichmentInput(Bam bam, GenomeMetadata genomeMetadata, IEnumerable <Bam> controlBamPaths, NexteraManifest nexteraManifest, CanvasEnrichmentPrecomputedControl precomputedControl, SamplePloidyInfo ploidyInfo, IFileLocation predefinedBinsFile, CanvasPcaModels pcaModels) { Bam = bam; GenomeMetadata = genomeMetadata; NexteraManifest = nexteraManifest; PrecomputedControl = precomputedControl; NormalBamPaths = new ReadOnlyCollection <Bam>(controlBamPaths.ToList()); PloidyInfo = ploidyInfo; PredefinedBinsFile = predefinedBinsFile; PcaModels = pcaModels; }