List<RodBinding<T>> now working (sort of).
At least the argument parsing system tolerates it.
This commit is contained in:
parent
6acb4aad3b
commit
a6691ab2fd
|
|
@ -111,7 +111,7 @@ public abstract class ArgumentTypeDescriptor {
|
||||||
* @return The parsed object.
|
* @return The parsed object.
|
||||||
*/
|
*/
|
||||||
public Object parse(ParsingEngine parsingEngine, ArgumentSource source, ArgumentMatches matches) {
|
public Object parse(ParsingEngine parsingEngine, ArgumentSource source, ArgumentMatches matches) {
|
||||||
return parse(parsingEngine, source, source.field.getType(), matches);
|
return parse(parsingEngine, source, source.field.getGenericType(), matches);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -133,18 +133,18 @@ public abstract class ArgumentTypeDescriptor {
|
||||||
protected ArgumentDefinition createDefaultArgumentDefinition( ArgumentSource source ) {
|
protected ArgumentDefinition createDefaultArgumentDefinition( ArgumentSource source ) {
|
||||||
Annotation argumentAnnotation = getArgumentAnnotation(source);
|
Annotation argumentAnnotation = getArgumentAnnotation(source);
|
||||||
return new ArgumentDefinition( ArgumentIOType.getIOType(argumentAnnotation),
|
return new ArgumentDefinition( ArgumentIOType.getIOType(argumentAnnotation),
|
||||||
source.field.getType(),
|
source.field.getType(),
|
||||||
ArgumentDefinition.getFullName(argumentAnnotation, source.field.getName()),
|
ArgumentDefinition.getFullName(argumentAnnotation, source.field.getName()),
|
||||||
ArgumentDefinition.getShortName(argumentAnnotation),
|
ArgumentDefinition.getShortName(argumentAnnotation),
|
||||||
ArgumentDefinition.getDoc(argumentAnnotation),
|
ArgumentDefinition.getDoc(argumentAnnotation),
|
||||||
source.isRequired() && !createsTypeDefault(source) && !source.isFlag() && !source.isDeprecated(),
|
source.isRequired() && !createsTypeDefault(source) && !source.isFlag() && !source.isDeprecated(),
|
||||||
source.isFlag(),
|
source.isFlag(),
|
||||||
source.isMultiValued(),
|
source.isMultiValued(),
|
||||||
source.isHidden(),
|
source.isHidden(),
|
||||||
getCollectionComponentType(source.field),
|
makeRawTypeIfNecessary(getCollectionComponentType(source.field)),
|
||||||
ArgumentDefinition.getExclusiveOf(argumentAnnotation),
|
ArgumentDefinition.getExclusiveOf(argumentAnnotation),
|
||||||
ArgumentDefinition.getValidationRegex(argumentAnnotation),
|
ArgumentDefinition.getValidationRegex(argumentAnnotation),
|
||||||
getValidOptions(source) );
|
getValidOptions(source) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -153,7 +153,7 @@ public abstract class ArgumentTypeDescriptor {
|
||||||
* @return The parameterized component type, or String.class if the parameterized type could not be found.
|
* @return The parameterized component type, or String.class if the parameterized type could not be found.
|
||||||
* @throws IllegalArgumentException If more than one parameterized type is found on the field.
|
* @throws IllegalArgumentException If more than one parameterized type is found on the field.
|
||||||
*/
|
*/
|
||||||
protected Class getCollectionComponentType( Field field ) {
|
protected Type getCollectionComponentType( Field field ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -164,7 +164,7 @@ public abstract class ArgumentTypeDescriptor {
|
||||||
* @param matches The argument matches for the argument source, or the individual argument match for a scalar if this is being called to help parse a collection.
|
* @param matches The argument matches for the argument source, or the individual argument match for a scalar if this is being called to help parse a collection.
|
||||||
* @return The individual parsed object matching the argument match with Class type.
|
* @return The individual parsed object matching the argument match with Class type.
|
||||||
*/
|
*/
|
||||||
public abstract Object parse( ParsingEngine parsingEngine, ArgumentSource source, Class type, ArgumentMatches matches );
|
public abstract Object parse( ParsingEngine parsingEngine, ArgumentSource source, Type type, ArgumentMatches matches );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the argument source only accepts a small set of options, populate the returned list with
|
* If the argument source only accepts a small set of options, populate the returned list with
|
||||||
|
|
@ -275,6 +275,18 @@ public abstract class ArgumentTypeDescriptor {
|
||||||
public static boolean isArgumentHidden(Field field) {
|
public static boolean isArgumentHidden(Field field) {
|
||||||
return field.isAnnotationPresent(Hidden.class);
|
return field.isAnnotationPresent(Hidden.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Class makeRawTypeIfNecessary(Type t) {
|
||||||
|
if ( t == null )
|
||||||
|
return null;
|
||||||
|
else if ( t instanceof ParameterizedType )
|
||||||
|
return (Class)((ParameterizedType) t).getRawType();
|
||||||
|
else if ( t instanceof Class ) {
|
||||||
|
return (Class)t;
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("Unable to determine Class-derived component type of field: " + t);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -296,13 +308,13 @@ class RodBindingArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parse(ParsingEngine parsingEngine, ArgumentSource source, Class type, ArgumentMatches matches) {
|
public Object parse(ParsingEngine parsingEngine, ArgumentSource source, Type type, ArgumentMatches matches) {
|
||||||
ArgumentDefinition defaultDefinition = createDefaultArgumentDefinition(source);
|
ArgumentDefinition defaultDefinition = createDefaultArgumentDefinition(source);
|
||||||
String value = getArgumentValue( defaultDefinition, matches );
|
String value = getArgumentValue( defaultDefinition, matches );
|
||||||
try {
|
try {
|
||||||
Tags tags = getArgumentTags(matches);
|
Tags tags = getArgumentTags(matches);
|
||||||
Constructor ctor = type.getConstructor(Class.class, String.class, String.class, Tags.class);
|
Constructor ctor = (makeRawTypeIfNecessary(type)).getConstructor(Class.class, String.class, String.class, Tags.class);
|
||||||
Class parameterType = getParameterizedTypeClass(source.field.getGenericType());
|
Class parameterType = getParameterizedTypeClass(type);
|
||||||
RodBinding result = (RodBinding)ctor.newInstance(parameterType, source.field.getName(), value, tags);
|
RodBinding result = (RodBinding)ctor.newInstance(parameterType, source.field.getName(), value, tags);
|
||||||
parsingEngine.addTags(result,tags);
|
parsingEngine.addTags(result,tags);
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -352,7 +364,8 @@ class SimpleArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parse(ParsingEngine parsingEngine, ArgumentSource source, Class type, ArgumentMatches matches) {
|
public Object parse(ParsingEngine parsingEngine, ArgumentSource source, Type fulltype, ArgumentMatches matches) {
|
||||||
|
Class type = makeRawTypeIfNecessary(fulltype);
|
||||||
if (source.isFlag())
|
if (source.isFlag())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
@ -393,7 +406,7 @@ class SimpleArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
throw e;
|
throw e;
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
throw new UserException.CommandLineException(String.format("Failed to parse value %s for argument %s. This is most commonly caused by providing an incorrect data type (e.g. a double when an int is required)",
|
throw new UserException.CommandLineException(String.format("Failed to parse value %s for argument %s. This is most commonly caused by providing an incorrect data type (e.g. a double when an int is required)",
|
||||||
value, source.field.getName()));
|
value, source.field.getName()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new DynamicClassResolutionException(String.class, e);
|
throw new DynamicClassResolutionException(String.class, e);
|
||||||
}
|
}
|
||||||
|
|
@ -436,8 +449,9 @@ class CompoundArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Object parse(ParsingEngine parsingEngine,ArgumentSource source, Class type, ArgumentMatches matches) {
|
public Object parse(ParsingEngine parsingEngine,ArgumentSource source, Type fulltype, ArgumentMatches matches) {
|
||||||
Class componentType;
|
Class type = makeRawTypeIfNecessary(fulltype);
|
||||||
|
Type componentType;
|
||||||
Object result;
|
Object result;
|
||||||
|
|
||||||
if( Collection.class.isAssignableFrom(type) ) {
|
if( Collection.class.isAssignableFrom(type) ) {
|
||||||
|
|
@ -452,7 +466,7 @@ class CompoundArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentType = getCollectionComponentType( source.field );
|
componentType = getCollectionComponentType( source.field );
|
||||||
ArgumentTypeDescriptor componentArgumentParser = parsingEngine.selectBestTypeDescriptor(componentType);
|
ArgumentTypeDescriptor componentArgumentParser = parsingEngine.selectBestTypeDescriptor(makeRawTypeIfNecessary(componentType));
|
||||||
|
|
||||||
Collection collection;
|
Collection collection;
|
||||||
try {
|
try {
|
||||||
|
|
@ -481,7 +495,7 @@ class CompoundArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
}
|
}
|
||||||
else if( type.isArray() ) {
|
else if( type.isArray() ) {
|
||||||
componentType = type.getComponentType();
|
componentType = type.getComponentType();
|
||||||
ArgumentTypeDescriptor componentArgumentParser = parsingEngine.selectBestTypeDescriptor(componentType);
|
ArgumentTypeDescriptor componentArgumentParser = parsingEngine.selectBestTypeDescriptor(makeRawTypeIfNecessary(componentType));
|
||||||
|
|
||||||
// Assemble a collection of individual values used in this computation.
|
// Assemble a collection of individual values used in this computation.
|
||||||
Collection<ArgumentMatch> values = new ArrayList<ArgumentMatch>();
|
Collection<ArgumentMatch> values = new ArrayList<ArgumentMatch>();
|
||||||
|
|
@ -489,7 +503,7 @@ class CompoundArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
for( ArgumentMatch value: match )
|
for( ArgumentMatch value: match )
|
||||||
values.add(value);
|
values.add(value);
|
||||||
|
|
||||||
result = Array.newInstance(componentType,values.size());
|
result = Array.newInstance(makeRawTypeIfNecessary(componentType),values.size());
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for( ArgumentMatch value: values ) {
|
for( ArgumentMatch value: values ) {
|
||||||
|
|
@ -512,16 +526,16 @@ class CompoundArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
* @throws IllegalArgumentException If more than one parameterized type is found on the field.
|
* @throws IllegalArgumentException If more than one parameterized type is found on the field.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Class getCollectionComponentType( Field field ) {
|
protected Type getCollectionComponentType( Field field ) {
|
||||||
// If this is a parameterized collection, find the contained type. If blow up if more than one type exists.
|
// If this is a parameterized collection, find the contained type. If blow up if more than one type exists.
|
||||||
if( field.getGenericType() instanceof ParameterizedType) {
|
if( field.getGenericType() instanceof ParameterizedType) {
|
||||||
ParameterizedType parameterizedType = (ParameterizedType)field.getGenericType();
|
ParameterizedType parameterizedType = (ParameterizedType)field.getGenericType();
|
||||||
if( parameterizedType.getActualTypeArguments().length > 1 )
|
if( parameterizedType.getActualTypeArguments().length > 1 )
|
||||||
throw new IllegalArgumentException("Unable to determine collection type of field: " + field.toString());
|
throw new IllegalArgumentException("Unable to determine collection type of field: " + field.toString());
|
||||||
return (Class)parameterizedType.getActualTypeArguments()[0];
|
return parameterizedType.getActualTypeArguments()[0];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return String.class;
|
return String.class;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -568,7 +582,7 @@ class MultiplexArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
throw new ReviewedStingException("No multiplexed ids available");
|
throw new ReviewedStingException("No multiplexed ids available");
|
||||||
|
|
||||||
Map<Object,Object> multiplexedMapping = new HashMap<Object,Object>();
|
Map<Object,Object> multiplexedMapping = new HashMap<Object,Object>();
|
||||||
Class componentType = getCollectionComponentType(source.field);
|
Class componentType = makeRawTypeIfNecessary(getCollectionComponentType(source.field));
|
||||||
ArgumentTypeDescriptor componentTypeDescriptor = parsingEngine.selectBestTypeDescriptor(componentType);
|
ArgumentTypeDescriptor componentTypeDescriptor = parsingEngine.selectBestTypeDescriptor(componentType);
|
||||||
|
|
||||||
for(Object id: multiplexedIds) {
|
for(Object id: multiplexedIds) {
|
||||||
|
|
@ -582,13 +596,13 @@ class MultiplexArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parse(ParsingEngine parsingEngine, ArgumentSource source, Class type, ArgumentMatches matches) {
|
public Object parse(ParsingEngine parsingEngine, ArgumentSource source, Type type, ArgumentMatches matches) {
|
||||||
if(multiplexedIds == null)
|
if(multiplexedIds == null)
|
||||||
throw new ReviewedStingException("Cannot directly parse a MultiplexArgumentTypeDescriptor; must create a derivative type descriptor first.");
|
throw new ReviewedStingException("Cannot directly parse a MultiplexArgumentTypeDescriptor; must create a derivative type descriptor first.");
|
||||||
|
|
||||||
Map<Object,Object> multiplexedMapping = new HashMap<Object,Object>();
|
Map<Object,Object> multiplexedMapping = new HashMap<Object,Object>();
|
||||||
|
|
||||||
Class componentType = getCollectionComponentType(source.field);
|
Class componentType = makeRawTypeIfNecessary(getCollectionComponentType(source.field));
|
||||||
|
|
||||||
|
|
||||||
for(Object id: multiplexedIds) {
|
for(Object id: multiplexedIds) {
|
||||||
|
|
@ -659,7 +673,7 @@ class MultiplexArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
* @throws IllegalArgumentException If more than one parameterized type is found on the field.
|
* @throws IllegalArgumentException If more than one parameterized type is found on the field.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected Class getCollectionComponentType( Field field ) {
|
protected Type getCollectionComponentType( Field field ) {
|
||||||
// Multiplex arguments must resolve to maps from which the clp should extract the second type.
|
// Multiplex arguments must resolve to maps from which the clp should extract the second type.
|
||||||
if( field.getGenericType() instanceof ParameterizedType) {
|
if( field.getGenericType() instanceof ParameterizedType) {
|
||||||
ParameterizedType parameterizedType = (ParameterizedType)field.getGenericType();
|
ParameterizedType parameterizedType = (ParameterizedType)field.getGenericType();
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import org.broadinstitute.sting.commandline.*;
|
||||||
import org.broadinstitute.sting.gatk.arguments.GATKArgumentCollection;
|
import org.broadinstitute.sting.gatk.arguments.GATKArgumentCollection;
|
||||||
import org.broadinstitute.sting.gatk.filters.ReadFilter;
|
import org.broadinstitute.sting.gatk.filters.ReadFilter;
|
||||||
import org.broadinstitute.sting.gatk.io.stubs.OutputStreamArgumentTypeDescriptor;
|
import org.broadinstitute.sting.gatk.io.stubs.OutputStreamArgumentTypeDescriptor;
|
||||||
import org.broadinstitute.sting.gatk.io.stubs.SAMFileReaderArgumentTypeDescriptor;
|
|
||||||
import org.broadinstitute.sting.gatk.io.stubs.SAMFileWriterArgumentTypeDescriptor;
|
import org.broadinstitute.sting.gatk.io.stubs.SAMFileWriterArgumentTypeDescriptor;
|
||||||
import org.broadinstitute.sting.gatk.io.stubs.VCFWriterArgumentTypeDescriptor;
|
import org.broadinstitute.sting.gatk.io.stubs.VCFWriterArgumentTypeDescriptor;
|
||||||
import org.broadinstitute.sting.gatk.phonehome.GATKRunReport;
|
import org.broadinstitute.sting.gatk.phonehome.GATKRunReport;
|
||||||
|
|
@ -165,7 +164,6 @@ public abstract class CommandLineExecutable extends CommandLineProgram {
|
||||||
*/
|
*/
|
||||||
protected Collection<ArgumentTypeDescriptor> getArgumentTypeDescriptors() {
|
protected Collection<ArgumentTypeDescriptor> getArgumentTypeDescriptors() {
|
||||||
return Arrays.asList( new VCFWriterArgumentTypeDescriptor(engine,System.out,argumentSources),
|
return Arrays.asList( new VCFWriterArgumentTypeDescriptor(engine,System.out,argumentSources),
|
||||||
new SAMFileReaderArgumentTypeDescriptor(engine),
|
|
||||||
new SAMFileWriterArgumentTypeDescriptor(engine,System.out),
|
new SAMFileWriterArgumentTypeDescriptor(engine,System.out),
|
||||||
new OutputStreamArgumentTypeDescriptor(engine,System.out) );
|
new OutputStreamArgumentTypeDescriptor(engine,System.out) );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert an OutputStreamStub instead of a full-fledged concrete OutputStream implementations.
|
* Insert an OutputStreamStub instead of a full-fledged concrete OutputStream implementations.
|
||||||
|
|
@ -78,7 +79,7 @@ public class OutputStreamArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parse( ParsingEngine parsingEngine, ArgumentSource source, Class type, ArgumentMatches matches ) {
|
public Object parse( ParsingEngine parsingEngine, ArgumentSource source, Type type, ArgumentMatches matches ) {
|
||||||
ArgumentDefinition definition = createDefaultArgumentDefinition(source);
|
ArgumentDefinition definition = createDefaultArgumentDefinition(source);
|
||||||
String fileName = getArgumentValue( definition, matches );
|
String fileName = getArgumentValue( definition, matches );
|
||||||
|
|
||||||
|
|
@ -91,7 +92,7 @@ public class OutputStreamArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
|
|
||||||
engine.addOutput(stub);
|
engine.addOutput(stub);
|
||||||
|
|
||||||
Object result = createInstanceOfClass(type,stub);
|
Object result = createInstanceOfClass(makeRawTypeIfNecessary(type),stub);
|
||||||
// WARNING: Side effects required by engine!
|
// WARNING: Side effects required by engine!
|
||||||
parsingEngine.addTags(result,getArgumentTags(matches));
|
parsingEngine.addTags(result,getArgumentTags(matches));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||||
import org.broadinstitute.sting.utils.sam.SAMFileReaderBuilder;
|
import org.broadinstitute.sting.utils.sam.SAMFileReaderBuilder;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describe how to parse SAMFileReaders.
|
* Describe how to parse SAMFileReaders.
|
||||||
|
|
@ -59,7 +60,7 @@ public class SAMFileReaderArgumentTypeDescriptor extends ArgumentTypeDescriptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parse( ParsingEngine parsingEngine, ArgumentSource source, Class type, ArgumentMatches matches ) {
|
public Object parse( ParsingEngine parsingEngine, ArgumentSource source, Type type, ArgumentMatches matches ) {
|
||||||
SAMFileReaderBuilder builder = new SAMFileReaderBuilder();
|
SAMFileReaderBuilder builder = new SAMFileReaderBuilder();
|
||||||
|
|
||||||
String readerFileName = getArgumentValue( createDefaultArgumentDefinition(source), matches );
|
String readerFileName = getArgumentValue( createDefaultArgumentDefinition(source), matches );
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -102,7 +103,7 @@ public class SAMFileWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object parse( ParsingEngine parsingEngine, ArgumentSource source, Class type, ArgumentMatches matches ) {
|
public Object parse( ParsingEngine parsingEngine, ArgumentSource source, Type type, ArgumentMatches matches ) {
|
||||||
// Extract all possible parameters that could be passed to a BAM file writer?
|
// Extract all possible parameters that could be passed to a BAM file writer?
|
||||||
ArgumentDefinition bamArgumentDefinition = createBAMArgumentDefinition(source);
|
ArgumentDefinition bamArgumentDefinition = createBAMArgumentDefinition(source);
|
||||||
String writerFileName = getArgumentValue( bamArgumentDefinition, matches );
|
String writerFileName = getArgumentValue( bamArgumentDefinition, matches );
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
@ -124,7 +125,7 @@ public class VCFWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor {
|
||||||
* @return Transform from the matches into the associated argument.
|
* @return Transform from the matches into the associated argument.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object parse( ParsingEngine parsingEngine, ArgumentSource source, Class type, ArgumentMatches matches ) {
|
public Object parse( ParsingEngine parsingEngine, ArgumentSource source, Type type, ArgumentMatches matches ) {
|
||||||
ArgumentDefinition defaultArgumentDefinition = createDefaultArgumentDefinition(source);
|
ArgumentDefinition defaultArgumentDefinition = createDefaultArgumentDefinition(source);
|
||||||
// Get the filename for the genotype file, if it exists. If not, we'll need to send output to out.
|
// Get the filename for the genotype file, if it exists. If not, we'll need to send output to out.
|
||||||
String writerFileName = getArgumentValue(defaultArgumentDefinition,matches);
|
String writerFileName = getArgumentValue(defaultArgumentDefinition,matches);
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,8 @@ public class VariantsToTableNewRodStyle extends RodWalker<Integer, Integer> {
|
||||||
@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<VariantContext> variants;
|
||||||
|
|
||||||
// @Input(fullName="rodList", shortName="RL", doc="A list of ROD types that we will convert to a table", required=true)
|
@Input(fullName="rodList", shortName="RL", doc="A list of ROD types that we will convert to a table", required=true)
|
||||||
// public List<RodBinding<Feature>> variantsList;
|
public List<RodBinding<Feature>> variantsList;
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
out.println(Utils.join("\t", fieldsToTake));
|
out.println(Utils.join("\t", fieldsToTake));
|
||||||
|
|
@ -135,8 +135,8 @@ 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 )
|
for ( RodBinding binding : variantsList )
|
||||||
// System.out.printf("VariantList binding %s tags=%s%n", binding, getToolkit().getTags(binding).getPositionalTags());
|
System.out.printf("VariantList binding %s tags=%s%n", binding, binding.getTags().getPositionalTags());
|
||||||
|
|
||||||
if ( ++nRecords < MAX_RECORDS || MAX_RECORDS == -1 ) {
|
if ( ++nRecords < MAX_RECORDS || MAX_RECORDS == -1 ) {
|
||||||
VariantContext vc = variants.getFirstValue(tracker, context.getLocation());
|
VariantContext vc = variants.getFirstValue(tracker, context.getLocation());
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ import org.broadinstitute.sting.gatk.arguments.ValidationExclusion;
|
||||||
import org.broadinstitute.sting.gatk.filters.FilterManager;
|
import org.broadinstitute.sting.gatk.filters.FilterManager;
|
||||||
import org.broadinstitute.sting.gatk.filters.ReadFilter;
|
import org.broadinstitute.sting.gatk.filters.ReadFilter;
|
||||||
import org.broadinstitute.sting.gatk.io.stubs.OutputStreamArgumentTypeDescriptor;
|
import org.broadinstitute.sting.gatk.io.stubs.OutputStreamArgumentTypeDescriptor;
|
||||||
import org.broadinstitute.sting.gatk.io.stubs.SAMFileReaderArgumentTypeDescriptor;
|
|
||||||
import org.broadinstitute.sting.gatk.io.stubs.SAMFileWriterArgumentTypeDescriptor;
|
import org.broadinstitute.sting.gatk.io.stubs.SAMFileWriterArgumentTypeDescriptor;
|
||||||
import org.broadinstitute.sting.gatk.io.stubs.VCFWriterArgumentTypeDescriptor;
|
import org.broadinstitute.sting.gatk.io.stubs.VCFWriterArgumentTypeDescriptor;
|
||||||
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrackBuilder;
|
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrackBuilder;
|
||||||
|
|
@ -118,7 +117,6 @@ public class GATKExtensionsGenerator extends CommandLineProgram {
|
||||||
protected Collection<ArgumentTypeDescriptor> getArgumentTypeDescriptors() {
|
protected Collection<ArgumentTypeDescriptor> getArgumentTypeDescriptors() {
|
||||||
List<ArgumentTypeDescriptor> typeDescriptors = new ArrayList<ArgumentTypeDescriptor>();
|
List<ArgumentTypeDescriptor> typeDescriptors = new ArrayList<ArgumentTypeDescriptor>();
|
||||||
typeDescriptors.add(new VCFWriterArgumentTypeDescriptor(GATKEngine,System.out,Collections.<Object>emptyList()));
|
typeDescriptors.add(new VCFWriterArgumentTypeDescriptor(GATKEngine,System.out,Collections.<Object>emptyList()));
|
||||||
typeDescriptors.add(new SAMFileReaderArgumentTypeDescriptor(GATKEngine));
|
|
||||||
typeDescriptors.add(new SAMFileWriterArgumentTypeDescriptor(GATKEngine,System.out));
|
typeDescriptors.add(new SAMFileWriterArgumentTypeDescriptor(GATKEngine,System.out));
|
||||||
typeDescriptors.add(new OutputStreamArgumentTypeDescriptor(GATKEngine,System.out));
|
typeDescriptors.add(new OutputStreamArgumentTypeDescriptor(GATKEngine,System.out));
|
||||||
return typeDescriptors;
|
return typeDescriptors;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue