public CanvasSmallPedigreeOutput Run(CanvasSmallPedigreeInput input, IDirectoryLocation sampleSandbox) { if (!_annotationFileProvider.IsSupported(input.GenomeMetadata)) { _logger.Info($"Skipping Canvas: unsupported reference genome '{input.GenomeMetadata.Name}'"); return(null); } if (!_annotationFileProvider.CustomDbSnpVcf(input.GenomeMetadata) && input.Vcf == null) { _logger.Info($"Skipping Canvas. A dbSNP VCF file was not provided and no small variant VCF file is available"); return(null); } var commandLine = new StringBuilder("SmallPedigree-WGS"); commandLine.Append(GetMultiSampleCommandLine(input.Samples, input.GenomeMetadata, input.Vcf, sampleSandbox)); // use sample vcf by default (performance could be similar with dbSNP vcf though) var bAlleleVcf = input.Vcf.VcfFile; var bAlleleVcfOptionName = SingleSampleCommonOptionsParser.SampleBAlleleVcfOptionName; if (_annotationFileProvider.CustomDbSnpVcf(input.GenomeMetadata)) { bAlleleVcf = _annotationFileProvider.GetDbSnpVcf(input.GenomeMetadata); bAlleleVcfOptionName = SingleSampleCommonOptionsParser.PopulationBAlleleVcfOptionName; } commandLine.Append($" --{bAlleleVcfOptionName} \"{bAlleleVcf}\""); var ploidyInfos = input.Samples.SelectData(sample => sample.PloidyInfo); var ploidyVcf = _canvasPloidyVcfCreator.CreatePloidyVcf(ploidyInfos, input.GenomeMetadata, sampleSandbox); if (ploidyVcf != null) { commandLine.Append($" --{SmallPedigreeOptionsParser.PloidyVcfOptionName} \"{ploidyVcf.VcfFile}\""); } var moreCustomParameters = new Dictionary <string, string>(); // common cnv feature disabled by default due to CANV-397 // string canvasPedigreeCallerParam = $@"--commoncnvs {_annotationFileProvider.GetCanvasAnnotationFile(input.GenomeMetadata, "commoncnvs.bed")}"; // moreCustomParameters["CanvasPedigreeCaller"] = canvasPedigreeCallerParam; commandLine.Append(_singleSampleInputCommandLineBuilder.GetCustomParameters(moreCustomParameters)); commandLine = _singleSampleInputCommandLineBuilder.MergeCustomCanvasParameters(commandLine); // use Proband or, when proband is not available, first sample as pedigree id var pedigreeId = input.Samples.Where(x => x.Value.SampleType == SampleType.Proband).Select(x => x.Key.Id).FirstOrDefault(); if (pedigreeId.IsNullOrEmpty()) { pedigreeId = input.Samples.First().Key.Id; } var job = new JobInfo(_runtimeExecutable.FullName, _canvasExe + " " + commandLine, "Canvas_" + pedigreeId); return(_workDoer.DoWork(WorkResourceRequest.CreateExact(1, 8), job, GetCanvasOutput(input.Samples, sampleSandbox)).Await()); }
private CanvasOutput RunSingleSample(string sampleId, CanvasResequencingInput input, IDirectoryLocation sampleSandbox) { if (!_annotationFileProvider.IsSupported(input.GenomeMetadata)) { _logger.Info($"Skipping Canvas for sample {sampleId}: unsupported reference genome '{input.GenomeMetadata.Name}'"); return(null); } if (!_annotationFileProvider.CustomDbSnpVcf(input.GenomeMetadata) && input.Vcf == null) { _logger.Info($"Skipping Canvas for sample {sampleId}. A dbSNP VCF file was not provided and no small variant VCF file is available"); return(null); } StringBuilder commandLine = new StringBuilder("Germline-WGS"); commandLine.Append(_singleSampleInputCommandLineBuilder.GetSingleSampleCommandLine(sampleId, input.Bam, input.GenomeMetadata, sampleSandbox)); // use sample vcf by default (performance could be similar with dbSNP vcf though) var bAlleleVcf = input.Vcf.VcfFile; var bAlleleVcfOptionName = SingleSampleCommonOptionsParser.SampleBAlleleVcfOptionName; if (_annotationFileProvider.CustomDbSnpVcf(input.GenomeMetadata)) { bAlleleVcf = _annotationFileProvider.GetDbSnpVcf(input.GenomeMetadata); bAlleleVcfOptionName = SingleSampleCommonOptionsParser.PopulationBAlleleVcfOptionName; } commandLine.Append($" --{bAlleleVcfOptionName} \"{bAlleleVcf}\""); IFileLocation ploidyBed = _canvasPloidyBedCreator.CreateGermlinePloidyBed(input.Vcf, input.GenomeMetadata, sampleSandbox); if (ploidyBed != null) { commandLine.Append($" --{SingleSampleCommonOptionsParser.PloidyBedOptionName} \"{ploidyBed}\""); } var canvasPartitionParam = $@"--commoncnvs {_annotationFileProvider.GetCanvasAnnotationFile(input.GenomeMetadata, "commoncnvs.bed")}"; var moreCustomParameters = new Dictionary <string, string>(); moreCustomParameters["CanvasPartition"] = canvasPartitionParam; commandLine.Append(_singleSampleInputCommandLineBuilder.GetCustomParameters(moreCustomParameters)); commandLine = _singleSampleInputCommandLineBuilder.MergeCustomCanvasParameters(commandLine); UnitOfWork singleSampleJob = new UnitOfWork() { ExecutablePath = CrossPlatform.IsThisLinux() ? _runtimeExecutable.FullName : _canvasExe.FullName, CommandLine = CrossPlatform.IsThisLinux() ? _canvasExe + " " + commandLine : commandLine.ToString(), LoggingFolder = _workManager.LoggingFolder.FullName, LoggingStub = "Canvas_" + sampleId, }; _workManager.DoWorkSingleThread(singleSampleJob); return(GetCanvasOutput(sampleId, sampleSandbox)); }
public SampleSet <Tuple <IFileLocation, bool> > GetBAlleleVcfs(SampleSet <CanvasTumorNormalEnrichmentInput> inputs, IDirectoryLocation sandbox) { var inputsUsingDbSnpVcf = inputs.WhereData(input => _annotationFileProvider.CustomDbSnpVcf(input.GenomeMetadata)); var targetedDbSnpVcfs = _enrichmentInputCreator.CreateDbSnpVcfForManifests(inputsUsingDbSnpVcf, sandbox, _annotationFileProvider); var bAlleleVcfs = new SampleSet <Tuple <IFileLocation, bool> >(); foreach (var input in inputs) { IFileLocation bAlleleVcf; bool isDbSnpVcf = true; if (!targetedDbSnpVcfs.TryGetValue(input.Value.NexteraManifest, out bAlleleVcf)) { bAlleleVcf = input.Value.NormalVcf.VcfFile; isDbSnpVcf = false; } bAlleleVcfs[input.Key] = Tuple.Create(bAlleleVcf, isDbSnpVcf); } return(bAlleleVcfs); }
public CanvasSmallPedigreeOutput Run(CanvasSmallPedigreeInput input, IDirectoryLocation sampleSandbox) { if (!_annotationFileProvider.IsSupported(input.GenomeMetadata)) { _logger.Info($"Skipping Canvas: unsupported reference genome '{input.GenomeMetadata.Name}'"); return(null); } if (!_annotationFileProvider.CustomDbSnpVcf(input.GenomeMetadata) && input.Vcf == null) { _logger.Info($"Skipping Canvas. A dbSNP VCF file was not provided and no small variant VCF file is available"); return(null); } var commandLine = new StringBuilder("SmallPedigree-WGS"); commandLine.Append(GetMultiSampleCommandLine(input.Samples, input.GenomeMetadata, input.Vcf, sampleSandbox)); // use sample vcf by default (performance could be similar with dbSNP vcf though) var bAlleleVcf = input.Vcf.VcfFile; var bAlleleVcfOptionName = SingleSampleCommonOptionsParser.SampleBAlleleVcfOptionName; if (_annotationFileProvider.CustomDbSnpVcf(input.GenomeMetadata)) { bAlleleVcf = _annotationFileProvider.GetDbSnpVcf(input.GenomeMetadata); bAlleleVcfOptionName = SingleSampleCommonOptionsParser.PopulationBAlleleVcfOptionName; } commandLine.Append($" --{bAlleleVcfOptionName} \"{bAlleleVcf}\""); var ploidyInfos = input.Samples.SelectData(sample => sample.PloidyInfo); var ploidyVcf = _canvasPloidyVcfCreator.CreatePloidyVcf(ploidyInfos, input.GenomeMetadata, sampleSandbox); if (ploidyVcf != null) { commandLine.Append($" --{SmallPedigreeOptionsParser.PloidyVcfOptionName} \"{ploidyVcf.VcfFile}\""); } var canvasPartitionParam = $@"--commoncnvs {_annotationFileProvider.GetCanvasAnnotationFile(input.GenomeMetadata, "commoncnvs.bed")}"; var moreCustomParameters = new Dictionary <string, string> { ["CanvasPartition"] = canvasPartitionParam }; commandLine.Append(_singleSampleInputCommandLineBuilder.GetCustomParameters(moreCustomParameters)); commandLine = _singleSampleInputCommandLineBuilder.MergeCustomCanvasParameters(commandLine); // use Proband or, when proband is not available, first sample as pedigree id var pedigreeId = input.Samples.Where(x => x.Value.SampleType == SampleType.Proband).Select(x => x.Key.Id).FirstOrDefault(); if (pedigreeId.IsNullOrEmpty()) { pedigreeId = input.Samples.First().Key.Id; } var singleSampleJob = new UnitOfWork() { ExecutablePath = CrossPlatform.IsThisLinux() ? _runtimeExecutable.FullName : _canvasExe.FullName, CommandLine = CrossPlatform.IsThisLinux() ? _canvasExe + " " + commandLine : commandLine.ToString(), LoggingFolder = _workManager.LoggingFolder.FullName, LoggingStub = "Canvas_" + pedigreeId, }; _workManager.DoWorkSingleThread(singleSampleJob); var sampleBams = input.Samples.SelectData(sample => sample.Bam); return(GetCanvasOutput(sampleBams, sampleSandbox)); }