MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Importing into Mathematica from URL (PubMed)

  • To: mathgroup at
  • Subject: [mg117626] Re: Importing into Mathematica from URL (PubMed)
  • From: "Hans Michel" <hmichel at>
  • Date: Tue, 29 Mar 2011 06:49:21 -0500 (EST)

I don't know the field but the problem you are experiencing has nothing to
do with mathematica or one site providing better data than another. 
This just returned the FASTA text amino acid sequence:

"FASTA"] for straight to "FASTA" format import.

This returned the GenPept full format

", "Text"]

This site needs to run in a browser, what you see in the browser seems to be
code that is generated through javascript. Mathematica only imports the raw
sources not not the final source when viewed through a web browser with
javascript engine on.

If you view your original site through a web browser ""; the "Send to:" link and drop
down image will give you the opportunity to save what you are viewing to
file. I just copied the representative URL from the save to file result.
This did not involve mathematica in any way.

You may also get this in xml format if you play around with the URL
viewr.fcgi? query strings

"7.0 for Microsoft Windows (32-bit) (February 18, 2009)"


-----Original Message-----
From: Thomas Dowling [mailto:thomasgdowling at] 
Sent: Thursday, March 24, 2011 6:27 AM
To: mathgroup at
Subject: [mg117626] [mg117594] Importing into Mathematica from URL (PubMed)


Does anyone know how to import a protein sequence from the PubMed database
into Mathematica, or
can anyone advise me as to where I am going wrong in the following approach?

1. As an example, I'd like to import the data for BSA (bovine serum albumin)
from the following site:

I wish to import all meaningful data from this page, but the bit I am
particularly interested in is the amino acid sequence

(in one-leter code) which is right at the end (between ORIGIN and //):

        1 mkwvtfisll llfssaysrg vfrrdthkse iahrfkdlge ehfkglvlia fsqylqqcpf
       61 dehvklvnel tefaktcvad eshagceksl htlfgdelck vaslretygd madccekqep
      121 ernecflshk ddspdlpklk pdpntlcdef kadekkfwgk ylyeiarrhp yfyapellyy
      181 ankyngvfqe ccqaedkgac llpkietmre kvltssarqr lrcasiqkfg eralkawsva
      241 rlsqkfpkae fvevtklvtd ltkvhkecch gdllecaddr adlakyicdn qdtissklke
      301 ccdkplleks hciaevekda ipenlpplta dfaedkdvck nyqeakdafl gsflyeysrr
      361 hpeyavsvll rlakeyeatl eeccakddph acystvfdkl khlvdepqnl ikqncdqfek
      421 lgeygfqnal ivrytrkvpq vstptlvevs rslgkvgtrc ctkpesermp ctedylslil
      481 nrlcvlhekt pvsekvtkcc teslvnrrpc fsaltpdety vpkafdeklf tfhadictlp
      541 dtekqikkqt alvellkhkp kateeqlktv menfvafvdk ccaaddkeac favegpklvv
      601 stqtala

2.  Import["","Elements";]

gives the following




only gives what looks like a load of rubbish, and there is NO SEQUENCE

3.  Trying in FASTA format (which is  supported by Mathematica)






also gives only rubbish.

 (Changing the Element to FullData or Plaintext has no effect)

4. NO SUCH PROBLEMS OCCUR with Uniprot (Swiss-Prot).



(Note that the sequence is now imported)

Or, BEST, using the FASTA format and importing from this site

Flatten@Characters@StringReplace[Import["";, "Plaintext"] , Whitespace->



which is where I'd like to get to.

So my question is the following:  What is so unusual about the PubMed site,
and what am I doing wrong in the approach I am taking?  It  would
be a great advantage to me to be able to import from PubMed in the manner
shown above for Uniport.

Thanks for your help

Tom Dowling

  • Prev by Date: Re: how do I solve for this
  • Next by Date: Re: Find all minima, maxima and saddles
  • Previous by thread: Re: Importing into Mathematica from URL (PubMed)
  • Next by thread: Re: Importing into Mathematica from URL (PubMed)