rod's now have names. Use getName() to access it. Next step is better interface to accessing rods
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@286 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
5019971290
commit
edc44807af
|
|
@ -28,9 +28,9 @@
|
||||||
<key>GanttGroupShading</key>
|
<key>GanttGroupShading</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>GanttVisibleRect</key>
|
<key>GanttVisibleRect</key>
|
||||||
<string>{{-35, 124}, {1025, 1033}}</string>
|
<string>{{-35, 141}, {1025, 1033}}</string>
|
||||||
<key>OutlineVisibleRect</key>
|
<key>OutlineVisibleRect</key>
|
||||||
<string>{{0, 124}, {789, 1033}}</string>
|
<string>{{0, 141}, {789, 1033}}</string>
|
||||||
<key>ScaleWidths</key>
|
<key>ScaleWidths</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>Automatic</key>
|
<key>Automatic</key>
|
||||||
|
|
@ -587,7 +587,7 @@
|
||||||
<key>taskDifferenceEngine</key>
|
<key>taskDifferenceEngine</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>nextId</key>
|
<key>nextId</key>
|
||||||
<integer>111</integer>
|
<integer>112</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>taskUserKeys</key>
|
<key>taskUserKeys</key>
|
||||||
<array/>
|
<array/>
|
||||||
|
|
@ -1373,6 +1373,7 @@
|
||||||
<integer>83</integer>
|
<integer>83</integer>
|
||||||
<integer>95</integer>
|
<integer>95</integer>
|
||||||
<integer>96</integer>
|
<integer>96</integer>
|
||||||
|
<integer>111</integer>
|
||||||
</array>
|
</array>
|
||||||
<key>objectId</key>
|
<key>objectId</key>
|
||||||
<integer>41</integer>
|
<integer>41</integer>
|
||||||
|
|
@ -2391,6 +2392,18 @@
|
||||||
<key>workTime</key>
|
<key>workTime</key>
|
||||||
<real>8</real>
|
<real>8</real>
|
||||||
</dict>
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>effort</key>
|
||||||
|
<real>28800</real>
|
||||||
|
<key>objectId</key>
|
||||||
|
<integer>111</integer>
|
||||||
|
<key>task</key>
|
||||||
|
<string>Fix rodDBSNP</string>
|
||||||
|
<key>workSeconds</key>
|
||||||
|
<real>28800</real>
|
||||||
|
<key>workTime</key>
|
||||||
|
<real>8</real>
|
||||||
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>topResources</key>
|
<key>topResources</key>
|
||||||
<array>
|
<array>
|
||||||
|
|
@ -2401,7 +2414,7 @@
|
||||||
<integer>-1</integer>
|
<integer>-1</integer>
|
||||||
</array>
|
</array>
|
||||||
<key>uuid</key>
|
<key>uuid</key>
|
||||||
<string>E50852A9-C0BE-452A-A050-4FF83DEF06D7</string>
|
<string>85860500-DAB8-4D75-95EE-F86F00907D5D</string>
|
||||||
<key>version</key>
|
<key>version</key>
|
||||||
<integer>2</integer>
|
<integer>2</integer>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
|
||||||
|
|
@ -158,21 +158,21 @@ public class GenomeAnalysisTK extends CommandLineProgram {
|
||||||
List<ReferenceOrderedData<? extends ReferenceOrderedDatum> > rods = new ArrayList<ReferenceOrderedData<? extends ReferenceOrderedDatum> >();
|
List<ReferenceOrderedData<? extends ReferenceOrderedDatum> > rods = new ArrayList<ReferenceOrderedData<? extends ReferenceOrderedDatum> >();
|
||||||
|
|
||||||
if ( TEST_ROD ) {
|
if ( TEST_ROD ) {
|
||||||
ReferenceOrderedData<rodGFF> gff = new ReferenceOrderedData<rodGFF>(new File("trunk/data/gFFTest.gff"), rodGFF.class );
|
ReferenceOrderedData<rodGFF> gff = new ReferenceOrderedData<rodGFF>("test", new File("trunk/data/gFFTest.gff"), rodGFF.class );
|
||||||
gff.testMe();
|
gff.testMe();
|
||||||
|
|
||||||
//ReferenceOrderedData dbsnp = new ReferenceOrderedData(new File("trunk/data/dbSNP_head.txt"), rodDbSNP.class );
|
//ReferenceOrderedData dbsnp = new ReferenceOrderedData(new File("trunk/data/dbSNP_head.txt"), rodDbSNP.class );
|
||||||
ReferenceOrderedData<rodDbSNP> dbsnp = new ReferenceOrderedData<rodDbSNP>(new File("/Volumes/Users/mdepristo/broad/ATK/exampleSAMs/dbSNP_chr20.txt"), rodDbSNP.class );
|
ReferenceOrderedData<rodDbSNP> dbsnp = new ReferenceOrderedData<rodDbSNP>("dbSNP", new File("/Volumes/Users/mdepristo/broad/ATK/exampleSAMs/dbSNP_chr20.txt"), rodDbSNP.class );
|
||||||
//dbsnp.testMe();
|
//dbsnp.testMe();
|
||||||
rods.add(dbsnp); // { gff, dbsnp };
|
rods.add(dbsnp); // { gff, dbsnp };
|
||||||
} else {
|
} else {
|
||||||
if ( DBSNP_FILE != null ) {
|
if ( DBSNP_FILE != null ) {
|
||||||
ReferenceOrderedData<rodDbSNP> dbsnp = new ReferenceOrderedData<rodDbSNP>(new File(DBSNP_FILE), rodDbSNP.class );
|
ReferenceOrderedData<rodDbSNP> dbsnp = new ReferenceOrderedData<rodDbSNP>("dbSNP", new File(DBSNP_FILE), rodDbSNP.class );
|
||||||
//dbsnp.testMe();
|
//dbsnp.testMe();
|
||||||
rods.add(dbsnp); // { gff, dbsnp };
|
rods.add(dbsnp); // { gff, dbsnp };
|
||||||
}
|
}
|
||||||
if ( HAPMAP_FILE != null ) {
|
if ( HAPMAP_FILE != null ) {
|
||||||
ReferenceOrderedData<HapMapAlleleFrequenciesROD> hapmap = new ReferenceOrderedData<HapMapAlleleFrequenciesROD>(new File(HAPMAP_FILE), HapMapAlleleFrequenciesROD.class );
|
ReferenceOrderedData<HapMapAlleleFrequenciesROD> hapmap = new ReferenceOrderedData<HapMapAlleleFrequenciesROD>("hapmap", new File(HAPMAP_FILE), HapMapAlleleFrequenciesROD.class );
|
||||||
//dbsnp.testMe();
|
//dbsnp.testMe();
|
||||||
rods.add(hapmap); // { gff, dbsnp };
|
rods.add(hapmap); // { gff, dbsnp };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,9 @@ public class HapMapAlleleFrequenciesROD extends ReferenceOrderedDatum {
|
||||||
public Integer varCounts; // maybe we don't need these?
|
public Integer varCounts; // maybe we don't need these?
|
||||||
public Integer totalCounts; // maybe we don't need these?
|
public Integer totalCounts; // maybe we don't need these?
|
||||||
|
|
||||||
|
public HapMapAlleleFrequenciesROD(String name) {
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
public GenomeLoc getLocation() { return loc; }
|
public GenomeLoc getLocation() { return loc; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import java.io.FileNotFoundException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
import edu.mit.broad.picard.util.TabbedTextFileParser;
|
import edu.mit.broad.picard.util.TabbedTextFileParser;
|
||||||
import org.broadinstitute.sting.gatk.iterators.PushbackIterator;
|
import org.broadinstitute.sting.gatk.iterators.PushbackIterator;
|
||||||
|
|
@ -23,12 +25,14 @@ import org.broadinstitute.sting.utils.Utils;
|
||||||
* To change this template use File | Settings | File Templates.
|
* To change this template use File | Settings | File Templates.
|
||||||
*/
|
*/
|
||||||
public class ReferenceOrderedData<ROD extends ReferenceOrderedDatum> implements Iterable<ROD> {
|
public class ReferenceOrderedData<ROD extends ReferenceOrderedDatum> implements Iterable<ROD> {
|
||||||
|
private String name;
|
||||||
private File file = null;
|
private File file = null;
|
||||||
private Class<ROD> type = null; // runtime type information for object construction
|
private Class<ROD> type = null; // runtime type information for object construction
|
||||||
|
|
||||||
public ReferenceOrderedData(File file, Class<ROD> type ) {
|
public ReferenceOrderedData(final String name, File file, Class<ROD> type ) {
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RODIterator iterator() {
|
public RODIterator iterator() {
|
||||||
|
|
@ -232,7 +236,9 @@ public class ReferenceOrderedData<ROD extends ReferenceOrderedDatum> implements
|
||||||
ROD parseLine(final String[] parts) {
|
ROD parseLine(final String[] parts) {
|
||||||
//System.out.printf("Parsing GFFLine %s%n", Utils.join(" ", parts));
|
//System.out.printf("Parsing GFFLine %s%n", Utils.join(" ", parts));
|
||||||
try {
|
try {
|
||||||
ROD obj = type.newInstance();
|
//ROD obj = type.newInstance();
|
||||||
|
Constructor c = type.getConstructor(String.class);
|
||||||
|
ROD obj = (ROD)c.newInstance(name);
|
||||||
obj.parseLine(parts);
|
obj.parseLine(parts);
|
||||||
return obj;
|
return obj;
|
||||||
} catch ( java.lang.InstantiationException e ) {
|
} catch ( java.lang.InstantiationException e ) {
|
||||||
|
|
@ -241,6 +247,12 @@ public class ReferenceOrderedData<ROD extends ReferenceOrderedDatum> implements
|
||||||
} catch ( java.lang.IllegalAccessException e ) {
|
} catch ( java.lang.IllegalAccessException e ) {
|
||||||
System.out.println(e);
|
System.out.println(e);
|
||||||
return null; // wow, unsafe!
|
return null; // wow, unsafe!
|
||||||
|
} catch ( java.lang.NoSuchMethodException e ) {
|
||||||
|
System.out.println(e);
|
||||||
|
return null; // wow, unsafe!
|
||||||
|
} catch ( InvocationTargetException e ) {
|
||||||
|
System.out.println(e);
|
||||||
|
return null; // wow, unsafe!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,13 @@ import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
* To change this template use File | Settings | File Templates.
|
* To change this template use File | Settings | File Templates.
|
||||||
*/
|
*/
|
||||||
public abstract class ReferenceOrderedDatum implements Comparable<ReferenceOrderedDatum> {
|
public abstract class ReferenceOrderedDatum implements Comparable<ReferenceOrderedDatum> {
|
||||||
|
protected String name;
|
||||||
|
|
||||||
public ReferenceOrderedDatum() { }
|
public ReferenceOrderedDatum(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() { return this.name; }
|
||||||
|
|
||||||
public abstract void parseLine(final String[] parts);
|
public abstract void parseLine(final String[] parts);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,9 @@ public class rodDbSNP extends ReferenceOrderedDatum implements AllelicVariant {
|
||||||
// Constructors
|
// Constructors
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
public rodDbSNP() {}
|
public rodDbSNP(final String name) {
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ public class rodGFF extends ReferenceOrderedDatum {
|
||||||
// Constructors
|
// Constructors
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
public rodGFF() {
|
public rodGFF(final String name) {
|
||||||
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValues(final String contig, final String source, final String feature,
|
public void setValues(final String contig, final String source, final String feature,
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ public class PrepareROD extends CommandLineProgram {
|
||||||
|
|
||||||
Class<? extends ReferenceOrderedDatum> rodClass = Types.get(ROD_TYPE.toLowerCase());
|
Class<? extends ReferenceOrderedDatum> rodClass = Types.get(ROD_TYPE.toLowerCase());
|
||||||
|
|
||||||
ReferenceOrderedData<? extends ReferenceOrderedDatum> rod = new ReferenceOrderedData(new File(ROD_FILE), rodClass );
|
ReferenceOrderedData<? extends ReferenceOrderedDatum> rod = new ReferenceOrderedData("ROD", new File(ROD_FILE), rodClass );
|
||||||
try {
|
try {
|
||||||
rod.validateFile();
|
rod.validateFile();
|
||||||
} catch ( Exception e ) {
|
} catch ( Exception e ) {
|
||||||
|
|
@ -68,7 +68,7 @@ public class PrepareROD extends CommandLineProgram {
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.printf("Validating output file %s%n", rodData.size(), OUTPUT_FILE);
|
System.out.printf("Validating output file %s%n", rodData.size(), OUTPUT_FILE);
|
||||||
ReferenceOrderedData outputRod = new ReferenceOrderedData(new File(OUTPUT_FILE), rodClass );
|
ReferenceOrderedData outputRod = new ReferenceOrderedData("ROD", new File(OUTPUT_FILE), rodClass );
|
||||||
try {
|
try {
|
||||||
outputRod.validateFile();
|
outputRod.validateFile();
|
||||||
//outputRod.hasSameContents(ROD_FILE);
|
//outputRod.hasSameContents(ROD_FILE);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue