knitr::opts_chunk$set(echo = TRUE)
library(dsBase) library(dsBaseClient) library(resourcer) library(DSLite) library(dsOmics) library(dsOmicsClient) ceneca <- newResource( name = "ceneca", url = "file://C:/Users/Gerard/OneDrive/ISGlobal/PhD/obiba-home/opal/seed/data/chr22.vcf.gz", format = 'VCF2GDS' ) ceneca_covars <- newResource( name = "ceneca_covars", url = "https://raw.githubusercontent.com/isglobal-brge/brgedata/master/data/ega_synthetic_data_phenotypes.tsv", format = "tsv" ) dslite.server <- newDSLiteServer(resources=list(ceneca = ceneca, ceneca_covars = ceneca_covars), config = DSLite::defaultDSConfiguration(include=c("dsBase", "resourcer", "dsOmics"))) builder <- DSI::newDSLoginBuilder() builder$append(server = "server1", url = "dslite.server", resource = "ceneca", driver = "DSLiteDriver") logindata.dslite.cnsim <- builder$build() conns <- datashield.login(logindata.dslite.cnsim, assign=T, symbol = "resource") datashield.assign.resource(conns, "resource_covars", "ceneca_covars") datashield.assign.expr(conns = conns, symbol = "ceneca_vcf", expr = quote(as.resource.object(resource))) datashield.assign.expr(conns = conns, symbol = "ceneca_feno", expr = quote(as.resource.data.frame(resource_covars)))
library(DSI) library(DSOpal) library(dsBaseClient) library(dsOmicsClient) builder <- newDSLoginBuilder() builder$append(server = "study1", url = "http://localhost:9980/", user = "dsuser", password = "password", resource = "RSRC.ceneca_vcf") logindata <- builder$build() conns <- datashield.login(logins = logindata, assign = TRUE, symbol = "resource") datashield.assign.resource(conns, "resource_covars", "RSRC.ceneca_covars") datashield.assign.expr(conns = conns, symbol = "ceneca_vcf", expr = quote(as.resource.object(resource))) datashield.assign.expr(conns = conns, symbol = "ceneca_feno", expr = quote(as.resource.data.frame(resource_covars)))
We need to specify:
ds.colnames("ceneca_feno")
We can see IDcol = 51 and sexcol = 62
Let's search for the sex encoding
ds.table("ceneca_feno$sex")$output.list$TABLES.COMBINED_all.sources_counts
Now we have the information to assemble the GenotypeData structure on the server
ds.GenotypeData(x='ceneca_vcf', covars = 'ceneca_feno', columnId = 51, sexId = 62, male_encoding = "male", female_encoding = "female", newobj.name = 'gds.Data')
ds.PCASNPS("ceneca_vcf")
al_freq <- ds.alleleFrequency("gds.Data")
ds.varLabels('gds.Data')
ds.glmSNP('rs587703534', 'Energy ~ sex', 'gds.Data', family = 'gaussian')
ds.glmSNP('rs12008773', "asthma ~ sex", 'gds.Data', family = 'binomial', strata = 'smoke')
ds.glmSNP(gr2, "asthma ~ sex", 'gds.Data', family = 'binomial')
ds.glmSNP(gr2, "asthma ~ sex", 'gds.Data', family = 'binomial', strata = 'smoke')
ds.GWAS('gds.Data', model = asthma ~ age+country, family = 'binomial')
datashield.logout(conns)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.