Skip to content

a-dev-walker/Methylation

 
 

Repository files navigation


Table of Contents

📖 Methylation Pipline Overview

drawing

💻 Essential Downloads

Download and install the following packages:

brew install cmake
brew uninstall glfw
git clone https://github.com/glfw/glfw.git && \
cd glfw && \
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 . && \
make && \
sudo make install

NOTE - R v4.1 includes compile and Tckl dependencies. brew can install libomp and cairo if needed. - After downloading R & RStudio unlocked the [System Preferences Privacy & Security Panel](https://github.com/NYU-Molecular-Pathology/Methylation/blob/main/Notes/SystemPermissions.md) before installing packages.

🌐 Network Drive Mount Paths

  • To install & run the pipeline, it is critical to mount the following network smb shared drives:
  • Open Finder and press ⌘(CMD) + K then paste each of the directories below, using NYUMC\KerberosID as the login name and password is your kerberos password.
cifs://research-cifs.nyumc.org/Research/CBioinformatics/
cifs://research-cifs.nyumc.org/Research/snudem01lab/snudem01labspace
cifs://shares-cifs.nyumc.org/apps/acc_pathology/molecular

⚡️ Quickstart

  1. Download the shell script to your home folder or another directory:
  • You can download runMeth.sh in this repo under Methylation/Meth_Scripts/ or use curl/wget:
curl -# -L https://raw.githubusercontent.com/NYU-Molecular-Pathology/Methylation/main/Meth_Scripts/runMeth.sh >$HOME/runMeth.sh
  1. Open the shell script, paste your REDCap API token in the methAPI field, and save it.

    You can use nano $HOME/runMeth.sh
#!/bin/bash
methAPI="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"  #Paste your API Token here
  1. Add permissions to the script to be executable:
chmod +rwx $HOME/runMeth.sh

To install the pipeline from your terminal, simply execute the following command:

$HOME/runMeth.sh 21-MGDM_TEST
  • If install of any packages fail, be sure to check the troubleshooting section at the bottom of this page

Input Paths

Files are copied to the work directory by their RUNID name and YEAR, including the worksheet and idats for example:

  • Worksheets /Volumes/molecular/MOLECULAR LAB ONLY/NYU-METHYLATION/WORKSHEETS/2022/22-MGDM17.xlsm
  • .idat files /Volumes/molecular/Molecular/iScan/

Default Working Directory

  • Input files are copied and report files are generated on the Cbioinformatics drive:
    /Volumes/CBioinformatics/Methylation/Clinical_Runs/22-MGDM17

Output Paths

  • Html report files saved to the working directory are copied to the Z-drive
    For example, run 22-MGDM17 report files would be output in the following directories:
    /Volumes/molecular/Molecular/MethylationClassifier/2022/22-MGDM17
    /Volumes/molecular/MOLECULAR LAB ONLY/NYU-METHYLATION/Results/2022/22-MGDM17

⚙️ Executing Methylation CLI

To run the Clinical or Research Methylation pipeline, simply use the locally stored Shell Script in:
/Volumes/CBioinformatics/Methylation/runMeth.sh

  • This shell script uses Curl to download the files from this repo and takes four positional argument inputs to execute methylExpress.R in the terminal.
  • The bash script stores your REDCap API token locally and only requires the methylation run ID to be entered.
  • You can copy runMeth.sh and create an alias or symlink to execute more easily. For example:
    alias runmeth='bash $HOME/runMeth.sh' or echo "alias runmeth='bash $HOME/runMeth.sh'" >> ~/.bashrc

🤖 runmeth.sh parameters

The shell script takes the following positional arguments:

methAPI='XXXXXXXX' # (hardcoded) Your REDCap API Token
methRun=${1-NULL}  # (required argument) methylation run id e.g. 22-MGDM17 @Default is NULL
PRIORITY=${2-NULL} # (optional) string list of prioritized RD-numbers to run
runPath=${3-NULL}  # (optional) any directory to copy/run the idat files if not Clinical_Runs
redcapUp=${4-NULL} # (optional) character "T" or "F": Flag to upload REDCap data or not

First, runmeth.sh downloads methylExpress.R and other files using curl:

curl -o methylExpress.R -L https://raw.githubusercontent.com/NYU-Molecular-Pathology/Methylation/main/R/methylExpress.R

Next, runmeth.sh passes the values input as args to methylExpress.R:
Rscript --verbose methylExpress.R $methAPI $methRun $PRIORITY $runPath


🧮 Passing Arguments to R

The four positional arguments from runmeth.sh are passed to the Rscript methylExpress.R:
arg[1] is the token for the API call ('#######################')
arg[2] is the RunID which if NULL runs the latest Clinical Worksheet 22-MGDM17
arg[3] is the selectRds parameter which is to prioritize samples being run (NULL)
arg[4] is the baseFolder parameter which is optional if you want to run/save output to a different directory (NULL)

Alternatively, instead of passing the RunID to runmeth.sh, you can source and download this repository and then locally edit args in methylExpress.R to run manually.

🧪 Run the Test Case

After installation, you can use the following run command to test the pipeline.

/Volumes/CBioinformatics/Methylation/runMeth.sh 21-MGDM_TEST

⚠️ Troubleshooting

Pipeline Installation Issues If you have issues with package installation or dependencies:
Make sure compilers are installed by opening Xcode.app or executing `sudo xcode-select --install`
Then, execute the all_installer.R script by copy and pasting the raw contents of the script below into Rstudio before running runmeth.sh again
https://raw.githubusercontent.com/NYU-Molecular-Pathology/Methylation/main/Research/all_installer.R
To resolve any problems during automation, you can open methylExpress.R in RStudio which is downladed by runmeth.sh to your home directory.
Try to run `sudo xcode-select -s /Library/Developer/CommandLineTools` and `brew install gdal proj` then install the package **rgdal** in Rstudio.
Download the libraries below from their sources:
(a) sqlite-autoconf-3330000.tar.gz from "https://www.sqlite.org/download.html".
(b) tiff-4.1.0.tar.gz from "https://download.osgeo.org/libtiff/"
(c) proj-7.2.0.tar.gz from "https://proj.org/download.html#current-release"
(d) libgeotiff-1.6.0.tar.gz from "https://download.osgeo.org/geotiff/libgeotiff/"
(e) geos-3.8.1.tar.bz2 from "https://trac.osgeo.org/geos"
(f) gdal-3.2.0.tar.gz from "https://gdal.org/download.html"
REDCap errors Once your run completes check in your run directory if there is any *upload_log.tsv* file or *redcaperrors.txt*. If these files exist, they may note any files or data which would have been over-written in the database. Check with the wet lab if any RD-numbers were duplicated or previously used for the samples listed in the upload_log.tsv file.
**NOTE** When running the test case run *21-MGDM_TEST* you may notice an error with the upload log as these reports would already exist in REDCap. It is normal for the test case to fail uploading since the REDCap database already contains the data and files for the test run.
How to upload manually to REDCap 1. Login with your kerberos ID to https://redcap.nyumc.org/ 2. On the left-hand sidebar scroll all the way down the Reports Bookmarks until you see the folder: >>>>CURRENT Runs~~~~~ and 3) >>>>>CLINICAL Current Run 3. Here, you can click on the RD-number of choice and then select "Upload html file" under the methylation menue 4. Optionally, you can also select "Add / Edit Records" menu in the left sidebar and find your RD-number in the "Search query" field
Fix wet lab worksheet 1. In your current working directory or in the path /Volumes/CBioinformatics/Methylation/Clinical_Runs/22-MGDM##, open the RUNID.xlsm file 2. On the Review ribbon, click unprotect worksheet and unprotect tab 3. Right-click the "worksheet" tab at the bottom and unhide... raw_labels tab 4. If any "#ref" errors either drag the formula down to correct or type "=" and select the cell in the first tab "worksheet" and press return. For example "=worksheet!B25" references cell B25 in the tab named "worksheet"

About

DNA methylation for tumor subclassifications by methylation array.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 85.8%
  • Shell 9.4%
  • Python 2.8%
  • HTML 1.6%
  • CSS 0.4%