GAllele – the genome alleles module

In this module, there are the GAllele.GAlleles class (which is the class that holds the allele types) and all the allele types to use with the supported chromosomes.

class GAllele.GAlleleList(options=None)

GAlleleList Class - The list allele type

Example:
>>> alleles = GAlleles()
>>> choices = [1,2,3,4]
>>> lst = GAlleleList(choices)
>>> alleles.add(lst)
>>> alleles[0].getRandomAllele() in lst
True
add(option)

Appends one option to the options list

Parameter:option – option to be added in the list
clear()
Removes all the allele options from the list
getRandomAllele()
Returns one random choice from the options list
remove(option)

Removes the option from list

Parameter:option – remove the option from the list
class GAllele.GAlleleRange(begin=0, end=100, real=False)

GAlleleRange Class - The range allele type

Example:
>>> ranges = GAlleleRange(0,100)
>>> ranges.getRandomAllele() >= 0 and ranges.getRandomAllele() <= 100
True
Parameters:
  • begin – the begin of the range
  • end – the end of the range
  • real – if True, the range will be of real values
add(begin, end)

Add a new range

Parameters:
  • begin – the begin of range
  • end – the end of the range
clear()
Removes all ranges
getMaximum()

Return the maximum of all the ranges

Return type:the maximum value
getMinimum()

Return the minimum of all the ranges

Return type:the minimum value
getRandomAllele()
Returns one random choice between the range
getReal()
Returns True if the range is real or False if it is integer
setReal(flag=True)

Sets True if the range is real or False if is integer

Parameter:flag – True or False
class GAllele.GAlleles(allele_list=None, homogeneous=False)

GAlleles Class - The set of alleles

Example:
>>> alleles = GAlleles()
>>> choices = [1,2,3,4]
>>> lst = GAlleleList(choices)
>>> alleles.add(lst)
>>> alleles[0].getRandomAllele() in lst
True
Parameters:
  • allele_list – the list of alleles
  • homogeneous – if is True, all the alleles will be use only the first added
add(allele)

Appends one allele to the alleles list

Parameter:allele – allele to be added


Previous topic

GenomeBase – the genomes base module

Next topic

G1DBinaryString – the classical binary string chromosome

This Page