Ejemplo n.º 1
0
        public string GenerateSpritzCMDCommand(SpritzOptions options)
        {
            string command = $"conda run --no-capture-output --live-stream dotnet SpritzCMD.dll {SpritzOptionStrings.GenerateSpritzCMDArgs(options)}";

            SpritzCMDCommand = command;
            return(command);
        }
Ejemplo n.º 2
0
        public string GenerateSpritzCMDCommand(SpritzOptions options)
        {
            string command = $"/opt/conda/lib/dotnet/dotnet SpritzCMD.dll {SpritzOptionStrings.GenerateSpritzCMDArgs(options)}";

            SpritzCMDCommand = command;
            return(command);
        }
Ejemplo n.º 3
0
        public string GenerateSnakemakeCommand(SpritzOptions options, bool setup)
        {
            string cmd = "";

            cmd += $"snakemake -j {options.Threads} --use-conda --conda-frontend mamba --configfile {Path.Combine(ConfigDirectory, "config.yaml")}";
            if (setup)
            {
                cmd += " setup.txt";
            }
            SnakemakeCommand = cmd;
            return(cmd);
        }
Ejemplo n.º 4
0
        public static string GenerateSpritzCMDArgs(SpritzOptions args)
        {
            // docker container working directory is /app/spritz/ and snakemake runs in /app/spritz/workflow/
            // the results directory is /app/spritz/results/
            string argsString =
                $"--{ThreadsLong} {args.Threads} " +
                $"--{AnalysisDirectoryLong}=/app/spritz/results/ ";

            if (args.Reference != null && args.Reference != string.Empty)
            {
                argsString += $"--{ReferenceLong}=\"\"\"{args.Reference}\"\"\" ";
            }
            if (args.AnalyzeVariants)
            {
                argsString += $"--{AnalyzeVariantsLong} ";
            }
            if (args.AnalyzeIsoforms)
            {
                argsString += $"--{AnalyzeIsoformsLong} ";
            }
            if (args.Quantify)
            {
                argsString += $"--{QuantifyLong} ";
            }
            if (args.AvailableReferences)
            {
                argsString += $"--{AvailableReferencesLong} ";
            }
            if (args.Fastq1 != null && args.Fastq1 != string.Empty)
            {
                argsString += $"--{Fastq1Long}={args.Fastq1} ";
            }
            if (args.Fastq2 != null && args.Fastq2 != string.Empty)
            {
                argsString += $"--{Fastq2Long}={args.Fastq2} ";
            }
            if (args.Fastq1SingleEnd != null && args.Fastq1SingleEnd != string.Empty)
            {
                argsString += $"--{Fastq1SingleEndLong}={args.Fastq1SingleEnd} ";
            }
            if (args.SraAccession != null && args.SraAccession != string.Empty)
            {
                argsString += $"--{SraAccessionLong}={args.SraAccession} ";
            }
            if (args.SraAccessionSingleEnd != null && args.SraAccessionSingleEnd != string.Empty)
            {
                argsString += $"--{SraAccessionSingleEndLong}={args.SraAccessionSingleEnd} ";
            }
            return(argsString);
        }
Ejemplo n.º 5
0
        public void WriteConfig(SpritzOptions options, string analysisDirectoryStr)
        {
            const string initialContent = "---\nversion: 1\n"; // needed to start writing yaml file

            var sr     = new StringReader(initialContent);
            var stream = new YamlStream();

            stream.Load(sr);

            var rootMappingNode = (YamlMappingNode)stream.Documents[0].RootNode;

            var sras            = options.SraAccession.Split(',');
            var sras_se         = options.SraAccessionSingleEnd.Split(',');
            var fqs             = options.Fastq1.Split(',') ?? Array.Empty <string>();
            var fqs_se          = options.Fastq1SingleEnd.Split(',') ?? Array.Empty <string>();
            var analysisStrings = new List <string>();

            if (options.AnalyzeVariants)
            {
                analysisStrings.Add("variant");
            }
            if (options.AnalyzeIsoforms)
            {
                analysisStrings.Add("isoform");
            }
            if (options.Quantify)
            {
                analysisStrings.Add("quant");
            }

            // write user input paired-end sras
            YamlSequenceNode accession = new();

            rootMappingNode.Add("sra", AddParam(sras, accession));

            // write user input paired-end sras
            YamlSequenceNode accession_se = new();

            rootMappingNode.Add("sra_se", AddParam(sras_se, accession_se));

            // write user input paired-end fastqs
            YamlSequenceNode fq = new();

            rootMappingNode.Add("fq", AddParam(fqs, fq));

            // write user input paired-end fastqs
            YamlSequenceNode fq_se = new();

            rootMappingNode.Add("fq_se", AddParam(fqs_se, fq_se));

            // write user defined analysis directory (input and output folder)
            YamlSequenceNode analysisDirectory = new();

            analysisDirectory.Style = SequenceStyle.Flow;
            analysisDirectory.Add(analysisDirectoryStr);
            rootMappingNode.Add("analysisDirectory", analysisDirectory);

            // process reference string
            var reference = options.Reference.Split(',');

            if (reference.Length != 4)
            {
                throw new SpritzException($"Error: the reference string \"{reference}\" does not have four comma-separated elements corresponding to a line from genomes.csv.");
            }
            string releaseStr   = reference[0];
            string speciesStr   = reference[1];
            string organismStr  = reference[2];
            string referenceStr = reference[3];

            // write ensembl release
            YamlScalarNode release = new(releaseStr[8..]);