/**
  * 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;
 }
Пример #2
0
 /**
  * 
  * @param VIB\Bundle\BioFormatsBundle\FileFormat\Interfaces\SequenceFile $sequenceFile
  */
 public function __construct(SequenceFile $sequenceFile)
 {
     $this->sequenceFile = $sequenceFile;
     $this->iterator = new \ArrayIterator($this->sequenceFile->getSequenceIndex());
 }