Moving HelpConstants out of HelpUtils so that we stop getting these ProgramElementDoc errors when com.sun.javadoc cannot load on a user's system.
This commit is contained in:
parent
22d13ccdab
commit
8822b8e7c8
|
|
@ -32,8 +32,8 @@ import org.apache.log4j.PatternLayout;
|
||||||
import org.broadinstitute.sting.gatk.CommandLineGATK;
|
import org.broadinstitute.sting.gatk.CommandLineGATK;
|
||||||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||||
import org.broadinstitute.sting.utils.help.ApplicationDetails;
|
import org.broadinstitute.sting.utils.help.ApplicationDetails;
|
||||||
|
import org.broadinstitute.sting.utils.help.HelpConstants;
|
||||||
import org.broadinstitute.sting.utils.help.HelpFormatter;
|
import org.broadinstitute.sting.utils.help.HelpFormatter;
|
||||||
import org.broadinstitute.sting.utils.help.HelpUtils;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -289,7 +289,7 @@ public abstract class CommandLineProgram {
|
||||||
*/
|
*/
|
||||||
private static void printDocumentationReference() {
|
private static void printDocumentationReference() {
|
||||||
errorPrintf("Visit our website and forum for extensive documentation and answers to %n");
|
errorPrintf("Visit our website and forum for extensive documentation and answers to %n");
|
||||||
errorPrintf("commonly asked questions " + HelpUtils.BASE_GATK_URL + "%n");
|
errorPrintf("commonly asked questions " + HelpConstants.BASE_GATK_URL + "%n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,7 @@ import org.broadinstitute.sting.gatk.refdata.tracks.FeatureManager;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Attribution;
|
import org.broadinstitute.sting.gatk.walkers.Attribution;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Walker;
|
import org.broadinstitute.sting.gatk.walkers.Walker;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.help.ApplicationDetails;
|
import org.broadinstitute.sting.utils.help.*;
|
||||||
import org.broadinstitute.sting.utils.help.DocumentedGATKFeature;
|
|
||||||
import org.broadinstitute.sting.utils.help.GATKDocUtils;
|
|
||||||
import org.broadinstitute.sting.utils.help.HelpUtils;
|
|
||||||
import org.broadinstitute.sting.utils.text.TextFormattingUtils;
|
import org.broadinstitute.sting.utils.text.TextFormattingUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -161,7 +158,7 @@ public class CommandLineGATK extends CommandLineExecutable {
|
||||||
List<String> header = new ArrayList<String>();
|
List<String> header = new ArrayList<String>();
|
||||||
header.add(String.format("The Genome Analysis Toolkit (GATK) v%s, Compiled %s",getVersionNumber(), getBuildTime()));
|
header.add(String.format("The Genome Analysis Toolkit (GATK) v%s, Compiled %s",getVersionNumber(), getBuildTime()));
|
||||||
header.add("Copyright (c) 2010 The Broad Institute");
|
header.add("Copyright (c) 2010 The Broad Institute");
|
||||||
header.add("For support and documentation go to " + HelpUtils.BASE_GATK_URL);
|
header.add("For support and documentation go to " + HelpConstants.BASE_GATK_URL);
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ package org.broadinstitute.sting.gatk.filters;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
import org.broadinstitute.sting.utils.classloader.PluginManager;
|
||||||
import org.broadinstitute.sting.utils.help.GATKDocUtils;
|
import org.broadinstitute.sting.utils.help.GATKDocUtils;
|
||||||
import org.broadinstitute.sting.utils.help.HelpUtils;
|
import org.broadinstitute.sting.utils.help.HelpConstants;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -71,7 +71,7 @@ public class FilterManager extends PluginManager<ReadFilter> {
|
||||||
|
|
||||||
return String.format("Read filter %s not found. Available read filters:%n%n%s%n%n%s",pluginName,
|
return String.format("Read filter %s not found. Available read filters:%n%n%s%n%n%s",pluginName,
|
||||||
userFriendlyListofReadFilters(availableFilters),
|
userFriendlyListofReadFilters(availableFilters),
|
||||||
"Please consult the GATK Documentation (" + HelpUtils.GATK_DOCS_URL + ") for more information.");
|
"Please consult the GATK Documentation (" + HelpConstants.GATK_DOCS_URL + ") for more information.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String userFriendlyListofReadFilters(List<Class<? extends ReadFilter>> filters) {
|
private String userFriendlyListofReadFilters(List<Class<? extends ReadFilter>> filters) {
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.MathUtils;
|
import org.broadinstitute.sting.utils.MathUtils;
|
||||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
|
import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
|
||||||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||||
import org.broadinstitute.sting.utils.help.HelpUtils;
|
import org.broadinstitute.sting.utils.help.HelpConstants;
|
||||||
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
import org.broadinstitute.sting.utils.variantcontext.writer.VariantContextWriter;
|
||||||
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
|
||||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
|
|
@ -81,7 +81,7 @@ public class VariantDataManager {
|
||||||
final double theSTD = standardDeviation(theMean, iii);
|
final double theSTD = standardDeviation(theMean, iii);
|
||||||
logger.info( annotationKeys.get(iii) + String.format(": \t mean = %.2f\t standard deviation = %.2f", theMean, theSTD) );
|
logger.info( annotationKeys.get(iii) + String.format(": \t mean = %.2f\t standard deviation = %.2f", theMean, theSTD) );
|
||||||
if( Double.isNaN(theMean) ) {
|
if( Double.isNaN(theMean) ) {
|
||||||
throw new UserException.BadInput("Values for " + annotationKeys.get(iii) + " annotation not detected for ANY training variant in the input callset. VariantAnnotator may be used to add these annotations. See " + HelpUtils.forumPost("discussion/49/using-variant-annotator"));
|
throw new UserException.BadInput("Values for " + annotationKeys.get(iii) + " annotation not detected for ANY training variant in the input callset. VariantAnnotator may be used to add these annotations. See " + HelpConstants.forumPost("discussion/49/using-variant-annotator"));
|
||||||
}
|
}
|
||||||
|
|
||||||
foundZeroVarianceAnnotation = foundZeroVarianceAnnotation || (theSTD < 1E-6);
|
foundZeroVarianceAnnotation = foundZeroVarianceAnnotation || (theSTD < 1E-6);
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ import net.sf.samtools.SAMSequenceDictionary;
|
||||||
import org.broadinstitute.sting.gatk.phonehome.GATKRunReport;
|
import org.broadinstitute.sting.gatk.phonehome.GATKRunReport;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.help.DocumentedGATKFeature;
|
import org.broadinstitute.sting.utils.help.DocumentedGATKFeature;
|
||||||
import org.broadinstitute.sting.utils.help.HelpUtils;
|
import org.broadinstitute.sting.utils.help.HelpConstants;
|
||||||
import org.broadinstitute.sting.utils.sam.ReadUtils;
|
import org.broadinstitute.sting.utils.sam.ReadUtils;
|
||||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||||
|
|
||||||
|
|
@ -278,7 +278,7 @@ public class UserException extends ReviewedStingException {
|
||||||
|
|
||||||
public static class ReadMissingReadGroup extends MalformedBAM {
|
public static class ReadMissingReadGroup extends MalformedBAM {
|
||||||
public ReadMissingReadGroup(SAMRecord read) {
|
public ReadMissingReadGroup(SAMRecord read) {
|
||||||
super(read, String.format("Read %s is either missing the read group or its read group is not defined in the BAM header, both of which are required by the GATK. Please use " + HelpUtils.forumPost("discussion/59/companion-utilities-replacereadgroups to fix this problem"), read.getReadName()));
|
super(read, String.format("Read %s is either missing the read group or its read group is not defined in the BAM header, both of which are required by the GATK. Please use " + HelpConstants.forumPost("discussion/59/companion-utilities-replacereadgroups to fix this problem"), read.getReadName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -354,7 +354,7 @@ public class UserException extends ReviewedStingException {
|
||||||
super(String.format("Lexicographically sorted human genome sequence detected in %s."
|
super(String.format("Lexicographically sorted human genome sequence detected in %s."
|
||||||
+ "\nFor safety's sake the GATK requires human contigs in karyotypic order: 1, 2, ..., 10, 11, ..., 20, 21, 22, X, Y with M either leading or trailing these contigs."
|
+ "\nFor safety's sake the GATK requires human contigs in karyotypic order: 1, 2, ..., 10, 11, ..., 20, 21, 22, X, Y with M either leading or trailing these contigs."
|
||||||
+ "\nThis is because all distributed GATK resources are sorted in karyotypic order, and your processing will fail when you need to use these files."
|
+ "\nThis is because all distributed GATK resources are sorted in karyotypic order, and your processing will fail when you need to use these files."
|
||||||
+ "\nYou can use the ReorderSam utility to fix this problem: " + HelpUtils.forumPost("discussion/58/companion-utilities-reordersam")
|
+ "\nYou can use the ReorderSam utility to fix this problem: " + HelpConstants.forumPost("discussion/58/companion-utilities-reordersam")
|
||||||
+ "\n %s contigs = %s",
|
+ "\n %s contigs = %s",
|
||||||
name, name, ReadUtils.prettyPrintSequenceRecords(dict)));
|
name, name, ReadUtils.prettyPrintSequenceRecords(dict)));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ public class ForumAPIUtils {
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
List<String> output = new ArrayList<String>();
|
List<String> output = new ArrayList<String>();
|
||||||
|
|
||||||
String text = httpGet(HelpUtils.GATK_FORUM_API_URL + "categories.json?CategoryIdentifier=tool-bulletin&page=1-100000&" + ACCESS_TOKEN + forumKey);
|
String text = httpGet(HelpConstants.GATK_FORUM_API_URL + "categories.json?CategoryIdentifier=tool-bulletin&page=1-100000&" + ACCESS_TOKEN + forumKey);
|
||||||
|
|
||||||
APIQuery details = gson.fromJson(text, APIQuery.class);
|
APIQuery details = gson.fromJson(text, APIQuery.class);
|
||||||
ForumDiscussion[] discussions = details.Discussions;
|
ForumDiscussion[] discussions = details.Discussions;
|
||||||
|
|
@ -158,7 +158,7 @@ public class ForumAPIUtils {
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
|
|
||||||
String data = gson.toJson(post.getPostData());
|
String data = gson.toJson(post.getPostData());
|
||||||
httpPost(data, HelpUtils.GATK_FORUM_API_URL + "post/discussion.json?" + ACCESS_TOKEN + forumKey);
|
httpPost(data, HelpConstants.GATK_FORUM_API_URL + "post/discussion.json?" + ACCESS_TOKEN + forumKey);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ public class GATKDocUtils {
|
||||||
/**
|
/**
|
||||||
* The URL root for RELEASED GATKDOC units
|
* The URL root for RELEASED GATKDOC units
|
||||||
*/
|
*/
|
||||||
public final static String URL_ROOT_FOR_RELEASE_GATKDOCS = HelpUtils.GATK_DOCS_URL;
|
public final static String URL_ROOT_FOR_RELEASE_GATKDOCS = HelpConstants.GATK_DOCS_URL;
|
||||||
/**
|
/**
|
||||||
* The URL root for STABLE GATKDOC units
|
* The URL root for STABLE GATKDOC units
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,81 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2011, The Broad Institute
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person
|
||||||
|
* obtaining a copy of this software and associated documentation
|
||||||
|
* files (the "Software"), to deal in the Software without
|
||||||
|
* restriction, including without limitation the rights to use,
|
||||||
|
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following
|
||||||
|
* conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be
|
||||||
|
* included in all copies or substantial portions of the Software.
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.broadinstitute.sting.utils.help;
|
||||||
|
|
||||||
|
import com.sun.javadoc.FieldDoc;
|
||||||
|
import com.sun.javadoc.PackageDoc;
|
||||||
|
import com.sun.javadoc.ProgramElementDoc;
|
||||||
|
import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
public class HelpConstants {
|
||||||
|
|
||||||
|
public final static String BASE_GATK_URL = "http://www.broadinstitute.org/gatk";
|
||||||
|
public final static String GATK_DOCS_URL = BASE_GATK_URL + "/gatkdocs/";
|
||||||
|
public final static String GATK_FORUM_URL = "http://gatkforums.broadinstitute.org/";
|
||||||
|
public final static String GATK_FORUM_API_URL = "https://gatkforums.broadinstitute.org/api/v1/";
|
||||||
|
|
||||||
|
public static String forumPost(String post) {
|
||||||
|
return GATK_FORUM_URL + post;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static boolean assignableToClass(ProgramElementDoc classDoc, Class lhsClass, boolean requireConcrete) {
|
||||||
|
try {
|
||||||
|
Class type = getClassForDoc(classDoc);
|
||||||
|
return lhsClass.isAssignableFrom(type) && (!requireConcrete || JVMUtils.isConcrete(type));
|
||||||
|
} catch (Throwable t) {
|
||||||
|
// Ignore errors.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static Class getClassForDoc(ProgramElementDoc doc) throws ClassNotFoundException {
|
||||||
|
return Class.forName(getClassName(doc));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static Field getFieldForFieldDoc(FieldDoc fieldDoc) {
|
||||||
|
try {
|
||||||
|
Class clazz = getClassForDoc(fieldDoc.containingClass());
|
||||||
|
return JVMUtils.findField(clazz, fieldDoc.name());
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reconstitute the class name from the given class JavaDoc object.
|
||||||
|
*
|
||||||
|
* @param doc the Javadoc model for the given class.
|
||||||
|
* @return The (string) class name of the given class.
|
||||||
|
*/
|
||||||
|
protected static String getClassName(ProgramElementDoc doc) {
|
||||||
|
PackageDoc containingPackage = doc.containingPackage();
|
||||||
|
return containingPackage.name().length() > 0 ?
|
||||||
|
String.format("%s.%s", containingPackage.name(), doc.name()) :
|
||||||
|
String.format("%s", doc.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -33,15 +33,6 @@ import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class HelpUtils {
|
public class HelpUtils {
|
||||||
|
|
||||||
public final static String BASE_GATK_URL = "http://www.broadinstitute.org/gatk";
|
|
||||||
public final static String GATK_DOCS_URL = BASE_GATK_URL + "/gatkdocs/";
|
|
||||||
public final static String GATK_FORUM_URL = "http://gatkforums.broadinstitute.org/";
|
|
||||||
public final static String GATK_FORUM_API_URL = "https://gatkforums.broadinstitute.org/api/v1/";
|
|
||||||
|
|
||||||
public static String forumPost(String post) {
|
|
||||||
return GATK_FORUM_URL + post;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static boolean assignableToClass(ProgramElementDoc classDoc, Class lhsClass, boolean requireConcrete) {
|
protected static boolean assignableToClass(ProgramElementDoc classDoc, Class lhsClass, boolean requireConcrete) {
|
||||||
try {
|
try {
|
||||||
Class type = getClassForDoc(classDoc);
|
Class type = getClassForDoc(classDoc);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue