Working on reference ordered data; added build.xml for ant!
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@14 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
f64f3e2d90
commit
0ee2375292
|
|
@ -0,0 +1,38 @@
|
||||||
|
<project name="AnalysisTK" default="dist" basedir=".">
|
||||||
|
<description>
|
||||||
|
simple build file
|
||||||
|
</description>
|
||||||
|
<!-- set global properties for this build -->
|
||||||
|
<property name="src" location="trunk/java/"/>
|
||||||
|
<property name="build" location="out/production/AnalysisTK"/>
|
||||||
|
<property name="dist" location="dist"/>
|
||||||
|
|
||||||
|
<target name="init">
|
||||||
|
<!-- Create the time stamp -->
|
||||||
|
<tstamp/>
|
||||||
|
<!-- Create the build directory structure used by compile -->
|
||||||
|
<mkdir dir="${build}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="compile" depends="init"
|
||||||
|
description="compile the source " >
|
||||||
|
<!-- Compile the java code from ${src} into ${build} -->
|
||||||
|
<javac srcdir="${src}" destdir="${build}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="dist" depends="compile"
|
||||||
|
description="generate the distribution" >
|
||||||
|
<!-- Create the distribution directory -->
|
||||||
|
<mkdir dir="${dist}/lib"/>
|
||||||
|
|
||||||
|
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
|
||||||
|
<jar jarfile="${dist}/AnalysisTK-${DSTAMP}.jar" basedir="${build}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="clean"
|
||||||
|
description="clean up" >
|
||||||
|
<!-- Delete the ${build} and ${dist} directory trees -->
|
||||||
|
<delete dir="${build}"/>
|
||||||
|
<delete dir="${dist}"/>
|
||||||
|
</target>
|
||||||
|
</project>
|
||||||
|
|
@ -25,6 +25,7 @@ public class AnalysisTK extends CommandLineProgram {
|
||||||
@Option(shortName="B", doc="Debugging output", optional=true) public String DEBUGGING_STR = null;
|
@Option(shortName="B", doc="Debugging output", optional=true) public String DEBUGGING_STR = null;
|
||||||
@Option(shortName="L", doc="Genome region to operation on: from chr:start-end", optional=true) public String REGION_STR = null;
|
@Option(shortName="L", doc="Genome region to operation on: from chr:start-end", optional=true) public String REGION_STR = null;
|
||||||
@Option(shortName="T", doc="Type of analysis to run") public String Analysis_Name = null;
|
@Option(shortName="T", doc="Type of analysis to run") public String Analysis_Name = null;
|
||||||
|
@Option(shortName="DBSNP", doc="DBSNP file", optional=true) public String DBSNP_FILE = null;
|
||||||
|
|
||||||
public static HashMap<String, Object> MODULES = new HashMap<String,Object>();
|
public static HashMap<String, Object> MODULES = new HashMap<String,Object>();
|
||||||
public static void addModule(final String name, final Object walker) {
|
public static void addModule(final String name, final Object walker) {
|
||||||
|
|
@ -60,6 +61,11 @@ public class AnalysisTK extends CommandLineProgram {
|
||||||
//dbsnp.testMe();
|
//dbsnp.testMe();
|
||||||
rods = new ReferenceOrderedData[] { dbsnp }; // { gff, dbsnp };
|
rods = new ReferenceOrderedData[] { dbsnp }; // { gff, dbsnp };
|
||||||
}
|
}
|
||||||
|
else if ( DBSNP_FILE != null ) {
|
||||||
|
ReferenceOrderedData dbsnp = new ReferenceOrderedData(new File(DBSNP_FILE), rodDbSNP.class );
|
||||||
|
//dbsnp.testMe();
|
||||||
|
rods = new ReferenceOrderedData[] { dbsnp }; // { gff, dbsnp };
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
rods = new ReferenceOrderedData[] {}; // { gff, dbsnp };
|
rods = new ReferenceOrderedData[] {}; // { gff, dbsnp };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package edu.mit.broad.sting.utils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import edu.mit.broad.picard.util.TabbedTextFileParser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for representing arbitrary reference ordered data sets
|
* Class for representing arbitrary reference ordered data sets
|
||||||
|
|
@ -30,9 +31,14 @@ public class ReferenceOrderedData<ROD extends ReferenceOrderedDatum> implements
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
public void testMe() {
|
public void testMe() {
|
||||||
|
ReferenceOrderedDatum last = null;
|
||||||
for ( ReferenceOrderedDatum rec : this ) {
|
for ( ReferenceOrderedDatum rec : this ) {
|
||||||
System.out.println(rec.toString());
|
if ( last == null || ! last.getContig().equals(rec.getContig()) ) {
|
||||||
|
System.out.println(rec.toString());
|
||||||
|
}
|
||||||
|
last = rec;
|
||||||
}
|
}
|
||||||
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
@ -41,10 +47,11 @@ public class ReferenceOrderedData<ROD extends ReferenceOrderedDatum> implements
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
private class SimpleRODIterator implements Iterator<ROD> {
|
private class SimpleRODIterator implements Iterator<ROD> {
|
||||||
private WhitespaceTextFileParser parser = null;
|
//private WhitespaceTextFileParser parser = null;
|
||||||
|
private TabbedTextFileParser parser = null;
|
||||||
|
|
||||||
public SimpleRODIterator() {
|
public SimpleRODIterator() {
|
||||||
parser = new WhitespaceTextFileParser(true, file);
|
parser = new TabbedTextFileParser(true, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
|
|
@ -81,9 +88,11 @@ public class ReferenceOrderedData<ROD extends ReferenceOrderedDatum> implements
|
||||||
// Otherwise we return the first object who's start is at pos
|
// Otherwise we return the first object who's start is at pos
|
||||||
//
|
//
|
||||||
public ROD seekForward(final String contigName, final int pos) {
|
public ROD seekForward(final String contigName, final int pos) {
|
||||||
|
final boolean DEBUG = false;
|
||||||
|
|
||||||
ROD result = null;
|
ROD result = null;
|
||||||
|
|
||||||
//System.out.printf(" *** starting seek to %s %d %s%n", contigName, pos, prev);
|
if ( DEBUG ) System.out.printf(" *** starting seek to %s %d %s%n", contigName, pos, prev);
|
||||||
while ( hasNext() ) {
|
while ( hasNext() ) {
|
||||||
ROD current = next();
|
ROD current = next();
|
||||||
//System.out.printf(" -> Seeking to %s %d AT %s %d%n", contigName, pos, current.getContig(), current.getStart());
|
//System.out.printf(" -> Seeking to %s %d AT %s %d%n", contigName, pos, current.getContig(), current.getStart());
|
||||||
|
|
@ -102,18 +111,20 @@ public class ReferenceOrderedData<ROD extends ReferenceOrderedDatum> implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( strCmp < 0 ) {
|
else if ( strCmp < 0 ) {
|
||||||
|
if ( DEBUG ) System.out.printf(" -> Jumping to contig %s%n", contigName);
|
||||||
// We've gone past the desired contig, break
|
// We've gone past the desired contig, break
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if ( DEBUG ) {
|
||||||
if ( result == null )
|
if ( result == null )
|
||||||
;
|
;
|
||||||
//System.out.printf(" --- seek result to %s %d is NULL%n", contigName, pos);
|
//System.out.printf(" --- seek result to %s %d is NULL%n", contigName, pos);
|
||||||
else
|
else
|
||||||
System.out.printf(" ### Found %s %d%n", result.getContig(), result.getStart());
|
System.out.printf(" ### Found %s %d%n", result.getContig(), result.getStart());
|
||||||
*/
|
}
|
||||||
|
|
||||||
|
|
||||||
// we ran out of elements or found something
|
// we ran out of elements or found something
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue