genetics-of-dna-methylation-consortium / godmc_phase2

This repository contains the code to run the analysis pipeline for phase 2 of goDMC released June 2024.
GNU General Public License v3.0
2 stars 0 forks source link

[Bug]: cannot run aggregate_adjustment1.sh #17

Closed ks164 closed 1 month ago

ks164 commented 1 month ago

Contact Details

No response

Scripts

03b-methylation_adjustment1.sh

What happened?

I ran 03b-methylation_adjustment in parallel on our cluster, generated the appropriate array of .Rdata files.

I am unable to use ./resources/methylation/aggregate_adjustement1.sh to combine the files, i get error:

Aggregating methylation_adjustment1 chunks There were 18 warnings (use warnings() to see them) Checking all files are present Error in main() : object 'norm.beta' not found Execution halted

N.B. the warnings are all related to R versions packages are installed under

How can the bug be reproduced?

No response

R version

4.3.3 (February, 2024)

Python version

None

Relevant log output

Aggregating methylation_adjustment1 chunks
There were 18 warnings (use warnings() to see them)
Checking all files are present
Error in main() : object 'norm.beta' not found
Execution halted
ZXiaopu commented 1 month ago

Hi,

Sorry for the late reply.

object norm.beta was supposed to be used in aggregate_adjustement2 rather than aggregate_adjustement1. one possibility is there is "pc" in your variable ${transformed_methylation_adjusted}

Can you go to your script path and then run

source config
echo ${transformed_methylation_adjusted} | grep pc

If this is the reason, can you change script [script path]/resources/methylation/aggregate_chunks.R line 30-32 to

if(grepl("methylation_adjusted_pcs", rootname)){
            betas <- norm.beta
}

please let me know whether it works.

ks164 commented 1 month ago

thanks so much for this; I think the reason is that my path to the data contains the string "pc" since our organization's cluster naming contains "hpc".

I have changed lines 30-32 in aggregate_chunks.R to be explicit as suggested, and the code is currently running.

ks164 commented 1 month ago

Unfortunately, the job failed with the same error as previously even after changing the code.

ZXiaopu commented 1 month ago

Can you show me your code in line 30-32 and also the results with below code

cd [Script path]
source config
${R_directory}Rscript ${scripts_directory}/resources/methylation/aggregate_chunks.R \
    ${transformed_methylation_adjusted} \
    ${meth_chunks} \
    ${methylation_array} \
    ${methylation_no_outliers} \
    ${subset}
ks164 commented 1 month ago

thanks for looking into this!

This is my amended code in the file './resources/methylation/aggregate_chunks.R ', with surrounding lines of code for reference fs <- fs[index] load(fs[1])

    if(grepl("methylation_adjusted_pcs", rootname)){
            betas <- norm.beta
    }

    if(is.na(rootname1)){
        message("Reading in data")

This is the result of running the code you provided:

source config ${R_directory}Rscript ${scripts_directory}/resources/methylation/aggregate_chunks.R \ ${transformed_methylation_adjusted} \ ${meth_chunks} \ ${methylation_array} \ ${methylation_no_outliers} \ ${subset} There were 18 warnings (use warnings() to see them) Checking all files are present Reading in data Error in main() : object 'norm.beta' not found Execution halted

In case it helps at all, my slurm submission script is identical to the example 'godmc_03b_aggregate.sh' except I don't specify a partition.

I haven't progressed beyond step 03b, so I haven't generated any pcs yet, and grepping for 'pcs' instead of 'pc' doesn't return any matches.

ZXiaopu commented 1 month ago

Can you show me the output of

source config
echo ${scripts_directory}/resources/methylation/aggregate_chunks.R
${transformed_methylation_adjusted}
${meth_chunks}
${methylation_array}
${methylation_no_outliers}
${subset}

I would like to check the full input of the script submission which might be helpful

ks164 commented 1 month ago

Thank you!

here's the output:

/hpc/group/sugdenlab/godmc_phase2/resources/methylation/aggregate_chunks.R -bash: /hpc/group/sugdenlab/godmc_phase2/processed_data/methylation_data/transformed_methylation_adjusted: No such file or directory -bash: 100: command not found -bash: epic: command not found -bash: /hpc/group/sugdenlab/godmc_phase2/processed_data/methylation_data/methylation_no_outliers.Robj: cannot execute binary file: Exec format error

The 'transformed_methylation_adjusted' .Rdata files do exist in /processed_data/ and I have checked them as instructed in the guidelines for running on a cluster.

ZXiaopu commented 1 month ago

Can you also change line 40 to 42 to

    if(grepl("methylation_adjusted_pcs", rootname)){
            betas <- norm.beta
    }

Hope it works

ks164 commented 1 month ago

Thanks so much, this worked!