diff get_parent_terms_by_relationship_type.pl @ 0:b2471db454a0 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
author iuc
date Fri, 10 Nov 2017 11:32:46 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/get_parent_terms_by_relationship_type.pl	Fri Nov 10 11:32:46 2017 -0500
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+
+eval 'exec /usr/bin/perl  -S $0 ${1+"$@"}'
+   if 0; # not running under some shell
+
+
+use Carp;
+use strict;
+use warnings;
+
+use OBO::Parser::OBOParser;
+
+my $my_parser = OBO::Parser::OBOParser->new();
+my $ontology  = $my_parser->work(shift(@ARGV));
+my $term_id   = shift(@ARGV);
+my $rel_id    = shift(@ARGV);
+
+my $target_term = $ontology->get_term_by_id($term_id);
+my @rels        = @{$ontology->get_relationships_by_source_term($target_term, $rel_id)};
+
+foreach my $r (@rels) {
+      # print "rel: ", $r->id(), "\n";
+       print $r->head()->id();
+      # print "tail: ", $r->tail()->id(), "\n\n";
+}
+
+exit 0;
+__END__
+
+
+
+
+
+