public void UpdateRankSplit() { if (ProgramState.LoadedSamples) { ClearComboBox(rspTextOutputCombo); ClearComboBox(rspSequenceCombo); ClearComboBox(rspMethodCombo); ClearComboBox(rspGraphicalOutputCombo); ClearComboBox(rspSampleCombo); ClearComboBox(rspSequenceForCombo); RankSplitMethods = RankSplit.GetRelevantMethods(); RankSplitGraphOut = RankSplit.GetRelevantOutputGraph(); RankSplitTextOut = RankSplit.GetRelevantOutputText(); RankSplitSamples = RankSplit.GetRelevantSamples(); RankSplitGraphToTypes = RankSplit.GetGraphTypes(); RankSplitGraphDesc = RankSplit.GetRelevantGraphTypes(); List <string> seqFet = RankSplit.GetRelevantFeatures(); foreach (KeyValuePair <string, BioSample> kvp in RankSplitSamples) { rspSampleCombo.AppendText(kvp.Key); } foreach (KeyValuePair <string, RankMethod> kvp in RankSplitMethods) { rspMethodCombo.AppendText(kvp.Key); } foreach (KeyValuePair <string, OutputMethGraph> kvp in RankSplitGraphOut) { rspGraphicalOutputCombo.AppendText(kvp.Key); } foreach (KeyValuePair <string, OutputMethText> kvp in RankSplitTextOut) { rspTextOutputCombo.AppendText(kvp.Key); } foreach (string st in seqFet) { rspSequenceCombo.AppendText(st); } foreach (string st in seqFet) { rspSequenceForCombo.AppendText(st); } } }
protected RankSplitInfo GatherRankSplitInfo(bool isGraph) { RankMethod m; OutputMethGraph omg; OutputMethText omt; GraphType gt; string feature; string feature2; try{ m = RankSplitMethods [rspMethodCombo.ActiveText]; omg = OutputMethGraph.Expr; omt = OutputMethText.BaseSeq; gt = RankSplitGraphDesc[rspGraphTypeCombo.ActiveText]; if (isGraph) { omg = RankSplitGraphOut [rspGraphicalOutputCombo.ActiveText]; } else { omt = RankSplitTextOut [rspTextOutputCombo.ActiveText]; } } catch (Exception e) { throw new Exception("You need to select an option from the combo menu!"); } feature = rspSequenceCombo.ActiveText; feature2 = rspSequenceForCombo.ActiveText; bool seqFeaturePass = false; bool seqFeature2Pass = false; foreach (string st in RankSplit.GetRelevantFeatures()) { if (st == feature) { seqFeaturePass = true; } if (st == feature2) { seqFeature2Pass = true; } } if (!seqFeaturePass || !seqFeature2Pass) { throw new Exception("You need to choose two features to look at\n they can be the same!"); } RankSplitInfo rsi; if (!rspSubDivideCheck.Active) { if (isGraph) { rsi = new RankSplitInfo(m, omg, feature); } else { rsi = new RankSplitInfo(m, omt, feature); } } else { if (rspBaseCountRadio.Active) { int bases; if (!int.TryParse(rspNoBaseEntry.Text, out bases)) { throw new Exception("Input -> Unable To Parse Base Count!"); } if (bases > 5000) { throw new Exception("Input -> Maximum Number of bases is 5000!"); } bool doStart = true; if (rspToEndRadio.Active) { doStart = false; } if (isGraph) { rsi = new RankSplitInfo(m, omg, feature, bases, doStart); } else { rsi = new RankSplitInfo(m, omt, feature, bases, doStart); } } else { int stDiv; int edDiv; if (!int.TryParse(rspStartDivEntry.Text, out stDiv)) { throw new Exception("Input -> Unable to Parse Start Division!"); } if (!int.TryParse(rspEndDivEntry.Text, out edDiv)) { throw new Exception("Input -> Unable to Parse End Division!"); } if (stDiv >= edDiv) { throw new Exception("Input -> Start division must be smaller than end!"); } if (stDiv > 20 || edDiv > 20) { throw new Exception("Input -> Division limit is 20."); } if (isGraph) { rsi = new RankSplitInfo(m, omg, feature, stDiv, edDiv); } else { rsi = new RankSplitInfo(m, omt, feature, stDiv, edDiv); } } } rsi.SeqFeature2 = feature2; rsi.GraphingType = gt; if (rspSubDivideCheck2.Active) { rsi.doSubSeqOut = true; if (rspPickNormaliseRadio2.Active) { rsi.SeqDivOut = SubSequenceDivision.Normalised; int stDiv2; int edDiv2; if (!int.TryParse(rspStartDivEntry2.Text, out stDiv2)) { throw new Exception("Output -> Unable to Parse Start Division!"); } if (!int.TryParse(rspEndDivEntry2.Text, out edDiv2)) { throw new Exception("Output -> Unable to Parse End Division!"); } if (stDiv2 >= edDiv2) { throw new Exception("Output -> Start division must be smaller than end!"); } if (stDiv2 > 20 || edDiv2 > 20) { throw new Exception("Output -> Division limit is 20."); } rsi.divStartOut = stDiv2; rsi.divEndOut = edDiv2; } else { rsi.SeqDivOut = SubSequenceDivision.AbsoluteBases; int bases2; if (!int.TryParse(rspNoBaseEntry2.Text, out bases2)) { throw new Exception("Output -> Unable To Parse Base Count!"); } if (bases2 > 5000) { throw new Exception("Output -> Maximum Number of bases is 5000!"); } bool doStart2 = true; if (rspToEndRadio2.Active) { doStart2 = false; } rsi.baseCountOut = bases2; rsi.fromStartOut = doStart2; } } int splitInt; if (!int.TryParse(rspRankDivEntry.Text, out splitInt)) { throw new Exception("Rank Division - please enter a positive integer."); } rsi.SplitCount = splitInt; if (rspDoSubDivCheck.Active) { rsi.doSubSet = true; if (rspSubDivNextRadio.Active) { rsi.SubSetType = SubSetMethod.Current; int mainRank; int splitRank; if (!int.TryParse(rspSubTakeGroupEntry.Text, out mainRank)) { throw new Exception("Unable to parse Sub-Set 'take group' entry, please enter a positive integer."); } if (!int.TryParse(rspSubAndSplitEntry.Text, out splitRank)) { throw new Exception("Unable to parse Sub-Set 'and split' entry, please enter a positive integer."); } if (mainRank > rsi.SplitCount) { throw new Exception("'Take Group' value must be lower than or equal to the split count."); } else if (mainRank < 1) { throw new Exception("'Take Group' value too low, please enter a positive integer."); } if (splitRank < 1) { throw new Exception("'And Split' value too low, please enter a positive integer."); } rsi.subCurMainRank = mainRank; rsi.subCurSplitCount = splitRank; } else { rsi.SubSetType = SubSetMethod.Previous; int fromGroup; int toGroup; if (!int.TryParse(rspSubFromGroupEntry.Text, out fromGroup)) { throw new Exception("Unable to parse Sub-Set 'from group' entry, please enter a positive integer."); } if (!int.TryParse(rspSubToGroupEntry.Text, out toGroup)) { throw new Exception("Unable to parse Sub-Set 'to group' entry, please enter a positive integer."); } if (fromGroup > OldRSPSize) { throw new Exception("'From Group' must be lower than or equal to the previous Split-Count"); } if (toGroup > OldRSPSize) { throw new Exception("'To Group' must be lower than or equal to the previous Split-Count"); } if (toGroup < fromGroup) { throw new Exception("'To Group' should be higher than or equal to 'From Group'"); } rsi.subOldEndRank = toGroup; rsi.subOldStartRank = fromGroup; rsi.oldIDlist = RSPGetOldIDList(fromGroup, toGroup); } } else { rsi.doSubSet = false; rsi.SubSetType = SubSetMethod.None; } if (rspMergeGraphCheck.Active) { rsi.MergeGraphs = true; } else { rsi.MergeGraphs = false; } try { rsi.sample = rspSampleCombo.ActiveText; } catch (Exception e) { throw new Exception("You need to select one or all samples from the drop-down menu!"); } OldRSPSize = rsi.SplitCount; rspMergeGraphCheck.Active = false; return(rsi); }