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

Weird bug when trying to normalize p-values #5

Open
BenayounLaboratory opened this issue Jan 5, 2022 · 2 comments
Open

Weird bug when trying to normalize p-values #5

BenayounLaboratory opened this issue Jan 5, 2022 · 2 comments

Comments

@BenayounLaboratory
Copy link

BenayounLaboratory commented Jan 5, 2022

Hi,

I am encountering a weird bug after inputting my data when I start the p-value normalization steps.

The annotateExpression and annotateModification steps work fine, so does the makePvalueObject step, and no errors occur. An object is generated.

Then, wen I attempt to proceed to pval normalization steps, things stop working unexpectedly and the error messages are not very helpful.

  • when calling plotDensityPval:
    Error in abs(returnPvalueCol(slot(pvalue_annotation, "score_data"), ref)) : non-numeric argument to mathematical function

  • when calling normalizePval:
    Error in 1 - p_ref : non-numeric argument to binary operator

Any idea what is happening and how to fix it? I have tried reformatting, removing some of my epigenomics, etc, but nothing is changing the error message.

Thank you for your help!

Best

@AJEinstein
Copy link
Contributor

AJEinstein commented Jan 5, 2022 via email

@BenayounLaboratory
Copy link
Author

Hi Andrew,

thank you for the quick response!

I have already checked, and there are no NAs or p-values equal to zero in our dataset.

Here is the sequence of events that runs without error:

SMITE.annotation.F <- makePvalueAnnotation(data                         = mm10_genes,
                                           other_data                   = list(enhancers = perimac_enhancers[,1:3]), 
                                           gene_name_col                = 4   , # 4th column of mm10_genes
                                           strand_col                   = 5   , # 5th column of mm10_genes
                                           other_tss_distance           = 5000, 
                                           promoter_upstream_distance   = 1000,
                                           promoter_downstream_distance = 1000)

SMITE.annotation.F <- annotateExpression(pvalue_annotation = SMITE.annotation.F,
                                         expr_data  = my.RNA.clean, 
                                         effect_col = 2,
                                         pval_col   = 3)

SMITE.annotation.F <- annotateModification(SMITE.annotation.F,
                                           F.my.atac.clean, 
                                           weight_by_method = "Stouffer", # Stouffer is default
                                           weight_by = c(promoter = "pval", body = "pval", enhancers = "distance"), 
                                           verbose = TRUE,
                                           mod_corr = TRUE, 
                                           mod_type = "ATAC",
                                           mod_included = c("promoter", "enhancers"))

SMITE.annotation.F <- makePvalueObject(SMITE.annotation.F,
                                       effect_directions = c(ATAC_promoter               = "increase"      ,
                                                             ATAC_enhancers              = "increase"      ) 
                                       )

Then, the prior errors occur when I either run:
plotDensityPval(pvalue_annotation = SMITE.annotation.F, cex = 0.4, ref = "expression")
or

SMITE.annotation.F <- normalizePval(SMITE.annotation.F, ref = "expression_pvalue")

Here are the headers of my inputs:
mm10_genes:

   chr   start     end GeneSymbol strand
1 chr1 3214482 3671498       Xkr4      -
2 chr1 4290846 4409241        Rp1      -
3 chr1 4490928 4497354      Sox17      -
4 chr1 4773200 4785726     Mrpl15      -
5 chr1 4807893 4846735     Lypla1      +
6 chr1 4857694 4897909      Tcea1      +

perimac_enhancers[,1:3]

      V1      V2      V3
7  chr10 3109400 3109800
24 chr10 3237000 3237400
35 chr10 3271200 3272400
39 chr10 3273600 3275200
68 chr10 3634200 3634400
76 chr10 3696200 3698400

my.RNA.clean

        GeneName log2FoldChange    pvalue
Rp1          Rp1   0.0016144572 0.8598752
Mrpl15    Mrpl15  -0.0004240793 0.9540478
Lypla1    Lypla1   0.0013636535 0.7965488
Tcea1      Tcea1  -0.0076257920 0.1522119
Rgs20      Rgs20   0.0568351806 0.2223534
Atp6v1h  Atp6v1h  -0.0022758691 0.6914778

F.my.atac.clean

                   Chr  Start    End log2FoldChange       pvalue
1 chr1_GL456211_random 111322 112587   -0.008756197 6.197186e-01
2 chr1_GL456211_random 115479 117473    0.020757561 4.480256e-01
3 chr1_GL456211_random 174525 174943    0.129627350 1.327759e-03
4 chr1_GL456212_random 101254 101625   -0.019844493 3.726685e-01
5 chr1_GL456212_random 150456 151713    0.067497317 8.724489e-03
6 chr1_GL456212_random 153072 153332    0.124315804 5.376452e-09

Any insights to figure out why this is not running (when the test data runs without issue) would be greatly appreciated.

Thank you!

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

2 participants