We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 874af7a commit bf1e0e3Copy full SHA for bf1e0e3
1 file changed
src/main/scala/org/fathomnet/worms/io/MutableWormsNode.scala
@@ -53,9 +53,13 @@ object MutableWormsNodeBuilder:
53
* the animalia node
54
*/
55
def trimTree(rootNode: MutableWormsNode): MutableWormsNode =
56
+ // Filter out all nodes that do not have "Animalia" as an ancestor
57
def filter(children: Seq[MutableWormsNode]): Seq[MutableWormsNode] =
58
children.filter(_.concept.names.map(_.name).exists(_.contains("Animalia")))
59
60
+ // Uncomment this to keep the full tree including plankton and other non-animalia nodes
61
+ // def filter(children: Seq[MutableWormsNode]): Seq[MutableWormsNode] = children
62
+
63
val accepted = filter(rootNode.children.toSeq)
64
if (accepted.isEmpty) rootNode
65
else MutableWormsNode(rootNode.concept, mutable.ArrayBuffer().appendAll(accepted))
0 commit comments