BioTorrents.de’s version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config.template.php 43KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * Environment
  5. * Config Loader v2
  6. *
  7. * To use the new system, which has significant security benefits,
  8. * (fine-grained scoping, ephemeral access lifetime, public vs. private, etc.),
  9. * please follow the example below.
  10. *
  11. * $ENV = ENV::go();
  12. * $ENV->PUBLIC_VALUE;
  13. * $ENV->getPriv('PRIVATE_VALUE');
  14. *
  15. * Using a central static $ENV singleton class has additional benefits.
  16. * The RecursiveArrayObject class included in env.class.php is a powerful tool:
  17. *
  18. * $LongArray = [];
  19. * ENV::setPub(
  20. * 'CONFIG',
  21. * $ENV->convert($LongArray)
  22. * );
  23. *
  24. * $ENV = ENV::go();
  25. * foreach ($ENV->CATS as $Cat) {
  26. * var_dump($Cat->Name);
  27. * }
  28. *
  29. * One more example using custom RecursiveArrayObject methods:
  30. * @see https://www.php.net/manual/en/class.arrayobject.php
  31. *
  32. * var_dump(
  33. * $ENV->dedupe(
  34. * $ENV->META->Formats->Sequences,
  35. * $ENV->META->Formats->Proteins->toArray()
  36. * )
  37. * );
  38. */
  39. # Initialize
  40. require_once 'env.class.php';
  41. $ENV = ENV::go();
  42. # Basic info
  43. ENV::setPub('PHP_MIN', '7.4.0');
  44. ENV::setPub('DEV', true);
  45. /**
  46. * Site identity
  47. */
  48. # Site name
  49. ENV::setPub(
  50. 'SITE_NAME',
  51. (!$ENV->DEV
  52. ? 'BioTorrents.de' # Production
  53. : '[Dev] BioTorrents.de') # Development
  54. );
  55. # Meta description
  56. ENV::setPub('DESCRIPTION', 'A platform to share biological sequence and medical imaging data');
  57. # Navigation glyphs
  58. ENV::setPub('SEP', '⸬'); # e.g., News ⸬ BioTorrents.de
  59. ENV::setPub('CRUMB', '›'); # e.g., Forums › Board › Thread
  60. # The FQDN of your site, e.g., dev.biotorrents.de
  61. ( # Old format
  62. !$ENV->DEV
  63. ? define('SITE_DOMAIN', 'biotorrents.de') # Production
  64. : define('SITE_DOMAIN', 'dev.biotorrents.de') # Development
  65. );
  66. ENV::setPub(
  67. 'SITE_DOMAIN',
  68. (!$ENV->DEV
  69. ? 'biotorrents.de' # Production
  70. : 'dev.biotorrents.de') # Development
  71. );
  72. # The FQDN of your image host, e.g., pics.biotorrents.de
  73. ENV::setPub('IMAGE_DOMAIN', 'pics.biotorrents.de');
  74. # Web root. Currently used for Twig but may also include config files
  75. ENV::setPub('WEB_ROOT', '/var/www/');
  76. # The root of the server, used for includes, e.g., /var/www/html/dev.biotorrents.de/
  77. ( # Old format
  78. !$ENV->DEV
  79. ? define('SERVER_ROOT', '/var/www/html/biotorrents.de/') # Production
  80. : define('SERVER_ROOT', '/var/www/html/dev.biotorrents.de/') # Development
  81. );
  82. ENV::setPub(
  83. 'SERVER_ROOT',
  84. (!$ENV->DEV
  85. ? '/var/www/html/biotorrents.de/' # Production
  86. : '/var/www/html/dev.biotorrents.de/') # Development
  87. );
  88. # Where torrent files are stored, e.g., /var/www/torrents-dev/
  89. ( # Old format
  90. !$ENV->DEV
  91. ? define('TORRENT_STORE', '/var/www/torrents/') # Production
  92. : define('TORRENT_STORE', '/var/www/torrents-dev/') # Development
  93. );
  94. ENV::setPub(
  95. 'TORRENT_STORE',
  96. (!$ENV->DEV
  97. ? '/var/www/torrents/' # Production
  98. : '/var/www/torrents-dev/') # Development);
  99. );
  100. # Allows you to run static content off another server. Default is usually what you want
  101. define('STATIC_SERVER', '/static/');
  102. ENV::setPub('STATIC_SERVER', '/static/');
  103. # The hashing algorithm used for SRI
  104. ENV::setPub('SRI', 'sha384');
  105. /**
  106. * Tech support
  107. */
  108. $TechSupport = [
  109. 'Email' => 'help@biotorrents.de',
  110. 'Subject' => '[TxID '.strtoupper(bin2hex(random_bytes(2))).'] Specific subject line with TxID intact',
  111. 'Body' => 'A detailed description of how you reach the error and the full text of any site messages you may receive.'
  112. ];
  113. ENV::setPub(
  114. 'HELP',
  115. $ENV->convert($TechSupport)
  116. );
  117. /**
  118. * App keys
  119. *
  120. * Separate keys for development and production.
  121. * Increased security and protection against config overwrites.
  122. */
  123. # Pre-shared key for generating hmacs for the image proxy
  124. ENV::setPriv('IMAGE_PSK', '');
  125. # Production
  126. if (!$ENV->DEV) {
  127. # Unused in OT Gazelle. Currently used for API token auth
  128. ENV::setPriv('ENCKEY', '');
  129. # Alphanumeric random key. This key must be the argument to schedule.php for the schedule to work
  130. ENV::setPriv('SCHEDULE_KEY', '');
  131. # Random key. Used for generating unique RSS auth key
  132. ENV::setPriv('RSS_HASH', '');
  133. # System API key. Used for getting resources via Json->fetch()
  134. ENV::setPriv('SELF_API', '');
  135. }
  136. # Development
  137. else {
  138. ENV::setPriv('ENCKEY', '');
  139. ENV::setPriv('SCHEDULE_KEY', '');
  140. ENV::setPriv('RSS_HASH', '');
  141. ENV::setPriv('SELF_API', '');
  142. }
  143. /**
  144. * Database
  145. */
  146. # Common info
  147. ENV::setPriv('SQLHOST', '10.0.0.3');
  148. ENV::setPriv('SQLPORT', 3306);
  149. #ENV::setPriv('SQLSOCK', '/var/run/mysqld/mysqld.sock');
  150. # TLS client certs
  151. ENV::setPriv('SQL_CERT', "$ENV->WEB_ROOT/sql-keys/client-cert.pem");
  152. ENV::setPriv('SQL_KEY', "$ENV->WEB_ROOT/sql-keys/client-key.pem");
  153. ENV::setPriv('SQL_CA', "$ENV->WEB_ROOT/sql-keys/ca.pem");
  154. # Production
  155. if (!$ENV->DEV) {
  156. ENV::setPriv('SQLDB', 'gazelle_production');
  157. ENV::setPriv('SQLLOGIN', 'gazelle_production');
  158. ENV::setPriv('SQLPASS', '');
  159. }
  160. # Development
  161. else {
  162. ENV::setPriv('SQLDB', 'gazelle_development');
  163. ENV::setPriv('SQLLOGIN', 'gazelle_development');
  164. ENV::setPriv('SQLPASS', '');
  165. }
  166. /**
  167. * Tracker
  168. */
  169. # Ocelot connection, e.g., 0.0.0.0
  170. ENV::setPriv('TRACKER_HOST', '0.0.0.0');
  171. # Production
  172. if (!$ENV->DEV) {
  173. ENV::setPriv('TRACKER_PORT', 34000);
  174. # Must be 32 alphanumeric characters and match site_password in ocelot.conf
  175. ENV::setPriv('TRACKER_SECRET', '');
  176. # Must be 32 alphanumeric characters and match report_password in ocelot.conf
  177. ENV::setPriv('TRACKER_REPORTKEY', '');
  178. }
  179. # Development
  180. else {
  181. ENV::setPriv('TRACKER_PORT', 34001);
  182. ENV::setPriv('TRACKER_SECRET', '');
  183. ENV::setPriv('TRACKER_REPORTKEY', '');
  184. }
  185. /**
  186. * Tracker URLs
  187. *
  188. * Added to torrents à la http://bittorrent.org/beps/bep_0012.html
  189. */
  190. # Production
  191. if (!$ENV->DEV) {
  192. define('ANNOUNCE_URLS', [
  193. [ # Tier 1
  194. 'https://track.biotorrents.de:443',
  195. ], [] # Tier 2
  196. ]);
  197. $AnnounceURLs = [
  198. [ # Tier 1
  199. 'https://track.biotorrents.de:443',
  200. ],
  201. [ # Tier 2
  202. #'udp://tracker.coppersurfer.tk:6969/announce',
  203. #'udp://tracker.cyberia.is:6969/announce',
  204. #'udp://tracker.leechers-paradise.org:6969/announce',
  205. ],
  206. ];
  207. ENV::setPub(
  208. 'ANNOUNCE_URLS',
  209. $ENV->convert($AnnounceURLs)
  210. );
  211. }
  212. # Development
  213. else {
  214. define('ANNOUNCE_URLS', [
  215. [ # Tier 1
  216. 'https://trx.biotorrents.de:443',
  217. ], [] # Tier 2
  218. ]);
  219. $AnnounceURLs = [
  220. [ # Tier 1
  221. 'https://trx.biotorrents.de:443',
  222. ], [], # Tier 2
  223. ];
  224. ENV::setPub(
  225. 'ANNOUNCE_URLS',
  226. $ENV->convert($AnnounceURLs)
  227. );
  228. }
  229. /**
  230. * Search
  231. */
  232. # SphinxqlQuery needs constants
  233. # $ENV breaks the torrent and request pages
  234. define('SPHINXQL_HOST', '127.0.0.1');
  235. define('SPHINXQL_PORT', 9306);
  236. define('SPHINXQL_SOCK', false);
  237. define('SPHINX_MAX_MATCHES', 1000); // Must be <= the server's max_matches variable (default 1000)
  238. /**
  239. * memcached
  240. *
  241. * Very important to run two instances,
  242. * one each for development and production.
  243. */
  244. # Production
  245. if (!$ENV->DEV) {
  246. ENV::setPriv(
  247. 'MEMCACHED_SERVERS',
  248. [[
  249. 'host' => 'unix:///var/run/memcached/memcached.sock',
  250. 'port' => 0,
  251. 'buckets' => 1
  252. ]]
  253. );
  254. }
  255. # Development
  256. else {
  257. ENV::setPriv(
  258. 'MEMCACHED_SERVERS',
  259. [[
  260. 'host' => 'unix:///var/run/memcached/memcached-dev.sock',
  261. 'port' => 0,
  262. 'buckets' => 1
  263. ]]
  264. );
  265. }
  266. /**
  267. * IRC/Slack
  268. */
  269. # IRC server address. Used for onsite chat tool
  270. define('BOT_SERVER', "irc.$ENV->SITE_DOMAIN");
  271. define('SOCKET_LISTEN_ADDRESS', 'localhost');
  272. define('SOCKET_LISTEN_PORT', 51010);
  273. define('BOT_NICK', 'ebooks');
  274. # IRC channels for official business
  275. define('ANNOUNCE_CHAN', '#announce');
  276. define('DEBUG_CHAN', '#debug');
  277. define('REQUEST_CHAN', '#requests');
  278. define('STAFF_CHAN', '#staff');
  279. define('ADMIN_CHAN', '#staff');
  280. define('HELP_CHAN', '#support');
  281. define('DISABLED_CHAN', '#support');
  282. #define('BOT_CHAN', '#userbots');
  283. # Slack invite link
  284. ENV::setPub(
  285. 'SLACK_INVITE',
  286. ''
  287. );
  288. /**
  289. * ================
  290. * = NO MORE =
  291. * = PRIVATE INFO =
  292. * ================
  293. */
  294. /**
  295. * Features
  296. */
  297. # Enable donation page
  298. ENV::setPub('FEATURE_DONATE', true);
  299. # Send re-enable requests to user's email
  300. define('FEATURE_EMAIL_REENABLE', true);
  301. ENV::setPub('FEATURE_EMAIL_REENABLE', true);
  302. # Require users to verify login from unknown locations
  303. ENV::setPub('FEATURE_ENFORCE_LOCATIONS', false);
  304. # Attempt to send messages to IRC
  305. ENV::setPub('FEATURE_IRC', true);
  306. # Attempt to send email from the site
  307. ENV::setPub('FEATURE_SEND_EMAIL', true);
  308. # Allow the site encryption key to be set without an account
  309. # (should only be used for initial setup)
  310. ENV::setPub('FEATURE_SET_ENC_KEY_PUBLIC', false);
  311. # Attempt to support the Seqhash algorithm
  312. # https://blog.libredna.org/post/seqhash/
  313. ENV::setPub('FEATURE_BIOPHP', true);
  314. /**
  315. * Settings
  316. */
  317. # Production
  318. if (!$ENV->DEV) {
  319. # Set to false if you don't want everyone to see debug information; can be overriden with 'site_debug'
  320. define('DEBUG_MODE', false);
  321. ENV::setPub('DEBUG_MODE', false);
  322. }
  323. # Development
  324. else {
  325. define('DEBUG_MODE', false);
  326. ENV::setPub('DEBUG_MODE', false);
  327. # Gazelle's debug mode is broken, so let's use PHP errors instead
  328. error_reporting(E_ALL);
  329. }
  330. # Set to false to disable open registration, true to allow anyone to register
  331. ENV::setPub(
  332. 'OPEN_REGISTRATION',
  333. (!$ENV->DEV
  334. ? true # Production
  335. : false) # Development
  336. );
  337. # The maximum number of users the site can have, 0 for no limit
  338. define('USER_LIMIT', 0);
  339. ENV::setPub('USER_LIMIT', 0);
  340. # User perks
  341. ENV::setPub('STARTING_INVITES', 2);
  342. ENV::setPub('STARTING_TOKENS', 2);
  343. ENV::setPub('STARTING_UPLOAD', 5368709120);
  344. ENV::setPub('DONOR_INVITES', 2);
  345. # Bonus Points
  346. define('BONUS_POINTS', 'Bonus Points');
  347. ENV::setPub('BONUS_POINTS', 'Bonus Points');
  348. ENV::setPub('BP_COEFF', 1.5); # OT default 0.5
  349. # Tag namespaces (configurable via CSS selectors)
  350. #define('TAG_NAMESPACES', ['male', 'female', 'parody', 'character']);
  351. # Banned stuff (file characters, browsers, etc.)
  352. ENV::setPub(
  353. 'BAD_CHARS',
  354. ['"', '*', '/', ':', '<', '>', '?', '\\', '|']
  355. );
  356. # Set to true to block Opera Mini proxy
  357. ENV::setPub('BLOCK_OPERA_MINI', true);
  358. # Password length limits
  359. ENV::setPub('PW_MIN', 15); # Brute force
  360. ENV::setPub('PW_MAX', 10000); # DDoS; default 307200
  361. # Misc stuff like generic reusable snippets
  362. # Example of a variable using heredoc syntax
  363. ENV::setPub(
  364. 'PW_ADVICE',
  365. <<<HTML
  366. <p>
  367. Any password $ENV->PW_MIN characters or longer is accepted, but a strong password
  368. <ul>
  369. <li>is a pass<em>phrase</em> of mixed case with many small words,</li>
  370. <li>that contains complex characters including Unicode and emoji.</li>
  371. </ul>
  372. </p>
  373. HTML
  374. );
  375. /**
  376. * Services
  377. *
  378. * Public APIs, domains, etc.
  379. * Not intended for private API keys.
  380. */
  381. # Current Sci-Hub domains
  382. # https://lovescihub.wordpress.com
  383. define('SCI_HUB', 'se');
  384. ENV::setPub(
  385. 'SCI_HUB',
  386. ['ren', 'tw', 'se']
  387. );
  388. # Semantic Scholar
  389. # https://api.semanticscholar.org
  390. ENV::setPub('SS', 'https://api.semanticscholar.org/v1/paper/');
  391. # IP Geolocation
  392. ENV::setPub('IP_GEO', 'https://tools.keycdn.com/geo.json?host=');
  393. /**
  394. * User class IDs
  395. *
  396. * Needed for automatic promotions.
  397. * Found in the `permissions` table.
  398. */
  399. # Name of class Class ID (not level)
  400. define('ADMIN', '1');
  401. define('USER', '2');
  402. define('MEMBER', '3');
  403. define('POWER', '4');
  404. define('ELITE', '5');
  405. define('LEGEND', '8');
  406. define('MOD', '11');
  407. define('SYSOP', '15');
  408. define('ARTIST', '19');
  409. define('DONOR', '20');
  410. define('VIP', '21');
  411. define('TORRENT_MASTER', '23');
  412. define('POWER_TM', '24');
  413. define('FLS_TEAM', '33');
  414. define('FORUM_MOD', '9001');
  415. /**
  416. * Forums
  417. */
  418. define('STAFF_FORUM', 3);
  419. define('DONOR_FORUM', 7);
  420. ENV::setPub('TRASH_FORUM', 8);
  421. ENV::setPub('ANNOUNCEMENT_FORUM', 1);
  422. ENV::setPub('SUGGESTIONS_FORUM', 2);
  423. # Pagination
  424. define('TORRENT_COMMENTS_PER_PAGE', 10);
  425. define('POSTS_PER_PAGE', 25);
  426. define('TOPICS_PER_PAGE', 50);
  427. define('TORRENTS_PER_PAGE', 50);
  428. define('REQUESTS_PER_PAGE', 25);
  429. define('MESSAGES_PER_PAGE', 25);
  430. define('LOG_ENTRIES_PER_PAGE', 50);
  431. # Cache catalogues
  432. define('THREAD_CATALOGUE', 500); // Limit to THREAD_CATALOGUE posts per cache key
  433. # Miscellaneous values
  434. define('MAX_RANK', 6);
  435. define('MAX_EXTRA_RANK', 8);
  436. define('MAX_SPECIAL_RANK', 3);
  437. ENV::setPub('DONOR_FORUM_RANK', 6);
  438. /**
  439. * Ratio and badges
  440. */
  441. # Ratio requirements, in descending order
  442. define('RATIO_REQUIREMENTS', [
  443. # Downloaded Req (0% seed) Req (100% seed)
  444. [200 * 1024**3, 0.60, 0.60],
  445. [160 * 1024**3, 0.60, 0.50],
  446. [120 * 1024**3, 0.50, 0.40],
  447. [100 * 1024**3, 0.40, 0.30],
  448. [80 * 1024**3, 0.30, 0.20],
  449. [60 * 1024**3, 0.20, 0.10],
  450. [40 * 1024**3, 0.15, 0.00],
  451. [20 * 1024**3, 0.10, 0.00],
  452. [10 * 1024**3, 0.05, 0.00],
  453. ]);
  454. # God I wish I didn't have to do this but I just don't care anymore
  455. $AutomatedBadgeIDs = [
  456. 'DL' => [
  457. '8' => 10,
  458. '16' => 11,
  459. '32' => 12,
  460. '64' => 13,
  461. '128' => 14,
  462. '256' => 15,
  463. '512' => 16,
  464. '1024' => 17,
  465. '2048' => 18,
  466. ],
  467. 'UL' => [
  468. '16' => 20,
  469. '32' => 21,
  470. '64' => 22,
  471. '128' => 23,
  472. '256' => 24,
  473. '512' => 25,
  474. '1024' => 26,
  475. '2048' => 27,
  476. '4096' => 28,
  477. ],
  478. 'Posts' => [
  479. '5' => 30,
  480. '10' => 31,
  481. '25' => 32,
  482. '50' => 33,
  483. '100' => 34,
  484. '250' => 35,
  485. '500' => 36,
  486. '1000' => 37,
  487. '2500' => 38,
  488. ]
  489. ];
  490. ENV::setPub(
  491. 'AUTOMATED_BADGE_IDS',
  492. $ENV->convert($AutomatedBadgeIDs)
  493. );
  494. /**
  495. * Site categories and meta
  496. *
  497. * THIS IS THE OLD FORMAT AND WILL GO AWAY.
  498. * PLEASE SEE $ENV->{DB,META,CATS} BELOW.
  499. */
  500. # Categories
  501. $Categories = [
  502. 'Sequences',
  503. 'Graphs',
  504. 'Systems',
  505. 'Geometric',
  506. 'Scalars/Vectors',
  507. 'Patterns',
  508. 'Constraints',
  509. 'Images',
  510. 'Spatial',
  511. 'Models',
  512. 'Documents',
  513. 'Machine Data',
  514. ];
  515. $GroupedCategories = $Categories;
  516. # Plain Formats
  517. $PlainFormats = [
  518. 'CSV' => ['csv'],
  519. 'JSON' => ['json'],
  520. 'Text' => ['txt'],
  521. 'XML' => ['xml'],
  522. ];
  523. # Sequence Formats
  524. $SeqFormats = [
  525. 'BAM' => ['bam'],
  526. 'CRAM' => ['cram'],
  527. 'EMBL' => ['embl'],
  528. 'FASTA' => ['fa', 'fasta', 'fsa'],
  529. 'FASTA+QUAL' => ['qual'],
  530. 'CSFASTA' => ['csfa', 'csfasta', 'csfsa'],
  531. 'FASTQ' => ['fastq', 'fq', 'sanfastq'],
  532. 'GFF' => ['gff', 'gff2', 'gff3'],
  533. 'GTF' => ['gtf'],
  534. 'GenBank' => ['gb', 'gbk', 'genbank'],
  535. 'HDF5' => ['bash5', 'baxh5', 'fast5', 'h5', 'hdf5'],
  536. 'PIR' => ['pir'],
  537. 'QSeq' => ['qseq'],
  538. 'SAM' => ['sam'],
  539. 'SFF' => ['sff'],
  540. 'SRF' => ['srf'],
  541. 'SnapGene' => ['dna', 'seq'],
  542. 'SwissProt' => ['dat'],
  543. 'VCF' => ['vcf'],
  544. ];
  545. # Protein Formats
  546. # DON'T PARSE RAW FILES. TOO MANY COMPETING VENDORS
  547. $ProtFormats = [
  548. 'ABI/Sciex' => ['t2d', 'wiff'],
  549. 'APML' => ['apml'],
  550. 'ASF' => ['asf'],
  551. 'Agilent/Bruker' => ['baf', 'd', 'fid', 'tdf', 'yep'],
  552. 'BlibBuild' => ['blib'],
  553. 'Bruker/Varian' => ['sms', 'xms'],
  554. 'Finnigan' => ['dat', 'ms'],
  555. 'ION-TOF' => ['ita', 'itm'],
  556. 'JCAMP-DX' => ['jdx'],
  557. 'MGF' => ['mgf'],
  558. 'MS2' => ['ms2'],
  559. 'MSF' => ['msf'],
  560. 'mzData' => ['mzdata'],
  561. 'mzML' => ['mzml'],
  562. 'mzXML' => ['mzxml'],
  563. 'OMSSA' => ['omssa', 'omx'],
  564. 'PEFF' => ['peff'],
  565. 'pepXML' => ['pepxml'],
  566. 'protXML' => ['protxml'],
  567. 'Shimadzu' => ['lcd', 'qgd', 'spc'],
  568. 'Skyline' => ['sky', 'skyd'],
  569. 'TPP/SPC' => ['dta'],
  570. 'Tandem' => ['tandem'],
  571. 'TraML' => ['traml'],
  572. 'ULVAC-PHI' => ['tdc'],
  573. ];
  574. # XML Graph Formats
  575. $GraphXmlFormats = [
  576. 'DGML' => ['dgml'],
  577. 'DotML' => ['dotml'],
  578. 'GEXF' => ['gexf'],
  579. 'GXL' => ['gxl'],
  580. 'GraphML' => ['graphml'],
  581. 'XGMML' => ['xgmml'],
  582. ];
  583. # Text Graph Formats
  584. $GraphTxtFormats = [
  585. 'DOT' => ['gv'],
  586. 'GML' => ['gml'],
  587. 'LCF' => ['lcf'],
  588. 'Newick' => ['xsd', 'sgf'],
  589. 'SIF' => ['sif'],
  590. 'TGF' => ['tgf'],
  591. ];
  592. # Image Formats
  593. # https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3948928/
  594. $ImgFormats = [
  595. 'Analyze' => ['hdr', 'img'],
  596. 'Interfile' => ['h33'],
  597. 'DICOM' => ['dcm', 'dicom'],
  598. 'HDF5' => ['bash5', 'baxh5', 'fast5', 'h5', 'hdf5'],
  599. 'NIfTI' => ['nii', 'nifti'],
  600. 'MINC' => ['minc', 'mnc'],
  601. 'JPEG' => ['jfif', 'jpeg', 'jpg'],
  602. 'JPEG 2000' => ['j2k', 'jp2', 'jpf', 'jpm', 'jpx', 'mj2'],
  603. 'PNG' => ['png'],
  604. 'TIFF' => ['tif', 'tiff'],
  605. 'WebP' => ['webp'],
  606. ];
  607. # Vector Map Formats
  608. $MapVectorFormats = [
  609. 'AutoCAD DXF' => ['dxf'],
  610. 'Cartesian (XYZ)' => ['xyz'],
  611. 'DLG' => ['dlg'],
  612. 'Esri TIN' => ['adf', 'dbf'],
  613. 'GML' => ['gml'],
  614. 'GeoJSON' => ['geojson'],
  615. 'ISFC' => ['isfc'],
  616. 'KML' => ['kml', 'kmzv'],
  617. # DAT omitted
  618. # https://en.wikipedia.org/wiki/MapInfo_TAB_format
  619. 'MapInfo TAB' => ['tab', 'ind', 'map', 'id'],
  620. 'Measure Map Pro' => ['mmp'],
  621. 'NTF' => ['ntf'],
  622. # DBF omitted
  623. # https://en.wikipedia.org/wiki/Shapefile
  624. 'Shapefile' => ['shp', 'shx'],
  625. 'Spatial Data File' => ['sdf', 'sdf3', 'sif', 'kif'],
  626. 'SOSI' => ['sosi'],
  627. 'SVG' => ['svg'],
  628. 'TIGER' => ['tiger'],
  629. 'VPF' => ['vpf'],
  630. ];
  631. # Raster Map Formats
  632. $MapRasterFormats = [
  633. 'ADRG' => ['adrg'],
  634. 'Binary' => ['bsq', 'bip', 'bil'],
  635. 'DRG' => ['drg'],
  636. 'ECRG' => ['ecrg'],
  637. 'ECW' => ['ecw'],
  638. # DAT and ASC omitted (common)
  639. # https://support.esri.com/en/technical-article/000008526
  640. # https://web.archive.org/web/20150128024528/http://docs.codehaus.org/display/GEOTOOLS/ArcInfo+ASCII+Grid+format
  641. 'Esri Grid' => ['adf', 'nit', 'asc', 'grd'],
  642. 'GeoTIFF' => ['tfw'],
  643. #'IMG' => ['img'],
  644. #'JPEG 2000' => ['j2k', 'jp2', 'jpf', 'jpm', 'jpx', 'mj2'],
  645. 'MrSID' => ['sid'],
  646. 'netCDF' => ['nc'],
  647. 'RPF' => ['cadrg', 'cib'],
  648. ];
  649. # Binary Document Formats
  650. # https://en.wikipedia.org/wiki/OpenDocument
  651. # https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions
  652. $BinDocFormats = [
  653. 'OpenDocument' => ['odt', 'fodt', 'ods', 'fods', 'odp', 'fodp', 'odg', 'fodg', 'odf'],
  654. 'Word' => ['doc', 'dot', 'wbk', 'docx', 'docm', 'dotx', 'dotm', 'docb'],
  655. 'PowerPoint' => ['ppt', 'pot', 'pps', 'pptx', 'pptm', 'potx', 'potm', 'ppam', 'ppsx', 'ppsm', 'sldx', 'sldm'],
  656. 'Excel' => ['xls', 'xlt', 'xlm', 'xlsx', 'xlsm', 'xltx', 'xltm', 'xlsb', 'xla', 'xlam', 'xll', 'xlw'],
  657. 'PDF' => ['pdf', 'fdf', 'xfdf'],
  658. ];
  659. # Extra Formats
  660. # DON'T PARSE IMG OR ISO FILES
  661. # https://en.wikipedia.org/wiki/Disk_image#File_formats
  662. # http://dcjtech.info/topic/python-file-extensions/
  663. $CpuGenFormats = [
  664. 'Docker' => ['dockerfile'],
  665. 'Hard Disk' => ['fvd', 'dmg', 'esd', 'qcow', 'qcow2', 'qcow3', 'smi', 'swm', 'vdi', 'vhd', 'vhdx', 'vmdk', 'wim'],
  666. 'Optical Disc' => ['bin', 'ccd', 'cso', 'cue', 'daa', 'isz', 'mdf', 'mds', 'mdx', 'nrg', 'uif'],
  667. 'Python' => ['pxd', 'py', 'py3', 'pyc', 'pyd', 'pyde', 'pyi', 'pyo', 'pyp', 'pyt', 'pyw', 'pywz', 'pyx', 'pyz', 'rpy', 'xpy'],
  668. 'Jupyter' => ['ipynb'],
  669. 'Ontology' => ['cgif', 'cl', 'clif', 'csv', 'htm', 'html', 'kif', 'obo', 'owl', 'rdf', 'rdfa', 'rdfs', 'rif', 'tsv', 'xcl', 'xht', 'xhtml', 'xml'],
  670. ];
  671. # Resolutions
  672. $Resolutions = [
  673. 'Contig',
  674. 'Scaffold',
  675. 'Chromosome',
  676. 'Genome',
  677. 'Proteome',
  678. 'Transcriptome',
  679. ];
  680. /**
  681. * $ENV->DB
  682. *
  683. * One flat array with all possible torrent/group fields.
  684. * These are mostly used in Twig templates as {{ db.title }}.
  685. * Meta abstraction layer for flavor text *around* DB fields.
  686. * Gazelle's job is to query the right tables, which will shift.
  687. */
  688. $DB = [
  689. # torrents_group
  690. 'category_id' => ['name' => 'Category', 'desc' => ''],
  691. 'title' => ['name' => 'Torrent Title', 'desc' => 'Definition line, e.g., Alcohol dehydrogenase ADH1'],
  692. 'subject' => ['name' => 'Organism', 'desc' => 'Organism line binomial, e.g., Saccharomyces cerevisiae'],
  693. 'object' => ['name' => 'Strain/Variety', 'desc' => 'Organism line if any, e.g., S288C'],
  694. 'year' => ['name' => 'Year', 'desc' => 'Publication year'],
  695. 'workgroup' => ['name' => 'Department/Lab', 'desc' => "Last author's institution, e.g., Lawrence Berkeley Laboratory"],
  696. 'location' => ['name' => 'Location', 'desc' => 'Physical location, e.g., Berkeley, CA 94720'],
  697. 'identifier' => ['name' => 'Accession Number', 'desc' => 'RefSeq and UniProt preferred'],
  698. 'tag_list' => ['name' => 'Tag List', 'desc' => 'Comma-seperated list of at least 5 tags'],
  699. 'timestamp' => ['name' => 'Uploaded On', 'desc' => ''],
  700. 'revision_id' => ['name' => 'Revision ID', 'desc' => ''],
  701. 'description' => ['name' => 'Group Description', 'desc' => ''],
  702. 'picture' => ['name' => 'Picture', 'desc' => 'A meaningful picture, e.g., the specimen or a thumbnail'],
  703. # From the non-renamed `torrents` table
  704. 'version' => ['name' => 'Version', 'desc' => 'Start with 0.1.0', 'note' => 'Please see <a href="https://semver.org" target="_blank">Semantic Versioning</a>'],
  705. 'license' => ['name' => 'License', 'desc' => '', 'note' => 'Please see <a href="http://www.dcc.ac.uk/resources/how-guides/license-research-data" target="_blank">How to License Research Data</a>'],
  706. 'mirrors' => ['name' => 'Mirrors', 'desc' => 'Up to two FTP/HTTP addresses that either point directly to a file, or for multi-file torrents, to the enclosing folder'],
  707. ];
  708. ENV::setPub(
  709. 'DB',
  710. $ENV->convert($DB)
  711. );
  712. /**
  713. * $ENV->META
  714. *
  715. * Main metadata object.
  716. * Responsible for defining field values.
  717. * These eventually go into the database,
  718. * so take care to define them well here.
  719. * Avoid nesting > 3 levels deep.
  720. */
  721. $META = [
  722. /**
  723. * 1.
  724. * PLATFORMS
  725. */
  726. 'Platforms' => [
  727. /**
  728. * 2.
  729. * Sequences
  730. */
  731. 'Sequences' => [
  732. # DNA
  733. 'Complete Genomics',
  734. 'cPAS-BGI/MGI',
  735. 'Helicos',
  736. 'Illumina HiSeq',
  737. 'Illumina MiSeq',
  738. 'Ion Torrent',
  739. 'Microfluidics',
  740. 'Nanopore',
  741. 'PacBio',
  742. 'Roche 454',
  743. 'Sanger',
  744. 'SOLiD',
  745. # RNA, Protein, etc.
  746. 'De Novo',
  747. 'HPLC',
  748. 'Mass Spec',
  749. 'RNA-Seq',
  750. ],
  751. /**
  752. * 2.
  753. * Graphs
  754. * https://en.wikipedia.org/wiki/Graph_drawing#Software
  755. */
  756. 'Graphs' => [
  757. 'BioFabric',
  758. 'BioTapestry',
  759. 'Cytoscape',
  760. 'Edraw Max',
  761. 'GenMAPP',
  762. 'Gephi',
  763. 'graph-tool',
  764. 'Graphviz',
  765. 'InCroMAP',
  766. 'LaNet-vi',
  767. 'Linkurious',
  768. 'MATLAB',
  769. 'MEGA',
  770. 'Maple',
  771. 'Mathematica',
  772. #'Microsoft Automatic Graph Layout',
  773. 'NetworkX',
  774. 'PGF/TikZ',
  775. 'PathVisio',
  776. 'Pathview',
  777. 'R',
  778. 'Systrip',
  779. 'Tom Sawyer Software',
  780. 'Tulip',
  781. 'yEd',
  782. ],
  783. /**
  784. * 2.
  785. * Images
  786. */
  787. 'Images' => [
  788. 'CT/CAT',
  789. 'ECG',
  790. 'Elastography',
  791. 'FNIR/NIRS',
  792. 'MPI',
  793. 'MRI/NMR',
  794. 'Microscopy',
  795. 'Photoacoustic',
  796. 'Photography',
  797. 'Scint/SPECT/PET',
  798. 'Ultrasound',
  799. 'X-Rays',
  800. ],
  801. /**
  802. * 2.
  803. * Documents
  804. */
  805. 'Documents' => [
  806. # Composed
  807. 'Literature',
  808. 'Software',
  809. # Generated
  810. 'Kernel',
  811. 'Metadata',
  812. 'Notebook',
  813. ],
  814. /**
  815. * 2.
  816. * Machine Data
  817. */
  818. 'Raw' => [
  819. 'Binary',
  820. 'Text',
  821. ],
  822. ], # End $ENV->META->Platforms
  823. /**
  824. * 1.
  825. * FORMATS
  826. */
  827. 'Formats' => [
  828. /**
  829. * 2.
  830. * Plain
  831. */
  832. 'Plain' => [
  833. 'CSV' => ['csv'], # 3
  834. 'JSON' => ['json'], # 3
  835. 'Text' => ['txt'], # 3
  836. 'XML' => ['xml'], # etc.
  837. ],
  838. /**
  839. * 2.
  840. * Archives
  841. */
  842. 'Archives' => [
  843. '7z' => ['7z'],
  844. 'bzip2' => ['bz2', 'bzip2'],
  845. 'gzip' => ['gz', 'gzip', 'tgz', 'tpz'],
  846. 'Pickle' => ['pickle', 'pkl'],
  847. 'RAR' => ['rar', 'rev'],
  848. 'tar' => ['tar'],
  849. 'ZIP' => ['zip', 'zipx'],
  850. 'None' => [''],
  851. ],
  852. /**
  853. * 2.
  854. * Sequences
  855. * https://www.ncbi.nlm.nih.gov/sra/docs/submitformats/
  856. */
  857. 'Sequences' => [
  858. 'BAM' => ['bam'],
  859. 'CRAM' => ['cram'],
  860. 'EMBL' => ['embl'],
  861. 'FASTA' => ['fa', 'fasta', 'fsa'],
  862. 'FASTA+QUAL' => ['qual'],
  863. 'CSFASTA' => ['csfa', 'csfasta', 'csfsa'],
  864. 'FASTQ' => ['fastq', 'fq', 'sanfastq'],
  865. 'GFF' => ['gff', 'gff2', 'gff3'],
  866. 'GTF' => ['gtf'],
  867. 'GenBank' => ['gb', 'gbk', 'genbank'],
  868. 'HDF5' => ['bash5', 'baxh5', 'fast5', 'h5', 'hdf5'],
  869. 'PIR' => ['pir'],
  870. 'QSeq' => ['qseq'],
  871. 'SAM' => ['sam'],
  872. 'SFF' => ['sff'],
  873. 'SRF' => ['srf'],
  874. 'SnapGene' => ['dna', 'seq'],
  875. 'SwissProt' => ['dat'],
  876. 'VCF' => ['vcf'],
  877. ],
  878. /**
  879. * 2.
  880. * Proteins
  881. * https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3518119/
  882. */
  883. 'Proteins' => [
  884. 'ABI/Sciex' => ['t2d', 'wiff'],
  885. 'APML' => ['apml'],
  886. 'ASF' => ['asf'],
  887. 'Agilent/Bruker' => ['baf', 'd', 'fid', 'tdf', 'yep'],
  888. 'BlibBuild' => ['blib'],
  889. 'Bruker/Varian' => ['sms', 'xms'],
  890. 'Finnigan' => ['dat', 'ms'],
  891. 'ION-TOF' => ['ita', 'itm'],
  892. 'JCAMP-DX' => ['jdx'],
  893. 'MGF' => ['mgf'],
  894. 'MS2' => ['ms2'],
  895. 'MSF' => ['msf'],
  896. 'mzData' => ['mzdata'],
  897. 'mzML' => ['mzml'],
  898. 'mzXML' => ['mzxml'],
  899. 'OMSSA' => ['omssa', 'omx'],
  900. 'PEFF' => ['peff'],
  901. 'pepXML' => ['pepxml'],
  902. 'protXML' => ['protxml'],
  903. 'Shimadzu' => ['lcd', 'qgd', 'spc'],
  904. 'Skyline' => ['sky', 'skyd'],
  905. 'TPP/SPC' => ['dta'],
  906. 'Tandem' => ['tandem'],
  907. 'TraML' => ['traml'],
  908. 'ULVAC-PHI' => ['tdc'],
  909. ],
  910. /**
  911. * 2.
  912. * Graph XML
  913. */
  914. 'GraphXml' => [
  915. 'DGML' => ['dgml'],
  916. 'DotML' => ['dotml'],
  917. 'GEXF' => ['gexf'],
  918. 'GXL' => ['gxl'],
  919. 'GraphML' => ['graphml'],
  920. 'XGMML' => ['xgmml'],
  921. ],
  922. /**
  923. * 2.
  924. * Graph plain
  925. */
  926. 'GraphTxt' => [
  927. 'DOT' => ['gv'],
  928. 'GML' => ['gml'],
  929. 'LCF' => ['lcf'],
  930. 'Newick' => ['xsd', 'sgf'],
  931. 'SIF' => ['sif'],
  932. 'TGF' => ['tgf'],
  933. ],
  934. /**
  935. * 2.
  936. * Image vector
  937. */
  938. 'ImgVector' => [
  939. 'AI' => ['ai'],
  940. 'CorelDRAW' => ['cdr'],
  941. 'EPS' => ['eps', 'epsf', 'epsi'],
  942. 'SVG' => ['svg'],
  943. 'WMF' => ['emf', 'emz', 'wmf', 'wmz'],
  944. ],
  945. /**
  946. * 2.
  947. * Image raster
  948. */
  949. 'ImgRaster' => [
  950. 'Analyze' => ['hdr', 'img'],
  951. 'Interfile' => ['h33'],
  952. 'DICOM' => ['dcm', 'dicom'],
  953. 'HDF5' => ['bash5', 'baxh5', 'fast5', 'h5', 'hdf5'],
  954. 'NIfTI' => ['nii', 'nifti'],
  955. 'MINC' => ['minc', 'mnc'],
  956. 'JPEG' => ['jfif', 'jpeg', 'jpg'],
  957. 'JPEG 2000' => ['j2k', 'jp2', 'jpf', 'jpm', 'jpx', 'mj2'],
  958. 'PNG' => ['png'],
  959. 'TIFF' => ['tif', 'tiff'],
  960. 'WebP' => ['webp'],
  961. ],
  962. /**
  963. * 2.
  964. * Map vector
  965. */
  966. 'MapVector' => [
  967. 'AutoCAD DXF' => ['dxf'],
  968. 'Cartesian (XYZ)' => ['xyz'],
  969. 'DLG' => ['dlg'],
  970. 'Esri TIN' => ['adf', 'dbf'],
  971. 'GML' => ['gml'],
  972. 'GeoJSON' => ['geojson'],
  973. 'ISFC' => ['isfc'],
  974. 'KML' => ['kml', 'kmzv'],
  975. # DAT omitted
  976. # https://en.wikipedia.org/wiki/MapInfo_TAB_format
  977. 'MapInfo TAB' => ['tab', 'ind', 'map', 'id'],
  978. 'Measure Map Pro' => ['mmp'],
  979. 'NTF' => ['ntf'],
  980. # DBF omitted
  981. # https://en.wikipedia.org/wiki/Shapefile
  982. 'Shapefile' => ['shp', 'shx'],
  983. 'Spatial Data File' => ['sdf', 'sdf3', 'sif', 'kif'],
  984. 'SOSI' => ['sosi'],
  985. 'SVG' => ['svg'],
  986. 'TIGER' => ['tiger'],
  987. 'VPF' => ['vpf'],
  988. ],
  989. /**
  990. * 2.
  991. * Map raster
  992. */
  993. 'MapRaster' => [
  994. 'ADRG' => ['adrg'],
  995. 'Binary' => ['bsq', 'bip', 'bil'],
  996. 'DRG' => ['drg'],
  997. 'ECRG' => ['ecrg'],
  998. 'ECW' => ['ecw'],
  999. # DAT and ASC omitted (common)
  1000. # https://support.esri.com/en/technical-article/000008526
  1001. # https://web.archive.org/web/20150128024528/http://docs.codehaus.org/display/GEOTOOLS/ArcInfo+ASCII+Grid+format
  1002. 'Esri Grid' => ['adf', 'nit', 'asc', 'grd'],
  1003. 'GeoTIFF' => ['tfw'],
  1004. #'IMG' => ['img'],
  1005. #'JPEG 2000' => ['j2k', 'jp2', 'jpf', 'jpm', 'jpx', 'mj2'],
  1006. 'MrSID' => ['sid'],
  1007. 'netCDF' => ['nc'],
  1008. 'RPF' => ['cadrg', 'cib'],
  1009. ],
  1010. /**
  1011. * 2.
  1012. * Binary documents
  1013. */
  1014. 'BinDoc' => [
  1015. 'OpenDocument' => ['odt', 'fodt', 'ods', 'fods', 'odp', 'fodp', 'odg', 'fodg', 'odf'],
  1016. 'Word' => ['doc', 'dot', 'wbk', 'docx', 'docm', 'dotx', 'dotm', 'docb'],
  1017. 'PowerPoint' => ['ppt', 'pot', 'pps', 'pptx', 'pptm', 'potx', 'potm', 'ppam', 'ppsx', 'ppsm', 'sldx', 'sldm'],
  1018. 'Excel' => ['xls', 'xlt', 'xlm', 'xlsx', 'xlsm', 'xltx', 'xltm', 'xlsb', 'xla', 'xlam', 'xll', 'xlw'],
  1019. 'PDF' => ['pdf', 'fdf', 'xfdf'],
  1020. ],
  1021. /**
  1022. * 2.
  1023. * Extra formats
  1024. */
  1025. 'CpuGen' => [
  1026. 'Docker' => ['dockerfile'],
  1027. 'Hard Disk' => ['fvd', 'dmg', 'esd', 'qcow', 'qcow2', 'qcow3', 'smi', 'swm', 'vdi', 'vhd', 'vhdx', 'vmdk', 'wim'],
  1028. 'Optical Disc' => ['bin', 'ccd', 'cso', 'cue', 'daa', 'isz', 'mdf', 'mds', 'mdx', 'nrg', 'uif'],
  1029. 'Python' => ['pxd', 'py', 'py3', 'pyc', 'pyd', 'pyde', 'pyi', 'pyo', 'pyp', 'pyt', 'pyw', 'pywz', 'pyx', 'pyz', 'rpy', 'xpy'],
  1030. 'Jupyter' => ['ipynb'],
  1031. 'Ontology' => ['cgif', 'cl', 'clif', 'csv', 'htm', 'html', 'kif', 'obo', 'owl', 'rdf', 'rdfa', 'rdfs', 'rif', 'tsv', 'xcl', 'xht', 'xhtml', 'xml'],
  1032. ],
  1033. ], # End $ENV->META->Formats
  1034. /**
  1035. * 1.
  1036. * SCOPES
  1037. */
  1038. 'Scopes' => [
  1039. /**
  1040. * 2.
  1041. * SI
  1042. */
  1043. 'SI' => [
  1044. 'Nano',
  1045. 'Micro',
  1046. 'Milli',
  1047. 'Centi',
  1048. 'Kilo',
  1049. 'Mega',
  1050. 'Giga',
  1051. 'Tera',
  1052. ],
  1053. /**
  1054. * 2.
  1055. * Sequences
  1056. */
  1057. 'Sequences' => [
  1058. 'Contig',
  1059. 'Scaffold',
  1060. 'Chromosome',
  1061. 'Genome',
  1062. 'Proteome',
  1063. 'Transcriptome',
  1064. ],
  1065. /**
  1066. * 2.
  1067. * Locations
  1068. */
  1069. 'Locations' => [
  1070. 'Organization',
  1071. 'Locality',
  1072. 'State',
  1073. 'Province',
  1074. 'Country',
  1075. 'Continent',
  1076. 'World',
  1077. ],
  1078. /**
  1079. * 2.
  1080. * XML
  1081. */
  1082. 'XML' => [
  1083. 'Value',
  1084. 'Attribute',
  1085. 'Group',
  1086. 'Element',
  1087. 'Schema',
  1088. ],
  1089. /**
  1090. * 2.
  1091. * Scalar
  1092. */
  1093. 'Scalar' => [
  1094. 'Area',
  1095. 'Density',
  1096. 'Distance',
  1097. 'Energy',
  1098. 'Mass',
  1099. 'Speed',
  1100. 'Temperature',
  1101. 'Time',
  1102. 'Volume',
  1103. 'Work',
  1104. ],
  1105. /**
  1106. * 2.
  1107. * Vector
  1108. */
  1109. 'Vector' => [
  1110. 'Acceleration',
  1111. 'Displacement',
  1112. 'Force',
  1113. 'Polarization',
  1114. 'Momentum',
  1115. 'Position',
  1116. 'Thrust',
  1117. 'Velocity',
  1118. 'Weight',
  1119. ],
  1120. ], # End $ENV->META->Scopes
  1121. /**
  1122. * 1.
  1123. * LICENSES
  1124. */
  1125. 'Licenses' => [
  1126. 'BSD-2',
  1127. 'BSD-3',
  1128. 'CC BY',
  1129. 'CC BY-SA',
  1130. 'CC BY-ND',
  1131. 'CC BY-NC',
  1132. 'CC BY-NC-SA',
  1133. 'CC BY-NC-ND',
  1134. 'GNU GPL',
  1135. 'GNU LGPL',
  1136. 'GNU AGPL',
  1137. 'GNU FDL',
  1138. 'MIT',
  1139. 'ODC-By',
  1140. 'ODC-ODbL',
  1141. 'OpenMTA',
  1142. 'Public Domain',
  1143. 'Unspecified',
  1144. ], # End $ENV->META->Licenses
  1145. ];
  1146. ENV::setPub(
  1147. 'META',
  1148. $ENV->convert($META)
  1149. );
  1150. /**
  1151. * Categories
  1152. * https://www.ncbi.nlm.nih.gov/books/NBK25464/
  1153. */
  1154. $CatIcons = "$ENV->STATIC_SERVER/common/bioicons";
  1155. $CollageCats = [
  1156. 0 => 'Personal',
  1157. 1 => 'Theme',
  1158. 2 => 'Staff Picks',
  1159. 3 => 'Group Picks',
  1160. ];
  1161. $CATS = [
  1162. 1 => [
  1163. 'ID' => 1,
  1164. 'Name' => 'Sequences',
  1165. 'Icon' => "$CatIcons/sequences.png",
  1166. 'Description' => "For data that's ACGT, ACGU, amino acid letters on disk.",
  1167. 'Platforms' => $ENV->META->Platforms->Sequences,
  1168. 'Formats' => array_merge([
  1169. /*
  1170. 'Sequences' => $ENV->META->Formats->Sequences,
  1171. 'Proteins' => $ENV->META->Formats->Proteins,
  1172. 'Plain' => $ENV->META->Formats->Plain,
  1173. */
  1174. $ENV->META->Formats->Sequences,
  1175. $ENV->META->Formats->Proteins,
  1176. $ENV->META->Formats->Plain,
  1177. ]),
  1178. ],
  1179. 2 => [
  1180. 'ID' => 2,
  1181. 'Name' => 'Graphs',
  1182. 'Icon' => "$CatIcons/graphs.png",
  1183. 'Description' => 'For pathway and regulatory network data, structured taxonomies, etc.',
  1184. 'Platforms' => $ENV->META->Platforms->Graphs,
  1185. 'Formats' => [
  1186. 'GraphXml' => $ENV->META->Formats->GraphXml,
  1187. 'GraphTxt' => $ENV->META->Formats->GraphTxt,
  1188. 'Plain' => $ENV->META->Formats->Plain,
  1189. ],
  1190. ],
  1191. 3 => [
  1192. 'ID' => 3,
  1193. 'Name' => 'Systems',
  1194. 'Icon' => "$CatIcons/systems.png",
  1195. 'Description' => 'For data that examines one facet broadly, not one subject deeply.',
  1196. 'Platforms' => $ENV->META->Platforms->Graphs,
  1197. 'Formats' => [
  1198. 'GraphXml' => $ENV->META->Formats->GraphXml,
  1199. 'GraphTxt' => $ENV->META->Formats->GraphTxt,
  1200. 'Plain' => $ENV->META->Formats->Plain,
  1201. ],
  1202. ],
  1203. 4 => [
  1204. 'ID' => 4,
  1205. 'Name' => 'Geometric',
  1206. 'Icon' => "$CatIcons/geometric.png",
  1207. 'Description' => "For structured data (XML, etc.) that describes the subject's orientation in space.",
  1208. 'Platforms' => $ENV->META->Platforms->Graphs,
  1209. 'Formats' => [
  1210. 'GraphXml' => $ENV->META->Formats->GraphXml,
  1211. 'GraphTxt' => $ENV->META->Formats->GraphTxt,
  1212. 'Plain' => $ENV->META->Formats->Plain,
  1213. ],
  1214. ],
  1215. 5 => [
  1216. 'ID' => 5,
  1217. 'Name' => 'Scalars/Vectors',
  1218. 'Icon' => "$CatIcons/scalars_vectors.png",
  1219. 'Description' => 'For data that describes observations over time and/or space.',
  1220. 'Platforms' => $ENV->META->Platforms->Graphs,
  1221. 'Formats' => [
  1222. 'GraphXml' => $ENV->META->Formats->GraphXml,
  1223. 'GraphTxt' => $ENV->META->Formats->GraphTxt,
  1224. 'Plain' => $ENV->META->Formats->Plain,
  1225. ],
  1226. ],
  1227. 6 => [
  1228. 'ID' => 6,
  1229. 'Name' => 'Patterns',
  1230. 'Icon' => "$CatIcons/patterns.png",
  1231. 'Description' => 'For data that describes recurring structures in nature such as common pathways or motifs in the proteome or metabolome.',
  1232. 'Platforms' => $ENV->META->Platforms->Graphs,
  1233. 'Formats' => [
  1234. 'GraphXml' => $ENV->META->Formats->GraphXml,
  1235. 'GraphTxt' => $ENV->META->Formats->GraphTxt,
  1236. 'Plain' => $ENV->META->Formats->Plain,
  1237. ],
  1238. ],
  1239. 7 => [
  1240. 'ID' => 7,
  1241. 'Name' => 'Constraints',
  1242. 'Icon' => "$CatIcons/constraints.png",
  1243. 'Description' => 'For data that records experimental control behavior, checks readings against known physical constants, tracks the thermodynamic limits of reactions, etc.',
  1244. 'Platforms' => $ENV->META->Platforms->Graphs,
  1245. 'Formats' => [
  1246. 'GraphXml' => $ENV->META->Formats->GraphXml,
  1247. 'GraphTxt' => $ENV->META->Formats->GraphTxt,
  1248. 'Plain' => $ENV->META->Formats->Plain,
  1249. ],
  1250. ],
  1251. 8 => [
  1252. 'ID' => 8,
  1253. 'Name' => 'Images',
  1254. 'Icon' => "$CatIcons/images.png",
  1255. 'Description' => 'For data you can look at!',
  1256. 'Platforms' => $ENV->META->Platforms->Images,
  1257. 'Formats' => [
  1258. 'ImgRaster' => $ENV->META->Formats->ImgRaster,
  1259. 'ImgVector' => $ENV->META->Formats->ImgVector,
  1260. 'Plain' => $ENV->META->Formats->Plain,
  1261. ],
  1262. ],
  1263. 9 => [
  1264. 'ID' => 9,
  1265. 'Name' => 'Spatial',
  1266. 'Icon' => "$CatIcons/spatial.png",
  1267. 'Description' => "For data that's limited to specific locations or otherwise describes macroscopic space.",
  1268. 'Platforms' => $ENV->META->Platforms->Graphs,
  1269. 'Formats' => [
  1270. 'MapRaster' => $ENV->META->Formats->MapRaster,
  1271. 'MapVector' => $ENV->META->Formats->MapVector,
  1272. 'ImgRaster' => $ENV->META->Formats->ImgRaster,
  1273. 'ImgVector' => $ENV->META->Formats->ImgVector,
  1274. 'Plain' => $ENV->META->Formats->Plain,
  1275. ],
  1276. ],
  1277. 10 => [
  1278. 'ID' => 10,
  1279. 'Name' => 'Models',
  1280. 'Icon' => "$CatIcons/models.png",
  1281. 'Description' => 'For projections, simulations, and other hypothetical or computer-generated data.',
  1282. 'Platforms' => $ENV->META->Platforms->Graphs,
  1283. 'Formats' => [
  1284. 'MapRaster' => $ENV->META->Formats->MapRaster,
  1285. 'MapVector' => $ENV->META->Formats->MapVector,
  1286. 'ImgRaster' => $ENV->META->Formats->ImgRaster,
  1287. 'ImgVector' => $ENV->META->Formats->ImgVector,
  1288. 'Plain' => $ENV->META->Formats->Plain,
  1289. ],
  1290. ],
  1291. 11 => [
  1292. 'ID' => 11,
  1293. 'Name' => 'Documents',
  1294. 'Icon' => "$CatIcons/documents.png",
  1295. 'Description' => 'For documentation, software, disk images, and literature datasets.',
  1296. 'Platforms' => $ENV->META->Platforms->Documents,
  1297. 'Formats' => [
  1298. 'BinDoc' => $ENV->META->Formats->BinDoc,
  1299. 'CpuGen' => $ENV->META->Formats->CpuGen,
  1300. 'Plain' => $ENV->META->Formats->Plain,
  1301. ],
  1302. ],
  1303. 12 => [
  1304. 'ID' => 12,
  1305. 'Name' => 'Machine Data',
  1306. 'Icon' => "$CatIcons/machine_data.png",
  1307. 'Description' => 'For raw reads and machine data of any category.',
  1308. 'Platforms' => $ENV->META->Platforms->Raw,
  1309. 'Formats' => [
  1310. 'Plain' => $ENV->META->Formats->Plain,
  1311. ],
  1312. ],
  1313. ];
  1314. ENV::setPub(
  1315. 'CATS',
  1316. $ENV->convert($CATS)
  1317. );
  1318. /**
  1319. * Regular expressions
  1320. *
  1321. * The Gazelle regex collection.
  1322. * Formerly in classes/regex.php.
  1323. */
  1324. // resource_type://username:password@domain:port/path?query_string#anchor
  1325. define('RESOURCE_REGEX', '(https?|ftps?):\/\/');
  1326. ENV::setPub(
  1327. 'RESOURCE_REGEX',
  1328. '(https?|ftps?):\/\/'
  1329. );
  1330. define('IP_REGEX', '(\d{1,3}\.){3}\d{1,3}');
  1331. ENV::setPub(
  1332. 'IP_REGEX',
  1333. '(\d{1,3}\.){3}\d{1,3}'
  1334. );
  1335. define('DOMAIN_REGEX', '([a-z0-9\-\_]+\.)*[a-z0-9\-\_]+');
  1336. ENV::setPub(
  1337. 'DOMAIN_REGEX',
  1338. '([a-z0-9\-\_]+\.)*[a-z0-9\-\_]+'
  1339. );
  1340. define('PORT_REGEX', ':\d{1,5}');
  1341. ENV::setPub(
  1342. 'PORT_REGEX',
  1343. ':\d{1,5}'
  1344. );
  1345. define('URL_REGEX', '('.RESOURCE_REGEX.')('.IP_REGEX.'|'.DOMAIN_REGEX.')('.PORT_REGEX.')?(\/\S*)*');
  1346. ENV::setPub(
  1347. 'URL_REGEX',
  1348. "($ENV->RESOURCE_REGEX)($ENV->IP_REGEX|$ENV->DOMAIN_REGEX)($ENV->PORT_REGEX)?(\/\S*)*"
  1349. );
  1350. define('USERNAME_REGEX', '/^[a-z0-9_]{2,20}$/iD');
  1351. ENV::setPub(
  1352. 'USERNAME_REGEX',
  1353. '/^[a-z0-9_]{2,20}$/iD'
  1354. );
  1355. define('EMAIL_REGEX', '[_a-z0-9-]+([.+][_a-z0-9-]+)*@'.DOMAIN_REGEX);
  1356. ENV::setPub(
  1357. 'EMAIL_REGEX',
  1358. "[_a-z0-9-]+([.+][_a-z0-9-]+)*@$ENV->DOMAIN_REGEX"
  1359. );
  1360. define('IMAGE_REGEX', URL_REGEX.'\/\S+\.(jpg|jpeg|tif|tiff|png|gif|bmp)(\?\S*)?');
  1361. ENV::setPub(
  1362. 'IMAGE_REGEX',
  1363. "$ENV->URL_REGEX\/\S+\.(jpg|jpeg|tif|tiff|png|gif|bmp)(\?\S*)?"
  1364. );
  1365. define('VIDEO_REGEX', URL_REGEX.'\/\S+\.(webm)(\?\S*)?');
  1366. ENV::setPub(
  1367. 'VIDEO_REGEX',
  1368. "$ENV->URL_REGEX\/\S+\.(webm)(\?\S*)?"
  1369. );
  1370. define('CSS_REGEX', URL_REGEX.'\/\S+\.css(\?\S*)?');
  1371. ENV::setPub(
  1372. 'CSS_REGEX',
  1373. "$ENV->URL_REGEX\/\S+\.css(\?\S*)?"
  1374. );
  1375. define('SITELINK_REGEX', RESOURCE_REGEX.'(www.)?'.preg_quote(SITE_DOMAIN, '/'));
  1376. ENV::setPub(
  1377. 'SITELINK_REGEX',
  1378. "$ENV->RESOURCE_REGEX(www.)?".preg_quote(SITE_DOMAIN, '/')
  1379. );
  1380. define('TORRENT_REGEX', SITELINK_REGEX.'\/torrents\.php\?(.*&)?torrentid=(\d+)'); // torrentid = group 4
  1381. ENV::setPub(
  1382. 'TORRENT_REGEX',
  1383. "$ENV->SITELINK_REGEX\/torrents\.php\?(.*&)?torrentid=(\d+)"
  1384. );
  1385. define('TORRENT_GROUP_REGEX', SITELINK_REGEX.'\/torrents\.php\?(.*&)?id=(\d+)'); // id = group 4
  1386. ENV::setPub(
  1387. 'TORRENT_GROUP_REGEX',
  1388. "$ENV->SITELINK_REGEX\/torrents\.php\?(.*&)?id=(\d+)"
  1389. );
  1390. define('ARTIST_REGEX', SITELINK_REGEX.'\/artist\.php\?(.*&)?id=(\d+)'); // id = group 4
  1391. ENV::setPub(
  1392. 'ARTIST_REGEX',
  1393. "$ENV->SITELINK_REGEX\/artist\.php\?(.*&)?id=(\d+)"
  1394. );
  1395. # https://stackoverflow.com/a/3180176
  1396. ENV::setPub(
  1397. 'HTML_REGEX',
  1398. '<([\w]+)([^>]*?)(([\s]*\/>)|(>((([^<]*?|<\!\-\-.*?\-\->)|(?R))*)<\/\\1[\s]*>))'
  1399. );
  1400. ENV::setPub(
  1401. 'BBCODE_REGEX',
  1402. '\[([\w]+)([^\]]*?)(([\s]*\/\])|(\]((([^\[]*?|\[\!\-\-.*?\-\-\])|(?R))*)\[\/\\1[\s]*\]))'
  1403. );
  1404. # https://www.crossref.org/blog/dois-and-matching-regular-expressions/
  1405. ENV::setPub(
  1406. 'DOI_REGEX',
  1407. '10.\d{4,9}\/[-._;()\/:A-Z0-9]+'
  1408. );
  1409. # https://www.biostars.org/p/13753/
  1410. ENV::setPub(
  1411. 'ENTREZ_REGEX',
  1412. '\d*'
  1413. );
  1414. # https://www.wikidata.org/wiki/Property:P496
  1415. ENV::setPub(
  1416. 'ORCID_REGEX',
  1417. '0000-000(1-[5-9]|2-[0-9]|3-[0-4])\d{3}-\d{3}[\dX]'
  1418. );
  1419. # https://www.biostars.org/p/13753/
  1420. ENV::setPub(
  1421. 'REFSEQ_REGEX',
  1422. '\w{2}_\d{1,}\.\d{1,}'
  1423. );
  1424. # https://www.uniprot.org/help/accession_numbers
  1425. ENV::setPub(
  1426. 'UNIPROT_REGEX',
  1427. '[OPQ][0-9][A-Z0-9]{3}[0-9]|[A-NR-Z][0-9]([A-Z][A-Z0-9]{2}[0-9]){1,2}'
  1428. );