Added the ability to update the Forum

GATKDocs looks for a key on gsa4, and updates the forum with new walker if it exists.
More changes were made to the GATKDocs. Works nicely with bootstrap on and offline.
Cleaned up the code as well

Signed-off-by: Mauricio Carneiro <carneiro@broadinstitute.org>
This commit is contained in:
Roger Zurawicki 2012-07-23 16:44:53 -04:00 committed by Mauricio Carneiro
parent 46ca49b63d
commit f3c504769b
7 changed files with 164 additions and 119 deletions

135
ivy.xml
View File

@ -23,89 +23,90 @@
--> -->
<ivy-module version="1.0"> <ivy-module version="1.0">
<info organisation="org.broadinstitute" module="Sting"/> <info organisation="org.broadinstitute" module="Sting"/>
<configurations defaultconfmapping="test->default"> <configurations defaultconfmapping="test->default">
<conf name="default" description="the core dependencies for the GATK"/> <conf name="default" description="the core dependencies for the GATK"/>
<conf name="test" extends="default" description="external dependencies used for testing and metrics" /> <conf name="test" extends="default" description="external dependencies used for testing and metrics"/>
<conf name="scala" extends="default" description="the dependencies for scala"/> <conf name="scala" extends="default" description="the dependencies for scala"/>
<conf name="queue" extends="scala" description="the dependencies for Queue"/> <conf name="queue" extends="scala" description="the dependencies for Queue"/>
</configurations> </configurations>
<dependencies defaultconf="default"> <dependencies defaultconf="default">
<dependency org="net.sf" name="sam" rev="latest.integration"/> <dependency org="net.sf" name="sam" rev="latest.integration"/>
<dependency org="net.sf" name="picard" rev="latest.integration"/> <dependency org="net.sf" name="picard" rev="latest.integration"/>
<dependency org="edu.mit.broad" name="picard-private-parts" rev="latest.integration"/> <dependency org="edu.mit.broad" name="picard-private-parts" rev="latest.integration"/>
<!-- Tribble --> <!-- Tribble -->
<dependency org="org.broad" name="tribble" rev="latest.integration"/> <dependency org="org.broad" name="tribble" rev="latest.integration"/>
<dependency org="log4j" name="log4j" rev="1.2.15"/> <dependency org="log4j" name="log4j" rev="1.2.15"/>
<dependency org="javax.mail" name="mail" rev="1.4.4"/> <dependency org="javax.mail" name="mail" rev="1.4.4"/>
<dependency org="colt" name="colt" rev="1.2.0"/> <dependency org="colt" name="colt" rev="1.2.0"/>
<!-- <dependency org="jboss" name="javassist" rev="3.7.ga"/> --> <!-- <dependency org="jboss" name="javassist" rev="3.7.ga"/> -->
<dependency org="org.simpleframework" name="simple-xml" rev="2.0.4"/> <dependency org="org.simpleframework" name="simple-xml" rev="2.0.4"/>
<dependency org="org.apache.bcel" name="bcel" rev="5.2"/> <dependency org="org.apache.bcel" name="bcel" rev="5.2"/>
<!-- Dependencies for reflections mvn repository --> <!-- Dependencies for reflections mvn repository -->
<dependency org="org.reflections" name="reflections" rev="0.9.5-RC2"/> <dependency org="org.reflections" name="reflections" rev="0.9.5-RC2"/>
<!-- Matrix package from math.nist.gov --> <!-- Matrix package from math.nist.gov -->
<dependency org="gov.nist" name="Jama" rev="1.0.2"/> <dependency org="gov.nist" name="Jama" rev="1.0.2"/>
<!-- Dependencies for the graph aligner --> <!-- Dependencies for the graph aligner -->
<dependency org="org.jgrapht" name="jgrapht-jdk1.5" rev="0.7.3"/> <dependency org="org.jgrapht" name="jgrapht-jdk1.5" rev="0.7.3"/>
<!-- Dependencies for the html walker documention --> <!-- Dependencies for the html walker documention -->
<dependency org="org.freemarker" name="freemarker" rev="2.3.18"/> <dependency org="org.freemarker" name="freemarker" rev="2.3.18"/>
<!-- Commons Dependencies -->
<dependency org="org.apache.commons" name="commons-email" rev="1.2"/>
<dependency org="org.apache.commons" name="commons-jexl" rev="2.1.1"/>
<dependency org="commons-lang" name="commons-lang" rev="2.5"/>
<dependency org="commons-logging" name="commons-logging" rev="1.1.1"/>
<dependency org="commons-io" name="commons-io" rev="2.1"/>
<dependency org="org.apache.commons" name="commons-math" rev="2.2" />
<!-- Lucene core utilities --> <!-- Commons Dependencies -->
<!-- <dependency org="org.apache.lucene" name="lucene-core" rev="3.0.3"/> --> <dependency org="org.apache.commons" name="commons-email" rev="1.2"/>
<dependency org="org.apache.commons" name="commons-jexl" rev="2.1.1"/>
<dependency org="commons-lang" name="commons-lang" rev="2.5"/>
<dependency org="commons-logging" name="commons-logging" rev="1.1.1"/>
<dependency org="commons-io" name="commons-io" rev="2.1"/>
<dependency org="org.apache.commons" name="commons-math" rev="2.2"/>
<!-- Dependencies for LSF, DRMAA, and other C libraries --> <!-- Lucene core utilities -->
<dependency org="net.java.dev.jna" name="jna" rev="3.2.7"/> <!-- <dependency org="org.apache.lucene" name="lucene-core" rev="3.0.3"/> -->
<!-- Dependencies for amazon.com S3 support --> <!-- Dependencies for LSF, DRMAA, and other C libraries -->
<dependency org="net.java.dev.jets3t" name="jets3t" rev="0.8.1"/> <dependency org="net.java.dev.jna" name="jna" rev="3.2.7"/>
<!-- Dependencies for GridEngine --> <!-- Dependencies for amazon.com S3 support -->
<dependency org="net.sf.gridscheduler" name="drmaa" rev="latest.integration"/> <dependency org="net.java.dev.jets3t" name="jets3t" rev="0.8.1"/>
<!-- Scala dependancies --> <!-- Dependencies for GridEngine -->
<dependency org="org.scala-lang" name="scala-compiler" rev="2.8.1"/> <dependency org="net.sf.gridscheduler" name="drmaa" rev="latest.integration"/>
<dependency org="org.scala-lang" name="scala-library" rev="2.8.1"/>
<!-- testing and evaluation dependencies --> <!-- Scala dependancies -->
<dependency org="org.testng" name="testng" rev="5.14.1" conf="test" /> <dependency org="org.scala-lang" name="scala-compiler" rev="2.8.1"/>
<dependency org="org.uncommons" name="reportng" rev="1.1.2" conf="test" /> <dependency org="org.scala-lang" name="scala-library" rev="2.8.1"/>
<dependency org="com.google.code.caliper" name="caliper" rev="1.0-SNAPSHOT" conf="test" />
<!-- Contracts for Java and dependencies --> <!-- testing and evaluation dependencies -->
<dependency org="com.google.code.cofoja" name="cofoja" rev="1.0-20110609" /> <dependency org="org.testng" name="testng" rev="5.14.1" conf="test"/>
<dependency org="asm" name="asm-all" rev="3.3.1" /> <dependency org="org.uncommons" name="reportng" rev="1.1.2" conf="test"/>
<dependency org="com.google.code.caliper" name="caliper" rev="1.0-SNAPSHOT" conf="test"/>
<!-- POI, for reading pipeline files --> <!-- Contracts for Java and dependencies -->
<dependency org="org.apache.poi" name="poi" rev="3.8-beta3" /> <dependency org="com.google.code.cofoja" name="cofoja" rev="1.0-20110609"/>
<dependency org="org.apache.poi" name="poi-ooxml" rev="3.8-beta3" /> <dependency org="asm" name="asm-all" rev="3.3.1"/>
<!-- snpEff annotator for pipelines --> <!-- POI, for reading pipeline files -->
<dependency org="net.sf.snpeff" name="snpeff" rev="2.0.5" /> <dependency org="org.apache.poi" name="poi" rev="3.8-beta3"/>
<dependency org="org.apache.poi" name="poi-ooxml" rev="3.8-beta3"/>
<!-- MongoDB for the GXDB project --> <!-- snpEff annotator for pipelines -->
<dependency org="org.mongodb" name="mongo-java-driver" rev="2.7.3"/> <dependency org="net.sf.snpeff" name="snpeff" rev="2.0.5"/>
<!-- GSON for talking to the REST API on Vanilla Forums --> <!-- MongoDB for the GXDB project -->
<dependency org="com.google.code.gson" name="gson" rev="2.2.2"/> <dependency org="org.mongodb" name="mongo-java-driver" rev="2.7.3"/>
<!-- Exclude dependencies on sun libraries where the downloads aren't available but included in the jvm. --> <!-- GSON and HTTP for talking to the REST API on Vanilla Forums -->
<exclude org="javax.servlet" /> <dependency org="com.google.code.gson" name="gson" rev="2.2.2"/>
<exclude org="javax.jms" /> <dependency org="org.apache.httpcomponents" name="httpclient" rev="4.1.1"/>
<exclude org="com.sun.*" />
</dependencies> <!-- Exclude dependencies on sun libraries where the downloads aren't available but included in the jvm. -->
<exclude org="javax.servlet"/>
<exclude org="javax.jms"/>
<exclude org="com.sun.*"/>
</dependencies>
</ivy-module> </ivy-module>

View File

@ -28,7 +28,7 @@ public class GATKDocUtils {
/** /**
* The URL root for RELEASED GATKDOC units * The URL root for RELEASED GATKDOC units
*/ */
public final static String URL_ROOT_FOR_RELEASE_GATKDOCS = "http://www.broadinstitute.org/gsa/gatkdocs/release/"; public final static String URL_ROOT_FOR_RELEASE_GATKDOCS = "http://www.broadinstitute.org/gatk/gatkdocs/";
/** /**
* The URL root for STABLE GATKDOC units * The URL root for STABLE GATKDOC units
*/ */

View File

@ -41,12 +41,16 @@ import org.broadinstitute.sting.gatk.CommandLineGATK;
import org.broadinstitute.sting.gatk.walkers.qc.DocumentationTest; import org.broadinstitute.sting.gatk.walkers.qc.DocumentationTest;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException; import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.exceptions.UserException; import org.broadinstitute.sting.utils.exceptions.UserException;
import org.broadinstitute.sting.utils.text.XReadLines;
import java.io.*; import java.io.*;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;
<<<<<<< HEAD
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
=======
>>>>>>> Added the ability to update the Forum
import java.util.*; import java.util.*;
/** /**
@ -82,6 +86,7 @@ public class GATKDoclet {
*/ */
final protected static File DESTINATION_DIR = new File("gatkdocs"); final protected static File DESTINATION_DIR = new File("gatkdocs");
final private static String FORUM_KEY_FILE = "/local/gsa-engineering/gatkdocs_publisher/forum.key";
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// //
// Global variables that are set on the command line by javadoc // Global variables that are set on the command line by javadoc
@ -142,7 +147,7 @@ public class GATKDoclet {
buildTimestamp = options[1]; buildTimestamp = options[1];
if (options[0].equals("-absolute-version")) if (options[0].equals("-absolute-version"))
absoluteVersion = options[1]; absoluteVersion = options[1];
if (options[0].equals("-include-hidden")) if (options[0].equals("-include -hidden"))
showHiddenFeatures = true; showHiddenFeatures = true;
if (options[0].equals("-test")) if (options[0].equals("-test"))
testOnly = true; testOnly = true;
@ -151,6 +156,7 @@ public class GATKDoclet {
// process the docs // process the docs
new GATKDoclet().processDocs(rootDoc); new GATKDoclet().processDocs(rootDoc);
return true; return true;
} }
@ -216,6 +222,15 @@ public class GATKDoclet {
} }
processIndex(cfg, new ArrayList<GATKDocWorkUnit>(myWorkUnits)); processIndex(cfg, new ArrayList<GATKDocWorkUnit>(myWorkUnits));
File forumKeyFile = new File(FORUM_KEY_FILE);
if (forumKeyFile.exists()) {
String forumKey = null;
// Read ing a one-line file so we can do a for loop
for (String line : new XReadLines(forumKeyFile))
forumKey = line;
updateForum(myWorkUnits, forumKey);
}
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} catch (IOException e) { } catch (IOException e) {
@ -223,6 +238,31 @@ public class GATKDoclet {
} }
} }
private void updateForum(Set<GATKDocWorkUnit> docWorkUnits, String forumKey) {
//first get list of posts that need to be added
List<String> old = ForumAPIUtils.getPostedTools(forumKey);
for (String s : old)
System.out.println(s);
System.out.printf("Forum has %d items%n", old.size());
System.out.printf("Docs have %d items%n", docWorkUnits.size());
List<GATKDocWorkUnit> toAdd = new ArrayList<GATKDocWorkUnit>();
for (GATKDocWorkUnit tool : docWorkUnits) {
if (!old.contains(tool.name)) {
System.out.println("WILL POST: " + tool.name + " TO FORUM");
toAdd.add(tool);
}
}
//update using list
for (GATKDocWorkUnit tool : toAdd) {
//if ( tool.name.equals("ApplyRecalibration") )
ForumAPIUtils.postToForum(tool, forumKey);
}
}
private void processCategories(Map<Category, List<Map<String, String>>> getCategories, Set<GATKDocWorkUnit> classes) throws IOException { private void processCategories(Map<Category, List<Map<String, String>>> getCategories, Set<GATKDocWorkUnit> classes) throws IOException {
List<Object> categories = new LinkedList<Object>(); List<Object> categories = new LinkedList<Object>();
for (Category cat : getCategories.keySet()) { for (Category cat : getCategories.keySet()) {
@ -248,7 +288,6 @@ public class GATKDoclet {
posts.add(properties); posts.add(properties);
} }
writeJson(DESTINATION_DIR + "/posts.json", posts);
} }
private void writeJson(String filename, Object source) throws IOException { private void writeJson(String filename, Object source) throws IOException {
@ -261,40 +300,6 @@ public class GATKDoclet {
} }
public static void postRestJson(String URL, String json) {
try {
URL url = new URL(URL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
OutputStream os = conn.getOutputStream();
os.write(json.getBytes());
os.flush();
if (conn.getResponseCode() != HttpURLConnection.HTTP_CREATED) {
throw new RuntimeException("Failed : HTTP error code : "
+ conn.getResponseCode());
}
BufferedReader br = new BufferedReader(new InputStreamReader(
(conn.getInputStream())));
String output;
System.out.println("Output from Server .... \n");
while ((output = br.readLine()) != null) {
System.out.println(output);
}
conn.disconnect();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
/** /**
* Returns the set of all GATKDocWorkUnits that we are going to generate docs for. * Returns the set of all GATKDocWorkUnits that we are going to generate docs for.
* *

File diff suppressed because one or more lines are too long

View File

@ -71,17 +71,8 @@
<div class="row-fluid"> <div class="row-fluid">
<#if isIndex> <#if isIndex>
<section class="span4"> <?php printGATKDocsNav(); ?>
<aside class="well"> <div class="span9">
<h2>About GATKdocs</h2>
<p>He is some text describing the docs, what it is and stuf...nalysis ready SNP and indel
calls
with hand filtering when VQSR is not possib. nalysis ready SNP and indel calls with hand
filtering when VQSR is not possib </p>
</aside>
</section>
<div class="span8">
</#if> </#if>
</#macro> </#macro>

View File

@ -1,3 +1,27 @@
<!--
~ Copyright (c) 2012, The Broad Institute
~
~ Permission is hereby granted, free of charge, to any person
~ obtaining a copy of this software and associated documentation
~ files (the "Software"), to deal in the Software without
~ restriction, including without limitation the rights to use,
~ copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the
~ Software is furnished to do so, subject to the following
~ conditions:
~
~ The above copyright notice and this permission notice shall be
~ included in all copies or substantial portions of the Software.
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
~ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
~ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
~ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
~ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
~ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
~ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
~ OTHER DEALINGS IN THE SOFTWARE.
-->
<#include "common.html"/> <#include "common.html"/>
<#macro emitGroup group> <#macro emitGroup group>
@ -40,7 +64,8 @@
<@makeHeader title="GATK documentation index" isIndex=true /> <@makeHeader title="GATK documentation index" isIndex=true />
<h1>GATK documentation index <h1>GATK documentation index
<small>${version}</small></h1> <small>${version}</small>
</h1>
<hr> <hr>
<#list groups?sort_by("name") as group> <#list groups?sort_by("name") as group>
<@emitGroup group=group/> <@emitGroup group=group/>

View File

@ -1,3 +1,27 @@
<!--
~ Copyright (c) 2012, The Broad Institute
~
~ Permission is hereby granted, free of charge, to any person
~ obtaining a copy of this software and associated documentation
~ files (the "Software"), to deal in the Software without
~ restriction, including without limitation the rights to use,
~ copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the
~ Software is furnished to do so, subject to the following
~ conditions:
~
~ The above copyright notice and this permission notice shall be
~ included in all copies or substantial portions of the Software.
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
~ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
~ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
~ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
~ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
~ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
~ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
~ OTHER DEALINGS IN THE SOFTWARE.
-->
<#include "common.html"/> <#include "common.html"/>
<#macro argumentlist name myargs> <#macro argumentlist name myargs>
@ -13,8 +37,7 @@
<td>${arg.summary}</td> <td>${arg.summary}</td>
</tr> </tr>
<#-- <#--
< <td>${arg.required}</td>
td>${arg.required}</td>
--> -->
</#list> </#list>
</#if> </#if>