static int GenomeAlignmentFromCmd(string[] args) { string keyFilePath = args[0]; string rCmapFilePath = args[1]; string outputDirPath = args[2]; int projectId = int.Parse(args[3]); float lengthFilter = float.Parse(args[4]) * 1000; float confidenceFilter = float.Parse(args[5]); float alignedLenPercentFilter = float.Parse(args[6]); string queryLocation = args[7]; bool saveChannel1 = int.Parse(args[8]) == 1 ? true : false; bool saveChannel2 = int.Parse(args[9]) == 1 ? true : false; int readKeyChroms = CMAPParser.ReadKeyFile(keyFilePath); Tuple <List <int>, List <Tuple <int, int, int> > > locations = UserInputParser.getLocations(queryLocation, null); List <int> chromIdsFilter = locations.Item1; List <Tuple <int, int, int> > chromStartEndFilter = locations.Item2; CMAPParser.rCmapPositions = CMAPParser.ParseCmap(rCmapFilePath, 1); List <Molecule> selectedMolecules = DatabaseManager.SelectMoleculesForGenomeAlignment(projectId, lengthFilter, confidenceFilter, alignedLenPercentFilter, null, chromIdsFilter, chromStartEndFilter); foreach (Molecule molecule in selectedMolecules) { CMAPParser.FitMoleculeToRef(molecule, saveChannel1, saveChannel2, outputDirPath); } return(0); }
private void filterMolecules_Click(object sender, EventArgs e) { alignmentFilter = aligned_filter_ckbx.Checked ? 1 : 0; lengthFilter = String.IsNullOrEmpty(min_len_txtbx.Text) ? 0 : float.Parse(min_len_txtbx.Text) * 1000; confidenceFilter = String.IsNullOrEmpty(min_conf_txtbx.Text) ? 0 : float.Parse(min_conf_txtbx.Text); alignedLenPercentFilter = String.IsNullOrEmpty(min_aligned_len_txtbx.Text) ? 0 : float.Parse(min_aligned_len_txtbx.Text); molIdsFilterArray = null; chromIdsFilter = null; chromStartEndFilter = null; if (!String.IsNullOrEmpty(mols_ids_txtbx.Text) && !String.IsNullOrEmpty(mol_ids_file_path_txtbx.Text)) { MessageBox.Show("For molecule IDs filter either input into the text box, or upload a file, but not both", "Error parsing filter options"); return; } if (!String.IsNullOrEmpty(mols_ids_txtbx.Text) || !String.IsNullOrEmpty(mol_ids_file_path_txtbx.Text)) { molIdsFilterArray = UserInputParser.getMolIds(mols_ids_txtbx.Text, mol_ids_file_path_txtbx.Text); if (molIdsFilterArray == null) { MessageBox.Show("Can't open molecule IDs file", "Error parsing filter options"); return; } } if (!String.IsNullOrEmpty(mol_locations_txtbx.Text) && !String.IsNullOrEmpty(mol_locations_file_path_txtbx.Text)) { MessageBox.Show("For molecule locations filter either input into the text box, or upload a file, but not both", "Error parsing filter options"); return; } if (!String.IsNullOrEmpty(mol_locations_txtbx.Text) || !String.IsNullOrEmpty(mol_locations_file_path_txtbx.Text)) { if (String.IsNullOrEmpty(key_file_path_txtbx.Text)) { MessageBox.Show("For molecule locations filter you must supply a key file", "Error parsing filter options"); return; } else //file and lines are present, parse the input { int readKeyChroms = CMAPParser.ReadKeyFile(key_file_path_txtbx.Text); //reading the key file to translate chromosome names to IDs, becaues chromosomes are saved as IDs in DB if (readKeyChroms == -1) { MessageBox.Show("Can't open specified key file", "Error opening file"); return; } else { //get the locations from user input Tuple <List <int>, List <Tuple <int, int, int> > > locations = UserInputParser.getLocations(mol_locations_txtbx.Text, mol_locations_file_path_txtbx.Text); chromIdsFilter = locations.Item1; chromStartEndFilter = locations.Item2; } } } }
private void get_output_button_Click(object sender, EventArgs e) { Stopwatch stopwatch = new Stopwatch(); string rCmapPath = r_cmap_file_path_txtbx.Text; string keyFilePath = key_file_path_txtbx2.Text; string outputDir = output_dir_txtbx.Text; if (String.IsNullOrEmpty(rCmapPath) || String.IsNullOrEmpty(keyFilePath)) { MessageBox.Show("r_cmap and key file required for analysis", "Missing file"); return; } if (String.IsNullOrEmpty(outputDir)) { MessageBox.Show("Missing output directory path", "Missing path"); return; } stopwatch.Start(); CMAPParser.rCmapPositions = CMAPParser.ParseCmap(rCmapPath, 1); if (CMAPParser.rCmapPositions == null) { MessageBox.Show("Unable to open file: " + rCmapPath, "Problem accessing file"); return; } int chroms = CMAPParser.ReadKeyFile(keyFilePath); if (chroms < 0) { MessageBox.Show("Unable to open file: " + keyFilePath, "Problem accessing file"); return; } List <Molecule> selectedMolecules = DatabaseManager.SelectMoleculesForGenomeAlignment(projectID, lengthFilter, confidenceFilter, alignedLenPercentFilter, molIdsFilterArray, chromIdsFilter, chromStartEndFilter); foreach (Molecule molecule in selectedMolecules) { CMAPParser.FitMoleculeToRef(molecule, save_ch1_checkbx.Checked, save_ch2_checkbx.Checked, outputDir); } MessageBox.Show(stopwatch.Elapsed.ToString()); }