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 42KB

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