Search in sources :

Example 1 with BaseSequence

use of io.repseq.core.BaseSequence in project repseqio by repseqio.

the class VDJCGeneDataTest method testSerialization1.

@Test
public void testSerialization1() throws Exception {
    VDJCGeneData gene = new VDJCGeneData(new BaseSequence("embedded://testseq"), "TRBV1", GeneType.Variable, true, Chains.TRB, new TreeMap<String, SortedSet<String>>(), new TreeMap<ReferencePoint, Long>());
    gene.addMetaValue("key", "val");
    String s1 = GlobalObjectMappers.toOneLine(gene);
    JsonNode n1 = GlobalObjectMappers.ONE_LINE.readTree(s1);
    assertTrue(n1.get("meta").get("key").isValueNode());
    assertEquals(gene, GlobalObjectMappers.ONE_LINE.readValue(s1, VDJCGeneData.class));
    gene.addMetaValue("key", "val1");
    String s2 = GlobalObjectMappers.toOneLine(gene);
    JsonNode n2 = GlobalObjectMappers.ONE_LINE.readTree(s2);
    assertFalse(n2.get("meta").get("key").isValueNode());
    assertEquals(gene, GlobalObjectMappers.ONE_LINE.readValue(s2, VDJCGeneData.class));
}
Also used : ReferencePoint(io.repseq.core.ReferencePoint) JsonNode(com.fasterxml.jackson.databind.JsonNode) SortedSet(java.util.SortedSet) BaseSequence(io.repseq.core.BaseSequence) Test(org.junit.Test)

Aggregations

JsonNode (com.fasterxml.jackson.databind.JsonNode)1 BaseSequence (io.repseq.core.BaseSequence)1 ReferencePoint (io.repseq.core.ReferencePoint)1 SortedSet (java.util.SortedSet)1 Test (org.junit.Test)1