:SELECT term.*, motif.*, count(motif.id) AS c :FROM term INNER JOIN graph_path ON (graph_path.term1_id = term.id) INNER JOIN association ON (association.term_id = graph_path.term2_id) INNER JOIN gene_product_seq ON (gene_product_seq.gene_product_id = association.gene_product_id) INNER JOIN seq_dbxref ON (gene_product_seq.seq_id = seq_dbxref.seq_id) INNER JOIN dbxref AS motif ON (motif.id = seq_dbxref.dbxref_id) :WHERE [ term.acc = &term_acc& ] [ term.name = &term_name& ] [ motif_dbxref.xref_dbname = &motif_dbname& ] [ motif_dbxref.xref_key = &motif_acc& ] [ association.is_not = 0 ] :GROUP BY term.id, motif.id :HAVING c > 1 :ORDER BY c DESC :USE NESTING (set(term(motif))) // schema: go desc: gene_products have sequences attached to them, and these sequences have peptide motifs (eg from sources such as pfam and subsumed into interpro) attached to them. this query finds which protein motifs are correlated with which terms via gene product associations. requires seqdb or seqdblite example_input: term_acc => SELECT acc FROM term example_input: term_name => SELECT name FROM term ORDER BY name example_input: motif_dbname => interpro, pfam, prints, prosite, smart