-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfp-group-presentation.pl
More file actions
executable file
·59 lines (43 loc) · 1.13 KB
/
fp-group-presentation.pl
File metadata and controls
executable file
·59 lines (43 loc) · 1.13 KB
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
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
my $dbh = DBI->connect("dbi:Pg:dbname=researchdata_test", '', '', {AutoCommit => 0});
my $sth = $dbh->prepare("UPDATE complexes SET fundamental = (?) WHERE signature = (?);");
my $stt = $dbh->prepare("UPDATE complexes SET fundamental = (?) WHERE type = (SELECT type FROM complexes WHERE signature = (?) AND type <> '' );");
my $sig = shift;
my $basedir = "../../researchdata";
open(my $fh, "<", "$basedir/fundamentalgroups_simp/$sig");
my $repr = <$fh>;
$repr =~ m/Group\( \[ (.*) \] \)\[ (.*) \]/;
my $group = "< | >";
if (defined $1) {
my @gens = split(/, /, $1);
my $expr = $2;
my $letter = "a";
my $gen = "";
foreach (@gens) {
$expr =~ s/$_/$letter/g;
$gen .= "$letter,";
$letter++;
}
$gen =~ s/,$//;
$expr =~ s/\*//g;
$group = "< $gen | $expr >";
}
if ($group eq "< | >") {
$group = "0";
}
if ($group eq "< a | >") {
$group = "Z";
}
if ($group eq "< a b | >") {
$group = "Z*Z";
}
$sth->execute($group,$sig);
$stt->execute($group,$sig);
$dbh->commit;
if (! -d "$basedir/groups/$group" ) {
`mkdir -p "$basedir/groups/$group"`;
}
`touch "$basedir/groups/$group/$sig"`;