function tripal_cv_obo_load_typedefs
2.x tripal_cv.obo_loader.inc | tripal_cv_obo_load_typedefs($defaultcv, $newcvs, $default_db, $jobid) |
1.x obo_loader.inc | tripal_cv_obo_load_typedefs($defaultcv, $newcvs, $default_db, $jobid) |
1 call to tripal_cv_obo_load_typedefs()
- tripal_cv_load_obo_v1_2 in tripal_cv/
includes/ obo_loader.inc
File
- tripal_cv/
includes/ obo_loader.inc, line 352 - Tripal Ontology Loader
Code
function tripal_cv_obo_load_typedefs($defaultcv, $newcvs, $default_db, $jobid) {
$sql = "
SELECT *
FROM tripal_obo_temp
WHERE type = 'Typedef'
";
$typedefs = chado_query($sql);
$sql = "
SELECT count(*) as num_terms
FROM tripal_obo_temp
WHERE type = 'Typedef'
";
$result = db_fetch_object(chado_query($sql));
$count = $result->num_terms;
// calculate the interval for updates
$interval = intval($count * 0.0001);
if ($interval < 1) {
$interval = 1;
}
$i = 0;
while ($typedef = db_fetch_object($typedefs)) {
$term = unserialize(base64_decode($typedef->stanza));
// update the job status every interval
if ($jobid and $i % $interval == 0) {
$complete = ($i / $count) * 33.33333333;
tripal_job_set_progress($jobid, intval($complete + 33.33333333));
printf("%d of %d records. (%0.2f%%) Memory: %s bytes\r", $i, $count, $complete * 3, number_format(memory_get_usage()));
}
tripal_cv_obo_process_term($term, $defaultcv->name, 1, $newcvs, $default_db);
$i++;
}
// set the final status
if ($jobid) {
if ($count > 0) {
$complete = ($i / $count) * 33.33333333;
}
else {
$complete = 33.33333333;
}
tripal_job_set_progress($jobid, intval($complete + 33.33333333));
printf("%d of %d records. (%0.2f%%) Memory: %s bytes\r", $i, $count, $complete * 3, number_format(memory_get_usage()));
}
return 1;
}