@@ -0,0 +1,2731 @@
+/*%0A * Copyright (C) 2004 EBI, GRL%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.ReportManager;%0Aimport org.ensembl.healthcheck.testcase.Priority;%0Aimport org.ensembl.healthcheck.testcase.SingleDatabaseTestCase;%0A%0A/**%0A * Check that the number of entries in the seq_region_attrib table specifying that the MT chromosome should use codon table 2%0A * matches the number of MT chromosomes (may be several different assemblies) %0A */%0Apublic class MTCodonTable extends SingleDatabaseTestCase %7B%0A%0A%09/**%0A%09 * Creates a new instance of MTCodonTable%0A%09 */%0A%09public MTCodonTable() %7B%0A%0A%09%09addToGroup(%22post_genebuild%22);%0A%09%09addToGroup(%22release%22);%0A%09%09setDescription(%22Check that the number of entries in the seq_region_attrib table specifying that the MT chromosome should use codon table 2 matches the number of MT chromosomes (may be several different assemblies)%22);%0A%09%09setPriority(Priority.AMBER);%0A%09%09setFix(%22Add seq_region_attribs%22);%0A%09%09setTeamResponsible(%22Genebuilders%22);%0A%0A%09%7D%0A%0A%09/**%0A%09 * Run the test.%0A%09 * %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%09int numMTs = getRowCount(con, %22SELECT COUNT(DISTINCT(seq_region_id)) FROM seq_region WHERE name = 'MT'%22);%0A%09%09%0A%09%09int numAttribs = getRowCount(con, %22SELECT COUNT(DISTINCT(sra.seq_region_id)) FROM seq_region sr, seq_region_attrib sra, attrib_type att WHERE sr.seq_region_id=sra.seq_region_id AND sra.attrib_type_id=att.attrib_type_id AND att.code = 'codon_table' AND sra.value = '2' AND sr.name = 'MT'%22);%0A%09%09%0A%09%09if (numMTs != numAttribs) %7B%0A%09%09%09%0A%09%09%09ReportManager.problem(this, con, %22There are %22 + numMTs + %22 seq_region entries named 'MT' but %22 + numAttribs + %22 seq_region_attribs specifying that they should use codon table 2%22);%0A%09%09%09result = false;%0A%09%09%7D%0A%09%09%0A%09%09return result;%0A%0A%09%7D // run%0A%0A%09// -----------------------------------------------------------------------%0A%0A%7D // MTCodonTable%0A%0A

Check that the number of entries in the seq_region_attrib table specifying that the MT chromosome should use codon table 2 matches the number of MT chromosomes (may be several different assemblies)