{"action":"created","issue":{"url":"https://api.github.com/repos/tripal/tripal/issues/290","repository_url":"https://api.github.com/repos/tripal/tripal","labels_url":"https://api.github.com/repos/tripal/tripal/issues/290/labels{/name}","comments_url":"https://api.github.com/repos/tripal/tripal/issues/290/comments","events_url":"https://api.github.com/repos/tripal/tripal/issues/290/events","html_url":"https://github.com/tripal/tripal/issues/290","id":297141386,"number":290,"title":"newick tree loader db issue","user":{"login":"bradfordcondon","id":7063154,"avatar_url":"https://avatars2.githubusercontent.com/u/7063154?v=4","gravatar_id":"","url":"https://api.github.com/users/bradfordcondon","html_url":"https://github.com/bradfordcondon","followers_url":"https://api.github.com/users/bradfordcondon/followers","following_url":"https://api.github.com/users/bradfordcondon/following{/other_user}","gists_url":"https://api.github.com/users/bradfordcondon/gists{/gist_id}","starred_url":"https://api.github.com/users/bradfordcondon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradfordcondon/subscriptions","organizations_url":"https://api.github.com/users/bradfordcondon/orgs","repos_url":"https://api.github.com/users/bradfordcondon/repos","events_url":"https://api.github.com/users/bradfordcondon/events{/privacy}","received_events_url":"https://api.github.com/users/bradfordcondon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-14T15:40:03Z","updated_at":"2018-02-14T15:49:07Z","closed_at":null,"author_association":"MEMBER","body":"### System information\r\n\r\n* Tripal Version: 3 \r\n* Drupal Version: 7.56\r\n* PostgreSQL Version: 9.6.1 \r\n* PHP Version: 7.1.7\r\n\r\n\r\n### Issue description\r\n\r\nTwo issues:\r\n\r\n#### Loader doesnt allow missing accessions despite saying it does\r\n\r\nThe loader reads:\r\n\r\n>Enter a database cross-reference of the form [DB name]:[accession]. The database name must already exist in the database. If the accession does not exist it is automatically added.\r\n\r\n\r\nHowever, attempting to insert a tree with an accession not in the db fails validation:\r\n`The dbxref provided does not exist in the database: .`\r\n\r\n\r\nI think this is because of the below code (line 193, `tripal_chado.phylotree.api.inc`:\r\n\r\n```\r\n $db_name = $matches[1];\r\n    $accession = $matches[2];\r\n    $values = array(\r\n     'accession' => $accession,\r\n      'db_id' => array(\r\n        'name' => $db_name\r\n      ),\r\n    );\r\n    $dbxref = chado_generate_var('dbxref', $values);\r\n    \r\n    if (!$dbxref) {\r\n      $errors['dbxref'] = t('The dbxref provided does not exist in the database: %dbxref.', array('%dbxref' => $dbxref));\r\n      return FALSE;\r\n    }\r\n    $options['dbxref_id'] = $dbxref->dbxref_id;\r\n  }\r\n```\r\nI get confused by chado_generate_var but i can fix this... inserting the term beforehand resolves the issue.\r\n\r\n#### Loader can't bulk load\r\n\r\nThis is the bigger issue.  It really needs to be able to load in mutliple newick trees.  It also needs to be able to assign those trees to accessions in bulk: that part is trickier, unless the name of the tree is the accession.\r\n\r\nAnthony has developed this feature for his chado_python module so I'll likely try to adopt that, but i imagine this will be a desired feature for other adopters.\r\n"},"comment":{"url":"https://api.github.com/repos/tripal/tripal/issues/comments/365649176","html_url":"https://github.com/tripal/tripal/issues/290#issuecomment-365649176","issue_url":"https://api.github.com/repos/tripal/tripal/issues/290","id":365649176,"user":{"login":"bradfordcondon","id":7063154,"avatar_url":"https://avatars2.githubusercontent.com/u/7063154?v=4","gravatar_id":"","url":"https://api.github.com/users/bradfordcondon","html_url":"https://github.com/bradfordcondon","followers_url":"https://api.github.com/users/bradfordcondon/followers","following_url":"https://api.github.com/users/bradfordcondon/following{/other_user}","gists_url":"https://api.github.com/users/bradfordcondon/gists{/gist_id}","starred_url":"https://api.github.com/users/bradfordcondon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradfordcondon/subscriptions","organizations_url":"https://api.github.com/users/bradfordcondon/orgs","repos_url":"https://api.github.com/users/bradfordcondon/repos","events_url":"https://api.github.com/users/bradfordcondon/events{/privacy}","received_events_url":"https://api.github.com/users/bradfordcondon/received_events","type":"User","site_admin":false},"created_at":"2018-02-14T15:49:07Z","updated_at":"2018-02-14T15:49:07Z","author_association":"MEMBER","body":"shoot: inserting the term beforehand passes validation, but fails in the load step with \r\n\r\n```\r\n\r\nSQLSTATE[23502]: Not null violation: 7 ERROR:  null value in column \"dbxref_id\" violates not-null constraint\r\nDETAIL:  Failing row contains (4, null, , 531, null, null).\r\nWD tripal_job: SQLSTATE[23502]: Not null violation: 7 ERROR:  null value in column \"dbxref_id\" violates not-null constraint     [error]\r\nDETAIL:  Failing row contains (4, null, , 531, null, null).\r\n[site http://default] [TRIPAL ERROR] [TRIPAL_JOB] SQLSTATE[23502]: Not null violation: 7 ERROR:  null value in column \"dbxref_id\" violates not-null constraintDETAIL:  Failing row contains (4, null, , 531, null, null).\r\n\r\n```"}}
{"actor":{"display_login":"bradfordcondon"}}