Table Models

The model objects are automatically loaded from the database and populated with the attributes from the table. A KnownGene object will therefore have a txStart, txEnd, etc attributes. The mapping from database tables to objects is performed by SqlAlchemy for us but to query the tables you need to use the SqlAlchemy ORM interface

Below we list the model methods we have added to the basic data. To find the attributes belonging to each class, you can use the UCSC table browser’s describe table schema button on the Table Browser

class ucsc.model.CcdsGene[source]

Bases: ucsc.model.KnownGene

ccdsGene entry, same interface as KnownGene

cds

return an Interval representing the CDS

exons

return a list of Intervals for each exon

transcript

return an Interval representing the transcript

class ucsc.model.ChainSelf[source]

Bases: ucsc.model.QueryByInterval

Chainself entry

dest

Interval of the destination of the chain

for_interval(interval)

return all links that overlap the specified interval

source

Interval of the source of the chain

Bases: ucsc.model.QueryByInterval

ChainSelfLink entry

dest

Interval of the destination of the chain

for_interval(interval)

return all links that overlap the specified interval

source

Interval of the source of the chain

class ucsc.model.CommonSnp[source]

Bases: ucsc.model.Snp

SNP entry

apply(interval)

Create the alernate alleles on the given interval

returns a list of alleles over the interval given

for_interval(interval)

Return all snps within an interval

interval

Get this Snp’s interval

other_alleles()

return the alternate allele (always on the + strand, unlike observed)

class ucsc.model.KnownCanonical[source]

Bases: ucsc.model.KnownGene

canonical genes

cds

return an Interval representing the CDS

exons

return a list of Intervals for each exon

transcript

return an Interval representing the transcript

class ucsc.model.KnownGene[source]

Bases: object

knownGene entry

cds

return an Interval representing the CDS

exons

return a list of Intervals for each exon

transcript

return an Interval representing the transcript

class ucsc.model.RefGene[source]

Bases: ucsc.model.KnownGene

refGene entry, same interface as KnownGene

cds

return an Interval representing the CDS

exons

return a list of Intervals for each exon

transcript

return an Interval representing the transcript

class ucsc.model.Snp[source]

Bases: object

SNP entry

apply(interval)[source]

Create the alernate alleles on the given interval

returns a list of alleles over the interval given

classmethod for_interval(interval)[source]

Return all snps within an interval

interval

Get this Snp’s interval

other_alleles()[source]

return the alternate allele (always on the + strand, unlike observed)