@@ -0,0 +1,2656 @@
+/*%0A * Copyright (C) 2006 WTSI & EBI%0A *%0A * This library is free software; you can redistribute it and/or modify it under the terms of the%0A * GNU Lesser General Public License as published by the Free Software Foundation; either version%0A * 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 WARRANTY; without%0A * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU%0A * Lesser General Public License for more details.%0A *%0A * You should have received a copy of the GNU Lesser General Public License along with this library;%0A * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA%0A * 02111-1307 USA%0A */%0A%0Apackage org.ensembl.healthcheck.testcase.generic;%0A%0Aimport java.sql.Connection;%0A%0Aimport org.ensembl.healthcheck.DatabaseRegistryEntry;%0Aimport org.ensembl.healthcheck.DatabaseType;%0Aimport org.ensembl.healthcheck.ReportManager;%0Aimport org.ensembl.healthcheck.testcase.SingleDatabaseTestCase;%0A%0A/**%0A * Check for HGNCs that have been assigned as display labels more than one gene.%0A */%0A%0Apublic class HGNCMultipleGenes extends SingleDatabaseTestCase %7B%0A%0A%09/**%0A%09 * Creates a new instance of Ditag.%0A%09 */%0A%09public HGNCMultipleGenes() %7B%0A%0A%09%09addToGroup(%22post_genebuild%22);%0A%09%09addToGroup(%22release%22);%0A%09%09setDescription(%22Check for HGNCs that have been assigned as display labels more than one gene.%22);%0A%0A%09%7D%0A%0A%09/**%0A%09 * This test only applies to core databases.%0A%09 */%0A%09public void types() %7B%0A%0A%09%09removeAppliesToType(DatabaseType.OTHERFEATURES);%0A%09%09removeAppliesToType(DatabaseType.ESTGENE);%0A%09%09removeAppliesToType(DatabaseType.VEGA);%0A%09%09removeAppliesToType(DatabaseType.CDNA);%0A%0A%09%7D%0A%0A%09/**%0A%09 * Test various things about ditag features.%0A%09 * %0A%09 * @param dbre%0A%09 *          The database to use.%0A%09 * @return Result.%0A%09 */%0A%09public boolean run(DatabaseRegistryEntry dbre) %7B%0A%0A%09%09boolean result = true;%0A%0A%09%09Connection con = dbre.getConnection();%0A%0A%09%09// this has to be done the slow way, don't think there's a way to do this all at once%0A%09%09int rows = getRowCount(con, %22SELECT DISTINCT(x.display_label), COUNT(*) AS count FROM gene g, xref x, external_db e WHERE e.external_db_id=x.external_db_id AND e.db_name='HUGO' AND x.xref_id=g.display_xref_id GROUP BY x.display_label HAVING COUNT %3E 1%22);%0A%0A%09%09if (rows %3E 0) %7B%0A%0A%09%09%09ReportManager.problem(this, con, rows + %22 HGNC symbols have been assigned to more than one gene%22);%0A%09%09%09result = false;%0A%0A%09%09%7D else %7B%0A%0A%09%09%09ReportManager.correct(this, con, %22All HGNC symbols only assigned to one gene%22);%0A%09%09%7D%0A%0A%09%09return result;%0A%0A%09%7D%0A%0A%09// ----------------------------------------------------------------------%0A%0A%7D%0A

Check for HGNCs that have been assigned as display labels more than one gene.