Zoc

Untitled

Zoc
Nov 25th, 2011
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. <?php
  2. // Configurações
  3. $filename = "seq.fas";
  4.  
  5.  
  6. ////////////////////////////////////////////////////////////////
  7. // Não mexa daqui em diante! :)
  8. ////////////////////////////////////////////////////////////////
  9. $report = array();
  10. $outFile = "";
  11.  
  12. // Lê arquivo
  13. $filedata = file_get_contents( $filename );
  14.  
  15. // Separa em linhas
  16. $line = explode("\n", $filedata);
  17.  
  18. // Pega numero de linhas
  19. $numLines = count( $line );
  20.  
  21. // Realiza o parsing
  22. for( $i = 0; $i < $numLines; $i++ )
  23. {
  24.     $matches = "";
  25.    
  26.     if ( preg_match( '/\#(.+) : _(.+)_ \(.+\) : MITOCHONDRION/', $line[ $i ], $matches ) )
  27.     {
  28.         $report[ $match[0] ] = preg_replace( "/ /", "_", $match[1] );
  29.     }
  30.     else if ( preg_match( '/>(.+)\((.+)\)/', $line[ $i ], $matches ) )
  31.     {
  32.         $outFile = $match[1].".fasta";
  33.     }
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment