annotate get_parent_terms_by_relationship_type.pl @ 0:a2fd3a529b77 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:33:25 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
1 #!/usr/bin/perl
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
2
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
3 eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
4 if 0; # not running under some shell
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
5
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
6
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
7 use Carp;
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
8 use strict;
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
9 use warnings;
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
10
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
11 use OBO::Parser::OBOParser;
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
12
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
13 my $my_parser = OBO::Parser::OBOParser->new();
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
14 my $ontology = $my_parser->work(shift(@ARGV));
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
15 my $term_id = shift(@ARGV);
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
16 my $rel_id = shift(@ARGV);
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
17
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
18 my $target_term = $ontology->get_term_by_id($term_id);
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
19 my @rels = @{$ontology->get_relationships_by_source_term($target_term, $rel_id)};
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
20
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
21 foreach my $r (@rels) {
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
22 # print "rel: ", $r->id(), "\n";
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
23 print $r->head()->id();
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
24 # print "tail: ", $r->tail()->id(), "\n\n";
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
25 }
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
26
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
27 exit 0;
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
28 __END__
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
29
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
30
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
31
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
32
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
33
a2fd3a529b77 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/onto-toolkit commit 9422f839ae354d4c26b02d4494abdeaad518d0e6
iuc
parents:
diff changeset
34