From 4c147329a9e20fc62651a1e43d19ff07d365c9f6 Mon Sep 17 00:00:00 2001 From: hanna Date: Fri, 4 Dec 2009 20:08:41 +0000 Subject: [PATCH] Turn javadoc comments for packages and classes into key/value pairs in a properties file. Embed the properties file in GenomeAnalysisTK.jar. Still no support for actually displaying the archived javadoc. Also change the approach to providing package javadocs: retired the deprecated package.html file in favor of Java1.5-style package-info.java. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2263 348d0f76-0448-11de-a6fe-93d51630548a --- build.xml | 61 ++++++++----- .../sting/gatk/datasources/package-info.java | 5 ++ .../sting/gatk/datasources/package.html | 11 --- .../datasources/providers/package-info.java | 6 ++ .../gatk/datasources/providers/package.html | 12 --- .../gatk/datasources/shards/package-info.java | 6 ++ .../gatk/datasources/shards/package.html | 12 --- .../simpleDataSources/package-info.java | 6 ++ .../simpleDataSources/package.html | 12 --- .../sting/gatk/executive/package-info.java | 4 + .../sting/gatk/executive/package.html | 10 --- .../sting/gatk/filters/package-info.java | 4 + .../sting/gatk/filters/package.html | 34 -------- .../sting/gatk/iterators/package-info.java | 4 + .../sting/gatk/iterators/package.html | 10 --- .../sting/gatk/package-info.java | 5 ++ .../broadinstitute/sting/gatk/package.html | 11 --- .../sting/gatk/refdata/package-info.java | 5 ++ .../sting/gatk/refdata/package.html | 10 --- .../sting/gatk/traversals/package-info.java | 5 ++ .../sting/gatk/traversals/package.html | 11 --- .../sting/gatk/walkers/package-info.java | 6 ++ .../sting/gatk/walkers/package.html | 13 --- .../sting/utils/doc/HelpExtractorDoclet.java | 87 +++++++++++++++++++ 24 files changed, 181 insertions(+), 169 deletions(-) create mode 100644 java/src/org/broadinstitute/sting/gatk/datasources/package-info.java delete mode 100644 java/src/org/broadinstitute/sting/gatk/datasources/package.html create mode 100644 java/src/org/broadinstitute/sting/gatk/datasources/providers/package-info.java delete mode 100644 java/src/org/broadinstitute/sting/gatk/datasources/providers/package.html create mode 100644 java/src/org/broadinstitute/sting/gatk/datasources/shards/package-info.java delete mode 100644 java/src/org/broadinstitute/sting/gatk/datasources/shards/package.html create mode 100644 java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/package-info.java delete mode 100644 java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/package.html create mode 100644 java/src/org/broadinstitute/sting/gatk/executive/package-info.java delete mode 100644 java/src/org/broadinstitute/sting/gatk/executive/package.html create mode 100644 java/src/org/broadinstitute/sting/gatk/filters/package-info.java delete mode 100644 java/src/org/broadinstitute/sting/gatk/filters/package.html create mode 100644 java/src/org/broadinstitute/sting/gatk/iterators/package-info.java delete mode 100644 java/src/org/broadinstitute/sting/gatk/iterators/package.html create mode 100644 java/src/org/broadinstitute/sting/gatk/package-info.java delete mode 100644 java/src/org/broadinstitute/sting/gatk/package.html create mode 100644 java/src/org/broadinstitute/sting/gatk/refdata/package-info.java delete mode 100644 java/src/org/broadinstitute/sting/gatk/refdata/package.html create mode 100644 java/src/org/broadinstitute/sting/gatk/traversals/package-info.java delete mode 100644 java/src/org/broadinstitute/sting/gatk/traversals/package.html create mode 100644 java/src/org/broadinstitute/sting/gatk/walkers/package-info.java delete mode 100644 java/src/org/broadinstitute/sting/gatk/walkers/package.html create mode 100644 java/src/org/broadinstitute/sting/utils/doc/HelpExtractorDoclet.java diff --git a/build.xml b/build.xml index 73b0c8d68..217c1b51e 100644 --- a/build.xml +++ b/build.xml @@ -2,7 +2,9 @@ Compile and distribute the Sting toolkit + + @@ -24,6 +26,25 @@ + + + + + + + + + + + + + + + + + + + @@ -60,17 +81,6 @@ - - - - - - - - - - - @@ -84,7 +94,17 @@ - + + + + + + @@ -101,6 +121,7 @@ + @@ -251,8 +272,8 @@ - - + + @@ -261,7 +282,7 @@ - + @@ -306,7 +327,7 @@ - + @@ -322,13 +343,7 @@ - - - - - - - + diff --git a/java/src/org/broadinstitute/sting/gatk/datasources/package-info.java b/java/src/org/broadinstitute/sting/gatk/datasources/package-info.java new file mode 100644 index 000000000..abb2d0b84 --- /dev/null +++ b/java/src/org/broadinstitute/sting/gatk/datasources/package-info.java @@ -0,0 +1,5 @@ +/** + * Provides efficient access to GATK primary data sources + * such as SAM files, fasta files, and reference-ordered data. + */ +package org.broadinstitute.sting.gatk.datasources; \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/datasources/package.html b/java/src/org/broadinstitute/sting/gatk/datasources/package.html deleted file mode 100644 index c60831f50..000000000 --- a/java/src/org/broadinstitute/sting/gatk/datasources/package.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - -Provides efficient access to GATK primary data sources -such as SAM files, fasta files, and reference-ordered data. - - - diff --git a/java/src/org/broadinstitute/sting/gatk/datasources/providers/package-info.java b/java/src/org/broadinstitute/sting/gatk/datasources/providers/package-info.java new file mode 100644 index 000000000..1b98e36cf --- /dev/null +++ b/java/src/org/broadinstitute/sting/gatk/datasources/providers/package-info.java @@ -0,0 +1,6 @@ +/** + * Provides a bridge from the block-at-a-time data access provided by + * the datasource system to the locus / read-at-a-time data access + * required by the traversal engine. + */ +package org.broadinstitute.sting.gatk.datasources.providers; \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/datasources/providers/package.html b/java/src/org/broadinstitute/sting/gatk/datasources/providers/package.html deleted file mode 100644 index eddb660b2..000000000 --- a/java/src/org/broadinstitute/sting/gatk/datasources/providers/package.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - -Provides a bridge from the block-at-a-time data access provided by -the datasource system to the locus / read-at-a-time data access -required by the traversal engine. - - - diff --git a/java/src/org/broadinstitute/sting/gatk/datasources/shards/package-info.java b/java/src/org/broadinstitute/sting/gatk/datasources/shards/package-info.java new file mode 100644 index 000000000..7d209f9c6 --- /dev/null +++ b/java/src/org/broadinstitute/sting/gatk/datasources/shards/package-info.java @@ -0,0 +1,6 @@ +/** + * Divides core input data into manageable blocks, each representing + * a subsection of data that is small enough to be processed by a single + * worker. + */ +package org.broadinstitute.sting.gatk.datasources.shards; diff --git a/java/src/org/broadinstitute/sting/gatk/datasources/shards/package.html b/java/src/org/broadinstitute/sting/gatk/datasources/shards/package.html deleted file mode 100644 index e13aba69a..000000000 --- a/java/src/org/broadinstitute/sting/gatk/datasources/shards/package.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - -Divides core input data into manageable blocks, each representing -a subsection of data that is small enough to be processed by a single -worker. - - - diff --git a/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/package-info.java b/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/package-info.java new file mode 100644 index 000000000..e0f73e794 --- /dev/null +++ b/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/package-info.java @@ -0,0 +1,6 @@ +/** + * Retrieves core GATK data, given a shard which represents a contiguous + * subsequence of core GATK data (reads, reference, or reference-ordered + * data). + */ +package org.broadinstitute.sting.gatk.datasources.simpleDataSources; \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/package.html b/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/package.html deleted file mode 100644 index 21587f902..000000000 --- a/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/package.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - -Retrieves core GATK data, given a shard which represents a contiguous -subsequence of core GATK data (reads, reference, or reference-ordered -data). - - - diff --git a/java/src/org/broadinstitute/sting/gatk/executive/package-info.java b/java/src/org/broadinstitute/sting/gatk/executive/package-info.java new file mode 100644 index 000000000..2ceb2ca14 --- /dev/null +++ b/java/src/org/broadinstitute/sting/gatk/executive/package-info.java @@ -0,0 +1,4 @@ +/** + * Manages individual analyses by shattering data, pushing individual shards to the traversal engines, and gathering results and presenting them to the user. + */ +package org.broadinstitute.sting.gatk.executive; \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/executive/package.html b/java/src/org/broadinstitute/sting/gatk/executive/package.html deleted file mode 100644 index 5c9d96264..000000000 --- a/java/src/org/broadinstitute/sting/gatk/executive/package.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -Manages individual analyses by shattering data, pushing individual shards to the traversal engines, and gathering results and presenting them to the user. - - - diff --git a/java/src/org/broadinstitute/sting/gatk/filters/package-info.java b/java/src/org/broadinstitute/sting/gatk/filters/package-info.java new file mode 100644 index 000000000..efd3a6db5 --- /dev/null +++ b/java/src/org/broadinstitute/sting/gatk/filters/package-info.java @@ -0,0 +1,4 @@ +/** + * Provides a commonly used set of filters for determining which data should and should not be applied. + */ +package org.broadinstitute.sting.gatk.filters; \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/filters/package.html b/java/src/org/broadinstitute/sting/gatk/filters/package.html deleted file mode 100644 index a2519a659..000000000 --- a/java/src/org/broadinstitute/sting/gatk/filters/package.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - -Provides a commonly used set of filters for determining which data should and should not be applied. - - \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/iterators/package-info.java b/java/src/org/broadinstitute/sting/gatk/iterators/package-info.java new file mode 100644 index 000000000..221efd50c --- /dev/null +++ b/java/src/org/broadinstitute/sting/gatk/iterators/package-info.java @@ -0,0 +1,4 @@ +/** + * Tools for iterating over different views of GATK data. + */ +package org.broadinstitute.sting.gatk.iterators; \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/iterators/package.html b/java/src/org/broadinstitute/sting/gatk/iterators/package.html deleted file mode 100644 index d14105052..000000000 --- a/java/src/org/broadinstitute/sting/gatk/iterators/package.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -Tools for iterating over different views of GATK data. - - - diff --git a/java/src/org/broadinstitute/sting/gatk/package-info.java b/java/src/org/broadinstitute/sting/gatk/package-info.java new file mode 100644 index 000000000..4110d8c80 --- /dev/null +++ b/java/src/org/broadinstitute/sting/gatk/package-info.java @@ -0,0 +1,5 @@ +/** + * Provides map/reduce application framework highly optimized for + * analysis of sequencing data. + */ +package org.broadinstitute.sting.gatk; \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/package.html b/java/src/org/broadinstitute/sting/gatk/package.html deleted file mode 100644 index 677a9b96f..000000000 --- a/java/src/org/broadinstitute/sting/gatk/package.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - -Provides map/reduce application framework highly optimized for -analysis of sequencing data. - - - diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/package-info.java b/java/src/org/broadinstitute/sting/gatk/refdata/package-info.java new file mode 100644 index 000000000..0c9e084f3 --- /dev/null +++ b/java/src/org/broadinstitute/sting/gatk/refdata/package-info.java @@ -0,0 +1,5 @@ +/** + * Reads and preprocesses the various types of data represented by the + * GATK. + */ +package org.broadinstitute.sting.gatk.refdata; \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/package.html b/java/src/org/broadinstitute/sting/gatk/refdata/package.html deleted file mode 100644 index 0c6a55319..000000000 --- a/java/src/org/broadinstitute/sting/gatk/refdata/package.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -Reads and preprocesses the various types of data represented by the -GATK. - - diff --git a/java/src/org/broadinstitute/sting/gatk/traversals/package-info.java b/java/src/org/broadinstitute/sting/gatk/traversals/package-info.java new file mode 100644 index 000000000..171c27df6 --- /dev/null +++ b/java/src/org/broadinstitute/sting/gatk/traversals/package-info.java @@ -0,0 +1,5 @@ +/** + * Traverses over a shard of data, performing a mini-map/reduce on that + * dataset. + */ +package org.broadinstitute.sting.gatk.traversals; \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/traversals/package.html b/java/src/org/broadinstitute/sting/gatk/traversals/package.html deleted file mode 100644 index 82ff0a1f9..000000000 --- a/java/src/org/broadinstitute/sting/gatk/traversals/package.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - -Traverses over a shard of data, performing a mini-map/reduce on that -dataset. - - - diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/package-info.java b/java/src/org/broadinstitute/sting/gatk/walkers/package-info.java new file mode 100644 index 000000000..8d118861f --- /dev/null +++ b/java/src/org/broadinstitute/sting/gatk/walkers/package-info.java @@ -0,0 +1,6 @@ +/** + * Runs the desired analysis on the smallest meaningful subset of the + * dataset. Traditionally, the smallest subset is either an individual + * locus or read. + */ +package org.broadinstitute.sting.gatk.walkers; diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/package.html b/java/src/org/broadinstitute/sting/gatk/walkers/package.html deleted file mode 100644 index 9f3a8983e..000000000 --- a/java/src/org/broadinstitute/sting/gatk/walkers/package.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - -Runs the desired analysis on the smallest meaningful subset of the -dataset. Traditionally, the smallest subset is either an individual -locus or read. - - - - diff --git a/java/src/org/broadinstitute/sting/utils/doc/HelpExtractorDoclet.java b/java/src/org/broadinstitute/sting/utils/doc/HelpExtractorDoclet.java new file mode 100644 index 000000000..354cdaa5c --- /dev/null +++ b/java/src/org/broadinstitute/sting/utils/doc/HelpExtractorDoclet.java @@ -0,0 +1,87 @@ +package org.broadinstitute.sting.utils.doc; + +import com.sun.javadoc.RootDoc; +import com.sun.javadoc.PackageDoc; +import com.sun.javadoc.ClassDoc; + +import java.util.HashSet; +import java.util.Set; +import java.util.Scanner; +import java.io.PrintStream; +import java.io.FileNotFoundException; + +/** + * Extracts certain types of javadoc (specifically package and class descriptions) and makes them available + * to applications at runtime. + * + * @author mhanna + * @version 0.1 + */ +public class HelpExtractorDoclet { + /** + * Extracts the contents of certain types of javadoc and adds them to an XML file. + * @param rootDoc The documentation root. + * @return Whether the JavaDoc run succeeded. + */ + public static boolean start(RootDoc rootDoc) throws FileNotFoundException { + PrintStream out = System.out; + + for(String[] options: rootDoc.options()) { + if(options[0].equals("-out")) + out = new PrintStream(options[1]); + } + + // Cache packages as we see them, since there's no direct way to iterate over packages. + Set packages = new HashSet(); + + for(ClassDoc currentClass: rootDoc.classes()) { + PackageDoc containingPackage = currentClass.containingPackage(); + packages.add(containingPackage); + String className = containingPackage.name().length() > 0 ? + String.format("%s.%s",containingPackage.name(),currentClass.name()) : + String.format("%s",currentClass.name()); + String commentText = formatText(currentClass.commentText()); + + if(commentText.length() > 0) + out.printf("%s=%s%n",className,commentText); + } + + for(PackageDoc currentPackage: packages) { + String commentText = formatText(currentPackage.commentText()); + if(commentText.length() > 0) + out.printf("%s=%s%n",currentPackage.name(),commentText); + } + + return true; + } + + /** + * Validate the given options against + * @param option + * @return + */ + public static int optionLength(String option) { + if(option.equals("-out")) { + return 2; + } + return 0; + } + + /** + * Format text for consumption by the properties file. + * @param text Text to format. + * @return Formatted text; string trimmed, newlines removed. + */ + private static String formatText(String text) { + Scanner scanner = new Scanner(text); + StringBuilder output = new StringBuilder(); + + while(scanner.hasNextLine()) { + if(output.length() > 0) + output.append(' '); + output.append(scanner.nextLine().trim()); + } + + return output.toString(); + } +}