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 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| #Parser
my $parser_dbSNP_Id = HTML::Parser->new(start_h => [\&start_rtn_dbSNP_Id,"tag, attr"],
text_h => [\&text_rtn_dbSNP_Id, "text"],
end_h => [\&end_rtn_dbSNP_Id, "tag"]
);
sub start_rtn_dbSNP_Id {
my ($tag, $attr) = @_;
if ($tag =~ /^pre$/){
$flag = 1;
}
if ($tag =~ /^font$/
and defined $attr->{color}
and $attr->{color} =~ /^red$/ ){
$flag = 2;
}
if ($tag =~ /^font$/
and defined $attr->{color}
and $attr->{color} =~ /^red$/ ){
$flag = 3;
}
} #End start_rtn_dbSNP_Id
sub text_rtn_dbSNP_Id {
my ($text) = @_;
$text =~ s/\n/ /g;
my @tab_dbSNP_Id = @_;
if($flag == 1){
push(@tab_dbSNP_Id, $text);
print data_out"Flanking sequence 1: $text\n";
}
if ($flag == 2){
push(@tab_dbSNP_Id, $text);
print data_out"allèle: $text\n";
}
if ($flag == 3 ){
# $text =~ s/
//;
push(@tab_dbSNP_Id, $text);
print data_out"Flanking sequence 2: $text\n";
}
} #End text_rtn_dbSNP_Id
sub end_rtn_dbSNP_Id {
my ($tag) = @_;
if ($tag =~ /^\/pre$/ && $flag == 1){
$flag = 0;
}
if ($tag =~ /^\/font$/ && $flag == 2){
$flag = 0;
}
if ($tag =~ /^\/td$/ && $flag == 3){
$flag = 0;
}
} #End end_rtn_dbSNP_Id
#start of parsing in dbSNP
$parser_dbSNP_Id->parse($page_dbSNP_Id);
#end of parsing (dbSNP)
$parser_dbSNP_Id->eof; |
Partager