Skip to content

Documentation says "genome" can be a string but code does not support it #1437

@RamRS

Description

@RamRS

The documentation for AddMotifs suggests the genome parameter can be "A BSgenome, DNAStringSet, FaFile, or string stating the genome build recognized by getBSgenome." (emphasis added by me).

However, if we use 'hg19' or 'hg38' as the value, we run into an error stating:

Error in hCsimpleError(msg, call)) :

error in evaluating the argument 'x' in selecting a method for function 'seqlevels':
unable to find an inherited method for function 'seqinfo' for signature '"character"'

I dug through the code and this probably happens here: https://github.com/stuart-lab/signac/blob/master/R/motifs.R#L45

The string is recognized and processed by CreateMotifMatrix:

https://github.com/stuart-lab/signac/blob/master/R/preprocessing.R#L142

but the new genome object (BSgenome) is not available to the parent function. The assignment needs to happen using a global assignment operator (<<-) or the genome variable needs to be returned to the calling function for the change to reflect.

Code to reproduce this from your vignette:

library(Signac)
library(Seurat)
library(JASPAR2020)
library(TFBSTools)
library(BSgenome.Mmusculus.UCSC.mm10)
library(patchwork)

mouse_brain <- readRDS("../vignette_data/adult_mouse_brain.rds")

# Get a list of motif position frequency matrices from the JASPAR database
pfm <- getMatrixSet(
  x = JASPAR2020,
  opts = list(collection = "CORE", tax_group = 'vertebrates', all_versions = FALSE)
)

# add motif information
mouse_brain <- AddMotifs(
  object = mouse_brain,
  genome = 'mm10',
  pfm = pfm
)

However, this works:

# add motif information
mouse_brain <- AddMotifs(
  object = mouse_brain,
  genome = BSgenome.Mmusculus.UCSC.mm10,
  pfm = pfm
)

I have not tested the code above but @esouto6 has been running your vignette code on our human data and ran into the error mentioned above, which I think you should be able to reproduce on your vignette data.

As this issue was originally reported by my colleague @esouto6, he will provide his sessionInfo() in a comment below.

EDIT: I've run the vignettes on mouse brain and adding motifs and verified this error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Q3 2023

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions