Support for List<RodBinding> argument type
This commit is contained in:
parent
38969b9783
commit
7ab8b53339
|
|
@ -27,6 +27,7 @@ package org.broadinstitute.sting.commandline;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
|
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -35,7 +36,7 @@ import java.util.List;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// TODO -- should have a derived class called VariantContentRodBinding with simple accessors
|
// TODO -- should have a derived class called VariantContentRodBinding with simple accessors
|
||||||
public class RodBinding<T> {
|
public class RodBinding {
|
||||||
final String variableName;
|
final String variableName;
|
||||||
final File sourceFile;
|
final File sourceFile;
|
||||||
|
|
||||||
|
|
@ -52,12 +53,16 @@ public class RodBinding<T> {
|
||||||
return sourceFile;
|
return sourceFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<T> getAll(RefMetaDataTracker tracker) {
|
public List<Object> getAll(RefMetaDataTracker tracker) {
|
||||||
return (List<T>)tracker.getReferenceMetaData(variableName);
|
return tracker.getReferenceMetaData(variableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T getVariantContext(RefMetaDataTracker tracker, ReferenceContext ref, GenomeLoc loc) {
|
public VariantContext getVariantContext(RefMetaDataTracker tracker, ReferenceContext ref, GenomeLoc loc) {
|
||||||
return (T)tracker.getVariantContext(ref, variableName, loc);
|
return tracker.getVariantContext(ref, variableName, loc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return String.format("(RodBinding name=%s source=%s)", variableName, sourceFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,10 @@ public class VariantsToTableNewRodStyle extends RodWalker<Integer, Integer> {
|
||||||
public boolean ALLOW_MISSING_DATA = false;
|
public boolean ALLOW_MISSING_DATA = false;
|
||||||
|
|
||||||
@Input(fullName="variants", shortName="V", doc="The variant file we will convert to a table", required=true)
|
@Input(fullName="variants", shortName="V", doc="The variant file we will convert to a table", required=true)
|
||||||
public RodBinding<VariantContext> variants;
|
public RodBinding variants;
|
||||||
|
|
||||||
|
@Input(fullName="variantsList", shortName="VL", doc="The variant file we will convert to a table", required=true)
|
||||||
|
public List<RodBinding> variantsList;
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
out.println(Utils.join("\t", fieldsToTake));
|
out.println(Utils.join("\t", fieldsToTake));
|
||||||
|
|
@ -135,6 +138,9 @@ public class VariantsToTableNewRodStyle extends RodWalker<Integer, Integer> {
|
||||||
if ( tracker == null ) // RodWalkers can make funky map calls
|
if ( tracker == null ) // RodWalkers can make funky map calls
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
for ( RodBinding binding : variantsList )
|
||||||
|
System.out.printf("VariantList binding %s%n", binding);
|
||||||
|
|
||||||
if ( ++nRecords < MAX_RECORDS || MAX_RECORDS == -1 ) {
|
if ( ++nRecords < MAX_RECORDS || MAX_RECORDS == -1 ) {
|
||||||
VariantContext vc = variants.getVariantContext(tracker, ref, context.getLocation());
|
VariantContext vc = variants.getVariantContext(tracker, ref, context.getLocation());
|
||||||
if ( (keepMultiAllelic || vc.isBiallelic()) && ( showFiltered || vc.isNotFiltered() ) ) {
|
if ( (keepMultiAllelic || vc.isBiallelic()) && ( showFiltered || vc.isNotFiltered() ) ) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue