about summary refs log tree commit diff
path: root/scripts/rqtl2_wrapper.R
diff options
context:
space:
mode:
authorAlexander_Kabui2024-10-29 17:27:08 +0300
committerAlexander_Kabui2024-10-29 17:27:08 +0300
commit3cd3b252e8fe89d9b835f8362cc017289d97b257 (patch)
tree931e5bb8220271b6a1f1399afd4c312e37989b2b /scripts/rqtl2_wrapper.R
parent741e88920bc71945b76702bc3ddd0bee2e93acd6 (diff)
downloadgenenetwork3-3cd3b252e8fe89d9b835f8362cc017289d97b257.tar.gz
feat: write output results as json.
Diffstat (limited to 'scripts/rqtl2_wrapper.R')
-rw-r--r--scripts/rqtl2_wrapper.R21
1 files changed, 19 insertions, 2 deletions
diff --git a/scripts/rqtl2_wrapper.R b/scripts/rqtl2_wrapper.R
index d8cf755..4c1e3dc 100644
--- a/scripts/rqtl2_wrapper.R
+++ b/scripts/rqtl2_wrapper.R
@@ -307,8 +307,8 @@ generate_lod_plot <- function(cross, scan_result, method, base_dir = ".") {
 }
 
 
-lod_file_path <- generate_lod_plot(dataset, scan_results, "HK")
-lod_file_path
+lod_plot_path <- generate_lod_plot(dataset, scan_results, "HK")
+lod_plot_path
 
 
 # perform  permutation tests for single-QTL method
@@ -421,3 +421,20 @@ lod_peaks = find_peaks(
 )
 
 lod_peaks
+cat("Generating the ouput data as  vector\n")
+output = list(lod_peaks = lod_peaks,
+             scan_results =scan_results,
+	     lod_significance = lod_significance,
+	     permutation_results = perm,
+	     lod_peaks = lod_peaks,
+	     lod_plot_path =lod_plot_path,
+	     scan_method = SCAN_METHOD  
+	     )
+
+output_json_data <-toJSON(output)
+file_name = genRandomFileName(prefix = "RQTL_output_", file_ext = ".json")
+output_file_path = file.path("." , file_name)
+str_glue("The output file path is  {output_file_path}")
+cat("Writing to the output file\n")
+write(output_json_data, file=output_file_path)
+