public static Dictionary <string, MotifCounter> MotifDistinctWithCount(List <ProproteinInterfaceSpreadsheetRecord> proproteinInterfaceSpreadsheetRecordList) { if (proproteinInterfaceSpreadsheetRecordList == null) { throw new ArgumentNullException(nameof(proproteinInterfaceSpreadsheetRecordList)); } var result = new Dictionary <string, MotifCounter>(); foreach (var record in proproteinInterfaceSpreadsheetRecordList) { var motifs = record.Motifs().Distinct().ToArray(); foreach (var motif in motifs) { if (!result.ContainsKey(motif)) { var motifCounter = new MotifCounter() { Motif = motif, MotifTooGeneral = ProproteinInterfaceMotif.IsMotifTooGeneral(motif), TotalFwd = 0, TotalRev = 0, TotalMix = 0, }; result.Add(motif, motifCounter); } if (record.Direction == "Fwd") { result[motif].TotalFwd++; } else if (record.Direction == "Rev") { result[motif].TotalRev++; } else if (record.Direction == "Mix") { result[motif].TotalMix++; } } } return(result); }