3 Einträge, 1 Seite |
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
############ erstes file schreiben: ###############
my $outfile1 = "$Table Alignment.txt";
unless (open(ALNTXT, "> /www/modperldocs/bioinf/data/$outfile1") ) {
print "Cannot open file \"$outfile1\" to write to!!\n\n";
exit;
}
$dbh = DBI->connect("DBI:mysql:database", $DBUSER,$DBPASS);
$sth = $dbh->prepare("USE $Table;");
$sth->execute();
$sth = $dbh->prepare("SELECT Id, Origin, Sequence FROM $Table;");
$sth->execute();
while (my ($Nr, $Name, $AS) = $sth->fetchrow_array()) {
chomp($AS);
format ALNTXT =
>@<<<<<<<<<<<<<<<<<<<<<&
lt;<<<<<<<<<<<<<<<
$Nr
@<<<<<<<<<<<<<<<<<<<<<<&
lt;<<<<<<<<<<<<<<<<<<<<<<;
$AS
.
write(ALNTXT);
}
close "/www/modperldocs/bioinf/data/$outfile1";
$sth->finish;
$dbh->disconnect;
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
##########################################
my $outfile2 = "$Table Primer.txt";
unless (open(PTXT,"> /www/modperldocs/bioinf/data/$outfile2") ) {
print "Cannot open file \"$outfile2\" to write to!!\n\n";
exit;
}
$dbh = DBI->connect("DBI:mysql:nucmutations",$DBUSER,$DBPASS);
$sth = $dbh->prepare("USE $Table;");
$sth->execute();
$sth = $dbh->prepare("SELECT Primer, Oligoname FROM $Table;");
$sth->execute();
while (my ($X, $oligo) = $sth->fetchrow_array()) {
format PTXT =
>@<<<<<<<<<<<<<<<<<<<<<&
lt;<<<<<<<<<<<<<<<
$oligo
@<<<<<<<<<<<<<<<<<<<<<<&
lt;<<<<<<<<<<<<<<<<<<<<<<;
$X
.
write(PTXT);
}
close "/www/modperldocs/bioinf/data/$outfile3";
$sth->finish;
$dbh->disconnect;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$statement="SELECT spalte1,spalte2,spalte3,spalte4,spalte5 FROM table";
## dann connecten
my $dbh=DBI->connect...
my $ary_ref = $dbh->selectall_arrayref($statement);
open(FILE1,file1);
open(FILE2,file2);
foreach my $val(@{$ary_ref})
{
print FILE1 $val->[0].' '.$val->[1].' '.$val->[2].'\n';
print FILE2 $val->[3].' '.$val->[4].'\n';
}
close(FILE1);
close(FILE2);
3 Einträge, 1 Seite |