public SampleSet <CanvasOutput> Run(SampleSet <CanvasTumorNormalWgsInput> inputs, IDirectoryLocation sandbox)
        {
            var outputs = new SampleSet <CanvasOutput>();

            foreach (var input in inputs)
            {
                IDirectoryLocation sampleSandbox = sandbox.CreateSubdirectory(input.Key.Id);
                outputs.Add(input.Key, RunSingleSample(input.Key.Id, input.Value, sampleSandbox));
            }
            return(outputs);
        }
Esempio n. 2
0
        public IFileLocation Write(IReadOnlyList <CanvasSegment> segments, IDirectoryLocation output,
                                   double normalizationFactor)
        {
            _logger.Info($"Begin writing bedgraph file at '{output}'");
            var benchmark = new Benchmark();
            var bedGraph  = output.GetFileLocation("coverage.bedgraph");

            _writer.Write(segments, bedGraph, normalizationFactor);
            _logger.Info($"Finished writing bedgraph file at '{bedGraph}'. Elapsed time: {benchmark.GetElapsedTime()}");
            _logger.Info($"Begin conversion of '{bedGraph}' to bigwig file");
            benchmark = new Benchmark();
            var bigWigConverterOutput = output.CreateSubdirectory("BigWigConverter");
            var bigwigFile            = _converter.Convert(bedGraph, _genome, bigWigConverterOutput);

            if (bigwigFile != null)
            {
                _logger.Info(
                    $"Finished conversion from bedgraph file at '{bedGraph}' to bigwig file at '{bigwigFile}'. Elapsed time: {benchmark.GetElapsedTime()}");
            }
            return(bigwigFile);
        }
Esempio n. 3
0
        public int Launch()
        {
            CommonOptions      commonOptions = _modeRunner.CommonOptions;
            IDirectoryLocation outFolder     = commonOptions.OutputDirectory;
            var log   = outFolder.GetFileLocation("CanvasLog.txt");
            var error = outFolder.GetFileLocation("CanvasError.txt");

            using (ILogger logger = new Logger(log, error))
            {
                try
                {
                    logger.Info($"Running Canvas {_mode} {_version}");
                    logger.Info($"Command-line arguments: {string.Join(" ", _args)}");
                    var checkpointRunner =
                        GetCheckpointRunner(
                            logger,
                            outFolder,
                            commonOptions.StartCheckpoint,
                            commonOptions.StopCheckpoint,
                            commonOptions.WholeGenomeFasta);
                    using (var manager = checkpointRunner.Manager)
                    {
                        IDirectoryLocation loggingFolder = outFolder.CreateSubdirectory("Logging");
                        IsasConfiguration  config        = IsasConfiguration.GetConfiguration();
                        IWorkManager       workManager   = new LocalWorkManager(logger, loggingFolder, 0, config.MaximumMemoryGB, config.MaximumHoursPerProcess);
                        _modeRunner.Run(logger, checkpointRunner, workManager);
                        manager.CheckFinalState();
                    }
                }
                catch (StopCheckpointFoundException) { }
                catch (Exception e)
                {
                    logger.Error($"Canvas workflow error: {e}");
                    return(-1);
                }
            }
            return(0);
        }
        private void AddControlPloidyVcf(StringBuilder commandLine, CanvasEnrichmentInput input, string SexChromosomeKaryotype, string sampleId, IDirectoryLocation sampleSandbox)
        {
            if (SexChromosomeKaryotype == null)
            {
                _logger.Warn("Sex chromosome ploidy not available for control sample. No ploidy will be provided to Canvas.");
                return;
            }

            _canvasPloidyVcfCreator.AddPloidyVcfOption(commandLine, SomaticEnrichmentOptionsParser.ControlPloidyVcfOptionName, input.GenomeMetadata, SexPloidyInfo.FromKaryotype(SexChromosomeKaryotype), sampleId, sampleSandbox.CreateSubdirectory("control"));
        }
Esempio n. 5
0
 /// <summary>
 /// Copy a directory into some parent directory. 
 /// If a directory with the same name exists in the parent directory it is first removed. 
 /// Returns the copied directory
 /// </summary>
 public IDirectoryLocation CopyInto(IDirectoryLocation parentDirectoryLocation)
 {
     return CopyTo(parentDirectoryLocation.CreateSubdirectory(Name));
 }
Esempio n. 6
0
 /// <summary>
 /// Moves a directory into a parent directory. If paths are not on the same filesystem volume this is equivalent to CopyInto() then Delete()
 /// If the parentDirectoryLocation already contains a directory with the same it is first removed
 /// Returns the directory in its new location
 /// </summary>
 public IDirectoryLocation MoveInto(IDirectoryLocation parentDirectoryLocation)
 {
     return MoveTo(parentDirectoryLocation.CreateSubdirectory(Name));
 }
Esempio n. 7
0
 public static IDirectoryLocation GetFastqFolder(IDirectoryLocation analysisFolder)
 {
     return analysisFolder.CreateSubdirectory(FastqFolderName);
 }
Esempio n. 8
0
 public static IDirectoryLocation GetLoggingFolder(IDirectoryLocation analysisFolder)
 {
     return analysisFolder.CreateSubdirectory(LoggingFolderName);
 }
Esempio n. 9
0
 public static IDirectoryLocation GetCheckpointFolder(IDirectoryLocation analysisFolder)
 {
     return analysisFolder.CreateSubdirectory(CheckpointFolderName);
 }