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

Using my interested da peaks in FindMotifs() turns into an error. #1109

Closed
jiangpuxuan opened this issue May 3, 2022 · 15 comments
Closed

Using my interested da peaks in FindMotifs() turns into an error. #1109

jiangpuxuan opened this issue May 3, 2022 · 15 comments

Comments

@jiangpuxuan
Copy link

jiangpuxuan commented May 3, 2022

Here is my code:

de.motif <- rownames(mydata)[1:50]
enriched.motifs <- FindMotifs(
  object = mydata,
  features = de.motif,
)
head(enriched.motifs)

1651584391(1)

Everything is OK.

And I tried to use my interested da peaks in enriched.motifs :

enriched.motifs <- FindMotifs(
  object = mydata,
  features = the da peaks in some interested cells ,
)

But the error is:

Error in density.default(x = query.feature[[featmatch]], kernel = "gaussian", : 'x' contains missing values

Thank you for your help!

@timoast
Copy link
Collaborator

timoast commented May 3, 2022

Can you show the DA peaks that cause the error? First few lines and output of dim

@jiangpuxuan
Copy link
Author

1651631710(1)

`de.motif` did not cause the error, but `interested da peaks` did.

@jiangpuxuan
Copy link
Author

Can you show the DA peaks that cause the error? First few lines and output of dim

Now I ran chromeVar and found differentially activating motifs , following the https://satijalab.org/signac/articles/motif_vignette.html.

But I still want to know the cause of this error.

@timoast
Copy link
Collaborator

timoast commented May 4, 2022

How many peaks are in the set of peaks that causes the error?

@jiangpuxuan
Copy link
Author

How many peaks are in the set of peaks that causes the error?

About 120.

@pabloswfly
Copy link

pabloswfly commented May 5, 2022

Curious about the resolution of this issue, I am encountering the same error.
The peak data in my specific case looks like this:

top.da.peak <- rownames(da_peaks[da_peaks$p_val < 0.005,])
head(top.da.peak)
length(top.da.peak)
dim(da_peaks)

----------------------------------------------------------------

'chr3-14451939-14453443''chr2-42903457-42904464''chr18-58364914-58365919''chr4-84417769-84418850''chr1-17602697-17603858''chr1-91585801-91586419'

17242

18728  7

@jiangpuxuan
Copy link
Author

Curious about the resolution of this issue, I am encountering the same error. The peak data in my specific case looks like this:

top.da.peak <- rownames(da_peaks[da_peaks$p_val < 0.005,])
head(top.da.peak)
length(top.da.peak)
dim(da_peaks)

----------------------------------------------------------------

'chr3-14451939-14453443''chr2-42903457-42904464''chr18-58364914-58365919''chr4-84417769-84418850''chr1-17602697-17603858''chr1-91585801-91586419'

17242

18728  7

Could you ran chromeVar and found differentially activating motifs?

@pabloswfly
Copy link

yes I could, as they are two independent processes.

@jiangpuxuan
Copy link
Author

yes I could, as they are two independent processes.

Have you calculated the background in Findmotifs()?

Or I thought that our interested da.peaks are not informative enough so that Findmotifs() get errors.

@pabloswfly
Copy link

My error occurs after calculating the background regions, during the matching of GC content:

Selecting background regions to match input sequence characteristics

Matching GC.percent distribution

Error in density.default(x = query.feature[[featmatch]], kernel = "gaussian", : 'x' contains missing values
Traceback:

1. FindMotifs(sub_endocrine, features = top.da.peak)
2. MatchRegionStats(meta.feature = mf.choose, query.feature = mf.query, 
 .     regions = features, n = background, verbose = verbose, ...)
3. density(x = query.feature[[featmatch]], kernel = "gaussian", 
 .     bw = 1)
4. density.default(x = query.feature[[featmatch]], kernel = "gaussian", 
 .     bw = 1)
5. stop("'x' contains missing values")

I had some peaks with zero counts in all cells in my object, but after filtering these rows out, I still get the same error.

@jiangpuxuan jiangpuxuan changed the title Using my interested da peaks in enriched.motifs turns into an error. Using my interested da peaks in FindMotifs() turns into an error. May 6, 2022
@rLannes
Copy link

rLannes commented May 9, 2022

Please, can you tell me How did you filter them out? I am running in the same issue. I would like to give it a try.

@jiangpuxuan
Copy link
Author

Please, can you tell me How did you filter them out? I am running in the same issue. I would like to give it a try.

Sorry, I have not solved this. But I recommand you run chromevar pipeline, following the https://satijalab.org/signac/articles/motif_vignette.html.

@rLannes
Copy link

rLannes commented May 9, 2022

I did, and I managed to run chromvar, but the Find Motifs function give me the same error as you. The thing that trouble me is if I use a subset of DE peaks it is fine. That is why I would want to try to subset only the peaks with at least some counts.

enriched.motifs <- FindMotifs(
  object = integrated,
  features = rownames(de)
)
Selecting background regions to match input sequence characteristics
Matching GC.percent distribution
Error in density.default(x = query.feature[[featmatch]], kernel = "gaussian",  : 
  'x' contains missing values

enriched.motifs <- FindMotifs(
  object = integrated,
  features = rownames(de)[1:100]
)
Selecting background regions to match input sequence characteristics
Matching GC.percent distribution
Testing motif enrichment in 100 regions

@rLannes
Copy link

rLannes commented May 9, 2022

I got the solution to my issue. Some peaks in the Differential peak object have an extension "chrX-131703821-131705582.1" removing the .1 solve the issue for me, hope this will help others.

@timoast
Copy link
Collaborator

timoast commented May 9, 2022

Thanks @rLannes, I've added a check to FindMotifs() for features that are not present in the assay that should resolve these issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants