public function search(SearchParametersInterface $parameters)
    {
        if (! is_a($parameters, 'pgb_liv\php_ms\Search\Parameters\MsgfPlusSearchParameters')) {
            throw new \InvalidArgumentException('Argument 1 expected to be of type MsgfPlusSearchParameters');
        }
        
        if (is_null($parameters->getSpectraPath()) || ! file_exists($parameters->getSpectraPath())) {
            throw new \InvalidArgumentException('Valid Spectra file must be specified in paramaters.');
        }
        
        if (is_null($parameters->getDatabases()) || ! file_exists($parameters->getDatabases())) {
            throw new \InvalidArgumentException('Valid database file must be specified in paramaters.');
        }
        
        $command = $this->getCommand($parameters);
        
        $this->executeCommand($command);
        
        if (! is_null($parameters->getOutputFile())) {
            return $parameters->getOutputFile();
        } else {
            $extensionPos = strrpos($parameters->getSpectraPath(), '.');
            return substr($parameters->getSpectraPath(), 0, $extensionPos) . '.mzid';
        }
    }