@@ -0,0 +1,3272 @@
+/*%0A Copyright (C) 2003 EBI, GRL%0A%0A This library is free software; you can redistribute it and/or%0A modify it under the terms of the GNU Lesser General Public%0A License as published by the Free Software Foundation; either%0A 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,%0A but WITHOUT ANY WARRANTY; without even the implied warranty of%0A 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%0A License along with this library; if not, write to the Free Software%0A Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA%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.SingleDatabaseTestCase;%0A%0A/**%0A * Check that there are Interpro descriptions, that each one has an xref, and that the xref has a description.%0A */%0A%0Apublic class InterproDescriptions extends SingleDatabaseTestCase %7B%0A%0A    /**%0A     * Create a new InterproDescriptions testcase.%0A     */%0A    public InterproDescriptions() %7B%0A%0A        addToGroup(%22post_genebuild%22);%0A        addToGroup(%22release%22);%0A        setDescription(%22Check that the repeat_type column of the repeat_consensus table is NOT populated.%22);%0A%0A    %7D%0A%0A    /**%0A     * Run the test.%0A     * %0A     * @param dbre The database to use.%0A     * @return true if the test pased.%0A     *  %0A     */%0A    public boolean run(DatabaseRegistryEntry dbre) %7B%0A%0A        boolean result = true;%0A%0A        Connection con = dbre.getConnection();%0A%0A        // check that the interpro table has some rows%0A        String sql = %22SELECT COUNT(*) FROM interpro%22;%0A%0A        int rows = getRowCount(con, sql);%0A        if (rows == 0) %7B%0A%0A            ReportManager.problem(this, con, %22Interpro table is empty (no xref checks done).%22);%0A            return false;%0A%0A        %7D else %7B%0A%0A            ReportManager.correct(this, con, %22Interpro table not empty%22);%0A        %7D%0A%0A        // check that there are no Interpro accessions without xrefs%0A        sql = %22SELECT count(*) FROM interpro i LEFT JOIN xref x ON i.interpro_ac=x.dbprimary_acc WHERE x.dbprimary_acc IS NULL%22;%0A%0A        rows = getRowCount(con, sql);%0A        if (rows %3E 0) %7B%0A%0A            ReportManager.problem(this, con, %22There are %22 + rows + %22 rows in the interpro table that have no associated xref%22);%0A            result = false;%0A%0A        %7D else %7B%0A%0A            ReportManager.correct(this, con, %22All Interpro accessions have xrefs%22);%0A        %7D%0A%0A        // check that the description field is populated for all of them%0A        sql = %22SELECT COUNT(*) FROM interpro i, xref x WHERE i.interpro_ac=x.dbprimary_acc AND x.description IS NULL%22;%0A%0A        rows = getRowCount(con, sql);%0A        if (rows %3E 0) %7B%0A%0A            ReportManager.problem(this, con, %22There are %22 + rows + %22 Interpro xrefs with missing descriptions%22);%0A            result = false;%0A%0A        %7D else %7B%0A%0A            ReportManager.correct(this, con, %22All Interpro accessions have xref descriptions%22);%0A        %7D%0A        %0A        return result;%0A%0A    %7D // run%0A    %0A%7D // InterproDescriptions%0A

Check that there are Interpro descriptions, that each one has an xref, and that the xref has a description.