From 67ac9dab06cf4762f4d423a2af0bbc131d75aa2d Mon Sep 17 00:00:00 2001
From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04>
Date: Mon, 17 Nov 2008 13:49:29 +0000
Subject: [PATCH] add getTopLevelOrganisms and
 getOrganismsContainingSrcFeatures

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@9369 ee4ac58c-ac51-4696-9907-e4b3aa274f04
---
 artemis_sqlmap/Organism.xml | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/artemis_sqlmap/Organism.xml b/artemis_sqlmap/Organism.xml
index fd6bcb27d..cdf992c34 100644
--- a/artemis_sqlmap/Organism.xml
+++ b/artemis_sqlmap/Organism.xml
@@ -59,5 +59,26 @@
 			f.feature_id=$featureId$
 		</isNull>
     </select>
+	
+	<select id="getOrganismsContainingSrcFeatures" resultClass="org.gmod.schema.organism.Organism">
+	  SELECT DISTINCT ON( feature.organism_id )  
+		organism.organism_id AS organismId, abbreviation, genus, species, common_name AS commonName, comment
+		FROM feature 
+		join  organism using (organism_id) 
+		join cvterm on feature.type_id = cvterm.cvterm_id 
+		WHERE residues notnull AND residues != '' 
+		AND ( <include refid="source_feature_cvterm_names"/> ) 
+	</select>
+	
+	<select id="getTopLevelOrganisms" resultClass="org.gmod.schema.organism.Organism">
+	  SELECT DISTINCT ON( feature.organism_id )  
+		organism.organism_id AS organismId, abbreviation, genus, species, common_name AS commonName, comment
+		FROM feature 
+		join  organism using (organism_id) 
+		join cvterm on feature.type_id = cvterm.cvterm_id 
+		JOIN featureprop using (feature_id)
+		WHERE featureprop.type_id in 
+		  (SELECT cvterm_id FROM cvterm JOIN cv using (cv_id) WHERE cv.name = 'genedb_misc' AND cvterm.name = 'top_level_seq' ) 
+	</select>	
  
 </sqlMap> 
-- 
GitLab