Generalized handler to allow it to be used with any arbitrary class structure.
DocumentedGATKFeature now includes a field for the group name. Build.xml works with public / private now.
This commit is contained in:
parent
453954182e
commit
f0be7348be
|
|
@ -457,8 +457,9 @@
|
||||||
</javadoc>
|
</javadoc>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="walkerdocs" unless="uptodate.extracthelp"
|
<target name="gatkdocs" unless="uptodate.extracthelp" depends="gatk.compile"
|
||||||
description="Extract help key/value pair file from the JavaDoc tags.">
|
description="Extract help key/value pair file from the JavaDoc tags.">
|
||||||
|
<property name="gatk.target" value="private"/>
|
||||||
<path id="doclet.classpath">
|
<path id="doclet.classpath">
|
||||||
<path refid="external.dependencies" />
|
<path refid="external.dependencies" />
|
||||||
<pathelement location="${java.classes}" />
|
<pathelement location="${java.classes}" />
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.baq.BAQ;
|
import org.broadinstitute.sting.utils.baq.BAQ;
|
||||||
import org.broadinstitute.sting.utils.collections.Pair;
|
import org.broadinstitute.sting.utils.collections.Pair;
|
||||||
import org.broadinstitute.sting.utils.help.DocumentedGATKFeature;
|
import org.broadinstitute.sting.utils.help.DocumentedGATKFeature;
|
||||||
import org.broadinstitute.sting.utils.help.WalkerDocumentationHandler;
|
import org.broadinstitute.sting.utils.help.GenericDocumentationHandler;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ import java.util.List;
|
||||||
@ReadFilters(MalformedReadFilter.class)
|
@ReadFilters(MalformedReadFilter.class)
|
||||||
@PartitionBy(PartitionType.NONE)
|
@PartitionBy(PartitionType.NONE)
|
||||||
@BAQMode(QualityMode = BAQ.QualityMode.OVERWRITE_QUALS, ApplicationTime = BAQ.ApplicationTime.ON_INPUT)
|
@BAQMode(QualityMode = BAQ.QualityMode.OVERWRITE_QUALS, ApplicationTime = BAQ.ApplicationTime.ON_INPUT)
|
||||||
@DocumentedGATKFeature( handler = WalkerDocumentationHandler.class )
|
@DocumentedGATKFeature( groupName = "GATK walkers" )
|
||||||
public abstract class Walker<MapType, ReduceType> {
|
public abstract class Walker<MapType, ReduceType> {
|
||||||
final protected static Logger logger = Logger.getLogger(Walker.class);
|
final protected static Logger logger = Logger.getLogger(Walker.class);
|
||||||
private GenomeAnalysisEngine toolkit;
|
private GenomeAnalysisEngine toolkit;
|
||||||
|
|
|
||||||
|
|
@ -36,5 +36,6 @@ import java.lang.annotation.*;
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target(ElementType.TYPE)
|
@Target(ElementType.TYPE)
|
||||||
public @interface DocumentedGATKFeature {
|
public @interface DocumentedGATKFeature {
|
||||||
Class<? extends DocumentedGATKFeatureHandler> handler();
|
String groupName();
|
||||||
|
Class<? extends DocumentedGATKFeatureHandler> handler() default GenericDocumentationHandler.class;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public abstract class DocumentedGATKFeatureHandler {
|
public abstract class DocumentedGATKFeatureHandler {
|
||||||
private GATKDoclet doclet;
|
private GATKDoclet doclet;
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
protected RootDoc getRootDoc() {
|
protected RootDoc getRootDoc() {
|
||||||
return this.doclet.rootDoc;
|
return this.doclet.rootDoc;
|
||||||
|
|
@ -64,7 +65,14 @@ public abstract class DocumentedGATKFeatureHandler {
|
||||||
return ResourceBundleExtractorDoclet.getClassName(doc).replace(".", "_") + ".html";
|
return ResourceBundleExtractorDoclet.getClassName(doc).replace(".", "_") + ".html";
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract String getGroupName();
|
final public String getGroupName() {
|
||||||
|
return groupName;
|
||||||
|
}
|
||||||
|
|
||||||
|
final public void setGroupName(String groupName) {
|
||||||
|
this.groupName = groupName;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract String getTemplateName(ClassDoc doc) throws IOException;
|
public abstract String getTemplateName(ClassDoc doc) throws IOException;
|
||||||
public abstract GATKDoclet.DocumentationData processOne(ClassDoc doc);
|
public abstract GATKDoclet.DocumentationData processOne(ClassDoc doc);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,7 @@ public class GATKDoclet extends ResourceBundleExtractorDoclet {
|
||||||
|
|
||||||
List<DocumentationData> indexData = new ArrayList<DocumentationData>();
|
List<DocumentationData> indexData = new ArrayList<DocumentationData>();
|
||||||
for ( ClassDoc doc : rootDoc.classes() ) {
|
for ( ClassDoc doc : rootDoc.classes() ) {
|
||||||
|
System.out.printf("Considering %s%n", doc);
|
||||||
DocumentedGATKFeatureHandler handler = getHandlerForClassDoc(doc);
|
DocumentedGATKFeatureHandler handler = getHandlerForClassDoc(doc);
|
||||||
if ( handler != null && handler.shouldBeProcessed(doc) ) {
|
if ( handler != null && handler.shouldBeProcessed(doc) ) {
|
||||||
DocumentationData docData = processDocumentationWithHandler(cfg, handler, doc);
|
DocumentationData docData = processDocumentationWithHandler(cfg, handler, doc);
|
||||||
|
|
@ -132,6 +133,7 @@ public class GATKDoclet extends ResourceBundleExtractorDoclet {
|
||||||
if ( docClass.isAnnotationPresent(DocumentedGATKFeature.class) ) {
|
if ( docClass.isAnnotationPresent(DocumentedGATKFeature.class) ) {
|
||||||
DocumentedGATKFeature feature = docClass.getAnnotation(DocumentedGATKFeature.class);
|
DocumentedGATKFeature feature = docClass.getAnnotation(DocumentedGATKFeature.class);
|
||||||
DocumentedGATKFeatureHandler handler = feature.handler().newInstance();
|
DocumentedGATKFeatureHandler handler = feature.handler().newInstance();
|
||||||
|
handler.setGroupName(feature.groupName());
|
||||||
handler.setDoclet(this);
|
handler.setDoclet(this);
|
||||||
return handler;
|
return handler;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -152,7 +154,7 @@ public class GATKDoclet extends ResourceBundleExtractorDoclet {
|
||||||
|
|
||||||
private void processIndex(Configuration cfg, List<DocumentationData> indexData) throws IOException {
|
private void processIndex(Configuration cfg, List<DocumentationData> indexData) throws IOException {
|
||||||
/* Get or create a template */
|
/* Get or create a template */
|
||||||
Template temp = cfg.getTemplate("walker.index.template.html");
|
Template temp = cfg.getTemplate("generic.index.template.html");
|
||||||
|
|
||||||
/* Merge data-model with template */
|
/* Merge data-model with template */
|
||||||
Writer out = new OutputStreamWriter(new FileOutputStream(new File("testdoc/index.html")));
|
Writer out = new OutputStreamWriter(new FileOutputStream(new File("testdoc/index.html")));
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ import java.util.Map;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class WalkerDocumentationHandler extends DocumentedGATKFeatureHandler {
|
public class GenericDocumentationHandler extends DocumentedGATKFeatureHandler {
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldBeProcessed(ClassDoc doc) {
|
public boolean shouldBeProcessed(ClassDoc doc) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -59,17 +59,14 @@ public class WalkerDocumentationHandler extends DocumentedGATKFeatureHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getGroupName() { return "GATK Walkers"; }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTemplateName(ClassDoc doc) throws IOException {
|
public String getTemplateName(ClassDoc doc) throws IOException {
|
||||||
return "walker.template.html";
|
return "generic.template.html";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GATKDoclet.DocumentationData processOne(ClassDoc doc) {
|
public GATKDoclet.DocumentationData processOne(ClassDoc doc) {
|
||||||
System.out.printf("Walker class %s%n", doc);
|
System.out.printf("%s class %s%n", getGroupName(), doc);
|
||||||
Map<String, Object> root = buildWalkerDataModel(doc); // Create the root hash
|
Map<String, Object> root = buildWalkerDataModel(doc); // Create the root hash
|
||||||
return new GATKDoclet.DocumentationData(doc.name(), (String)root.get("summary"), root);
|
return new GATKDoclet.DocumentationData(doc.name(), (String)root.get("summary"), root);
|
||||||
}
|
}
|
||||||
|
|
@ -136,9 +133,9 @@ public class WalkerDocumentationHandler extends DocumentedGATKFeatureHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
private FieldDoc getFieldDoc(ClassDoc classDoc, String name, boolean primary) {
|
private FieldDoc getFieldDoc(ClassDoc classDoc, String name, boolean primary) {
|
||||||
System.out.printf("Looking for %s in %s%n", name, classDoc.name());
|
//System.out.printf("Looking for %s in %s%n", name, classDoc.name());
|
||||||
for ( FieldDoc fieldDoc : classDoc.fields(false) ) {
|
for ( FieldDoc fieldDoc : classDoc.fields(false) ) {
|
||||||
System.out.printf("fieldDoc " + fieldDoc + " name " + fieldDoc.name());
|
//System.out.printf("fieldDoc " + fieldDoc + " name " + fieldDoc.name());
|
||||||
if ( fieldDoc.name().equals(name) )
|
if ( fieldDoc.name().equals(name) )
|
||||||
return fieldDoc;
|
return fieldDoc;
|
||||||
|
|
||||||
Loading…
Reference in New Issue