Skip to content

Commit

Permalink
add docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
alyst committed May 16, 2018
1 parent a778a00 commit 6f2a5f3
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/ontology.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

"""
The collection of all ontology terms and their relations.
"""
struct Ontology
header::Dict{String, Vector{String}}
prefix::String
Expand Down
14 changes: 13 additions & 1 deletion src/parser.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# The OBO Flat File parser

"""
Represents one entry in the OBO file, e.g.
```
[Term]
id: GO:0000002
namespace: biological_process
def: BBB
name: two
```
is stored as `Stanza` with `Typ` = "Term", `id` = "GO:0000002" and
`tagvalues = Dict("id" => "GO:0000002", "namespace" => ["biological_process"], "def" => ["BBB"], "name" => "two")`.
"""
struct Stanza
Typ::String # Official ones are: "Term", "Typedef" and "Instance"
id::String
Expand Down Expand Up @@ -51,6 +62,7 @@ parseOBO(filepath::AbstractString) = open(parseOBO, filepath, "r")

const r_stanza = r"^\[(.*)\]$"

# returns tagvalues of the current Stanza and the type of the next one
function parsetagvalues(s)
vals = TagDict()

Expand Down
15 changes: 15 additions & 0 deletions src/term.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ const TagDict = Dict{String, Vector{String}}
const RefDict = Dict{String, String}
const RelDict = Dict{Symbol, Set{TermId}}

"""
Ontology term.
The `Term` object is a node in the direct acyclic ontology graph.
Its outgoing and incoming edges represent the relations with the other nodes and
could be retrieved by
```julia
relationship(term, sym)
```
and
```julia
rev_relationship(term, sym)
```
respectively, where `sym` is the relationship annotation (e.g. `:part_of`, `:is_a`, `:regulates`).
"""
struct Term
id::TermId
name::String
Expand Down
3 changes: 3 additions & 0 deletions src/typedef.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# FIXME add description
"""
"""
struct Typedef
id::String
name::String
Expand Down

0 comments on commit 6f2a5f3

Please sign in to comment.