# Class Genome

java.lang.Object
org.snpeff.interval.Interval
org.snpeff.interval.Marker
org.snpeff.interval.Genome

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

public class Genome extends Marker implements Iterable<Chromosome>
This is just used for the Interval class. It is NOT a representation of an entire genome.

Author:
  pcingola
See Also:
  - Serialized Form

## Field Summary

### Fields inherited from class Marker

`type`

### Fields inherited from class Interval

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

## Constructor Summary

Constructors
Constructor
Description
`Genome()`
`Genome(String version)`
`Genome(String version, Config config)`

## Method Summary

Modifier and Type
Method
Description
`void`
`add(Chromosome chromo)`
Add a chromosome
`List<String>`
`chromosomeNamesSorted()`
Get a sorted list of chromosomes
`static Genome`
`createFromFaidx(String genomeName, String faidxFile)`
Create a genome from a faidx file.
`String[]`
`getChromoFastaFiles()`
`Chromosome`
`getChromosome(String chromoName)`
Find chromosome 'chromoName'
`int`
`getChromosomeCount()`
`Collection<Chromosome>`
`getChromosomes()`
`List<Chromosome>`
`getChromosomesSortedSize()`
Return chromosomes sorted by size (largest chromosomes first)
`CytoBands`
`getCytoBands()`
`Genes`
`getGenes()`
`List<Gene>`
`getGenesSorted()`
Create a sorted list of genes (sorted by gene Id)
`List<Gene>`
`getGenesSortedPos()`
Create a sorted list of genes (sorted by genomic position)
`String`
`getGenomeId()`
`GenomicSequences`
`getGenomicSequences()`
`Chromosome`
`getOrCreateChromosome(String chromoName)`
Get or create a chromosome
`String`
`getSpecies()`
`String`
`getVersion()`
`boolean`
`hasChromosome(String chromo)`
Is this chromosome in this genome?
`boolean`
`hasCodingInfo()`
`boolean`
`hasTranscriptSupportLevelInfo()`
Do we have coding info from genes?
`boolean`
`isMostExonsHaveSequence()`
Do most exons have sequence? This is an indicator that something went really bad building the database.
`Iterator<Chromosome>`
`iterator()`
`long`
`length()`
Total genome length: add all chromosomes
`boolean`
`readGenomeSequence(String fastaFile)`
Read the whole genome sequence into memory
`void`
`remove(Chromosome chromo)`
Remove a chromosome WARINIG: Doesn't check any dependencies!
`void`
`save(String fileName)`
Save genome to file
`void`
`serializeParse(MarkerSerializer markerSerializer)`
Parse a line from a serialized file
`String`
`serializeSave(MarkerSerializer markerSerializer)`
Create a string to serialize to a file
`String`
`toString()`
Show number of genes, transcripts invalid input: '&' exons
`String`
`toString(StringBuilder errors)`
Show number of genes, transcripts invalid input: '&' exons Arr all errors to buffer

### Methods inherited from class Marker

`adjust, apply, applyDel, applyDup, applyIns, applyMixed, clone, cloneShallow, codonTable, compareTo, compareToPos, distance, distanceBases, getParent, getType, idChain, idChain, idChain, includes, intersect, isAdjustIfParentDoesNotInclude, isDeferredAnalysis, isShowWarningIfParentDoesNotInclude, minus, query, query, readTxt, shouldApply, union, variantEffect, 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, setStrandMinus, shiftCoordinates, size, toStr, toStringAsciiArt, toStrPos`

### Methods inherited from class Object

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

### Methods inherited from interface Iterable

`forEach, spliterator`

## Constructor Details

### Genome

public Genome()

### Genome

public Genome(String version)

### Genome

public Genome(String version, Config config)

## Method Details

### createFromFaidx

public static Genome createFromFaidx(String genomeName, String faidxFile)
Create a genome from a faidx file. See "samtools faidx" command (reference http://samtools.sourceforge.net/samtools.shtml)

Parameters:
  `genomeName` - : Genome's name (version)
  `faidxFile` - : FAI file used to create all chromosomes
Returns:

### add

public void add(Chromosome chromo)
Add a chromosome

### chromosomeNamesSorted

public List<String> chromosomeNamesSorted()
Get a sorted list of chromosomes

### getChromoFastaFiles

public String[] getChromoFastaFiles()

### getChromosome

public Chromosome getChromosome(String chromoName)
Find chromosome 'chromoName'

### getChromosomeCount

public int getChromosomeCount()

### getChromosomes

public Collection<Chromosome> getChromosomes()

### getChromosomesSortedSize

public List<Chromosome> getChromosomesSortedSize()
Return chromosomes sorted by size (largest chromosomes first)

### getCytoBands

public CytoBands getCytoBands()

### getGenes

public Genes getGenes()

### getGenesSorted

public List<Gene> getGenesSorted()
Create a sorted list of genes (sorted by gene Id)

### getGenesSortedPos

public List<Gene> getGenesSortedPos()
Create a sorted list of genes (sorted by genomic position)

### getGenomeId

public String getGenomeId()

### getGenomicSequences

public GenomicSequences getGenomicSequences()

### getOrCreateChromosome

public Chromosome getOrCreateChromosome(String chromoName)
Get or create a chromosome

### getSpecies

public String getSpecies()

### getVersion

public String getVersion()

### hasChromosome

public boolean hasChromosome(String chromo)
Is this chromosome in this genome?

### hasCodingInfo

public boolean hasCodingInfo()

### hasTranscriptSupportLevelInfo

public boolean hasTranscriptSupportLevelInfo()
Do we have coding info from genes?

### isMostExonsHaveSequence

public boolean isMostExonsHaveSequence()
Do most exons have sequence? This is an indicator that something went really bad building the database.

Returns:
  Check if most exons have sequence assigned.

### iterator

public Iterator<Chromosome> iterator()

Specified by:
  `iterator` in interface `Iterable<Chromosome>`

### length

public long length()
Total genome length: add all chromosomes

### readGenomeSequence

public boolean readGenomeSequence(String fastaFile)
Read the whole genome sequence into memory

Parameters:
  `fastaFile` - : Path to a Fasta file
Returns:
  true if it was successful

### remove

public void remove(Chromosome chromo)
Remove a chromosome WARINIG: Doesn't check any dependencies!

### save

public void save(String fileName)
Save genome to file

### serializeParse

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

Specified by:
  `serializeParse` in interface `TxtSerializable`
Overrides:
  `serializeParse` in class `Marker`

### serializeSave

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

Specified by:
  `serializeSave` in interface `TxtSerializable`
Overrides:
  `serializeSave` in class `Marker`

### toString

public String toString()
Show number of genes, transcripts invalid input: '&' exons

Overrides:
  `toString` in class `Marker`

### toString

public String toString(StringBuilder errors)
Show number of genes, transcripts invalid input: '&' exons Arr all errors to buffer