use of io.repseq.core.GeneFeature in project repseqio by repseqio.
the class GeneFeatureTest method testIntersection1.
@Test
public void testIntersection1() throws Exception {
GeneFeature f1, f2;
f1 = create(1, 5, 7, 9);
f2 = create(8, 9);
Assert.assertEquals(create(8, 9), GeneFeature.intersection(f1, f2));
f1 = create(1, 5, 7, 10);
f2 = create(8, 9);
Assert.assertEquals(create(8, 9), GeneFeature.intersection(f1, f2));
}
use of io.repseq.core.GeneFeature in project repseqio by repseqio.
the class GeneFeatureTest method testIntersection10.
@Test(expected = IllegalArgumentException.class)
public void testIntersection10() throws Exception {
GeneFeature f1, f2;
f1 = create(new int[] { 7, 9 }, new int[] { 0, -3 });
f2 = create(new int[] { 1, 5, 7, 9, 10, 12 }, new int[] { -3, 0, 1, -3, -2, 4 });
GeneFeature.intersection(f2, f1);
}
use of io.repseq.core.GeneFeature in project repseqio by repseqio.
the class GeneFeatureTest method testIntersection2.
@Test(expected = IllegalArgumentException.class)
public void testIntersection2() throws Exception {
GeneFeature f1, f2;
f1 = create(1, 5, 7, 9);
f2 = create(6, 9);
GeneFeature.intersection(f1, f2);
}
use of io.repseq.core.GeneFeature in project repseqio by repseqio.
the class GeneFeatureTest method testListForDocumentation.
@Ignore
@Test
public void testListForDocumentation() throws Exception {
GeneFeature.getFeatureByName("sd");
List<GFT> gfts = new ArrayList<>();
Field[] declaredFields = GeneFeature.class.getDeclaredFields();
for (Field field : declaredFields) if (Modifier.isStatic(field.getModifiers()) && field.getType() == GeneFeature.class) {
GeneFeature value = (GeneFeature) field.get(null);
String name = field.getName();
gfts.add(new GFT(value, name, field.getAnnotation(Doc.class).value()));
}
Collections.sort(gfts);
int widthName = 0, widthValue = 0, widthDoc = 0;
for (GFT gft : gfts) {
widthName = Math.max(widthName, gft.name.length());
widthValue = Math.max(widthValue, gft.value.length());
widthDoc = Math.max(widthDoc, gft.doc.length());
}
String sepHeader = "+" + chars(widthName + 2, '=') + "+" + chars(widthValue + 2, '=') + "+" + chars(widthDoc + 2, '=') + "+";
String sep = "+" + chars(widthName + 2, '-') + "+" + chars(widthValue + 2, '-') + "+" + chars(widthDoc + 2, '-') + "+";
System.out.println(sep);
System.out.println("| " + fixed("Gene Feature Name", widthName) + " | " + fixed("Gene feature decomposition", widthValue) + " | " + fixed("Documentation", widthDoc) + " |");
System.out.println(sepHeader);
for (GFT gft : gfts) {
System.out.println("| " + fixed(gft.name, widthName) + " | " + fixed(gft.value, widthValue) + " | " + fixed(gft.doc, widthDoc) + " |");
System.out.println(sep);
}
}
use of io.repseq.core.GeneFeature in project repseqio by repseqio.
the class GeneFeatureTest method testIntersection6.
@Test(expected = IllegalArgumentException.class)
public void testIntersection6() throws Exception {
GeneFeature f1, f2;
f1 = create(6, 9, 10, 11);
f2 = create(1, 5, 7, 9, 10, 12);
GeneFeature.intersection(f1, f2);
}
Aggregations