Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run LINDA from command line? #20

Closed
fgfmds opened this issue Dec 6, 2018 · 4 comments
Closed

How to run LINDA from command line? #20

fgfmds opened this issue Dec 6, 2018 · 4 comments

Comments

@fgfmds
Copy link

fgfmds commented Dec 6, 2018

I noticed that there is an option in the script to run from the command line. If i try:

Rscript linda_predict.R /path/to/file/filename.nii

I get an error about an unexpected "/".

What am i doing wrong?

Thank you.

@dorianps
Copy link
Owner

dorianps commented Dec 6, 2018 via email

@fgfmds
Copy link
Author

fgfmds commented Jan 6, 2019

I have been experimenting with versions 0.2.6 and 0.2.7. I was able to run 0.2.6 from the command line successfully after making a few small modifications to the script.

Here are the changes I made:

  1. Comment out the following lines:
    #parse arguments for command line use
    #args=commandArgs(TRUE)
    #for(i in 1:length(args)){
    #eval(parse(text=args[i]))
    #}

  2. Add the following line:
    #!/usr/bin/env Rscript
    args = commandArgs(TRUE)

  3. Modify the argument length test section as follows:
    #test if there is at least two arguments: if not, return an error
    if (length(args) < 2) {
    stop("At least two arguments must be supplied: path to T1 file and path to template", call.=FALSE)
    } else if (length(args)>=2) {
    t1 = args[1]
    scriptdir = args[2]
    }

Once the changes above are in place, I was able to run the script with the following command:

Rscript /path/to/script/0.2.6/linda_predict.R /path/to/T1/file/filename.nii /path/to/template/dir/

I hope people find this helpful, and thank you again for all your help.

@fgfmds fgfmds closed this as completed Jan 6, 2019
@dorianps
Copy link
Owner

dorianps commented Jan 6, 2019

Thank you. Note that we also created a full package with v0.5.0 which would behave like any other R package. But if v0.2.6 is doing the job for you, that's fine, the output should be the same.

@fgfmds
Copy link
Author

fgfmds commented Jan 6, 2019

The truth is we started testing with LINDA when you were still at version 0.2.6. So we've invested some time and effort into getting things to work under that version. We will probably go to v0.5.0 at some point. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants