Skip to content
Snippets Groups Projects

Fsharp cwl

Merged Dominik Brilhaus requested to merge fsharp-cwl into main
7 files
+ 47
32
Compare changes
  • Side-by-side
  • Inline
Files
7
@@ -2,7 +2,7 @@
```bash
cd runs/isaSampleToRawDataSeq
cd runs/isaSampleToRawDataSeq-run
```
```bash
@@ -2,5 +2,5 @@ arcPath:
class: Directory
path: ../../
assayName: "Talinum_RNASeq_minimal"
outName: "rnaseq-samples"
startingNodeNum: 1
outName: rnaseq-samples
startingNodeNum: 0

rnaseq-samples.xlsx

Download
+ 12
6
@@ -6,13 +6,14 @@ library("DESeq2")
library("tximport")
library("rhdf5")
library("ggplot2")
library("readxl")
## In-and-out
# inKallistoResults <- "../../runs/kallisto/kallisto_results"
# inMetadataFile <- "../../runs/merged_isa_metadata/out/merged_isa.tsv"
# inMetadataSample <- "Source.Name"
# inMetadataFactorList <- list("Factor..Photosynthesis.mode.", "Factor..Biosource.amount.")
inKallistoResults <- "../../runs/kallisto/kallisto_results"
inMetadataFile <- "../../runs/isaSampleToRawDataSeq-run/rnaseq-samples.xlsx"
inMetadataSample <- "Input [Source Name]"
inMetadataFactorList <- list("Factor [Photosynthesis mode]")
### Read arguments from CLI
@@ -34,13 +35,18 @@ head(txi$counts)
## Read sample metadata
samples_metadata <- read.table(file = inMetadataFile, sep = "\t")
samples_metadata <- as.data.frame(read_xlsx(path = inMetadataFile))
samples <- samples_metadata[order(samples_metadata[[inMetadataSample]]), c(inMetadataSample, unlist(inMetadataFactorList))]
rownames(samples) <- samples[,inMetadataSample]
factors <- sapply(inMetadataFactorList, function(x) x[[1]])
design_formula <- as.formula(paste("~", paste(rev(factors), collapse = " + ")))
## Annoying workaround to prevent formula error with special chars in column headers
colnames(samples) <- make.names(colnames(samples))
factors <- make.names(factors)
design_formula <- as.formula(paste("~", paste(rev(factors), collapse = " + ")))
## DESeq
@@ -2,7 +2,7 @@ cwlVersion: v1.2
class: CommandLineTool
hints:
DockerRequirement:
dockerPull: mcr.microsoft.com/dotnet/sdk:6.0
dockerPull: mcr.microsoft.com/dotnet/sdk:8.0
requirements:
- class: InitialWorkDirRequirement
listing:
@@ -25,12 +25,12 @@ inputs:
type: string
inputBinding:
position: 2
outName:
type: string
inputBinding:
position: 3
startingNodeNum:
type: int
inputBinding:
position: 3
outName:
type: string
inputBinding:
position: 4
@@ -39,5 +39,5 @@ outputs:
type: File[]
outputBinding:
glob:
- "*.tsv"
- "*.csv"
- "*.xlsx"
@@ -4,22 +4,22 @@
#r "nuget: ARCtrl.NET"
#r "nuget: ARCtrl.QueryModel"
#r "nuget: FsSpreadsheet.CsvIO"
open System.IO
open ARCtrl.NET
open ARCtrl
open ARCtrl.QueryModel
open ARCtrl.Helper
open FsSpreadsheet
open FsSpreadsheet.Net
open FsSpreadsheet.CsvIO
// input parameters
// let args : string array = fsi.CommandLineArgs |> Array.tail
// let arcPath = args.[0]
// let assayName = args.[1]
// let startingNodeNum = args.[2] |> int
// let outName = args.[3]
let args : string array = fsi.CommandLineArgs |> Array.tail
let arcPath = args.[0]
let assayName = args.[1]
let startingNodeNum = args.[2] |> int
let outName = args.[3]
type ArcTables with
@@ -31,16 +31,16 @@ type ArcTables with
)
|> ArcTables
// test parameters
let source = __SOURCE_DIRECTORY__
let arcPath = Path.Combine(source, "../../")
let assayName = "Talinum_RNASeq_minimal"
let startingNodeNum = 0
let outName = "rnaseq-samples"
// // test parameters
// let source = __SOURCE_DIRECTORY__
// let arcPath = Path.Combine(source, "../../")
// let assayName = "Talinum_RNASeq_minimal"
// let startingNodeNum = 0
// let outName = "rnaseq-samples"
// Load ARC
// Remove all tables with either an input or output column missing 🤣😀
// Remove all tables with either an input or output column missing
let clean (a : ARC) =
a.ISA.Value.Assays |> Seq.iter (fun a ->
a.Tables
@@ -64,7 +64,7 @@ let clean (a : ARC) =
)
a
// transform all data cells to freetext cells 😀🤣😀😀🤣😀😀🤣😀😀🤣😀😀🤣😀😀🤣😀😀🤣😀
// transform all data cells to freetext cells
let shittify (a : ARC) =
a.ISA.Value.Assays |> Seq.iter (fun a ->
a.Tables
@@ -161,6 +161,8 @@ let wb = new FsSpreadsheet.FsWorkbook()
wb.AddWorksheet ws
// Write to csv
// Write to xlsx
wb.ToXlsxFile ($"{outName}.xlsx")
wb.ToXlsxFile (outName + ".xlsx")
\ No newline at end of file
// Write to csv
wb.ToCsvFile ($"{outName}.csv")
\ No newline at end of file
Loading