/** * Set sequence * * @param VIB\Bundle\BioBundle\Entity\DNA\Abstracts\Sequence $sequence * @param boolean $recurse */ public function setSequence(Sequence $sequence, $recurse = true) { if ($recurse === true) { if ($sequence != null) { $sequence->addFeature($this, false); } elseif ($this->sequence != null) { $this->sequence->removeFeature($this, false); } } $this->sequence = $sequence; }
/** * Parse the string containing FastA header * * @param string $line * @param VIB\Bundle\BioBundle\Entity\DNA\Abstracts\Sequence $sequence */ protected function parseFastAHeader($line, AbstractSequence $sequence) { $match = array(); if (preg_match("/^>(\\S+)(.*)\$/", $line, $match) === 1) { $name = rawurldecode(trim($match[1])); if (strlen($name) > 0) { $sequence->setName($name); } else { throw new FileFormatException("Sequence name is empty."); } $description = trim($match[2]); if (strlen($description) > 0) { $sequence->setDescription($description); } } }