[Biophp-dev] (no subject)
biophp-dev@bioinformatics.org
biophp-dev@bioinformatics.org
Mon, 18 Oct 2004 10:50:43 +0200
This is a multi-part message in MIME format.
------_=_NextPart_001_01C4B4EF.8D380A40
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi all,
Here is a little update of my suggestion for =
CVS/biophp/genephp/parsers/fasta.inc.php
regards,
Fred
function fetchNext()
{
$record=3DArray(); //for returning results
if($this->next_label) {
list($id,$sequence)=3D$this->findNextLabel();
//treat the Defline used at NCBI
//>gi|42794768|ref|NM_002576.3| Homo sapiens =
p21/Cdc42/Rac1-activated kinase 1 (STE20 homolog, yeast) (PAK1), mRNA
if(ereg("^gi", $id)) {
$id =3D substr($id, 3); //take off gi|
list($id, $db, $accession_version, $definition) =3D =
explode("|", $id);
list($accession, $version) =3D explode(".", =
$accession_version);
$record['ncbi_gi_id'] =3D$id;
$record['id'] =3D$accession;
$record['accession'] =3D$accession;
$record['version'] =3D$accession_version;
$record['definition'] =3D$definition;
if (ereg("mRNA", $definition)) $record['moltype'] =3D =
"mRNA";
if (ereg("Homo sapiens", $definition)) {
$record['source'] =3D "Homo sapiens (human)";
$record['organism'] =3D "Homo sapiens";
}
}
else {
$record['id']=3D$id;
}
$record['sequence']=3D$sequence;
return $record;
}
else {
//no more records in file
return false;
}
}
------_=_NextPart_001_01C4B4EF.8D380A40
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.0.6556.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=3D2 FACE=3D"Arial">Hi all,</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Here is a little update of my =
suggestion for CVS/biophp/genephp/parsers/fasta.inc.php</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">regards,</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Fred</FONT>
</P>
<BR>
<P><FONT SIZE=3D2 FACE=3D"Arial">function fetchNext()</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"> {</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> =
$record=3DArray(); //for returning results</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> =
if($this->next_label) {</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; list($id,$sequence)=3D$this->findNextLabel();</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; //treat the Defline used at NCBI</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; //>gi|42794768|ref|NM_002576.3| Homo sapiens =
p21/Cdc42/Rac1-activated kinase 1 (STE20 homolog, yeast) (PAK1), =
mRNA</FONT></P>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; if(ereg("^gi", $id)) {</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; $id =3D substr($id, 3); //take off =
gi|</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; list($id, $db, $accession_version, =
$definition) =3D explode("|", $id);</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; list($accession, $version) =3D =
explode(".", $accession_version);</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; $record['ncbi_gi_id'] =
=3D$id;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; =
$record['id'] =
=3D$accession;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; $record['accession'] =
=3D$accession;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; =
$record['version'] =
=3D$accession_version;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; $record['definition'] =
=3D$definition;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; if (ereg("mRNA", =
$definition)) $record['moltype'] =3D "mRNA";</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; if (ereg("Homo sapiens", =
$definition)) {</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; =
$record['source'] =3D "Homo sapiens =
(human)";</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; =
$record['organism'] =3D "Homo sapiens";</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; }</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; }</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; else {</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; $record['id']=3D$id;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; }</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; $record['sequence']=3D$sequence;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; return $record;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> }</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> else {</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; //no more records in file</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nbs=
p; return false;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> }</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"> }</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C4B4EF.8D380A40--