opencga.sh is the officially recommended command line tool for users. It implements most of the functionality with many different commands and subcommands. These commands are a one-to-one mapping of Resources from REST web services and subcommands are mapping to end-points. All the operations that can be performed using the command line internally creates one or several REST calls, so access to REST machine/cluster is required.
Correlation Between REST and CLI
In the following URL, "samples" is the resource and "search" is the endpoint:
the corresponding command in the command line is :
and the corresponding subcommand is :
Executing ./opencga.sh will return the list of all available commands with a description for each of them as shown below:
The list of sample subcommands can be retrieved by simply executing the "samples" command without any argument as show below:
CLI Session Management
Generally, unless we are pointing to a public OpenCGA installation, users will first need to log in using the "users login" command line. Once the user has successfully logged in, a session file will be generated in their home folder:
This session file contains the following information:
This makes easier for users to login only once and execute any number of commands till the session token is expired. Please note down, session expiration is set by OpenCGA server independently from client. Once token is expired, user have to login again and can perform desired operations as normal.
- Line 2: OpenCGA host against which the user has been authenticated.
- Line 3: API version of the OpenCGA host
- Line 4: Authenticated user.
- Line 5: Token generated when the user last logged in.
- Line 6: Token generated when the user last logged in to refresh token without the need to provide user credentials again.
- Line 7: Date when the user last logged in.
- Line 8: Date when the token will expire.
- Line 9: Studies that are accessible by the user
Authenticating is only necessary the first time. Users will have time to execute any other command line without the need to provide any more credentials until the stored token expires. Please note down that the token expiration time is set by the main OpenCGA installation. Once this token has expired, users will need to log back in again to keep working with the command line.
Table of Contents:
- No labels