# Introduction

This package contains all the functionality to easily create a new metadata scheme. The resulting scheme package will contain all files needed so that it can be easily be distributed and used, and can be either be distributed directly or uploaded to an online repository, e.g. the default dmdScheme repository.

# Create new scheme

To create your own scheme package entails a few simple steps.

1. Open an existing scheme definition you want to use as a starting point. The easies is to use the command
open_new_spreadsheet(keepData = TRUE)

which will open the current scheme including example data in your spreadsheet program of choice.

If the .xlsx file is locked, you can unlock it by using the password test.

You can also manually extract the .xlsx file from any scheme package and use it.

It is important, that the final scheme contains example data as the resulting scheme package has to contain example data.

1. Edit the new scheme definition

This .xlsx file can be edited following the limitations as specified in the Minimum requirements for metadatascheme based on dmdScheme. After modifications have been done and the spreadsheet has been saved, the scheme package can be created by using

scheme_make( "TheFile.xlsx" )

which will create a file named NAME_VERSION.tar.gz in the directory path based on the scheme definition in TheFile.xlsx. NAME and VERSION are the scheme name and scheme version as specified in the cell (H:1) in sheet Experiment.

The following two commands will install the new scheme and use it:

scheme_install(file = "NAME_VERSION.tar.gz")
scheme_use("NAME", "VERSION")

To upload the scheme to the main repository on github, please either clone the repo and send a pull request or file an issue with the scheme package as an attachment.

# Create R package to Extending the functionality of the dmdScheme package

The package dmdScheme package is only providing the base functionality for working with dmdSchemes. In many cases, the functionality needs to be extended to be able to work with other schemes. This can be done by creating a new package which is

1. depends on the package dmdScheme, and
2. automatically downloads, installs and activates a specific scheme definition and not the default dmdScheme.

Similar to the function package.skeleton() in the utils package, dmdScheme provides a function which creates a package skeleton with the required functionality.

To for example create a package in the folder path = tempdir() which depends on the R package dmdScheme and loads and activates upon loading the scheme emeScheme of version 0.9.5 which is in the default repository:

if (!scheme_installed("emeScheme", "0.9.5")) {
scheme_install("emeScheme", "0.9.5")
}
## Scheme definition /var/folders/50/wcr5bjwn75q595n6x82gxj280000gq/T//Rtmp2pTKaj/file41386467ed49/emeScheme_0.9.5.tar.gz, installed with
## name:    emeScheme
## version: 0.9.5
scheme_use("emeScheme", "0.9.5")
## Theme switched to emeScheme_0.9.5
make_new_package( path = tempdir() )
## Creating directories ...
## Creating DESCRIPTION ...
## Creating NAMESPACE ...
## Creating Read-and-delete-me ...
## Copying code files ...
## Making help files ...
## Done.
## Further steps are described in '/var/folders/50/wcr5bjwn75q595n6x82gxj280000gq/T//Rtmp2pTKaj/emeScheme/Read-and-delete-me'.
scheme_use("dmdScheme", "0.9.5")
## Theme switched to dmdScheme_0.9.5
scheme_uninstall("emeScheme", "0.9.5")
## Scheme emeScheme_0.9.5 deleted and moved to
## [1] "/var/folders/50/wcr5bjwn75q595n6x82gxj280000gq/T//Rtmp2pTKaj/file4138630b871e"

NOTE: If the scheme package is not in the default repository, the file inst/aaa.R` in the new package needs to be adapted to automatically anstall and use the scheme!

For an example of an R package of this kind see the R folder in the emeScheme package on github.