rotifer.interval.utils.filter_nonoverlapping_regions#
- rotifer.interval.utils.filter_nonoverlapping_regions(df, reference=['query'], start='qstart', end='qend', maximum_overlap=0.4, criteria={'probability': False, 'region_length': False, 'score': False, 'sum_probs': False}, *args, **kwargs)[source]#
This function selects the best set of non-overlapping intervals.
The input Pandas DataFrame must contain columns corresponding to unidimensional interval coordinates (start and end columns) and at least one reference column (e.g. pid or sequence).
- Parameters:
- dfPandas dataframe
The dataframe must have at least a reference column and coordinates
- reference(list of) strings, default [‘sequence’]
Name of the column storing sequence identifiers
- startstring, default estart
Name of the column with the first coordinate of each interval
- endstring, default eend
Name of the column with the last coordinate of each interval
- maximum_overlapinteger, default 0.1 (10% of the shortest)
Maximum number of overlapping residues to ignore. If maximum_overlap < 1, the parameter is treated as a percentage
- criteriaordered dictionary
Criteria for best interval selection.
Keys in this dictionary must match column names in the input Pandas DataFrame. Values should be booleans (True or False).
‘region_length’ is an exception: this column is automatically calculated from the start and end coordinates of each region.
A True value for a given column will give precedence for rows with the smallest value in that column. A False value will select rows with the largest values.
Examples
HMMER results, parsed by hmmer2table, using the environment limits:
>>> df = pd.read_csv("results.hmmer2table.tsv", sep=" ") >>> dfc = filter_overlapping_regions(df)
HH-suite results based on the largest probability and/or region length:
>>> df = pd.read_csv("results.hhsuite2table.tsv", sep=" ") >>> c = {'probability':False, 'region_length':False} >>> dfc = filter_overlapping_regions(df, start='qstart', end='qend', criteria=c)