-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclassifyChecker.pl
executable file
·61 lines (61 loc) · 1.53 KB
/
classifyChecker.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
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/perl -w
use strict;
#sed -e '/^atha|Viridiplantae/ s/atha|/atha|Viridiplantae|/ ; s/atha|Viridiplantae/atha|Viridiplantae/' FastasAnnot/*.fasta | grep 'atha'
my $dir = $ARGV[0];
chomp $dir;
my @headers = `grep -h '>' $dir/*`;
my %homeobox = ();
my %spec = ();
foreach my $header (@headers) {
chomp $header;
my $spec = "";
my $kingdom = "";
my $family = "";
my $class = "";
my $HG = "";
my $uid = "";
if ($header =~ /\|.*\|.*\|.*\|.*\|/) {
($spec,$kingdom,$family,$class,$HG,$uid) = split /\|/, $header;
$spec =~ s/^>//;
if ($family eq $class) {
my ($Class,$Family,$cm,$End) = split /,/, `grep -i '$family' HomeoDBClass.csv`;
if ($Class) {
#$homeobox{"$class|$family"} = "$Class|$Family";
}
else {
$homeobox{"$class|$family"} = "$class|$family";
}
}
}
else {
unless ($header !~ /\|/) {
($spec,$family,$class,$HG,$uid) = split /\|/, $header;
$spec =~ s/^>//;
$spec = lc $spec;
my $groups = `grep '$spec' phylogenyTable.csv`;
my @groups = split /,/, $groups;
$kingdom = $groups[6];
$kingdom =~ s{\/}{-}g;
$spec{$spec} = "$spec|$kingdom";
if ($family eq $class) {
my ($Class,$Family,$cm,$End) = split /,/, `grep -i '$family' HomeoDBClass.csv`;
if ($Class) {
$homeobox{"$class|$family"} = "$Class|$Family";
}
}
}
}
}
foreach my $orig ( sort keys %homeobox ) {
my $new = $homeobox{$orig};
chomp $orig;
chomp $new;
print "$orig -> $new\n";
}
foreach my $orig ( sort keys %spec ) {
my $new = $spec{$orig};
chomp $orig;
chomp $new;
print "$orig -> $new\n";
}
exit;