genomepy.annotation.filter_regex

genomepy.annotation.filter_regex(df: DataFrame, regex: str, invert_match: Optional[bool] = False, column: Union[str, int] = 0) DataFrame

Filter a pandas dataframe by a column (default: 1st, contig name).

Parameters
  • df (pd.Dataframe) – annotation to filter (a pandas dataframe)

  • regex (str) – regex string to match

  • invert_match (bool, optional) – keep contigs NOT matching the regex string

  • column (str or int, optional) – column name or number to filter (default: 1st, contig name)

Returns

filtered dataframe

Return type

pd.DataFrame