leafcutter icon indicating copy to clipboard operation
leafcutter copied to clipboard

Installation probelm r/4.3.1

Open seyoun209 opened this issue 1 year ago • 6 comments

I have tried in r/4.3.1

install.packages("remotes")
remotes::install_github("stan-dev/rstantools")
remotes::install_github("davidaknowles/leafcutter/leafcutter", ref = "psi_2019")

Now, I cannot install the : remotes::install_github("davidaknowles/leafcutter/leafcutter")

I was getting error below:

654 |  return internal::first_aligned<int(unpacket_traits<DefaultPacketType>::alignment),Derived>(m);
   |                                     ^~~~~~~~~
make: *** [/nas/longleaf/rhel8/apps/r/4.3.1/lib64/R/etc/Makeconf:198: stanExports_bb_glm.o] Error 1
ERROR: compilation failed for package ‘leafcutter’
* removing ‘/work/users/s/e/seyoun/R/oodlibs/leafcutter’
Warning message:
In i.p(...) :
 installation of package ‘/work/appscr/r/seyoun/RtmpTV5nEH/file3c06a96b2b8545/leafcutter_0.2.8.tar.gz’ had non-zero exit status

I have removed packages and re-installed all of them, but it still shows the same errors. Any ideas? please help @jackhump

seyoun209 avatar Mar 29 '24 21:03 seyoun209

Hi Jess. Please try again with an older version of R if you have it, R 4.0 or earlier. We're aware of this issue, it's a problem for a lot of users.

jackhump avatar Mar 29 '24 23:03 jackhump

If you're feeling brave we also have a beta version of a Python version that removes the dependence on stan. It should install through pip install leafcutter, we haven't managed to get a conda package to build yet.

davidaknowles avatar Mar 30 '24 01:03 davidaknowles

Thanks for getting back to me. I did not have any luck with the R/4.0 since all other dependencies are not available for the r/4.0. I am trying to install everything manually, but it gives so many errors on everything.

I actually wanted to use the function from the psi_2019 that has scripts/leafcutter_quantify_psi.R,, but the newer Python version seems not to have it. Is it possible to have it in the main branch for this function?

I have two batch confounders and when I tried to use the function you mentioned on it,

ratios = counts %>% 
  mutate(clu = str_split_fixed(rownames(counts), ":", 4)[,4]) %>%
  group_by(clu) %>% 
  mutate_all( funs( ./sum(.) ) ) %>% 
  ungroup() %>%
  as.data.frame() %>% 
  set_rownames(rownames(counts)) %>% 
  select(-clu)
ratios = ratios[rowMeans(is.na(ratios)) <= 0.4,,drop=F ]
row_means = rowMeans(ratios, na.rm = T)
row_means_outer = outer(row_means, rep(1,ncol(ratios)))
ratios[is.na(ratios)] = row_means_outer[is.na(ratios)]

I had to regress out the confounder inside this, but I was unsure how to do it manually. It would be nice to run manually without installing and calculating ratios with the confounders. (I have two different batches) then I am trying to see how much different PCA and heatmap etc

seyoun209 avatar Mar 30 '24 01:03 seyoun209

I have also tried to install it in both r/4.0 and r/3.6, and it shows the same errors. I did not have any problems installing rstan and rstantools, even other dependency packages, so I couldn't find out the reasons.

/work/users/s/e/seyoun/R/newlibs/StanHeaders/include/stan/math/rev/core/reverse_pass_callback.hpp: At global scope:
/work/users/s/e/seyoun/R/newlibs/StanHeaders/include/stan/math/rev/core/reverse_pass_callback.hpp:38:13: error: ‘void stan::math::reverse_pllback(F&&) [with F = stan::math::multiply(const T1&, const T2&) [with T1 = Eigen::Matrix<double, -1, -1>; T2 = Eigen::Matrix<stan::math::vue<double>, -1, 1>; stan::require_all_matrix_t<EigMat1, EigMat2>* <anonymous> = 0; stan::require_return_type_t<stan::is_var, T1, T2>* <anon = 0; stan::require_not_row_and_col_vector_t<T1, T2>* <anonymous> = 0]::<lambda()>]’, declared using local type ‘stan::math::multiply(constconst T2&) [with T1 = Eigen::Matrix<double, -1, -1>; T2 = Eigen::Matrix<stan::math::var_value<double>, -1, 1>; stan::require_all_matrix_t<E, EigMat2>* <anonymous> = 0; stan::require_return_type_t<stan::is_var, T1, T2>* <anonymous> = 0; stan::require_not_row_and_col_vector_t<T1,<anonymous> = 0]::<lambda()>’, is used but never defined [-fpermissive]
 inline void reverse_pass_callback(F&& functor) {
             ^~~~~~~~~~~~~~~~~~~~~
In file included from /work/users/s/e/seyoun/R/newlibs/StanHeaders/include/stan/math/rev/core.hpp:13,
                 from /work/users/s/e/seyoun/R/newlibs/StanHeaders/include/src/stan/model/model_base.hpp:5,
                 from /work/users/s/e/seyoun/R/newlibs/rstan/include/rstan/stan_fit.hpp:48,
                 from /work/users/s/e/seyoun/R/newlibs/rstan/include/rstan/rstaninc.hpp:4,
                 from stanExports_bb_glm.h:20,
                 from stanExports_bb_glm.cc:5:
/work/users/s/e/seyoun/R/newlibs/StanHeaders/include/stan/math/rev/core/callback_vari.hpp:61:28: error: ‘stan::math::var_value<typename stain_type<T>::type> stan::math::make_callback_var(T&&, F&&) [with T = double; F = stan::math::inv_logit(const stan::math::var_value<T>&) [witdouble; stan::require_stan_scalar_or_eigen_t<T>* <anonymous> = 0]::<lambda(auto:572&)>; typename stan::plain_type<T>::type = double]’, declsing local type ‘stan::math::inv_logit(const stan::math::var_value<T>&) [with T = double; stan::require_stan_scalar_or_eigen_t<T>* <anonymo0]::<lambda(auto:572&)>’, is used but never defined [-fpermissive]
 var_value<plain_type_t<T>> make_callback_var(T&& value, F&& functor) {
                            ^~~~~~~~~~~~~~~~~
make: *** [/nas/longleaf/rhel8/apps/r/3.6.0/lib64/R/etc/Makeconf:174: stanExports_bb_glm.o] Error 1
ERROR: compilation failed for package ‘leafcutter’
* removing ‘/work/users/s/e/seyoun/R/newlibs/leafcutter’
Warning message:
In i.p(...) :
  installation of package ‘/tmp/RtmpXIncc3/file228dcf37cf884d/leafcutter_0.2.8.tar.gz’ had non-zero exit status

seyoun209 avatar Mar 30 '24 18:03 seyoun209

I strongly recommend that you run the leafcutter in the container, which avoids unnecessary trouble in installing the leafcutter. I manually packaged a singularity container, maybe you can try it.

singularity push IMG.sif library://zpliu/bioinfomatic/leafcutter:v0.2.9

zpliu1126 avatar Apr 03 '24 01:04 zpliu1126

I finally got it installed! Ended up sticking with R 3.6 to avoid upgrading dependencies and created a separate folder for them, keeping them away from R 4.3. Thanks! It would be great to use R 4.1, especially since it's the latest version our school server supports. But for now, this setup is working. Yay! 👍

seyoun209 avatar Apr 03 '24 11:04 seyoun209