metrumresearchgroup / Torsten

library of C++ functions that support applications of Stan in Pharmacometrics
BSD 3-Clause "New" or "Revised" License
53 stars 11 forks source link

Torsten Installation on a Mac #29

Closed Jwetherington closed 3 years ago

Jwetherington commented 3 years ago

I've attempted to run the 2-compartment PK model using the R interface to Torsten which has generated the following error message:

Compiling Stan program... \ Semantic error in '/var/folders/k_/t891xypn0vvd7x5lfdv6txmh0000gn/T/RtmpvhNll8/model-a7d43e46fd25.stan', line 87, column 26 to line 95, column 20:

85:      parms = {CL[j], V[j], ka[j]};
86:  
87:      x[start[j]:end[j],] = PKModelOneCpt(time[start[j]:end[j]], 
                               ^
88:                     amt[start[j]:end[j]],
89:                     rate[start[j]:end[j]],

A returning function was expected but an undeclared identifier 'PKModelOneCpt' was supplied.

make: *** [/var/folders/k_/t891xypn0vvd7x5lfdv6txmh0000gn/T/RtmpvhNll8/model-a7d43e46fd25.hpp] Error 1 Error: An error occured during compilation! See the message above for more information. Called from: self$compile(...)


I've had challenges installing the R interface to Torsten and, so far, I'm thinking I've not been successful. I would appreciate some guidance. Apologies for the open ended request, but I'm new to Torsten/Stan. Thanks in advance for your help in this matter.

Jwetherington commented 3 years ago

Apologies as I posted the wrong error message. The error included:

SYNTAX ERROR, MESSAGE(S) FROM PARSER: Info: Comments beginning with # are deprecated. Please use // in place of # for line comments. No matches for:

PKModelTwoCpt(real[ ], real[ ], real[ ], real[ ], int[ ], int[ ], int[ ], int[ ], real[ ], real[ ], real[ ])

Function PKModelTwoCpt not found. error in 'modela7d46bcb39cd_multiDoseME2PK1' at line 82, column 35

80:                     addl[start[j]:end[j]],
81:                     ss[start[j]:end[j]],
82:                     parms, F, tLag);
                                      ^
83: 

Error in stanc(file = file, model_code = model_code, model_name = model_name, : failed to parse Stan model 'multiDoseME2PK1' due to the above error. Called from: stanc(file = file, model_code = model_code, model_name = model_name, verbose = verbose, obfuscate_model_name = obfuscate_model_name, allow_undefined = allow_undefined, isystem = isystem)

yizhang-yiz commented 3 years ago

First we need make sure you're using the latest version and your macOS is setup correctly. Please download the repo by

git clone -b develop git@github.com:metrumresearchgroup/Torsten.git

and try to compile the 2-cpt model

cd Torsten/cmdstan/
make -j4 build
make ../example-models/pk2cpt/pk2cpt

If that works, you can later follow cmdstanr instruction(see also #27 ) to use R interface.

Jwetherington commented 3 years ago

Entered in the terminal window in the HOME directory: git clone -b develop git@github.com:metrumresearchgroup/Torsten.git

The following message was generated:

Cloning into 'Torsten'... Warning: Permanently added the RSA host key for IP address '140.82.113.3' to the list of known hosts. git@github.com: Permission denied (publickey). fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

Am I missing something?

yizhang-yiz commented 3 years ago

Does https work?

git clone -b develop https://github.com/metrumresearchgroup/Torsten.git

If not, simply choos "download ZIP".

Jwetherington commented 3 years ago

Successfully downloaded Torsten via https and compiled example-models/pk2cpt/pk2cpt. Then successfully installed CmdStanR using install.packages("cmdstanr", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))

Using the R interface to compile the PMX function PKModelOneCpt(time, amt, rate, ii, evid, cmt, addl, ss, theta, F, tlag) generated the following error:

SYNTAX ERROR, MESSAGE(S) FROM PARSER: No matches for:

PKModelOneCpt(real[ ], real[ ], real[ ], real[ ], int[ ], int[ ], int[ ], int[ ], real[ ], real[ ], real[ ])

Function PKModelOneCpt not found. error in 'modelb6705c06afaa_multiDosePK1Torsten' at line 95, column 35

93:                     addl[start[j]:end[j]],
94:                     ss[start[j]:end[j]],
95:                     parms, F, tLag);
                                      ^
96: 

Error in stanc(file = file, model_code = model_code, model_name = model_name, : failed to parse Stan model 'multiDosePK1Torsten' due to the above error. Called from: stanc(file = file, model_code = model_code, model_name = model_name, verbose = verbose, obfuscate_model_name = obfuscate_model_name, allow_undefined = allow_undefined, isystem = isystem)

Is the PKModelOneCpt function available through Torsten? I've not tried other functions. Thank you very much for your help.

yizhang-yiz commented 3 years ago

As you can see the documentation and pk2cpt example there's been a change in signature. The functionality can be access through pmx_solve_twocpt function.