coalispr.bedgraph_analyze.experiment

Module to manage experiments and samples.

Functions

all_exps([plusdiscards, allpos, allneg, allmut])

Return SHORT names for all (non-redundant) experimental/data samples.

controls([allpos, allneg])

Return SHORT names for positive and negative control samples.

discarded()

Return SHORT names for discarded samples (CAT_D).

for_group(group[, plusdiscards, samples])

Return dicts of group member names vs. lenghts and samples.

get_grplabels(keygrp)

Return labels to denote various samples in a group. This could be for

get_picks()

Return list of keys and items for comparing groups.

goption()

Assemble values for -g command-line options according to availability.

has_discards()

Return True if samples have been declared as unused (CAT_D)

has_redundant_muts()

Return True if samples have been declared as CAT_M.lower()

has_grouparg()

Boolean to indicate if -g command-line option is feasible

mixed_groups([plusdiscards, allmut, samples])

Return nested dict with sample names for groups with multiple subgroups

mutant([allmut])

Return SHORT names for mutant samples (CAT_M).

negative([allneg])

Return list of SHORT names for negative control samples (CAT_U).

positive([allpos])

Return SHORT names for positive control samples (CAT_S).

reference()

Return SHORT names for reference samples (CAT_R).

mutant_groups(df)

Build and return a list of tuples for generating sidepanels with

drop_discarded(df)

Return dataframe without discarded samples.

get_discard([df])

Provide discard selection present in dataframe df.

get_mutant([df, allmut])

Provide mutant selection present in dataframe df.

get_negative([df, allneg])

Provide negative control selection present in dataframe df.

get_positive([df, allpos])

Provide positive control selection present in dataframe df.

get_reference([df])

Provide reference selection present in dataframe df.

Module Contents

coalispr.bedgraph_analyze.experiment.all_exps(plusdiscards=True, allpos=True, allneg=True, allmut=True)

Return SHORT names for all (non-redundant) experimental/data samples.

Parameters:
  • plusdiscards (bool) – If ‘True’, any CAT_D samples will be included.

  • minimal (bool (default: False)) – Flag to include redundant samples, i.e. to return all mutant samples.

coalispr.bedgraph_analyze.experiment.controls(allpos=True, allneg=True)

Return SHORT names for positive and negative control samples.

coalispr.bedgraph_analyze.experiment.discarded()

Return SHORT names for discarded samples (CAT_D).

coalispr.bedgraph_analyze.experiment.for_group(group, plusdiscards=False, samples=None)

Return dicts of group member names vs. lenghts and samples.

Parameters:
  • group (str) – Name of group to use.

  • plusdiscards (bool) – If ‘True’, any CAT_D samples will be included.

  • samples (list) – Samples to group

coalispr.bedgraph_analyze.experiment.get_grplabels(keygrp)

Return labels to denote various samples in a group. This could be for REST or ALL.

Parameters:

keygrp (str) – Key for selecting proper dictionary with group labels.

coalispr.bedgraph_analyze.experiment.get_picks()

Return list of keys and items for comparing groups.

coalispr.bedgraph_analyze.experiment.goption()

Assemble values for -g command-line options according to availability.

Returns:

Dictionary to assemble command parser item ‘-g’ and options vs. choices. {‘usegroups’:{1:CATEGORY, 2:grouping2,}, ‘-g’:’ -g{1,2,}’, ‘glist’:[1, 2,], ‘-h’:’Group libraries according to 1: CATEGORY; 2: grouping2;.’ }

Return type:

dict

coalispr.bedgraph_analyze.experiment.has_discards()

Return True if samples have been declared as unused (CAT_D)

coalispr.bedgraph_analyze.experiment.has_redundant_muts()

Return True if samples have been declared as CAT_M.lower()

coalispr.bedgraph_analyze.experiment.has_grouparg()

Boolean to indicate if -g command-line option is feasible

coalispr.bedgraph_analyze.experiment.mixed_groups(plusdiscards=False, allmut=False, samples=None)

Return nested dict with sample names for groups with multiple subgroups (for group-comparison).

Parameters:
  • plusdiscards (bool) – If ‘True’, any CAT_D samples will be included.

  • allmut (bool (default: False)) – Flag to include redundant samples, i.e. to return all mutant samples.

  • samples (list) – List of samples.

coalispr.bedgraph_analyze.experiment.mutant(allmut=False)

Return SHORT names for mutant samples (CAT_M).

Get mutants to be analyzed. Set ‘allmut’ to True to include redundant samples. This could change/induce bias when deviance (from positive controls) of mapped reads gets more weight due to a larger number of similar (technical) repeats.

Parameters:

allmut (bool (default: False)) – Flag to include redundant samples, i.e. to return all mutant samples.

Returns:

A list of SHORT names for non-redundant or (all) mutant samples.

Return type:

list

coalispr.bedgraph_analyze.experiment.negative(allneg=True)

Return list of SHORT names for negative control samples (CAT_U).

Parameters:

allneg (bool) – Flag to include all negative control samples where process is found to be turned off (False); this is the minimal set of negative controls, marked by CAT_U in uppercase in EXPFILE. Samples can also be included if their inactivated/deleted protein is expected to bind sequenced RNA or is known to be essential to sustain the biological process under study (True);

coalispr.bedgraph_analyze.experiment.positive(allpos=True)

Return SHORT names for positive control samples (CAT_S).

Parameters:

allpos (bool) – If False, only samples marked by CAT_S in uppercase in EXPFILE are collected. By default all are returned.

coalispr.bedgraph_analyze.experiment.reference()

Return SHORT names for reference samples (CAT_R).

coalispr.bedgraph_analyze.experiment.mutant_groups(df)

Build and return a list of tuples for generating sidepanels with labels described in group dicts like MUTGROUPS in EXPFILE; Samples are selected from dataframe incl. discards if needed; being marked irrelevant, discards do not get a legend in the side panel.

Determines order of appearance: [
    (NEGCTL, _getshortsdict(GROUP, UNSPECIFICS)),
    (METHOD, _getshortsdict(METHOD, METHODS)),
    (FRACTION, _getshortsdict(FRACTION, FRACTIONS)),
    (CONDITION, _getshortsdict(CONDITION, CONDITIONS)),
    (MUTANT, _getshortsdict(GROUP, MUTANTS)),
    ]
Parameters:

df (Pandas.DataFrame) – Dataframe like that for merged bedgraphs: sample names to be retrieved - to define groupings via the EXPFILE - are in the columns.

coalispr.bedgraph_analyze.experiment.drop_discarded(df)

Return dataframe without discarded samples.

Calling function should check for empty discarded() (and then skip this)

coalispr.bedgraph_analyze.experiment.get_discard(df=None)

Provide discard selection present in dataframe df.

coalispr.bedgraph_analyze.experiment.get_mutant(df=None, allmut=False)

Provide mutant selection present in dataframe df.

coalispr.bedgraph_analyze.experiment.get_negative(df=None, allneg=True)

Provide negative control selection present in dataframe df.

coalispr.bedgraph_analyze.experiment.get_positive(df=None, allpos=True)

Provide positive control selection present in dataframe df.

coalispr.bedgraph_analyze.experiment.get_reference(df=None)

Provide reference selection present in dataframe df.