Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Facultative CAM in Talinum
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dominik Brilhaus
Facultative CAM in Talinum
Commits
8aaa8665
Commit
8aaa8665
authored
5 months ago
by
Dominik Brilhaus
Browse files
Options
Downloads
Patches
Plain Diff
try fix fsharp isa read
parent
8a4c41b4
No related branches found
No related tags found
1 merge request
!4
fix docker
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
workflows/isaSampleToRawDataSeq/isaSampleToRawDataSeq.fsx
+129
-92
129 additions, 92 deletions
workflows/isaSampleToRawDataSeq/isaSampleToRawDataSeq.fsx
with
129 additions
and
92 deletions
workflows/isaSampleToRawDataSeq/isaSampleToRawDataSeq.fsx
+
129
−
92
View file @
8aaa8665
// Pull out the full ISA process sequence (incl. all metadata) leading to the first Raw Data Node
// Pull out the full ISA process sequence (incl. all metadata) leading to the first Raw Data Node
// Dependencies
// Dependencies
#
r
"nuget: ARCtrl.NET, 2.0.2"
#
r
"nuget: ARCtrl.NET"
#
r
"nuget: ARCtrl.QueryModel, 2.0.2"
#
r
"nuget: ARCtrl.QueryModel"
open
System
.
IO
open
System
.
IO
open
ARCtrl
.
NET
open
ARCtrl
.
NET
open
ARCtrl
open
ARCtrl
open
ARCtrl
.
QueryModel
open
ARCtrl
.
QueryModel
open
ARCtrl
.
Helper
// input parameters
open
FsSpreadsheet
open
FsSpreadsheet
.
Net
let
args
:
string
array
=
fsi
.
CommandLineArgs
|>
Array
.
tail
let
arcPath
=
args
.[
0
]
// input parameters
let
assayName
=
args
.[
1
]
let
startingNodeNum
=
args
.[
2
]
|>
int
// let args : string array = fsi.CommandLineArgs |> Array.tail
let
outName
=
args
.[
3
]
// let arcPath = args.[0]
// let assayName = args.[1]
// let startingNodeNum = args.[2] |> int
// test parameters
// let outName = args.[3]
let
source
=
__
SOURCE_DIRECTORY__
let
arcPath
=
Path
.
Combine
(
source
,
"../../"
)
let
assayName
=
"Talinum_RNASeq_minimal"
type
ArcTables
with
let
startingNodeNum
=
1
let
outName
=
"rnaseq-samples"
member
this
.
IgnoreShitty
()
:
ArcTables
=
this
.
Tables
|>
ResizeArray
.
filter
(
fun
t
->
// Load ARC
t
.
TryGetInputColumn
()
.
IsSome
&&
t
.
TryGetOutputColumn
()
.
IsSome
)
let
arc
=
ARC
.
load
(
arcPath
)
|>
ArcTables
let
inv
=
arc
.
ISA
.
Value
// test parameters
// Load first data node
let
source
=
__
SOURCE_DIRECTORY__
let
arcPath
=
Path
.
Combine
(
source
,
"../../"
)
let
firstData
=
inv
.
GetAssay
(
assayName
).
FirstData
let
assayName
=
"Talinum_RNASeq_minimal"
let
startingNodeNum
=
1
// Create headers for output table
let
outName
=
"rnaseq-samples"
let
headers
=
[
CompositeHeader
.
Input
IOType
.
Sample
// Load ARC
for
v
in
inv
.
ArcTables
.
ValuesOf
firstData
.[
0
]
do
if
v
.
IsCharacteristicValue
then
let
clean
(
a
:
ARC
)
=
CompositeHeader
.
Characteristic
v
.
Category
a
.
ISA
.
Value
.
Assays
|>
Seq
.
iter
(
fun
a
->
elif
v
.
IsParameterValue
then
a
.
Tables
CompositeHeader
.
Parameter
v
.
Category
|>
Seq
.
toArray
elif
v
.
IsFactorValue
then
|>
Seq
.
iter
(
fun
t
->
CompositeHeader
.
Factor
v
.
Category
if
not
(
t
.
TryGetInputColumn
()
.
IsSome
&&
t
.
TryGetOutputColumn
()
.
IsSome
)
then
elif
v
.
IsComponent
then
a
.
RemoveTable
t
.
Name
CompositeHeader
.
Component
v
.
Category
else
failwithf
"what the f is %O"
v
)
CompositeHeader
.
Output
IOType
.
Data
)
]
a
.
ISA
.
Value
.
Studies
|>
Seq
.
iter
(
fun
s
->
s
.
Tables
// Create rows
|>
Seq
.
toArray
|>
Seq
.
iter
(
fun
t
->
let
getRow
(
d
:
QNode
)
=
if
not
(
t
.
TryGetInputColumn
()
.
IsSome
&&
t
.
TryGetOutputColumn
()
.
IsSome
)
then
[|
s
.
RemoveTable
t
.
Name
CompositeCell
.
createFreeText
(
inv
.
ArcTables
.
SamplesOf
d
).[
startingNodeNum
].
Name
)
for
v
in
inv
.
ArcTables
.
ValuesOf
d
do
)
if
v
.
HasUnit
then
a
CompositeCell
.
Unitized
(
v
.
ValueText
,
v
.
Unit
)
else
let
arc
=
ARC
.
load
(
arcPath
)
|>
clean
CompositeCell
.
Term
(
v
.
Value
.
AsOntology
()
)
CompositeCell
.
FreeText
d
.
Name
let
inv
=
arc
.
ISA
.
Value
|]
// Load first data node
// Combine into table
let
firstData
=
inv
.
GetAssay
(
assayName
).
FirstData
let
t
=
ArcTable
.
init
"FullTable"
// Create headers for output table
t
.
Headers
<-
ResizeArray
headers
let
headers
=
[
CompositeHeader
.
Input
IOType
.
Sample
for
d
in
firstData
do
for
v
in
inv
.
ArcTables
.
IgnoreShitty
()
.
ValuesOf
firstData
.[
0
].
Name
do
t
.
AddRow
(
getRow
d
)
if
v
.
IsCharacteristicValue
then
CompositeHeader
.
Characteristic
v
.
Category
// Small detour via workbook
elif
v
.
IsParameterValue
then
let
ws
=
Spreadsheet
.
ArcTable
.
toFsWorksheet
t
CompositeHeader
.
Parameter
v
.
Category
elif
v
.
IsFactorValue
then
let
wb
=
new
FsSpreadsheet
.
FsWorkbook
()
CompositeHeader
.
Factor
v
.
Category
elif
v
.
IsComponent
then
wb
.
AddWorksheet
ws
CompositeHeader
.
Component
v
.
Category
else
failwithf
"what the f is %O"
v
// Write to csv
CompositeHeader
.
Output
IOType
.
Data
wb
.
ToCsvFile
(
outName
+
".tsv"
,
Separator
=
'\t'
)
]
wb
.
ToXlsxFile
(
outName
+
".xlsx"
)
// Create rows
let
getRow
(
d
:
QNode
)
=
[|
CompositeCell
.
createFreeText
(
inv
.
ArcTables
.
SamplesOf
d
).[
startingNodeNum
].
Name
for
v
in
inv
.
ArcTables
.
ValuesOf
d
do
if
v
.
HasUnit
then
CompositeCell
.
Unitized
(
v
.
ValueText
,
v
.
Unit
)
else
CompositeCell
.
Term
(
v
.
Value
.
AsOntology
()
)
CompositeCell
.
FreeText
d
.
Name
|]
// Combine into table
let
t
=
ArcTable
.
init
"FullTable"
t
.
Headers
<-
ResizeArray
headers
for
d
in
firstData
do
t
.
AddRow
(
getRow
d
)
// Small detour via workbook
let
ws
=
Spreadsheet
.
ArcTable
.
toFsWorksheet
None
t
let
wb
=
new
FsSpreadsheet
.
FsWorkbook
()
wb
.
AddWorksheet
ws
// Write to csv
// wb.To (outName + ".tsv", Separator = '\t')
wb
.
ToXlsxFile
(
outName
+
".xlsx"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment