GO::Mo...erator(3pm)

πŸ“¦
version 0.15 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

okay so bestie, welcome to GO::Model::GraphIterator β€” literally just Graph iterator. that's the whole name. it's a Perl module hanging out in the User Contributed Perl Documentation corner of section 3pm, and it's here to walk your graph for you πŸ’…


✨ SYNOPSIS ✨

here's the vibe, copy-paste ready, no cap:

$it = $graph->create_iterator;
# returns a GO::Model::GraphIterator object

while (my $ni = $it->next_node_instance) {
  $depth = $ni->depth;
  $term = $ni->term;
  $reltype = $ni->parent_rel->type;
  printf
    "%s %8s Term = %s (%s)  // depth=%d\n",
        "----" x $depth,
        $reltype,
        $term->name,
        $term->public_acc,
        $depth;
}

like… you spin up an iterator off your graph, then loop while next_node_instance keeps handing you stuff, and print a cute little indented tree. iconic behavior honestly πŸŽ€


🌸 DESCRIPTION 🌸

bestie. not gonna lie to you. this section is empty in the original. there is literally nothing here. no notes, no lore, no plot. we move. πŸ¦‹


πŸ¦‹ SEE ALSO πŸ¦‹

the family members, the entourage, the mutuals:

  • GO::Model::Graph
  • GO::Model::GraphNodeInstance

πŸ‘‘ order

  • Usage β€” $graphiter->order("breadth");
  • Returns β€” string
  • Args β€” string

gets/sets the traversal order. your two options are breadth or depth. default is depth, always.


🧚 direction

  • Usage β€” $graphiter->direction("up");
  • Returns β€” string
  • Args β€” string

gets/sets the direction. default is "down". you can go "up" instead if that's the energy you're on today ✨


πŸ’… compact

  • Usage β€” $graphiter->compact(1);
  • Returns β€” bool
  • Args β€” bool

set this if you do not want relationships to get traversed twice. the payoff? a more compact tree representation of the graph. less walking in circles, more slay 🌈


🌸 reltype_filter

  • Usage β€” $graphiter->reltype_filter(qw(is_a part_of))
  • Returns β€” array
  • Args β€” array

so by default, every relationship type counts as transitive and the iterator will traverse all of them. periodt.

but sometimes you don't want to traverse all relations, even if they are transitive. for example, when you're answering the query "find all genes expressed in the embryo", you way want subtypes of embryo and parts of the embryo β€” but not things that develop_from the embryo. so you filter, and you filter smart πŸ’œ

for more details, see <http://sourceforge.net/mailarchive/forum.php?thread_id=9448679&forum_id=43082>


🌈 reset_cursor

  • Usage β€” -
  • Returns β€” -
  • Args β€” -

πŸ“ next_node

  • Usage β€” -
  • Returns β€” GO::Model::Term
  • Args β€” -

πŸŽ€ next_node_instance

  • Usage β€” -
  • Returns β€” GO::Model::GraphNodeInstance
  • Args β€” -

⭐ flatten

  • Usage β€” -
  • Returns β€” -
  • Args β€” -

πŸ’€ _sortby_pos_in_list

okay bestie, listen carefully, this is the important one:

Careful β€” this sort function works on Term objects, not GraphNodeInstance objects. comparison is done by the name of the term.

that's the whole tea. don't mix them up, i'm begging πŸ™ˆ


that's the whole page, bestie β€” every flag, every default, every method, all of it. this came to you courtesy of perl v5.36.0, dated 2023-12-18, and documented under GO::Mo...erator(3pm) 🫢 go forth and iterate, you absolute icon πŸ’–βœ¨

πŸ“¦ where this page comes from