openphacts / GLOBAL

Global project issues [private for now. owner lee harland]
3 stars 0 forks source link

target class pharmacology server error on 1.4, works on 1.3 #184

Open danidi opened 10 years ago

danidi commented 10 years ago

https://beta.openphacts.org/1.4/target/tree/pharmacology/pages?uri=http%3A%2F%2Fpurl.uniprot.org%2Fenzyme%2F1.-.-.-&app_id=XXX&app_key=XXX&target_organism=Homo+sapiens&min-pChembl=7&_pageSize=all returns an internal server error after approx. 1min 30s. The same query on 1.3 gives results in a bit less than 2min. Are there any changes in the restrictions or time-outs on 1.4?

stain commented 9 years ago

This is timing out (I assume) with a 500 Internal Server Error is only on the beta.openphacts.org deployment - but it works on ops2. Perhaps OpenLink can check the configuration for talking to the 1.4 PHP? (Is it a RewriteRule?)

stain@biggie-mint ~ $ curl 'http://ops2.few.vu.nl/target/tree/pharmacology/pages?uri=http%3A%2F%2Fpurl.uniprot.org%2Fenzyme%2F2.-.-.-&app_id=XXX&app_key=XXX&target_organism=Homo+sapiens&min-pChembl=7&_pageSize=all' > /tmp/1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  114M    0  114M    0     0   144k      0 --:--:--  0:13:26 --:--:-- 3217k

(13 minutes there for enzyme/2 - enzyme/1 took less than 2 minutes and then got cached)

btw probably unrelated: - http://purl.uniprot.org/enzyme/1 and http://purl.uniprot.org/enzyme/1.-.-.- in real life gives a 400 Bad Request with Can't handle namespace: enzyme.

stain commented 9 years ago

Assigning to @ghard @yrjana for OpenLink to have a look if the nginx config for 1.4 differs from 1.3 with regards to timeouts.

ghard commented 9 years ago

The resulting SPARQL query returns 251478 rows from 1.4 virtuoso instance. No error on the backend. @antonisloizou we should cross-check with ops2.

ChristineChichester commented 9 years ago

I cannot re-create this error on either 1.3 or 1.4 using the 3-scale interface (with out the pagesize=all)

antonisloizou commented 8 years ago

There are 13012 activites that should be returned here. https://ops2.few.vu.nl/target/tree/pharmacology/pages?uri=http%3A%2F%2Fpurl.uniprot.org%2Fenzyme%2F1.-.-.-&app_id=be7ce5a9&app_key=77069eed83fceb8bb23f031c05193151&target_organism=Homo+sapiens&min-pChembl=7&_pageSize=all

It currently times out across all 1.4, 1.5 and develop, so at least its consistent.

Up until _pageSize=4000 you get results back, after that we run into :

Endpoint returned 400 Virtuoso 37000 Error SP030: SPARQL compiler, line 105: Too many arguments of a standard built-in function in operator()

The final CONSTRUCT query hasn't returned in over an hour on virtuoso, and the timeout is at 15mins. The SELECT version of it however , takes only 30s

Maybe OL, @ghard can take a look at these queries, but they are pretty expensive by definition:

SELECT:

PREFIX chembl: <http://rdf.ebi.ac.uk/terms/chembl#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX ops: <http://www.openphacts.org/api#>
PREFIX obo_goa: <http://www.semantic-systems-biology.org/ontology/rdf/OBO#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX cheminf: <http://semanticscience.org/resource/>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX qudt: <http://qudt.org/1.1/schema/qudt#>
SELECT DISTINCT ?item ?chembl_compound  WHERE {
  {
    SELECT DISTINCT ?item ?chembl_compound ?chembl_target ?assay_uri ?target_type ?assay_organism ?assay_description ?assay_type ?target_name ?target_organism ?protein ?protein_name ?published_type ?published_relation ?published_value ?published_unit ?activity_type ?activity_relation ?activity_value ?activity_unit ?qudt_uri ?pChembl ?act_comment ?document ?doi ?pmid WHERE {
      {
        SELECT DISTINCT ?chembl_target WHERE {
          ?chembl_target chembl:hasProteinClassification|chembl:hasTargetComponent/chembl:targetCmptXref|chembl:hasTargetComponent/skos:exactMatch/obo_goa:C|chembl:hasTargetComponent/skos:exactMatch/obo_goa:F|chembl:hasTargetComponent/skos:exactMatch/obo_goa:P ?class .
          VALUES ?node_uri {
            <http://purl.uniprot.org/enzyme/1.-.-.->  
          } GRAPH ?g {
            ?class rdfs:subClassOf ?node_uri .
          }
        } 
      }
      GRAPH <http://www.ebi.ac.uk/chembl> {
        {
          ?item <http://rdf.ebi.ac.uk/terms/chembl#pChembl> ?pChembl FILTER( ?pChembl >= 7 ) 
        }  {
          ?chembl_target<http://rdf.ebi.ac.uk/terms/chembl#organismName> "Homo sapiens".
        } 
        ?item a chembl:Activity ;
              chembl:hasAssay ?assay_uri ;
              chembl:hasMolecule ?chembl_compound .
        ?assay_uri chembl:hasTarget ?chembl_target .
        ?chembl_target a ?target_type .
      }
      GRAPH <http://www.ebi.ac.uk/chembl> {
        {
          ?assay_uri chembl:organismName ?assay_organism 
        }
        UNION {
          ?assay_uri dcterms:description ?assay_description 
        }
        UNION {
          ?assay_uri chembl:assayTestType ?assay_type 
        }
        UNION {
          ?chembl_target dcterms:title ?target_name 
        }
        UNION {
          ?chembl_target chembl:organismName ?target_organism 
        }
        UNION {
          ?chembl_target chembl:hasTargetComponent ?protein .
          OPTIONAL {
            GRAPH <http://www.conceptwiki.org> {
              ?cw_target skos:exactMatch ?protein ;
                         skos:prefLabel ?protein_name
            } 
          }
        }
        UNION {
          ?item chembl:publishedType ?published_type 
        }
        UNION {
          ?item chembl:publishedRelation ?published_relation 
        }
        UNION {
          ?item chembl:publishedValue ?published_value 
        }
        UNION {
          ?item chembl:publishedUnits ?published_unit 
        }
        UNION {
          ?item chembl:standardType ?activity_type 
        }
        UNION {
          ?item chembl:standardRelation ?activity_relation 
        }
        UNION {
          ?item chembl:standardValue ?std_value .
          BIND (xsd:decimal(?std_value) as ?activity_value) 
        }
        UNION {
          ?item chembl:standardUnits ?activity_unit 
        }
        UNION {
          ?item chembl:hasQUDT ?qudt_uri 
        }
        UNION {
          ?item chembl:pChembl ?pChembl 
        }
        UNION {
          ?item chembl:activityComment ?act_comment 
        }
        UNION {
          ?item chembl:hasDocument ?document .
          {
            ?document owl:sameAs ?doi 
          }
          UNION {
            ?document bibo:pmid ?pmid 
          }
        }
      } 
    } 
  }
  OPTIONAL {
    GRAPH <http://ops.rsc.org> {
      {
        ?ocrs_compound skos:exactMatch ?chembl_compound ;
                       cheminf:CHEMINF_000396 ?inchi;
                       cheminf:CHEMINF_000399 ?inchi_key;
                       cheminf:CHEMINF_000018 ?smiles .
      } UNION {
        [] obo:IAO_0000136 ?ocrs_compound ;
           a cheminf:CHEMINF_000484 ;
           qudt:numericValue ?molweight .
      }
      UNION {
        [] obo:IAO_0000136 ?ocrs_compound ;
           a cheminf:CHEMINF_000367;
           qudt:numericValue ?num_ro5_violations .
      }
      OPTIONAL {
        GRAPH <http://www.conceptwiki.org> {
          ?cw_compound skos:exactMatch ?ocrs_compound ;
                       skos:prefLabel ?compound_name .
        } 
      }
    } 
  } 
}

CONSTRUCT :

PREFIX chembl: <http://rdf.ebi.ac.uk/terms/chembl#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX ops: <http://www.openphacts.org/api#>
PREFIX obo_goa: <http://www.semantic-systems-biology.org/ontology/rdf/OBO#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX cheminf: <http://semanticscience.org/resource/>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX qudt: <http://qudt.org/1.1/schema/qudt#>
CONSTRUCT { ?item chembl:hasMolecule ?chembl_compound;
        chembl:publishedType ?published_type ;
        chembl:publishedRelation ?published_relation ;
        chembl:publishedValue ?published_value ;
        chembl:publishedUnits ?published_unit ;
        chembl:standardType ?activity_type;
        chembl:standardRelation ?activity_relation;
        chembl:standardValue ?activity_value;
        chembl:hasQUDT ?qudt_uri;
        chembl:hasAssay ?assay_uri ;
        chembl:pChembl ?pChembl ;
    chembl:activityComment ?act_comment ;
        chembl:hasDocument ?doi ;
        bibo:pmid ?pmid ;
        void:inDataset <http://www.ebi.ac.uk/chembl> .
?qudt_uri skos:prefLabel ?activity_unit .
?assay_uri chembl:hasTarget ?chembl_target ;
        chembl:assayTestType ?assay_type ;
        dcterms:description ?assay_description ;
        chembl:assayOrganismName ?assay_organism ;
        void:inDataset <http://www.ebi.ac.uk/chembl> .
?chembl_target dcterms:title ?target_name;
        chembl:targetOrganismName ?target_organism ;
    ops:classifiedUnder ?class ;
    chembl:hasTargetComponent ?protein ;
        a ?target_type ;
        void:inDataset <http://www.ebi.ac.uk/chembl> .
?chembl_compound skos:exactMatch ?ocrs_compound ;
    skos:exactMatch ?cw_compound ;
    void:inDataset <http://www.ebi.ac.uk/chembl> .
?ocrs_compound ops:smiles ?smiles ;
        ops:inchi ?inchi ;
        ops:inchikey ?inchi_key;
    ops:molweight ?molweight ;
        ops:ro5_violations ?num_ro5_violations ;
        void:inDataset <http://ops.rsc.org> .
?protein skos:exactMatch ?cw_target .
?cw_target skos:prefLabel ?protein_name ;
        void:inDataset <http://www.conceptwiki.org> .
?cw_compound skos:prefLabel ?compound_name ;
        void:inDataset <http://www.conceptwiki.org> .
  }  WHERE { 
{ SELECT DISTINCT ?item ?chembl_compound ?chembl_target ?assay_uri ?target_type ?assay_organism ?assay_description ?assay_type ?target_name ?target_organism ?protein ?protein_name ?published_type ?published_relation ?published_value ?published_unit ?activity_type ?activity_relation ?activity_value ?activity_unit ?qudt_uri ?pChembl ?act_comment ?document ?doi ?pmid WHERE {
    { SELECT DISTINCT ?chembl_target WHERE {
          ?chembl_target chembl:hasProteinClassification|chembl:hasTargetComponent/chembl:targetCmptXref|chembl:hasTargetComponent/skos:exactMatch/obo_goa:C|chembl:hasTargetComponent/skos:exactMatch/obo_goa:F|chembl:hasTargetComponent/skos:exactMatch/obo_goa:P ?class .
            VALUES ?node_uri { <http://purl.uniprot.org/enzyme/1.-.-.->  } GRAPH ?g {
            ?class rdfs:subClassOf ?node_uri .
          }
    } }
    GRAPH <http://www.ebi.ac.uk/chembl> { { ?item <http://rdf.ebi.ac.uk/terms/chembl#pChembl> ?pChembl FILTER( ?pChembl >= 7 ) }  { ?chembl_target<http://rdf.ebi.ac.uk/terms/chembl#organismName> "Homo sapiens". } 
        ?item a chembl:Activity ;
              chembl:hasAssay ?assay_uri ;
              chembl:hasMolecule ?chembl_compound .
        ?assay_uri chembl:hasTarget ?chembl_target .
        ?chembl_target a ?target_type .
    }
        GRAPH <http://www.ebi.ac.uk/chembl> {
          { ?assay_uri chembl:organismName ?assay_organism }
          UNION { ?assay_uri dcterms:description ?assay_description }
          UNION { ?assay_uri chembl:assayTestType ?assay_type }
          UNION { ?chembl_target dcterms:title ?target_name }
          UNION { ?chembl_target chembl:organismName ?target_organism }
          UNION { ?chembl_target chembl:hasTargetComponent ?protein .
            OPTIONAL {
              GRAPH <http://www.conceptwiki.org> {
            ?cw_target skos:exactMatch ?protein ;
                   skos:prefLabel ?protein_name
              } 
            }
          }
          UNION { ?item chembl:publishedType ?published_type }
          UNION { ?item chembl:publishedRelation ?published_relation }
          UNION { ?item chembl:publishedValue ?published_value }
          UNION { ?item chembl:publishedUnits ?published_unit }
          UNION { ?item chembl:standardType ?activity_type }
          UNION { ?item chembl:standardRelation ?activity_relation }
          UNION { ?item chembl:standardValue ?std_value .
            BIND (xsd:decimal(?std_value) as ?activity_value) 
          }
          UNION { ?item chembl:standardUnits ?activity_unit }
          UNION { ?item chembl:hasQUDT ?qudt_uri }
          UNION { ?item chembl:pChembl ?pChembl }
          UNION { ?item chembl:activityComment ?act_comment }
          UNION { ?item chembl:hasDocument ?document .
            { ?document owl:sameAs ?doi }
            UNION { ?document bibo:pmid ?pmid }
          }
        } 
} }
OPTIONAL {
    GRAPH <http://ops.rsc.org> {
    { ?ocrs_compound skos:exactMatch ?chembl_compound ;
            cheminf:CHEMINF_000396 ?inchi;
        cheminf:CHEMINF_000399 ?inchi_key;
        cheminf:CHEMINF_000018 ?smiles .
    } UNION {
        [] obo:IAO_0000136 ?ocrs_compound ;
        a cheminf:CHEMINF_000484 ;
        qudt:numericValue ?molweight .
    }
    UNION {
        [] obo:IAO_0000136 ?ocrs_compound ;
        a cheminf:CHEMINF_000367;
        qudt:numericValue ?num_ro5_violations .
    }
    OPTIONAL {
        GRAPH <http://www.conceptwiki.org> {
            ?cw_compound skos:exactMatch ?ocrs_compound ;
                skos:prefLabel ?compound_name .
        } 
    }
    } 
} }