Skip to content

Commit 0d2a22a

Browse files
error correction for this release of irefindex
1 parent 9d22837 commit 0d2a22a

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

irefindex/irefindex.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class irefindexParser extends Bio2RDFizer
3434
function __construct($argv) { //
3535
parent::__construct($argv,"irefindex");
3636
parent::addParameter('files',true,'all|10090|10116|4932|559292|562|6239|7227|9606|A','all','all or comma-separated list of files to process');
37-
parent::addParameter('version',false,'08122013|03022013|10182011','08122013','dated version of files to download');
37+
parent::addParameter('version',false,'07042015|08122013|03022013|10182011','07042015','dated version of files to download');
3838
parent::addParameter('download_url',false,null,'http://irefindex.org/download/irefindex/data/current/psi_mitab/MITAB2.6/');
3939
parent::initialize();
4040
}
@@ -79,11 +79,12 @@ function Run()
7979

8080
$zin = new ZipArchive();
8181
if ($zin->open($lfile) === FALSE) {
82-
trigger_error("Unable to open $lfile");
82+
trigger_error("Unable to open $lfile",E_USER_ERROR);
8383
exit;
8484
}
85-
if(($fp = $zin->getStream($base_file)) === FALSE) {
86-
trigger_error("Unable to get $base_file in ziparchive $lfile");
85+
$ifile = $file.".mitab.04072015.txt"; // introduced because of file name change in this release
86+
if(($fp = $zin->getStream($ifile)) === FALSE) {
87+
trigger_error("Unable to get $ifile in ziparchive $lfile",E_USER_ERROR);
8788
return FALSE;
8889
}
8990
parent::setReadFile($lfile);
@@ -156,14 +157,12 @@ function Parse()
156157
$l = parent::getReadFile()->read(100000);
157158
$header = explode("\t",trim(substr($l,1)));
158159
if(($c = count($header)) != 54) {
159-
trigger_erorr("Expecting 54 columns, found $c!");
160+
trigger_erorr("Expecting 54 columns, found $c!",E_USER_ERROR);
160161
return FALSE;
161162
}
162-
163163
// check # of columns
164164
while($l = parent::getReadFile()->read(500000)) {
165165
$a = explode("\t",trim($l));
166-
167166
// irefindex identifiers
168167
$rigid = "irefindex.".$a[34]; # checksum for interaction
169168
$rogida = "irefindex.".$a[32]; # checksum for A
@@ -190,6 +189,10 @@ function Parse()
190189
if($id == '-') {
191190
// this happens with hprd
192191
$iid = "hprd:".substr($ids[1],6);
192+
} else if($ns=="pubmed") {
193+
$data = $this->ParseStringArray($a[12]);
194+
$ns = $data['label'];
195+
continue;
193196
} else {
194197
$iid = $ns.":".$id;
195198
}

0 commit comments

Comments
 (0)