@Test public void testAddMemberReplicaForShard() { configuration.addMemberReplicaForShard("people-1", MEMBER_2); String shardName = configuration.getShardNameForModule("people"); assertEquals("ModuleShardName", "people-1", shardName); ShardStrategy shardStrategy = configuration.getStrategyForModule("people"); assertEquals("ModuleStrategy", ModuleShardStrategy.class, shardStrategy.getClass()); Collection<MemberName> members = configuration.getMembersFromShardName("people-1"); assertEquals("Members", ImmutableSortedSet.of(MEMBER_1, MEMBER_2), ImmutableSortedSet.copyOf(members)); configuration.addMemberReplicaForShard("non-existent", MEMBER_2); Set<String> shardNames = configuration.getAllShardNames(); assertEquals("ShardNames", ImmutableSortedSet.of("people-1", "cars-1", "test-1", "default"), ImmutableSortedSet.copyOf(shardNames)); }
/** * Returns a new {@link CustomFitter} with bounds corresponding to the Fibonacci sequence. * * @param maxBucketSize the maximum bucket size to create (rounded down to the nearest Fibonacci * number) * @throws IllegalArgumentException if {@code maxBucketSize <= 0} */ public static CustomFitter create(long maxBucketSize) { checkArgument(maxBucketSize > 0, "maxBucketSize must be greater than 0"); ImmutableSortedSet.Builder<Double> boundaries = ImmutableSortedSet.naturalOrder(); boundaries.add(Double.valueOf(0)); long i = 1; long j = 2; long k = 3; while (i <= maxBucketSize) { boundaries.add(Double.valueOf(i)); i = j; j = k; k = i + j; } return CustomFitter.create(boundaries.build()); }
/** * Create a new {@link ExponentialFitter}. * * @param numFiniteIntervals the number of intervals, excluding the underflow and overflow * intervals * @param base the base of the exponent * @param scale a multiplicative factor for the exponential function * @throws IllegalArgumentException if {@code numFiniteIntervals <= 0}, {@code width <= 0} or * {@code base <= 1} */ public static ExponentialFitter create(int numFiniteIntervals, double base, double scale) { checkArgument(numFiniteIntervals > 0, "numFiniteIntervals must be greater than 0"); checkArgument(scale != 0, "scale must not be 0"); checkArgument(base > 1, "base must be greater than 1"); checkDouble(base); checkDouble(scale); ImmutableSortedSet.Builder<Double> boundaries = ImmutableSortedSet.naturalOrder(); for (int i = 0; i < numFiniteIntervals + 1; i++) { boundaries.add(scale * Math.pow(base, i)); } return new AutoValue_ExponentialFitter(base, scale, boundaries.build()); }
@Nonnull public SortedSet<ImmutableItem> toSortedSet(@Nonnull Comparator<? super ImmutableItem> comparator, @Nullable final SortedSet<? extends Item> sortedSet) { if (sortedSet == null || sortedSet.size() == 0) { return ImmutableSortedSet.of(); } @SuppressWarnings("unchecked") ImmutableItem[] newItems = (ImmutableItem[])new Object[sortedSet.size()]; int index = 0; for (Item item: sortedSet) { newItems[index++] = makeImmutable(item); } return ArraySortedSet.of(comparator, newItems); }
@Test public void testParseHpoHead() throws IOException { final GoOboParser parser = new GoOboParser(goHeadFile, true); final GoOntology ontology = parser.parse(); assertEquals( "ImmutableDirectedGraph [edgeLists={ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000]=ImmutableVertexEdgeList [inEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=1], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=2], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=3]], outEdges=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=1]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=2]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=3]]]}, edgeCount=3]", ontology.getGraph().toString()); assertEquals( "[ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000004], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005554], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0007582], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008372]]", ImmutableSortedSet.copyOf(ontology.getAllTermIds()).toString()); assertThat(ImmutableSortedMap.copyOf(ontology.getTermMap()).toString(), startsWith("{ImmutableTermId")); assertThat(ImmutableSortedMap.copyOf(ontology.getTermMap()).toString(), endsWith("description=null, trailingModifiers=null]]]}")); assertEquals( "{1=GoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=1, relationQualifier=IS_A], 2=GoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=2, relationQualifier=IS_A], 3=GoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=3, relationQualifier=IS_A]}", ImmutableSortedMap.copyOf(ontology.getRelationMap()).toString()); assertEquals("ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000]", ontology.getRootTermId().toString()); assertEquals( "{data-version=releases/2017-06-16, remark=Includes Ontology(OntologyID(OntologyIRI(<http://purl.obolibrary.org/obo/go/never_in_taxon.owl>))) [Axioms: 18 Logical Axioms: 0]}", ontology.getMetaInfo().toString()); }
@Test public void testParseHpoHead() throws IOException { final HpoOboParser parser = new HpoOboParser(hpoHeadFile, true); final HpoOntology ontology = parser.parse(); assertEquals( "ImmutableDirectedGraph [edgeLists={ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001]=ImmutableVertexEdgeList [inEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], id=1], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000118], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], id=4]], outEdges=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005]=ImmutableVertexEdgeList [inEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], id=2], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000007], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], id=3]], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], id=1]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], id=2]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000007]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000007], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], id=3]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000118]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000118], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], id=4]]]}, edgeCount=4]", ontology.getGraph().toString()); assertEquals( "[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000007], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000118], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001416], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001453], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001461], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001526]]", ImmutableSortedSet.copyOf(ontology.getAllTermIds()).toString()); assertEquals( "{ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], altTermIds=[], name=All, definition=null, comment=Root of all terms in the Human Phenotype Ontology., subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=UMLS:C0444868, description=null, trailingModifiers=null]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001453], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001461]], name=Mode of inheritance, definition=The pattern in which a particular genetic trait or disorder is passed from one generation to the next., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Inheritance, scope=EXACT, synonymTypeName=null, termXrefs=[]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=UMLS:C1708511, description=null, trailingModifiers=null]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463]], name=Autosomal dominant inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in heterozygotes. In the context of medical genetics, an autosomal dominant disorder is caused when a single copy of the mutant allele is present. Males and females are affected equally, and can both transmit the disorder with a risk of 50% for each child of inheriting the mutant allele., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal dominant, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal dominant form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal dominant type, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=SNOMEDCT_US:263681008, description=null, trailingModifiers=null], ImmutableDbxref [name=UMLS:C0443147, description=null, trailingModifiers=null]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000007]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000007], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001416], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001526]], name=Autosomal recessive inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in homozygotes. In the context of medical genetics, autosomal recessive disorders manifest in homozygotes (with two copies of the mutant allele) or compound heterozygotes (whereby each copy of a gene has a distinct mutant allele)., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal recessive, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal recessive form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal recessive predisposition, scope=RELATED, synonymTypeName=null, termXrefs=[]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=SNOMEDCT_US:258211005, description=null, trailingModifiers=null], ImmutableDbxref [name=UMLS:C0441748, description=null, trailingModifiers=null], ImmutableDbxref [name=UMLS:C4020899, description=null, trailingModifiers=null]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000118]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000118], altTermIds=[], name=Phenotypic abnormality, definition=A phenotypic abnormality., comment=This is the root of the phenotypic abnormality subontology of the HPO., subsets=[], synonyms=[ImmutableTermSynonym [value=Organ abnormality, scope=EXACT, synonymTypeName=null, termXrefs=[]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=UMLS:C4021819, description=null, trailingModifiers=null]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463]], name=Autosomal dominant inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in heterozygotes. In the context of medical genetics, an autosomal dominant disorder is caused when a single copy of the mutant allele is present. Males and females are affected equally, and can both transmit the disorder with a risk of 50% for each child of inheriting the mutant allele., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal dominant, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal dominant form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal dominant type, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=SNOMEDCT_US:263681008, description=null, trailingModifiers=null], ImmutableDbxref [name=UMLS:C0443147, description=null, trailingModifiers=null]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001416]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000007], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001416], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001526]], name=Autosomal recessive inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in homozygotes. In the context of medical genetics, autosomal recessive disorders manifest in homozygotes (with two copies of the mutant allele) or compound heterozygotes (whereby each copy of a gene has a distinct mutant allele)., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal recessive, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal recessive form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal recessive predisposition, scope=RELATED, synonymTypeName=null, termXrefs=[]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=SNOMEDCT_US:258211005, description=null, trailingModifiers=null], ImmutableDbxref [name=UMLS:C0441748, description=null, trailingModifiers=null], ImmutableDbxref [name=UMLS:C4020899, description=null, trailingModifiers=null]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463]], name=Autosomal dominant inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in heterozygotes. In the context of medical genetics, an autosomal dominant disorder is caused when a single copy of the mutant allele is present. Males and females are affected equally, and can both transmit the disorder with a risk of 50% for each child of inheriting the mutant allele., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal dominant, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal dominant form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal dominant type, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=SNOMEDCT_US:263681008, description=null, trailingModifiers=null], ImmutableDbxref [name=UMLS:C0443147, description=null, trailingModifiers=null]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463]], name=Autosomal dominant inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in heterozygotes. In the context of medical genetics, an autosomal dominant disorder is caused when a single copy of the mutant allele is present. Males and females are affected equally, and can both transmit the disorder with a risk of 50% for each child of inheriting the mutant allele., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal dominant, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal dominant form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal dominant type, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=SNOMEDCT_US:263681008, description=null, trailingModifiers=null], ImmutableDbxref [name=UMLS:C0443147, description=null, trailingModifiers=null]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463]], name=Autosomal dominant inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in heterozygotes. In the context of medical genetics, an autosomal dominant disorder is caused when a single copy of the mutant allele is present. Males and females are affected equally, and can both transmit the disorder with a risk of 50% for each child of inheriting the mutant allele., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal dominant, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal dominant form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal dominant type, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=SNOMEDCT_US:263681008, description=null, trailingModifiers=null], ImmutableDbxref [name=UMLS:C0443147, description=null, trailingModifiers=null]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001453]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001453], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001461]], name=Mode of inheritance, definition=The pattern in which a particular genetic trait or disorder is passed from one generation to the next., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Inheritance, scope=EXACT, synonymTypeName=null, termXrefs=[]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=UMLS:C1708511, description=null, trailingModifiers=null]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463]], name=Autosomal dominant inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in heterozygotes. In the context of medical genetics, an autosomal dominant disorder is caused when a single copy of the mutant allele is present. Males and females are affected equally, and can both transmit the disorder with a risk of 50% for each child of inheriting the mutant allele., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal dominant, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal dominant form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal dominant type, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=SNOMEDCT_US:263681008, description=null, trailingModifiers=null], ImmutableDbxref [name=UMLS:C0443147, description=null, trailingModifiers=null]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463]], name=Autosomal dominant inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in heterozygotes. In the context of medical genetics, an autosomal dominant disorder is caused when a single copy of the mutant allele is present. Males and females are affected equally, and can both transmit the disorder with a risk of 50% for each child of inheriting the mutant allele., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal dominant, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal dominant form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal dominant type, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=SNOMEDCT_US:263681008, description=null, trailingModifiers=null], ImmutableDbxref [name=UMLS:C0443147, description=null, trailingModifiers=null]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001461]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001453], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001461]], name=Mode of inheritance, definition=The pattern in which a particular genetic trait or disorder is passed from one generation to the next., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Inheritance, scope=EXACT, synonymTypeName=null, termXrefs=[]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=UMLS:C1708511, description=null, trailingModifiers=null]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463]], name=Autosomal dominant inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in heterozygotes. In the context of medical genetics, an autosomal dominant disorder is caused when a single copy of the mutant allele is present. Males and females are affected equally, and can both transmit the disorder with a risk of 50% for each child of inheriting the mutant allele., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal dominant, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal dominant form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal dominant type, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=SNOMEDCT_US:263681008, description=null, trailingModifiers=null], ImmutableDbxref [name=UMLS:C0443147, description=null, trailingModifiers=null]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001526]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000007], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001416], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001526]], name=Autosomal recessive inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in homozygotes. In the context of medical genetics, autosomal recessive disorders manifest in homozygotes (with two copies of the mutant allele) or compound heterozygotes (whereby each copy of a gene has a distinct mutant allele)., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal recessive, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal recessive form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal recessive predisposition, scope=RELATED, synonymTypeName=null, termXrefs=[]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=SNOMEDCT_US:258211005, description=null, trailingModifiers=null], ImmutableDbxref [name=UMLS:C0441748, description=null, trailingModifiers=null], ImmutableDbxref [name=UMLS:C4020899, description=null, trailingModifiers=null]]]}", ImmutableSortedMap.copyOf(ontology.getTermMap()).toString()); assertEquals( "{1=HpoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], id=1, relationQualifier=IS_A], 2=HpoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], id=2, relationQualifier=IS_A], 3=HpoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000007], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], id=3, relationQualifier=IS_A], 4=HpoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000118], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], id=4, relationQualifier=IS_A]}", ImmutableSortedMap.copyOf(ontology.getRelationMap()).toString()); assertEquals("ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001]", ontology.getRootTermId().toString()); assertEquals( "{data-version=releases/2017-04-13, saved-by=Peter Robinson, Sebastian Koehler, Sandra Doelken, Chris Mungall, Melissa Haendel, Nicole Vasilevsky, Monarch Initiative, et al.}", ontology.getMetaInfo().toString()); }
@Test public void testParseHpoHead() throws IOException { final MpoOboParser parser = new MpoOboParser(mpoHeadFile, true); final MpoOntology ontology = parser.parse(); assertEquals( "ImmutableDirectedGraph [edgeLists={ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001]=ImmutableVertexEdgeList [inEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], id=1]], outEdges=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186]=ImmutableVertexEdgeList [inEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001188], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], id=2], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0002075], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], id=3]], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], id=1]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001188]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001188], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], id=2]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0002075]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0002075], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], id=3]]]}, edgeCount=3]", ontology.getGraph().toString()); assertEquals( "[ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000368], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001188], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0002075]]", ImmutableSortedSet.copyOf(ontology.getAllTermIds()).toString()); assertEquals( "{ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001]=MPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], altTermIds=[], name=mammalian phenotype, definition=the observable morphological, physiological, behavioral and other characteristics of mammalian organisms that are manifested through development and lifespan, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null, xrefs=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000368]=MPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0002075], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000368]], name=abnormal coat/hair pigmentation, definition=irregular or unusual pigmentation of the hair, comment=null, subsets=[Europhenome_Terms, IMPC, Sanger_Terms], synonyms=[ImmutableTermSynonym [value=abnormal coat color, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=abnormal hair pigmentation, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=coat: color anomalies, scope=EXACT, synonymTypeName=null, termXrefs=[]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=MGI:2173541, description=null, trailingModifiers=null]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186]=MPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], altTermIds=[], name=pigmentation phenotype, definition=null, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null, xrefs=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001188]=MPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001188], altTermIds=[], name=hyperpigmentation, definition=excess of pigment in any or all tissues or a part of a tissue, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null, xrefs=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0002075]=MPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0002075], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000368]], name=abnormal coat/hair pigmentation, definition=irregular or unusual pigmentation of the hair, comment=null, subsets=[Europhenome_Terms, IMPC, Sanger_Terms], synonyms=[ImmutableTermSynonym [value=abnormal coat color, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=abnormal hair pigmentation, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=coat: color anomalies, scope=EXACT, synonymTypeName=null, termXrefs=[]]], obsolete=false, createdBy=null, creationDate=null, xrefs=[ImmutableDbxref [name=MGI:2173541, description=null, trailingModifiers=null]]]}", ImmutableSortedMap.copyOf(ontology.getTermMap()).toString()); assertEquals( "{1=MpoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], id=1, relationQualifier=IS_A], 2=MpoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001188], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], id=2, relationQualifier=IS_A], 3=MpoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0002075], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], id=3, relationQualifier=IS_A]}", ImmutableSortedMap.copyOf(ontology.getRelationMap()).toString()); assertEquals("ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001]", ontology.getRootTermId().toString()); assertEquals("{data-version=releases/2017-06-05}", ontology.getMetaInfo().toString()); }
@Test public void testParseUberphenoHead() throws IOException { final UberphenoOboParser parser = new UberphenoOboParser(uberphenoHeadFile, true); final UberphenoOntology ontology = parser.parse(); assertEquals( "ImmutableDirectedGraph [edgeLists={ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=2]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001]=ImmutableVertexEdgeList [inEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], id=4]], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=1]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], id=4]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001]=ImmutableVertexEdgeList [inEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=2], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=1], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=3]], outEdges=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=3]]]}, edgeCount=4]", ontology.getGraph().toString()); assertEquals( "[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001]]", ImmutableSortedSet.copyOf(ontology.getAllTermIds()).toString()); assertEquals( "{ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001]=UberphenoTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], altTermIds=[], name=All, definition=null, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null, xrefs=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001]=UberphenoTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], altTermIds=[], name=mammalian phenotype, definition=null, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null, xrefs=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186]=UberphenoTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], altTermIds=[], name=pigmentation phenotype, definition=null, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null, xrefs=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001]=UberphenoTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], altTermIds=[], name=UBERPHENO_ROOT, definition=null, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null, xrefs=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001]=UberphenoTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001], altTermIds=[], name=abnormal(ly) quality zebrafish anatomical entity, definition=null, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null, xrefs=[]]}", ImmutableSortedMap.copyOf(ontology.getTermMap()).toString()); assertEquals( "{1=UberphenoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=1, relationQualifier=IS_A], 2=UberphenoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=2, relationQualifier=IS_A], 3=UberphenoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=3, relationQualifier=IS_A], 4=UberphenoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], id=4, relationQualifier=IS_A]}", ImmutableSortedMap.copyOf(ontology.getRelationMap()).toString()); assertEquals("ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001]", ontology.getRootTermId().toString()); assertEquals("{date=20:01:2012 06:00}", ontology.getMetaInfo().toString()); }
@Test public void testRemoveMemberReplicaForShard() { configuration.removeMemberReplicaForShard("default", MEMBER_2); String shardName = configuration.getShardNameForModule("default"); assertEquals("ModuleShardName", "default", shardName); ShardStrategy shardStrategy = configuration.getStrategyForModule("default"); assertNull("ModuleStrategy", shardStrategy); Collection<MemberName> members = configuration.getMembersFromShardName("default"); assertEquals("Members", ImmutableSortedSet.of(MEMBER_1, MEMBER_3), ImmutableSortedSet.copyOf(members)); configuration.removeMemberReplicaForShard("non-existent", MEMBER_2); Set<String> shardNames = configuration.getAllShardNames(); assertEquals("ShardNames", ImmutableSortedSet.of("people-1", "cars-1", "test-1", "default"), ImmutableSortedSet.copyOf(shardNames)); }
protected void initializePropertySources() { if (environment.getPropertySources().contains(APOLLO_PROPERTY_SOURCE_NAME)) { //already initialized return; } CompositePropertySource composite = new CompositePropertySource(APOLLO_PROPERTY_SOURCE_NAME); //sort by order asc ImmutableSortedSet<Integer> orders = ImmutableSortedSet.copyOf(NAMESPACE_NAMES.keySet()); Iterator<Integer> iterator = orders.iterator(); while (iterator.hasNext()) { int order = iterator.next(); for (String namespace : NAMESPACE_NAMES.get(order)) { Config config = ConfigService.getConfig(namespace); composite.addPropertySource(new ConfigPropertySource(namespace, config)); } } environment.getPropertySources().addFirst(composite); }
@Command( aliases = {"maplist", "maps", "ml"}, desc = "Shows the maps that are currently loaded", usage = "[page]", min = 0, max = 1, help = "Shows all the maps that are currently loaded including ones that are not in the rotation." ) @CommandPermissions("pgm.maplist") public static void maplist(CommandContext args, final CommandSender sender) throws CommandException { final Set<PGMMap> maps = ImmutableSortedSet.copyOf(new PGMMap.DisplayOrder(), PGM.getMatchManager().getMaps()); new PrettyPaginatedResult<PGMMap>(PGMTranslations.get().t("command.map.mapList.title", sender)) { @Override public String format(PGMMap map, int index) { return (index + 1) + ". " + map.getInfo().getShortDescription(sender); } }.display(new BukkitWrappedCommandSender(sender), maps, args.getInteger(0, 1) /* page */); }
static void guavaStuff() { Collection<String> c = null; Object o = null; // BUG: Diagnostic contains: passing @Nullable parameter 'c' where @NonNull is required ImmutableList.builder().addAll(c).build(); // BUG: Diagnostic contains: passing @Nullable parameter 'o' where @NonNull is required ImmutableList.builder().add(o).build(); // BUG: Diagnostic contains: passing @Nullable parameter 'c' where @NonNull is required ImmutableSet.builder().addAll(c).build(); // BUG: Diagnostic contains: passing @Nullable parameter 'o' where @NonNull is required ImmutableSet.builder().add(o).build(); // BUG: Diagnostic contains: passing @Nullable parameter 'c' where @NonNull is required ImmutableSortedSet.builder().addAll(c).build(); // BUG: Diagnostic contains: passing @Nullable parameter 'o' where @NonNull is required ImmutableSortedSet.builder().add(o).build(); // BUG: Diagnostic contains: passing @Nullable parameter 'c' where @NonNull is required Iterables.getFirst(c, "hi"); }
private String reorderedImportsString(ImmutableSortedSet<Import> imports) { assert !imports.isEmpty(); Import firstImport = imports.iterator().next(); // Pretend that the first import was preceded by another import of the same kind // (static or non-static), so we don't insert a newline there. boolean lastWasStatic = firstImport.isStatic; StringBuilder sb = new StringBuilder(); for (Import thisImport : imports) { if (lastWasStatic && !thisImport.isStatic) { // Blank line between static and non-static imports. sb.append(lineSeparator); } lastWasStatic = thisImport.isStatic; sb.append(thisImport); } return sb.toString(); }
public ParentChildIndexFieldData(Index index, Settings indexSettings, MappedFieldType.Names fieldNames, FieldDataType fieldDataType, IndexFieldDataCache cache, MapperService mapperService, CircuitBreakerService breakerService) { super(index, indexSettings, fieldNames, fieldDataType, cache); this.breakerService = breakerService; if (Version.indexCreated(indexSettings).before(Version.V_2_0_0_beta1)) { parentTypes = new TreeSet<>(); for (DocumentMapper documentMapper : mapperService.docMappers(false)) { beforeCreate(documentMapper); } mapperService.addTypeListener(this); } else { ImmutableSortedSet.Builder<String> builder = ImmutableSortedSet.naturalOrder(); for (DocumentMapper mapper : mapperService.docMappers(false)) { ParentFieldMapper parentFieldMapper = mapper.parentFieldMapper(); if (parentFieldMapper.active()) { builder.add(parentFieldMapper.type()); } } parentTypes = builder.build(); } }
@Test public void testParseHpoHead() throws IOException { final GoOboParser parser = new GoOboParser(goHeadFile, true); final GoOntology ontology = parser.parse(); assertEquals( "ImmutableDirectedGraph [edgeLists={ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000]=ImmutableVertexEdgeList [inEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=1], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=2], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=3]], outEdges=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=1]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=2]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=3]]]}, edgeCount=3]", ontology.getGraph().toString()); assertEquals( "[ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000004], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005554], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0007582], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150], ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008372]]", ImmutableSortedSet.copyOf(ontology.getAllTermIds()).toString()); assertThat(ImmutableSortedMap.copyOf(ontology.getTermMap()).toString(), startsWith("{ImmutableTermId")); assertThat(ImmutableSortedMap.copyOf(ontology.getTermMap()).toString(), endsWith("createdBy=null, creationDate=null]}")); assertEquals( "{1=GoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0003674], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=1, relationQualifier=IS_A], 2=GoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0005575], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=2, relationQualifier=IS_A], 3=GoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0008150], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000], id=3, relationQualifier=IS_A]}", ImmutableSortedMap.copyOf(ontology.getRelationMap()).toString()); assertEquals("ImmutableTermId [prefix=ImmutableTermPrefix [value=GO], id=0000000]", ontology.getRootTermId().toString()); assertEquals( "{data-version=releases/2017-06-16, remark=Includes Ontology(OntologyID(OntologyIRI(<http://purl.obolibrary.org/obo/go/never_in_taxon.owl>))) [Axioms: 18 Logical Axioms: 0]}", ontology.getMetaInfo().toString()); }
@Test public void testParseHpoHead() throws IOException { final HpoOboParser parser = new HpoOboParser(hpoHeadFile, true); final HpoOntology ontology = parser.parse(); assertEquals( "ImmutableDirectedGraph [edgeLists={ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001]=ImmutableVertexEdgeList [inEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], id=1], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000118], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], id=4]], outEdges=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005]=ImmutableVertexEdgeList [inEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], id=2], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000007], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], id=3]], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], id=1]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], id=2]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000007]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000007], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], id=3]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000118]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000118], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], id=4]]]}, edgeCount=4]", ontology.getGraph().toString()); assertEquals( "[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000007], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000118], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001416], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001453], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001461], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001526]]", ImmutableSortedSet.copyOf(ontology.getAllTermIds()).toString()); assertEquals( "{ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], altTermIds=[], name=All, definition=null, comment=Root of all terms in the Human Phenotype Ontology., subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001453], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001461]], name=Mode of inheritance, definition=The pattern in which a particular genetic trait or disorder is passed from one generation to the next., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Inheritance, scope=EXACT, synonymTypeName=null, termXrefs=[]]], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463]], name=Autosomal dominant inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in heterozygotes. In the context of medical genetics, an autosomal dominant disorder is caused when a single copy of the mutant allele is present. Males and females are affected equally, and can both transmit the disorder with a risk of 50% for each child of inheriting the mutant allele., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal dominant, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal dominant form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal dominant type, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]]], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000007]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000007], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001416], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001526]], name=Autosomal recessive inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in homozygotes. In the context of medical genetics, autosomal recessive disorders manifest in homozygotes (with two copies of the mutant allele) or compound heterozygotes (whereby each copy of a gene has a distinct mutant allele)., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal recessive, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal recessive form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal recessive predisposition, scope=RELATED, synonymTypeName=null, termXrefs=[]]], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000118]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000118], altTermIds=[], name=Phenotypic abnormality, definition=A phenotypic abnormality., comment=This is the root of the phenotypic abnormality subontology of the HPO., subsets=[], synonyms=[ImmutableTermSynonym [value=Organ abnormality, scope=EXACT, synonymTypeName=null, termXrefs=[]]], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463]], name=Autosomal dominant inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in heterozygotes. In the context of medical genetics, an autosomal dominant disorder is caused when a single copy of the mutant allele is present. Males and females are affected equally, and can both transmit the disorder with a risk of 50% for each child of inheriting the mutant allele., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal dominant, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal dominant form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal dominant type, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]]], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001416]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000007], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001416], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001526]], name=Autosomal recessive inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in homozygotes. In the context of medical genetics, autosomal recessive disorders manifest in homozygotes (with two copies of the mutant allele) or compound heterozygotes (whereby each copy of a gene has a distinct mutant allele)., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal recessive, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal recessive form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal recessive predisposition, scope=RELATED, synonymTypeName=null, termXrefs=[]]], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463]], name=Autosomal dominant inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in heterozygotes. In the context of medical genetics, an autosomal dominant disorder is caused when a single copy of the mutant allele is present. Males and females are affected equally, and can both transmit the disorder with a risk of 50% for each child of inheriting the mutant allele., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal dominant, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal dominant form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal dominant type, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]]], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463]], name=Autosomal dominant inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in heterozygotes. In the context of medical genetics, an autosomal dominant disorder is caused when a single copy of the mutant allele is present. Males and females are affected equally, and can both transmit the disorder with a risk of 50% for each child of inheriting the mutant allele., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal dominant, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal dominant form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal dominant type, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]]], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463]], name=Autosomal dominant inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in heterozygotes. In the context of medical genetics, an autosomal dominant disorder is caused when a single copy of the mutant allele is present. Males and females are affected equally, and can both transmit the disorder with a risk of 50% for each child of inheriting the mutant allele., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal dominant, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal dominant form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal dominant type, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]]], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001453]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001453], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001461]], name=Mode of inheritance, definition=The pattern in which a particular genetic trait or disorder is passed from one generation to the next., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Inheritance, scope=EXACT, synonymTypeName=null, termXrefs=[]]], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463]], name=Autosomal dominant inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in heterozygotes. In the context of medical genetics, an autosomal dominant disorder is caused when a single copy of the mutant allele is present. Males and females are affected equally, and can both transmit the disorder with a risk of 50% for each child of inheriting the mutant allele., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal dominant, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal dominant form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal dominant type, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]]], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463]], name=Autosomal dominant inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in heterozygotes. In the context of medical genetics, an autosomal dominant disorder is caused when a single copy of the mutant allele is present. Males and females are affected equally, and can both transmit the disorder with a risk of 50% for each child of inheriting the mutant allele., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal dominant, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal dominant form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal dominant type, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]]], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001461]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001453], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001461]], name=Mode of inheritance, definition=The pattern in which a particular genetic trait or disorder is passed from one generation to the next., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Inheritance, scope=EXACT, synonymTypeName=null, termXrefs=[]]], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001415], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001447], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001448], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001451], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001455], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001456], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001463]], name=Autosomal dominant inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in heterozygotes. In the context of medical genetics, an autosomal dominant disorder is caused when a single copy of the mutant allele is present. Males and females are affected equally, and can both transmit the disorder with a risk of 50% for each child of inheriting the mutant allele., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal dominant, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal dominant form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal dominant type, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]]], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001526]=HPOTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000007], altTermIds=[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001416], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0001526]], name=Autosomal recessive inheritance, definition=A mode of inheritance that is observed for traits related to a gene encoded on one of the autosomes (i.e., the human chromosomes 1-22) in which a trait manifests in homozygotes. In the context of medical genetics, autosomal recessive disorders manifest in homozygotes (with two copies of the mutant allele) or compound heterozygotes (whereby each copy of a gene has a distinct mutant allele)., comment=null, subsets=[], synonyms=[ImmutableTermSynonym [value=Autosomal recessive, scope=EXACT, synonymTypeName=null, termXrefs=[]], ImmutableTermSynonym [value=Autosomal recessive form, scope=RELATED, synonymTypeName=null, termXrefs=[ImmutableTermXref [id=null, description=null]]], ImmutableTermSynonym [value=Autosomal recessive predisposition, scope=RELATED, synonymTypeName=null, termXrefs=[]]], obsolete=false, createdBy=null, creationDate=null]}", ImmutableSortedMap.copyOf(ontology.getTermMap()).toString()); assertEquals( "{1=HpoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], id=1, relationQualifier=IS_A], 2=HpoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000006], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], id=2, relationQualifier=IS_A], 3=HpoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000007], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005], id=3, relationQualifier=IS_A], 4=HpoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000118], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], id=4, relationQualifier=IS_A]}", ImmutableSortedMap.copyOf(ontology.getRelationMap()).toString()); assertEquals("ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001]", ontology.getRootTermId().toString()); assertEquals( "{data-version=releases/2017-04-13, saved-by=Peter Robinson, Sebastian Koehler, Sandra Doelken, Chris Mungall, Melissa Haendel, Nicole Vasilevsky, Monarch Initiative, et al.}", ontology.getMetaInfo().toString()); }
@Test public void readTest() throws IOException { FieldEncryptorConfig expectedConfig = new FieldEncryptorConfigBuilder().setValueEncryptor(ValueEncryptor.AES_CBC).setProvider("SunJCE").setKeyLength(24) .setEncryptUsingVisibility(false).setKeyId("keyId").setDestination(EntryField.COLUMN_FAMILY) .setSources(ImmutableSortedSet.of(EntryField.ROW, EntryField.COLUMN_QUALIFIER, EntryField.COLUMN_FAMILY)).build(); FieldEncryptorConfig actualConfig = new FieldEncryptorConfigBuilder().readFromIni(getIni("config1.ini").get(EntryField.COLUMN_FAMILY.toString())).build(); assertThat("reading the ini file produces the correct configuration", actualConfig, hasSameFieldsAs(expectedConfig)); expectedConfig = new FieldEncryptorConfigBuilder().setValueEncryptor(ValueEncryptor.AES_CBC).setProvider("BC").setKeyLength(16) .setEncryptUsingVisibility(true).setKeyId("AES_CBC").setDestination(EntryField.ROW).setSources(ImmutableSortedSet.of(EntryField.ROW)).build(); actualConfig = new FieldEncryptorConfigBuilder().readFromIni(getIni("config2.ini").get(EntryField.ROW.toString())).build(); assertThat("reading the ini file produces the correct configuration", actualConfig, hasSameFieldsAs(expectedConfig)); expectedConfig = new FieldEncryptorConfigBuilder().setValueEncryptor(ValueEncryptor.AES_CBC).setKeyLength(16).setEncryptUsingVisibility(true) .setKeyId("AES_CBC").setDestination(EntryField.ROW).setSources(ImmutableSortedSet.of(EntryField.ROW)).build(); actualConfig = new FieldEncryptorConfigBuilder().readFromIni(getIni("config2WithoutDefaults.ini").get(EntryField.ROW.toString())).build(); assertThat("default values are correctly set", actualConfig, hasSameFieldsAs(expectedConfig)); expectedConfig = new FieldEncryptorConfigBuilder().setValueEncryptor(ValueEncryptor.AES_CBC).setProvider(null).setKeyLength(16) .setEncryptUsingVisibility(false).setKeyId(ValueEncryptor.AES_CBC.toString()).setDestination(EntryField.VALUE) .setSources(ImmutableSortedSet.of(EntryField.VALUE)).build(); actualConfig = new FieldEncryptorConfigBuilder().readFromIni(getIni("config3.ini").get(EntryField.VALUE.toString())).build(); assertThat("reading the ini file produces the correct configuration", actualConfig, hasSameFieldsAs(expectedConfig)); }
@Test public void testParseUberphenoHead() throws IOException { final UberphenoOboParser parser = new UberphenoOboParser(uberphenoHeadFile, true); final UberphenoOntology ontology = parser.parse(); assertEquals( "ImmutableDirectedGraph [edgeLists={ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=2]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001]=ImmutableVertexEdgeList [inEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], id=4]], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=1]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], id=4]]], ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001]=ImmutableVertexEdgeList [inEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=2], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=1], ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=3]], outEdges=[]], ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001]=ImmutableVertexEdgeList [inEdges=[], outEdges=[ImmutableEdge [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=3]]]}, edgeCount=4]", ontology.getGraph().toString()); assertEquals( "[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001]]", ImmutableSortedSet.copyOf(ontology.getAllTermIds()).toString()); assertEquals( "{ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001]=UberphenoTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], altTermIds=[], name=All, definition=null, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001]=UberphenoTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], altTermIds=[], name=mammalian phenotype, definition=null, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186]=UberphenoTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], altTermIds=[], name=pigmentation phenotype, definition=null, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001]=UberphenoTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], altTermIds=[], name=UBERPHENO_ROOT, definition=null, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null], ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001]=UberphenoTerm [id=ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001], altTermIds=[], name=abnormal(ly) quality zebrafish anatomical entity, definition=null, comment=null, subsets=[], synonyms=[], obsolete=false, createdBy=null, creationDate=null]}", ImmutableSortedMap.copyOf(ontology.getTermMap()).toString()); assertEquals( "{1=UberphenoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=1, relationQualifier=IS_A], 2=UberphenoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=2, relationQualifier=IS_A], 3=UberphenoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=ZP], id=0000001], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001], id=3, relationQualifier=IS_A], 4=UberphenoTermRelation [source=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0001186], dest=ImmutableTermId [prefix=ImmutableTermPrefix [value=MP], id=0000001], id=4, relationQualifier=IS_A]}", ImmutableSortedMap.copyOf(ontology.getRelationMap()).toString()); assertEquals("ImmutableTermId [prefix=ImmutableTermPrefix [value=UBERPHENO], id=00000001]", ontology.getRootTermId().toString()); assertEquals("{date=20:01:2012 06:00}", ontology.getMetaInfo().toString()); }
final void check() { runTester().assertNonNullValues( Gender.MALE, Integer.valueOf(0), 0, "", "", ImmutableList.of(), ImmutableList.of(), ImmutableMap.of(), ImmutableMap.of(), ImmutableSet.of(), ImmutableSet.of(), ImmutableSortedSet.of(), ImmutableSortedSet.of(), ImmutableMultiset.of(), ImmutableMultiset.of(), ImmutableMultimap.of(), ImmutableMultimap.of(), ImmutableTable.of(), ImmutableTable.of()); }
@Override public Set<ModelType<? extends PUBLIC>> getSupportedTypes() { ImmutableSortedSet.Builder<ModelType<? extends PUBLIC>> supportedTypes = ImmutableSortedSet.orderedBy(ModelTypes.<PUBLIC>displayOrder()); for (TypeRegistration<?> registration : registrations.values()) { if (registration.isConstructible()) { supportedTypes.add(registration.publicType); } } return supportedTypes.build(); }
private static String propertyDescription(ModelSchemaExtractionContext<?> parentContext, ModelProperty<?> property) { if (property.getDeclaredBy().size() == 1 && property.getDeclaredBy().contains(parentContext.getType())) { return String.format("property '%s'", property.getName()); } else { ImmutableSortedSet<String> declaredBy = ImmutableSortedSet.copyOf(Iterables.transform(property.getDeclaredBy(), Functions.toStringFunction())); return String.format("property '%s' declared by %s", property.getName(), Joiner.on(", ").join(declaredBy)); } }
public Set<ModelType<?>> getDeclaredBy() { ImmutableSortedSet.Builder<ModelType<?>> declaredBy = new ImmutableSortedSet.Builder<ModelType<?>>(Ordering.usingToString()); for (PropertyAccessorExtractionContext accessor : accessors.values()) { for (Method method : accessor.getDeclaringMethods()) { declaredBy.add(ModelType.declaringType(method)); } } return declaredBy.build(); }
@Nonnull private static <T> SortedSet<? extends T> toNaturalSortedSet(@Nonnull Collection<? extends T> collection) { if (isNaturalSortedSet(collection)) { return (SortedSet<? extends T>)collection; } return ImmutableSortedSet.copyOf(collection); }
private ModelTypeInitializationException canNotConstructTypeException(NodeInitializerContext<?> context) { ImmutableSortedSet.Builder<ModelType<?>> constructibleTypes = ImmutableSortedSet.orderedBy(ModelTypes.displayOrder()); for (NodeInitializerExtractionStrategy extractor : additionalStrategies) { for (ModelType<?> constructibleType : extractor.supportedTypes()) { if (context.getConstraints().isSatisfiedBy(constructibleType)) { constructibleTypes.add(constructibleType); } } } return new ModelTypeInitializationException(context, schemaStore, ScalarTypes.TYPES, constructibleTypes.build()); }
@Override public TaskClassValidator extractValidator(Class<? extends Task> type) { ImmutableSet.Builder<TaskPropertyInfo> validatedPropertiesBuilder = ImmutableSet.builder(); ImmutableSet.Builder<String> nonAnnotatedPropertiesBuilder = ImmutableSortedSet.naturalOrder(); Queue<TypeEntry> queue = new ArrayDeque<TypeEntry>(); queue.add(new TypeEntry(null, type)); while (!queue.isEmpty()) { TypeEntry entry = queue.remove(); parseProperties(entry.parent, entry.type, validatedPropertiesBuilder, nonAnnotatedPropertiesBuilder, queue); } return new TaskClassValidator(validatedPropertiesBuilder.build(), nonAnnotatedPropertiesBuilder.build()); }
public static <T extends TaskFilePropertySpec> SortedSet<T> collectFileProperties(String displayName, Iterator<? extends T> fileProperties) { Set<String> names = Sets.newHashSet(); ImmutableSortedSet.Builder<T> builder = ImmutableSortedSet.naturalOrder(); while (fileProperties.hasNext()) { T propertySpec = fileProperties.next(); String propertyName = propertySpec.getPropertyName(); if (!names.add(propertyName)) { throw new IllegalArgumentException(String.format("Multiple %s file properties with name '%s'", displayName, propertyName)); } builder.add(propertySpec); } return builder.build(); }
@Override protected List<String> create(String[] elements) { Comparator<String> comparator = createExplicitComparator(elements); ImmutableSortedSet.Builder<String> builder = ImmutableSortedSet.orderedBy(comparator); builder.add(BEFORE_FIRST); builder.add(BEFORE_FIRST_2); builder.add(elements); builder.add(AFTER_LAST); builder.add(AFTER_LAST_2); return builder .build() .subSet(BEFORE_FIRST_2, AFTER_LAST_2) .asList() .subList(1, elements.length + 1); }
@SuppressWarnings("unused") // called by NullPointerTester public void checkDefaultValuesForTheseTypes( Gender gender, Integer integer, int i, String string, CharSequence charSequence, List<String> list, ImmutableList<Integer> immutableList, Map<String, Integer> map, ImmutableMap<String, String> immutableMap, Set<String> set, ImmutableSet<Integer> immutableSet, SortedSet<Number> sortedSet, ImmutableSortedSet<Number> immutableSortedSet, Multiset<String> multiset, ImmutableMultiset<Integer> immutableMultiset, Multimap<String, Integer> multimap, ImmutableMultimap<String, Integer> immutableMultimap, Table<String, Integer, Exception> table, ImmutableTable<Integer, String, Exception> immutableTable) { calledWith( gender, integer, i, string, charSequence, list, immutableList, map, immutableMap, set, immutableSet, sortedSet, immutableSortedSet, multiset, immutableMultiset, multimap, immutableMultimap, table, immutableTable); }
@Test public void defArray() { ImmutableDefaultArray a1 = ImmutableDefaultArray.builder().build(); int[] array = a1.prop(); int[] nextArray = a1.prop(); check(array != nextArray); check(a1.ints() instanceof ImmutableSortedSet); }
/** * Create a new {@link LinearFitter}. * * @param numFiniteIntervals the number of intervals, excluding the underflow and overflow * intervals * @param width the width of each interval * @param offset the start value of the first interval * @throws IllegalArgumentException if {@code numFiniteIntervals <= 0} or {@code width <= 0} */ public static LinearFitter create(int numFiniteIntervals, double width, double offset) { checkArgument(numFiniteIntervals > 0, "numFiniteIntervals must be greater than 0"); checkArgument(width > 0, "width must be greater than 0"); checkDouble(offset); ImmutableSortedSet.Builder<Double> boundaries = ImmutableSortedSet.naturalOrder(); for (int i = 0; i < numFiniteIntervals + 1; i++) { boundaries.add(width * i + offset); } return new AutoValue_LinearFitter(width, offset, boundaries.build()); }
@Nonnull public ImmutableSortedSet<ImmutableItem> toSortedSet(@Nonnull Comparator<? super ImmutableItem> comparator, @Nullable final Iterable<? extends Item> iterable) { if (iterable == null) { return ImmutableSortedSet.of(); } boolean needsCopy = false; if (iterable instanceof ImmutableSortedSet && ((ImmutableSortedSet)iterable).comparator().equals(comparator)) { for (Item element: iterable) { if (!isImmutable(element)) { needsCopy = true; break; } } } else { needsCopy = true; } if (!needsCopy) { return (ImmutableSortedSet<ImmutableItem>)iterable; } final Iterator<? extends Item> iter = iterable.iterator(); return ImmutableSortedSet.copyOf(comparator, new Iterator<ImmutableItem>() { @Override public boolean hasNext() { return iter.hasNext(); } @Override public ImmutableItem next() { return makeImmutable(iter.next()); } @Override public void remove() { iter.remove(); } }); }
@Override protected List<String> create(String[] elements) { Comparator<String> comparator = createExplicitComparator(elements).reverse(); return ImmutableSortedSet.orderedBy(comparator) .add(elements) .build() .descendingSet() .asList(); }
public static <E> Collector<E, ?, ImmutableSortedSet<E>> toSortedSet(Comparator<? super E> comparator) { return Collector.of( () -> new ImmutableSortedSet.Builder<E>(comparator), ImmutableSortedSet.Builder::add, (l, r) -> l.addAll(r.build()), ImmutableSortedSet.Builder::build ); }
@Nonnull private static <T> SortedSet<? extends T> toSortedSet(@Nonnull Comparator<? super T> elementComparator, @Nonnull Collection<? extends T> collection) { if (collection instanceof SortedSet) { SortedSet<? extends T> sortedSet = (SortedSet<? extends T>)collection; Comparator<?> comparator = sortedSet.comparator(); if (comparator != null && comparator.equals(elementComparator)) { return sortedSet; } } return ImmutableSortedSet.copyOf(elementComparator, collection); }
private <T extends PresortedComparable<T>> SortedSet<T> toDescriptorSet( Set<? extends KeyedDexItem<T>> set) { ImmutableSortedSet.Builder<T> builder = new ImmutableSortedSet.Builder<>(PresortedComparable::slowCompareTo); for (KeyedDexItem<T> item : set) { builder.add(item.getKey()); } return builder.build(); }
private static <T extends PresortedComparable<T>> ImmutableSortedSet<T> rewriteItems( Set<T> original, BiFunction<T, DexEncodedMethod, T> rewrite) { ImmutableSortedSet.Builder<T> builder = new ImmutableSortedSet.Builder<>(PresortedComparable::slowCompare); for (T item : original) { builder.add(rewrite.apply(item, null)); } return builder.build(); }
public final CorpusQueryAssessments loadFrom(final CharSource source) throws IOException { final List<String> lines = source.readLines(); final List<QueryResponse2016> queries = Lists.newArrayList(); final Map<QueryResponse2016, String> metadata = Maps.newHashMap(); final ImmutableMultimap.Builder<QueryResponse2016, Symbol> responsesToSystems = ImmutableMultimap.builder(); final Map<QueryResponse2016, QueryAssessment2016> assessments = Maps.newHashMap(); Optional<String> lastMetadata = Optional.absent(); for (final String line : lines) { if (line.startsWith("#")) { lastMetadata = Optional.of(line.trim().substring(1)); } else { final String[] parts = line.trim().split("\t"); checkArgument(parts.length == 5, "expected five columns, but got " + parts.length); final Symbol queryID = Symbol.from(parts[0]); final Symbol docID = Symbol.from(parts[1]); final String[] systemIDs = parts[2].split(","); final ImmutableSortedSet<CharOffsetSpan> spans = extractPJSpans(parts[3]); final QueryAssessment2016 assessment = QueryAssessment2016.valueOf(parts[4]); final QueryResponse2016 query = QueryResponse2016.builder().queryID(queryID).docID(docID) .addAllPredicateJustifications(spans).build(); queries.add(query); for(final String systemID: systemIDs) { responsesToSystems.put(query, Symbol.from(systemID)); } if (!assessment.equals(QueryAssessment2016.UNASSESSED)) { assessments.put(query, assessment); } if (lastMetadata.isPresent()) { metadata.put(query, lastMetadata.get()); lastMetadata = Optional.absent(); } } } return CorpusQueryAssessments.builder().addAllQueryReponses(queries).assessments(assessments) .queryResponsesToSystemIDs(responsesToSystems.build()) .metadata(metadata).build(); }
private static ImmutableSortedSet<CharOffsetSpan> extractPJSpans(final String part) { final ImmutableSortedSet.Builder<CharOffsetSpan> spans = ImmutableSortedSet.naturalOrder(); for (final String spanString : commaSplitter.split(part.trim())) { final List<String> spanParts = ImmutableList.copyOf(dashSplitter.split(spanString)); checkState(spanParts.size() == 2, "Expected two components to the span, but got " + spanParts.size()); final int start = Integer.parseInt(spanParts.get(0)); final int end = Integer.parseInt(spanParts.get(1)); spans.add(CharOffsetSpan.fromOffsetsOnly(start, end)); } return spans.build(); }
PrecomputedScores(Collection<TermId> termIds) { termIdCount = termIds.size(); data = new float[termIdCount * termIdCount]; termIdToIdx = new HashMap<>(termIdCount); int i = 0; for (TermId termId : ImmutableSortedSet.copyOf(termIds)) { termIdToIdx.put(termId, i++); } }
@Test public void test() { Set<TermId> inputIds = Sets.newHashSet(id1); Set<TermId> outputIds = ImmutableSortedSet.copyOf(TermIds.augmentWithAncestors(ontology, inputIds, true)); assertEquals( "[ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000001], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000002], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000003], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000004], ImmutableTermId [prefix=ImmutableTermPrefix [value=HP], id=0000005]]", outputIds.toString()); }