Guest User

Untitled

a guest
Oct 23rd, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. unless (open FILE, "<", '/scratch/SampleDataFiles/test.fasta') {
  2. die "Cannot Open File", $!;
  3. }
  4.  
  5. $/ = ">";
  6.  
  7. my @file = <FILE>;
  8. my $file = "@file";
  9. chomp $file;
  10.  
  11. my $count = 0;
  12. my $sequence_count = 0;
  13.  
  14. foreach $file (@file) {
  15.  
  16. if ($file =~ /(.*;.*;?n)(w+)/) {
  17.  
  18. my $head = $1;
  19. my $sequence = $2;
  20. $sequence_count = $sequence_count +1;
  21.  
  22. if ($sequence =~ /([VILMFWCA]{8,}?)/i) {
  23.  
  24. print "n", "Hydrophobic region(s) found in ", $head, "n";
  25. $count = $count +1;
  26.  
  27. }
  28.  
  29.  
  30. while ($sequence =~ /([VILMFWCA]{8,}?)/gi) {
  31.  
  32. my $pos = pos($sequence)-7;
  33. print $1, " found at ", $pos, "n", "n";
  34.  
  35. }
  36. }
  37. }
  38.  
  39.  
  40. print "n", "n", "-------------------------", "n", "Hydrophobic region(s)
  41. found in ", $count, " out of ", $sequence_count , " sequences.", "n", "n";
  42.  
  43.  
  44.  
  45. close FILE;
Add Comment
Please, Sign In to add comment