public class SimpleTsvOutputRenderer extends OutputRenderer
LocatableFuncotationCreator.CONTIG_FIELD_NAME
, LocatableFuncotationCreator.START_FIELD_NAME
, and
LocatableFuncotationCreator.END_FIELD_NAME
If you want the output file to have locatable data in different fields, make sure the alias file maps these to
the preferred field name in the output.
Sorting of columns is based on the config file:
- Columns from the config file in order as appearing in the config file.
- Remaining default, override, and funcotation fields in natural/alphanumberical order (e.g. FIELD1, FIELD2, FIELD10).
Note that remaining funcotation fields will not appear when `isWriteFuncotationFieldsNotInConfig` is `false`
"Remaining" means fields that did not appear in the config file (as a column name nor as an alias)
If this output renderer does not actually render any variants, it will not necessarily have the same columns as
when there actually are variants. Please note that `isWriteFuncotationFieldsNotInConfig` = false will
have the same column list in these cases, but there are other caveats, since leftover funcotation fields will not
be written ever.dataSourceFactories, manualAnnotations, toolVersion
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the
OutputRenderer . |
static java.util.LinkedHashMap<java.lang.String,java.util.List<java.lang.String>> |
createColumnNameToAliasesMap(java.nio.file.Path configFile)
Create key value pairs where the key is the output column name and the value is a list of possible field names, in order of priority.
|
static SimpleTsvOutputRenderer |
createFromFile(java.nio.file.Path outputFilePath,
java.util.LinkedHashMap<java.lang.String,java.lang.String> unaccountedForDefaultAnnotations,
java.util.LinkedHashMap<java.lang.String,java.lang.String> unaccountedForOverrideAnnotations,
java.util.Set<java.lang.String> excludedOutputFields,
java.nio.file.Path configPath,
java.lang.String toolVersion,
boolean isWriteColumnsNotInConfig) |
static SimpleTsvOutputRenderer |
createFromResource(java.nio.file.Path outputFilePath,
java.util.LinkedHashMap<java.lang.String,java.lang.String> unaccountedForDefaultAnnotations,
java.util.LinkedHashMap<java.lang.String,java.lang.String> unaccountedForOverrideAnnotations,
java.util.Set<java.lang.String> excludedOutputFields,
java.nio.file.Path resourcePath,
java.lang.String toolVersion,
boolean isWriteColumnsNotInConfig)
Use when loading the config file from the jar.
|
void |
write(htsjdk.variant.variantcontext.VariantContext variant,
FuncotationMap txToFuncotationMap)
Write the given
variant and txToFuncotationMap to the output file. |
createFuncotationFromLinkedHashMap, getDataSourceInfoString, getToolVersion
public void close()
OutputRenderer
OutputRenderer
.close
in interface java.lang.AutoCloseable
close
in class OutputRenderer
public void write(htsjdk.variant.variantcontext.VariantContext variant, FuncotationMap txToFuncotationMap)
OutputRenderer
variant
and txToFuncotationMap
to the output file.write
in class OutputRenderer
variant
- VariantContext
to write to the file.txToFuncotationMap
- FuncotationMap
to add to the given variant
on output.public static java.util.LinkedHashMap<java.lang.String,java.util.List<java.lang.String>> createColumnNameToAliasesMap(java.nio.file.Path configFile)
configFile
- config file that encodes column_name:alias_1,alias_2 ....null
public static SimpleTsvOutputRenderer createFromFile(java.nio.file.Path outputFilePath, java.util.LinkedHashMap<java.lang.String,java.lang.String> unaccountedForDefaultAnnotations, java.util.LinkedHashMap<java.lang.String,java.lang.String> unaccountedForOverrideAnnotations, java.util.Set<java.lang.String> excludedOutputFields, java.nio.file.Path configPath, java.lang.String toolVersion, boolean isWriteColumnsNotInConfig)
outputFilePath
- Path
to write. Never null
unaccountedForDefaultAnnotations
- LinkedHashMap
of default annotations that must be added. Never null
unaccountedForOverrideAnnotations
- LinkedHashMap
of override annotations that must be added. Never null
excludedOutputFields
- Set
column names that are not to appear in the output file. Use an empty set
for no exclusions. Never null
configPath
- Configuration file where each key is a column and a comma-separated list of fields acts as a
list of possible aliases. Note that the list of the keys is the same order that will be seen
in the output.toolVersion
- The version number of the tool used to produce the VCF file. Never null
isWriteColumnsNotInConfig
- Whether to write funcotation fields that were present but had no alias,
no default value, nor override value.public static SimpleTsvOutputRenderer createFromResource(java.nio.file.Path outputFilePath, java.util.LinkedHashMap<java.lang.String,java.lang.String> unaccountedForDefaultAnnotations, java.util.LinkedHashMap<java.lang.String,java.lang.String> unaccountedForOverrideAnnotations, java.util.Set<java.lang.String> excludedOutputFields, java.nio.file.Path resourcePath, java.lang.String toolVersion, boolean isWriteColumnsNotInConfig)
createFromFile(Path, LinkedHashMap, LinkedHashMap, Set, Path, String, boolean)
outputFilePath
- See createFromFile(Path, LinkedHashMap, LinkedHashMap, Set, Path, String, boolean)
unaccountedForDefaultAnnotations
- See createFromFile(Path, LinkedHashMap, LinkedHashMap, Set, Path, String, boolean)
unaccountedForOverrideAnnotations
- See createFromFile(Path, LinkedHashMap, LinkedHashMap, Set, Path, String, boolean)
excludedOutputFields
- See createFromFile(Path, LinkedHashMap, LinkedHashMap, Set, Path, String, boolean)
resourcePath
- Configuration file (as a Resource). See createFromFile(Path, LinkedHashMap, LinkedHashMap, Set, Path, String, boolean)
toolVersion
- See createFromFile(Path, LinkedHashMap, LinkedHashMap, Set, Path, String, boolean)
isWriteColumnsNotInConfig
- Whether to write funcotation fields that were present but had no alias,
no default value, nor override value.