Hi
I have a list of rsid and i want to search against clinvar database and print the condition_germline column with respect to each rsid. Anyway, i have got a script.
use strict;
use warnings;
use LWP::Simple;
use HTML::TableExtract;
# Read list of rsids from file
my $rsids_file = 'rsids.txt';
open(my $fh, '<', $rsids_file) or die "Can't open $rsids_file: $!";
my @rsids = <$fh>;
close($fh);
# Loop through each rsid
foreach my $rsid (@rsids) {
chomp($rsid);
# Construct URL for ClinVar search
my $url = "https://www.ncbi.nlm.nih.gov/clinvar/variation/$rsid/";
# Fetch web content
my $content = get($url);
unless (defined $content) {
warn "Couldn't get $url: ", $!;
next;
}
# Extract table
my $te = HTML::TableExtract->new(headers => ["Condition_Germline"]);
$te->parse($content);
# Print condition_germline column
foreach my $ts ($te->tables) {
foreach my $row ($ts->rows) {
print join("\t", @$row), "\n";
}
}
}
But, when its runs getting the following error.
Couldn't get https://www.ncbi.nlm.nih.gov/clinvar/variation/rs11203366/: at .\fetch_condition.pl line 22.
Couldn't get https://www.ncbi.nlm.nih.gov/clinvar/variation/rs11203367/: at .\fetch_condition.pl line 22.
Couldn't get https://www.ncbi.nlm.nih.gov/clinvar/variation/rs874881/: at .\fetch_condition.pl line 22.
Couldn't get https://www.ncbi.nlm.nih.gov/clinvar/variation/rs776453694/: at .\fetch_condition.pl line 22.
Couldn't get https://www.ncbi.nlm.nih.gov/clinvar/variation/rs80324279/: at .\fetch_condition.pl line 22.
Couldn't get https://www.ncbi.nlm.nih.gov/clinvar/variation/rs324420/: at .\fetch_condition.pl line 22.
Couldn't get https://www.ncbi.nlm.nih.gov/clinvar/variation/rs112766203/: at .\fetch_condition.pl line 22.
I appreciate your suggestions.
Thank you.
Hii... i have updated the script in python..But, still getting no data found. Actually the data is there, i have print the parsed html file but not print the conditions_germline = soup.find('Conditions-Germline'). Is there problem with this line?? I have attached the script with this. Kindly have a look into this.Thank you.