diff options
author | Lan Hui <lanhui@zjnu.edu.cn> | 2024-08-26 17:50:12 +0800 |
---|---|---|
committer | Lan Hui <lanhui@zjnu.edu.cn> | 2024-08-26 17:50:12 +0800 |
commit | fa719fee177152cc9f5d4632c6aa68b91336f8df (patch) | |
tree | d450173c26377174c7486d8e53aa44f237aaf5d3 | |
parent | 965c52946eef4cd76f0a4119be63d82348cfee23 (diff) |
JSON file should look like '{key:value}' but not ['{key:value}']
-rw-r--r-- | Code/slice_TPM_to_JSON.R | 20 | ||||
-rw-r--r-- | Code/slice_TPM_to_JSON.py | 2 |
2 files changed, 1 insertions, 21 deletions
diff --git a/Code/slice_TPM_to_JSON.R b/Code/slice_TPM_to_JSON.R deleted file mode 100644 index e7021ef..0000000 --- a/Code/slice_TPM_to_JSON.R +++ /dev/null @@ -1,20 +0,0 @@ - -#library(rjson) -library(jsonlite) -dir.name <- '../Data/history/expr/json' -tpm.file <- '../Data/history/expr/assemble/TPM.6604.txt' -take.log <- 'YES' -X <- read.table(tpm.file, header=T, check.names=FALSE, sep="\t") -gene.id <- as.vector(X[,1]) -X[,1] <- NULL # remove first column -if (take.log == 'YES') { - X <- log(X+1) -} -if (!dir.exists(dir.name)) { - dir.create(dir.name) -} -for (i in 1:dim(X)[1]) { - y <- toJSON(X[i,], digits=I(3)) - file.name = paste(dir.name, paste(gene.id[i], 'json', sep='.'), sep='/') - cat(y, file=file.name) -} diff --git a/Code/slice_TPM_to_JSON.py b/Code/slice_TPM_to_JSON.py index 618310f..b2edfa2 100644 --- a/Code/slice_TPM_to_JSON.py +++ b/Code/slice_TPM_to_JSON.py @@ -141,7 +141,7 @@ def make_json_file_using_r(dir_name, glb_param_dict): # use r script to make it dir.create(dir.name) } for (i in 1:dim(X)[1]) { - y <- toJSON(X[i,], digits=I(3)) + y <- toJSON(unbox(X[i,]), digits=I(3)) file.name = paste(dir.name, paste(gene.id[i], 'json', sep='.'), sep='/') cat(y, file=file.name) } |