Skip to content

Instantly share code, notes, and snippets.

@jelber2
Last active October 18, 2023 13:41
Show Gist options
  • Save jelber2/6896281178e8b988742f8373daaa6113 to your computer and use it in GitHub Desktop.
Save jelber2/6896281178e8b988742f8373daaa6113 to your computer and use it in GitHub Desktop.
MethPhaser

MethPhaser installation

Install micromamba or mamba or conda

# Install micromamba
"${SHELL}" <(curl -L micro.mamba.pm/install.sh)

You will then see something like this in a BASH shell (parts with "(type....)" are added for instructions

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  3069  100  3069    0     0  13059      0 --:--:-- --:--:-- --:--:-- 13059
Micromamba binary folder? [~/.local/bin]  (hit enter)
Init shell (bash)? [Y/n] y (type y)
Configure conda-forge? [Y/n] y (type y)
Prefix location? [~/micromamba] (type y)
Modifying RC file "/home/jelber43/.bashrc"
Generating config for root prefix "/home/jelber43/micromamba"
Setting mamba executable to: "/home/jelber43/.local/bin/micromamba"
Adding (or replacing) the following in your "/home/jelber43/.bashrc" file

# >>> mamba initialize >>>
# !! Contents within this block are managed by 'mamba init' !!
export MAMBA_EXE='/home/jelber43/.local/bin/micromamba';
export MAMBA_ROOT_PREFIX='/home/jelber43/micromamba';
__mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --root-prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__mamba_setup"
else
    alias micromamba="$MAMBA_EXE"  # Fallback on help from mamba activate
fi
unset __mamba_setup
# <<< mamba initialize <<<

Please restart your shell to activate micromamba or run the following:\n
  source ~/.bashrc (or ~/.zshrc, ~/.xonshrc, ~/.config/fish/config.fish, ...)

Source your .bashrc file to enable micromamba

source ~/.bashrc

Make a micromamba environment with Python3.11, pip, openssl, and ca-certificates

micromamba create -n methphaser -c bioconda -c conda-forge python=3.11 pip ca-certificates openssl -y

Activate the micromamba environment

micromamba activate methphaser

Use pip to install remaining python packages

pip3 install pysam tqdm pandas scipy matplotlib certifi seaborn

Get methphaser python scripts

git clone https://github.com/treangenlab/methphaser

Add the scripts to your PATH (your directory might be different of course)

export PATH="/home/jelber43/sandbox/methphaser/methphaser:$PATH"

Get example data to test installation

wget 'https://zenodo.org/api/records/8360845/files-archive' -O test_data.zip

Make an test_data directory, then unzip the zip file contents there.

mkdir -p test_data
unzip test_data.zip -d test_data/.

Run MethPhaser Step1 (takes < 5 min)

./methphaser/meth_phaser_parallel -b test_data/HLA.R10.haplotagged.bam -r test_data/GCA_000001405.15_GRCh38_no_alt_analysis_set.chr6.fna -g test_data/LSK.filtered.gtf -vc test_data/HLA.R10.phased.vcf.gz  -o test_data/work 

/home/jelber43/sandbox/methphaser/methphaser/methphasing:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  from pkg_resources import require
# ignore these two previous lines

Run MethPhaser Step2 (< 1 min)

./methphaser/meth_phaser_post_processing -ib test_data/HLA.R10.haplotagged.bam -if test_data/work/ -ov test_data/output.vcf -ob test_data/output -vc test_data/HLA.R10.phased.vcf.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment