-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRegEx_Motif_finder.pl
51 lines (35 loc) · 1.1 KB
/
RegEx_Motif_finder.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/perl
opendir (DIR, "/home/folder/folder1"); #This folder holds the genomes (fasta)
open (d, ">/home/folder/file1.txt");
my @files= readdir (DIR);
$howmanyfiles=@files;
$howmanygenomes=$howmanyfiles-2;
closedir(DIR);
open (LIST, ">/home/folder/"."file2.txt");
foreach my $file(@files)
{
next if $file=~ /^\.\.?$/;
next if -d $file;
print d "$file\n";
open (TXTFILE, "/home/folder/folder1/".$file);
open (CHS, ">>/home/folder/Sequences.txt");
$a= "";
$b= "";
while ($a= <TXTFILE>)
{
chop ($a);
$b=$b.$a;
}
my $sec=$b;
my @CHS=$sec=~ m/>[^>]*Q..EY[A-Z]*EDR.L[A-Z]*Q.RRW[^>]*/gi; #The Regular expression
my $CHSN=@CHS; #prints on screen results
print FULL_LIST "\n$file"."\tCHS found:"."\t$CHSN";
print "\nGenome "."$file"." done."."\tCHS found:"."\t$CHSN";
while ($a!=$CHSN)
{
print CHS "$CHS[$a]\n";
$a=$a+1;
}
close(TXTFILE);
}
print "\nProcessing "."$howmanygenomes"." Genome files."." Wait for ALL Genomes to finish\n"; #prints on screen progress