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

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