public void InitEventCountList(bool orderByCount = true) { var map = new Dictionary <string, EventCount>(); foreach (var e in this) { EventCount ec; if (map.TryGetValue(e.Event, out ec)) { ec.Count++; } else { ec = new EventCount(e.Event, 1); map[e.Event] = ec; } } if (orderByCount) { _eventCountList = (from ec in map.Values orderby ec.Count descending select ec).ToList(); } else { _eventCountList = (from ec in map.Values orderby ec.Event select ec).ToList(); } }
public void InitEventCountList(int minimumMappingQuality, bool orderByCount = true) { var map = new Dictionary <string, EventCount>(); foreach (var e in this) { if (!e.PassScoreFilter(minimumMappingQuality)) { continue; } EventCount ec; if (map.TryGetValue(e.Event, out ec)) { ec.Count++; } else { ec = new EventCount(e.Event, 1); map[e.Event] = ec; } } if (orderByCount) { _eventCountList = (from ec in map.Values orderby ec.Count descending select ec).ToList(); } else { _eventCountList = (from ec in map.Values orderby ec.Event select ec).ToList(); } }