Requested by Geraldine: adding a utility to register deprecated walkers (and the major version of the first release since they were removed) so that the User Error printed out for e.g. CountCovariates now states: Walker CountCovariates is no longer available in the GATK; it has been deprecated since version 2.0.
This commit is contained in:
parent
7cf4b63d76
commit
56f8afab97
|
|
@ -274,6 +274,38 @@ public class GenomeAnalysisEngine {
|
|||
//return result;
|
||||
}
|
||||
|
||||
// TODO -- Let's move this to a utility class in unstable - but which one?
|
||||
// **************************************************************************************
|
||||
// * Handle Deprecated Walkers *
|
||||
// **************************************************************************************
|
||||
|
||||
// Mapping from walker name to major version number where the walker first disappeared
|
||||
private static Map<String, String> deprecatedGATKWalkers = new HashMap<String, String>();
|
||||
static {
|
||||
deprecatedGATKWalkers.put("CountCovariates", "2.0");
|
||||
deprecatedGATKWalkers.put("TableRecalibration", "2.0");
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method to check whether a given walker has been deprecated in a previous GATK release
|
||||
*
|
||||
* @param walkerName the walker class name (not the full package) to check
|
||||
*/
|
||||
public static boolean isDeprecatedWalker(final String walkerName) {
|
||||
return deprecatedGATKWalkers.containsKey(walkerName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method to check whether a given walker has been deprecated in a previous GATK release
|
||||
*
|
||||
* @param walkerName the walker class name (not the full package) to check
|
||||
*/
|
||||
public static String getDeprecatedMajorVersionNumber(final String walkerName) {
|
||||
return deprecatedGATKWalkers.get(walkerName);
|
||||
}
|
||||
|
||||
// **************************************************************************************
|
||||
|
||||
/**
|
||||
* Retrieves an instance of the walker based on the walker name.
|
||||
*
|
||||
|
|
@ -287,6 +319,9 @@ public class GenomeAnalysisEngine {
|
|||
if ( isGATKLite() && GATKLiteUtils.isAvailableOnlyInFullGATK(walkerName) ) {
|
||||
e = new UserException.NotSupportedInGATKLite("the " + walkerName + " walker is available only in the full version of the GATK");
|
||||
}
|
||||
else if ( isDeprecatedWalker(walkerName) ) {
|
||||
e = new UserException.DeprecatedWalker(walkerName, getDeprecatedMajorVersionNumber(walkerName));
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -316,9 +316,9 @@ public class UserException extends ReviewedStingException {
|
|||
|
||||
|
||||
|
||||
public static class MissingWalker extends UserException {
|
||||
public MissingWalker(String walkerName, String message) {
|
||||
super(String.format("Walker %s is not available: %s", walkerName, message));
|
||||
public static class DeprecatedWalker extends UserException {
|
||||
public DeprecatedWalker(String walkerName, String version) {
|
||||
super(String.format("Walker %s is no longer available in the GATK; it has been deprecated since version %s", walkerName, version));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue