hi,
i'm trying to parse the info. retrieved from a web page as follows: -
$text_info = curl_init("http://domain.com/info.txt");
-
$buffer = curl_exec($text_info);
-
if (preg_match_all("/DE\s+(.+)/", $buffer, $desc)) { $description .= $desc[1]; }
-
but the problem is, there are several lines in the $buffer variable that has the same pattern. for example,
DE Potassium voltage-gated channel subfamily A member 3 (Voltage-gated
DE potassium channel subunit Kv1.3) (HPCN3) (HGK5) (HuKIII) (HLK3).
which is what i am interested in, but also, there are lines that the above pattern matches, such as,
RP NUCLEOTIDE SEQUENCE [GENOMIC DNA].
which i am not interested in. i tried using '^' infront of DE ("/^DE\s+(.+)/"), but doesn't work at all.
please help.
Thanks a lot in advance.
3 1380
can you give us a sample file (or chunk of file) that is typical, and highlight the lines or strings your interested in.
Without seeing the whole thing, we can't give you the best possible regex.
thanks for your reply. here's the file that i've been trying to parse. the underlined part (line 6 & 7) is what i am interested in. i would like the retrieved line look like: UDP-galactose translocator (UDP-galactose transporter) (UGT) (UDP-Gal-Tr) (Solute carrier family 35 member A2) (mUGT1).
Thank you! -
ID S35A2_MOUSE Reviewed; 390 AA.
-
AC Q9R0M8;
-
DT 01-DEC-2000, integrated into UniProtKB/Swiss-Prot.
-
DT 01-MAY-2000, sequence version 1.
-
DT 15-JAN-2008, entry version 53.
- DE UDP-galactose translocator (UDP-galactose transporter) (UGT) (UDP-Gal-
-
DE Tr) (Solute carrier family 35 member A2) (mUGT1).
-
GN Name=Slc35a2; Synonyms=Ugt1;
-
OS Mus musculus (Mouse).
-
OC Eukaryota; Metazoa; Chordata; Craniata; Vertebrata; Euteleostomi;
-
OC Mammalia; Eutheria; Euarchontoglires; Glires; Rodentia; Sciurognathi;
-
OC Muroidea; Muridae; Murinae; Mus.
-
OX NCBI_TaxID=10090;
-
RN [1]
-
RP NUCLEOTIDE SEQUENCE [MRNA].
-
RC STRAIN=BALB/c;
-
RX MEDLINE=20047065; PubMed=10578063 [NCBI, ExPASy, EBI, Israel, Japan];
-
RA Ishida N., Yoshioka S., Iida M., Sudo K., Miura N., Aoki K.,
-
RA Kawakita M.;
-
RT "Indispensability of transmembrane domains of Golgi UDP-galactose
-
RT transporter as revealed by analysis of genetic defects in UDP-
-
RT galactose transporter-deficient murine had-1 mutant cell lines and
-
RT construction of deletion mutants.";
-
RL J. Biochem. 126:1107-1117(1999).
-
RN [2]
-
RP NUCLEOTIDE SEQUENCE [LARGE SCALE MRNA].
-
RC STRAIN=FVB/N; TISSUE=Salivary gland;
-
RX PubMed=15489334 [NCBI, ExPASy, EBI, Israel, Japan]; DOI=10.1101/gr.2596504;
-
RG The MGC Project Team;
-
RT "The status, quality, and expansion of the NIH full-length cDNA
-
RT project: the Mammalian Gene Collection (MGC).";
-
RL Genome Res. 14:2121-2127(2004).
-
CC -!- FUNCTION: Transports nucleotide sugars from the cytosol into Golgi
-
CC vesicles where glycosyltransferases function.
-
CC -!- SUBCELLULAR LOCATION: Golgi apparatus membrane; Multi-pass
-
CC membrane protein.
-
CC -!- SIMILARITY: Belongs to the nucleotide-sugar transporter family.
-
CC SLC35A subfamily.
-
CC -----------------------------------------------------------------------
-
CC Copyrighted by the UniProt Consortium, see http://www.uniprot.org/terms
-
CC Distributed under the Creative Commons Attribution-NoDerivs License
-
CC -----------------------------------------------------------------------
-
DR EMBL; AB027147; BAA86885.1; -; mRNA. [EMBL / GenBank / DDBJ] [CoDingSequence]
-
DR EMBL; BC037701; AAH37701.1; -; mRNA. [EMBL / GenBank / DDBJ] [CoDingSequence]
-
DR PIR; JC7162; JC7162.
-
DR RefSeq; NP_001077406.1; -.
-
DR UniGene; Mm.214976; -.
-
DR Ensembl; ENSMUSG00000031156; Mus_musculus
-
DR GeneID; 22232; -.
-
DR MGI; MGI:1345297; Slc35a2.
-
DR ArrayExpress; Q9R0M8; -.
-
DR GermOnline; ENSMUSG00000031156; Mus_musculus
-
DR GO; GO:0000139; C:Golgi membrane; IDA:MGI.
-
DR GO; GO:0005459; F:UDP-galactose transmembrane transporter act...; IDA:MGI.
-
DR GO; GO:0008643; P:carbohydrate transport; IDA:MGI.
-
DR InterPro; IPR007271; Nuc_sug_transpt.
-
DR InterPro; IPR004689; UDPgal_transpt.
-
DR InterPro; Graphical view of domain structure.
-
DR PANTHER; PTHR10231; Nuc_sug_transpt; 1.
-
DR Pfam; PF04142; Nuc_sug_transp; 1.
-
DR Pfam; Graphical view of domain structure.
-
DR TIGRFAMs; TIGR00803; nst; 1.
-
DR CMR; Q9R0M8.
-
DR ProDom [Domain structure / List of seq. sharing at least 1 domain]
-
DR BLOCKS; Q9R0M8.
-
DR ProtoNet; Q9R0M8.
-
DR DIP; Q9R0M8.
-
DR ModBase; Q9R0M8.
-
DR SWISS-2DPAGE; GET REGION ON 2D PAGE.
-
PE 2: Evidence at transcript level;
-
KW Golgi apparatus; Membrane; Sugar transport; Transmembrane; Transport.
-
FT CHAIN 1 390 UDP-galactose translocator.
-
FT /FTId=PRO_0000213354.
-
FT TRANSMEM 3 23 Potential.
-
FT TRANSMEM 37 57 Potential.
-
FT TRANSMEM 65 85 Potential.
-
FT TRANSMEM 97 117 Potential.
-
FT TRANSMEM 140 160 Potential.
-
FT TRANSMEM 169 189 Potential.
-
FT TRANSMEM 200 220 Potential.
-
FT TRANSMEM 238 258 Potential.
-
FT TRANSMEM 269 289 Potential.
-
FT TRANSMEM 315 335 Potential.
-
SQ SEQUENCE 390 AA; 40766 MW; F7CD57C5C0D401B8 CRC64;
-
MAAVGVGGST AAAGAGAVSS GALEPGSTTA AHRRLKYISL AVLVVQNASL ILSIRYARTL
-
PGDRFFATTA VVMAEVLKGL TCLLLLFAQK RGNVKHLVLF LHEAVLVQYV DTLKLAVPSL
-
IYTLQNNLQY VAISNLPAAT FQVTYQLKIL TTALFSVLML NRSLSRLQWA SLLLLFTGVA
-
IVQAQQAGGS GPRPLDQNPG AGLAAVVASC LSSGFAGVYF EKILKGSSGS VWLRNLQLGL
-
FGTALGLVGL WWAEGTAVAS QGFFFGYTPA VWGVVLNQAF GGLLVAVVVK YADNILKGFA
-
TSLSIVLSTV ASIRLFGFHL DPLFALGAGL VIGAVYLYSL PRGAVKAIAS ASASGPCIHQ
-
QPPGQPPPPQ LSSRGDLTTE PFLPKSVLVK
-
//
-
Reading another thread, Displaying part of a remote file, in this forum, I saw that cURL returned text buffer does NOT have line breaks.
So it will be hard for you to filter out your string at the beginning of a line. You could read the file in an array and then filter the DE-starting lines out.
See THIS POST in the referred thread that shows how you could do it.
Ronald
Sign in to post your reply or Sign up for a free account.
Similar topics
by: |
last post by:
Hi,
I need to read a big CSV file, where different fields should be converted to
different types,
such as int, double, datetime, SqlMoney, etc.
I have an array, which describes the fields and...
|
by: Markus Kling |
last post by:
"double.Parse(double.MaxValue.ToString())" yields the following Exception:
Value was either too large or too small for a Double.
at System.Number.ParseDouble(String value, NumberStyles options,...
|
by: AdrianH |
last post by:
Assumptions
I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C++ programming.
FYI
Although I have called...
|
by: basswhizz |
last post by:
Hi guys im having trouble with somethings else now can you help out thanks!!
Im getting this error message
Parse error: syntax error, unexpected $end
Here's my code cheers!!]
<?php
//...
|
by: mmiller |
last post by:
I have a pretty limited knowledge of PHP.
My scenario is:
I want one form to have two (2) submit buttons. I want one button to submit an email to a specific address then redirect to a page, and...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |