Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

runCetran.R 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. ## To run this on your computer, you will need to change rgg home,g_inputdir
  2. ##set the working directory to this file parent folder
  3. #rgghome="~/Gits/CeTrAn/CeTrAn"
  4. rgghome ="/Users/colombj/github_repo/06_divers/CeTrAn/CeTrAn"
  5. inshinyapp=FALSE
  6. GRvar=2 ## say which variable to use at the grouping variable while producing graphs, group=2, genotype=3,...
  7. ## this is to be modified according to data location
  8. outputfile = "output"
  9. g_inputdir = "~/Desktop/diffdom_buri"
  10. #g_outputdir="~/Desktop/diffdom_buri/output"
  11. g_filetablename ="textfiles/Textfiles_compiled.txt"
  12. #those are the variables
  13. g_duration_slider = 10 #default=10, min0 max20
  14. g_bin_size= 1 #default=1, min0 max20
  15. g_supress_paints=TRUE
  16. g_treshold = 8 # min0 max20
  17. g_general= TRUE
  18. g_roundarena= TRUE
  19. g_stripes_deviation=TRUE
  20. g_occupancy= TRUE
  21. g_angledev= TRUE
  22. g_outputtext= TRUE
  23. g_log= TRUE
  24. g_thigmo= TRUE
  25. g_pca= TRUE
  26. g_individual= FALSE
  27. g_open_pdf=FALSE
  28. ###reading the table of groups
  29. g_filetable= read.csv(paste(g_inputdir,g_filetablename, sep="/"),sep = "\t", header=FALSE)
  30. ### R CODE ###
  31. ##############
  32. # setwd(rgghome)
  33. message("start")
  34. # load libs and functions
  35. source("functions/include.r", local=TRUE)
  36. #check if input is ok
  37. if (!exists("g_inputdir")||!exists("g_filetable"))
  38. stop("No input files specified.")
  39. if (ncol(g_filetable)!=2)
  40. stop("Input matrix has a wrong format")
  41. # determine path
  42. datapath = g_inputdir
  43. message(datapath)
  44. # set output dir, need to create the directory if not existant
  45. outputpath = ""
  46. if (exists("g_outputdir")) {
  47. outputpath = g_outputdir
  48. } else {
  49. dir.create (paste(c(datapath,"/output"),collapse=""))
  50. outputpath = paste(c(datapath,"/output"),collapse="")
  51. }
  52. ##fordebug
  53. message("1st")
  54. setwd(outputpath)
  55. save.image(file= paste(outputfile,"_workspace.rdata"))
  56. setwd(rgghome)
  57. message("2nd")
  58. #load fly data
  59. fileName = g_filetable[,1]
  60. group = g_filetable[,2]
  61. # takes fileName, datapath and group
  62. source("scripts/MultipleFilesLoader.r", local=TRUE)
  63. # "traj" contains the trajectories, "env[[i]]" the area informations
  64. # "params[[i]]" the Experiment Parameters and Informations
  65. # id_table the animals and corresponding groups
  66. # print trajectorie information
  67. #print(traj)
  68. # get group and individum information
  69. ### compute and plot data
  70. #suppressWarnings(dir.create(outputpath))
  71. ###########
  72. #########
  73. #individual traces first#
  74. #setwd(rgghome)
  75. # load libs and functions again to avoid any old function to be present
  76. #source("functions/include.r")
  77. if (g_individual) {
  78. source ("scripts/singleflyoutputs.r", local=TRUE)}
  79. source ("scripts/expand_f_table.r", local=TRUE)
  80. group_ids = levels(factor(id_table$group))
  81. print(outputpath)
  82. # write to
  83. message("second")
  84. setwd(outputpath)
  85. message(paste(c("Writing output to ",outputpath),collapse=""))
  86. bla = paste(c(outputfile,"t",g_treshold,"Pt",g_duration_slider,".pdf"),collapse="")
  87. pdf(bla)
  88. setwd(rgghome)
  89. source ("scripts/samplesize.r", local=TRUE)
  90. source ("scripts/exp_length.r", local=TRUE)
  91. if (g_general) {
  92. source ("scripts/general.r", local=TRUE)
  93. source ("scripts/straightness.r", local=TRUE)
  94. source ("scripts/activity_martin.r", local=TRUE)
  95. source ("scripts/activity_log.r", local=TRUE)
  96. }
  97. if (g_roundarena) {
  98. source ("scripts/thigmotaxis.r", local=TRUE)
  99. }
  100. if (g_stripes_deviation){
  101. source ("scripts/angledev.r", local=TRUE)
  102. }
  103. source ("scripts/saveworkspace.r", local=TRUE)
  104. #
  105. setwd(rgghome)
  106. source ("scripts/changef_table.r", local=TRUE)
  107. source ("scripts/pdfoutput.r", local=TRUE)
  108. if (g_occupancy) {
  109. source ("scripts/occupancy.r", local=TRUE)
  110. }
  111. source ("scripts/saveworkspace.r", local=TRUE)
  112. if (g_pca) {source ("scripts/pca.r", local=TRUE)
  113. }
  114. source ("scripts/saveworkspace2.r", local=TRUE)
  115. # close write
  116. g = dev.off()
  117. #
  118. # # open pdf
  119. # setwd(outputpath)
  120. # plot_path = paste(c(getwd(),"/",bla),collapse="")
  121. # if (g_open_pdf) {
  122. # if (.Platform$OS.type=="Linux")
  123. # system(paste(c("gnome-open",plot_path),collapse=" "))
  124. # else
  125. # system(paste(c("open",plot_path),collapse=" "))
  126. # }
  127. #
  128. #
  129. #
  130. #
  131. #
  132. #