Title: | Armadillo Client for the Armadillo Service |
---|---|
Description: | A set of functions to manage data shared on a 'MOLGENIS Armadillo' server. |
Authors: | Mariska Slofstra [aut, cre] , Sido Haakma [aut] , Tommy de Boer [aut] , Fleur Kelpin [aut] , Morris Swertz [aut] , Tim Cadman [aut] |
Maintainer: | Mariska Slofstra <[email protected]> |
License: | LGPL (>= 2.1) |
Version: | 2.7.0 |
Built: | 2024-11-13 06:00:46 UTC |
Source: | https://github.com/molgenis/molgenis-r-armadillo |
This function ensures that a given URL string ends with a slash ('/'). If the URL does not end with a slash, it appends one.
.add_slash_if_missing(url)
.add_slash_if_missing(url)
url |
A character string representing the URL. |
A character string with a trailing slash if it was missing.
Helper function for compressing to an RDS file
.compress_resource(resource, file)
.compress_resource(resource, file)
resource |
the resource to write to file |
file |
the name of the file (without extension) |
the extension of the file
Helper function for compressing to a parquet file
.compress_table(table, file)
.compress_table(table, file)
table |
the table to write to file |
file |
the name of the file (without extension) |
the extension of the file
Formats API posts based on subset definition
.format_api_posts(posts, subset_def)
.format_api_posts(posts, subset_def)
posts |
A list of API posts |
subset_def |
A tibble containing subset definition |
A tibble consisting of original subset_def with columns 'posts' and 'status' appended.
Helper function to get the contents of a linkfile
.get_linkfile_content(project, object_name)
.get_linkfile_content(project, object_name)
project |
projectname where the linkfile is stored |
object_name |
folder/name of linkfile |
the contents of the linkfile
Helper function to extract the source parquet file in a linkfile
.load_linked_table(file, columns)
.load_linked_table(file, columns)
file |
source table parquet file |
columns |
character list of columns to select from source file |
the contents of the file, as data frame
Helper function to extract an RDS file
.load_resource(file)
.load_resource(file)
file |
file to extract |
the contents of the file
Helper function to extract a parquet file
.load_table(file)
.load_table(file)
file |
file to extract |
the contents of the file, as data frame
Copy resource
armadillo.copy_resource( project, folder, name, new_folder = folder, new_name = name )
armadillo.copy_resource( project, folder, name, new_folder = folder, new_name = name )
project |
study or other variable collection |
folder |
the folder containing the resource |
name |
specific resource for copy action |
new_folder |
name of the folder in which to place the copy, defaults to folder |
new_name |
name of the copy, defaults to name |
the response from the server
## Not run: armadillo.copy_resource( project = "gecko", folder = "core_all", name = "table1", new_folder = "core_all_v2", ) ## End(Not run)
## Not run: armadillo.copy_resource( project = "gecko", folder = "core_all", name = "table1", new_folder = "core_all_v2", ) ## End(Not run)
Copy table
armadillo.copy_table( project, folder, name, new_folder = folder, new_name = name )
armadillo.copy_table( project, folder, name, new_folder = folder, new_name = name )
project |
study or other variable collection |
folder |
the folder containing the table |
name |
specific table for copy action |
new_folder |
name of the folder in which to place the copy, defaults to folder |
new_name |
name of the copy, defaults to name |
the response from the server
## Not run: armadillo.copy_table( project = "gecko", folder = "core_all", name = "table1", new_folder = "core_all_v2", ) ## End(Not run)
## Not run: armadillo.copy_table( project = "gecko", folder = "core_all", name = "table1", new_folder = "core_all_v2", ) ## End(Not run)
Create a project for a variable collection
armadillo.create_project( project_name = NULL, users = NULL, overwrite_existing = "choose" )
armadillo.create_project( project_name = NULL, users = NULL, overwrite_existing = "choose" )
project_name |
The name of the project to create. The project name
|
users |
A list collection of the users that should have access to the project |
overwrite_existing |
Character, specifying action to take if project still exists: 'choose' (default) displays a menu giving the option to overwrite or not, 'yes' overwrites the existing project and 'no' exists the function with a message. |
## Not run: armadillo.create_project("gecko") ## End(Not run)
## Not run: armadillo.create_project("gecko") ## End(Not run)
A project represents usually a study or collection of variables
armadillo.delete_project(project_name)
armadillo.delete_project(project_name)
project_name |
the name of the study or collection of variables name |
## Not run: armadillo.delete_project(project_name = "gecko") ## End(Not run)
## Not run: armadillo.delete_project(project_name = "gecko") ## End(Not run)
Delete project folder
armadillo.delete_project_folder(project, folder)
armadillo.delete_project_folder(project, folder)
project |
project to delete the object from |
folder |
folder to delete the object from |
Delete resource
armadillo.delete_resource(project, folder, name)
armadillo.delete_resource(project, folder, name)
project |
project to delete the resource from |
folder |
folder to delete the resource from |
name |
resource name |
## Not run: armadillo.delete_resource( project = "gecko", folder = "core_all", name = "table1" ) ## End(Not run)
## Not run: armadillo.delete_resource( project = "gecko", folder = "core_all", name = "table1" ) ## End(Not run)
Delete table
armadillo.delete_table(project, folder, name)
armadillo.delete_table(project, folder, name)
project |
project to delete the table from |
folder |
folder to delete the table from |
name |
table name |
## Not run: armadillo.delete_table( project = "gecko", folder = "core_all", name = "table1" ) ## End(Not run)
## Not run: armadillo.delete_table( project = "gecko", folder = "core_all", name = "table1" ) ## End(Not run)
Gets the users of an given project name
armadillo.get_project_users(project_name)
armadillo.get_project_users(project_name)
project_name |
the name of the project to extract the users from |
List of all users within "project_name"
## Not run: armadillo.get_project_users("some-project") ## End(Not run)
## Not run: armadillo.get_project_users("some-project") ## End(Not run)
Gets the Projects information
armadillo.get_projects_info()
armadillo.get_projects_info()
the projects and their information
## Not run: armadillo.get_projects_info() ## End(Not run)
## Not run: armadillo.get_projects_info() ## End(Not run)
Installs a user defined package into the provided profile. The package is automatically whitelisted after installation. Only available during development.
armadillo.install_packages(paths, profile = "default")
armadillo.install_packages(paths, profile = "default")
paths |
the path(s) to the package(s), can be a vector or a string |
profile |
the selected profile |
List the projects
armadillo.list_projects()
armadillo.list_projects()
the projects
## Not run: armadillo.list_projects() ## End(Not run)
## Not run: armadillo.list_projects() ## End(Not run)
List the resources in a project
armadillo.list_resources(project)
armadillo.list_resources(project)
project |
the shared project in which the resources are located |
the resources in the project
## Not run: armadillo.list_resources("gecko") ## End(Not run)
## Not run: armadillo.list_resources("gecko") ## End(Not run)
List the tables in a project
armadillo.list_tables(project)
armadillo.list_tables(project)
project |
the shared project in which the tables are located |
the table names, without the extension
## Not run: armadillo.list_tables("gecko") ## End(Not run)
## Not run: armadillo.list_tables("gecko") ## End(Not run)
Load a resource from a project
armadillo.load_resource(project, folder, name)
armadillo.load_resource(project, folder, name)
project |
study or collection variables |
folder |
the folder containing the resource |
name |
name of the resource |
the loaded resource
## Not run: armadillo.load_resource( project = "gecko", folder = "core_all", name = "lc_core_1" ) ## End(Not run)
## Not run: armadillo.load_resource( project = "gecko", folder = "core_all", name = "lc_core_1" ) ## End(Not run)
Load a table from a project
armadillo.load_table(project, folder, name)
armadillo.load_table(project, folder, name)
project |
study or collection variables |
folder |
the folder containing the table |
name |
name of the table |
the contents of the table file, as data frame
## Not run: armadillo.load_table( project = "gecko", folder = "core_all", name = "lc_core_1" ) ## End(Not run)
## Not run: armadillo.load_table( project = "gecko", folder = "core_all", name = "lc_core_1" ) ## End(Not run)
Interactively obtains an id token and uses it to create a session token for an Armadillo Service
armadillo.login(armadillo)
armadillo.login(armadillo)
armadillo |
URL of the Armadillo server, |
the id token
## Not run: armadillo.login( "https://armadillo.dev.molgenis.org" ) armadillo.login("http://localhost:8080") ## End(Not run)
## Not run: armadillo.login( "https://armadillo.dev.molgenis.org" ) armadillo.login("http://localhost:8080") ## End(Not run)
Login with username / password (meant for dev and test environments)
armadillo.login_basic(armadillo, username, password)
armadillo.login_basic(armadillo, username, password)
armadillo |
URL of the Armadillo server |
username |
the username |
password |
the password |
## Not run: armadillo.login( "https://armadillo.dev.molgenis.org", "admin", "admin" ) armadillo.login("http://localhost:8080", "admin", "admin") ## End(Not run)
## Not run: armadillo.login( "https://armadillo.dev.molgenis.org", "admin", "admin" ) armadillo.login("http://localhost:8080", "admin", "admin") ## End(Not run)
Move the resource
armadillo.move_resource( project, folder, name, new_folder = folder, new_name = name )
armadillo.move_resource( project, folder, name, new_folder = folder, new_name = name )
project |
a study or collection of variables |
folder |
the folder containing the resource to move |
name |
a resource to move |
new_folder |
the folder to move the resource to, defaults to folder |
new_name |
use to rename the file, defaults to name |
NULL, invisibly
## Not run: armadillo.move_resource( project = "gecko", folder = "core_all", name = "table1", new_folder = "core_all_v2", ) ## End(Not run)
## Not run: armadillo.move_resource( project = "gecko", folder = "core_all", name = "table1", new_folder = "core_all_v2", ) ## End(Not run)
Move the table
armadillo.move_table( project, folder, name, new_folder = folder, new_name = name )
armadillo.move_table( project, folder, name, new_folder = folder, new_name = name )
project |
a study or collection of variables |
folder |
the folder containing the table to move |
name |
a table to move |
new_folder |
the folder to move the table to, defaults to folder |
new_name |
use to rename the file, defaults to name |
NULL, invisibly
## Not run: armadillo.move_table( project = "gecko", folder = "core_all", name = "table1", new_folder = "core_all_v2", ) ## End(Not run)
## Not run: armadillo.move_table( project = "gecko", folder = "core_all", name = "table1", new_folder = "core_all_v2", ) ## End(Not run)
This automates the process of:
Checking what data is available to create subsets
Make the subset
armadillo.subset( input_source = NULL, subset_def = NULL, source_project = NULL, source_folder = NULL, source_table = NULL, target_project = NULL, target_folder = NULL, target_table = NULL, target_vars = NULL, new_project = NULL, dry_run = NULL )
armadillo.subset( input_source = NULL, subset_def = NULL, source_project = NULL, source_folder = NULL, source_table = NULL, target_project = NULL, target_folder = NULL, target_table = NULL, target_vars = NULL, new_project = NULL, dry_run = NULL )
input_source |
Character specifying how information about the target view is provided: choose 'subset_def' if providing a subset definition object, or 'arguments' if providing information directly. |
subset_def |
R object containing subset definition created by
|
source_project |
project from which to subset data |
source_folder |
folder from which to subset data. Compulsory if input_source = 'arguments'. |
source_table |
table from which to subset data. Compulsory if input_source = 'arguments'. |
target_project |
project to upload subset to. Will be created if it doesn't exist. |
target_folder |
folder to upload subset to. Will be created if it doesn't exist. Compulsory if input_source = 'arguments'. |
target_table |
table to upload subset to. Compulsory if input_source = 'arguments'. |
target_vars |
variables from 'source_table' to include in the view. Compulsory if input_source = 'arguments'. |
new_project |
Deprecated: use |
dry_run |
Defunct: previously enabgled dry-run to check which variables are missing |
missing variables provided in the subset definition
## Not run: armadillo.subset( source_project = "gecko", target_project = "study1", subset_def = local_subset ) ## End(Not run)
## Not run: armadillo.subset( source_project = "gecko", target_project = "study1", subset_def = local_subset ) ## End(Not run)
Builds an R object containing info required to make subsets
armadillo.subset_definition(reference_csv = NULL, vars = NULL)
armadillo.subset_definition(reference_csv = NULL, vars = NULL)
reference_csv |
|
vars |
Deprecated: use |
A dataframe containing variables that is used for input in the
armadillo.subset()
method
## Not run: armadillo.subset_definition( reference_csv = "C:/tmp/vars.csv" ) ## End(Not run)
## Not run: armadillo.subset_definition( reference_csv = "C:/tmp/vars.csv" ) ## End(Not run)
Uploads a resource to a folder in a project
armadillo.upload_resource(project, folder, resource, name = NULL)
armadillo.upload_resource(project, folder, resource, name = NULL)
project |
the project to upload to |
folder |
the folder to upload to |
resource |
the resource to upload |
name |
name of the resource (optional) |
## Not run: armadillo.upload_table( project = "gecko", folder = "core_all", table1 ) ## End(Not run)
## Not run: armadillo.upload_table( project = "gecko", folder = "core_all", table1 ) ## End(Not run)
Uploads a table to a folder in a project
armadillo.upload_table(project, folder, table, name = NULL)
armadillo.upload_table(project, folder, table, name = NULL)
project |
the project to upload to |
folder |
the folder to upload to |
table |
the table to upload |
name |
name of the table (optional) |
## Not run: armadillo.upload_table( project = "gecko", folder = "core_all", table1 ) ## End(Not run)
## Not run: armadillo.upload_table( project = "gecko", folder = "core_all", table1 ) ## End(Not run)