# Class Gene

java.lang.Object
org.snpeff.interval.Interval
org.snpeff.interval.Marker
org.snpeff.interval.IntervalAndSubIntervals<Transcript>
org.snpeff.interval.Gene

All Implemented Interfaces:
  `Serializable, Cloneable, Comparable<Interval>, Iterable<Transcript>, TxtSerializable`

public class Gene extends IntervalAndSubIntervals<Transcript>
Interval for a gene, as well as transcripts

Author:
  pcingola
See Also:
  - Serialized Form

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static enum`
`Gene.GeneType`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`CIRCULAR_GENE_ID`

### Fields inherited from class Marker

`type`

### Fields inherited from class Interval

`chromosomeNameOri, end, id, parent, start, strandMinus`

## Constructor Summary

Constructors
Constructor
Description
`Gene()`
`Gene(Marker parent, int start, int end, boolean strandMinus, String id, String geneName, BioType bioType)`

## Method Summary

Modifier and Type
Method
Description
`void`
`addPerGene(Marker marker)`
Add a gene dependent marker
`boolean`
`adjust()`
Adjust start, end and strand values
`void`
`buildPerGene()`
Build gene dependent interval tree
`Transcript`
`canonical()`
Get canonical transcript Canonical transcripts are defined as the longest CDS of amongst the protein coding transcripts.
`Gene`
`circularClone()`
In a circular genome, a gene can have negative coordinates or crosses over chromosome end.
`Gene`
`cloneShallow()`
Perform a shallow clone
`double`
`cpgExonBias()`
Calculate CpG bias: number of CpG / expected[CpG]
`void`
`filterTags(Set<String> tags, Set<String> tagsNo)`
Filter transcripts by tags
`void`
`filterTranscriptSupportLevel(TranscriptSupportLevel maxTsl)`
Filter transcripts by TSL
`Gene.GeneType`
`geneType()`
`BioType`
`getBioType()`
`String`
`getGeneName()`
`boolean`
`isProteinCoding()`
Is any of the transcripts protein coding?
`protected boolean`
`isShowWarningIfParentDoesNotInclude()`
Show an error if parent does not include child?
`int`
`keepTranscripts(Set<String> trIds)`
Remove all transcripts in trIds
`int`
`keepTranscriptsProteinCoding()`
Keep only protein coding transcripts
`Markers`
`markers()`
A list of all markers in this transcript
`void`
`removeNonCanonical(String trId)`
Remove all non-canonical transcripts
`boolean`
`removeUnverified()`
Remove unverified or corrected transcripts
`void`
`serializeParse(MarkerSerializer markerSerializer)`
Parse a line from a serialized file
`String`
`serializeSave(MarkerSerializer markerSerializer)`
Create a string to serialize to a file
`void`
`setBioType(BioType bioType)`
`int`
`sizeof(String type)`
Size of a genetic region for a given gene
`String`
`toString()`
`String`
`toString(boolean showTr)`
`boolean`
`variantEffect(Variant variant, VariantEffects variantEffects)`
Get some details about the effect on this gene
`protected void`
`variantEffectGene(Variant variant, VariantEffects variantEffects)`
Add gene-specific annotations

### Methods inherited from class IntervalAndSubIntervals

`add, addAll, addAll, apply, clone, containsId, get, invalidateSorted, iterator, numChilds, query, remove, reset, setStrandMinus, shiftCoordinates, sorted, sortedStrand, subIntervals`

### Methods inherited from class Marker

`adjust, applyDel, applyDup, applyIns, applyMixed, codonTable, compareTo, compareToPos, distance, distanceBases, getParent, getType, idChain, idChain, idChain, includes, intersect, isAdjustIfParentDoesNotInclude, isDeferredAnalysis, minus, query, readTxt, shouldApply, union, variantEffectNonRef`

### Methods inherited from class Interval

`equals, findParent, getChromosome, getChromosomeName, getChromosomeNameOri, getChromosomeNum, getEnd, getGenome, getGenomeName, getId, getStart, getStrand, hashCode, intersects, intersects, intersects, intersects, intersectSize, isCircular, isSameChromo, isStrandMinus, isStrandPlus, isValid, setChromosomeNameOri, setEnd, setId, setParent, setStart, size, toStr, toStringAsciiArt, toStrPos`

### Methods inherited from class Object

`equals, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface Iterable

`forEach, spliterator`

## Field Details

### CIRCULAR_GENE_ID

public static final String CIRCULAR_GENE_ID

See Also:
  - Constant Field Values

## Constructor Details

### Gene

public Gene()

### Gene

public Gene(Marker parent, int start, int end, boolean strandMinus, String id, String geneName, BioType bioType)

## Method Details

### addPerGene

public void addPerGene(Marker marker)
Add a gene dependent marker

### adjust

public boolean adjust()
Adjust start, end and strand values

Returns:
  true if any adjustment was done

### buildPerGene

public void buildPerGene()
Build gene dependent interval tree

### canonical

public Transcript canonical()
Get canonical transcript Canonical transcripts are defined as the longest CDS of amongst the protein coding transcripts. If none of the transcripts is protein coding, then it is the longest cDNA.

### circularClone

public Gene circularClone()
In a circular genome, a gene can have negative coordinates or crosses over chromosome end. These genes are mirrored to the opposite end of the chromosome so that they can be referenced by both circular coordinates.

### cloneShallow

public Gene cloneShallow()
Description copied from class: `Marker`
Perform a shallow clone

Overrides:
  `cloneShallow` in class `IntervalAndSubIntervals<Transcript>`

### cpgExonBias

public double cpgExonBias()
Calculate CpG bias: number of CpG / expected[CpG]

### filterTags

public void filterTags(Set<String> tags, Set<String> tagsNo)
Filter transcripts by tags

Parameters:
  `tags` - : Ttranscripts to keep
  `tagsNo` - : Transcripts to remove

### filterTranscriptSupportLevel

public void filterTranscriptSupportLevel(TranscriptSupportLevel maxTsl)
Filter transcripts by TSL

### geneType

public Gene.GeneType geneType()

### getBioType

public BioType getBioType()

### getGeneName

public String getGeneName()

### isProteinCoding

public boolean isProteinCoding()
Is any of the transcripts protein coding?

### isShowWarningIfParentDoesNotInclude

protected boolean isShowWarningIfParentDoesNotInclude()
Description copied from class: `Marker`
Show an error if parent does not include child?

Overrides:
  `isShowWarningIfParentDoesNotInclude` in class `Marker`

### keepTranscripts

public int keepTranscripts(Set<String> trIds)
Remove all transcripts in trIds

Returns:
  : Number of transcripts removed

### keepTranscriptsProteinCoding

public int keepTranscriptsProteinCoding()
Keep only protein coding transcripts

Returns:
  : Number of transcripts removed

### markers

public Markers markers()
Description copied from class: `IntervalAndSubIntervals`
A list of all markers in this transcript

Overrides:
  `markers` in class `IntervalAndSubIntervals<Transcript>`

### removeNonCanonical

public void removeNonCanonical(String trId)
Remove all non-canonical transcripts

### removeUnverified

public boolean removeUnverified()
Remove unverified or corrected transcripts

Returns:
  : True if ALL transcripts have been removed

### serializeParse

public void serializeParse(MarkerSerializer markerSerializer)
Parse a line from a serialized file

Specified by:
  `serializeParse` in interface `TxtSerializable`
Overrides:
  `serializeParse` in class `IntervalAndSubIntervals<Transcript>`

### serializeSave

public String serializeSave(MarkerSerializer markerSerializer)
Create a string to serialize to a file

Specified by:
  `serializeSave` in interface `TxtSerializable`
Overrides:
  `serializeSave` in class `IntervalAndSubIntervals<Transcript>`
Returns:

### setBioType

public void setBioType(BioType bioType)

### sizeof

public int sizeof(String type)
Size of a genetic region for a given gene

### toString

public String toString()

Overrides:
  `toString` in class `Marker`

### toString

public String toString(boolean showTr)

### variantEffect

public boolean variantEffect(Variant variant, VariantEffects variantEffects)
Get some details about the effect on this gene

Overrides:
  `variantEffect` in class `Marker`

### variantEffectGene

protected void variantEffectGene(Variant variant, VariantEffects variantEffects)
Add gene-specific annotations