/** * 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; }
/** * Unset an offset. * * @param mixed $offset */ public function offsetUnset($offset) { return $this->sequenceFile->deleteSequence($offset); }