Commit 203f875f authored by jlopez's avatar jlopez
Browse files

Refactor Bioconductor getPackages

parent 093394d7
...@@ -72,7 +72,7 @@ if(strpos($distrib, ':') !== false) { ...@@ -72,7 +72,7 @@ if(strpos($distrib, ':') !== false) {
else if($distrib == "CPAN") { else if($distrib == "CPAN") {
$result = findCPANPackage($distrib, $version_num, $version_name, $filter, $limit, false); $result = findCPANPackage($distrib, $version_num, $version_name, $filter, $limit, false);
} }
else if($distrib == "CRAN") { else if($distrib == "CRAN" || $distrib == "Bioconductor") {
$result = findRPackage($distrib, $version_num, $version_name, $filter, $limit, false); $result = findRPackage($distrib, $version_num, $version_name, $filter, $limit, false);
} }
else { else {
......
...@@ -295,6 +295,44 @@ function findRPackage($os_name, $version_num, $version_name, $keyword, $limit, $ ...@@ -295,6 +295,44 @@ function findRPackage($os_name, $version_num, $version_name, $keyword, $limit, $
fclose($h); fclose($h);
} }
}
else if($repos == "bioc") {
$url_packages = "https://www.bioconductor.org/packages/release/bioc/";
$doc = getDocument($url_packages);
$trs = $doc->getElementsByTagName('tr');
$size = $trs->length - 1;
$index = 0;
for ($i = 1; $i <= $size; $i++) {
$name = $trs[$i]->childNodes[1]->nodeValue;
if(strpos($name, $keyword) !== false) {
$description = $trs[$i]->childNodes[5]->nodeValue;
$version = "";
$link = "https://www.bioconductor.org/packages/release/bioc/html/".$name.".html";
$other = $trs[$i]->childNodes[3]->nodeValue;
$package = new Package($name, $version, $description, $link, $other);
$results[] = $package;
$index++;
}
if($index == $limit) {
break;
}
}
} }
return $results; return $results;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment