Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

initial commit

  • Loading branch information...
commit 9d0ce88b183d59d87ce5459d54f59f41dc6cc52c 0 parents
Johannes Goll authored
Showing with 26,569 additions and 0 deletions.
  1. +8 −0 README
  2. +6 −0 app/.htaccess
  3. +74 −0 app/config/acl.ini.php
  4. +44 −0 app/config/bootstrap.php
  5. +245 −0 app/config/core.php
  6. +59 −0 app/config/database.php
  7. +6 −0 app/config/htaccess/htaccess_app
  8. +6 −0 app/config/htaccess/htaccess_root
  9. +7 −0 app/config/htaccess/htaccess_webroot
  10. +70 −0 app/config/inflections.php
  11. +52 −0 app/config/routes.php
  12. +79 −0 app/config/sql/db_acl.php
  13. +40 −0 app/config/sql/db_acl.sql
  14. +56 −0 app/config/sql/i18n.php
  15. +26 −0 app/config/sql/i18n.sql
  16. +53 −0 app/config/sql/sessions.php
  17. +16 −0 app/config/sql/sessions.sql
  18. +225 −0 app/controllers/app_controller.php
  19. +627 −0 app/controllers/browse_controller.php
  20. +1,101 −0 app/controllers/compare_controller.php
  21. +249 −0 app/controllers/components/authsome.php
  22. +25 −0 app/controllers/components/baseModel.php
  23. +210 −0 app/controllers/components/format.php
  24. +563 −0 app/controllers/components/matrix.php
  25. +20 −0 app/controllers/components/r.php
  26. +320 −0 app/controllers/components/solr.php
  27. +58 −0 app/controllers/dashboard_controller.php
  28. +14 −0 app/controllers/errors_controller.php
  29. +76 −0 app/controllers/libraries_controller.php
  30. +13 −0 app/controllers/logs_controller.php
  31. +20 −0 app/controllers/menus_controller.php
  32. +137 −0 app/controllers/populations_controller.php
  33. +138 −0 app/controllers/projects_controller.php
  34. +55 −0 app/controllers/rest_controller.php
  35. +260 −0 app/controllers/search_controller.php
  36. +38 −0 app/controllers/user_group_permissions_controller.php
  37. +7 −0 app/controllers/user_groups_controller.php
  38. +296 −0 app/controllers/users_controller.php
  39. +322 −0 app/controllers/view_controller.php
  40. +24 −0 app/index.php
  41. 0  app/locale/eng/LC_MESSAGES/empty
  42. 0  app/models/behaviors/empty
  43. +195 −0 app/models/behaviors/membership.php
  44. 0  app/models/datasources/empty
  45. +182 −0 app/models/datasources/rss_source.php
  46. +218 −0 app/models/datasources/soap_source.php
  47. +81 −0 app/models/datasources/solr_source.php
  48. +11 −0 app/models/environmental_library.php
  49. +13 −0 app/models/enzyme.php
  50. +23 −0 app/models/go_graph.php
  51. +19 −0 app/models/go_term.php
  52. +6 −0 app/models/gos_blog.php
  53. +11 −0 app/models/hmm.php
  54. +14 −0 app/models/kegg.php
  55. +61 −0 app/models/library.php
  56. +9 −0 app/models/log.php
  57. +4 −0 app/models/login_token.php
  58. +44 −0 app/models/pathway.php
  59. +51 −0 app/models/population.php
  60. +244 −0 app/models/project.php
  61. +12 −0 app/models/taxonomy.php
  62. +212 −0 app/models/user.php
  63. +65 −0 app/models/user_group.php
  64. +7 −0 app/models/user_group_permission.php
  65. 0  app/plugins/empty
  66. +62 −0 app/plugins/spark_plug/config/config.php
  67. +7 −0 app/plugins/spark_plug/config/routes.php
  68. +139 −0 app/plugins/spark_plug/config/schema/spark_plug.sql
  69. +242 −0 app/plugins/spark_plug/controllers/components/authsome.php
  70. 0  app/plugins/spark_plug/controllers/components/empty
  71. +38 −0 app/plugins/spark_plug/controllers/user_group_permissions_controller.php
  72. +7 −0 app/plugins/spark_plug/controllers/user_groups_controller.php
  73. +214 −0 app/plugins/spark_plug/controllers/users_controller.php
  74. +178 −0 app/plugins/spark_plug/models/behaviors/membership.php
  75. +6 −0 app/plugins/spark_plug/models/company.php
  76. +4 −0 app/plugins/spark_plug/models/login_token.php
  77. +150 −0 app/plugins/spark_plug/models/user.php
  78. +65 −0 app/plugins/spark_plug/models/user_group.php
  79. +7 −0 app/plugins/spark_plug/models/user_group_permission.php
  80. +11 −0 app/plugins/spark_plug/spark_plug_app_controller.php
  81. +20 −0 app/plugins/spark_plug/spark_plug_app_model.php
  82. 0  app/plugins/spark_plug/tests/cases/behaviors/empty
  83. 0  app/plugins/spark_plug/tests/cases/components/empty
  84. 0  app/plugins/spark_plug/tests/cases/controllers/empty
  85. 0  app/plugins/spark_plug/tests/cases/helpers/empty
  86. +239 −0 app/plugins/spark_plug/tests/cases/models/user.test.php
  87. +83 −0 app/plugins/spark_plug/tests/cases/models/user_group.test.php
  88. +11 −0 app/plugins/spark_plug/tests/fixtures/company_fixture.php
  89. +7 −0 app/plugins/spark_plug/tests/fixtures/login_token_fixture.php
  90. +26 −0 app/plugins/spark_plug/tests/fixtures/user_fixture.php
  91. +12 −0 app/plugins/spark_plug/tests/fixtures/user_group_fixture.php
  92. +59 −0 app/plugins/spark_plug/tests/fixtures/user_group_permission_fixture.php
  93. 0  app/plugins/spark_plug/tests/groups/empty
  94. +1,615 −0 app/plugins/spark_plug/vendors/phpmailer/class.phpmailer.php
  95. +1,008 −0 app/plugins/spark_plug/vendors/phpmailer/class.smtp.php
  96. +1,043 −0 app/plugins/spark_plug/vendors/phpmailer/phpmailer_doc.html
  97. +6 −0 app/plugins/spark_plug/views/elements/layout/control_panel/icon.ctp
  98. +1 −0  app/plugins/spark_plug/views/elements/layout/email/text/default.thtml
  99. +1 −0  app/plugins/spark_plug/views/elements/layout/footer.ctp
  100. +19 −0 app/plugins/spark_plug/views/elements/layout/header.ctp
  101. +4 −0 app/plugins/spark_plug/views/elements/layout/help_section.ctp
  102. +24 −0 app/plugins/spark_plug/views/elements/layout/logged_in_menu.default.ctp
  103. +39 −0 app/plugins/spark_plug/views/elements/layout/rightcol.ctp
  104. 0  app/plugins/spark_plug/views/helpers/empty
  105. +11 −0 app/plugins/spark_plug/views/user_group_permissions/add.ctp
  106. +12 −0 app/plugins/spark_plug/views/user_group_permissions/edit.ctp
  107. +51 −0 app/plugins/spark_plug/views/user_group_permissions/index.ctp
  108. +8 −0 app/plugins/spark_plug/views/users/activate_password.ctp
  109. +7 −0 app/plugins/spark_plug/views/users/change_password.ctp
  110. +16 −0 app/plugins/spark_plug/views/users/dashboard.ctp
  111. +19 −0 app/plugins/spark_plug/views/users/edit.ctp
  112. +16 −0 app/plugins/spark_plug/views/users/forgot_password.ctp
  113. +63 −0 app/plugins/spark_plug/views/users/index.ctp
  114. +9 −0 app/plugins/spark_plug/views/users/login.ctp
  115. +36 −0 app/plugins/spark_plug/views/users/register.ctp
  116. 0  app/tests/cases/behaviors/empty
  117. 0  app/tests/cases/components/empty
  118. +26 −0 app/tests/cases/controllers/annotations_controller.test.php
  119. +26 −0 app/tests/cases/controllers/blast_results_controller.test.php
  120. 0  app/tests/cases/controllers/empty
  121. +26 −0 app/tests/cases/controllers/libraries_controller.test.php
  122. +26 −0 app/tests/cases/controllers/peptides_controller.test.php
  123. +26 −0 app/tests/cases/controllers/projects_controller.test.php
  124. +26 −0 app/tests/cases/controllers/reads_controller.test.php
  125. +26 −0 app/tests/cases/controllers/rrnas_controller.test.php
  126. +26 −0 app/tests/cases/controllers/trnas_controller.test.php
  127. 0  app/tests/cases/helpers/empty
  128. +40 −0 app/tests/cases/models/annotation.test.php
  129. +45 −0 app/tests/cases/models/blast_result.test.php
  130. 0  app/tests/cases/models/empty
  131. +32 −0 app/tests/cases/models/library.test.php
  132. +32 −0 app/tests/cases/models/peptide.test.php
  133. +30 −0 app/tests/cases/models/project.test.php
  134. +31 −0 app/tests/cases/models/read.test.php
  135. +33 −0 app/tests/cases/models/rrna.test.php
  136. +33 −0 app/tests/cases/models/trna.test.php
  137. +38 −0 app/tests/fixtures/annotation_fixture.php
  138. +48 −0 app/tests/fixtures/blast_result_fixture.php
  139. 0  app/tests/fixtures/empty
  140. +22 −0 app/tests/fixtures/library_fixture.php
  141. +22 −0 app/tests/fixtures/peptide_fixture.php
  142. +18 −0 app/tests/fixtures/project_fixture.php
  143. +20 −0 app/tests/fixtures/read_fixture.php
  144. +24 −0 app/tests/fixtures/rrna_fixture.php
  145. +24 −0 app/tests/fixtures/trna_fixture.php
  146. 0  app/tests/groups/empty
  147. 0  app/vendors/shells/tasks/empty
  148. 0  app/vendors/shells/templates/empty
  149. +82 −0 app/views/browse/apis_taxonomy.ctp
  150. +88 −0 app/views/browse/blast_taxonomy.ctp
  151. +81 −0 app/views/browse/enzymes.ctp
  152. +86 −0 app/views/browse/gene_ontology.ctp
  153. +101 −0 app/views/browse/pathways.ctp
  154. +176 −0 app/views/compare/index.ctp
  155. +234 −0 app/views/compare/result_panel.ctp
  156. +135 −0 app/views/compare/tab_panel.ctp
  157. +160 −0 app/views/dashboard/index.ctp
  158. +101 −0 app/views/dashboard/user_dashboard.ctp
  159. +9 −0 app/views/elements/message.ctp
  160. +6 −0 app/views/elements/solr_exception.ctp
  161. 0  app/views/errors/empty
  162. +8 −0 app/views/errors/index_update.ctp
  163. +116 −0 app/views/helpers/crumb.php
  164. +188 −0 app/views/helpers/dialog.php
  165. 0  app/views/helpers/empty
  166. +412 −0 app/views/helpers/facet.php
  167. +133 −0 app/views/helpers/lucene_result_paginator.php
  168. +644 −0 app/views/helpers/matrix.php
  169. +235 −0 app/views/helpers/tree.php
  170. +172 −0 app/views/layouts/default.ctp
  171. +1 −0  app/views/layouts/empty.ctp
  172. +24 −0 app/views/layouts/jcvi.ctp
  173. 0  app/views/layouts/js/empty
  174. 0  app/views/layouts/rss/empty
  175. 0  app/views/layouts/xml/empty
  176. +19 −0 app/views/libraries/add.ctp
  177. +56 −0 app/views/libraries/edit.ctp
  178. +79 −0 app/views/libraries/index.ctp
  179. +26 −0 app/views/libraries/view.ctp
  180. +73 −0 app/views/logs/index.ctp
  181. +83 −0 app/views/menus/quick.ctp
  182. +88 −0 app/views/populations/add.ctp
  183. +75 −0 app/views/populations/edit.ctp
  184. +95 −0 app/views/populations/index.ctp
  185. +144 −0 app/views/populations/view.ctp
  186. +70 −0 app/views/populations/wait.ctp
  187. +15 −0 app/views/projects/add.ctp
  188. +32 −0 app/views/projects/edit.ctp
  189. +77 −0 app/views/projects/index.ctp
  190. +66 −0 app/views/projects/index_no_pagination.ctp
  191. +246 −0 app/views/projects/view.ctp
  192. +22 −0 app/views/reads/add.ctp
  193. +24 −0 app/views/reads/edit.ctp
  194. +58 −0 app/views/reads/index.ctp
  195. +39 −0 app/views/reads/taxonomic_distribution.ctp
  196. +135 −0 app/views/reads/view.ctp
  197. +4 −0 app/views/rest/projects.ctp
  198. +2 −0  app/views/rest/xml/index.ctp
  199. +3 −0  app/views/rest/xml/projects.ctp
  200. 0  app/views/scaffolds/empty
  201. +74 −0 app/views/search/index.ctp
  202. +11 −0 app/views/user_group_permissions/add.ctp
  203. +12 −0 app/views/user_group_permissions/edit.ctp
  204. +51 −0 app/views/user_group_permissions/index.ctp
  205. +32 −0 app/views/users/activate_password.ctp
  206. +39 −0 app/views/users/change_password.ctp
  207. +109 −0 app/views/users/dashboard.ctp
  208. +57 −0 app/views/users/edit.ctp
  209. +73 −0 app/views/users/edit_project_users.ctp
  210. +32 −0 app/views/users/forgot_password.ctp
  211. +71 −0 app/views/users/index.ctp
  212. +41 −0 app/views/users/register.ctp
  213. +16 −0 app/views/view/apis.ctp
  214. +43 −0 app/views/view/facet_panel.ctp
  215. +115 −0 app/views/view/index.ctp
  216. +7 −0 app/webroot/.htaccess
  217. +102 −0 app/webroot/css.php
  218. +83 −0 app/webroot/css/browse.css
  219. +699 −0 app/webroot/css/cake.generic.css
  220. +481 −0 app/webroot/css/cake.generic_backup.css
  221. +265 −0 app/webroot/css/comparator.css
  222. +128 −0 app/webroot/css/dashboard.css
  223. +56 −0 app/webroot/css/glide-menu.css
  224. BIN  app/webroot/css/images/ui-bg_flat_0_aaaaaa_40x100.png
  225. BIN  app/webroot/css/images/ui-bg_flat_75_ffffff_40x100.png
  226. BIN  app/webroot/css/images/ui-bg_glass_55_fbf9ee_1x400.png
  227. BIN  app/webroot/css/images/ui-bg_glass_65_ffffff_1x400.png
  228. BIN  app/webroot/css/images/ui-bg_glass_75_dadada_1x400.png
  229. BIN  app/webroot/css/images/ui-bg_glass_75_e6e6e6_1x400.png
  230. BIN  app/webroot/css/images/ui-bg_glass_95_fef1ec_1x400.png
  231. BIN  app/webroot/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  232. BIN  app/webroot/css/images/ui-icons_222222_256x240.png
  233. BIN  app/webroot/css/images/ui-icons_2e83ff_256x240.png
  234. BIN  app/webroot/css/images/ui-icons_454545_256x240.png
  235. BIN  app/webroot/css/images/ui-icons_888888_256x240.png
  236. BIN  app/webroot/css/images/ui-icons_cd0a0a_256x240.png
  237. +406 −0 app/webroot/css/jquery-ui-1.7.2.custom.css
  238. +110 −0 app/webroot/css/population.css
  239. +119 −0 app/webroot/css/search.css
  240. +34 −0 app/webroot/css/ui.multiselect.css
  241. +75 −0 app/webroot/css/user-dashboard.css
  242. +55 −0 app/webroot/css/view.css
  243. +13 −0 app/webroot/files/r/metastats/Routput.diffAb
  244. +443 −0 app/webroot/files/r/metastats/detect_DA_features.r
  245. +15 −0 app/webroot/files/r/metastats/jrw.manmouse.class.matrix
  246. +4 −0 app/webroot/files/r/metastats/run_metastats.r
  247. +227 −0 app/webroot/files/r/r_plots.r
  248. +231 −0 app/webroot/files/r/r_plots_backup.r
  249. BIN  app/webroot/img/387.jpg
  250. BIN  app/webroot/img/Thumbs.db
  251. BIN  app/webroot/img/ajax-loader-small.gif
  252. BIN  app/webroot/img/ajax-loader.gif
  253. BIN  app/webroot/img/ajax.gif
  254. BIN  app/webroot/img/arrow.gif
  255. BIN  app/webroot/img/arrow_dn.gif
  256. BIN  app/webroot/img/arrow_up.gif
  257. BIN  app/webroot/img/bc_bg.png
  258. BIN  app/webroot/img/bc_separator.png
  259. BIN  app/webroot/img/button.png
  260. BIN  app/webroot/img/cake.icon.gif
  261. BIN  app/webroot/img/cake.power.gif
  262. BIN  app/webroot/img/cakephp.png
  263. BIN  app/webroot/img/download-large.png
  264. BIN  app/webroot/img/download-medium.png
  265. BIN  app/webroot/img/download-small.png
  266. BIN  app/webroot/img/fieldset_gradient.jpg
  267. BIN  app/webroot/img/home.png
  268. BIN  app/webroot/img/lastnode.png
  269. BIN  app/webroot/img/metarep-browse.jpg
  270. BIN  app/webroot/img/metarep-compare.jpg
  271. BIN  app/webroot/img/metarep-download.jpg
  272. BIN  app/webroot/img/metarep-search.jpg
  273. BIN  app/webroot/img/metarep-view.jpg
  274. BIN  app/webroot/img/node.png
  275. BIN  app/webroot/img/solr.jpg
  276. BIN  app/webroot/img/sort-asc.gif
  277. BIN  app/webroot/img/sort-bg.gif
  278. BIN  app/webroot/img/sort-desc.gif
  279. BIN  app/webroot/img/vline.png
  280. +95 −0 app/webroot/index.php
  281. +136 −0 app/webroot/js/builder.js
  282. +965 −0 app/webroot/js/controls.js
  283. +974 −0 app/webroot/js/dragdrop.js
  284. +1,123 −0 app/webroot/js/effects.js
  285. +697 −0 app/webroot/js/jGlideMenu.069/jQuery.jGlideMenu.069.js
  286. +90 −0 app/webroot/js/jQuery.jGlideMenu.067.min.js
  287. +15 −0 app/webroot/js/jquery.qtip-1.0.0-rc3.min.js
  288. BIN  app/webroot/js/jquery/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
  289. BIN  app/webroot/js/jquery/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
  290. BIN  app/webroot/js/jquery/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
  291. BIN  app/webroot/js/jquery/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
  292. BIN  app/webroot/js/jquery/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png
  293. BIN  app/webroot/js/jquery/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
  294. BIN  app/webroot/js/jquery/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
  295. BIN  app/webroot/js/jquery/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  296. BIN  app/webroot/js/jquery/css/smoothness/images/ui-icons_222222_256x240.png
  297. BIN  app/webroot/js/jquery/css/smoothness/images/ui-icons_2e83ff_256x240.png
  298. BIN  app/webroot/js/jquery/css/smoothness/images/ui-icons_454545_256x240.png
  299. BIN  app/webroot/js/jquery/css/smoothness/images/ui-icons_888888_256x240.png
  300. BIN  app/webroot/js/jquery/css/smoothness/images/ui-icons_cd0a0a_256x240.png
Sorry, we could not display the entire diff because too many files (1,281) changed.
8 README
@@ -0,0 +1,8 @@
+METAREP WEB DIRECTORY
+
+/app application files
+/cake cake framework files
+/parsers lucene index parsing/generating files
+/solr-server solr server configuration files
+/vendors 3rd-party php tools
+
6 app/.htaccess
@@ -0,0 +1,6 @@
+<IfModule mod_rewrite.c>
+ RewriteEngine on
+ RewriteBase /metarep
+ RewriteRule ^$ webroot/ [L]
+ RewriteRule (.*) webroot/$1 [L]
+ </IfModule>
74 app/config/acl.ini.php
@@ -0,0 +1,74 @@
+;<?php die() ?>
+; SVN FILE: $Id: acl.ini.php 7945 2008-12-19 02:16:01Z gwoo $
+;/**
+; * Short description for file.
+; *
+; *
+; * PHP versions 4 and 5
+; *
+; * CakePHP(tm) : Rapid Development Framework http://www.cakephp.org/
+; * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+; *
+; * Licensed under The MIT License
+; * Redistributions of files must retain the above copyright notice.
+; *
+; * @filesource
+; * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+; * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
+; * @package cake
+; * @subpackage cake.app.config
+; * @since CakePHP(tm) v 0.10.0.1076
+; * @version $Revision: 7945 $
+; * @modifiedby $LastChangedBy: gwoo $
+; * @lastmodified $Date: 2008-12-18 18:16:01 -0800 (Thu, 18 Dec 2008) $
+; * @license http://www.opensource.org/licenses/mit-license.php The MIT License
+; */
+
+; acl.ini.php - Cake ACL Configuration
+; ---------------------------------------------------------------------
+; Use this file to specify user permissions.
+; aco = access control object (something in your application)
+; aro = access request object (something requesting access)
+;
+; User records are added as follows:
+;
+; [uid]
+; groups = group1, group2, group3
+; allow = aco1, aco2, aco3
+; deny = aco4, aco5, aco6
+;
+; Group records are added in a similar manner:
+;
+; [gid]
+; allow = aco1, aco2, aco3
+; deny = aco4, aco5, aco6
+;
+; The allow, deny, and groups sections are all optional.
+; NOTE: groups names *cannot* ever be the same as usernames!
+;
+; ACL permissions are checked in the following order:
+; 1. Check for user denies (and DENY if specified)
+; 2. Check for user allows (and ALLOW if specified)
+; 3. Gather user's groups
+; 4. Check group denies (and DENY if specified)
+; 5. Check group allows (and ALLOW if specified)
+; 6. If no aro, aco, or group information is found, DENY
+;
+; ---------------------------------------------------------------------
+
+;-------------------------------------
+;Users
+;-------------------------------------
+
+[username-goes-here]
+groups = group1, group2
+deny = aco1, aco2
+allow = aco3, aco4
+
+;-------------------------------------
+;Groups
+;-------------------------------------
+
+[groupname-goes-here]
+deny = aco5, aco6
+allow = aco7, aco8
44 app/config/bootstrap.php
@@ -0,0 +1,44 @@
+<?php
+/* SVN FILE: $Id: bootstrap.php 7945 2008-12-19 02:16:01Z gwoo $ */
+/**
+ * Short description for file.
+ *
+ * Long description for file
+ *
+ * PHP versions 4 and 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
+ * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @filesource
+ * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
+ * @package cake
+ * @subpackage cake.app.config
+ * @since CakePHP(tm) v 0.10.8.2117
+ * @version $Revision: 7945 $
+ * @modifiedby $LastChangedBy: gwoo $
+ * @lastmodified $Date: 2008-12-18 18:16:01 -0800 (Thu, 18 Dec 2008) $
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License
+ */
+/**
+ *
+ * This file is loaded automatically by the app/webroot/index.php file after the core bootstrap.php is loaded
+ * This is an application wide file to load any function that is not used within a class define.
+ * You can also use this to include or require any files in your application.
+ *
+ */
+/**
+ * The settings below can be used to set additional paths to models, views and controllers.
+ * This is related to Ticket #470 (https://trac.cakephp.org/ticket/470)
+ *
+ * $modelPaths = array('full path to models', 'second full path to models', 'etc...');
+ * $viewPaths = array('this path to views', 'second full path to views', 'etc...');
+ * $controllerPaths = array('this path to controllers', 'second full path to controllers', 'etc...');
+ *
+ */
+//EOF
+?>
245 app/config/core.php
@@ -0,0 +1,245 @@
+<?php
+/* SVN FILE: $Id: core.php 7945 2008-12-19 02:16:01Z gwoo $ */
+/**
+ * This is core configuration file.
+ *
+ * Use it to configure core behavior of Cake.
+ *
+ * PHP versions 4 and 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
+ * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @filesource
+ * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
+ * @package cake
+ * @subpackage cake.app.config
+ * @since CakePHP(tm) v 0.2.9
+ * @version $Revision: 7945 $
+ * @modifiedby $LastChangedBy: gwoo $
+ * @lastmodified $Date: 2008-12-18 18:16:01 -0800 (Thu, 18 Dec 2008) $
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License
+ */
+
+#include_once(ROOT.'/app/plugins/spark_plug/config/config.php');
+
+
+/**
+ * CakePHP Debug Level:
+ *
+ * Production Mode:
+ * 0: No error messages, errors, or warnings shown. Flash messages redirect.
+ *
+ * Development Mode:
+ * 1: Errors and warnings shown, model caches refreshed, flash messages halted.
+ * 2: As in 1, but also with full debug messages and SQL output.
+ * 3: As in 2, but also with full controller dump.
+ *
+ * In production mode, flash messages redirect after a time interval.
+ * In development mode, you need to click the flash message to continue.
+ */
+ Configure::write('debug', '1');
+
+/**
+ * Application wide charset encoding
+ */
+ Configure::write('App.encoding', 'UTF-8');
+
+ define('METAREP_TMP_DIR','/opt/www/metarep/tmp');
+
+/**
+ * To configure CakePHP *not* to use mod_rewrite and to
+ * use CakePHP pretty URLs, remove these .htaccess
+ * files:
+ *
+ * /.htaccess
+ * /app/.htaccess
+ * /app/webroot/.htaccess
+ *
+ * And uncomment the App.baseUrl below:
+ */
+ //Configure::write('App.baseUrl', env('SCRIPT_NAME'));
+/**
+ * Uncomment the define below to use CakePHP admin routes.
+ *
+ * The value of the define determines the name of the route
+ * and its associated controller actions:
+ *
+ * 'admin' -> admin_index() and /admin/controller/index
+ * 'superuser' -> superuser_index() and /superuser/controller/index
+ */
+ //Configure::write('Routing.admin', 'admin');
+
+/**
+ * Turn off all caching application-wide.
+ *
+ */
+ //Configure::write('Cache.disable', true);
+/**
+ * Enable cache checking.
+ *
+ * If set to true, for view caching you must still use the controller
+ * var $cacheAction inside your controllers to define caching settings.
+ * You can either set it controller-wide by setting var $cacheAction = true,
+ * or in each action using $this->cacheAction = true.
+ *
+ */
+ //Configure::write('Cache.check', true);
+/**
+ * Defines the default error type when using the log() function. Used for
+ * differentiating error logging and debugging. Currently PHP supports LOG_DEBUG.
+ */
+ define('LOG_ERROR', 2);
+
+
+
+/**
+ * The preferred session handling method. Valid values:
+ *
+ * 'php' Uses settings defined in your php.ini.
+ * 'cake' Saves session files in CakePHP's /tmp directory.
+ * 'database' Uses CakePHP's database sessions.
+ *
+ * To define a custom session handler, save it at /app/config/<name>.php.
+ * Set the value of 'Session.save' to <name> to utilize it in CakePHP.
+ *
+ * To use database sessions, execute the SQL file found at /app/config/sql/sessions.sql.
+ *
+ */
+ Configure::write('Session.save', 'database');
+/**
+ * The name of the table used to store CakePHP database sessions.
+ *
+ * 'Session.save' must be set to 'database' in order to utilize this constant.
+ *
+ * The table name set here should *not* include any table prefix defined elsewhere.
+ */
+ Configure::write('Session.table', 'cake_sessions');
+/**
+ * The DATABASE_CONFIG::$var to use for database session handling.
+ *
+ * 'Session.save' must be set to 'database' in order to utilize this constant.
+ */
+ Configure::write('Session.database', 'default');
+/**
+ * The name of CakePHP's session cookie.
+ */
+ Configure::write('Session.cookie', 'CAKEPHP');
+/**
+ * Session time out time (in seconds).
+ * Actual value depends on 'Security.level' setting.
+ */
+ Configure::write('Session.timeout', '120');
+/**
+ * If set to false, sessions are not automatically started.
+ */
+ Configure::write('Session.start', true);
+
+/**
+ * Set maxium mem limit.
+ * PHP Fatal error: Allowed memory size of bytes exhausted (tried to allocate 4 bytes) in dbo_mysql.php
+ */
+define ('MAX_MEMORY_LIMIT', '512M');
+
+/**
+ * When set to false, HTTP_USER_AGENT will not be checked
+ * in the session
+ */
+ Configure::write('Session.checkAgent', true);
+/**
+ * The level of CakePHP security. The session timeout time defined
+ * in 'Session.timeout' is multiplied according to the settings here.
+ * Valid values:
+ *
+ * 'high' Session timeout in 'Session.timeout' x 10
+ * 'medium' Session timeout in 'Session.timeout' x 100
+ * 'low' Session timeout in 'Session.timeout' x 300
+ *
+ * CakePHP session IDs are also regenerated between requests if
+ * 'Security.level' is set to 'high'.
+ */
+ Configure::write('Security.level', 'low');
+/**
+ * A random string used in security hashing methods.
+ */
+ Configure::write('Security.salt', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi');
+/**
+ * Compress CSS output by removing comments, whitespace, repeating tags, etc.
+ * This requires a/var/cache directory to be writable by the web server for caching.
+ * and /vendors/csspp/csspp.php
+ *
+ * To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or use HtmlHelper::css().
+ */
+ //Configure::write('Asset.filter.css', 'css.php');
+/**
+ * Plug in your own custom JavaScript compressor by dropping a script in your webroot to handle the
+ * output, and setting the config below to the name of the script.
+ *
+ * To use, prefix your JavaScript link URLs with '/cjs/' instead of '/js/' or use JavaScriptHelper::link().
+ */
+ //Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php');
+/**
+ * The classname and database used in CakePHP's
+ * access control lists.
+ */
+ Configure::write('Acl.classname', 'DbAcl');
+ Configure::write('Acl.database', 'default');
+/**
+ *
+ * Cache Engine Configuration
+ * Default settings provided below
+ *
+ * File storage engine.
+ *
+ * Cache::config('default', array(
+ * 'engine' => 'File', //[required]
+ * 'duration'=> 3600, //[optional]
+ * 'probability'=> 100, //[optional]
+ * 'path' => CACHE, //[optional] use system tmp directory - remember to use absolute path
+ * 'prefix' => 'cake_', //[optional] prefix every cache file with this string
+ * 'lock' => false, //[optional] use file locking
+ * 'serialize' => true, [optional]
+ * ));
+ *
+ *
+ * APC (http://pecl.php.net/package/APC)
+ *
+ * Cache::config('default', array(
+ * 'engine' => 'Apc', //[required]
+ * 'duration'=> 3600, //[optional]
+ * 'probability'=> 100, //[optional]
+ * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
+ * ));
+ *
+ * Xcache (http://xcache.lighttpd.net/)
+ *
+ * Cache::config('default', array(
+ * 'engine' => 'Xcache', //[required]
+ * 'duration'=> 3600, //[optional]
+ * 'probability'=> 100, //[optional]
+ * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
+ * 'user' => 'user', //user from xcache.admin.user settings
+ * 'password' => 'password', //plaintext password (xcache.admin.pass)
+ * ));
+ *
+ *
+ * Memcache (http://www.danga.com/memcached/)
+ *
+ * Cache::config('default', array(
+ * 'engine' => 'Memcache', //[required]
+ * 'duration'=> 3600, //[optional]
+ * 'probability'=> 100, //[optional]
+ * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
+ * 'servers' => array(
+ * '127.0.0.1:11211' // localhost, default port 11211
+ * ), //[optional]
+ * 'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory)
+ * ));
+ *
+ */
+ Cache::config('default', array('engine' => 'File'));
+?>
59 app/config/database.php
@@ -0,0 +1,59 @@
+<?php
+/***********************************************************
+* File: database.php
+* Description:
+*
+* Author: jgoll
+* Date: Feb 16, 2010
+************************************************************/
+class DATABASE_CONFIG {
+
+ var $default = array(
+ 'driver' => 'mysql',
+ 'persistent' => true,
+ 'host' => 'mysql51-dmz-pro',
+ 'login' => 'ifx_mg_reports',
+ 'password' => 'mgano',
+ 'database' => 'ifx_metagenomics_reports',
+ );
+
+ var $go = array(
+ 'driver' => 'mysql',
+ 'persistent' => true,
+ 'host' => 'mysql51-dmz-pro',
+ 'login' => 'access',
+ 'password' => 'access',
+ 'database' => 'gene_ontology',
+ );
+
+ var $gosBlog = array(
+ 'datasource' => 'rss',
+ 'feedUrl' => 'http://blogs.jcvi.org/tag/gos/feed/',
+ 'encoding' => 'UTF-8',
+ 'cacheTime' => '+1 day',
+ );
+
+ var $keggSoap = array(
+ 'datasource' => 'soap',
+ 'wsdl' => 'http://soap.genome.jp/KEGG.wsdl',
+ 'location' => '',
+ 'uri' => '',
+ );
+
+// var $solr = array(
+// 'host' => 'metarep-prod1',
+// 'port' => '8983',
+// );
+
+// var $default = array(
+// 'driver' => 'sqlite3',
+// 'connect' =>'sqlite',
+// 'persistent' => false,
+// 'host' => 'localhost',
+// 'login' => '',
+// 'password' => '',
+// //'database' => '/home/jhoover/test.db',
+// 'database' => '/usr/local/annotation/METAGENOMIC/results/TEST/sqlite/ifx_metagenomics_reports_indexed',
+// );
+}
+?>
6 app/config/htaccess/htaccess_app
@@ -0,0 +1,6 @@
+<IfModule mod_rewrite.c>
+ RewriteEngine on
+ RewriteBase /metarep
+ RewriteRule ^$ webroot/ [L]
+ RewriteRule (.*) webroot/$1 [L]
+ </IfModule>
6 app/config/htaccess/htaccess_root
@@ -0,0 +1,6 @@
+<IfModule mod_rewrite.c>
+ RewriteEngine on
+ RewriteBase /metarep
+ RewriteRule ^$ app/webroot/ [L]
+ RewriteRule (.*) app/webroot/$1 [L]
+</IfModule>
7 app/config/htaccess/htaccess_webroot
@@ -0,0 +1,7 @@
+<IfModule mod_rewrite.c>
+ RewriteEngine On
+ RewriteBase /metarep
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
+</IfModule>
70 app/config/inflections.php
@@ -0,0 +1,70 @@
+<?php
+/* SVN FILE: $Id: inflections.php 7945 2008-12-19 02:16:01Z gwoo $ */
+/**
+ * Custom Inflected Words.
+ *
+ * This file is used to hold words that are not matched in the normail Inflector::pluralize() and
+ * Inflector::singularize()
+ *
+ * PHP versions 4 and %
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
+ * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @filesource
+ * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
+ * @package cake
+ * @subpackage cake.app.config
+ * @since CakePHP(tm) v 1.0.0.2312
+ * @version $Revision: 7945 $
+ * @modifiedby $LastChangedBy: gwoo $
+ * @lastmodified $Date: 2008-12-18 18:16:01 -0800 (Thu, 18 Dec 2008) $
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License
+ */
+/**
+ * This is a key => value array of regex used to match words.
+ * If key matches then the value is returned.
+ *
+ * $pluralRules = array('/(s)tatus$/i' => '\1\2tatuses', '/^(ox)$/i' => '\1\2en', '/([m|l])ouse$/i' => '\1ice');
+ */
+ $pluralRules = array();
+/**
+ * This is a key only array of plural words that should not be inflected.
+ * Notice the last comma
+ *
+ * $uninflectedPlural = array('.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox');
+ */
+ $uninflectedPlural = array();
+/**
+ * This is a key => value array of plural irregular words.
+ * If key matches then the value is returned.
+ *
+ * $irregularPlural = array('atlas' => 'atlases', 'beef' => 'beefs', 'brother' => 'brothers')
+ */
+ $irregularPlural = array();
+/**
+ * This is a key => value array of regex used to match words.
+ * If key matches then the value is returned.
+ *
+ * $singularRules = array('/(s)tatuses$/i' => '\1\2tatus', '/(matr)ices$/i' =>'\1ix','/(vert|ind)ices$/i')
+ */
+ $singularRules = array();
+/**
+ * This is a key only array of singular words that should not be inflected.
+ * You should not have to change this value below if you do change it use same format
+ * as the $uninflectedPlural above.
+ */
+ $uninflectedSingular = $uninflectedPlural;
+/**
+ * This is a key => value array of singular irregular words.
+ * Most of the time this will be a reverse of the above $irregularPlural array
+ * You should not have to change this value below if you do change it use same format
+ *
+ * $irregularSingular = array('atlases' => 'atlas', 'beefs' => 'beef', 'brothers' => 'brother')
+ */
+ $irregularSingular = array_flip($irregularPlural);
+?>
52 app/config/routes.php
@@ -0,0 +1,52 @@
+<?php
+/* SVN FILE: $Id: routes.php 7945 2008-12-19 02:16:01Z gwoo $ */
+/**
+ * Short description for file.
+ *
+ * In this file, you set up routes to your controllers and their actions.
+ * Routes are very important mechanism that allows you to freely connect
+ * different urls to chosen controllers and their actions (functions).
+ *
+ * PHP versions 4 and 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
+ * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @filesource
+ * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
+ * @package cake
+ * @subpackage cake.app.config
+ * @since CakePHP(tm) v 0.2.9
+ * @version $Revision: 7945 $
+ * @modifiedby $LastChangedBy: gwoo $
+ * @lastmodified $Date: 2008-12-18 18:16:01 -0800 (Thu, 18 Dec 2008) $
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License
+ */
+/**
+ * Here, we are connecting '/' (base path) to controller called 'Pages',
+ * its action called 'display', and we pass a param to select the view file
+ * to use (in this case, /app/views/pages/home.ctp)...
+ */
+ //Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
+/**
+ * ...and connect the rest of 'Pages' controller's urls.
+ */
+ //Router::connect('/*', array('controller' => 'errors', 'action' => 'indexUpdate'));
+
+ #include_once(ROOT.'/app/plugins/spark_plug/config/routes.php');
+// Router::mapResources('rest');
+// Router::parseExtensions();
+
+ Router::mapResources('projects');
+ Router::parseExtensions('xml');
+
+ Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
+
+ Router::connect('/', array('controller' => 'dashboard', 'action' => 'index'));
+
+ Router::connect('/contact.php', array('controller' => 'dashboard', 'action' => 'index'));
+?>
79 app/config/sql/db_acl.php
@@ -0,0 +1,79 @@
+<?php
+/* SVN FILE: $Id: db_acl.php 7945 2008-12-19 02:16:01Z gwoo $ */
+/*DbAcl schema generated on: 2007-11-24 15:11:13 : 1195945453*/
+/**
+ * This is Acl Schema file
+ *
+ * Use it to configure database for ACL
+ *
+ * PHP versions 4 and 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
+ * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @filesource
+ * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
+ * @package cake
+ * @subpackage cake.app.config.sql
+ * @since CakePHP(tm) v 0.2.9
+ * @version $Revision: 7945 $
+ * @modifiedby $LastChangedBy: gwoo $
+ * @lastmodified $Date: 2008-12-18 18:16:01 -0800 (Thu, 18 Dec 2008) $
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License
+ */
+/*
+ *
+ * Using the Schema command line utility
+ * cake schema run create DbAcl
+ *
+ */
+class DbAclSchema extends CakeSchema {
+
+ var $name = 'DbAcl';
+
+ function before($event = array()) {
+ return true;
+ }
+
+ function after($event = array()) {
+ }
+
+ var $acos = array(
+ 'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
+ 'parent_id' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
+ 'model' => array('type'=>'string', 'null' => true),
+ 'foreign_key' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
+ 'alias' => array('type'=>'string', 'null' => true),
+ 'lft' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
+ 'rght' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
+ 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
+ );
+
+ var $aros = array(
+ 'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
+ 'parent_id' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
+ 'model' => array('type'=>'string', 'null' => true),
+ 'foreign_key' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
+ 'alias' => array('type'=>'string', 'null' => true),
+ 'lft' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
+ 'rght' => array('type'=>'integer', 'null' => true, 'default' => NULL, 'length' => 10),
+ 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
+ );
+
+ var $aros_acos = array(
+ 'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
+ 'aro_id' => array('type'=>'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
+ 'aco_id' => array('type'=>'integer', 'null' => false, 'length' => 10),
+ '_create' => array('type'=>'string', 'null' => false, 'default' => '0', 'length' => 2),
+ '_read' => array('type'=>'string', 'null' => false, 'default' => '0', 'length' => 2),
+ '_update' => array('type'=>'string', 'null' => false, 'default' => '0', 'length' => 2),
+ '_delete' => array('type'=>'string', 'null' => false, 'default' => '0', 'length' => 2),
+ 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'ARO_ACO_KEY' => array('column' => array('aro_id', 'aco_id'), 'unique' => 1))
+ );
+
+}
+?>
40 app/config/sql/db_acl.sql
@@ -0,0 +1,40 @@
+# $Id: db_acl.sql 7945 2008-12-19 02:16:01Z gwoo $
+#
+# Copyright 2005-2008, Cake Software Foundation, Inc.
+#
+# Licensed under The MIT License
+# Redistributions of files must retain the above copyright notice.
+# http://www.opensource.org/licenses/mit-license.php The MIT License
+
+CREATE TABLE acos (
+ id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ parent_id INTEGER(10) DEFAULT NULL,
+ model VARCHAR(255) DEFAULT '',
+ foreign_key INTEGER(10) UNSIGNED DEFAULT NULL,
+ alias VARCHAR(255) DEFAULT '',
+ lft INTEGER(10) DEFAULT NULL,
+ rght INTEGER(10) DEFAULT NULL,
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE aros_acos (
+ id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ aro_id INTEGER(10) UNSIGNED NOT NULL,
+ aco_id INTEGER(10) UNSIGNED NOT NULL,
+ _create CHAR(2) NOT NULL DEFAULT 0,
+ _read CHAR(2) NOT NULL DEFAULT 0,
+ _update CHAR(2) NOT NULL DEFAULT 0,
+ _delete CHAR(2) NOT NULL DEFAULT 0,
+ PRIMARY KEY(id)
+);
+
+CREATE TABLE aros (
+ id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ parent_id INTEGER(10) DEFAULT NULL,
+ model VARCHAR(255) DEFAULT '',
+ foreign_key INTEGER(10) UNSIGNED DEFAULT NULL,
+ alias VARCHAR(255) DEFAULT '',
+ lft INTEGER(10) DEFAULT NULL,
+ rght INTEGER(10) DEFAULT NULL,
+ PRIMARY KEY (id)
+);
56 app/config/sql/i18n.php
@@ -0,0 +1,56 @@
+<?php
+/* SVN FILE: $Id: i18n.php 7945 2008-12-19 02:16:01Z gwoo $ */
+/*i18n schema generated on: 2007-11-25 07:11:25 : 1196004805*/
+/**
+ * This is i18n Schema file
+ *
+ * Use it to configure database for i18n
+ *
+ * PHP versions 4 and 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
+ * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @filesource
+ * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
+ * @package cake
+ * @subpackage cake.app.config.sql
+ * @since CakePHP(tm) v 0.2.9
+ * @version $Revision: 7945 $
+ * @modifiedby $LastChangedBy: gwoo $
+ * @lastmodified $Date: 2008-12-18 18:16:01 -0800 (Thu, 18 Dec 2008) $
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License
+ */
+/*
+ *
+ * Using the Schema command line utility
+ * cake schema run create i18n
+ *
+ */
+class i18nSchema extends CakeSchema {
+
+ var $name = 'i18n';
+
+ function before($event = array()) {
+ return true;
+ }
+
+ function after($event = array()) {
+ }
+
+ var $i18n = array(
+ 'id' => array('type'=>'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
+ 'locale' => array('type'=>'string', 'null' => false, 'length' => 6, 'key' => 'index'),
+ 'model' => array('type'=>'string', 'null' => false, 'key' => 'index'),
+ 'foreign_key' => array('type'=>'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
+ 'field' => array('type'=>'string', 'null' => false, 'key' => 'index'),
+ 'content' => array('type'=>'text', 'null' => true, 'default' => NULL),
+ 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'locale' => array('column' => 'locale', 'unique' => 0), 'model' => array('column' => 'model', 'unique' => 0), 'row_id' => array('column' => 'foreign_key', 'unique' => 0), 'field' => array('column' => 'field', 'unique' => 0))
+ );
+
+}
+?>
26 app/config/sql/i18n.sql
@@ -0,0 +1,26 @@
+# $Id: i18n.sql 7945 2008-12-19 02:16:01Z gwoo $
+#
+# Copyright 2005-2008, Cake Software Foundation, Inc.
+#
+# Licensed under The MIT License
+# Redistributions of files must retain the above copyright notice.
+# http://www.opensource.org/licenses/mit-license.php The MIT License
+
+CREATE TABLE i18n (
+ id int(10) NOT NULL auto_increment,
+ locale varchar(6) NOT NULL,
+ model varchar(255) NOT NULL,
+ foreign_key int(10) NOT NULL,
+ field varchar(255) NOT NULL,
+ content mediumtext,
+ PRIMARY KEY (id),
+# UNIQUE INDEX I18N_LOCALE_FIELD(locale, model, foreign_key, field),
+# INDEX I18N_LOCALE_ROW(locale, model, foreign_key),
+# INDEX I18N_LOCALE_MODEL(locale, model),
+# INDEX I18N_FIELD(model, foreign_key, field),
+# INDEX I18N_ROW(model, foreign_key),
+ INDEX locale (locale),
+ INDEX model (model),
+ INDEX row_id (foreign_key),
+ INDEX field (field)
+);
53 app/config/sql/sessions.php
@@ -0,0 +1,53 @@
+<?php
+/* SVN FILE: $Id: sessions.php 7945 2008-12-19 02:16:01Z gwoo $ */
+/*Sessions schema generated on: 2007-11-25 07:11:54 : 1196004714*/
+/**
+ * This is Sessions Schema file
+ *
+ * Use it to configure database for Sessions
+ *
+ * PHP versions 4 and 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
+ * Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @filesource
+ * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
+ * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
+ * @package cake
+ * @subpackage cake.app.config.sql
+ * @since CakePHP(tm) v 0.2.9
+ * @version $Revision: 7945 $
+ * @modifiedby $LastChangedBy: gwoo $
+ * @lastmodified $Date: 2008-12-18 18:16:01 -0800 (Thu, 18 Dec 2008) $
+ * @license http://www.opensource.org/licenses/mit-license.php The MIT License
+ */
+/*
+ *
+ * Using the Schema command line utility
+ * cake schema run create Sessions
+ *
+ */
+class SessionsSchema extends CakeSchema {
+
+ var $name = 'Sessions';
+
+ function before($event = array()) {
+ return true;
+ }
+
+ function after($event = array()) {
+ }
+
+ var $cake_sessions = array(
+ 'id' => array('type'=>'string', 'null' => false, 'key' => 'primary'),
+ 'data' => array('type'=>'text', 'null' => true, 'default' => NULL),
+ 'expires' => array('type'=>'integer', 'null' => true, 'default' => NULL),
+ 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
+ );
+
+}
+?>
16 app/config/sql/sessions.sql
@@ -0,0 +1,16 @@
+# $Id: sessions.sql 7118 2008-06-04 20:49:29Z gwoo $
+#
+# Copyright 2005-2008, Cake Software Foundation, Inc.
+# 1785 E. Sahara Avenue, Suite 490-204
+# Las Vegas, Nevada 89104
+#
+# Licensed under The MIT License
+# Redistributions of files must retain the above copyright notice.
+# http://www.opensource.org/licenses/mit-license.php The MIT License
+
+CREATE TABLE cake_sessions (
+ id varchar(255) NOT NULL default '',
+ data text,
+ expires int(11) default NULL,
+ PRIMARY KEY (id)
+);
225 app/controllers/app_controller.php
@@ -0,0 +1,225 @@
+<?php
+/***********************************************************
+* File: app_controller.php
+* Description:
+*
+* Author: jgoll
+* Date: Mar 22, 2010
+************************************************************/
+
+class AppController extends Controller {
+
+ #global helpers
+ var $helpers = array('Session','Html', 'Form','Crumb','Javascript','Ajax');
+ var $components = array('Session','Cookie','RequestHandler','Authsome' => array('model' => 'User'));
+
+
+ var $openUrls = array( 'users/login',
+ 'dashboard/index',
+ 'users/register',
+ 'users/forgotPassword',
+ 'users/activate_password');
+ //handle permissions
+ function beforeFilter() {
+ if($this->RequestHandler->isAjax()) {
+ return;
+ }
+
+ //get current url
+ $controller = $this->params['controller'] ;
+ $action = $this->params['action'] ;
+ $url = "$controller/$action";
+
+ #check if url is publicly accessable
+ if(in_array($url,$this->openUrls)) {
+ return;
+ }
+
+ #handle all other permissions
+ if($this->Authsome->get()) {
+ $currentUser = $this->Authsome->get();
+ $currentUserId = $currentUser['User']['id'];
+ $userGroup = $currentUser['UserGroup']['name'];
+
+ #admin users have access to all sites and data
+ if($userGroup === ADMIN_USER_GROUP) {
+ return;
+ }
+ else {
+ #handle data access for view controller
+ if($controller==='view') {
+ if($action==='index' || $action==='download' ) {
+ $parameters = $this->params['pass'];
+ $dataset = $parameters[0];
+
+ if($userGroup === JCVI_USER_GROUP) {
+ return;
+ }
+ if($this->Project->hasDatasetAccess($dataset,$currentUserId)) {
+ return;
+ }
+ }
+ if($action==='facet' ) {
+ return;
+ }
+ }
+
+ #handle data access for search controller
+ if($controller==='search') {
+ $parameters = $this->params['pass'];
+ $dataset = $parameters[0];
+
+ if($userGroup === JCVI_USER_GROUP) {
+ return;
+ }
+ if($this->Project->hasDatasetAccess($dataset,$currentUserId)) {
+ return;
+ }
+ }
+
+ #handle data access for browse controller
+ if($controller==='browse') {
+ $parameters = $this->params['pass'];
+ $dataset = $parameters[0];
+
+ if($userGroup === JCVI_USER_GROUP) {
+ return;
+ }
+ if($this->Project->hasDatasetAccess($dataset,$currentUserId)) {
+ return;
+ }
+ }
+
+ #handle data access for browse controller
+ if($controller==='compare') {
+ if($action === 'index') {
+ $parameters = $this->params['pass'];
+ $dataset = $parameters[0];
+
+ if($userGroup === JCVI_USER_GROUP) {
+ return;
+ }
+ if($this->Project->hasDatasetAccess($dataset,$currentUserId)) {
+ return;
+ }
+ }
+ else {
+ return;
+ }
+ }
+
+ #handle data access for projects
+ if($controller==='projects') {
+ if($action != 'index' && $action != 'add') {
+ #get project id
+ $parameters = $this->params['pass'];
+ $projectId = $parameters[0];
+
+ #only valid project ids can be passed
+ if($action==='view') {
+ #JCVI users can see all data
+ if($userGroup === JCVI_USER_GROUP) {
+ return;
+ }
+ if($this->Project->hasProjectAccess($projectId,$currentUserId)) {
+ return;
+ }
+ }
+ #edit only allowed for project managers
+ if($action==='edit') {
+ if($this->Project->isProjectAdmin($projectId,$currentUserId)) {
+ return;
+ }
+ }
+ }
+ }
+
+ //handle population access
+ if($controller==='populations') {
+ if($action === 'index') {
+ if($userGroup === JCVI_USER_GROUP) {
+ return;
+ }
+ }
+ else {
+ $parameters = $this->params['pass'];
+ $arg1 = $parameters[0];
+
+ if($action==='view') {
+ $population = $this->Population->findById($arg1);
+ #JCVI users can see all data
+ if($userGroup === JCVI_USER_GROUP) {
+ return;
+ }
+ if($this->Project->hasDatasetAccess($population['Population']['name'],$currentUserId)) {
+ return;
+ }
+ }
+ if($action==='add') {
+ #grant access for project admins
+ if($this->Project->isProjectAdmin($arg1,$currentUserId)) {
+ return;
+ }
+ }
+ if($action==='delete') {
+ $population = $this->Population->findById($arg1);
+
+ #grant access for dataset admins
+ if($this->Project->isDatasetAdmin($population['Population']['name'],$currentUserId)) {
+ return;
+ }
+ }
+ }
+ }
+
+ //handle library access
+ if($controller==='libraries') {
+ if($action === 'index') {
+ #JCVI users can see all data
+ if($userGroup === JCVI_USER_GROUP) {
+ return;
+ }
+ }
+ else {
+ if($action==='edit') {
+ $parameters = $this->params['pass'];
+ $libraryId = $parameters[0];
+ $library = $this->Library->findById($libraryId);
+
+ #grant access for project admins
+ if($this->Project->isDatasetAdmin($library['Library']['name'],$currentUserId)) {
+ return;
+ }
+ }
+ }
+
+ }
+
+ if($controller==='users') {
+ if($action==='editProjectUsers') {
+ $parameters = $this->params['pass'];
+ $projectId = $parameters[0];
+ #grant access for project admins
+ if($this->Project->isProjectAdmin($projectId,$currentUserId)) {
+ return;
+ }
+ }
+ }
+ if($controller === 'rest') {
+ return;
+ }
+
+ if($this->Authsome->check($url)) {
+ return;
+ }
+ $this->Session->setFlash("You don't have permissions to view this page.");
+ $this->redirect("/dashboard");
+ }
+ }
+ else {
+ $this->Session->setFlash("Please log in.");
+ $this->redirect("/dashboard");
+ }
+ }
+}
+?>
627 app/controllers/browse_controller.php
@@ -0,0 +1,627 @@
+<?php
+
+/***********************************************************
+* File: browse_controller.php
+* Description:
+*
+* Author: jgoll
+* Date: Feb 16, 2010
+************************************************************/
+
+define('BLAST_TAXONOMY', 'Blast Taxonomy');
+define('APIS_TAXONOMY', 'Apis Taxonomy');
+define('ENZYMES', 'Enzymes');
+define('GENE_ONTOLOGY', 'Gene Ontology');
+define('PATHWAY', 'Pathway');
+
+class BrowseController extends AppController {
+ var $name = 'Browse';
+
+ var $limit = 10;
+
+ var $helpers = array('Facet','Tree','Ajax','Dialog');
+
+ var $uses = array('Project','Taxonomy','GoTerm','GoGraph','Enzymes','Population','Library','Pathway','Kegg');
+
+ var $components = array('Session','RequestHandler','Solr','Format');
+
+ function blastTaxonomy($dataset='CBAYVIR',$expandTaxon=1) {
+
+ $this->pageTitle = 'Browse Blast Taxonomy';
+
+ //get session based taxonomic tree
+ $displayedTree = $this->Session->read(BLAST_TAXONOMY.'.tree');
+
+ if(!isset($displayedTree)) {
+ $expandTaxon=1;
+ }
+
+ //get taxonomy information from database
+ $taxaChildren = $this->Taxonomy->find('all', array('conditions' => array('Taxonomy.parent_tax_id' => $expandTaxon)));
+ $taxaParent = $this->Taxonomy->find('first', array('conditions' => array('Taxonomy.taxon_id' => $expandTaxon)));
+
+ $parentName = $taxaParent['Taxonomy']['name'];
+
+ $childArray = array();
+ $childCounts = array();
+ $numChildHits =0;
+
+ #debug($displayedTree);
+
+ //for each child get solr count
+ foreach($taxaChildren as $taxon) {
+
+ try{
+ $count= $this->Solr->count($dataset,"blast_tree:".$taxon['Taxonomy']['taxon_id']);
+ }
+ catch(Exception $e) {
+ $this->Session->setFlash(SOLR_CONNECT_EXCEPTION);
+ $this->redirect('/projects/index');
+ }
+
+ //set count
+ $taxon['Taxonomy']['count'] = $count;
+
+ $taxonId = $taxon['Taxonomy']['taxon_id'];
+
+ //filter for children
+ if($count>0 && $taxonId!=1) {
+ $taxon['Taxonomy']['count'] = $count;
+ $taxon['Taxonomy']['children'] = NULL;
+
+ $childCounts[$taxon['Taxonomy']['name']]=$count;
+ //add children to child array
+ $childArray[$taxonId] = $taxon['Taxonomy'];
+ $numChildHits +=$count;
+ }
+ }
+
+ $solrArguments = array( "facet" => "true",
+ 'facet.field' => array('blast_species','com_name','go_id','ec_id','com_name_src','hmm_id'),
+ 'facet.mincount' => 1,
+ "facet.limit" => $this->Solr->numFacetCounts);
+
+ try{
+ $result = $this->Solr->search($dataset,"blast_tree:$expandTaxon", 0,0,$solrArguments,true);
+ }
+ catch(Exception $e) {
+ $this->Session->setFlash(SOLR_CONNECT_EXCEPTION);
+ $this->redirect('/projects/index');
+ }
+ $numHits = (int) $result->response->numFound;
+ $facets = $result->facet_counts;
+
+
+ //show root level for 1
+ if($expandTaxon==1) {
+ $displayedTree = $childArray;
+ }
+ //build tree
+ else {
+ $this->traverseArray($displayedTree,$childArray,$expandTaxon);
+ }
+
+ $this->Session->write(BLAST_TAXONOMY.'.tree', $displayedTree);
+ $this->Session->write(BLAST_TAXONOMY.'.childCounts', $childCounts);
+ $this->Session->write(BLAST_TAXONOMY.'.facets', $facets);
+
+ $this->set('projectName', $this->Project->getProjectName($dataset));
+ $this->set('projectId', $this->Project->getProjectId($dataset));
+ $this->set('dataset',$dataset);
+ $this->set('childCounts',$childCounts);
+ $this->set('taxon',$parentName);
+ $this->set('numHits',$numHits);
+ $this->set('numChildHits',$numChildHits);
+ $this->set('facets',$facets);
+ $this->set('mode',BLAST_TAXONOMY);
+
+ }
+
+ function apisTaxonomy($dataset='CBAYVIR',$expandTaxon=1) {
+
+ $this->pageTitle = 'Browse Apis Taxonomy';
+
+ //get session based taxonomic tree
+ $displayedTree = $this->Session->read(APIS_TAXONOMY.'.tree');
+
+ if(!isset($displayedTree)) {
+ $expandTaxon=1;
+ }
+
+ //get taxonomy information from database
+ $taxaChildren = $this->Taxonomy->find('all', array('conditions' => array('Taxonomy.parent_tax_id' => $expandTaxon)));
+ $taxaParent = $this->Taxonomy->find('first', array('conditions' => array('Taxonomy.taxon_id' => $expandTaxon)));
+ //die(print($taxaParent['Taxonomy']['name']));
+ $parentName = $taxaParent['Taxonomy']['name'];
+
+ $childArray = array();
+ $childCounts = array();
+ $numChildHits =0;
+
+ //for each child get solr count
+ foreach($taxaChildren as $taxon) {
+
+ //get solr count
+ try {
+ $count= $this->Solr->count($dataset,"apis_tree:".$taxon['Taxonomy']['taxon_id']);
+ }
+ catch(Exception $e) {
+ $this->Session->setFlash(SOLR_CONNECT_EXCEPTION);
+ $this->redirect('/projects/index');
+ }
+ //set count
+ $taxon['Taxonomy']['count'] = $count;
+
+ $taxonId = $taxon['Taxonomy']['taxon_id'];
+
+ //filter for children
+ if($count>0 && $taxonId!=1) {
+ $taxon['Taxonomy']['count'] = $count;
+ $taxon['Taxonomy']['children'] = NULL;
+
+ $childCounts[$taxon['Taxonomy']['name']]=$count;
+ //add children to child array
+ $childArray[$taxonId] = $taxon['Taxonomy'];
+ $numChildHits +=$count;
+ }
+ }
+
+
+ $solrArguments = array( "facet" => "true",
+ 'facet.field' => array('blast_species','com_name','go_id','ec_id','com_name_src','hmm_id'),
+ 'facet.mincount' => 1,
+ "facet.limit" => $this->Solr->numFacetCounts);
+
+ try{
+ $result = $this->Solr->search($dataset,"apis_tree:$expandTaxon", 0,0,$solrArguments,true);
+ }
+ catch(Exception $e) {
+ $this->Session->setFlash(SOLR_CONNECT_EXCEPTION);
+ $this->redirect('/projects/index');
+ }
+ $numHits = (int) $result->response->numFound;
+ $facets = $result->facet_counts;
+
+
+ //show root level for 1
+ if($expandTaxon==1) {
+ $displayedTree = $childArray;
+ }
+ //build tree
+ else {
+ $this->traverseArray($displayedTree,$childArray,$expandTaxon);
+ }
+
+ $this->Session->write(APIS_TAXONOMY.'.tree', $displayedTree);
+ $this->Session->write(APIS_TAXONOMY.'.childCounts', $childCounts);
+ $this->Session->write(APIS_TAXONOMY.'.facets', $facets);
+
+
+ $this->set('projectName', $this->Project->getProjectName($dataset));
+ $this->set('projectId', $this->Project->getProjectId($dataset));
+ $this->set('dataset',$dataset);
+ $this->set('childCounts',$childCounts);
+ $this->set('taxon',$parentName);
+ $this->set('numHits',$numHits);
+ $this->set('numChildHits',$numChildHits);
+ $this->set('facets',$facets);
+ $this->set('mode',APIS_TAXONOMY);
+
+ }
+
+ function enzymes($dataset='CBAYVIR',$expandTaxon='root') {
+
+ $this->pageTitle = 'Browse Enzymes';
+
+ //get session based taxonomic tree
+ $displayedTree = $this->Session->read(ENZYMES.'.tree');
+
+ if(!isset($displayedTree)) {
+ $expandTaxon='root';
+ }
+
+ if($expandTaxon==='root'){
+ $solrQuery = "-ec_id:unassigned";
+ $expandTaxon=1;
+ }
+ else {
+ $taxonPrefix = split("\\.-",$expandTaxon);
+ $solrQuery = "ec_id:$taxonPrefix[0]*";
+ }
+
+ //get taxonomy information from database
+ $taxaChildren = $this->Enzymes->find('all', array('conditions' => array('Enzymes.parent_ec_id' => $expandTaxon)));
+ $taxaParent = $this->Enzymes->find('first', array('conditions' => array('Enzymes.ec_id' => $expandTaxon)));
+ //die(print($taxaParent['Taxonomy']['name']));
+ $parentName = $taxaParent['Enzymes']['name'];
+
+ $childArray = array();
+ $childCounts = array();
+ $numChildHits =0;
+
+ //for each child get solr count
+ foreach($taxaChildren as $taxon) {
+ $ec = split("\\.-",$taxon['Enzymes']['ec_id']);
+
+ try{
+ //get solr count
+ $count= $this->Solr->count($dataset,"ec_id:".$ec[0]."*");
+ }
+ catch (Exception $e) {
+ $this->Session->setFlash(SOLR_CONNECT_EXCEPTION);
+ $this->redirect('/projects/index');
+ }
+ //set count
+ $taxon['Enzymes']['count'] = $count;
+ $taxon['Enzymes']['name'] = $taxon['Enzymes']['name'] ." (".$taxon['Enzymes']['ec_id'].")";
+
+ $taxonId = $taxon['Enzymes']['ec_id'];
+
+ //filter for children
+ if($count>0 && $taxonId!=1) {
+ $taxon['Enzymes']['count'] = $count;
+ $taxon['Enzymes']['children'] = NULL;
+
+ $childCounts[$taxon['Enzymes']['name']]=$count;
+ //add children to child array
+ $childArray[$taxonId] = $taxon['Enzymes'];
+ $numChildHits +=$count;
+ }
+ }
+
+ //get the facets
+ $solrArguments = array( "facet" => "true",
+ 'facet.field' => array('blast_species','com_name','go_id','ec_id','com_name_src','hmm_id'),
+ 'facet.mincount' => 1,
+ "facet.limit" => $this->Solr->numFacetCounts);
+
+ try {
+ $result = $this->Solr->search($dataset,$solrQuery, 0,0,$solrArguments,true);
+ }
+ catch(Exception $e){
+ $this->Session->setFlash(SOLR_CONNECT_EXCEPTION);
+ $this->redirect('/projects/index');
+ }
+
+ $numHits = (int) $result->response->numFound;
+ $facets = $result->facet_counts;
+
+ //show root level for 1
+ if($expandTaxon==1) {
+ $displayedTree = $childArray;
+ }
+ //build tree
+ else {
+ $this->traverseArray($displayedTree,$childArray,$expandTaxon);
+ }
+
+ $this->Session->write(ENZYMES.'.tree', $displayedTree);
+ $this->Session->write(ENZYMES.'.childCounts', $childCounts);
+ $this->Session->write(ENZYMES.'.facets', $facets);
+
+ $this->set('projectName', $this->Project->getProjectName($dataset));
+ $this->set('projectId', $this->Project->getProjectId($dataset));
+ $this->set('dataset',$dataset);
+ $this->set('childCounts',$childCounts);
+ $this->set('node',$parentName);
+ $this->set('numHits',$numHits);
+ $this->set('numChildHits',$numChildHits);
+ $this->set('facets',$facets);
+ $this->set('mode',ENZYMES);
+ }
+
+ function geneOntology($dataset='CBAYVIR',$expandTaxon='root') {
+
+ $this->pageTitle = 'Browse Gene Ontology';
+
+ //get session based taxonomic tree
+ $displayedTree = $this->Session->read(GENE_ONTOLOGY.'.tree');
+
+ if(!isset($displayedTree)) {
+ $expandTaxon='root';
+ }
+
+ if($expandTaxon==='root') {
+ //get all entries with go assignment
+ $solrQuery = "-go_id:unassigned";
+ $goAcc ="all";
+
+ //set selected node attributes
+ $selectedNode['acc'] = $expandTaxon;
+ $selectedNode['name'] = 'root';
+ }
+ else {
+ $solrQuery="go_tree:$expandTaxon";
+
+ //GO integer to accession
+ $goAcc = "GO:".str_pad($expandTaxon,7,"0",STR_PAD_LEFT);
+
+ //get GO data for selected node
+ $goTerm = $this->GoTerm->find('all', array('fields'=> array('name'),'conditions' => array('acc' => $goAcc)));
+ $selectedNode['acc'] = $expandTaxon;
+
+ //set selected node attributes
+ $selectedNode['acc'] = $expandTaxon;
+ $selectedNode['name'] = $goTerm[0]['GoTerm']['name'];
+ }
+
+ //get children from go database
+ $taxaChildren = $this->GoGraph->find('all', array('conditions' => array('Ancestor.acc' => $goAcc,'distance'=>'1', 'Descendant.is_obsolete' => '0')));
+
+ $childArray = array();
+ $childCounts = array();
+
+ $childHits =0;
+
+ //for each child get solr count
+ foreach($taxaChildren as $taxon) {
+
+ //transform GO accession fetched from database to integer
+ $tmp =split("\\:",$taxon['Descendant']['acc']);
+ $goId = ltrim($tmp[1], "0");
+
+ $taxon['Descendant']['acc'] = $goId;
+
+ //get solr count
+ try{
+ $count= $this->Solr->count($dataset,"go_tree:".$goId);
+ }
+ catch(Exception $e){
+ $this->Session->setFlash(SOLR_CONNECT_EXCEPTION);
+ $this->redirect('/projects/index');
+ }
+ #FIXME temporary fix for GO parsing error
+ if($count==0) {
+ $goIdFix = str_pad($goId,7,"0",STR_PAD_LEFT);
+
+ try{
+ $count= $this->Solr->count($dataset,"go_tree:".$goIdFix);
+ }
+ catch(Exception $e){
+ $this->Session->setFlash(SOLR_CONNECT_EXCEPTION);
+ $this->redirect('/projects/index');
+ }
+ }
+
+ //set count
+ $taxon['Descendant']['count'] = $count;
+
+ $taxonId = $taxon['Descendant']['acc'];
+
+ //filter for children with counts
+ if($count>0 && $taxonId!='all') {
+
+ //check if leave node (has no children)
+ $goAcc = "GO:".str_pad($goId,7,"0",STR_PAD_LEFT);
+ #$childCount = $this->GoGraph->find('count', array('conditions' => array('Ancestor.acc' => $goAcc,'distance'=>'1', 'Descendant.is_obsolete' => '0')));
+
+ //$displayName = $goAcc." | ".$taxon['Descendant']['name'];
+ $displayName = $taxon['Descendant']['name']." ($goAcc)";
+
+ //set display name, accession | name
+ $taxon['Descendant']['name'] = $displayName;
+ $taxon['Descendant']['count'] = $count;
+ $taxon['Descendant']['children']= NULL;
+ #$taxon['Descendant']['rank'] = $childCount == 0 ? 'leave' : '';
+
+ //create child counts
+ $childCounts[$displayName]=$count;
+
+ //add children to child array
+ $childArray[$taxonId] = $taxon['Descendant'];
+
+ //add up hits for children
+ $childHits +=$count;
+ }
+ }
+
+ $solrArguments = array( "facet" => "true",
+ 'facet.field' => array('blast_species','com_name','go_id','ec_id','com_name_src','hmm_id'),
+ 'facet.mincount' => 1,
+ "facet.limit" => $this->Solr->numFacetCounts);
+ try{
+ $result = $this->Solr->search($dataset,$solrQuery, 0,0,$solrArguments,true);
+ }
+ catch(Exception $e){
+ $this->Session->setFlash(SOLR_CONNECT_EXCEPTION);
+ $this->redirect('/projects/index');
+ }
+
+
+ $numHits = (int) $result->response->numFound;
+
+ #FIXME temporary fix for GO parsing error
+ if($numHits==0) {
+ $goIdFix = str_pad($expandTaxon,7,"0",STR_PAD_LEFT);
+ $solrQuery="go_tree:$goIdFix";
+
+ try{
+ $result = $this->Solr->search($dataset,$solrQuery, 0,0,$solrArguments,true);
+ }
+ catch(Exception $e){
+ $this->Session->setFlash(SOLR_CONNECT_EXCEPTION);
+ $this->redirect('/projects/index');
+ }
+ }
+
+ $numHits = (int) $result->response->numFound;
+ $facets = $result->facet_counts;
+
+ //show root level for 1
+ if($expandTaxon=='root') {
+ $displayedTree = $childArray;
+ }
+
+ //build tree
+ else {
+ $this->traverseArray($displayedTree,$childArray,$expandTaxon);
+ }
+
+ $this->Session->write(GENE_ONTOLOGY.'.tree', $displayedTree);
+ $this->Session->write(GENE_ONTOLOGY.'.childCounts', $childCounts);
+ $this->Session->write(GENE_ONTOLOGY.'.facets', $facets);
+
+ $this->set('dataset',$dataset);
+
+ //if has children set child counts
+ if(!empty($childCounts)) {
+ arsort($childCounts,SORT_NUMERIC);
+ $this->set('childCounts',$childCounts);
+ }
+
+ //add id to node
+ $this->set('projectName', $this->Project->getProjectName($dataset));
+ $this->set('projectId', $this->Project->getProjectId($dataset));
+ $this->set('node',$selectedNode);
+ $this->set('numHits',$numHits);
+ $this->set('numChildHits',$numHits);
+ $this->set('facets',$facets);
+ $this->set('mode',GENE_ONTOLOGY);
+ }
+
+ function pathways($dataset='CBAYVIR',$expandNode = 16905) {
+
+ $this->pageTitle = 'Browse Pathways';
+
+ //get session based taxonomic tree
+ $displayedTree = $this->Session->read(PATHWAY.'.tree');
+
+ if(!isset($displayedTree)) {
+ $expandTaxon=16905;
+ }
+
+ //get pathway information for parent and children from database
+ $parent = $this->Pathway->find('first', array('conditions' => array('Pathway.id' => $expandNode)));
+ $children = $this->Pathway->find('all', array('conditions' => array('Pathway.parent_id' => $expandNode)));
+
+ $parentName = $parent['Pathway']['name'];
+ $parentLevel = $parent['Pathway']['level'];
+ $pathwayUrl = "http://www.genome.jp/kegg-bin/show_pathway?ec".str_pad($parent['Pathway']['kegg_id'],5,0,STR_PAD_LEFT);
+
+ if($parentLevel === 'enzyme') {
+ $parentSolrResults = $this->Solr->getPathwayFacets('*:*',$dataset,$parentLevel,$expandNode,$children,$parent['Pathway']['ec_id']);
+ $parentName = $parent['Pathway']['name']." (".$parent['Pathway']['ec_id'].")";
+ }
+ else {
+ $parentSolrResults = $this->Solr->getPathwayFacets('*:*',$dataset,$parentLevel,$expandNode,$children);
+ }
+
+ $childArray = array();
+ $childCounts = array();
+ $numChildHits = 0;
+
+ //for each child get solr count
+ foreach($children as $node) {
+ $name = $node['Pathway']['name'];
+ $level = $node['Pathway']['level'];
+ $nodeId = $node['Pathway']['id'];
+ $ecId = $node['Pathway']['ec_id'];
+
+// if($level == '')
+// $pathwayEnzymeCount = $node['Pathway']['child_count'];
+
+ $childCount = $this->Solr->getPathwayCount('*:*',$dataset,$level,$nodeId,0,$ecId);
+
+ //filter for children
+ if($childCount >= 0 ) {
+
+ $node['Pathway']['count'] = $childCount;
+ $node['Pathway']['children'] = NULL;
+
+ if($level === 'enzyme') {
+ $childCounts["$name ($ecId)"] = $childCount;
+ $node['Pathway']['name'] = "$name ($ecId)";
+ if($childCount > 0) {
+ $pathwayUrl.="+$ecId";
+ }
+ }
+ else {
+ $childCounts[$name] = $childCount;
+ }
+
+ $childArray[$nodeId] = $node['Pathway'];
+ $numChildHits += $childCount;
+ }
+
+ }
+ #debug($pathwayUrl);
+
+ //show root level for 1
+ if($expandNode == 16905) {
+ $displayedTree = $childArray;
+ }
+ //build tree
+ else {
+ $this->traverseArray($displayedTree,$childArray,$expandNode);
+ }
+ #debug($displayedTree);
+
+ $this->Session->write(PATHWAY.'.tree', $displayedTree);
+ $this->Session->write(PATHWAY.'.childCounts', $childCounts);