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: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123:
<?php
namespace DispatchModule\Models;
class CppredictModel extends \BaseModule\Models\BaseModel {
protected $cpRoot;
protected $tempDir;
protected $templates;
protected $tmap;
protected $defaultPredictionSettings;
private $logFile;
private $debug;
public function logRecord($message) {
if ($this->debug) {
$this->logFile->appendContent(time() . ' : CppredictModel : ' . $message . "\n");
}
}
public function __construct($debug = -1) {
if ($debug === -1) {
$this->debug = \Nette\Diagnostics\Debugger::isEnabled();
} else {
$this->debug = $debug;
}
$this->cpRoot = CPPREDICT_TOOLDIR . 'cp_root/';
$this->tempDir = TEMP_PATH . '/cppredict/';
$this->templates = 'template-selection.aln';
$this->tmap = 'tmap.csv';
$this->defaultPredictionSettings = ' -p -w 10 -g 0.15 --disregard_ends';
$this->logFile = new \BaseModule\Models\FileModel('files/cppredict/cppredict_tool.log');
$dummyCommand = $this->buildCommand('someInput');
$this->logRecord(' Built model with command ' . $dummyCommand);
}
public function buildCommand($inputSeqFasta) {
$this->logRecord('Constructing command for input: ' . $inputSeqFasta);
$command = 'cp_predict.py -r ' . $this->cpRoot;
$command = $command . ' -t ' . $this->templates;
$command = $command . ' -m ' . $this->tmap;
$command = $command . $this->defaultPredictionSettings;
$command = $command . ' --tmp_dir ' . $this->tempDir;
$command = $command . ' -i ' . $inputSeqFasta;
if ($this->debug) {
$command = $command . ' -v 2>>' . $this->logFile->getFile();
}
$this->logRecord('Constructed command: ' . $command);
return $command;
}
}