public ViewInfo ConvertFromDocumentView(ViewInfo viewInfo, ref IEnumerable <PropertyPath> propertyPaths)
        {
            if (viewInfo.ParentColumn.PropertyType != typeof(SkylineDocument))
            {
                return(viewInfo);
            }
            var viewSpec = viewInfo.GetViewSpec();
            IList <KeyValuePair <PropertyPath, PropertyPath> > mapping;
            Type newType;

            if (AnyColumnsWithPrefix(viewSpec, PeptidesPrecursorsTransitions))
            {
                mapping = ReverseMapping(MappingFromTransitions());
                newType = typeof(Entities.Transition);
            }
            else if (AnyColumnsWithPrefix(viewSpec, PeptidesPrecursors))
            {
                mapping = ReverseMapping(MappingFromPrecursors());
                newType = typeof(Precursor);
            }
            else if (AnyColumnsWithPrefix(viewSpec, Peptides))
            {
                mapping = ReverseMapping(MappingFromPeptides());
                newType = typeof(Entities.Peptide);
            }
            else if (AnyColumnsWithPrefix(viewSpec, Proteins))
            {
                mapping = ReverseMapping(MappingFromProteins());
                newType = typeof(Protein);
            }
            else if (AnyColumnsWithPrefix(viewSpec, Replicates))
            {
                mapping = ReverseMapping(MappingFromReplicates());
                newType = typeof(Replicate);
            }
            else
            {
                return(viewInfo);
            }
            viewSpec = MapViewSpec(mapping, viewSpec, newType);
            if (null != propertyPaths)
            {
                propertyPaths = propertyPaths.Select(path => MapPropertyPath(mapping, path));
            }
            if (Equals(viewSpec.SublistId, SkylineViewContext.GetReplicateSublist(typeof(SkylineDocument))))
            {
                viewSpec = viewSpec.SetSublistId(SkylineViewContext.GetReplicateSublist(newType));
            }
            return(new ViewInfo(viewInfo.DataSchema, newType, viewSpec));
        }
        public ViewInfo MakeIntoDocumentView(ViewInfo viewInfo, ref IEnumerable <PropertyPath> propertyPaths)
        {
            IList <KeyValuePair <PropertyPath, PropertyPath> > mapping;

            if (viewInfo.ParentColumn.PropertyType == typeof(Entities.Peptide))
            {
                mapping = MappingFromPeptides();
            }
            else if (viewInfo.ParentColumn.PropertyType == typeof(Precursor))
            {
                mapping = MappingFromPrecursors();
            }
            else if (viewInfo.ParentColumn.PropertyType == typeof(Entities.Transition))
            {
                mapping = MappingFromTransitions();
            }
            else if (viewInfo.ParentColumn.PropertyType == typeof(Protein))
            {
                mapping = MappingFromProteins();
            }
            else if (viewInfo.ParentColumn.PropertyType == typeof(Replicate))
            {
                mapping = MappingFromReplicates();
            }
            else
            {
                return(viewInfo);
            }
            var viewSpec = viewInfo.GetViewSpec();

            viewSpec = MapViewSpec(mapping, viewSpec, typeof(SkylineDocument));
            if (null != propertyPaths)
            {
                propertyPaths = ImmutableList.ValueOf(propertyPaths.Select(path => MapPropertyPath(mapping, path)));
            }
            if (Equals(viewSpec.SublistId, SkylineViewContext.GetReplicateSublist(viewInfo.ParentColumn.PropertyType)))
            {
                viewSpec = viewSpec.SetSublistId(SkylineViewContext.GetReplicateSublist(typeof(SkylineDocument)));
            }
            return(new ViewInfo(viewInfo.DataSchema, typeof(SkylineDocument), viewSpec));
        }