@@ -0,0 +1,2943 @@
+/*%0A * Copyright (C) 2012 EBI, GRL%0A * %0A * This library is free software; you can redistribute it and/or modify it under the%0A * terms of the GNU Lesser General Public License as published by the Free Software%0A * Foundation; either version 2.1 of the License, or (at your option) any later version.%0A * %0A * This library is distributed in the hope that it will be useful, but WITHOUT ANY%0A * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A%0A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.%0A * %0A * You should have received a copy of the GNU Lesser General Public License along with%0A * this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place,%0A * Suite 330, Boston, MA 02111-1307 USA%0A */%0A%0Apackage org.ensembl.healthcheck.testcase.compara;%0A%0Aimport java.sql.Connection;%0A%0Aimport org.ensembl.healthcheck.DatabaseRegistryEntry;%0Aimport org.ensembl.healthcheck.ReportManager;%0Aimport org.ensembl.healthcheck.Species;%0Aimport org.ensembl.healthcheck.Team;%0Aimport org.ensembl.healthcheck.testcase.SingleDatabaseTestCase;%0Aimport org.ensembl.healthcheck.util.DBUtils;%0A%0A%0A/**%0A * Check compara Gene Gain/Loss tables.%0A */%0A%0Apublic class CheckGeneGainLossData extends SingleDatabaseTestCase %7B%0A%0A        public CheckGeneGainLossData() %7B%0A%0A                addToGroup(%22compara_homology%22);%0A                setDescription(%22Check that we have data coming from ncRNA and protein gain/loss trees%22);%0A                setTeamResponsible(Team.COMPARA);%0A        %7D%0A%0A       /**                                                                                                                                                                                   %0A         * Run the test.%0A         *%0A         * @param dbre%0A         *          The database to use.%0A         * @return true if the test passed.%0A         *%0A         **/%0A%0A        public boolean run(DatabaseRegistryEntry dbre) %7B%0A %0A                boolean result = true;%0A%0A                Connection con = dbre.getConnection();%0A%0A                String sql_main = %22SELECT member_type, count(*)%22 + %0A                        %22 FROM gene_tree_root gtr JOIN CAFE_gene_family cgf ON(gtr.root_id=cgf.gene_tree_root_id)%22 +%0A                        %22 WHERE gtr.tree_type = 'tree' GROUP BY gtr.member_type%22;%0A%0A                int numRows = DBUtils.getRowCount(con, sql_main);%0A                if (numRows %3E 2)  %7B%0A                        ReportManager.problem(this, con, %22FAILED Gene Gain/Loss Data test. Either ncRNA or protein trees don't have gene Gain/Loss trees.%22);%0A                        ReportManager.problem(this, con, %22FAILURE DETAILS: There are less than 2 member_types %5Bprotein/ncRNA%5D having gene Gain/Loss trees.%22);%0A                        ReportManager.problem(this, con, %22USEFUL SQL: %22 + sql_main);%0A                        return false;%0A                                              %0A                %7D%0A                return true;%0A        %7D%0A%0A%7D%0A

Check if there are gene Gain/Loss trees coming from both protein and ncRNA trees