Exemple #1
0
        public void TwoPartialOverlappingSegments_ReturnsThreeSegments()
        {
            var sample1SegmentationResults = new GenomeSegmentationResults(new Dictionary <string, Segment[]>
            {
                ["chr1"] = new[] { new Segment {
                                       start = 0, end = 200
                                   } }
            });
            var sample2SegmentationResults = new GenomeSegmentationResults(new Dictionary <string, Segment[]>
            {
                ["chr1"] = new[] { new Segment {
                                       start = 100, end = 300
                                   } }
            });

            var segmentationResults =
                GenomeSegmentationResults.SplitOverlappingSegments(sample1SegmentationResults.Yield().Concat(sample2SegmentationResults).ToList());

            var expectedSegmentationResults = new GenomeSegmentationResults(new Dictionary <string, Segment[]>
            {
                ["chr1"] = new[] { new Segment {
                                       start = 0, end = 100
                                   }, new Segment {
                                       start = 100, end = 200
                                   }, new Segment {
                                       start = 200, end = 300
                                   } }
            });

            AssertEqualSegmentations(expectedSegmentationResults, segmentationResults);
        }
Exemple #2
0
        public void SingleSamplesReturnsSameSegments()
        {
            var sampleSegmentationResults = new GenomeSegmentationResults(new Dictionary <string, Segment[]>
            {
                ["chr1"] = new[] { new Segment {
                                       start = 1, end = 200
                                   } }
            });

            var segmentationResults =
                GenomeSegmentationResults.SplitOverlappingSegments(sampleSegmentationResults.Yield().ToList());

            AssertEqualSegmentations(sampleSegmentationResults, segmentationResults);
        }
Exemple #3
0
        public void IdenticalSegmentsReturnsOneCopy()
        {
            var sample1SegmentationResults = new GenomeSegmentationResults(new Dictionary <string, Segment[]>
            {
                ["chr1"] = new[] { new Segment {
                                       start = 1, end = 200
                                   } }
            });
            var sample2SegmentationResults = new GenomeSegmentationResults(new Dictionary <string, Segment[]>
            {
                ["chr1"] = new[] { new Segment {
                                       start = 1, end = 200
                                   } }
            });

            var segmentationResults =
                GenomeSegmentationResults.SplitOverlappingSegments(sample1SegmentationResults.Yield().Concat(sample2SegmentationResults).ToList());

            AssertEqualSegmentations(sample1SegmentationResults, sample2SegmentationResults);
            AssertEqualSegmentations(sample1SegmentationResults, segmentationResults);
        }
Exemple #4
0
        public void CanHandleMultipleChromosomes()
        {
            var sample1SegmentationResults = new GenomeSegmentationResults(new Dictionary <string, Segment[]>
            {
                ["chr1"] = new[] { new Segment {
                                       start = 0, end = 100
                                   } },
                ["chr2"] = new[] { new Segment {
                                       start = 300, end = 400
                                   } }
            });
            var sample2SegmentationResults = new GenomeSegmentationResults(new Dictionary <string, Segment[]>
            {
                ["chr1"] = new[] { new Segment {
                                       start = 100, end = 200
                                   } },
                ["chr2"] = new[] { new Segment {
                                       start = 500, end = 600
                                   } }
            });

            var segmentationResults =
                GenomeSegmentationResults.SplitOverlappingSegments(sample1SegmentationResults.Yield().Concat(sample2SegmentationResults).ToList());

            var expectedSegmentationResults = new GenomeSegmentationResults(new Dictionary <string, Segment[]>
            {
                ["chr1"] = new[] { new Segment {
                                       start = 0, end = 100
                                   }, new Segment {
                                       start = 100, end = 200
                                   } },
                ["chr2"] = new[] { new Segment {
                                       start = 300, end = 400
                                   }, new Segment {
                                       start = 500, end = 600
                                   } }
            });

            AssertEqualSegmentations(expectedSegmentationResults, segmentationResults);
        }
Exemple #5
0
        public void RecurringBoundariesAreUniquified()
        {
            var sample1SegmentationResults = new GenomeSegmentationResults(new Dictionary <string, Segment[]>
            {
                ["chr1"] = new[] { new Segment {
                                       start = 1, end = 300
                                   } }
            });
            var sample2SegmentationResults = new GenomeSegmentationResults(new Dictionary <string, Segment[]>
            {
                ["chr1"] = new[] { new Segment {
                                       start = 1, end = 200
                                   }, new Segment {
                                       start = 200, end = 300
                                   } }
            });
            var sample3SegmentationResults = new GenomeSegmentationResults(new Dictionary <string, Segment[]>
            {
                ["chr1"] = new[] { new Segment {
                                       start = 1, end = 200
                                   }, new Segment {
                                       start = 200, end = 300
                                   } }
            });

            var segmentationResults =
                GenomeSegmentationResults.SplitOverlappingSegments(sample1SegmentationResults.Yield().Concat(sample2SegmentationResults).ToList());

            var expectedSegmentationResults = new GenomeSegmentationResults(new Dictionary <string, Segment[]>
            {
                ["chr1"] = new[] { new Segment {
                                       start = 1, end = 200
                                   }, new Segment {
                                       start = 200, end = 300
                                   } }
            });

            AssertEqualSegmentations(expectedSegmentationResults, segmentationResults);
        }
Exemple #6
0
        public void OneSegmentOverlappingManySegments_ReturnsUnionOfBreakpoints()
        {
            var sample1SegmentationResults = new GenomeSegmentationResults(new Dictionary <string, Segment[]>
            {
                ["chr1"] = new[]
                {
                    new Segment {
                        start = 0, end = 600
                    }
                }
            });
            var sample2SegmentationResults = new GenomeSegmentationResults(new Dictionary <string, Segment[]>
            {
                ["chr1"] = new[]
                {
                    new Segment {
                        start = 100, end = 200
                    },
                    new Segment {
                        start = 200, end = 300
                    },
                    new Segment {
                        start = 500, end = 700
                    },
                    new Segment {
                        start = 800, end = 900
                    }
                }
            });

            var segmentationResults =
                GenomeSegmentationResults.SplitOverlappingSegments(sample1SegmentationResults.Yield().Concat(sample2SegmentationResults).ToList());

            var expectedSegmentationResults = new GenomeSegmentationResults(new Dictionary <string, Segment[]>
            {
                ["chr1"] = new[]
                {
                    new Segment {
                        start = 0, end = 100
                    },
                    new Segment {
                        start = 100, end = 200
                    },
                    new Segment {
                        start = 200, end = 300
                    },
                    new Segment {
                        start = 300, end = 500
                    },
                    new Segment {
                        start = 500, end = 600
                    },
                    new Segment {
                        start = 600, end = 700
                    },
                    new Segment {
                        start = 800, end = 900
                    }
                }
            });

            AssertEqualSegmentations(expectedSegmentationResults, segmentationResults);
        }