Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions api/tripal_analysis_blast.api.inc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function tripal_get_feature_blast_results($feature_id, $db_id = NULL) {

$analysis = chado_generate_var('analysis', array('analysis_id' => $analysisfeature[0]->analysis_id));
$analysis_id = $analysis->analysis_id;
$adb_id = NULL;

// Get the blast_hit_data record for this analysis feature. For Tripal v3
// all blast files imported will use this table. Previously it was optional.
Expand Down Expand Up @@ -80,7 +81,9 @@ function tripal_get_feature_blast_results($feature_id, $db_id = NULL) {
// database id
else {
$blastdb = chado_get_property(array('table'=> 'analysis', 'id' => $analysis_id), array('type_name' => 'analysis_blast_blastdb', 'cv_name' => 'tripal'));
$adb_id = $blastdb->value;
if ($blastdb) {
$adb_id = $blastdb->value;
}
}
}

Expand All @@ -93,19 +96,20 @@ function tripal_get_feature_blast_results($feature_id, $db_id = NULL) {
continue;
}

// get the database
// analysis db will be null if no blast hits for this feature
if ($adb_id) {
// get the database
$db_arr = chado_select_record('db', array('*'), array('db_id' => $adb_id));
$db = $db_arr[0];
}

// parse the XML and add it to the array of blast results to be returned
module_load_include('inc', 'tripal_analysis_blast', 'includes/TripalImporter/BlastImporter');
$importer = new BlastImporter();
$blast_obj =$importer->getResultObject($blast_xml, $db, $feature_id, $analysis);
$blast_obj->analysis = $analysis;
$blast_obj_array [$blast_obj_counter] = $blast_obj;
$blast_obj_counter ++;
// parse the XML and add it to the array of blast results to be returned
module_load_include('inc', 'tripal_analysis_blast', 'includes/TripalImporter/BlastImporter');
$importer = new BlastImporter();
$blast_obj =$importer->getResultObject($blast_xml, $db, $feature_id, $analysis);
$blast_obj->analysis = $analysis;
$blast_obj_array [$blast_obj_counter] = $blast_obj;
$blast_obj_counter ++;
}
}

return $blast_obj_array;
Expand Down