Skip to content
Snippets Groups Projects
Commit 85178ec6 authored by Dominik Brilhaus's avatar Dominik Brilhaus
Browse files

there must be a better way for that arcRoot

parent 2e31eeda
No related branches found
No related tags found
No related merge requests found
# cwltool README
## First cd into the (runs) folder, with the .yml file
cwltool ../../workflows/merge_isa_metadata.cwl merge_isa_metadata.yml
\ No newline at end of file
cd /Users/dominikbrilhaus/03_DataPLANT_gitlab/samplearc_rnaseq/runs/merged_isa_metadata
## Let it flow
```bash
### store arc root (two levels up from here) as variable
arc_root=$(echo ${PWD%/*/*})
# arc_root=/Users/dominikbrilhaus/03_DataPLANT_gitlab/samplearc_rnaseq/
### write a temporary yml
cat merge_isa_metadata.yml > merge_isa_metadata_rooted.yml
### add the arc root to that yml
printf "\narc_root: $arc_root\n" >> merge_isa_metadata_rooted.yml
### run with cwltool
cwltool ../../workflows/merge_isa_metadata.cwl merge_isa_metadata_rooted.yml
```
......@@ -2,8 +2,6 @@ cores: 1
r_script:
class: File
path: ../../workflows/merge_isa_metadata.R
# arc_root: ../
arc_root: /Users/dominikbrilhaus/03_DataPLANT_gitlab/samplearc_rnaseq/
in_isa_study: studies/TalinumFacultativeCAM/isa.study.xlsx:plant_growth
in_isa_assay: assays/Talinum_RNASeq_minimal/isa.assay.xlsx:2EXT01_RNA:3ASY01_RNASeq
out_folder: runs/merged_isa_metadata
\ No newline at end of file
cores: 1
r_script:
class: File
path: ../../workflows/merge_isa_metadata.R
in_isa_study: studies/TalinumFacultativeCAM/isa.study.xlsx:plant_growth
in_isa_assay: assays/Talinum_RNASeq_minimal/isa.assay.xlsx:2EXT01_RNA:3ASY01_RNASeq
out_folder: runs/merged_isa_metadata
arc_root: /Users/dominikbrilhaus/03_DataPLANT_gitlab/samplearc_rnaseq
......@@ -26,8 +26,6 @@ in_isa_study <- args[2]
in_isa_assay <- args[3]
out_folder <- args[4]
# setwd(arc_root)
################################################
#### Read metadata from isa excel workbooks
################################################
......@@ -36,12 +34,12 @@ isa_study <- unlist(strsplit(paste(arc_root, in_isa_study, sep = "/"), split = "
isa_assay <- unlist(strsplit(paste(arc_root, in_isa_assay, sep = "/"), split = ":"))
isa_sheets <- list()
for(i in 2:length(isa_study))
for (i in 2:length(isa_study))
{
isa_sheets[[length(isa_sheets) + 1]] <- readWorkbook(isa_study[1], isa_study[i], startRow = 1)
}
for(i in 2:length(isa_assay))
for (i in 2:length(isa_assay))
{
isa_sheets[[length(isa_sheets) + 1]] <- readWorkbook(isa_assay[1], isa_assay[i], startRow = 1)
}
......@@ -52,20 +50,19 @@ for(i in 2:length(isa_assay))
isa_merged <- isa_sheets[[1]]
for(j in 2:length(isa_sheets))
for (j in 2:length(isa_sheets))
# for(j in 2)
{
isa_merged <- merge(isa_merged,
isa_sheets[[j]],
by.x = "Sample.Name",
by.y = "Source.Name",
isa_sheets[[j]],
by.x = "Sample.Name",
by.y = "Source.Name",
)
# Rename duplicated Sample.Name column
colnames(isa_merged)[which(colnames(isa_merged) == "Sample.Name")] <- paste("Sample.Name", j, sep = ".")
colnames(isa_merged)[which(colnames(isa_merged) == "Sample.Name.y")] <- "Sample.Name"
}
......@@ -87,4 +84,4 @@ dir.create(paste(arc_root, out_folder, sep = "/"), recursive = T, showWarnings =
#### Write table to file
################################################
write.table(isa_merged, file = paste(arc_root, out_folder, "merged_isa.tsv", sep = "/"), sep = "\t")
\ No newline at end of file
write.table(isa_merged, file = paste(arc_root, out_folder, "merged_isa.tsv", sep = "/"), sep = "\t")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment