Sir / Madam,
I would like to map and extract common numbers between 5 column (i.e.Start) and 6th column (End) for refFlat table with 2nd column (Start) and 3rd column (End) for mirna table. Could you please modify the script attach here. I would be glad for your support.
With regards,
Rocky
Seoul, Korea
This is a simple script to extract Start and End column.
#!/usr/bin/perl
use strict;
use DBI;
my $user = 'root';
my $password = '1004';
# connect to the database
my $dbh = DBI->connect("dbi:mysql:mirvar", $user, $password) || die "Failed connect DB : $!\n";
my $sql;
$sql = "select * from mirna limit 10";
my $sth = $dbh->prepare($sql);
$sth->execute || die "Error! : $sql\n";
while( my $mirna= $sth->fetchrow_hashref() ){
my $start = $mirna->{'Start'};
my $end = $mirna->{'End'};
print "$chr\t$start\t$end\n";
#!/usr/bin/perl
use strict;
use DBI;
my $user = 'root';
my $password = '1004';
# connect to the database
my $dbh = DBI->connect("dbi:mysql:mirvar", $user, $password) || die "Failed connect DB : $!\n";
my $sql;
$sql = "select * from mirna, refFlat limit 10";
my $sth = $dbh->prepare($sql);
$sth->execute || die "Error! : $sql\n";
while( my $mirna && $refFlat = $sth->fetchrow_hashref() ){
my $chr = $mirna->{'chr'};
my $start = $mirna->{'Start'};
my $end = $mirna->{'End'};
my $chr = $refFlat->{'chr'};
my $start = $refFlat->{'Start'};
my $end = $refFlat->{'End'};
print "$chr\t$start\t$end\n";
}