@@ -0,0 +1,2798 @@
+/*%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 */%0A%0Apackage org.ensembl.healthcheck.testcase;%0A%0Aimport java.sql.*;%0A%0Aimport org.ensembl.healthcheck.*;%0A%0Aimport org.ensembl.healthcheck.util.*;%0A%0A/*%0A * Check that marker features exist if markers exist, and that map_wieghts are%0A * set to non-zero values%0A */%0Apublic class CheckMarkerFeaturesTestCase extends EnsTestCase %7B%0A  %0A  /**%0A   * Creates a new instance of CheckAllTranscriptsBelongToAGeneTestCase%0A   */%0A  public CheckMarkerFeaturesTestCase() %7B%0A    addToGroup(%22db_constraints%22);%0A    setDescription(%22Checks that marker_features exist and that they have%22%0A%09%09   + %22 non-zero map_weights%22);%0A  %7D%0A  %0A  /** %0A   * Verify marker features exist if markers exist, and that map weights != 0%0A   * @return Result.%0A   */%0A  public TestResult run() %7B%0A    DatabaseConnectionIterator it = getDatabaseConnectionIterator();%0A    %0A    boolean result = true;%0A%0A    while (it.hasNext()) %7B%0A      %0A      Connection con = (Connection)it.next();%0A      boolean markersExist = %0A%09  getRowCount(con, %22select count(*) from marker%22) %3E 0;%0A%0A      /* %0A       * assume this species has no markers, dangling refs test case will%0A       * catch problem if marker_features exist without markers %0A       */%0A      if (!markersExist) %7B%0A%09  ReportManager.info(this, con, %22Marker features appear to be ok%22);%0A%09  continue;%0A      %7D%0A%0A      int count = getRowCount(con, %22select count(*) from marker_feature%22);%0A      %0A      %0A      if(count == 0) %7B%0A%09  ReportManager.problem(this, con, %22no marker features in database%22%0A%09%09%09%09+ %22even though markers are present%22);%0A%09  result = false;%0A%09  continue;%0A      %7D%0A      %0A      count = getRowCount(con, %22select count(*) from marker_feature%22%0A%09%09%09  + %22 where map_weight = 0%22); %0A      %0A      if(count %3E 0) %7B%0A%09  ReportManager.problem(this, con, %22marker features have not been%22 +%0A%09%09%09%09%22assigned correct map weights%22);%0A%09  result = false;%0A%09  continue;%0A      %7D%0A%0A      ReportManager.info(this, con, %22Marker features appear to be ok%22);%0A    %7D // while connection%0A    %0A    return new TestResult(getShortTestName(), result);%0A    %0A  %7D // run%0A  %0A%7D // CheckMarkerFeaturesTestCase%0A

test case to ensure marker_features are present if markers exist, and that map weights look ok