private void fireSelectionChanged(BindingList <ICompoundGroupItem> selectedCompounds) { IEnumerator <ICompoundGroupItem> enumerator = selectedCompounds.GetEnumerator(); ICompoundGroup obj = null; while (enumerator.MoveNext()) { ICompoundGroupItem temp = enumerator.Current; if (obj == null) { obj = temp.CompoundGroupInfo; } } EventAggregator.GetEvent <CompoundSelectionChanged>().Publish(obj); }
private void CompoundSelectionChanged(ICompoundGroup obj) { if (obj != null) { IDictionary <string, ICompound> sampleWiseDataDictionary = obj.SampleWiseDataDictionary; Dictionary <string, string> sampleGrouping = ExperimentContext.GetGrouping(); GroupColors = GetGroupColors(); PlotItems = new List <PlotItem>(); foreach (string sampleName in sampleWiseDataDictionary.Keys) { PlotItems.Add(new PlotItem(sampleName, sampleGrouping[sampleName], sampleWiseDataDictionary[sampleName])); } UpdatePlotControl(); } }
private void CompoundSelectionChanged(ICompoundGroup compoundGroupObject) { if (compoundGroupObject == null) { return; } IDictionary <string, ICompound> sampleWiseDataDictionary = compoundGroupObject.SampleWiseDataDictionary; Dictionary <string, string> sampleGrouping = ExperimentContext.GetGrouping(); GroupColors = GetGroupColors(); PlotItems = new List <PlotItem>(); foreach (string sampleName in sampleWiseDataDictionary.Keys) { PlotItems.Add(new PlotItem(sampleName, sampleGrouping[sampleName], sampleWiseDataDictionary[sampleName])); } DisplayMode = "List"; UpdatePlotControl(); }
private void CompoundGroupSelectionChanged(ICompoundGroup obj) { Compounds.Clear(); if (obj == null) { return; } IDictionary <string, ICompound> sampleWiseICompounds = obj.SampleWiseDataDictionary; if (sampleWiseICompounds == null) { return; } IEnumerator <ICompound> enumerator = sampleWiseICompounds.Values.GetEnumerator(); while (enumerator.MoveNext()) { Compounds.Add(enumerator.Current); } }
/// <summary> /// Test whether the compound group passes the threshold cutoff for a given compound ResultAttribute /// </summary> /// <param name="cg"></param> /// <param name="valueAttr"></param> /// <param name="threshold"></param> /// <returns></returns> private bool TestFilter(ICompoundGroup cg, ResultAttribute valueAttr, double threshold) { // set up algorithm specific filter parameters var filterMode = m_psetFilters.FrequencyGroupMFE; var freqMode = m_psetFilters.FrequencyFilterModeMFE; var freqMin = m_psetFilters.FrequencyMinMFE; var pctMin = m_psetFilters.FrequencyMinPctMFE; // get a structure of compound groups grouped by sample group var sgGroups = cg.GroupBy(kvp => m_sampleGroupDict[kvp.Key], kvp => kvp.Value); switch (filterMode) { case CpdGroupFilterMode.AllSamples: // the frequency pass cutoff must be met across all samples if (freqMode == CpdGroupFrequencyFilterMode.PctOfFiles) { freqMin = m_sampleGroupDict.Count * pctMin / 100; } return(cg.Values .Where(c => c.HasValue(valueAttr)) .Count(c => (double)c.Value(valueAttr) >= threshold) >= freqMin); case CpdGroupFilterMode.SamplesInEachGroup: // the frequency pass cutoff must be met within every sample group foreach (var sg in sgGroups) { var sgFreq = sg.Where(c => c.HasValue(valueAttr)) .Count(c => (double)c.Value(valueAttr) >= threshold); if (freqMode == CpdGroupFrequencyFilterMode.PctOfFiles) { freqMin = m_sampleGroupDict.Count(g => g.Value == sg.Key) * pctMin / 100; } if (sgFreq < freqMin) { return(false); } } return(true); case CpdGroupFilterMode.SamplesInOneGroup: // the frequence pass cutoff must be met within at least one sample group foreach (var sg in sgGroups) { var sgFreq = sg.Where(c => c.HasValue(valueAttr)) .Count(c => (double)c.Value(valueAttr) >= threshold); if (freqMode == CpdGroupFrequencyFilterMode.PctOfFiles) { freqMin = m_sampleGroupDict.Count(g => g.Value == sg.Key) * pctMin / 100; } if (sgFreq >= freqMin) { return(true); } } return(false); default: return(true); } }
/// <summary> /// Initializes a new instance of the <see cref="CompoundGroupItem"/> class. /// </summary> /// <param name="compoundGroup"></param> public CompoundGroupItem(ICompoundGroup compoundGroup) { this.CompoundGroupInfo = compoundGroup; }