private CanvasOutput RunSingleSample(string sampleId, CanvasTumorNormalEnrichmentInput input, IFileLocation bAlleleVcf, bool isDbSnpVcf, IFileLocation manifest, IDirectoryLocation sampleSandbox)
        {
            if (!_annotationFileProvider.IsSupported(input.GenomeMetadata))
            {
                _logger.Info($"Skipping Canvas for sample {sampleId}: unsupported reference genome '{input.GenomeMetadata.Name}'");
                return(null);
            }

            StringBuilder commandLine = new StringBuilder("Tumor-normal-enrichment");

            commandLine.Append(_singleSampleInputCommandLineBuilder.GetSingleSampleCommandLine(sampleId, input.TumorBam, input.GenomeMetadata, sampleSandbox));
            commandLine.Append($" --normal-bam \"{input.NormalBam.BamFile}\"");
            commandLine.Append($" --manifest \"{manifest}\"");
            var bAlleleVcfOptionName = isDbSnpVcf ?
                                       SingleSampleCommonOptionsParser.PopulationBAlleleVcfOptionName :
                                       SingleSampleCommonOptionsParser.SampleBAlleleVcfOptionName;

            commandLine.Append($" --{bAlleleVcfOptionName} {bAlleleVcf.WrapWithShellQuote()}");

            commandLine.Append($" --somatic-vcf \"{input.SomaticVcf.VcfFile}\"");

            AddPloidyVcf(commandLine, SingleSampleCommonOptionsParser.PloidyVcfOptionName, input, sampleId, sampleSandbox);

            commandLine.Append(_singleSampleInputCommandLineBuilder.GetCustomParameters());
            commandLine = _singleSampleInputCommandLineBuilder.MergeCustomCanvasParameters(commandLine);

            var job = new JobInfo(_runtimeExecutable.FullName, _canvasExe + " " + commandLine, "Canvas_" + sampleId);

            return(_workDoer.DoWork(WorkResourceRequest.CreateExact(1, 8), job, GetCanvasOutput(sampleId, sampleSandbox)).Await());
        }
Example #2
0
        private CanvasOutput RunSingleSample(string sampleId, CanvasTumorNormalEnrichmentInput input, IFileLocation bAlleleVcf, bool isDbSnpVcf, IFileLocation manifest, IDirectoryLocation sampleSandbox)
        {
            if (!_annotationFileProvider.IsSupported(input.GenomeMetadata))
            {
                _logger.Info($"Skipping Canvas for sample {sampleId}: unsupported reference genome '{input.GenomeMetadata.Name}'");
                return(null);
            }

            StringBuilder commandLine = new StringBuilder("Tumor-normal-enrichment");

            commandLine.Append(_singleSampleInputCommandLineBuilder.GetSingleSampleCommandLine(sampleId, input.TumorBam, input.GenomeMetadata, sampleSandbox));
            commandLine.Append($" --normal-bam \"{input.NormalBam.BamFile}\"");
            commandLine.Append($" --manifest \"{manifest}\"");
            var bAlleleVcfOptionName = isDbSnpVcf ?
                                       SingleSampleCommonOptionsParser.PopulationBAlleleVcfOptionName :
                                       SingleSampleCommonOptionsParser.SampleBAlleleVcfOptionName;

            commandLine.Append($" --{bAlleleVcfOptionName} {bAlleleVcf.WrapWithShellQuote()}");

            commandLine.Append($" --somatic-vcf \"{input.SomaticVcf.VcfFile}\"");

            IFileLocation ploidyBed = _canvasPloidyBedCreator.CreatePloidyBed(input.NormalVcf, input.GenomeMetadata, sampleSandbox);

            if (ploidyBed != null)
            {
                commandLine.Append($" --{SingleSampleCommonOptionsParser.PloidyBedOptionName} \"{ploidyBed}\"");
            }
            commandLine.Append(_singleSampleInputCommandLineBuilder.GetCustomParameters());
            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));
        }