Skip to content

Commit

Permalink
Enable the creation of study metadata based on sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
Etschbeijer committed Oct 10, 2024
1 parent e6becb8 commit 3c383de
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/Spreadsheet/ArcStudy.fs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,25 @@ module ArcStudy =
with
| err -> failwithf "Failed while parsing metadatasheet: %s" err.Message

let toMetadataCollection (study : ArcStudy) (assays : ArcAssay list option) =
Studies.toRows study assays
|> Seq.append [SparseRow.fromValues [studiesLabel]]
|> Seq.map (fun r -> SparseRow.getAllValues r)

let fromMetadataCollection (collection: seq<seq<string option>>) : ArcStudy*ArcAssay list =
try
let fromRows (rows: seq<SparseRow>) =
let en = rows.GetEnumerator()
en.MoveNext() |> ignore
let _,_,_,study = Studies.fromRows 2 en
study
collection
|> Seq.map SparseRow.fromAllValues
|> fromRows
|> Option.defaultValue (ArcStudy.create(Identifier.createMissingIdentifier()),[])
with
| err -> failwithf "Failed while parsing metadatasheet: %s" err.Message

let isMetadataSheetName (name : string) =
name = metadataSheetName || name = obsoleteMetadataSheetName

Expand Down
17 changes: 16 additions & 1 deletion tests/Spreadsheet/StudyFileTests.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ArcStudyTests
module ArcStudyTests


open TestingUtils
Expand Down Expand Up @@ -60,6 +60,21 @@ let testMetaDataFunctions =
Expect.isOk writingSuccess (Result.getMessage writingSuccess)
)

testCase "TestMetadataFromCollection" (fun () ->

let study, assays =
Study.BII_S_1.studyMetadataCollection
|> ArcStudy.fromMetadataCollection

Expect.isSome study.Title "Study of the impact of changes in flux on the transcriptome, proteome, endometabolome and exometabolome of the yeast Saccharomyces cerevisiae under different nutrient limitations"
Expect.isSome study.Description "We wished to study the impact of growth rate on the total complement of mRNA molecules, proteins, and metabolites in S. cerevisiae, independent of any nutritional or other physiological effects. To achieve this, we carried out our analyses on yeast grown in steady-state chemostat culture under four different nutrient limitations (glucose, ammonium, phosphate, and sulfate) at three different dilution (that is, growth) rates (D = u = 0.07, 0.1, and 0.2/hour, equivalent to population doubling times (Td) of 10 hours, 7 hours, and 3.5 hours, respectively; u = specific growth rate defined as grams of biomass generated per gram of biomass present per unit time)."
Expect.isSome study.SubmissionDate "2007-04-30"

Expect.isSome assays.[0].MeasurementType "protein expression profiling"
Expect.isSome assays.[1].MeasurementType "etabolite profiling"
Expect.isSome assays.[2].MeasurementType "transcription profiling"
)

testCase "OutputMatchesInputEmpty" (fun () ->

let o =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,15 @@ module BII_S_1 =
row61.[1].Value <- "Comment[Study Person REF]"
ws

let studyMetadataCollection =
let study, assays = ARCtrl.Spreadsheet.ArcStudy.fromMetadataSheet studyMetadata

let assays =
if assays.IsEmpty then None
else Some assays

ARCtrl.Spreadsheet.ArcStudy.toMetadataCollection study assays

let studyMetadataEmptyObsoleteSheetName =
let cp = studyMetadataEmpty.Copy()
cp.Name <- "Study"
Expand Down

0 comments on commit 3c383de

Please sign in to comment.