1
- namespace ARCtrl.ISA. Spreadsheet
1
+ namespace ARCtrl.Spreadsheet
2
2
3
- open ARCtrl. ISA
3
+ open ARCtrl
4
4
open Comment
5
5
open Remark
6
6
open System.Collections .Generic
7
+ open ARCtrl.Helper
8
+ open ARCtrl.Process .Conversion
9
+
7
10
8
11
module Assays =
9
12
@@ -24,15 +27,15 @@ module Assays =
24
27
25
28
26
29
let fromString measurementType measurementTypeTermSourceREF measurementTypeTermAccessionNumber technologyType technologyTypeTermSourceREF technologyTypeTermAccessionNumber technologyPlatform fileName comments : ArcAssay =
27
- let measurementType = OntologyAnnotation.fromString ( ?termName = measurementType,? tan = measurementTypeTermAccessionNumber,? tsr = measurementTypeTermSourceREF)
28
- let technologyType = OntologyAnnotation.fromString ( ?termName = technologyType,? tan = technologyTypeTermAccessionNumber,? tsr = technologyTypeTermSourceREF)
30
+ let measurementType = OntologyAnnotation.create ( ?name = measurementType,? tan = measurementTypeTermAccessionNumber,? tsr = measurementTypeTermSourceREF)
31
+ let technologyType = OntologyAnnotation.create ( ?name = technologyType,? tan = technologyTypeTermAccessionNumber,? tsr = technologyTypeTermSourceREF)
29
32
ArcAssay.make
30
33
( fileName)
31
- ( Option.fromValueWithDefault OntologyAnnotation.empty measurementType)
32
- ( Option.fromValueWithDefault OntologyAnnotation.empty technologyType)
33
- ( technologyPlatform |> Option.map ArcAssay .decomposeTechnologyPlatform)
34
+ ( Option.fromValueWithDefault ( OntologyAnnotation()) measurementType)
35
+ ( Option.fromValueWithDefault ( OntologyAnnotation()) technologyType)
36
+ ( technologyPlatform |> Option.map JsonTypes .decomposeTechnologyPlatform)
34
37
( ResizeArray())
35
- [||]
38
+ ( ResizeArray ())
36
39
( comments)
37
40
38
41
let fromSparseTable ( matrix : SparseTable ) : ArcAssay list =
@@ -47,7 +50,7 @@ module Assays =
47
50
matrix.CommentKeys
48
51
|> List.map ( fun k ->
49
52
Comment.fromString k ( matrix.TryGetValueDefault( " " ,( k, i))))
50
- |> Array.ofList
53
+ |> ResizeArray
51
54
52
55
fromString
53
56
( matrix.TryGetValue( measurementTypeLabel, i))
@@ -69,24 +72,23 @@ module Assays =
69
72
let processedFileName =
70
73
if a.Identifier.StartsWith( Identifier.MISSING_ IDENTIFIER) then Identifier.removeMissingIdentifier( a.Identifier) else Identifier.Assay.fileNameFromIdentifier( a.Identifier)
71
74
let i = i + 1
72
- let mt = Option.defaultValue OntologyAnnotation.empty a.MeasurementType |> fun mt -> OntologyAnnotation.toString( mt, true )
73
- let tt = Option.defaultValue OntologyAnnotation.empty a.TechnologyType |> fun tt -> OntologyAnnotation.toString( tt, true )
75
+ let mt = Option.defaultValue ( OntologyAnnotation()) a.MeasurementType |> fun mt -> OntologyAnnotation.toString( mt, true )
76
+ let tt = Option.defaultValue ( OntologyAnnotation()) a.TechnologyType |> fun tt -> OntologyAnnotation.toString( tt, true )
74
77
do matrix.Matrix.Add (( measurementTypeLabel, i), mt.TermName)
75
78
do matrix.Matrix.Add (( measurementTypeTermAccessionNumberLabel, i), mt.TermAccessionNumber)
76
79
do matrix.Matrix.Add (( measurementTypeTermSourceREFLabel, i), mt.TermSourceREF)
77
80
do matrix.Matrix.Add (( technologyTypeLabel, i), tt.TermName)
78
81
do matrix.Matrix.Add (( technologyTypeTermAccessionNumberLabel, i), tt.TermAccessionNumber)
79
82
do matrix.Matrix.Add (( technologyTypeTermSourceREFLabel, i), tt.TermSourceREF)
80
- do matrix.Matrix.Add (( technologyPlatformLabel, i), ( Option.defaultValue " " ( a.TechnologyPlatform |> Option.map ArcAssay .composeTechnologyPlatform)))
83
+ do matrix.Matrix.Add (( technologyPlatformLabel, i), ( Option.defaultValue " " ( a.TechnologyPlatform |> Option.map JsonTypes .composeTechnologyPlatform)))
81
84
do matrix.Matrix.Add (( fileNameLabel, i), processedFileName)
82
85
83
- if Array.isEmpty a.Comments |> not then
84
- a.Comments
85
- |> Array.iter ( fun comment ->
86
- let n , v = comment |> Comment.toString
87
- commentKeys <- n :: commentKeys
88
- matrix.Matrix.Add(( n, i), v)
89
- )
86
+ a.Comments
87
+ |> ResizeArray.iter ( fun comment ->
88
+ let n , v = comment |> Comment.toString
89
+ commentKeys <- n :: commentKeys
90
+ matrix.Matrix.Add(( n, i), v)
91
+ )
90
92
)
91
93
{ matrix with CommentKeys = commentKeys |> List.distinct |> List.rev}
92
94
0 commit comments