function tripal_cv_load_obo_v1_2_url
2.x tripal_cv.obo_loader.inc | tripal_cv_load_obo_v1_2_url($obo_name, $url, $jobid = NULL, $is_new = TRUE) |
1.x obo_loader.inc | tripal_cv_load_obo_v1_2_url($obo_name, $url, $jobid = NULL, $is_new = TRUE) |
Related topics
1 call to tripal_cv_load_obo_v1_2_url()
- tripal_cv_load_obo_v1_2_id in tripal_cv/
includes/ obo_loader.inc
File
- tripal_cv/
includes/ obo_loader.inc, line 216 - Tripal Ontology Loader
Code
function tripal_cv_load_obo_v1_2_url($obo_name, $url, $jobid = NULL, $is_new = TRUE) {
$newcvs = array();
// first download the OBO
$temp = tempnam(sys_get_temp_dir(), 'obo_');
print "Downloading URL $url, saving to $temp\n";
$url_fh = fopen($url, "r");
$obo_fh = fopen($temp, "w");
if (!$url_fh) {
tripal_cv_obo_quiterror("Unable to download the remote OBO file at $url. Could a firewall be blocking outgoing connections? " .
" if you are unable to download the file you may manually downlod the OBO file and use the web interface to " .
" specify the location of the file on your server.");
}
while (!feof($url_fh)) {
fwrite($obo_fh, fread($url_fh, 255), 255);
}
fclose($url_fh);
fclose($obo_fh);
// second, parse the OBO
tripal_cv_load_obo_v1_2($temp, $jobid, $newcvs);
// now remove the temp file
unlink($temp);
if ($is_new) {
tripal_cv_add_obo_ref($obo_name, $url);
}
// update the cvtermpath table
tripal_cv_load_update_cvtermpath($newcvs, $jobid);
print "Done\n";
}