File tree Expand file tree Collapse file tree
src/ISADotNet.XLSX/AssayFile Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -132,6 +132,18 @@ module AnnotationColumn =
132132 Some h
133133 | _ -> None
134134
135+ /// Parses to ColumnHeader, if the given header describes a data file
136+ let tryParseDataFileName ( header : string ) =
137+ match ColumnHeader.fromStringHeader header with
138+ | h when h.Kind = " Data File Name" -> Some h
139+ | h when h.Kind = " Raw Data File" -> Some h
140+ | h when h.Kind = " Derived Data File" -> Some h
141+ | h when h.Kind = " Image File" -> Some h
142+ | _ -> None
143+
144+ /// Returns true, if the given header describes a data column
145+ let isData header = tryParseDataFileName header |> Option.isSome
146+
135147 /// Returns true, if the given header describes a sample name
136148 let isSample header = tryParseSampleName header |> Option.isSome
137149
Original file line number Diff line number Diff line change @@ -171,6 +171,27 @@ module AnnotationNode =
171171 ( unitGetter |> Option.map ( fun f -> f matrix i))
172172 )
173173
174+ /// If the headers of a node depict a sample name, returns a function for parsing the values of the matrix to the sample names
175+ let tryGetDataFileGetter ( headers : string seq ) =
176+ Seq.tryPick tryParseDataFileName headers
177+ |> Option.map ( fun h ->
178+
179+ let dataType =
180+ if h.Kind = " Image File" then Some DataFile.ImageFile
181+ elif h.Kind = " Raw Data File" then Some DataFile.RawDataFile
182+ elif h.Kind = " Derived Data File" then Some DataFile.DerivedDataFile
183+ else None
184+ let numberComment = h.Number |> Option.map ( string >> ( Comment.fromString " Number" ) >> List.singleton)
185+
186+ fun ( matrix : System.Collections.Generic.Dictionary <( string * int ), string >) i ->
187+
188+ Data.create
189+ None
190+ ( Dictionary.tryGetValue ( h.HeaderString, i) matrix)
191+ dataType
192+ numberComment
193+ )
194+
174195 /// If the headers of a node depict a sample name, returns a function for parsing the values of the matrix to the sample names
175196 let tryGetSampleNameGetter ( headers : string seq ) =
176197 Seq.tryPick tryParseSampleName headers
You can’t perform that action at this time.
0 commit comments