Skip to content

grl.unlist modifies elements' meta col name when conflict with GRL's #15

@xtYao

Description

@xtYao

In grl.unlist, the final step is to merge the meta columns of the input GRangesList and the unlisted GRanges:

values(out) = BiocGenerics::cbind(values(grl)[out$grl.ix, , drop = FALSE], values(out))

If there is duplicated col names, it modifies the column name in out by appending .1 to it, while preserving colnames in values(grl). This is inconvenient because usually use case of the function would be to annotate a GRangesList in its unlisted form and then split back to listed form, after which the columns of the GRangesList and its elements column with the same name got swapped.

For example, both GRL and its elements have a column cn, then after gr = grl.unlist(grl); new.grl = split(gr, gr$grl.ix), the element in new.grl now have two columns cn and cn.1, however the cn.1 matches to the old element column cn, and the new cn matches to mcols(grl)$cn. This causes inconsistency.

I suggest simply swap the two argument in cbind, so that the element meta col names got preserved in the output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions