Single cell analysis package
Classes | Functions | Variables
sc-analyses Namespace Reference

Classes

class  settings
 this class reads settings of the run and keeps them in its attributes if settings file in incorrect, the init method prints error and terminates application More...
 

Functions

def read_expression (expression_file, settings, min_expression=0.1, min_cells=10, log_transform=True)
 function takes expression file and settings object and returns: More...
 
def run_PCA (expression_table, annotation, n_components)
 runs PCA and returns: More...
 
def get_isoforms_correlated_with_pc (expression_table, pc, n, filename)
 save genes correlated with a PC to file More...
 
def annotate_df (row, df, min_dist, ax)
 create annotation label for a point on axis if it's far enough from other points used internally by plotting functions More...
 
def plot_2d_pca_multiplot (transformed_expression, annotation, pca, settings)
 create plot of 6 PC combinations PC1 vs PC2, PC3 vs PC4 etc. More...
 
def plot_2d_pca_single_plot (transformed_expression, annotation, pca, settings)
 plot cells of defined pair of PCs arguments are: More...
 
def plot_3d_pca (transformed_expression, annotation, settings, height=1080, width=1600)
 create 3d PCA plot using plotly library arguments are: More...
 
def plot_hierarchycal_clusterings (transformed_expression, annotation, settings)
 plot hierarchycal clustering arguments are: More...
 
def rotate_expression (transformed_expression, x, y, angle)
 rotate transformed expression matrix by defined angle used internally in order to define pseudotime arguments are: More...
 
def find_pseudotime (transformed_expression, annotation, pca, settings)
 function More...
 
def plot_gene_with_pseudotime (exp, pseudotime, transcript_id)
 plots gene expression over pseudotime arguments are: More...
 
def main ()
 main function when run separately, program expects following arguments: More...
 

Variables

list run_modes = ["find_day_correlated_pcs", "2d-pca-multiplot", "2d-pca-single", "3d-pca", "hierarchy", "pseudotime"]
 what modes can be script run in More...
 
list accepted_sets_with_parameter = ["color", "outline-color", "size", "name", "shape", "superimpose", "superimpose-for-spearman"]
 sets with parameter look like: operation set_name parameter for ex. More...
 
list accepted_sets_without_parameter = ["remove"]
 sets without parameter look like: operation set_name for ex. More...
 
list accepted_parameters = ["number_of_genes"]
 parameters supposed to be set once More...
 

Function Documentation

◆ annotate_df()

def sc-analyses.annotate_df (   row,
  df,
  min_dist,
  ax 
)

create annotation label for a point on axis if it's far enough from other points used internally by plotting functions

◆ find_pseudotime()

def sc-analyses.find_pseudotime (   transformed_expression,
  annotation,
  pca,
  settings 
)

function

  • finds pair of 2 PCs that are most correlated with time labels (as defined by "day" column in annotation table) using spearman correlation
  • finds rotation of this PCs so X axis has best correlation with time

returns: pseudotime for each cell, defined as linear combination of PCs, having best time correlation

arguments are:

  • pd.DataFrame with PCA transformed gene expression
  • annotation pd.DataFrame
  • pca sklearn.decomposition object
  • settings object

◆ get_isoforms_correlated_with_pc()

def sc-analyses.get_isoforms_correlated_with_pc (   expression_table,
  pc,
  n,
  filename 
)

save genes correlated with a PC to file

◆ main()

def sc-analyses.main ( )

main function when run separately, program expects following arguments:

◆ plot_2d_pca_multiplot()

def sc-analyses.plot_2d_pca_multiplot (   transformed_expression,
  annotation,
  pca,
  settings 
)

create plot of 6 PC combinations PC1 vs PC2, PC3 vs PC4 etc.

arguments are:

  • pd.DataFrame with PCA transformed gene expression
  • annotation pd.DataFrame
  • pca sklearn.decomposition object
  • settings object

◆ plot_2d_pca_single_plot()

def sc-analyses.plot_2d_pca_single_plot (   transformed_expression,
  annotation,
  pca,
  settings 
)

plot cells of defined pair of PCs arguments are:

  • pd.DataFrame with PCA transformed gene expression
  • annotation pd.DataFrame
  • pca sklearn.decomposition object
  • settings object

◆ plot_3d_pca()

def sc-analyses.plot_3d_pca (   transformed_expression,
  annotation,
  settings,
  height = 1080,
  width = 1600 
)

create 3d PCA plot using plotly library arguments are:

  • pd.DataFrame with PCA transformed gene expression
  • annotation pd.DataFrame
  • settings object

◆ plot_gene_with_pseudotime()

def sc-analyses.plot_gene_with_pseudotime (   exp,
  pseudotime,
  transcript_id 
)

plots gene expression over pseudotime arguments are:

  • pd.DataFrame with gene expression
  • pd.Series with pseudotime coordinates for each cell
  • Ensamble transcript ID

◆ plot_hierarchycal_clusterings()

def sc-analyses.plot_hierarchycal_clusterings (   transformed_expression,
  annotation,
  settings 
)

plot hierarchycal clustering arguments are:

  • pd.DataFrame with PCA transformed gene expression
  • annotation pd.DataFrame
  • settings object
  • filename for output picture

◆ read_expression()

def sc-analyses.read_expression (   expression_file,
  settings,
  min_expression = 0.1,
  min_cells = 10,
  log_transform = True 
)

function takes expression file and settings object and returns:

  • pd.DataFrame with [log transformed] expression values [genes expressed over min_expression in at least min_cells]
  • pd.DataFrame with annotations for each cell. Expression table and annotation table have the same rows

◆ rotate_expression()

def sc-analyses.rotate_expression (   transformed_expression,
  x,
  y,
  angle 
)

rotate transformed expression matrix by defined angle used internally in order to define pseudotime arguments are:

  • pd.DataFrame with PCA transformed gene expression
  • x,y = PCs to rotate
  • angle in degrees returns: pdDataFrame with values in columns x,y rotated by angle

◆ run_PCA()

def sc-analyses.run_PCA (   expression_table,
  annotation,
  n_components 
)

runs PCA and returns:

  • PCA transformed coordinates
  • sklearn.decomposition.pca object

Variable Documentation

◆ accepted_parameters

list sc-analyses.accepted_parameters = ["number_of_genes"]

parameters supposed to be set once

◆ accepted_sets_with_parameter

list sc-analyses.accepted_sets_with_parameter = ["color", "outline-color", "size", "name", "shape", "superimpose", "superimpose-for-spearman"]

sets with parameter look like: operation set_name parameter for ex.

: color day_4 clue

◆ accepted_sets_without_parameter

list sc-analyses.accepted_sets_without_parameter = ["remove"]

sets without parameter look like: operation set_name for ex.

: remove low_read_count_cells

◆ run_modes

list sc-analyses.run_modes = ["find_day_correlated_pcs", "2d-pca-multiplot", "2d-pca-single", "3d-pca", "hierarchy", "pseudotime"]

what modes can be script run in