Exemplo n.º 1
0
        public void GetFirstVariantPosition_multi_chrom_index()
        {
            var index = new JasixIndex();

            index.Add("chr1", 100, 101, 100000);
            index.Add("chr1", 105, 109, 100050);
            index.Add("chr1", 160, 166, 100100);
            index.Add("chr2", 100, 100, 100150);
            index.Add("chr2", 102, 105, 100200);

            index.Flush();

            var chrPos = Utilities.ParseQuery("chr1");

            Assert.Equal(100000, index.GetFirstVariantPosition(chrPos.Item1, chrPos.Item2, chrPos.Item3));

            chrPos = Utilities.ParseQuery("chr2");
            Assert.Equal(100150, index.GetFirstVariantPosition(chrPos.Item1, chrPos.Item2, chrPos.Item3));
        }
Exemplo n.º 2
0
        public void FindLargeVaritants_method_does_not_return_small_variants()
        {
            var index = new JasixIndex();

            index.Add("chr1", 100, 101, 100_000);
            index.Add("chr1", 105, 109, 100_050);
            index.Add("chr1", 160, 166, 100_100);
            index.Add("chr1", 200, 1000, 100_075);//large variant
            index.Add("chr2", 100, 100, 100_150);
            index.Add("chr2", 102, 105, 100_200);

            index.Flush();

            //checking large variants
            Assert.Null(index.LargeVariantPositions("chr1", 100, 199));
            var largeVariants = index.LargeVariantPositions("chr1", 100, 201);

            Assert.NotNull(largeVariants);
            Assert.Single(largeVariants);
            Assert.Equal(100075, largeVariants[0]);
        }
Exemplo n.º 3
0
        public void Add_fill_node_and_start_another()
        {
            var index = new JasixIndex();

            //creating two nodes each containing 50 entries
            for (var i = 0; i < 2 * JasixCommons.PreferredNodeCount; i++)
            {
                index.Add("chr1", 100 + i, 101 + i, 100_000 + i);
            }

            index.Add("chr1", 160 + 2 * JasixCommons.PreferredNodeCount, 166 + 2 * JasixCommons.PreferredNodeCount, 200_100);
            index.Add("chr2", 100, 100, 200_150);
            index.Add("chr2", 102, 105, 200_200);

            index.Flush();

            Assert.Equal(100_000, index.GetFirstVariantPosition("chr1", 100, 102));
            Assert.Equal(100_000 + JasixCommons.PreferredNodeCount, index.GetFirstVariantPosition("chr1", 2 * JasixCommons.PreferredNodeCount + 55, 2 * JasixCommons.PreferredNodeCount + 55));
            Assert.Equal(-1, index.GetFirstVariantPosition("chr1", 2 * JasixCommons.PreferredNodeCount + 120, 2 * JasixCommons.PreferredNodeCount + 124));
            Assert.Equal(200_100, index.GetFirstVariantPosition("chr1", 2 * JasixCommons.PreferredNodeCount + 158, 2 * JasixCommons.PreferredNodeCount + 160));
            Assert.Equal(200_150, index.GetFirstVariantPosition("chr2", 103, 105));
        }
        public void Combination_of_large_and_small_variants()
        {
            var index = new JasixIndex();

            //query range 10,000- 10,020
            index.Add("chr1", 8_000, 9_900, 90_000);  //SV not overlapping the query
            index.Add("chr1", 9_000, 10_005, 90_100); // partially overlapping
            index.Add("chr1", 9_500, 10_050, 90_200); //completely overlapping
            index.Add("chr1", 10_000, 10_001, 100_000);
            index.Add("chr1", 10_004, 10_006, 100_100);
            index.Add("chr1", 10_009, 10_550, 100_200);//SV starting from the middle of the range
            index.Add("chr1", 10_008, 10_010, 100_300);
            index.Add("chr1", 10_011, 10_020, 100_400);
            index.Add("chr1", 10_039, 10_550, 100_200);//SV past the range

            index.Flush();

            var firstSmallVarLocation = index.GetFirstVariantPosition("chr1", 10_000, 10_020);
            var largeVariantLocations = index.LargeVariantPositions("chr1", 10_000, 10_020);

            Assert.Equal(90_000, firstSmallVarLocation);
            Assert.True(largeVariantLocations.SequenceEqual(new List <long> {
                90_100, 90_200, 100_200
            }));