Le 13-01-2016 à 20:58, Paul PILLOT <paulpil...@gmail.com> a écrit :

Hi Eric,
rcsb implements a REST API that you can query through Ajax to get many answers 
to a lot of question.
Here is an example of code I designed to get informations from a PDB, such as 
the number and names of chains, the ligands, the related pubmed abstract, etc…
PDB rest web service returns XML documents that can be easily parsed with 
Jquery built in fonctions : find() to get the main node, attr() to get specific 
node attributes.
My internet access is very slow at the moment, so I am not able to check which 
are the nodes you are looking after, but I am convinced that you could find the 
answers to your questions through this very powerful and effective channel.
Paul

$.ajax({
                                url: "http://www.pdb.org/pdb/rest/describePDB 
<http://www.pdb.org/pdb/rest/describePDB>",
                                data: {
                                        structureId: pdb
                                },
                                success: function(txt){
                                        var $xml = $(txt);
                                        var node = $xml.find("PDB");
                                        if (node.length==0) {
                                                alert(« Unknown PDB 
identifier",'reponsePdb','error');
                                                return;
                                        }
                                        var pId = node.attr("pubmedId");
                                        var titre = node.attr("title");
                                        var authors = 
node.attr('citation_authors');
                                        var txt = '<div id="article"><span 
class="label label-info">Titre</span> '+titre+' ';
                                        txt += '<span class="label 
label-info">Pubmed</span> <a target="_blank" 
href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&dopt=Abstract&list_uids='+pId+'
 
<http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&dopt=Abstract&list_uids='+pId+'>">'+pId+'</a>'
                                        txt += ' <span class="label 
label-info">Auteurs</span> '+authors;
                                        txt+= '</div><div 
id="caracteristiquesMol"></div>';
                                        $('#reponsePdb').append(txt);
                                        $('#reponsePdb').append('<br />');
                                        $('#auteur').val(authors);
                                        
$('#codePdb').val(pdb).triggerHandler('change');
                                        
                                        
$('#reponsePdb').data('pdb',pdb).data('pubmed_article',pId).data('auteurs_article',authors).data('titre_article',titre);
                                        
                                        $('#imagePdb').append("<img 
class='pdb-img' src='http://www.pdb.org/pdb/images/ 
<http://www.pdb.org/pdb/images/>"+pdb+"_bio_r_500.jpg?bioNum=1'/>");
                                        
                                        
                                        $.ajax({
                                                url: 
"http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi 
<http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi>",
                                                data: {
                                                        db: "pubmed",
                                                        id: pId,
                                                        retmode: "xml",
                                                        rettype: "abstract"
                                                },
                                                success: function(txt){
                                                        //console.log(txt);
                                                        var $xml = $(txt);
                                                        var txt = '';
                                                        var pmc = 
$xml.find("ArticleId[IdType='pmc']").text();
                                                        var volume = 
$xml.find("Volume").text();
                                                        var revue = 
$xml.find("Title").text();
                                                        var pages = 
$xml.find("MedlinePgn").text();
                                                        var annee = 
$xml.find("Year:first").text();
                                                        var doi = 
$xml.find("ArticleId[IdType='doi']").text();
                                                        var abstract = 
$xml.find("AbstractText").text();
                                                        
                                                        txt += '<br /><span 
class="label label-info">in</span> '+revue+' '+annee+' n°'+volume+ ' p'+pages+' 
';
                                                        if (pmc.length>0) txt 
+= '<span class="label label-info »>Full article (PubMedCentral)</span> <a 
target="_blank" href="http://www.ncbi.nlm.nih.gov/pmc/articles/'+pmc+'/ 
<http://www.ncbi.nlm.nih.gov/pmc/articles/'+pmc+'/>">'+pmc+'</a> ';
                                                        
                                                        if (doi.length>0) txt 
+= '<span class="label label-info">Site de l\'éditeur</span> <a  
target="_blank" href="http://dx.doi.org/'+doi+' 
<http://dx.doi.org/'+doi+'>">'+revue+'</a> ';
                                                        txt += '<br /><span 
class="label label-info »>Abstract</span> '+abstract+'<br />'
                                                        
$('#article').append(txt);
                                                        
                                                        var tiret = 
pages.indexOf('-');
                                                        var pdeb = 
pages.substr(0,tiret), pfin = pages.substr(tiret+1);
                                                        
$('#reponsePdb').data('annee_article',annee).data( 'volume_article' , volume 
).data('journal_article',revue).data('abstract_article',abstract).data('page_deb_article',pdeb).data('page_fin_article',pfin);
                                                }
                                        });
                                        $.ajax({
                                                url: 
"http://www.pdb.org/pdb/rest/describeMol 
<http://www.pdb.org/pdb/rest/describeMol>",
                                                data: {
                                                        structureId: pdb
                                                },
                                                success: function(txt){
                                                        var $xml = $(txt);
                                                        var chaines
                                                        
$xml.find("polymer").each(function(index,el){
                                                                var t = '<br 
/><span class="label label-success">Chaines</span>';
                                                                
$(this).find("chain").each(function(){
                                                                        t+= 
$(this).attr('id')+' ';
                                                                })
                                                                var nature = 
$(this).attr('type');
                                                                t+= ' <span 
class="label label-success">Nature</span> '+nature+' ';
                                                                var nom = 
$(this).find("polymerDescription").attr('description')
                                                                t+= ' <span 
class="label label-success">Nom</span> '+nom+' ';
                                                                
$(this).find("accession").each(function(){
                                                                        var 
uniprotId = $(this).attr('id');
                                                                        t+= ' 
<a target="_blank" href="http://www.uniprot.org/uniprot/'+uniprotId+' 
<http://www.uniprot.org/uniprot/'+uniprotId+'>">'+uniprotId+'</a> '
                                                                })
                                                                var organisme = 
$(this).find("Taxonomy").attr('name')
                                                                if (organisme){
                                                                        t += ' 
<span class="label label-success">Organisme</span> '+organisme+' ';
                                                                        
selOrganisme(organisme)
                                                                }
                                                                
$('#caracteristiquesMol').append(t);
                                                
                                                        });
                                                        var mut = 
$xml.find("mutation:first").attr('desc');
                                                        if (mut) {
                                                                t = '<br/><span 
class="label label-warning">Mutation</span> '+mut+' ';
                                                                
$('#caracteristiquesMol').append(t);
                                                        }
                                                }
                                        });
                                        $.ajax({
                                                url: 
"http://www.pdb.org/pdb/rest/ligandInfo 
<http://www.pdb.org/pdb/rest/ligandInfo>",
                                                data: {
                                                        structureId: pdb
                                                },
                                                success: function(txt){
                                                        var $xml = $(txt);
                                                        var chaines
                                                        
$xml.find("ligand").each(function(index,el){
                                                                var t = '<br 
/><span class="label label-important">Ligand</span> ';
                                                                var chId = 
$(this).attr('chemicalID');
                                                                var type = 
$(this).attr('type');
                                                                var nom = 
$(this).find('chemicalName').text();
                                                                var smiles = 
$(this).find('smiles').text();
                                                                t+= chId + ' ';
                                                                t+= ' <span 
class="label label-important">Nom</span> '+nom+' ';
                                                                t+= ' <span 
class="label label-important">Type</span> '+type+' ';
                                                                t+= '<br /><img 
src="http://cactus.nci.nih.gov/chemical/structure/'+smiles+'/image 
<http://cactus.nci.nih.gov/chemical/structure/'+smiles+'/image>"/><br />';
                                                                
$('#caracteristiquesMol').append(t);
                                                
                                                        });
                                                }
                                        });

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to