Utilities to map genes
count_genes_in_mapping(gene_lists, labels, mapping, normalise=False)¶
Maps lists of ids to a mapping dictionary, returning a
pandas.DataFramein which the rows are the labels provided and the columns the categories to which the ids map. Each element of the matrix label-category is the sum of all ids in the relative gene list that maps to the specific category.
- gene_lists (iterable) – an iterable in which each element is a iterable of ids that can be mapped to mapping
- labels (iterable) – an iterable of strings that defines the labels to
be used in the resulting rows in the
pandas.DataFrame; must have the same length as gene_lists
- mapping (dict) – a dictionary in the form: gene_id->[cat1, cat2, .., catN]
- normalise (bool) – if True the counts are normalised over the total for each row.
group_annotation_by_mapping(annotations, mapping, attr='ko')¶
Group annotations by mapping dictionary
Parameters: Return dict: