File tree 3 files changed +121
-67
lines changed
3 files changed +121
-67
lines changed Original file line number Diff line number Diff line change
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
+ ?>
Original file line number Diff line number Diff line change @@ -66,7 +66,8 @@ function run(){
66
66
$ rfile = $ rdir .strtoupper ($ file )."/gene_association.goa_ " .$ file .".gz " ;
67
67
if ($ download == true ) {
68
68
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 );
70
71
}
71
72
72
73
$ gz = (strstr (parent ::getParameterValue ('output_format ' ),".gz " ) === FALSE )?false :true ;
You can’t perform that action at this time.
0 commit comments