racpy package

Submodules

racpy.cli module

Console script for racpy.

racpy.core module

class racpy.core.RNAAgeCalc(tissue=None, exprtype='FPKM', idtype='symbol', stype='all', signature=None)[source]

Bases: object

Calculate RNA age.

Attributes: - tissue: a string indicates which tissue the gene expression data is obtained from. Users are expected to provide one of the these tissues:

adipose_tissue, adrenal_gland, blood, blood_vessel, brain, breast, colon, esophagus, heart, liver, lung, muscle, nerve, ovary, pancreas, pituitary, prostate, salivary_gland, skin, small_intestine, spleen, stomach, testis, thyroid, uterus, vagina.

If the tissue argument is not provide or the provided tissue is not in this list, then the age predictor trained on all tissues will be used to calculate RNA age.

  • exprtype: either “count” or “FPKM”. Default is “FPKM”. For RPKM data,

please use exprtype=”FPKM”.

  • idtype: a string which indicates the gene id type in “exprdata”. It

should be one of “symbol”, “ensembl.gene”, “entrezgene” or “refseq”. Default is “symbol”.

  • stype: a string which specifies which version of pre-trained

calculators to be used. It should be either “all” or “Caucasian”. “all” means samples from all races (American Indian/Alaska Native, Asian, Black/African American, and Caucasian) are used to obtain the pre-trained calculator. “Caucasian” means only the Caucasian samples are used to build up the pre-trained calculator. Default is “all”.

  • signature: a string which indicate the age signature to use when

calculating RNA age. This argument is not required.

In the case that this argument is not provided, if tissue argument is also provided and the tissue is in the list above, the tissue specific age signature given by our DESeq2 analysis result on GTEx data will be used. Otherwise, the across tissue signature “GTExAge” will be used.

In the case that this argument is provided, it should be one of the following signatures. A detailed description of the meaning of these signatures is given in the package tutorial.

DESeq2, Pearson, Dev, deMagalhaes, GenAge, GTExAge, Peters, all

property exprtype
property idtype
predict_age(exprdata, genelength=None, chronage=None)[source]

Calculate RNA age.

This function calculates RNA age based on pre-trained predictors.

Parameters

exprdata – a pandas DataFrame which contains gene expression data

with each row represents a gene and each column represents a sample. Use the argument “exprtype” to specify raw count or FPKM. The index of “exprdata” should be gene ids and columns names of “exprdata” should be sample ids.

Parameters

genelength – a pandas Series, DataFrame, numpy array, or list

which contains gene length in bp. The size of genelength should be equal to the number of rows in exprdata. This argument is optional. If using exprtype=”FPKM”, genelength argument is ignored. If using exprtype=”count”, the raw count will be converted to FPKM. If genelength is provided, the function will convert raw count to FPKM according to the user-supplied gene length. Otherwise, gene length is obtained from the internal database.

Parameters

chronage – a pandas DataFrame which contains the chronological

age of each sample. This argument is optional. If provided, it should be a DataFrame with 1st column sample id and 2nd column chronological age. The sample order in chronage doesn’t have to be in the same order as in exprdata. However, the samples in chronage and exprdata should be the same. If some samples’ chronological age are not available, users are expected to set the chronological age in chronage to NaN. If chronage contains more than 2 columns, only the first 2 columns will be considered. If this argument is not provided, the age acceleration residual will not be calculated. See package tutorial for the definition of age acceleration residual.

Returns

a pandas DataFrame contains RNA age.

property signature
property stype
property tissue

racpy.exceptions module

exception racpy.exceptions.Error[source]

Bases: Exception

Base-class for all exceptions raised by this module

exception racpy.exceptions.SetterError[source]

Bases: racpy.exceptions.Error

There was a problem with the use of setter

racpy.makeplot module

racpy.makeplot.makeplot(res, main='RNA age vs chronological age', xlab='chronological age', ylab='RNA Age')[source]

Make plot to visualize RNA age.

This function makes plots to visualize the relationship between chronological age and RNA age.

Parameters

res – a pandas DataFrame returned by predict_age function.

If the chronological age is not provided when using predict_age function, visulization cannot be made.

Parameters
  • main – a string which specifies the title of the plot

  • xlab – a string which specifies label of x-axis

  • ylab – label of y-axis

Returns

a scatter plot

Module contents

Top-level package for racpy.