Help now points to GATKDocs instead of spitting out full, garbled description
This commit is contained in:
parent
a8eb8c27f0
commit
1c63d43176
|
|
@ -36,6 +36,7 @@ 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.ApplicationDetails;
|
||||||
import org.broadinstitute.sting.utils.help.DocumentedGATKFeature;
|
import org.broadinstitute.sting.utils.help.DocumentedGATKFeature;
|
||||||
|
import org.broadinstitute.sting.utils.help.GATKDoclet;
|
||||||
import org.broadinstitute.sting.utils.text.TextFormattingUtils;
|
import org.broadinstitute.sting.utils.text.TextFormattingUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -175,12 +176,8 @@ public class CommandLineGATK extends CommandLineExecutable {
|
||||||
StringBuilder additionalHelp = new StringBuilder();
|
StringBuilder additionalHelp = new StringBuilder();
|
||||||
Formatter formatter = new Formatter(additionalHelp);
|
Formatter formatter = new Formatter(additionalHelp);
|
||||||
|
|
||||||
formatter.format("Description:%n");
|
formatter.format("For a full description of this walker, see its GATKdocs at:%n");
|
||||||
|
formatter.format("%s%n", GATKDoclet.helpLinksToGATKDocs(walkerType));
|
||||||
WalkerManager walkerManager = engine.getWalkerManager();
|
|
||||||
String walkerHelpText = walkerManager.getWalkerDescriptionText(walkerType);
|
|
||||||
|
|
||||||
printDescriptorLine(formatter,WALKER_INDENT,"",WALKER_INDENT,FIELD_SEPARATOR,walkerHelpText,TextFormattingUtils.DEFAULT_LINE_WIDTH);
|
|
||||||
|
|
||||||
return additionalHelp.toString();
|
return additionalHelp.toString();
|
||||||
}
|
}
|
||||||
|
|
@ -194,8 +191,6 @@ public class CommandLineGATK extends CommandLineExecutable {
|
||||||
StringBuilder additionalHelp = new StringBuilder();
|
StringBuilder additionalHelp = new StringBuilder();
|
||||||
Formatter formatter = new Formatter(additionalHelp);
|
Formatter formatter = new Formatter(additionalHelp);
|
||||||
|
|
||||||
formatter.format("Available analyses:%n");
|
|
||||||
|
|
||||||
// Get the list of walker names from the walker manager.
|
// Get the list of walker names from the walker manager.
|
||||||
WalkerManager walkerManager = engine.getWalkerManager();
|
WalkerManager walkerManager = engine.getWalkerManager();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,8 @@ public abstract class DocumentedGATKFeatureHandler {
|
||||||
|
|
||||||
public boolean shouldBeProcessed(ClassDoc doc) { return true; }
|
public boolean shouldBeProcessed(ClassDoc doc) { return true; }
|
||||||
|
|
||||||
public String getDestinationFilename(ClassDoc doc) {
|
public String getDestinationFilename(ClassDoc doc, Class clazz) {
|
||||||
return HelpUtils.getClassName(doc).replace(".", "_") + ".html";
|
return GATKDoclet.htmlFilenameForClass(clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract String getTemplateName(ClassDoc doc) throws IOException;
|
public abstract String getTemplateName(ClassDoc doc) throws IOException;
|
||||||
|
|
|
||||||
|
|
@ -30,19 +30,29 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by IntelliJ IDEA.
|
* Simple collection of all relevant information about something the GATKDoclet can document
|
||||||
* User: depristo
|
*
|
||||||
* Date: 7/24/11
|
* Created by IntelliJ IDEA.
|
||||||
* Time: 7:59 PM
|
* User: depristo
|
||||||
* To change this template use File | Settings | File Templates.
|
* Date: 7/24/11
|
||||||
*/
|
* Time: 7:59 PM
|
||||||
public class GATKDocWorkUnit implements Comparable<GATKDocWorkUnit> {
|
*/
|
||||||
// known at the start
|
class GATKDocWorkUnit implements Comparable<GATKDocWorkUnit> {
|
||||||
final String name, filename, group;
|
/** The class that's being documented */
|
||||||
final DocumentedGATKFeatureHandler handler;
|
|
||||||
final ClassDoc classDoc;
|
|
||||||
final Class clazz;
|
final Class clazz;
|
||||||
|
/** The name of the thing we are documenting */
|
||||||
|
final String name;
|
||||||
|
/** the filename where we will be writing the docs for this class */
|
||||||
|
final String filename;
|
||||||
|
/** The name of the documentation group (e.g., walkers, read filters) class belongs to */
|
||||||
|
final String group;
|
||||||
|
/** The documentation handler for this class */
|
||||||
|
final DocumentedGATKFeatureHandler handler;
|
||||||
|
/** The javadoc documentation for clazz */
|
||||||
|
final ClassDoc classDoc;
|
||||||
|
/** The annotation that lead to this Class being in GATKDoc */
|
||||||
final DocumentedGATKFeature annotation;
|
final DocumentedGATKFeature annotation;
|
||||||
|
/** When was this walker built, and what's the absolute version number */
|
||||||
final String buildTimestamp, absoluteVersion;
|
final String buildTimestamp, absoluteVersion;
|
||||||
|
|
||||||
// set by the handler
|
// set by the handler
|
||||||
|
|
@ -64,12 +74,21 @@ public class GATKDocWorkUnit implements Comparable<GATKDocWorkUnit> {
|
||||||
this.absoluteVersion = absoluteVersion;
|
this.absoluteVersion = absoluteVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by the GATKDoclet to set handler provided context for this work unit
|
||||||
|
* @param summary
|
||||||
|
* @param forTemplate
|
||||||
|
*/
|
||||||
public void setHandlerContent(String summary, Map<String, Object> forTemplate) {
|
public void setHandlerContent(String summary, Map<String, Object> forTemplate) {
|
||||||
this.summary = summary;
|
this.summary = summary;
|
||||||
this.forTemplate = forTemplate;
|
this.forTemplate = forTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> toMap() {
|
/**
|
||||||
|
* Return a String -> String map suitable for FreeMarker to create an index to this WorkUnit
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Map<String, String> indexDataMap() {
|
||||||
Map<String, String> data = new HashMap<String, String>();
|
Map<String, String> data = new HashMap<String, String>();
|
||||||
data.put("name", name);
|
data.put("name", name);
|
||||||
data.put("summary", summary);
|
data.put("summary", summary);
|
||||||
|
|
@ -78,6 +97,11 @@ public class GATKDocWorkUnit implements Comparable<GATKDocWorkUnit> {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort in order of the name of this WorkUnit
|
||||||
|
* @param other
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public int compareTo(GATKDocWorkUnit other) {
|
public int compareTo(GATKDocWorkUnit other) {
|
||||||
return this.name.compareTo(other.name);
|
return this.name.compareTo(other.name);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,9 @@ import java.util.*;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class GATKDoclet {
|
public class GATKDoclet {
|
||||||
|
private final static String URL_ROOT_FOR_RELEASE_GATKDOCS = "http://www.broadinstitute.org/gsa/gatkdocs/release/";
|
||||||
|
private final static String URL_ROOT_FOR_STABLE_GATKDOCS = "http://iwww.broadinstitute.org/gsa/gatkdocs/stable/";
|
||||||
|
private final static String URL_ROOT_FOR_UNSTABLE_GATKDOCS = "http://iwww.broadinstitute.org/gsa/gatkdocs/unstable/";
|
||||||
final protected static File SETTINGS_DIR = new File("settings/helpTemplates");
|
final protected static File SETTINGS_DIR = new File("settings/helpTemplates");
|
||||||
final protected static File DESTINATION_DIR = new File("gatkdocs");
|
final protected static File DESTINATION_DIR = new File("gatkdocs");
|
||||||
final protected static Logger logger = Logger.getLogger(GATKDoclet.class);
|
final protected static Logger logger = Logger.getLogger(GATKDoclet.class);
|
||||||
|
|
@ -89,6 +92,19 @@ public class GATKDoclet {
|
||||||
return showHiddenFeatures;
|
return showHiddenFeatures;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String htmlFilenameForClass(Class c) {
|
||||||
|
return c.getName().replace(".", "_") + ".html";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String helpLinksToGATKDocs(Class c) {
|
||||||
|
String classPath = htmlFilenameForClass(c);
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
b.append("release version: ").append(URL_ROOT_FOR_RELEASE_GATKDOCS).append(classPath).append("\n");
|
||||||
|
b.append("stable version: ").append(URL_ROOT_FOR_STABLE_GATKDOCS).append(classPath).append("\n");
|
||||||
|
b.append("unstable version: ").append(URL_ROOT_FOR_UNSTABLE_GATKDOCS).append(classPath).append("\n");
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
public Set<GATKDocWorkUnit> workUnits() {
|
public Set<GATKDocWorkUnit> workUnits() {
|
||||||
TreeSet<GATKDocWorkUnit> m = new TreeSet<GATKDocWorkUnit>();
|
TreeSet<GATKDocWorkUnit> m = new TreeSet<GATKDocWorkUnit>();
|
||||||
|
|
||||||
|
|
@ -103,7 +119,7 @@ public class GATKDoclet {
|
||||||
DocumentedGATKFeatureHandler handler = createHandler(doc, feature);
|
DocumentedGATKFeatureHandler handler = createHandler(doc, feature);
|
||||||
if ( handler != null && handler.shouldBeProcessed(doc) ) {
|
if ( handler != null && handler.shouldBeProcessed(doc) ) {
|
||||||
logger.info("Going to generate documentation for class " + doc);
|
logger.info("Going to generate documentation for class " + doc);
|
||||||
String filename = handler.getDestinationFilename(doc);
|
String filename = handler.getDestinationFilename(doc, clazz);
|
||||||
GATKDocWorkUnit unit = new GATKDocWorkUnit(doc.name(),
|
GATKDocWorkUnit unit = new GATKDocWorkUnit(doc.name(),
|
||||||
filename, feature.groupName(),
|
filename, feature.groupName(),
|
||||||
feature, handler, doc, clazz,
|
feature, handler, doc, clazz,
|
||||||
|
|
@ -220,7 +236,7 @@ public class GATKDoclet {
|
||||||
Set<DocumentedGATKFeature> docFeatures = new HashSet<DocumentedGATKFeature>();
|
Set<DocumentedGATKFeature> docFeatures = new HashSet<DocumentedGATKFeature>();
|
||||||
List<Map<String, String>> data = new ArrayList<Map<String, String>>();
|
List<Map<String, String>> data = new ArrayList<Map<String, String>>();
|
||||||
for ( GATKDocWorkUnit workUnit : indexData ) {
|
for ( GATKDocWorkUnit workUnit : indexData ) {
|
||||||
data.add(workUnit.toMap());
|
data.add(workUnit.indexDataMap());
|
||||||
docFeatures.add(workUnit.annotation);
|
docFeatures.add(workUnit.annotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue