Don't like ads? PRO users don't see any ads ;-)

Max_FASTA

By: glykos on May 4th, 2012  |  syntax: Perl  |  size: 0.42 KB  |  hits: 34  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/usr/bin/perl -w
  2.  
  3. $/ = '>';
  4. $max = 0;
  5.  
  6. while ( $in = <STDIN> )
  7.   {
  8.     if ( $in =~ /.*?\|pdb\|(.*?)\|.*?\n([^>]*)/ )
  9.       {
  10.         $code = $1;
  11.         $seq = $2;
  12.         $seq =~ s/\n//g;
  13.         if ( length( $seq ) > $max )
  14.           {
  15.             $maxcode = $code;
  16.             $max = length( $seq );
  17.           }
  18.        
  19.       }
  20.  
  21.   }
  22.      
  23. print "Max length was $max for $maxcode\n";
  24.  
  25. exit();