Skip to content

Commit 2c52c35

Browse files
Merge pull request #383 from micheldumontier/release3
updates
2 parents de7890a + c0b1daa commit 2c52c35

File tree

3 files changed

+121
-67
lines changed

3 files changed

+121
-67
lines changed

common/php/oboparser.php

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
function OBOParser($in)
4+
{
5+
if($in === NULL) return NULL;
6+
7+
while($l = fgets($in)) {
8+
if(strlen(trim($l)) == 0) continue;
9+
10+
if(strstr($l,"[Term]")) {
11+
if(isset($term)) {
12+
$terms[$term['id'][0]] = $term;
13+
}
14+
$term = '';
15+
} else if(strstr($l,"[Typedef]")) {
16+
if(isset($term)) {
17+
$terms[$term['id'][0]] = $term;
18+
unset($term);
19+
}
20+
$typedef = '';
21+
} else {
22+
if(isset($term)) {
23+
$a = explode(": ",trim($l));
24+
$a[1] = str_replace('"','',$a[1]); // remove brackets
25+
26+
preg_match("/(.*) \! (.*)/",$a[1],$m); // parse out the label that may come with an id
27+
if(count($m)) {
28+
$a[1] = $m[1];
29+
}
30+
$term[$a[0]][] = $a[1];
31+
32+
} else if(isset($typedef)) {
33+
34+
} else {
35+
// in the header
36+
//format-version: 1.0
37+
$a = explode(": ",trim($l));
38+
$terms['ontology'][$a[0]][] = $a[1];
39+
}
40+
}
41+
}
42+
if(isset($term)) $terms[$term['id'][0]] = $term;
43+
44+
return $terms;
45+
}
46+
47+
function BuildNamespaceSearchList($terms, &$out)
48+
{
49+
foreach($terms AS $term) {
50+
if(isset($term['namespace'][0]) && isset( $term['id'][0] ) && isset( $term['name'][0]))
51+
$out[$term['namespace'][0]][$term['id'][0]] = $term['name'][0];
52+
}
53+
}
54+
?>

goa/goa.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ function run(){
6666
$rfile = $rdir.strtoupper($file)."/gene_association.goa_".$file.".gz";
6767
if($download == true) {
6868
echo "downloading $file ... ";
69-
file_put_contents($lfile,file_get_contents($rfile));
69+
//file_put_contents($lfile,file_get_contents($rfile));
70+
utils::DownloadSingle($rfile,$lfile);
7071
}
7172

7273
$gz = (strstr(parent::getParameterValue('output_format'),".gz") === FALSE)?false:true;

0 commit comments

Comments
 (0)