This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
forked from HusseinLakkis01/scCoAnnotate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from fungenomics/dev
moved ontology processing to separate rule (#129)
- Loading branch information
Showing
4 changed files
with
82 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
library(tidyverse) | ||
|
||
set.seed(1234) | ||
|
||
args = commandArgs(trailingOnly = TRUE) | ||
|
||
out = args[1] | ||
reference_name = args[2] | ||
lab_path = args[3] | ||
ontology_path = args[4] | ||
ontology_columns = strsplit(args[5], split = ' ')[[1]] | ||
|
||
print(out) | ||
print(lab_path) | ||
print(reference_name) | ||
print(ontology_path) | ||
print(ontology_columns) | ||
|
||
#----- SAVE ONTOLOGY ----------------------------------- | ||
|
||
dir.create(paste0(out, '/model/', reference_name, '/ontology/'), recursive = T) | ||
|
||
if(length(ontology_columns) == 1 & ontology_columns[1] == 'label'){ | ||
|
||
lab = data.table::fread(lab_path, header = T) | ||
print(lab) | ||
|
||
ont = data.frame(label = unique(lab$label)) | ||
print(ont) | ||
|
||
data.table::fwrite(ont, | ||
file = paste0(out, '/model/', reference_name, '/ontology/ontology.csv'), | ||
sep = ',') | ||
}else{ | ||
ont = data.table::fread(ontology_path) | ||
print(ont) | ||
|
||
data.table::fwrite(ont, | ||
file = paste0(out, '/model/', reference_name, '/ontology/ontology.csv'), | ||
sep = ',') | ||
} | ||
|
||
#-------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters