This is a test version of Biostars. For the public version, visit https://www.biostars.org.
clock mus musculus in r

Hello,

I'm trying to implement a clock for mus musculus article.

I started with the following code in R

Which gives me a wrong result, 6.238126 years when the mice has 41 weeks..

I don't know what I'm doing wrong.

Thank you

r mus musculus

The paper reports all the ages, predictions and model errors in months, are you sure the model isn't built on (and outputs) months rather than years? (I admit after a very quick check this was not clear in the methodology) (another thing that you may encounter when dealing with clocks is that the outputted age is transformed, for example the model predicts log(age) instead of age).

However since we are dealing with mices I dont know which direction to take.. also the model rightfully states everything in months but since that I just applied the same system as to humans (except the last function) I was expecting the result in years. If we state the result as months (sigma_DNAmPhenoAge = 6.238126) and take approximately 4.34812141 weeks in a month we get 27.12413 weeks; and if we apply the last function it gives 151.0006

For the moment I have checked the first part of your code:

r_mouse = read.csv("GSM2465621_M00018362_41wk_Liver.cov.txt", sep = "\t")

names(r_mouse) <- c("chromosome", "start_position", "end_position", 
                    "methylation_percentage", "methylated", "non_methylated")

r_mouse$chromosome <- paste("chr", r_mouse$chromosome, sep = "")

### ------------------------------------------ Beta's

beta_mouse = (r_mouse$methylated)/(r_mouse$methylated + r_mouse$non_methylated + 100)

names(beta_mouse) <- r_mouse$chromosome

And it leads to your CpGs being named with non-unique names:

head(beta_mouse)
      chr4       chr4       chr4       chr4       chr4       chr4 
0.00000000 0.01960784 0.01960784 0.01960784 0.00000000 0.00990099

So I don't know how you can match each CpG with each coefficient.

I had the same difficulty, however the coefficients that are available at the paper also were indexed as chromosome number instead of CpG's, what I did was (couldn't find a better solution) match every coefficient chromosome to the correspondent beta chromosome and then remove the duplicate values so that they only pair once, after that I just did the summation

That would explain why you got different results. 1) In the paper you linked, both of the available clocks (in sup. tables 1 and 2) do have unique coordinates: look at the Chromosome and the Coordinate columns in the table. If you paste them together (e.g. "chr1_9967422") you will have unique columns. You can do the same for your own data (GSM2465621) by pasting the chr and start or end columns (they are the same) and thus select your CpGs and match them to the clock's coefficients. 2) If not all of the CpGs of the clock are in your data matrix CpGs (GSM2465621), do not ignore those coefficients. It is better if you input them with some values (such as 0% meth) and use them in the summation. 3) Finally, in the summation do not forget to add the Intercept coefficient (it is the first one in the provided clock files). That coefficient does not multiply any methylation value.

0 answers

No answers yet.

Log in to answer this question.