diff --git a/build.xml b/build.xml
index d8d384d72..05389ad68 100644
--- a/build.xml
+++ b/build.xml
@@ -40,21 +40,18 @@
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -104,10 +101,7 @@
-
-
-
-
+
@@ -134,6 +128,7 @@
+
@@ -186,54 +181,47 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+ Building Scala...
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -265,10 +253,13 @@
+
+
+
-
+
diff --git a/ivy.xml b/ivy.xml
index 416e9e1da..43d6a9138 100644
--- a/ivy.xml
+++ b/ivy.xml
@@ -1,21 +1,30 @@
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/java/src/org/broadinstitute/sting/utils/PackageUtils.java b/java/src/org/broadinstitute/sting/utils/PackageUtils.java
index 3ff474686..f834c8fa1 100755
--- a/java/src/org/broadinstitute/sting/utils/PackageUtils.java
+++ b/java/src/org/broadinstitute/sting/utils/PackageUtils.java
@@ -3,16 +3,30 @@ package org.broadinstitute.sting.utils;
import org.reflections.Reflections;
import org.reflections.scanners.SubTypesScanner;
import org.reflections.util.AbstractConfiguration;
-import org.reflections.util.ClasspathHelper;
+import org.apache.log4j.Logger;
import java.util.Set;
import java.util.ArrayList;
import java.util.List;
+import java.util.Collection;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.io.File;
+import java.io.IOException;
+
+import com.google.common.collect.Lists;
/**
* PackageUtils contains some useful methods for package introspection.
*/
public class PackageUtils {
+ /**
+ * our log, which we want to capture anything from this class
+ */
+ private static Logger logger = Logger.getLogger(PackageUtils.class);
+
/**
* A reference into our introspection utility.
*/
@@ -20,9 +34,9 @@ public class PackageUtils {
static {
// Initialize general-purpose source tree reflector.
- reflections = new Reflections( new AbstractConfiguration() {
+ reflections = new Reflections(new AbstractConfiguration() {
{
- setUrls(ClasspathHelper.getUrlsForCurrentClasspath());
+ setUrls(PackageUtils.getUrlsForClasspath(System.getProperty("java.class.path")));
setScanners(new SubTypesScanner());
}
});
@@ -31,25 +45,116 @@ public class PackageUtils {
/**
* Private constructor. No instantiating this class!
*/
- private PackageUtils() {}
+ private PackageUtils() {
+ }
+
{
}
/**
* Return the classes that implement the specified interface.
*
- * @param iface the interface which returned classes should implement.
- * @return the list of classes that implement the interface.
+ * @param iface the interface which returned classes should implement.
+ * @return the list of classes that implement the interface.
*/
public static List> getClassesImplementingInterface(Class iface) {
// Load all classes implementing the given interface, then filter out any class that isn't concrete.
Set> allTypes = reflections.getSubTypesOf(iface);
List> concreteTypes = new ArrayList>();
- for( Class extends T> type: allTypes ) {
- if( JVMUtils.isConcrete(type) )
+ for (Class extends T> type : allTypes) {
+ if (JVMUtils.isConcrete(type))
concreteTypes.add(type);
}
return concreteTypes;
}
+
+ /**
+ * get a list of URL's, given the current classpath. This function is a fix for the
+ * reflections package, which doesn't correctly expand the classpath from a jar (it doesn't
+ * get the manifest and parse out the embedded classpth).
+ * @param classpath the current classpath
+ * @return
+ */
+ public static Collection getUrlsForClasspath(String classpath) {
+ // if the classpath is null, we can't really do anything
+ if (classpath == null || classpath.equals(""))
+ throw new StingException("Classpath cannot be empty or null");
+ List urls = Lists.newArrayList();
+
+ // the current working directory
+ String baseDir = System.getProperty("user.dir");
+
+ // our collection of classpath's to expand
+ List javaClassPath = new ArrayList();
+
+ // the current classpath can be a list of path's seperated by a semicolon
+ String[] classPaths = classpath.split(File.pathSeparator);
+ for (String part : classPaths) {
+ extractJarClasspath(baseDir, javaClassPath, part);
+ }
+
+ // check to make sure each extracted path exists, if so add it to our list
+ if (javaClassPath.size() > 0)
+ for (JarPath path : javaClassPath) {
+ try {
+ if (path.isValid())
+ urls.add(path.toValidFile().toURL());
+ } catch (MalformedURLException e) {
+ throw new StingException("could not create url from " + path, e);
+ }
+ }
+
+ return urls;
+ }
+
+ /**
+ * extract the classpath from a jar
+ *
+ * @param baseDir the base
+ * @param javaClassPath the list of jar paths
+ * @param part the current the subsection of the classpath we're processing
+ */
+ private static void extractJarClasspath(String baseDir, List javaClassPath, String part) {
+ try {
+ JarFile myJar = new JarFile(part);
+ Attributes.Name classPath = new Attributes.Name("Class-Path");
+ if (myJar.getManifest().getMainAttributes().containsKey(classPath)) {
+ for (String jar : myJar.getManifest().getMainAttributes().getValue(classPath).split(" "))
+ javaClassPath.add(new JarPath(baseDir, new File(part).getParent(), jar));
+ }
+ } catch (IOException e) {
+ logger.warn("could not retreive manifest from " + part);
+ }
+ }
+
+ /**
+ * a simple helper class, to determine the absolute path to a jar file
+ */
+ static class JarPath {
+ private final String mPath;
+ private final String mFilename;
+ private final String mWorkingDir;
+
+ public JarPath(String workingDir, String path, String filename) {
+ this.mPath = path;
+ this.mFilename = filename;
+ mWorkingDir = workingDir;
+ }
+
+ public File toValidFile() {
+ if (new File(mFilename).exists())
+ return new File(mFilename);
+ if (new File(mPath + File.separator + mFilename).exists())
+ return new File(mPath + File.separator + mFilename);
+ if (new File(mWorkingDir + File.separator + mFilename).exists())
+ return new File(mWorkingDir + File.separator + mFilename);
+ return null;
+ }
+
+ public boolean isValid() {
+ return (toValidFile() != null) ? true : false;
+ }
+ }
+
}
diff --git a/scala/src/BaseTransitionTableCalculator.scala b/scala/src/BaseTransitionTableCalculator.scala
index b07c539ce..ddd3b8548 100755
--- a/scala/src/BaseTransitionTableCalculator.scala
+++ b/scala/src/BaseTransitionTableCalculator.scala
@@ -1,4 +1,4 @@
-package org.broadinstitute.sting.scala
+/**package org.broadinstitute.sting.scala
import gatk.walkers.genotyper.{UnifiedGenotyper, GenotypeCall}
import java.io.File
@@ -68,7 +68,7 @@ class TransitionTable() {
}
}
-class BaseTransitionTableCalculator extends LocusWalker[Unit,Int] {
+class BaseTransitionTableCalculator { // extends LocusWalker[Unit,Int] {
private var MIN_MAPPING_QUALITY = 30
private var MIN_BASE_QUALITY = 20
private var MIN_LOD = 5
@@ -208,3 +208,4 @@ class BaseTransitionTableCalculator extends LocusWalker[Unit,Int] {
print1("1-mismatch-rev", tableREV)
}
}
+*/
\ No newline at end of file
diff --git a/scala/src/PrintReadsScala.scala b/scala/src/ScalaCountLoci.scala
similarity index 86%
rename from scala/src/PrintReadsScala.scala
rename to scala/src/ScalaCountLoci.scala
index 18bc9b2e6..658aabc18 100755
--- a/scala/src/PrintReadsScala.scala
+++ b/scala/src/ScalaCountLoci.scala
@@ -5,9 +5,8 @@ import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker
import org.broadinstitute.sting.gatk.contexts.ReferenceContext
import org.broadinstitute.sting.gatk.contexts.AlignmentContext
-class PrintReadsScala extends LocusWalker[Int,Int] {
+class ScalaCountLoci extends LocusWalker[Int,Int] {
override def map(tracker: RefMetaDataTracker, ref: ReferenceContext, context: AlignmentContext): Int = {
- //println(context.getReads().size())
return 1
}