Callen & Vanessa April 14, 2021
April 14, 2021
Callen Bragdon - cjoseph@bu.edu
Vanessa Mengze Li - vmli@bu.edu
- Back-end: MariaDB
- R functions to interact with DB: This package
SigRepoR
. See Installation below. - R6 objects:
OmicSignature
andOmicSignatureCollection
designed to store signatures. See Installation below. Click here for the vignette - User-control API
- Front-end: R-Shiny interface
See our development Shiny app server (BU VPN required)
devtools::install_github(repo = "montilab/OmicSignature")
devtools::install_github(repo = "montilab/SigRepoR", auth_token = "...")
Before proceeding with any interactions, it's important that you first configure your session to point to which database to upload to, along with where to write files to in your file system.
configureSigRepo(
signatureDirectory="/opt/shiny-server/challenge_project/miscellanea/signatures/",
databaseServer="sigrepo.bu.edu",
databasePort="4253",
applicationPort="",
signatureServer="sigrepo.bu.edu"
)
Now, for downstream queries, you'll be able to establish connections in the future without needing to specify which server to query repeatedly.
The final step in your setup will be to establish your connection handle, described below:
myHandle <- newConnHandle("cjoseph", usePassword="NO")
You will be prompted to (safely) enter your password in another dialogue window in order to establish a connection to your database.
However, if you don't need any particular permissions, and just want to "read only", you can create a handle with the "guest" account, which only has read privileges and are the default parameters for establishing this handle, shown below.
myHandle <- newConnHandle()
For certain R querying functions in this package, the guest account is used by default, and the handle disconnects when accomplishing the query by default.
Assuming you already have your OmicSignature object created, let's work with uploading.
If you don't have "write" access, after configuration, you can use requestUser()
, which will add your table to the "user_requests" table in the database for review by an administrator, who will use userApproval
to either grant or reject your request
# you can choose not to put
# parameters in, and use the console
# readline capability to fill them in as you go.
requestUser(
newUserName="requestedName",
newUserEmail="example@test.edu"
)
# you'll still be prompted for a password you would want to use
To upload your object completely to your back-end
addSignatureWrapper(
yourObjectOrFileOfObject,
thisHandle=yourConnectionHandle,
# uploadPath=sys.getenv("signatureDirectory"), # default to configuration settings
user="your SigRepo Username"
)
executing the above:
- writes your object and differential expression files to disk
- checks the phenotype of the signature object. if it doesn't exist already in the phenotypes table, that new phenotype will get added.
- inserts signature metadata into signatures table in the database(addSignature)
- inserts level2 data from that object into the features_signatures table in the database(addLevel2).
- inserts signature-keyword pairs into the keyword_signatures table in the database(addSignatureKeywords).
OmicSignatureCollection Objects are simply a group of Omic Signature objects. You can upload such objects like this:
addSignatureCollection(
OmicSignatureCollectionObj,
connHandle,
uploadPath=sys.getenv("signatureDirectory"),
thisUser="your SigRepo User Name"
)
This function:
- "unpacks" the OmicSignatureCollection by getting the "OmicSigList" property
- runs an lapply of the function "addSignatureWrapper" on this list
- inserts signature-to-collection pairs into the signature-to-collection table in the database(addCollectionSignatures)
If the collection you're uploading doesn't exist as an entry in the collections table of the database, the addCollectionSignatures function will add that collection as a new entry to the collections table before uploading the pairs.