use of io.repseq.core.GeneFeature in project repseqio by repseqio.
the class GeneFeatureTest method testRandom1.
@Test
public void testRandom1() {
Well44497a rand = new Well44497a();
int tn = BasicReferencePoint.TOTAL_NUMBER_OF_BASIC_REFERENCE_POINTS;
for (int baseBlock = 2; baseBlock < 5; ++baseBlock) for (int t = 0; t < 1000; ++t) {
int[] all = new int[tn];
ArrayList<GeneFeature> features = new ArrayList<>();
int begin, end = 0;
do {
begin = end + rand.nextInt(baseBlock);
end = begin + 1 + rand.nextInt(baseBlock);
if (end >= tn)
break;
Arrays.fill(all, begin, end, 1);
features.add(create(begin, end));
} while (end < tn);
IntArrayList expectedPoints = new IntArrayList();
if (all[0] == 1)
expectedPoints.add(0);
for (int i = 1; i < tn; ++i) if (all[i] != all[i - 1])
expectedPoints.add(i);
if (all[tn - 1] == 1)
expectedPoints.add(tn);
GeneFeature actual = new GeneFeature(features.toArray(new GeneFeature[features.size()]));
assertEquals(create(expectedPoints.toArray()), actual);
assertEquals(expectedPoints.size() / 2, actual.regions.length);
}
}
use of io.repseq.core.GeneFeature in project repseqio by repseqio.
the class GeneFeatureTest method testIntersection9.
@Test
public void testIntersection9() throws Exception {
GeneFeature f1, f2;
f1 = create(new int[] { 7, 9 }, new int[] { 2, -4 });
f2 = create(new int[] { 1, 5, 7, 9, 10, 12 }, new int[] { -3, 0, 1, -4, -2, 4 });
Assert.assertEquals(create(new int[] { 7, 9 }, new int[] { 2, -4 }), GeneFeature.intersection(f2, f1));
}
use of io.repseq.core.GeneFeature in project repseqio by repseqio.
the class GeneFeatureTest method testIntersection14.
@Test
public void testIntersection14() throws Exception {
GeneFeature aa1 = GeneFeature.VRegion.append(new GeneFeature(ReferencePoint.VEnd, ReferencePoint.VEnd.move(-20)));
GeneFeature aa2 = GeneFeature.VRegion.append(new GeneFeature(ReferencePoint.VEnd, ReferencePoint.VEnd.move(-15)));
Assert.assertEquals(aa2, GeneFeature.intersection(aa1, aa2));
GeneFeature dd1 = new GeneFeature(ReferencePoint.DEnd.move(-3), ReferencePoint.DBegin).append(GeneFeature.DRegion).append(GeneFeature.GermlineDPSegment);
GeneFeature dd2 = GeneFeature.GermlineDPSegment.append(GeneFeature.DRegion).append(new GeneFeature(ReferencePoint.DEnd, ReferencePoint.DBegin.move(3)));
GeneFeature dd3 = new GeneFeature(ReferencePoint.DEnd.move(-3), ReferencePoint.DBegin).append(GeneFeature.DRegion).append(new GeneFeature(ReferencePoint.DEnd, ReferencePoint.DBegin.move(3)));
Assert.assertEquals(dd3, GeneFeature.intersection(dd1, dd2));
}
use of io.repseq.core.GeneFeature in project repseqio by repseqio.
the class GeneFeatureTest method testIntersection3.
@Test(expected = IllegalArgumentException.class)
public void testIntersection3() throws Exception {
GeneFeature f1, f2;
f1 = create(1, 5, 7, 9);
f2 = create(2, 5, 6, 9);
GeneFeature.intersection(f1, f2);
}
use of io.repseq.core.GeneFeature in project repseqio by repseqio.
the class GeneFeatureTest method testReversed.
@Test
public void testReversed() throws Exception {
GeneFeature gf = GeneFeature.parse("{FR1Begin:VEnd}+{VEnd:VEnd(-20)}");
assertEquals(2, gf.size());
gf = GeneFeature.parse("{FR1Begin:VEnd}").append(GeneFeature.parse("{VEnd:VEnd(-20)}"));
assertEquals(2, gf.size());
gf = GeneFeature.VGeneWithP;
assertEquals(2, gf.size());
}
Aggregations