GFF3ImporterTest.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. <?php
  2. namespace Tests;
  3. use StatonLab\TripalTestSuite\DBTransaction;
  4. use StatonLab\TripalTestSuite\TripalTestCase;
  5. class GFF3ImporterTest extends TripalTestCase {
  6. use DBTransaction;
  7. /**
  8. * Confirm basic GFF importer functionality.
  9. *
  10. * @group gff
  11. */
  12. public function testGFFImporter() {
  13. $gff_file = ['file_local' => __DIR__ . '/../data/small_gene.gff'];
  14. $fasta = ['file_local' => __DIR__ . '/../data/short_scaffold.fasta'];
  15. $analysis = factory('chado.analysis')->create();
  16. $organism = factory('chado.organism')->create();
  17. $run_args = [
  18. 'analysis_id' => $analysis->analysis_id,
  19. 'organism_id' => $organism->organism_id,
  20. 'use_transaction' => 1,
  21. 'add_only' => 0,
  22. 'update' => 1,
  23. 'create_organism' => 0,
  24. 'create_target' => 0,
  25. ///regexps for mRNA and protein.
  26. 're_mrna' => NULL,
  27. 're_protein' => NULL,
  28. //optional
  29. 'target_organism_id' => NULL,
  30. 'target_type' => NULL,
  31. 'start_line' => NULL,
  32. 'landmark_type' => NULL,
  33. 'alt_id_attr' => NULL,
  34. ];
  35. $this->loadLandmarks($analysis, $organism, $fasta);
  36. $this->runGFFLoader($run_args, $gff_file);
  37. // This protein is an explicit protein / polypeptide imported from the GFF
  38. // file.
  39. $name = 'test_protein_001.1';
  40. $query = db_select('chado.feature', 'f')
  41. ->fields('f', ['uniquename'])
  42. ->condition('f.uniquename', $name)
  43. ->execute()
  44. ->fetchField();
  45. $this->assertEquals($name, $query);
  46. }
  47. /**
  48. * Run the GFF loader on gff_duplicate_ids.gff for testing.
  49. *
  50. * This tests whether the GFF loader detects duplicate IDs which makes a
  51. * GFF file invalid since IDs should be unique. The GFF loader should throw
  52. * and exception which this test checks for
  53. */
  54. public function testGFFImporterDuplicateIDsExceptionCheck() {
  55. $gff_file = ['file_local' => __DIR__ . '/../data/gff_duplicate_ids.gff'];
  56. $analysis = factory('chado.analysis')->create();
  57. $organism = factory('chado.organism')->create();
  58. $run_args = [
  59. 'analysis_id' => $analysis->analysis_id,
  60. 'organism_id' => $organism->organism_id,
  61. 'use_transaction' => 1,
  62. 'add_only' => 0,
  63. 'update' => 1,
  64. 'create_organism' => 0,
  65. 'create_target' => 0,
  66. ///regexps for mRNA and protein.
  67. 're_mrna' => NULL,
  68. 're_protein' => NULL,
  69. //optional
  70. 'target_organism_id' => NULL,
  71. 'target_type' => NULL,
  72. 'start_line' => NULL,
  73. 'landmark_type' => NULL,
  74. 'alt_id_attr' => NULL,
  75. ];
  76. $hasException = false;
  77. try {
  78. $this->loadLandmarks($analysis, $organism);
  79. // This will produce an exception of duplicate feature ID
  80. $this->runGFFLoader($run_args, $gff_file);
  81. }
  82. catch(\Exception $ex) {
  83. $hasException = true;
  84. }
  85. // We expect an exception to happen so we are looking for a return of true
  86. $this->assertEquals($hasException, true);
  87. }
  88. /**
  89. * Run the GFF loader on small_gene.gff for testing.
  90. *
  91. * This gff has many attributes that we would like to test in the
  92. * testGFFImporterAttribute*() methods.
  93. */
  94. private function initGFFImporterAttributes() {
  95. $gff = ['file_local' => __DIR__ . '/../data/small_gene.gff'];
  96. $fasta = ['file_local' => __DIR__ . '/../data/short_scaffold.fasta'];
  97. $analysis = factory('chado.analysis')->create();
  98. $organism = factory('chado.organism')->create();
  99. $run_args = [
  100. 'analysis_id' => $analysis->analysis_id,
  101. 'organism_id' => $organism->organism_id,
  102. 'use_transaction' => 1,
  103. 'add_only' => 0,
  104. 'update' => 1,
  105. 'create_organism' => 0,
  106. 'create_target' => 0,
  107. ///regexps for mRNA and protein.
  108. 're_mrna' => NULL,
  109. 're_protein' => NULL,
  110. //optional
  111. 'target_organism_id' => $organism->organism_id,
  112. 'target_type' => NULL,
  113. 'start_line' => NULL,
  114. 'landmark_type' => NULL,
  115. 'alt_id_attr' => NULL,
  116. ];
  117. $this->loadLandmarks($analysis, $organism, $fasta);
  118. $this->runGFFLoader($run_args, $gff);
  119. $this->organism = $organism;
  120. $this->analysis = $analysis;
  121. $this->gene_cvt = chado_get_cvterm(array(
  122. 'name' => 'gene',
  123. 'cv_id' => array(
  124. 'name' => 'sequence',
  125. ),
  126. ))->cvterm_id;
  127. $this->mrna_cvt = chado_get_cvterm(array(
  128. 'name' => 'mRNA',
  129. 'cv_id' => array(
  130. 'name' => 'sequence',
  131. ),
  132. ))->cvterm_id;
  133. $this->supercontig_cvt = chado_get_cvterm(array(
  134. 'name' => 'supercontig',
  135. 'cv_id' => array(
  136. 'name' => 'sequence',
  137. ),
  138. ))->cvterm_id;
  139. $this->gene_1_uname = 'test_gene_001';
  140. $this->gene_2_uname = 'test_gene_002';
  141. $this->scaffold_1_uname = 'scaffold1';
  142. }
  143. /**
  144. * Ensures that the feature record is loaded correctly into chado.
  145. *
  146. * @group gff
  147. */
  148. public function testGFFImporterAttributeFeature() {
  149. $this->initGFFImporterAttributes();
  150. $organism = $this->organism;
  151. $query = db_select('chado.feature', 'f')
  152. ->fields('f')
  153. ->condition('uniquename', $this->gene_1_uname)
  154. ->condition('type_id', $this->gene_cvt)
  155. ->execute();
  156. $gene_1 = $query->fetchObject();
  157. $this->assertEquals('test_gene_001', $gene_1->uniquename);
  158. $this->assertEquals('test_gene_001', $gene_1->name);
  159. $this->assertEquals($organism->organism_id, $gene_1->organism_id);
  160. $this->assertEquals($this->gene_cvt, $gene_1->type_id);
  161. }
  162. /**
  163. * Ensures the feature alias is loaded correctly into chado.
  164. *
  165. * @group gff
  166. */
  167. public function testGFFImporterAttributeAlias() {
  168. $this->initGFFImporterAttributes();
  169. $alias = 'first_test_gene';
  170. $gene_1 = db_select('chado.feature', 'f')
  171. ->fields('f')
  172. ->condition('uniquename', $this->gene_1_uname)
  173. ->condition('type_id', $this->gene_cvt)
  174. ->execute()->fetchObject();
  175. $query = db_select('chado.feature_synonym', 'fs');
  176. $query->join('chado.synonym', 's', 's.synonym_id = fs.synonym_id');
  177. $query->fields('s');
  178. $query->condition('fs.feature_id', $gene_1->feature_id);
  179. $query = $query->execute();
  180. $result = $query->fetchObject();
  181. $this->assertEquals($alias, $result->name);
  182. }
  183. /**
  184. * Ensures that the dbxref records are loaded correctly into chado.
  185. *
  186. * @group gff
  187. */
  188. public function testGFFImporterAttributeDbxref() {
  189. $this->initGFFImporterAttributes();
  190. $test_db_name = 'TEST_DB';
  191. $dbx_accession = 'test_gene_dbx_001';
  192. $test_db = chado_get_db(array('name' => $test_db_name));
  193. $gff_db = chado_get_db(array('name' => 'GFF_source'));
  194. $gene_1 = db_select('chado.feature', 'f')
  195. ->fields('f')
  196. ->condition('uniquename', $this->gene_1_uname)
  197. ->condition('type_id', $this->gene_cvt)
  198. ->execute()->fetchObject();
  199. $dbx_query = db_select('chado.feature_dbxref', 'fdbx');
  200. $dbx_query->join('chado.dbxref', 'dbx', 'dbx.dbxref_id = fdbx.dbxref_id');
  201. $dbx_query->fields('dbx');
  202. $dbx_query->condition('fdbx.feature_id', $gene_1->feature_id);
  203. $gff_query = clone $dbx_query;
  204. $dbx_query->condition('dbx.db_id', $test_db->db_id);
  205. $dbx_query = $dbx_query->execute();
  206. $gff_query->condition('dbx.db_id', $gff_db->db_id);
  207. $gff_query = $gff_query->execute();
  208. $dbxref = $dbx_query->fetchObject();
  209. $gff_dbxref = $gff_query->fetchObject();
  210. $this->assertEquals($dbx_accession, $dbxref->accession);
  211. $this->assertEquals($this->gene_1_uname, $gff_dbxref->accession);
  212. }
  213. /**
  214. * Ensures ontology term records loaded correctly into chado.
  215. *
  216. * @group gff
  217. */
  218. public function testGFFImporterAttributeOntology() {
  219. $this->initGFFImporterAttributes();
  220. $ontology_db = 'SO';
  221. $ontology_accession = '0000704';
  222. $gene_1 = db_select('chado.feature', 'f')
  223. ->fields('f')
  224. ->condition('uniquename', $this->gene_1_uname)
  225. ->condition('type_id', $this->gene_cvt)
  226. ->execute()->fetchObject();
  227. $term = chado_get_cvterm(array(
  228. 'dbxref_id' => array(
  229. 'accession' => $ontology_accession,
  230. 'db_id' => array(
  231. 'name' => $ontology_db,
  232. ),
  233. ),
  234. ));
  235. $feature_cvt = db_select('chado.feature_cvterm', 'fcvt')
  236. ->fields('fcvt')
  237. ->condition('cvterm_id', $term->cvterm_id)
  238. ->condition('feature_id', $gene_1->feature_id)
  239. ->execute();
  240. $this->assertEquals(1, $feature_cvt->rowCount());
  241. }
  242. /**
  243. * Ensures feature parent record loaded correctly into chado.
  244. *
  245. * @group gff
  246. */
  247. public function testGFFImporterAttributeParent() {
  248. $this->initGFFImporterAttributes();
  249. $mrna_uname = 'test_mrna_001.1';
  250. $rel_cvt = chado_get_cvterm(array(
  251. 'name' => 'part_of',
  252. 'cv_id' => array(
  253. 'name' => 'sequence',
  254. ),
  255. ))->cvterm_id;
  256. $mrna = db_select('chado.feature', 'f')
  257. ->fields('f')
  258. ->condition('uniquename', $mrna_uname)
  259. ->condition('type_id', $this->mrna_cvt)
  260. ->execute()->fetchObject();
  261. $query = db_select('chado.feature_relationship', 'fr');
  262. $query->join('chado.feature', 'f', 'f.feature_id = fr.object_id');
  263. $query->fields('f');
  264. $query->condition('fr.subject_id', $mrna->feature_id);
  265. $query->condition('fr.type_id', $rel_cvt);
  266. $query = $query->execute();
  267. $parent = $query->fetchObject();
  268. $this->assertEquals('test_gene_001', $parent->uniquename);
  269. $this->assertEquals('test_gene_001', $parent->name);
  270. $this->assertEquals($this->gene_cvt, $parent->type_id);
  271. $this->assertEquals($this->organism->organism_id, $parent->organism_id);
  272. }
  273. /**
  274. * Ensure target record loaded correctly into chado.
  275. *
  276. * @group gff
  277. */
  278. public function testGFFImporterAttributeTarget() {
  279. $this->initGFFImporterAttributes();
  280. $target_feature = 'scaffold1';
  281. $start = 99;
  282. $end = 200;
  283. $target_type = 'supercontig';
  284. $target_cvt = chado_get_cvterm(array(
  285. 'name' => $target_type,
  286. 'cv_id' => array(
  287. 'name' => 'sequence',
  288. ),
  289. ))->cvterm_id;
  290. $source_feature = db_select('chado.feature', 'f')
  291. ->fields('f')
  292. ->condition('uniquename', $target_feature)
  293. ->condition('type_id', $target_cvt)
  294. ->execute()->fetchObject();
  295. $gene_1 = db_select('chado.feature', 'f')
  296. ->fields('f')
  297. ->condition('uniquename', $this->gene_1_uname)
  298. ->condition('type_id', $this->gene_cvt)
  299. ->execute()->fetchObject();
  300. $featureloc = db_select('chado.featureloc', 'fl')
  301. ->fields('fl')
  302. ->condition('fl.feature_id', $gene_1->feature_id)
  303. ->condition('fl.srcfeature_id', $source_feature->feature_id)
  304. ->execute()->fetchObject();
  305. $this->assertEquals($start, $featureloc->fmin);
  306. $this->assertEquals($end, $featureloc->fmax);
  307. }
  308. /**
  309. * Ensure properties loaded correctly into chado.
  310. *
  311. * @group gff
  312. */
  313. public function testGFFImporterAttributeProperty() {
  314. $this->initGFFImporterAttributes();
  315. $gap_1 = 'test_gap_1';
  316. $gap_2 = 'test_gap_2';
  317. $note_val = 'test_gene_001_note';
  318. $gene_1 = db_select('chado.feature', 'f')
  319. ->fields('f')
  320. ->condition('uniquename', $this->gene_1_uname)
  321. ->condition('type_id', $this->gene_cvt)
  322. ->execute()->fetchObject();
  323. $gap_cvt = chado_get_cvterm(array(
  324. 'name' => 'Gap',
  325. 'cv_id' => array(
  326. 'name' => 'feature_property',
  327. ),
  328. ))->cvterm_id;
  329. $note_cvt = chado_get_cvterm(array(
  330. 'name' => 'Note',
  331. 'cv_id' => array(
  332. 'name' => 'feature_property',
  333. ),
  334. ))->cvterm_id;
  335. // Assert gaps loaded correctly
  336. $gaps_query = db_select('chado.featureprop', 'fp')
  337. ->fields('fp')
  338. ->condition('feature_id', $gene_1->feature_id)
  339. ->condition('type_id', $gap_cvt)
  340. ->execute();
  341. while (($gap = $gaps_query->fetchObject())) {
  342. $gaps[$gap->value] = $gap;
  343. }
  344. $this->assertEquals($gap_1, $gaps[$gap_1]->value);
  345. $this->assertEquals(0, $gaps[$gap_1]->rank);
  346. // Assert note loaded correctly
  347. $note = db_select('chado.featureprop', 'fp')
  348. ->fields('fp')
  349. ->condition('feature_id', $gene_1->feature_id)
  350. ->condition('type_id', $note_cvt)
  351. ->execute()->fetchObject();
  352. $this->assertEquals($note_val, $note->value);
  353. $this->assertEquals(0, $note->rank);
  354. }
  355. /**
  356. * Ensure derives from information loaded correctly into chado.
  357. *
  358. * @group gff
  359. */
  360. public function testGFFImporterAttributeDerivesFrom() {
  361. $this->initGFFImporterAttributes();
  362. $gene_2 = db_select('chado.feature', 'f')
  363. ->fields('f')
  364. ->condition('uniquename', $this->gene_2_uname)
  365. ->condition('type_id', $this->gene_cvt)
  366. ->execute()->fetchObject();
  367. $derivesfrom_cvt = chado_get_cvterm(array(
  368. 'name' => 'derives_from',
  369. 'cv_id' => array(
  370. 'name' => 'sequence',
  371. ),
  372. ))->cvterm_id;
  373. $query = db_select('chado.feature', 'f');
  374. $query->join('chado.feature_relationship', 'fr', 'f.feature_id = fr.object_id');
  375. $query->fields('f');
  376. $query->condition('fr.subject_id', $gene_2->feature_id);
  377. $query->condition('fr.type_id', $derivesfrom_cvt);
  378. $query = $query->execute();
  379. $derivesfrom_feature = $query->fetchObject();
  380. $this->assertEquals($this->gene_1_uname, $derivesfrom_feature->uniquename);
  381. $this->assertEquals($this->gene_1_uname, $derivesfrom_feature->name);
  382. $this->assertEquals($this->gene_cvt, $derivesfrom_feature->type_id);
  383. }
  384. /**
  385. * Ensure FASTA information loaded correctly into chado.
  386. *
  387. * @group gff
  388. */
  389. public function testGFFImporterAttributeFastas() {
  390. $this->initGFFImporterAttributes();
  391. $scaffold = db_select('chado.feature', 'f')
  392. ->fields('f')
  393. ->condition('uniquename', $this->scaffold_1_uname)
  394. ->condition('type_id', $this->supercontig_cvt)
  395. ->execute()->fetchObject();
  396. $this->assertEquals(720, $scaffold->seqlen);
  397. $this->assertEquals(720, strlen($scaffold->residues));
  398. $this->assertEquals('83578d8afdaec399c682aa6c0ddd29c9', $scaffold->md5checksum);
  399. }
  400. /**
  401. * Test that when checked, explicit proteins are created when specified within
  402. * the GFF file. Explicit proteins will not respect the skip_protein argument
  403. * and will therefore be added to the database.
  404. *
  405. * @group gff
  406. * @ticket 77
  407. *
  408. */
  409. public function testGFFPolypeptide() {
  410. $gff_file = ['file_local' => __DIR__ . '/../data/simpleGFF.gff'];
  411. $analysis = factory('chado.analysis')->create();
  412. $organism = factory('chado.organism')->create();
  413. $run_args = [
  414. // The new argument
  415. 'skip_protein' => 1,
  416. 'analysis_id' => $analysis->analysis_id,
  417. 'organism_id' => $organism->organism_id,
  418. 'use_transaction' => 1,
  419. 'add_only' => 0,
  420. 'update' => 1,
  421. 'create_organism' => 0,
  422. 'create_target' => 0,
  423. // regexps for mRNA and protein.
  424. 're_mrna' => NULL,
  425. 're_protein' => NULL,
  426. // optional
  427. 'target_organism_id' => NULL,
  428. 'target_type' => NULL,
  429. 'start_line' => NULL,
  430. 'landmark_type' => NULL,
  431. 'alt_id_attr' => NULL,
  432. ];
  433. $this->loadLandmarks($analysis, $organism);
  434. $this->runGFFLoader($run_args, $gff_file);
  435. $identifier = [
  436. 'cv_id' => ['name' => 'sequence'],
  437. 'name' => 'polypeptide',
  438. ];
  439. $protein_type_id = tripal_get_cvterm($identifier);
  440. $name = 'FRAEX38873_v2_000000010.1.3_test_protein';
  441. $query = db_select('chado.feature', 'f')
  442. ->fields('f', ['uniquename'])
  443. ->condition('f.uniquename', $name)
  444. ->condition('f.type_id', $protein_type_id->cvterm_id)
  445. ->execute()
  446. ->fetchAll();
  447. $this->assertEquals(1, count($query));
  448. }
  449. /**
  450. * Add a skip protein option. Test that when checked, implicit proteins are
  451. * not created, but that they are created when unchecked.
  452. *
  453. * @group gff
  454. * @ticket 77
  455. *
  456. */
  457. public function testGFFNoProteinOption() {
  458. $gff_file = ['file_local' => __DIR__ . '/../data/gff_protein_generation.gff'];
  459. $analysis = factory('chado.analysis')->create();
  460. $organism = factory('chado.organism')->create();
  461. $run_args = [
  462. //Skip protein feature generation
  463. 'skip_protein' => 1,
  464. 'analysis_id' => $analysis->analysis_id,
  465. 'organism_id' => $organism->organism_id,
  466. 'use_transaction' => 1,
  467. 'add_only' => 0,
  468. 'update' => 1,
  469. 'create_organism' => 0,
  470. 'create_target' => 0,
  471. ///regexps for mRNA and protein.
  472. 're_mrna' => NULL,
  473. 're_protein' => NULL,
  474. //optional
  475. 'target_organism_id' => NULL,
  476. 'target_type' => NULL,
  477. 'start_line' => NULL,
  478. 'landmark_type' => NULL,
  479. 'alt_id_attr' => NULL,
  480. ];
  481. $this->loadLandmarks($analysis, $organism);
  482. $this->runGFFLoader($run_args, $gff_file);
  483. $identifier = [
  484. 'cv_id' => ['name' => 'sequence'],
  485. 'name' => 'polypeptide',
  486. ];
  487. $protein_type_id = tripal_get_cvterm($identifier);
  488. $name = "FRAEX38873_v2_000000190.1-protein";
  489. $results = db_select('chado.feature', 'f')
  490. ->fields('f', ['uniquename'])
  491. ->condition('f.uniquename', $name)
  492. ->condition('f.type_id', $protein_type_id->cvterm_id)
  493. ->execute()
  494. ->fetchAll();
  495. // There should be no proteins since we used the skip_proteins flag and no
  496. // explicit proteins were specified in the test file
  497. $this->assertEquals(0, count($results));
  498. // Now perform a unit test where we do not skip proteins generation
  499. $run_args['skip_protein'] = 0;
  500. $this->runGFFLoader($run_args, $gff_file);
  501. $query = db_select('chado.feature', 'f')
  502. ->fields('f', ['uniquename'])
  503. ->condition('f.uniquename', $name)
  504. ->condition('f.type_id', $protein_type_id->cvterm_id)
  505. ->execute()
  506. ->fetchObject();
  507. $this->assertEquals($name, $query->uniquename);
  508. }
  509. /**
  510. * The GFF importer should still create explicitly defined proteins if
  511. * skip_protein is true.
  512. *
  513. * @group gff
  514. * @ticket 77
  515. */
  516. public function testGFFImporterLoadsExplicitProteins() {
  517. $gff_file = ['file_local' => __DIR__ . '/../data/simpleGFF.gff'];
  518. $analysis = factory('chado.analysis')->create();
  519. $organism = factory('chado.organism')->create();
  520. $run_args = [
  521. //The new argument
  522. 'skip_protein' => 1,
  523. ///
  524. 'analysis_id' => $analysis->analysis_id,
  525. 'organism_id' => $organism->organism_id,
  526. 'use_transaction' => 1,
  527. 'add_only' => 0,
  528. 'update' => 1,
  529. 'create_organism' => 0,
  530. 'create_target' => 0,
  531. ///regexps for mRNA and protein.
  532. 're_mrna' => NULL,
  533. 're_protein' => NULL,
  534. //optional
  535. 'target_organism_id' => NULL,
  536. 'target_type' => NULL,
  537. 'start_line' => NULL,
  538. 'landmark_type' => NULL,
  539. 'alt_id_attr' => NULL,
  540. ];
  541. $this->loadLandmarks($analysis, $organism);
  542. $this->runGFFLoader($run_args, $gff_file);
  543. $name = 'FRAEX38873_v2_000000010.1.3_test_protein';
  544. $query = db_select('chado.feature', 'f')
  545. ->fields('f', ['uniquename'])
  546. ->condition('f.uniquename', $name)
  547. ->execute()
  548. ->fetchField();
  549. $this->assertEquals($name, $query);
  550. }
  551. private function runGFFLoader($run_args, $file) {
  552. // silent(function ($run_args, $file) {
  553. module_load_include('inc', 'tripal_chado', 'includes/TripalImporter/GFF3Importer');
  554. $importer = new \GFF3Importer();
  555. $importer->create($run_args, $file);
  556. $importer->prepareFiles();
  557. $importer->run();
  558. // });
  559. }
  560. private function loadLandmarks($analysis, $organism, $landmark_file = array()) {
  561. if (empty($landmark_file)) {
  562. $landmark_file = ['file_local' => __DIR__ . '/../data/empty_landmarks.fasta'];
  563. }
  564. $run_args = [
  565. 'organism_id' => $organism->organism_id,
  566. 'analysis_id' => $analysis->analysis_id,
  567. 'seqtype' => 'supercontig',
  568. 'method' => 2, //default insert and update
  569. 'match_type' => 1, //unique name default
  570. //optional
  571. 're_name' => NULL,
  572. 're_uname' => NULL,
  573. 're_accession' => NULL,
  574. 'db_id' => NULL,
  575. 'rel_type' => NULL,
  576. 're_subject' => NULL,
  577. 'parent_type' => NULL,
  578. ];
  579. module_load_include('inc', 'tripal_chado', 'includes/TripalImporter/FASTAImporter');
  580. //silent(function ($run_args, $landmark_file) {
  581. $importer = new \FASTAImporter();
  582. $importer->create($run_args, $landmark_file);
  583. $importer->prepareFiles();
  584. $importer->run();
  585. // });
  586. }
  587. }