/** * Extract a slice of $length sequences starting at position $offset from the Collection. * * If $length is null it returns all sequences from $offset to the end of the Collection. * Keys have to be preserved by this method. Calling this method will only return the * selected slice and NOT change the sequences contained in the collection slice is called on. * * @param int $offset * @param int $length * @return array */ public function slice($offset, $length = null) { $sequences = array(); $index = array_slice($this->sequenceFile->getSequenceIndex(), $offset, $length, true); foreach ($index as $indexEntry => $value) { $sequences[$indexEntry] = $this->sequenceFile->readSequence($indexEntry); } return $sequences; }
/** * Return the sequence at specified offset. * * @param mixed $offset * @return VIB\Bundle\BioBundle\Entity\DNA\Abstracts\Sequence */ public function offsetGet($offset) { return $this->sequenceFile->readSequence($offset); }