-
Notifications
You must be signed in to change notification settings - Fork 2
/
rnacgpi2ofn.pl
executable file
·62 lines (48 loc) · 1.15 KB
/
rnacgpi2ofn.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/perl
use strict;
our @taxa = qw(
10090
10116
3702
39947
44689
4530
4896
559292
6239
7227
7955
9606
);
my %tm = map {($_=>1)} @taxa;
open my $fh, '<', 'prefixes.ofn.txt' or die "error opening prefixes.obo.txt: $!";
my $prefixes = do { local $/; <$fh> };
print "format-version: 1.2\n";
print $prefixes;
print "Ontology(<http://purl.obolibrary.org/obo/go/noctua/rnac.owl>\n";
print "\n";
my %done = ();
while(<>) {
chomp;
next if m@^\!@;
my @vals = split(/\t/,$_);
print STDERR "BAD: $_\n" unless $vals[5] eq 'rna';
my $id = $vals[0] . ":" . $vals[1];
$id =~ s/_/-/;
my $n = $vals[3];
my $taxid = $vals[6];
$taxid =~ s/taxon://;
#print STDERR "$taxid\n";
next unless $tm{$taxid};
print "Declaration(Class($id))\n";
print "AnnotationAssertion(rdfs:label $id $n\")\n";
print "AnnotationAssertion(oboInOwl:id $id \"$id\")\n";
print "AnnotationAssertion(oboInOwl:hasBroadSynonym $id $n\")\n";
print "SubClassOf($id CHEBI:33697)\n";
print "SubClassOf($id ObjectSomeValuesFrom(obo:RO_0002162 $taxid))\n";
print "\n";
$done{$id}++;
}
print ")\n";
# PR:000000001 ! protein
exit 0;