diff --git a/public/java/src/org/broadinstitute/sting/utils/help/DocumentedGATKFeatureObject.java b/public/java/src/org/broadinstitute/sting/utils/help/DocumentedGATKFeatureObject.java index 9d198ee1a..66354202f 100644 --- a/public/java/src/org/broadinstitute/sting/utils/help/DocumentedGATKFeatureObject.java +++ b/public/java/src/org/broadinstitute/sting/utils/help/DocumentedGATKFeatureObject.java @@ -30,17 +30,24 @@ package org.broadinstitute.sting.utils.help; * @author depristo */ class DocumentedGATKFeatureObject { - final boolean enable; - final String groupName, summary; - final Class[] extraDocs; + private final Class classToDoc; + private final boolean enable; + private final String groupName, summary; + private final Class[] extraDocs; - public DocumentedGATKFeatureObject(final boolean enable, final String groupName, final String summary, final Class[] extraDocs) { + public DocumentedGATKFeatureObject(Class classToDoc, final boolean enable, final String groupName, final String summary, final Class[] extraDocs) { + this.classToDoc = classToDoc; this.enable = enable; this.groupName = groupName; this.summary = summary; this.extraDocs = extraDocs; } + public DocumentedGATKFeatureObject(Class classToDoc, final String groupName, final String summary) { + this(classToDoc, true, groupName, summary, new Class[]{}); + } + + public Class getClassToDoc() { return classToDoc; } public boolean enable() { return enable; } public String groupName() { return groupName; } public String summary() { return summary; } diff --git a/public/java/src/org/broadinstitute/sting/utils/help/GATKDoclet.java b/public/java/src/org/broadinstitute/sting/utils/help/GATKDoclet.java index 070663605..5755d2b37 100644 --- a/public/java/src/org/broadinstitute/sting/utils/help/GATKDoclet.java +++ b/public/java/src/org/broadinstitute/sting/utils/help/GATKDoclet.java @@ -33,6 +33,7 @@ import freemarker.template.TemplateException; import org.apache.commons.io.FileUtils; import org.apache.log4j.Level; import org.apache.log4j.Logger; +import org.broad.tribble.FeatureCodec; import org.broadinstitute.sting.utils.exceptions.ReviewedStingException; import java.io.*; @@ -50,6 +51,14 @@ public class GATKDoclet { RootDoc rootDoc; + final static Collection STATIC_DOCS = new ArrayList(); + static { + STATIC_DOCS.add(new DocumentedGATKFeatureObject(FeatureCodec.class, + "Reference ordered data (ROD) codecs", + "Tribble codecs for reading reference ordered data such as VCF or BED files")); + } + + /** * Extracts the contents of certain types of javadoc and adds them to an XML file. * @param rootDoc The documentation root. @@ -162,12 +171,20 @@ public class GATKDoclet { private DocumentedGATKFeatureObject getFeatureForClassDoc(ClassDoc doc) { Class docClass = getClassForClassDoc(doc); - // todo -- add looked here to static TO DOC collection as well - if ( docClass != null && docClass.isAnnotationPresent(DocumentedGATKFeature.class) ) { - DocumentedGATKFeature f = docClass.getAnnotation(DocumentedGATKFeature.class); - return new DocumentedGATKFeatureObject(f.enable(), f.groupName(), f.summary(), f.extraDocs()); - } else { + + if ( docClass == null ) return null; // not annotated so it shouldn't be documented + + if ( docClass.isAnnotationPresent(DocumentedGATKFeature.class) ) { + DocumentedGATKFeature f = docClass.getAnnotation(DocumentedGATKFeature.class); + return new DocumentedGATKFeatureObject(docClass, f.enable(), f.groupName(), f.summary(), f.extraDocs()); + } else { + for ( DocumentedGATKFeatureObject staticDocs : STATIC_DOCS ) { + if ( staticDocs.getClassToDoc().isAssignableFrom(docClass) ) { + return new DocumentedGATKFeatureObject(docClass, staticDocs.enable(), staticDocs.groupName(), staticDocs.summary(), staticDocs.extraDocs()); + } + } + return null; } } @@ -212,16 +229,15 @@ public class GATKDoclet { Collections.sort(indexData); - Set docFeatures = new HashSet(); + List> groups = new ArrayList>(); + Set seenDocumentationFeatures = new HashSet(); List> data = new ArrayList>(); for ( GATKDocWorkUnit workUnit : indexData ) { data.add(workUnit.indexDataMap()); - docFeatures.add(workUnit.annotation); - } - - List> groups = new ArrayList>(); - for ( DocumentedGATKFeatureObject feature : docFeatures ) { - groups.add(toMap(feature)); + if ( ! seenDocumentationFeatures.contains(workUnit.annotation.groupName()) ) { + groups.add(toMap(workUnit.annotation)); + seenDocumentationFeatures.add(workUnit.annotation.groupName()); + } } root.put("data", data); diff --git a/public/java/src/org/broadinstitute/sting/utils/help/GenericDocumentationHandler.java b/public/java/src/org/broadinstitute/sting/utils/help/GenericDocumentationHandler.java index 6ddf8a157..b4d82f0e8 100644 --- a/public/java/src/org/broadinstitute/sting/utils/help/GenericDocumentationHandler.java +++ b/public/java/src/org/broadinstitute/sting/utils/help/GenericDocumentationHandler.java @@ -255,21 +255,21 @@ public class GenericDocumentationHandler extends DocumentedGATKFeatureHandler { put("name", otherUnit.name);}}); } - - List> hierarchyDocs = new ArrayList>(); - for (final GATKDocWorkUnit other : all ) { - final String relation = classRelationship(toProcess.clazz, other.clazz); - if ( relation != null ) - hierarchyDocs.add( - new HashMap(){{ - put("filename", other.filename); - put("relation", relation); - put("name", other.name);}}); - - } - - root.put("relatedDocs", hierarchyDocs); root.put("extradocs", extraDocsData); + + +// List> hierarchyDocs = new ArrayList>(); +// for (final GATKDocWorkUnit other : all ) { +// final String relation = classRelationship(toProcess.clazz, other.clazz); +// if ( relation != null ) +// hierarchyDocs.add( +// new HashMap(){{ +// put("filename", other.filename); +// put("relation", relation); +// put("name", other.name);}}); +// +// } +// root.put("relatedDocs", hierarchyDocs); } private static final String classRelationship(Class me, Class other) {