1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45:
<?php
namespace AnalyseModule\Models;
class BaseTool extends \BaseModule\Services\BaseService {
protected function loadSequencesFromDb($accessions) {
$accClear = array();
$starts = array();
$stops = array();
foreach ($accessions as $i => $acc) {
$accRecord = explode(':', $acc);
$accClear[] = $accRecord[0];
$stops[] = $accRecord[2];
$starts[] = $accRecord[2];
}
$dbTool = new \DispatchModule\Tools\DbTool($this->container);
for ($i = 1; $i < count($accClear); $i++) {
$dbTool->completeData['db_accession_array'][] = $accClear[$i];
}
$dbTool->addCriteria('accession', $accClear[0]);
$result = $dbTool->execute();
$sequences = $result->data;
foreach ($sequences as $i => $sequence) {
$key = array_search($sequence->accession, $accClear);
if ($sequence->startPosition != $starts[$key] && $sequence->stopPosition != $stops[$key]) {
unset($sequences[$i]);
}
}
return $sequences;
}
}