Register GATK-full-only walkers and rethrow the missing walker error as a not supported in GATK lite error

This commit is contained in:
Eric Banks 2012-07-25 14:11:03 -04:00
parent a5721a8846
commit 357e0b35af
3 changed files with 24 additions and 2 deletions

View File

@ -281,7 +281,14 @@ public class GenomeAnalysisEngine {
* @return An instance of the walker.
*/
public Walker<?, ?> getWalkerByName(String walkerName) {
return walkerManager.createByName(walkerName);
try {
return walkerManager.createByName(walkerName);
} catch ( UserException e ) {
if ( isGATKLite() && GATKLiteUtils.isAvailableOnlyInFullGATK(walkerName) ) {
e = new UserException.NotSupportedInGATKLite("the " + walkerName + " walker is available only in the full version of the GATK");
}
throw e;
}
}
/**

View File

@ -41,6 +41,21 @@ public class GATKLiteUtils {
*/
private GATKLiteUtils() { }
private static Set<String> fullVersionGATKWalkers = new HashSet<String>();
static {
fullVersionGATKWalkers.add("HaplotypeCaller");
fullVersionGATKWalkers.add("ReduceReads");
}
/**
* Utility method to check whether a given walker is only available in the full GATK release
*
* @param walkerName the walker class name (not the package) to check
*/
public static boolean isAvailableOnlyInFullGATK(final String walkerName) {
return fullVersionGATKWalkers.contains(walkerName);
}
/**
* Utility method to determine whether this is the lite version of the GATK
*/

View File

@ -80,7 +80,7 @@ public class UserException extends ReviewedStingException {
public static class NotSupportedInGATKLite extends UserException {
public NotSupportedInGATKLite(String message) {
super(String.format("GATK Lite does support all of the features of the full version: %s", message));
super(String.format("GATK Lite does not support all of the features of the full version: %s", message));
}
}