tirank.LoadData

tirank.LoadData.load_bulk_exp(path_to_bulk_exp)[source]

Loads a bulk expression file (CSV or TXT) into a DataFrame.

Parameters:

path_to_bulk_exp (str) – The file path to the bulk expression data. Assumes genes are rows and samples are columns.

Returns:

A pandas DataFrame of the expression data.

Return type:

pd.DataFrame

tirank.LoadData.load_bulk_clinical(path_to_bulk_cli)[source]

Loads a bulk clinical data file (CSV, TXT, or Excel) into a DataFrame.

Parameters:

path_to_bulk_cli (str) – The file path to the bulk clinical data. Assumes samples are rows and clinical variables are columns.

Returns:

A pandas DataFrame of the clinical data.

Return type:

pd.DataFrame

tirank.LoadData.check_bulk(savePath, bulkExp, bulkClinical)[source]

Checks and filters bulk data for common samples.

Intersects the samples in the bulk expression columns and the bulk clinical index. Filters both DataFrames to keep only the common samples and saves the results as pickle files.

Parameters:
  • savePath (str) – The main project directory path to save results.

  • bulkExp (pd.DataFrame) – Bulk expression DataFrame (genes x samples).

  • bulkClinical (pd.DataFrame) – Bulk clinical DataFrame (samples x variables).

Returns:

None

tirank.LoadData.load_sc_data(path_to_sc_h5ead, savePath)[source]

Loads single-cell RNA-seq data from an .h5ad file.

Parameters:
  • path_to_sc_h5ead (str) – The file path to the .h5ad file.

  • savePath (str) – The main project directory path to save the loaded AnnData object as ‘anndata.pkl’.

Returns:

The loaded AnnData object.

Return type:

sc.AnnData

tirank.LoadData.load_st_data(path_to_st_floder, savePath)[source]

Loads spatial transcriptomics (ST) data from a 10x Visium folder.

Uses scanpy.read_visium() to load the data.

Parameters:
  • path_to_st_floder (str) – The file path to the directory containing the 10x Visium output (e.g., ‘spatial’, ‘filtered_feature_bc_matrix.h5’).

  • savePath (str) – The main project directory path to save the loaded AnnData object as ‘anndata.pkl’.

Returns:

The loaded AnnData object.

Return type:

sc.AnnData

tirank.LoadData.view_dataframe(df, nrow=10, ncol=8)[source]

Prints a top-left subset of a DataFrame for quick viewing.

Parameters:
  • df (pd.DataFrame) – The DataFrame to view.

  • nrow (int, optional) – The number of rows to show. Defaults to 10.

  • ncol (int, optional) – The number of columns to show. Defaults to 8.

Returns:

None

tirank.LoadData.transfer_exp_profile(scAnndata)[source]

Converts the .X matrix of an AnnData object to a pandas DataFrame.

Handles both sparse and dense .X matrices. The resulting DataFrame is structured as genes (rows) x cells/spots (columns).

Parameters:

scAnndata (sc.AnnData) – The AnnData object.

Returns:

The expression matrix as a pandas DataFrame.

Return type:

pd.DataFrame

Functions

tirank.LoadData.check_bulk

Checks and filters bulk data for common samples.

tirank.LoadData.load_bulk_clinical

Loads a bulk clinical data file (CSV, TXT, or Excel) into a DataFrame.

tirank.LoadData.load_bulk_exp

Loads a bulk expression file (CSV or TXT) into a DataFrame.

tirank.LoadData.load_sc_data

Loads single-cell RNA-seq data from an .h5ad file.

tirank.LoadData.load_st_data

Loads spatial transcriptomics (ST) data from a 10x Visium folder.

tirank.LoadData.transfer_exp_profile

Converts the .X matrix of an AnnData object to a pandas DataFrame.

tirank.LoadData.view_dataframe

Prints a top-left subset of a DataFrame for quick viewing.