public void QueryValidFastqFormatsTest() { string[] expected = new string[] { "Illumina", "Solexa", "Sanger" }; string[] actual; actual = BioHelper.QueryValidFastqFormats(); Assert.AreEqual(expected.Length, actual.Length); foreach (string format in actual) { Assert.IsTrue(expected.Any(s => s.Equals(format))); } }
/// <summary> /// Constructor for OpenFileDialog /// </summary> /// <param name="fileTypes">List of valid file types</param> public OpenFileDialog(List <string> fileTypes) { InitializeComponent(); this.btnBrowse.Focus(); #region Parser type combo box // Populate the parser type combo box ComboBoxItem defaultItem = new ComboBoxItem(); defaultItem.Content = Resource.MANUAL_CHOICE; this.comboParserType.Items.Add(defaultItem); Collection <string> validParsers = new Collection <string>(); validParsers.Add(SequenceParsers.FastQ.Name); validParsers.Add(SequenceParsers.Fasta.Name); foreach (var parserName in validParsers) { ComboBoxItem item = new ComboBoxItem(); item.Content = parserName; item.Tag = parserName; this.comboParserType.Items.Add(item); } this.comboParserType.SelectedIndex = 0; this.fileTypes = fileTypes; #endregion #region FASTQ format combo box defaultItem = new ComboBoxItem(); defaultItem.Content = Resource.MANUAL_CHOICE; this.comboFastqType.Items.Add(defaultItem); string[] validFormats = BioHelper.QueryValidFastqFormats(); foreach (var format in validFormats) { ComboBoxItem item = new ComboBoxItem(); item.Content = format; item.Tag = format; this.comboFastqType.Items.Add(item); } this.comboFastqType.SelectedIndex = 0; #endregion #region BLAST database combo box this.availableBlastDatabases = new List <string> (); // query for available BLAST databases List <string> databases = BlastTools.QueryAvailableBlastDatabases(); foreach (var db in databases) { ComboBoxItem item = new ComboBoxItem(); item.Content = db; item.Tag = db; this.comboBlastDb.Items.Add(item); } this.comboBlastDb.SelectedIndex = 0; #endregion }
/// <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); }