Skip to content

Bug if no significant results (e.g. from meme) #67

@fwzhao

Description

@fwzhao

# collect enrichments
if serial:
# read/parse, label and append
for name, df, function, kwargs, suffix, _ in possible_steps:
if name in steps:
enr = function(
get_this_file_or_timestamped(os.path.join(comparison_dir, suffix)),
**kwargs
)
enr.loc[:, "comparison_name"] = comp
enr.loc[:, "direction"] = direction
enr.loc[:, "label"] = "{}.{}".format(comp, direction)
df.append(enr)

If there are no enrichments (e.g. nothing out of meme), the subsequent lines of code cause a "ValueError: cannot set a frame with no defined index and a scalar" since there are no results (enr is an empty dataframe).

The solution would be to add this tiny if statement - if not enr.empty:

            # collect enrichments
            if serial:
                # read/parse, label and append
                for name, df, function, kwargs, suffix, _ in possible_steps:
                    if name in steps:
                        enr = function(
                            get_this_file_or_timestamped(
                                os.path.join(comparison_dir, suffix)),
                            **kwargs)
                        if not enr.empty:
                            enr.loc[:, "comparison_name"] = comp
                            enr.loc[:, "direction"] = direction
                            enr.loc[:, "label"] = "{}.{}".format(
                                comp, direction)
                            df.append(enr)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions