protected virtual void InitData()
            {
                List <DocNode>               docNodes       = new List <DocNode>();
                List <IdentityPath>          docNodePaths   = new List <IdentityPath>();
                List <List <PointPairList> > pointPairLists = new List <List <PointPairList> >();
                List <String> docNodeLabels = new List <string>();

                ReplicateGroups = new ReplicateGroup[0];
                foreach (var docNodePath in _selectedDocNodePaths)
                {
                    var nodeArray        = _document.ToNodeArray(docNodePath);
                    var docNode          = nodeArray.Last();
                    var replicateIndices = Enumerable.Range(0, _document.Settings.MeasuredResults.Chromatograms.Count);
                    // ReSharper disable CanBeReplacedWithTryCastAndCheckForNull
                    if (docNode is TransitionDocNode)
                    {
                        var nodeTran = (TransitionDocNode)docNode;
                        ReplicateGroups = GetReplicateGroups(replicateIndices).ToArray();
                        docNodes.Add(nodeTran);
                        docNodePaths.Add(docNodePath);
                        pointPairLists.Add(GetPointPairLists((PeptideDocNode)nodeArray[1], (TransitionGroupDocNode)nodeArray[2], nodeTran, _displayType));
                        docNodeLabels.Add(ChromGraphItem.GetTitle(nodeTran));
                    }
                    else if (docNode is TransitionGroupDocNode)
                    {
                        var nodeGroup      = (TransitionGroupDocNode)docNode;
                        var peptideDocNode = (PeptideDocNode)nodeArray[1];
                        ReplicateGroups = GetReplicateGroups(replicateIndices).ToArray();
                        if (_displayType == DisplayTypeChrom.single || _displayType == DisplayTypeChrom.total)
                        {
                            docNodes.Add(nodeGroup);
                            docNodePaths.Add(docNodePath);
                            pointPairLists.Add(GetPointPairLists(peptideDocNode, nodeGroup, _displayType));
                            docNodeLabels.Add(ChromGraphItem.GetTitle(nodeGroup));
                        }
                        else
                        {
                            foreach (TransitionDocNode nodeTran in GraphChromatogram.GetDisplayTransitions(nodeGroup,
                                                                                                           _displayType))
                            {
                                docNodes.Add(nodeTran);
                                docNodePaths.Add(new IdentityPath(docNodePath, nodeTran.Id));
                                pointPairLists.Add(GetPointPairLists(peptideDocNode, nodeGroup, nodeTran, _displayType));
                                docNodeLabels.Add(ChromGraphItem.GetTitle(nodeTran));
                            }
                        }
                    }
                    else if (docNode is PeptideDocNode)
                    {
                        var nodePep = (PeptideDocNode)docNode;
                        ReplicateGroups = GetReplicateGroups(replicateIndices).ToArray();
                        var isMultiSelect = _selectedDocNodePaths.Count > 1 ||
                                            (_selectedDocNodePaths.Count == 1 && Program.MainWindow != null &&
                                             Program.MainWindow.SelectedNode is PeptideGroupTreeNode);
                        foreach (var tuple in GetPeptidePointPairLists((PeptideGroupDocNode)nodeArray[0], nodePep, isMultiSelect))
                        {
                            docNodes.Add(tuple.Node);
                            docNodePaths.Add(docNodePath);
                            pointPairLists.Add(tuple.PointPairList);
                            docNodeLabels.Add(tuple.DisplaySeq);
                        }
                    }
                }
                // ReSharper restore CanBeReplacedWithTryCastAndCheckForNull
                PointPairLists = pointPairLists;
                DocNodes       = docNodes;
                _docNodePaths  = ImmutableList.ValueOf(docNodePaths);
                DocNodeLabels  = docNodeLabels;

                var oldGroupNames    = ReplicateGroups.Select(g => g.GroupName).ToArray();
                var uniqueGroupNames = oldGroupNames.Distinct().ToArray();

                // Instert "All" groups and point pair lists in their correct positions
                InsertAllGroupsAndPointPairLists(uniqueGroupNames, docNodes.Count);

                // Collect all references to points that have a valid Y value
                var references = CollectValidPointRefs(uniqueGroupNames, oldGroupNames, docNodes.Count);

                // Merge groups if their replicate index is the same and each peptide only occurs in one of the files
                MergeGroups(uniqueGroupNames, references);

                // Remove groups that don't have any peptides in them
                RemoveEmptyGroups(docNodes.Count);
            }