Skip to content

Commit 1259791

Browse files
authored
Merge pull request #29 from CSBiology/feature-extensionMethods-#26
`OboOntology` extension methods
2 parents b4f58b9 + 7425e17 commit 1259791

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
namespace Ontology.NET.OBO
2+
3+
4+
open Ontology.NET
5+
6+
7+
[<AutoOpen>]
8+
module Extensions =
9+
10+
type OboOntology with
11+
12+
/// <summary>
13+
/// Returns the corresponding Ontology from the OboOntology, with the term IDs as node keys, the terms as CvTerms as node data and the relations as edges.
14+
/// </summary>
15+
/// <remarks>If a relation points to a term that is not present in the given OboOntology, initializes them as new CvTerms but with name and ref = "&lt;missing&gt;".</remarks>
16+
member this.ToOntology() =
17+
Ontology.fromOboOntology this
18+
19+
/// <summary>
20+
/// Returns the corresponding Ontology from the given OboOntology, with the term IDs as node keys, the terms as CvTerms as node data and the relations as edges.
21+
/// </summary>
22+
/// <param name="oboOnto">The OboOntology that serves as the basis for the respective Ontology.</param>
23+
/// <remarks>If a relation points to a term that is not present in the given OboOntology, initializes them as new CvTerms but with name and ref = "&lt;missing&gt;".</remarks>
24+
static member toOntology (oboOnto : OboOntology) =
25+
oboOnto.ToOntology()

src/Ontology.NET/Ontology.NET.fsproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@
3232
<Compile Include="OBO\OboProvider.fs" />
3333
<Compile Include="OntologyRelation.fs" />
3434
<Compile Include="Ontology.fs" />
35+
<Compile Include="ExtensionMethods.fs" />
3536
</ItemGroup>
3637

37-
<ItemGroup />
38-
3938
<PropertyGroup>
4039
<Authors>Heinrich Lukas Weil, Oliver Maus, F# open source contributors</Authors>
4140
<Description>A library to work with ontologies and ontology-related file formats.</Description>

src/Ontology.NET/Ontology.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ type Ontology() =
6262
/// <summary>
6363
/// Takes a given OboOntology and returns the corresponding Ontology, with the term IDs as node keys, the terms as CvTerms as node data and the relations as edges.
6464
/// </summary>
65+
/// <param name="oboOnto">The OboOntology that serves as the basis for the respective Ontology.</param>
6566
/// <remarks>If a relation points to a term that is not present in the given OboOntology, initializes them as new CvTerms but with name and ref = "&lt;missing&gt;".</remarks>
6667
static member fromOboOntology (oboOnto : OboOntology) =
6768

@@ -1325,6 +1326,7 @@ type Ontology() =
13251326
/// <summary>
13261327
/// Returns the given Ontology as a collection of Triplets.
13271328
/// </summary>
1329+
/// <param name="onto">The Ontology that serves as the informational basis for the Triplet collection.</param>
13281330
/// <returns>A collection of Triplets in the form of SourceTerm * Relation * TargetTerm.</returns>
13291331
static member toTriplets (onto : Ontology) =
13301332
onto.ToTriplets()

0 commit comments

Comments
 (0)