/// <summary> /// Returns candidates for grouping by annotation by the annotation target. (usually replicates) /// </summary> public static string[] FindGroupsByTarget(SrmSettings settings, AnnotationDef.AnnotationTarget target) { var replicateAnnotations = settings.DataSettings.AnnotationDefs .Where(annotationDef => annotationDef.AnnotationTargets.Contains(target)); return(replicateAnnotations.Select(a => a.Name).ToArray()); }
public static Type RowTypeFromAnnotationTarget(AnnotationDef.AnnotationTarget annotationTarget) { switch (annotationTarget) { case AnnotationDef.AnnotationTarget.protein: return(typeof(Protein)); case AnnotationDef.AnnotationTarget.peptide: return(typeof(Databinding.Entities.Peptide)); case AnnotationDef.AnnotationTarget.precursor: return(typeof(Precursor)); case AnnotationDef.AnnotationTarget.transition: return(typeof(Databinding.Entities.Transition)); case AnnotationDef.AnnotationTarget.replicate: return(typeof(Replicate)); case AnnotationDef.AnnotationTarget.precursor_result: return(typeof(PrecursorResult)); case AnnotationDef.AnnotationTarget.transition_result: return(typeof(TransitionResult)); default: return(null); } }
private Annotations AddAnnotations(Annotations annotations, AnnotationDef.AnnotationTarget annotationTarget) { annotations = annotations.ChangeAnnotation("Text", annotationTarget + ":" + _counter++); if (DocumentAnnotations.NOTE_TARGETS.Contains(annotationTarget)) { annotations = annotations.ChangeNote("Note" + _counter++); } annotations = annotations.ChangeAnnotation("Number", (_counter++ *.1).ToString(CultureInfo.InvariantCulture)); if (0 != (_elementCount & 2)) { _counter++; annotations = annotations.ChangeAnnotation("TrueFalse", "TrueFalse"); } annotations = annotations.ChangeAnnotation(GetAnnotationTargetName(annotationTarget), annotationTarget + ":" + _counter++); return(annotations); }
/// <summary> /// Remove annotations from the Annotations object which do not apply to the particular target, /// or are calculated. /// Also uses the StringPool to reduce duplicated strings. /// </summary> public Annotations ScrubAnnotations(Annotations annotations, AnnotationDef.AnnotationTarget target) { if (annotations.IsEmpty) { return(annotations); } var newAnnotations = annotations.ListAnnotations().AsEnumerable(); if (null != _validAnnotationNames) { var validNames = _validAnnotationNames[target]; newAnnotations = newAnnotations.Where(kvp => validNames.Contains(kvp.Key)); } newAnnotations = newAnnotations.Select(kvp => new KeyValuePair <string, string>( StringPool.GetString(kvp.Key), kvp.Value)); return(new Annotations(StringPool.GetString(annotations.Note), newAnnotations, annotations.ColorIndex)); }
public AnnotationTargetItem(AnnotationDef.AnnotationTarget annotationTarget, SrmDocument.DOCUMENT_TYPE modeUI) { AnnotationTarget = annotationTarget; ModeUI = modeUI; }
public AnnotationTargetAttribute(AnnotationDef.AnnotationTarget target) { AnnotationTarget = target; }
private string GetAnnotationTargetName(AnnotationDef.AnnotationTarget annotationTarget) { Assert.IsTrue(Enum.IsDefined(typeof(AnnotationDef.AnnotationTarget), annotationTarget)); return(annotationTarget.ToString()); }
public AnnotationTargetItem(AnnotationDef.AnnotationTarget annotationTarget) { AnnotationTarget = annotationTarget; }
/// <summary> /// Gets possible values for an annotation. /// </summary> public static string[] GetPossibleAnnotations(SrmSettings settings, string group, AnnotationDef.AnnotationTarget target) { var annotation = settings.DataSettings.AnnotationDefs.FirstOrDefault(annotationDef => annotationDef.AnnotationTargets.Contains(target) && annotationDef.Name == group); if (annotation == null) { return(new string[0]); } switch (annotation.Type) { case AnnotationDef.AnnotationType.text: case AnnotationDef.AnnotationType.number: return(settings.MeasuredResults == null ? new string[0] : settings.MeasuredResults.Chromatograms .Select(c => c.Annotations.GetAnnotation(group)).Distinct().Where(s => s != null).ToArray()); case AnnotationDef.AnnotationType.value_list: return(annotation.Items.ToArray()); case AnnotationDef.AnnotationType.true_false: return(new[] { Resources.AnnotationHelper_GetReplicateIndicices_True, Resources.AnnotationHelper_GetReplicateIndicices_False }); default: return(new string[0]); // Should never happen } }
private static void AddAnnotations(Configuration configuration, SrmSettings settings, AnnotationDef.AnnotationTarget annotationTarget, Type persistentClass) { var mapping = configuration.GetClassMapping(persistentClass); foreach (var annotationDef in settings.DataSettings.AnnotationDefs) { if (!annotationDef.AnnotationTargets.Contains(annotationTarget)) { continue; } string columnName = AnnotationDef.GetColumnName(annotationDef.Name); Type accessorType; switch (annotationDef.Type) { case AnnotationDef.AnnotationType.number: accessorType = typeof(NumberAnnotationPropertyAccessor); break; case AnnotationDef.AnnotationType.true_false: accessorType = typeof(BoolAnnotationPropertyAccessor); break; default: accessorType = typeof(AnnotationPropertyAccessor); break; } AddColumn(mapping, columnName, accessorType); } }