/**
  * @Route("/")
  * @Route("/hello/{name}")
  * @Template()
  */
 public function indexAction($name = "guest")
 {
     $fasta_in = new FastAFile(new \SplFileObject("/tmp/dmel-all-chromosome-r5.47.fasta"));
     $fasta_out = new FastAFile(new \SplFileObject("/tmp/test-output.fasta"));
     foreach ($fasta_out->getSequences() as $sequence) {
         $fasta_out->removeSequence($sequence);
     }
     foreach ($fasta_in->getSequences() as $sequence) {
         $fasta_out->addSequence($sequence);
     }
     $fasta_out->save();
     return array();
 }
Example #2
0
 /**
  * {@inheritDoc}
  */
 public function readFile()
 {
     $file = $this->getWorkingFile();
     if ($file == null) {
         $this->fileValid = false;
         return false;
     }
     $sequencesRead = 0;
     while (!$file->eof()) {
         $line = trim($file->current());
         if (strlen($line) > 0) {
             if (substr($line, 0, 7) == "##FASTA") {
                 $file->next();
                 parent::readFile();
             } elseif ($line[0] != "#") {
                 $feature = $this->parseFeature($line);
                 if ($feature instanceof GFFFeature) {
                     $this->features[] = $feature;
                 } elseif ($feature !== null) {
                     $this->fileValid = false;
                     return false;
                 }
             }
         }
         $file->next();
     }
     $this->fileRead = true;
     return $sequencesRead;
 }