Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble specifying regions for CoveragePlot and visualizing genes #771

Closed
zrcjessica opened this issue Sep 1, 2021 · 11 comments
Closed
Labels
bug Something isn't working

Comments

@zrcjessica
Copy link

Following up on #746

I have a scATAC-seq dataset on which I've run Cicero and would like to visualize links of interest. I've created a Links object and added it to my Signac object as described in the Signac vignettes. However, I have noticed that I run into issues when I try to specify my own regions for the CoveragePlot (rather than directly giving it a range from the Links object, e.g. CoveragePlot(object = atac, region = links[1])). I think that this might be because my custom regions extend past the end of the chromosome, but I have not stringently tested this. In any case, the error message that I get in this case looks something like this:

Error: Aesthetics must be either length 1 or the same as the data (253): label

Additionally, I have tried to specify gene names (rather than coordinates) for the region argument. For example:

CoveragePlot(object = atac, region = "Tmem212")

According to the docs, this should work. I've also made sure that the annotation associated with my atac object contains an entry for this gene, but I get the following error:

Error: logical subscript contains NAs

In my case, I am using the rat genome from Ensembl, Rnor_6.0.

Finally, I have noticed that sometimes when I am plotting a region, genes won't show up when I would expect it to, or I might see parts of gene bodies in the plot but no annotation for their names. For example:
image
While Tmem212 shows up and is annotated, the other two genes that overlap the window being visualized are not labeled. My hunch is that genes which are not entirely located within the region specified for plotting are not labeled. If that's the case, then I think it would be really helpful to modify the code such that even genes which are only partially located within the plot region are labeled.

Thanks for your help!

@zrcjessica zrcjessica added the bug Something isn't working label Sep 1, 2021
@timoast
Copy link
Collaborator

timoast commented Sep 2, 2021

Hi @zrcjessica, could you show the code needed to create the annotation object?

As for the gene name issue, this should be fixed in the latest version of Signac. Can you try updating and see if you still have this issue?

@zrcjessica
Copy link
Author

Hi @timoast, here's the code for how I added the annotation to my Signac object:

atac <- readRDS("atac.rds")
ens.gtf <- import("Rattus_norvegicus.Rnor_6.0.101.gtf")
genome(ens.gtf) <- "Rnor_6.0"
DefaultAssay(atac) <- "peaks"
Annotation(dat) <- ens.gtf

I'm using the GTF file from Ensembl and loading in my Signac object from an RDS file.

To update my version of Signac which I have installed with conda, is this the right command?

conda update -c bioconda r-signac

@timoast
Copy link
Collaborator

timoast commented Sep 3, 2021

I think the issue is that there are some entries with NA for the gene name, and this causes an error when trying to look up the gene name. If you run:

ens.gtf <- ens.gtf[!is.na(ens.gtf$gene_name)]
Annotation(atac) <- ens.gtf

This should probably fix it. I'll also work on a fix within the Signac code to ignore entries with NA.

As for conda, yes that should update the package. You can check the version that's loaded in R by running packageVersion("Signac") (latest release is 1.3.0)

timoast added a commit that referenced this issue Sep 3, 2021
@timoast
Copy link
Collaborator

timoast commented Sep 3, 2021

This should now be fixed on the develop branch, please reopen if you still have issues

@timoast timoast closed this as completed Sep 3, 2021
@zrcjessica
Copy link
Author

Hi! Reopening because I tried to update Signac (via conda) and got this error when I tried to load it into a new R session:

Error: package or namespace load failed for ‘Signac’:
 object ‘markvario’ is not exported by 'namespace:spatstat'

Any thoughts on what this might be?

@timoast
Copy link
Collaborator

timoast commented Sep 8, 2021

You might need to update Seurat as well, I think this is due to an old issue related to spatstat (see mojaveazure/seurat-disk#56)

@zrcjessica
Copy link
Author

I followed the suggestions to update my version of spatstat and also just updated Seurat but now I'm getting this error when I try to load in either Signac or Seurat:

namespace ‘SeuratObject’ 4.0.0 is being loaded, but >= 4.0.2 is required

@timoast
Copy link
Collaborator

timoast commented Sep 8, 2021

Ok, you might also need to update SeuratObject. Normally it's updated automatically, since Seurat depends on SeuratObject >= 4.0.2, not sure why it hasn't in your case. Might be something to do with conda.

@zrcjessica
Copy link
Author

Should I still try to install SeuratObject via conda?

@timoast
Copy link
Collaborator

timoast commented Sep 8, 2021

Yep, if you're using conda to install R packages it's best to stick with using conda for all the packages

@zrcjessica
Copy link
Author

Alright, it seems to have worked, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants