/// <summary> /// /// </summary> /// <param name="ftp"></param> /// <param name="dbFilename"></param> /// <param name="overwrite"></param> private void GetAndPrepareBlastDB(string ftp, string dbFilename, bool overwrite) { Console.Write("Downloading {0} from {0}...", dbFilename, ftp); var status = BlastLocalHandler.DownloadFasta(ftp, dbFilename, qcm.ContaminationFinder.Blaster.BlastDbPath, overwrite); Console.WriteLine("status {0}", status); // FastqFormat FASTA to BLAST database string fastaFile = qcm.ContaminationFinder.Blaster.BlastDbPath + "/" + dbFilename; string resultStdOut, resultStdErr; BlastLocalHandler.MakeBlastDb(fastaFile, qcm.ContaminationFinder.Blaster.BlastDbPath, "nucl", out resultStdOut, out resultStdErr); Console.Write(resultStdOut); Console.Error.Write(resultStdErr); }
/// <summary> /// Parse command line arguments /// </summary> /// <param name="args"></param> /// <returns></returns> static CommandLineOptions ProcessCommandLine(string[] args) { CommandLineOptions myArgs = new CommandLineOptions(); CommandLineArguments parser = new CommandLineArguments(); AddParameters(parser); try { parser.Parse(args, myArgs); } catch (Exception e) { Console.Error.WriteLine("\nException while processing command line arguments [{0}]", e.Message); Environment.Exit(-1); } if (myArgs.help) { string[] validFastqFormats = BioHelper.QueryValidFastqFormats(); string helpString = "Usage: SeqcosUtil.exe [options] <input file>\n" + "\nDescription: Evaluates the quality of sequencing reads and summarizes\n" + " the results in the form of text and plots. BLAST may be optionally performed\n" + " against a custom database (i.e. when looking for sequence contamination)." + "\n\n/help (/h)\n Show this help information" + "\n\n/silent (/s)\n Show less details displayed in the console" + "\n\n/FastQFormat (/q)\n Required for FASTQ input files. Choose from [" + string.Join(",", validFastqFormats) + "]" + "\n\n/OutputDirectory:<string> (/o)\n The name of the output directory where all output files will be saved. Relative/Absolute paths are not currently supported." + "\n\n/UseExcelHyperlinks (/e)\n Outputs Excel-formatted hyperlinks in the csv file" + "\n\n\n*** BLAST Options ***\n" + "\n\n/ExecuteBlast (/B)\n Perform a BLAST of the input sequences against a custom database. Windows NCBI BLAST must be installed first" + "\n\n/BlastDbPrefix:<string> (/D)\n Database to use for BLAST. The default is UniVec (http://www.ncbi.nlm.nih.gov/VecScreen/UniVec.html)" + "\n\n/BlastSize:<int> (/S)\n Limit the number of sequences to be searched by BLAST. Default is " + Resource.BLAST_MAX_SEQUENCES_DEFAULT + "." ; Console.WriteLine(helpString); Environment.Exit(-1); } // Process all the arguments for correctness if (!File.Exists(myArgs.InputFile)) { Console.Error.WriteLine("The file {0} could not be found.", myArgs.InputFile); Environment.Exit(-1); } if (myArgs.OutputDirectory == null) { myArgs.OutputDirectory = Path.GetFileNameWithoutExtension(myArgs.InputFile); } if (!Directory.Exists(myArgs.OutputDirectory)) { Directory.CreateDirectory(myArgs.OutputDirectory); } if (myArgs.ExecuteBlast) { // check to make sure Windows BLAST is installed if (!BlastLocalHandler.IsLocalBLASTInstalled(BlastLocalHandler.BlastVersion)) { Console.Error.WriteLine("Unable to find {0} in your PATH environment variable. Please check that BLAST is correctly installed."); Environment.Exit(-1); } if (myArgs.BlastSize < 0) { Console.Error.WriteLine("/BlastSize must be greater than 0."); Environment.Exit(-1); } } return(myArgs); }