Search in sources :

Example 31 with GeneFeature

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));
}
Also used : GeneFeature(io.repseq.core.GeneFeature) Test(org.junit.Test)

Example 32 with GeneFeature

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);
}
Also used : GeneFeature(io.repseq.core.GeneFeature) Test(org.junit.Test)

Example 33 with GeneFeature

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);
}
Also used : GeneFeature(io.repseq.core.GeneFeature) Test(org.junit.Test)

Example 34 with GeneFeature

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);
    }
}
Also used : Field(java.lang.reflect.Field) GeneFeature(io.repseq.core.GeneFeature) IntArrayList(com.milaboratory.util.IntArrayList) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 35 with GeneFeature

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);
}
Also used : GeneFeature(io.repseq.core.GeneFeature) Test(org.junit.Test)

Aggregations

GeneFeature (io.repseq.core.GeneFeature)41 Test (org.junit.Test)23 NucleotideSequence (com.milaboratory.core.sequence.NucleotideSequence)10 GeneType (io.repseq.core.GeneType)9 VDJCGene (io.repseq.core.VDJCGene)6 NSequenceWithQuality (com.milaboratory.core.sequence.NSequenceWithQuality)3 VDJCAlignments (com.milaboratory.mixcr.basictypes.VDJCAlignments)3 ReferencePoint (io.repseq.core.ReferencePoint)3 VDJCLibrary (io.repseq.core.VDJCLibrary)3 VDJCLibraryRegistry (io.repseq.core.VDJCLibraryRegistry)3 Pattern (java.util.regex.Pattern)3 SequenceRead (com.milaboratory.core.io.sequence.SequenceRead)2 AminoAcidSequence (com.milaboratory.core.sequence.AminoAcidSequence)2 Clone (com.milaboratory.mixcr.basictypes.Clone)2 VDJCHit (com.milaboratory.mixcr.basictypes.VDJCHit)2 VDJCAlignerParameters (com.milaboratory.mixcr.vdjaligners.VDJCAlignerParameters)2 IntArrayList (com.milaboratory.util.IntArrayList)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Well19937c (org.apache.commons.math3.random.Well19937c)2