Code Monkey home page Code Monkey logo

Comments (7)

wvictor14 avatar wvictor14 commented on September 20, 2024

Hi Alan, sorry I missed this message

Can you provide a little more detail, your code, the output messages, and a sessionInfo() call?

from planet.

alanlamsiu avatar alanlamsiu commented on September 20, 2024

Hi Victor,

Thanks for getting back.

I tried to follow the example and it worked as shown below.

> predictEthnicity(plBetas) %>%
  head()
1860 of 1860 predictors present.
# A tibble: 6 × 7
  Sample_ID  Predicted_ethnicity_nothr… Predicted_ethni… Prob_African Prob_Asian
  <chr>      <chr>                      <chr>                   <dbl>      <dbl>
1 GSM1944936 Caucasian                  Caucasian            0.00331    0.0164
2 GSM1944939 Caucasian                  Caucasian            0.000772   0.000514
3 GSM1944942 Caucasian                  Caucasian            0.000806   0.000699
4 GSM1944944 Caucasian                  Caucasian            0.000883   0.000792
5 GSM1944946 Caucasian                  Caucasian            0.000885   0.00130
6 GSM1944948 Caucasian                  Caucasian            0.000852   0.000973
# … with 2 more variables: Prob_Caucasian <dbl>, Highest_Prob <dbl>

Then I use my own data, which is also a table of beta values but it showed the "NA" output.

> predictEthnicity(betas) %>%
  head()
1860 of 1860 predictors present.
# A tibble: 6 × 7
  Sample_ID Predicted_ethnicity_nothre… Predicted_ethni… Prob_African Prob_Asian
  <chr>     <lgl>                       <lgl>                   <dbl>      <dbl>
1 NPBB_1   NA                          NA                         NA         NA
2 NPBB_2   NA                          NA                         NA         NA
3 NPBB_3  NA                          NA                         NA         NA
4 NPBB_4   NA                          NA                         NA         NA
5 NPBB_5   NA                          NA                         NA         NA
6 NPBB_6   NA                          NA                         NA         NA
# … with 2 more variables: Prob_Caucasian <dbl>, Highest_Prob <dbl>

Here is the sessionInfo output.

> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /home/alan/conda_envs/sesame_v1.16.0/lib/libopenblasp-r0.3.21.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] planet_1.4.0

loaded via a namespace (and not attached):
 [1] compiler_4.2.2  ellipsis_0.3.2  magrittr_2.0.3  cli_3.5.0
 [5] tools_4.2.2     pillar_1.7.0    glue_1.6.2      tibble_3.1.7
 [9] crayon_1.5.1    utf8_1.2.2      fansi_1.0.3     vctrs_0.5.1
[13] lifecycle_1.0.3 pkgconfig_2.0.3 rlang_1.0.6

I appreciate if you could advise on this issue.

from planet.

wvictor14 avatar wvictor14 commented on September 20, 2024

I suspect your data has NAs

Can you run the following?

pf <- intersect(rownames(betas), ethnicityCpGs)
sum(is.na(betas[pf,]))
range(betas[pf,])
head(betas[pf,])

from planet.

wvictor14 avatar wvictor14 commented on September 20, 2024

If your data looks fine after checking with above, would you be able to send me a sample of your data?

just this would be fine:

betas[pf,] # just the ethnicity predictors

Does the predictAge function work?

from planet.

alanlamsiu avatar alanlamsiu commented on September 20, 2024

Thanks Victor for looking into the issue. Please see the table here, https://github.com/alanlamsiu/Data_sharing/blob/main/ethnicity_probes_betas.txt, for beta values of the ethnicity predictors. I also tried predictAge but it returned "NA" for all individuals.

from planet.

wvictor14 avatar wvictor14 commented on September 20, 2024

The reason why they are likely all NAs is that you are missing 635 out of 1860 predictors (CpGs) for all individual samples. Please do not bother with these functions unless you have a sufficient amount of the predictor data available

library(readr)
library(planet)
library(glue)
#devtools::install_github('wvictor14/planet')

data <- read.table('ethnicity_probes_betas.txt')
head(data)

sum(is.na(data))

rows_all_missing <- rowSums(is.na(data)) == ncol(data)
index_all_missing <- which(rows_all_missing) 

n_missing <- sum(rows_all_missing)

glue::glue('There is {n_missing} out of 1860 # of CpGs', 
           'that are missing for all individuals.')
glue('here are the cpgs that are missing:')
rownames(data)[index_all_missing]

from planet.

alanlamsiu avatar alanlamsiu commented on September 20, 2024

Thanks Victor. I will try again when getting better data.

from planet.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.