-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from nfdi4plants/structural-ontology
Add Structural ontologies, rename ArcGraphModel -> ARCTokenization
- Loading branch information
Showing
48 changed files
with
3,354 additions
and
1,758 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
#r "nuget: DocumentFormat.OpenXml" | ||
#r "nuget: FSharpAux" | ||
#r "nuget: FsOboParser" | ||
#r "nuget: FsSpreadsheet, 3.1.1" | ||
#r "nuget: FsSpreadsheet.ExcelIO, 3.1.1" | ||
#r "nuget: FSharp.FGL" | ||
|
@@ -33,20 +34,149 @@ open System.Collections.Generic | |
|
||
open FsSpreadsheet | ||
open FsSpreadsheet.ExcelIO | ||
open FsOboParser | ||
//open FsSpreadsheet.DSL | ||
open ControlledVocabulary | ||
open ControlledVocabulary.ParamBase | ||
open ArcGraphModel | ||
open ARCTokenization | ||
|
||
|
||
let expectedTermValuesSimple = | ||
[ | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""; "iid"] | ||
[""; "ititle"] | ||
[""; "idesc"] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""; "Maus"; "Keider"; "müller"; "oih"] | ||
[""; "Oliver"; "andreas"] | ||
[""; "L. I."; "C."] | ||
[""; "[email protected]"] | ||
[""] | ||
[""] | ||
[""] | ||
[""; "Affe"] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""; "sid"] | ||
[""; "stitle"] | ||
[""; "sdesc"] | ||
[""] | ||
[""] | ||
[""; "sid\isa.study.xlsx"] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""; "aid\isa.assay.xlsx"; "aid2\isa.assay.xlsx"] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""; "weil"] | ||
[""; "lukas"] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
[""] | ||
] | ||
|
||
let allExpectedMetadataTermsFull = | ||
Terms.InvestigationMetadata.cvTerms | ||
|> List.skip 1 //(ignore root term) | ||
|> List.zip expectedTermValuesSimple | ||
|> List.map (fun (values,term) -> | ||
values | ||
|> List.mapi (fun i v -> | ||
if i = 0 then | ||
CvParam(term, ParamValue.CvValue (CvTerm("AGMO:00000001", "Metadata Section Key", "AGMO")), []) | ||
else | ||
CvParam(term, ParamValue.Value v, []) | ||
) | ||
) | ||
|> List.concat | ||
allExpectedMetadataTermsFull.Length | ||
|
||
let parsedInvestigationMetadataSimple = Investigation.parseMetadataSheetFromFile (__SOURCE_DIRECTORY__ + "/tests/ArcGraphModel.Tests/Fixtures/correct/investigation_simple.xlsx") | ||
parsedInvestigationMetadataSimple.Length | ||
|
||
let i_fs = FsWorkbook.fromXlsxFile (__SOURCE_DIRECTORY__ + "/tests/ArcGraphModel.Tests/Fixtures/correct/investigation_simple.xlsx") | ||
|
||
(FsWorkbook.getWorksheetByName "isa_investigation" i_fs).CellCollection.GetCells() | ||
|> Seq.filter(fun c -> c.RowNumber = 1) | ||
|
||
|
||
|
||
parsedInvestigationMetadataSimple | ||
|> List.skip 10 | ||
|> List.take 10 | ||
|
||
// Assay annotation table parsing | ||
|
||
let assayTokens = Assay.parseAnnotationTablesFromFile (__SOURCE_DIRECTORY__ + "/tests/ArcGraphModel.Tests/Fixtures/correct/assay_with_single_characteristics.xlsx") | ||
|
||
// Investigation metadata parsing | ||
|
||
let investigationTokens = Investigation.parseMetadataSheetfromXlsxFile (__SOURCE_DIRECTORY__ + "/tests/ArcGraphModel.Tests/Fixtures/correct/full_investigation_mkay.xlsx") | ||
|
||
//let inves = FsWorkbook.fromXlsxFile @"C:\Users\revil\OneDrive\CSB-Stuff\NFDI\testARC30\isa.investigation.xlsx" | ||
//let inves = FsWorkbook.fromXlsxFile @"C:\Users\olive\OneDrive\CSB-Stuff\NFDI\testARC30\isa.investigation.xlsx" | ||
let inves = FsWorkbook.fromXlsxFile (__SOURCE_DIRECTORY__ + "/tests/ArcGraphModel.Tests/Fixtures/isa.investigation.xlsx") | ||
let inves = FsWorkbook.fromXlsxFile (__SOURCE_DIRECTORY__ + "/tests/ArcGraphModel.Tests/Fixtures/correct/full_investigation_mkay.xlsx") | ||
|
||
let invesWs = FsWorkbook.getWorksheets inves |> Seq.head | ||
invesWs.RescanRows() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace ArcGraphModel | ||
namespace ARCTokenization | ||
|
||
open ControlledVocabulary | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
src/ArcGraphModel/ISA/AnnotationTable.fs → src/ARCTokenization/AnnotationTable.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace ArcGraphModel | ||
namespace ARCTokenization | ||
|
||
open ControlledVocabulary | ||
open FSharpAux | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
namespace ARCTokenization | ||
|
||
open ControlledVocabulary | ||
open FSharpAux | ||
open FsSpreadsheet | ||
open ARCTokenization.Terms | ||
|
||
module MetadataSheet = | ||
|
||
let (|Term|_|) (terms : CvTerm list) (key : string) : CvTerm Option = | ||
terms | ||
|> List.tryFind (fun (term) -> CvTerm.getName term = key) | ||
|
||
let (|UnMatchable|) (key : string) : string = | ||
key | ||
|
||
// we need to have separate functions here because matching is done based on term name, of which some are contained in multiple structural ontologies | ||
// (e.g. the study metadata section is a copy of the resepctive section in an investigation file) | ||
|
||
let rec parseAssayKey (attributes : IParam list) (key : string) : ParamValue -> IParam = | ||
match key with | ||
|
||
| Term AssayMetadata.cvTerms term -> | ||
fun (pv) -> CvParam(term,pv,attributes) | ||
|
||
| UnMatchable name -> | ||
fun (pv) -> UserParam(name,pv,attributes) // UserParam(name,pv,Attributes) | ||
|
||
let rec parseStudyKey (attributes : IParam list) (key : string) : ParamValue -> IParam = | ||
match key with | ||
|
||
| Term StudyMetadata.cvTerms term -> | ||
fun (pv) -> CvParam(term,pv,attributes) | ||
|
||
| UnMatchable name -> | ||
fun (pv) -> UserParam(name,pv,attributes) // UserParam(name,pv,Attributes) | ||
|
||
let rec parseInvestigationKey (attributes : IParam list) (key : string) : ParamValue -> IParam = | ||
match key with | ||
|
||
| Term InvestigationMetadata.cvTerms term -> | ||
fun (pv) -> CvParam(term,pv,attributes) | ||
|
||
| UnMatchable name -> | ||
fun (pv) -> UserParam(name,pv,attributes) // UserParam(name,pv,Attributes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.