Skip to content

Commit

Permalink
Add location attributes to all metadata section cv params, annotate k…
Browse files Browse the repository at this point in the history
…eys with special term
  • Loading branch information
kMutagene committed Aug 4, 2023
1 parent cd4f08b commit ae6c20a
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 66 deletions.
56 changes: 2 additions & 54 deletions src/ArcGraphModel/Terms.fs
Original file line number Diff line number Diff line change
Expand Up @@ -46,58 +46,6 @@ module AssayMetadata =
ontology.Terms
|> List.map (fun t -> CvTerm(t.Id,t.Name,"ASSMSO"))

module Terms =

let filepath = "http://purl.obolibrary.org/obo/NCIT_C47922","Pathname","NCIT"

let person = "http://purl.obolibrary.org/obo/NCIT_C25190","Person","NCIT"

let name = "http://semanticscience.org/resource/SIO_000116","name","SIO"

let identifier = "http://semanticscience.org/resource/SIO_000115","identifier","SIO"

let title = "http://semanticscience.org/resource/SIO_000185","title","SIO"

let descriptor = "http://semanticscience.org/resource/SIO_000133","descriptor","SIO"

let familyName = "http://purl.obolibrary.org/obo/IAO_0020017","family name","IAO"

let givenName = "http://purl.obolibrary.org/obo/IAO_0020016","given name","IAO"

let midInitials = "http://purl.obolibrary.org/obo/NCIT_C25536","Initials","NCIT"

let email = "http://purl.obolibrary.org/obo/NCIT_C42775","E-mail Address","NCIT"

let phone = "http://purl.obolibrary.org/obo/NCIT_C40978","Telephone Number","NCIT"
module StructuralTerms =

let design = "http://semanticscience.org/resource/SIO_000705","Design","SIO"

let investigation = "ARCO:1234","Investigation","ARCO"

let study = "ARCO:1234","Study","ARCO"

let assay = "ARCO:1234","Assay","ARCO"

let publication = "ARCO:1234","Publication","ARCO"

let status = "ARCO:1234","Status","ARCO"

let factor = "ARCO:12345","Factor","ARCO"

let parameter = "ARCO:12346","Parameter","ARCO"

let characteristic = "ARCO:12347","Characteristic","ARCO"

let rawData = "http://purl.obolibrary.org/obo/NCIT_C142663","Raw Data","NCIT"

let processedData = "http://purl.obolibrary.org/obo/NCIT_C84340","Processed Data","NCIT"

let data = "http://purl.obolibrary.org/obo/NCIT_C25474","Data","NCIT"

let source = "ARCO:12349","Source Material","ARCO"

let sample = "ARCO:12350","Sample","ARCO"

let annotationID = "ARCO:1","AnnotationID","ARCO"

let termSourceRef = "ARCO:2","termSourceRef","ARCO"
let metadataSectionKey = CvTerm("AGMO:00000001","Metadata Section Key","AGMO")
34 changes: 26 additions & 8 deletions src/ArcGraphModel/Tokenization.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,31 @@ module Tokenization =
| [] -> failwith "Cannot convert nothin"
| key :: [] ->
let f = keyParser [] key.Value
[f (ParamValue.CvValue ("","MetadataSectionKey",""))]

let keyTerm =
let tmp = f (ParamValue.CvValue Terms.StructuralTerms.metadataSectionKey)
CvAttributeCollection.tryAddAttribute (Address.createRowParam(key.RowNumber)) tmp |> ignore
CvAttributeCollection.tryAddAttribute (Address.createColumnParam(key.ColumnNumber)) tmp |> ignore
tmp

[keyTerm]

| key :: cells ->
let f = keyParser [] key.Value
cells
|> List.map (fun c ->
let param = f (ParamValue.Value c.Value)
CvAttributeCollection.tryAddAttribute (Address.createRowParam(c.RowNumber)) param |> ignore
CvAttributeCollection.tryAddAttribute (Address.createColumnParam(c.ColumnNumber)) param |> ignore
param
)

let keyTerm =
let tmp = f (ParamValue.CvValue Terms.StructuralTerms.metadataSectionKey)
CvAttributeCollection.tryAddAttribute (Address.createRowParam(key.RowNumber)) tmp |> ignore
CvAttributeCollection.tryAddAttribute (Address.createColumnParam(key.ColumnNumber)) tmp |> ignore
tmp

let cellTerms =
cells
|> List.map (fun c ->
let param = f (ParamValue.Value c.Value)
CvAttributeCollection.tryAddAttribute (Address.createRowParam(c.RowNumber)) param |> ignore
CvAttributeCollection.tryAddAttribute (Address.createColumnParam(c.ColumnNumber)) param |> ignore
param

)
keyTerm :: cellTerms
15 changes: 11 additions & 4 deletions src/ArcGraphModel/TopLevelParsers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open FSharpAux
open FsSpreadsheet
open FsSpreadsheet.ExcelIO

type Investigation() =
type Investigation =

/// <summary>
/// Parses the metadata sheet from an ISA Investigation XLSX file as a row-based 2D list of `IParam`s.
Expand Down Expand Up @@ -38,7 +38,7 @@ type Investigation() =
)
|> List.concat

type Study() =
type Study =

/// <summary>
/// Parses the metadata sheet from an ISA Study XLSX file as a row-based 2D list of `IParam`s.
Expand Down Expand Up @@ -71,7 +71,15 @@ type Study() =
)
|> List.concat

type Assay() =
/// <summary>
/// Parses all annotation tables from an ISA Study XLSX file as a list of `TokenizedAnnotationTable`s, a type that contains IO columns separated from the other columns.
/// </summary>
/// <param name="path">he path to the study xlsx file</param>
static member parseAnnotationTablesFromFile (path: string) =
FsWorkbook.fromXlsxFile path
|> AnnotationTable.parseWorkbook

type Assay =

/// <summary>
/// Parses the metadata sheet from an ISA Assay XLSX file as a row-based 2D list of `IParam`s.
Expand Down Expand Up @@ -104,7 +112,6 @@ type Assay() =
)
|> List.concat


/// <summary>
/// Parses all annotation tables from an ISA Assay XLSX file as a list of `TokenizedAnnotationTable`s, a type that contains IO columns separated from the other columns.
/// </summary>
Expand Down

0 comments on commit ae6c20a

Please sign in to comment.