Skip to content

Commit 42c63f8

Browse files
committed
so2java
1 parent f84e2cd commit 42c63f8

File tree

2 files changed

+118
-0
lines changed

2 files changed

+118
-0
lines changed

stylesheets/bio/so/so2java.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# motivation
2+
3+
converts 'Sequence ontology in OWL' to a C/java/... code to recreate the ontology tree in memory
4+
5+
# Usage
6+
7+
```
8+
curl -L "https://github.com/The-Sequence-Ontology/SO-Ontologies/blob/master/so-simple.owl?raw=true" | xsltproc so2java.xsl -|
9+
``
10+
11+
# Output
12+
13+
function:
14+
15+
```c
16+
newTerm(term_accession, term_label, term_parent1, term_parent2, .... term_parentN);
17+
```
18+
19+
20+
```c
21+
newTerm("SO:0000001","region","SO:0000110");
22+
newTerm("SO:0000002","sequence_secondary_structure","SO:0001411");
23+
newTerm("SO:0000003","G_quartet","SO:0000002");
24+
newTerm("SO:0000004","interior_coding_exon","SO:0000195");
25+
newTerm("SO:0000005","satellite_DNA","SO:0000705");
26+
newTerm("SO:0000006","PCR_product","SO:0000695");
27+
newTerm("SO:0000007","read_pair","SO:0000150");
28+
newTerm("SO:0000010","protein_coding","SO:0000401");
29+
newTerm("SO:0000011","non_protein_coding","SO:0000401");
30+
newTerm("SO:0000012","scRNA_primary_transcript","SO:0000483");
31+
newTerm("SO:0000013","scRNA","SO:0000655");
32+
newTerm("SO:0000014","INR_motif","SO:0001660");
33+
newTerm("SO:0000015","DPE_motif","SO:0001660");
34+
newTerm("SO:0000016","BREu_motif","SO:0001660");
35+
newTerm("SO:0000017","PSE_motif","SO:0000713");
36+
newTerm("SO:0000018","linkage_group","SO:0001411");
37+
newTerm("SO:0000020","RNA_internal_loop","SO:0000715");
38+
newTerm("SO:0000021","asymmetric_RNA_internal_loop","SO:0000020");
39+
newTerm("SO:0000022","A_minor_RNA_motif","SO:0000715");
40+
newTerm("SO:0000023","K_turn_RNA_motif","SO:0000021");
41+
newTerm("SO:0000024","sarcin_like_RNA_motif","SO:0000021");
42+
newTerm("","symmetric_RNA_internal_loop","SO:0000020");
43+
newTerm("SO:0000026","RNA_junction_loop","SO:0000715");
44+
newTerm("SO:0000027","RNA_hook_turn","SO:0000026");
45+
newTerm("SO:0000028","base_pair","SO:0000002");
46+
newTerm("SO:0000029","WC_base_pair","SO:0000028");
47+
newTerm("SO:0000030","sugar_edge_base_pair","SO:0000028");
48+
newTerm("SO:0000031","aptamer","SO:0000696");
49+
newTerm("SO:0000032","DNA_aptamer","SO:0000031");
50+
newTerm("SO:0000033","RNA_aptamer","SO:0000031");
51+
(...)
52+
newTerm("SO:1001281","flanking_three_prime_quadruplet_recoding_signal","SO:1001277");
53+
newTerm("SO:1001282","UAG_stop_codon_signal","SO:1001288");
54+
newTerm("SO:1001283","UAA_stop_codon_signal","SO:1001288");
55+
newTerm("SO:1001284","regulon","SO:0005855");
56+
newTerm("SO:1001285","UGA_stop_codon_signal","SO:1001288");
57+
newTerm("SO:1001286","three_prime_repeat_recoding_signal","SO:1001277");
58+
newTerm("SO:1001287","distant_three_prime_recoding_signal","SO:1001277");
59+
newTerm("SO:1001288","stop_codon_signal","SO:1001268");
60+
newTerm("SO:2000061","databank_entry","SO:0000695");
61+
newTerm("SO:3000000","gene_segment","SO:0000842");
62+
```
63+

stylesheets/bio/so/so2java.xsl

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="ASCII"?>
2+
<xsl:stylesheet
3+
version="1.0"
4+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5+
6+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
7+
xmlns:owl="http://www.w3.org/2002/07/owl#"
8+
xmlns:oboInOwl="http://www.geneontology.org/formats/oboInOwl#"
9+
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
10+
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
11+
xmlns:so="http://purl.obolibrary.org/obo/so#"
12+
xmlns:obo="http://purl.obolibrary.org/obo/">
13+
14+
15+
<xsl:output method='text'/>
16+
17+
<xsl:template match="/">
18+
<xsl:apply-templates select="rdf:RDF"/>
19+
</xsl:template>
20+
21+
<xsl:template match="rdf:RDF">
22+
<xsl:apply-templates select="owl:Class" mode="nodes"/>
23+
24+
</xsl:template>
25+
26+
<xsl:template match="owl:Class[owl:deprecated/text() = 'true']" mode="nodes">
27+
<!-- ignore deprecated -->
28+
</xsl:template>
29+
30+
<xsl:template match="owl:Class" mode="nodes">
31+
<xsl:text>newTerm("</xsl:text>
32+
<xsl:value-of select="oboInOwl:id/text()"/>
33+
<xsl:text>","</xsl:text>
34+
<xsl:value-of select="rdfs:label/text()"/>
35+
<xsl:text>"</xsl:text>
36+
<xsl:for-each select="rdfs:subClassOf[@rdf:resource]">
37+
<xsl:variable name="rsrc" select="@rdf:resource"/>
38+
<xsl:text>,"</xsl:text>
39+
<xsl:value-of select="/rdf:RDF/owl:Class[@rdf:about = $rsrc]/oboInOwl:id/text()"/>
40+
<xsl:text>"</xsl:text>
41+
</xsl:for-each>
42+
<xsl:text>);
43+
</xsl:text>
44+
</xsl:template>
45+
46+
<xsl:template match="owl:Class[owl:deprecated/text() = 'true']" mode="bind">
47+
<!-- ignore deprecated -->
48+
</xsl:template>
49+
50+
51+
52+
53+
</xsl:stylesheet>
54+
55+

0 commit comments

Comments
 (0)