Fixed Queue's tagging of RodBindings.
Fixed argument definition names.
This commit is contained in:
parent
249614e6bb
commit
22ca44c015
|
|
@ -144,6 +144,9 @@ public abstract class ArgumentDefinitionField extends ArgumentField {
|
||||||
} else if ("input_file".equals(argumentDefinition.fullName) && argumentDefinition.ioType == ArgumentIOType.INPUT) {
|
} else if ("input_file".equals(argumentDefinition.fullName) && argumentDefinition.ioType == ArgumentIOType.INPUT) {
|
||||||
return Arrays.asList(new InputTaggedFileDefinitionField(argumentDefinition), new InputIndexesArgumentField(argumentDefinition, BAMIndex.BAMIndexSuffix, ".bam"));
|
return Arrays.asList(new InputTaggedFileDefinitionField(argumentDefinition), new InputIndexesArgumentField(argumentDefinition, BAMIndex.BAMIndexSuffix, ".bam"));
|
||||||
|
|
||||||
|
} else if ((RodBinding.class.equals(argumentDefinition.argumentType) || RodBinding.class.equals(argumentDefinition.componentType)) && argumentDefinition.ioType == ArgumentIOType.INPUT) {
|
||||||
|
return Arrays.asList(new InputTaggedFileDefinitionField(argumentDefinition), new InputIndexesArgumentField(argumentDefinition, Tribble.STANDARD_INDEX_EXTENSION));
|
||||||
|
|
||||||
} else if (argumentDefinition.ioType == ArgumentIOType.INPUT) {
|
} else if (argumentDefinition.ioType == ArgumentIOType.INPUT) {
|
||||||
return Collections.singletonList(new InputArgumentField(argumentDefinition));
|
return Collections.singletonList(new InputArgumentField(argumentDefinition));
|
||||||
|
|
||||||
|
|
@ -196,7 +199,7 @@ public abstract class ArgumentDefinitionField extends ArgumentField {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (intervalFields.contains(argumentDefinition.fullName) && argumentDefinition.ioType == ArgumentIOType.INPUT)
|
// if (intervalFields.contains(argumentDefinition.fullName) && argumentDefinition.ioType == ArgumentIOType.INPUT)
|
||||||
// Change intervals exclusize of intervalsString.
|
// Change intervals exclusive of intervalsString.
|
||||||
private static class IntervalFileArgumentField extends InputArgumentField {
|
private static class IntervalFileArgumentField extends InputArgumentField {
|
||||||
public IntervalFileArgumentField(ArgumentDefinition argumentDefinition) {
|
public IntervalFileArgumentField(ArgumentDefinition argumentDefinition) {
|
||||||
super(argumentDefinition);
|
super(argumentDefinition);
|
||||||
|
|
@ -332,9 +335,7 @@ public abstract class ArgumentDefinitionField extends ArgumentField {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// Allows the user to specify the track name, track type, and the file.
|
||||||
* The other extreme of a NamedRodBindingField, allows the user to specify the track name, track type, and the file.
|
|
||||||
*/
|
|
||||||
public static class RodBindArgumentField extends ArgumentDefinitionField {
|
public static class RodBindArgumentField extends ArgumentDefinitionField {
|
||||||
public RodBindArgumentField(ArgumentDefinition argumentDefinition) {
|
public RodBindArgumentField(ArgumentDefinition argumentDefinition) {
|
||||||
super(argumentDefinition);
|
super(argumentDefinition);
|
||||||
|
|
@ -347,25 +348,28 @@ public abstract class ArgumentDefinitionField extends ArgumentField {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// Tagged input_files or other rods.
|
||||||
* Named input_files.
|
|
||||||
*/
|
|
||||||
public static class InputTaggedFileDefinitionField extends ArgumentDefinitionField {
|
public static class InputTaggedFileDefinitionField extends ArgumentDefinitionField {
|
||||||
public InputTaggedFileDefinitionField(ArgumentDefinition argumentDefinition) {
|
public InputTaggedFileDefinitionField(ArgumentDefinition argumentDefinition) {
|
||||||
super(argumentDefinition);
|
super(argumentDefinition);
|
||||||
}
|
}
|
||||||
@Override protected Class<?> getInnerType() { return null; } // TaggedFile does not need to be imported.
|
@Override protected Class<?> getInnerType() { return null; } // TaggedFile does not need to be imported.
|
||||||
@Override protected String getFieldType() { return "List[File]"; }
|
@Override protected String getFieldType() { return argumentDefinition.isMultiValued ? "List[File]" : "File"; }
|
||||||
@Override protected String getDefaultValue() { return "Nil"; }
|
@Override protected String getDefaultValue() { return argumentDefinition.isMultiValued ? "Nil" : "_"; }
|
||||||
@Override protected String getCommandLineTemplate() {
|
@Override protected String getCommandLineTemplate() {
|
||||||
|
if (argumentDefinition.isMultiValued) {
|
||||||
return " + repeat(\"\", %3$s, format=TaggedFile.formatCommandLine(\"%1$s\"))";
|
return " + repeat(\"\", %3$s, format=TaggedFile.formatCommandLine(\"%1$s\"))";
|
||||||
|
} else if (!argumentDefinition.required) {
|
||||||
|
return " + optional(\"\", %3$s, format=TaggedFile.formatCommandLine(\"%1$s\"))";
|
||||||
|
} else {
|
||||||
|
return " + TaggedFile.formatCommandLine(\"%1$s\")(\"\", %3$s, \"\")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// Adds optional inputs for the indexes of any rods added to this function.
|
||||||
* Adds optional inputs for the indexes of any bams or sams added to this function.
|
|
||||||
*/
|
|
||||||
private static class InputIndexesArgumentField extends ArgumentField {
|
private static class InputIndexesArgumentField extends ArgumentField {
|
||||||
|
private final boolean originalIsMultiValued;
|
||||||
private final String indexFieldName;
|
private final String indexFieldName;
|
||||||
private final String originalFieldName;
|
private final String originalFieldName;
|
||||||
private final String indexSuffix;
|
private final String indexSuffix;
|
||||||
|
|
@ -374,14 +378,19 @@ public abstract class ArgumentDefinitionField extends ArgumentField {
|
||||||
this(originalArgumentDefinition, indexSuffix, null);
|
this(originalArgumentDefinition, indexSuffix, null);
|
||||||
}
|
}
|
||||||
public InputIndexesArgumentField(ArgumentDefinition originalArgumentDefinition, String indexSuffix, String originalSuffix) {
|
public InputIndexesArgumentField(ArgumentDefinition originalArgumentDefinition, String indexSuffix, String originalSuffix) {
|
||||||
this.indexFieldName = originalArgumentDefinition.fullName + "Indexes";
|
this.originalIsMultiValued = originalArgumentDefinition.isMultiValued;
|
||||||
|
this.indexFieldName = originalArgumentDefinition.fullName + "Index" + (originalIsMultiValued ? "es" : "");
|
||||||
this.originalFieldName = originalArgumentDefinition.fullName;
|
this.originalFieldName = originalArgumentDefinition.fullName;
|
||||||
this.indexSuffix = indexSuffix;
|
this.indexSuffix = indexSuffix;
|
||||||
this.originalSuffix = originalSuffix;
|
this.originalSuffix = originalSuffix;
|
||||||
}
|
}
|
||||||
@Override protected Class<? extends Annotation> getAnnotationIOClass() { return Input.class; }
|
@Override protected Class<? extends Annotation> getAnnotationIOClass() { return Input.class; }
|
||||||
@Override public String getCommandLineAddition() { return ""; }
|
@Override public String getCommandLineAddition() { return ""; }
|
||||||
@Override protected String getDoc() { return "Dependencies on any indexes of " + this.originalFieldName; }
|
@Override protected String getDoc() {
|
||||||
|
return originalIsMultiValued
|
||||||
|
? "Dependencies on any indexes of " + this.originalFieldName
|
||||||
|
: "Dependencies on the index of " + this.originalFieldName;
|
||||||
|
}
|
||||||
@Override protected String getFullName() { return this.indexFieldName; }
|
@Override protected String getFullName() { return this.indexFieldName; }
|
||||||
@Override protected boolean isRequired() { return false; }
|
@Override protected boolean isRequired() { return false; }
|
||||||
@Override protected String getFieldType() { return "List[File]"; }
|
@Override protected String getFieldType() { return "List[File]"; }
|
||||||
|
|
@ -389,6 +398,7 @@ public abstract class ArgumentDefinitionField extends ArgumentField {
|
||||||
@Override protected Class<?> getInnerType() { return File.class; }
|
@Override protected Class<?> getInnerType() { return File.class; }
|
||||||
@Override protected String getRawFieldName() { return this.indexFieldName; }
|
@Override protected String getRawFieldName() { return this.indexFieldName; }
|
||||||
@Override protected String getFreezeFields() {
|
@Override protected String getFreezeFields() {
|
||||||
|
if (originalIsMultiValued) {
|
||||||
if (originalSuffix == null) {
|
if (originalSuffix == null) {
|
||||||
return String.format(
|
return String.format(
|
||||||
("%1$s ++= %2$s" +
|
("%1$s ++= %2$s" +
|
||||||
|
|
@ -404,9 +414,25 @@ public abstract class ArgumentDefinitionField extends ArgumentField {
|
||||||
" new File(orig.getPath.stripSuffix(\"%4$s\") + \"%3$s\") ))%n"),
|
" new File(orig.getPath.stripSuffix(\"%4$s\") + \"%3$s\") ))%n"),
|
||||||
indexFieldName, originalFieldName, indexSuffix, originalSuffix);
|
indexFieldName, originalFieldName, indexSuffix, originalSuffix);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (originalSuffix == null) {
|
||||||
|
return String.format(
|
||||||
|
("if (%2$s != null)%n " +
|
||||||
|
"%1$s :+= new File(%2$s.getPath + \"%3$s\")%n"),
|
||||||
|
indexFieldName, originalFieldName, indexSuffix);
|
||||||
|
} else {
|
||||||
|
return String.format(
|
||||||
|
("if (%2$s != null && %2$s.getName.endsWith(\"%4$s\"))%n " +
|
||||||
|
"%1$s ++= Array(" +
|
||||||
|
" new File(%2$s.getPath + \"%3$s\")," +
|
||||||
|
" new File(%2$s.getPath.stripSuffix(\"%4$s\") + \"%3$s\") )%n"),
|
||||||
|
indexFieldName, originalFieldName, indexSuffix, originalSuffix);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tracks an automatically generated index
|
||||||
private static abstract class OutputIndexArgumentField extends ArgumentField {
|
private static abstract class OutputIndexArgumentField extends ArgumentField {
|
||||||
protected final String indexFieldName;
|
protected final String indexFieldName;
|
||||||
protected final String originalFieldName;
|
protected final String originalFieldName;
|
||||||
|
|
@ -456,6 +482,7 @@ public abstract class ArgumentDefinitionField extends ArgumentField {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Allows setting the format for floats and doubles
|
||||||
private static class FormatterArgumentField extends ArgumentField {
|
private static class FormatterArgumentField extends ArgumentField {
|
||||||
private final ArgumentField argumentField;
|
private final ArgumentField argumentField;
|
||||||
public FormatterArgumentField(ArgumentField argumentField) {
|
public FormatterArgumentField(ArgumentField argumentField) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue