Removed previous, and largely unused, help system extensions.

This involved deleting the utils/help/*Taglet.java classes, which parsed out these fields unnecessarily
This also involved removing the few uses of these from the codebase.  For these uses, though, almost all were an identical copy of the first line of the docs, which is the default javadoc behavior anyway.
This commit is contained in:
Mark DePristo 2011-07-22 09:42:44 -04:00
parent e922ebc29d
commit 421b70ca4f
10 changed files with 21 additions and 302 deletions

View File

@ -33,9 +33,7 @@ import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.utils.baq.BAQ;
import org.broadinstitute.sting.utils.classloader.PluginManager;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.help.DescriptionTaglet;
import org.broadinstitute.sting.utils.help.DisplayNameTaglet;
import org.broadinstitute.sting.utils.help.SummaryTaglet;
import org.broadinstitute.sting.utils.help.ResourceBundleExtractorDoclet;
import org.broadinstitute.sting.utils.text.TextFormattingUtils;
import java.util.*;
@ -82,19 +80,10 @@ public class WalkerManager extends PluginManager<Walker> {
* @return A suitable display name for the package.
*/
public String getPackageDisplayName(String packageName) {
// Try to find an override for the display name of this package.
String displayNameKey = String.format("%s.%s",packageName,DisplayNameTaglet.NAME);
String displayName;
if(helpText.containsKey(displayNameKey)) {
displayName = helpText.getString(displayNameKey);
}
else {
// If no override exists...
// ...try to compute the override from the text of the package name, while accounting for
// unpackaged walkers.
displayName = packageName.substring(packageName.lastIndexOf('.')+1);
if(displayName.trim().equals("")) displayName = "<unpackaged>";
}
// ...try to compute the override from the text of the package name, while accounting for
// unpackaged walkers.
String displayName = packageName.substring(packageName.lastIndexOf('.')+1);
if (displayName.trim().equals("")) displayName = "<unpackaged>";
return displayName;
}
@ -104,7 +93,7 @@ public class WalkerManager extends PluginManager<Walker> {
* @return Package help text, or "" if none exists.
*/
public String getPackageSummaryText(String packageName) {
String key = String.format("%s.%s",packageName,SummaryTaglet.NAME);
String key = String.format("%s.%s",packageName, ResourceBundleExtractorDoclet.SUMMARY_TAGLET_NAME);
if(!helpText.containsKey(key))
return "";
return helpText.getString(key);
@ -116,7 +105,7 @@ public class WalkerManager extends PluginManager<Walker> {
* @return Walker summary description, or "" if none exists.
*/
public String getWalkerSummaryText(Class<? extends Walker> walkerType) {
String walkerSummary = String.format("%s.%s",walkerType.getName(), SummaryTaglet.NAME);
String walkerSummary = String.format("%s.%s",walkerType.getName(), ResourceBundleExtractorDoclet.SUMMARY_TAGLET_NAME);
if(!helpText.containsKey(walkerSummary))
return "";
return helpText.getString(walkerSummary);
@ -137,7 +126,7 @@ public class WalkerManager extends PluginManager<Walker> {
* @return Walker full description, or "" if none exists.
*/
public String getWalkerDescriptionText(Class<? extends Walker> walkerType) {
String walkerDescription = String.format("%s.%s",walkerType.getName(), DescriptionTaglet.NAME);
String walkerDescription = String.format("%s.%s",walkerType.getName(), ResourceBundleExtractorDoclet.DESCRIPTION_TAGLET_NAME);
if(!helpText.containsKey(walkerDescription))
return "";
return helpText.getString(walkerDescription);

View File

@ -58,6 +58,8 @@ import java.util.List;
import java.util.Map;
/**
* First pass of the recalibration. Generates recalibration table based on various user-specified covariates (such as reported quality score, cycle, and dinucleotide).
*
* This walker is designed to work as the first pass in a two-pass processing step.
* It does a by-locus traversal operating only at sites that are not in dbSNP.
* We assume that all reference mismatches we see are therefore errors and indicative of poor base quality.
@ -72,7 +74,6 @@ import java.util.Map;
*
* @author rpoplin
* @since Nov 3, 2009
* @help.summary First pass of the recalibration. Generates recalibration table based on various user-specified covariates (such as reported quality score, cycle, and dinucleotide).
*/
@BAQMode(ApplicationTime = BAQ.ApplicationTime.FORBIDDEN)

View File

@ -54,8 +54,10 @@ import java.util.ResourceBundle;
import java.util.regex.Pattern;
/**
* Second pass of the recalibration. Uses the table generated by CountCovariates to update the base quality scores of the input bam file using a sequential table calculation making the base quality scores more accurately reflect the actual quality of the bases as measured by reference mismatch rate.
*
* This walker is designed to work as the second pass in a two-pass processing step, doing a by-read traversal.
*
* For each base in each read this walker calculates various user-specified covariates (such as read group, reported quality score, cycle, and dinuc)
* Using these values as a key in a large hashmap the walker calculates an empirical base quality score and overwrites the quality score currently in the read.
* This walker then outputs a new bam file with these updated (recalibrated) reads.
@ -65,7 +67,6 @@ import java.util.regex.Pattern;
*
* @author rpoplin
* @since Nov 3, 2009
* @help.summary Second pass of the recalibration. Uses the table generated by CountCovariates to update the base quality scores of the input bam file using a sequential table calculation making the base quality scores more accurately reflect the actual quality of the bases as measured by reference mismatch rate.
*/
@BAQMode(QualityMode = BAQ.QualityMode.ADD_TAG, ApplicationTime = BAQ.ApplicationTime.ON_OUTPUT)

View File

@ -49,8 +49,6 @@ import java.util.*;
*
* @author rpoplin
* @since Mar 14, 2011
*
* @help.summary Applies cuts to the input vcf file (by adding filter lines) to achieve the desired novel FDR levels which were specified during VariantRecalibration
*/
public class ApplyRecalibration extends RodWalker<Integer, Integer> {

View File

@ -53,8 +53,6 @@ import java.util.*;
*
* User: rpoplin
* Date: 3/12/11
*
* @help.summary Takes variant calls as .vcf files, learns a Gaussian mixture model over the variant annotations and evaluates the variant -- assigning an informative lod score
*/
public class VariantRecalibrator extends RodWalker<ExpandingArrayList<VariantDatum>, ExpandingArrayList<VariantDatum>> implements TreeReducible<ExpandingArrayList<VariantDatum>> {

View File

@ -1,59 +0,0 @@
package org.broadinstitute.sting.utils.help;
import com.sun.tools.doclets.Taglet;
import java.util.Map;
/**
* Provide an alternate description for the given help system.
*
* @author mhanna
* @version 0.1
*/
public class DescriptionTaglet extends HelpTaglet {
/**
* The key tag for this taglet.
*/
public static final String NAME = "help.description";
/**
* Return the name of this custom tag.
*/
@Override
public String getName() {
return NAME;
}
/**
* Will return false since overviews are always named
* by the <code>@WalkerName</code> tag.
* @return false always
*/
@Override
public boolean inOverview() {
return true;
}
/**
* Will return true to indicate that packages can be given useful
* description.
* @return true always
*/
@Override
public boolean inPackage() {
return true;
}
/**
* Register this Taglet.
* @param tagletMap the map to register this tag to.
*/
public static void register(Map tagletMap) {
DescriptionTaglet tag = new DescriptionTaglet();
Taglet t = (Taglet)tagletMap.get(tag.getName());
if (t != null) {
tagletMap.remove(tag.getName());
}
tagletMap.put(tag.getName(), tag);
}
}

View File

@ -1,49 +0,0 @@
package org.broadinstitute.sting.utils.help;
import com.sun.tools.doclets.Taglet;
import java.util.Map;
/**
* Provide a display name in the help for packages
*
* @author mhanna
* @version 0.1
*/
public class DisplayNameTaglet extends HelpTaglet {
/**
* The display name for this taglet.
*/
public static final String NAME = "help.display.name";
/**
* Return the name of this custom tag.
*/
@Override
public String getName() {
return NAME;
}
/**
* Will return true to indicate that packages can be given useful
* display text.
* @return true always
*/
@Override
public boolean inPackage() {
return true;
}
/**
* Register this Taglet.
* @param tagletMap the map to register this tag to.
*/
public static void register(Map tagletMap) {
DisplayNameTaglet tag = new DisplayNameTaglet();
Taglet t = (Taglet)tagletMap.get(tag.getName());
if (t != null) {
tagletMap.remove(tag.getName());
}
tagletMap.put(tag.getName(), tag);
}
}

View File

@ -1,91 +0,0 @@
package org.broadinstitute.sting.utils.help;
import com.sun.javadoc.Tag;
import com.sun.tools.doclets.Taglet;
/**
* Basic functionality for the help taglet.
*
* @author mhanna
* @version 0.1
*/
public abstract class HelpTaglet implements Taglet {
/**
* Return the name of this custom tag.
*/
public abstract String getName();
/**
* Will return false since this tag cannot be applied
* to a field.
* @return false since this tag cannot be applied to a field.
*/
public boolean inField() {
return false;
}
/**
* Will return false since by default, help tags cannot be applied to a constructor.
* @return false since by default, help tags cannot be applied to a constructor.
*/
public boolean inConstructor() {
return false;
}
/**
* Will return false since by default, help tags cannot be applied to a method.
* @return false since by default, this tag cannot be applied to a method.
*/
public boolean inMethod() {
return false;
}
/**
* Will return false since by default, help tags cannot be applied to an overview.
* @return false since by default, help tags cannot be applied to an overview.
*/
public boolean inOverview() {
return false;
}
/**
* Will return false since by default, help tags cannot be applied to a package.
* description.
* @return false since by default, help tags cannot be applied to a package.
*/
public boolean inPackage() {
return false;
}
/**
* Will return false since help tags are by default not inline.
* @return false since help tags are by default not inline.
*/
public boolean inType() {
return false;
}
/**
* Will return false since help tags are by default not inline.
* @return false since help tags are by default not inline.
*/
public boolean isInlineTag() {
return false;
}
/**
* Create a string representation of this tag. Since this tag is only
* used by the help system, don't output any HTML.
*/
public String toString(Tag tag) {
return null;
}
/**
* Create a string representation of this tag. Since this tag is only
* used by the help system, don't output any HTML.
*/
public String toString(Tag[] tags) {
return null;
}
}

View File

@ -47,7 +47,9 @@ public class ResourceBundleExtractorDoclet {
/**
* Taglet for the particular version number.
*/
protected static final String VERSION_TAGLET_NAME = "version";
public static final String VERSION_TAGLET_NAME = "version";
public static final String SUMMARY_TAGLET_NAME = "help.summary";
public static final String DESCRIPTION_TAGLET_NAME = "help.description";
/**
* Maintains a collection of resources in memory as they're accumulated.
@ -250,39 +252,26 @@ public class ResourceBundleExtractorDoclet {
String description = element.commentText();
for(Tag tag: element.tags()) {
if(tag.name().equals("@"+DisplayNameTaglet.NAME)) {
if(name != null)
throw new ReviewedStingException("Only one display name tag can be used per package / walker.");
name = tag.text();
}
else if(tag.name().equals("@"+VERSION_TAGLET_NAME)) {
if(tag.name().equals("@"+VERSION_TAGLET_NAME)) {
if ( absoluteVersion != null ) {
version = absoluteVersion;
}
else {
version = String.format("%s%s%s", (versionPrefix != null) ? versionPrefix : "",
tag.text(),
(versionSuffix != null) ? versionSuffix : "");
tag.text(),
(versionSuffix != null) ? versionSuffix : "");
}
}
else if(tag.name().equals("@"+SummaryTaglet.NAME))
summary = tag.text();
else if(tag.name().equals("@"+DescriptionTaglet.NAME))
description = tag.text();
}
// Write out an alternate element name, if exists.
if(name != null)
resourceText.setProperty(String.format("%s.%s",elementName,DisplayNameTaglet.NAME),name);
if(version != null)
resourceText.setProperty(String.format("%s.%s",elementName,VERSION_TAGLET_NAME),version);
// Write out an alternate element summary, if exists.
resourceText.setProperty(String.format("%s.%s",elementName,SummaryTaglet.NAME),formatText(summary));
resourceText.setProperty(String.format("%s.%s",elementName,SUMMARY_TAGLET_NAME),formatText(summary));
// Write out an alternate description, if present.
resourceText.setProperty(String.format("%s.%s",elementName,DescriptionTaglet.NAME),formatText(description));
resourceText.setProperty(String.format("%s.%s",elementName,DESCRIPTION_TAGLET_NAME),formatText(description));
}
/**

View File

@ -1,58 +0,0 @@
package org.broadinstitute.sting.utils.help;
import com.sun.tools.doclets.Taglet;
import java.util.Map;
/**
* Provide an alternate brief summary for this walker / package.
* Acts as an alternative to the first sentence employed by default.
* @author mhanna
* @version 0.1
*/
public class SummaryTaglet extends HelpTaglet {
/**
* The key tag for this taglet.
*/
public static final String NAME = "help.summary";
/**
* Return the name of this custom tag.
*/
@Override
public String getName() {
return NAME;
}
/**
* Will return false since overviews are always named
* by the <code>@WalkerName</code> tag.
* @return false always
*/
@Override
public boolean inOverview() {
return true;
}
/**
* Will return true to indicate that packages can be given useful summary.
* @return true always
*/
@Override
public boolean inPackage() {
return true;
}
/**
* Register this Taglet.
* @param tagletMap the map to register this tag to.
*/
public static void register(Map tagletMap) {
SummaryTaglet tag = new SummaryTaglet();
Taglet t = (Taglet)tagletMap.get(tag.getName());
if (t != null) {
tagletMap.remove(tag.getName());
}
tagletMap.put(tag.getName(), tag);
}
}