Package htsjdk.variant.variantcontext

# Class CommonInfo

java.lang.Object
htsjdk.variant.variantcontext.CommonInfo

All Implemented Interfaces:
  `Serializable`

public final class CommonInfo extends Object implements Serializable
Common utility routines for VariantContext and Genotype

See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`static final double`
`NO_LOG10_PERROR`
`static final long`
`serialVersionUID`

## Constructor Summary

Constructors
Constructor
Description
`CommonInfo(String name, double log10PError, Set<String> filters, Map<String,Object> attributes)`

## Method Summary

Modifier and Type
Method
Description
`void`
`addFilter(String filter)`
`void`
`addFilters(Collection<String> filters)`
`void`
`clearAttributes()`
`boolean`
`filtersWereApplied()`
`Object`
`getAttribute(String key)`
`Object`
`getAttribute(String key, Object defaultValue)`
`boolean`
`getAttributeAsBoolean(String key, boolean defaultValue)`
`double`
`getAttributeAsDouble(String key, double defaultValue)`
`List<Double>`
`getAttributeAsDoubleList(String key, Double defaultValue)`
`int`
`getAttributeAsInt(String key, int defaultValue)`
`List<Integer>`
`getAttributeAsIntList(String key, Integer defaultValue)`
`List<Object>`
`getAttributeAsList(String key)`
Gets the attributes from a key as a list.
`String`
`getAttributeAsString(String key, String defaultValue)`
`List<String>`
`getAttributeAsStringList(String key, String defaultValue)`
`Map<String,Object>`
`getAttributes()`
`Set<String>`
`getFilters()`
`Set<String>`
`getFiltersMaybeNull()`
`double`
`getLog10PError()`
`String`
`getName()`
`int`
`getNumAttributes()`
`double`
`getPhredScaledQual()`
Floating-point arithmetic allows signed zeros such as +0.0 and -0.0.
`boolean`
`hasAttribute(String key)`
`boolean`
`hasLog10PError()`
`boolean`
`isFiltered()`
`boolean`
`isNotFiltered()`
`void`
`putAttribute(String key, Object value)`
`void`
`putAttribute(String key, Object value, boolean allowOverwrites)`
`void`
`putAttributes(Map<String,?> map)`
`void`
`removeAttribute(String key)`
`void`
`setAttributes(Map<String,?> map)`
`void`
`setLog10PError(double log10PError)`
`void`
`setName(String name)`
Sets the name

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### serialVersionUID

public static final long serialVersionUID

See Also:
  - Constant Field Values

### NO_LOG10_PERROR

public static final double NO_LOG10_PERROR

See Also:
  - Constant Field Values

## Constructor Details

### CommonInfo

public CommonInfo(String name, double log10PError, Set<String> filters, Map<String,Object> attributes)

## Method Details

### getName

public String getName()

Returns:
  the name

### setName

public void setName(String name)
Sets the name

Parameters:
  `name` - the name associated with this information

### getFiltersMaybeNull

public Set<String> getFiltersMaybeNull()

### getFilters

public Set<String> getFilters()

### filtersWereApplied

public boolean filtersWereApplied()

### isFiltered

public boolean isFiltered()

### isNotFiltered

public boolean isNotFiltered()

### addFilter

public void addFilter(String filter)

### addFilters

public void addFilters(Collection<String> filters)

### hasLog10PError

public boolean hasLog10PError()

### getLog10PError

public double getLog10PError()

Returns:
  the -1 * log10-based error estimate

### getPhredScaledQual

public double getPhredScaledQual()
Floating-point arithmetic allows signed zeros such as +0.0 and -0.0. Adding the constant 0.0 to the result ensures that the returned value is never -0.0 since (-0.0) + 0.0 = 0.0. When this is set to '0.0', the resulting VCF would be 0 instead of -0.

Returns:
  double - Phred scaled quality score

### setLog10PError

public void setLog10PError(double log10PError)

### clearAttributes

public void clearAttributes()

### getAttributes

public Map<String,Object> getAttributes()

Returns:
  the attribute map

### setAttributes

public void setAttributes(Map<String,?> map)

### putAttribute

public void putAttribute(String key, Object value)

### putAttribute

public void putAttribute(String key, Object value, boolean allowOverwrites)

### removeAttribute

public void removeAttribute(String key)

### putAttributes

public void putAttributes(Map<String,?> map)

### hasAttribute

public boolean hasAttribute(String key)

### getNumAttributes

public int getNumAttributes()

### getAttribute

public Object getAttribute(String key)

Parameters:
  `key` - the attribute key
Returns:
  the attribute value for the given key (or null if not set)

### getAttribute

public Object getAttribute(String key, Object defaultValue)

### getAttributeAsList

public List<Object> getAttributeAsList(String key)
Gets the attributes from a key as a list. Note: int[] and double[] arrays are boxed.

Returns:
  empty list if the key was not found; `Collections.singletonList(Object)` if there is only one value; a list containing the values if the value is a `List` or array.

### getAttributeAsStringList

public List<String> getAttributeAsStringList(String key, String defaultValue)

### getAttributeAsIntList

public List<Integer> getAttributeAsIntList(String key, Integer defaultValue)

### getAttributeAsDoubleList

public List<Double> getAttributeAsDoubleList(String key, Double defaultValue)

### getAttributeAsString

public String getAttributeAsString(String key, String defaultValue)

### getAttributeAsInt

public int getAttributeAsInt(String key, int defaultValue)

### getAttributeAsDouble

public double getAttributeAsDouble(String key, double defaultValue)

### getAttributeAsBoolean

public boolean getAttributeAsBoolean(String key, boolean defaultValue)