diff --git a/Snakefile b/Snakefile
index 140233dc188c746082f20983efd51e422672c826..6bed2b213c8837bf57229d1a8d0886913efbfcbe 100644
--- a/Snakefile
+++ b/Snakefile
@@ -383,12 +383,15 @@ rule run_sv_classification:
 
 rule plot_heatmap:
     input:
+        maryam = "utils/R-packages2/MaRyam/R/MaRyam",
         haplotypeProbs = "sv_probabilities/{sample}/{windows}.{bpdens}/allSegCellProbs.table",
         genotypeProbs  = "sv_probabilities/{sample}/{windows}.{bpdens}/allSegCellGTprobs.table",
         info     = "counts/{sample}/{windows}.info",
         bamNames = "sv_probabilities/{sample}/{windows}.{bpdens}/bamNames.txt"
     output:
         "sv_probabilities/{sample}/{windows}.{bpdens}/final_plots/heatmapPlots.pdf"
+    params:
+        r_package_path = "utils/R-packages2"
     log:
         "log/{sample}/final.plots.{windows}.{bpdens}.txt"
     script:
diff --git a/utils/plot_heatmap.R b/utils/plot_heatmap.R
index 39265f39d61ac9fb01f0adddd3873fcc4af9c8ee..32f4804575aab9e1513e0010e07ce10658d8d126 100644
--- a/utils/plot_heatmap.R
+++ b/utils/plot_heatmap.R
@@ -1,11 +1,10 @@
 #' Rscript for the snakemake pipeline for computing jump probabilities and including heatmaps
 #' author Maryam Ghareghani
 
-# install and load MaRyam package
-library(devtools) 
-install_git("git://github.com/friendsofstrandseq/MaRyam.git", branch = "master")
-library("MaRyam")
+sink(snakemake@log[[1]])
 
+.libPaths( c( snakemake@params[["r_package_path"]],.libPaths()) )
+suppressPackageStartupMessages(library(MaRyam))
 
 hapProbsFile = snakemake@input[["haplotypeProbs"]]
 GTprobsFile = snakemake@input[["genotypeProbs"]]