diff --git a/R/shiny-ui-base.R b/R/shiny-ui-base.R index 78ca6f25004cb2d51d73832ed52f23cef051caae..007489ed254cf3e34437e7b2f95c059280fa0329 100644 --- a/R/shiny-ui-base.R +++ b/R/shiny-ui-base.R @@ -1612,11 +1612,6 @@ mk_shinyscreen_server <- function(projects,init) { "available" else "unavailable" }) - output$metfrag_panel = renderUI({ - ctrls = make_metfrag_panel(envopts=init$envopts) - do.call(tagList,ctrls) - }) - output$entry_mf_summ_fname = renderText({ kv = req(rf_get_cindex_kval()) metfrag_gen_entry_fname(kv) diff --git a/inst/testdata/example_db.csv b/inst/testdata/example_db.csv new file mode 100644 index 0000000000000000000000000000000000000000..89126cfdeef57a1bbf02929a2c598b7da251b2eb --- /dev/null +++ b/inst/testdata/example_db.csv @@ -0,0 +1,5 @@ +"Identifier","FirstBlock","PubMed_Count","Patent_Count","Related_CIDs","Synonym","MolecularFormula","SMILES","InChI","InChIKey","MonoisotopicMass","CompoundName","AnnoTypeCount","AgroChemInfo","BioPathway","DrugMedicInfo","FoodRelated","PharmacoInfo","SafetyInfo","ToxicityInfo","KnownUse","DisorderDisease","Identification" +"3","INCSWYKICIYAHB","11","280","9964159 23615184 45266758","(2S,3S)-2,3-dihydroxy-2,3-dihydrobenzoic acid","C7H8O4","C1=CC(C(C(=C1)C(=O)O)O)O","InChI=1S/C7H8O4/c8-5-3-1-2-4(6(5)9)7(10)11/h1-3,5-6,8-9H,(H,10,11)","INCSWYKICIYAHB-UHFFFAOYSA-N","156.042259","5,6-dihydroxycyclohexa-1,3-diene-1-carboxylic acid","2","0","2","0","0","2","0","0","0","0","0" +"4","HXKKHQJGJAFBHI","71","103352","4 111033 439938 446260 4631415 7311736 44150279","1-Aminopropan-2-ol","C3H9NO","CC(CN)O","InChI=1S/C3H9NO/c1-3(5)2-4/h3,5H,2,4H2,1H3","HXKKHQJGJAFBHI-UHFFFAOYSA-N","75.068414","1-aminopropan-2-ol","7","0","3","0","8","2","10","3","5","0","3" +"5","HIQNVODXENYOFK","3","13","5 25244426","3-Amino-2-oxopropyl phosphate","C3H8NO5P","C(C(=O)COP(=O)(O)O)N","InChI=1S/C3H8NO5P/c4-1-3(5)2-9-10(6,7)8/h1-2,4H2,(H2,6,7,8)","HIQNVODXENYOFK-UHFFFAOYSA-N","169.014009","(3-amino-2-oxopropyl) dihydrogen phosphate","2","0","2","0","0","2","0","0","0","0","0" +"6","VYZAHLCBVHPDDF","3142","20129","6","1-chloro-2,4-dinitrobenzene","C6H3ClN2O4","C1=CC(=C(C=C1[N+](=O)[O-])[N+](=O)[O-])Cl","InChI=1S/C6H3ClN2O4/c7-5-2-1-4(8(10)11)3-6(5)9(12)13/h1-3H","VYZAHLCBVHPDDF-UHFFFAOYSA-N","201.978134","1-chloro-2,4-dinitrobenzene","9","0","5","3","2","7","11","3","7","1","2" diff --git a/tests/testthat/test-api.R b/tests/testthat/test-api.R index 860e1b8b0a564bb72777c1af1931b2fc426a6bb9..7f9b16e2ee2092059c0dfc0a67dd275594ae3815 100644 --- a/tests/testthat/test-api.R +++ b/tests/testthat/test-api.R @@ -9,29 +9,13 @@ test_that("Preparation for app start",{withr::with_tempdir({ dir.create(ddbdir) mrt = "mrt.fake.jar" saveRDS("",file=mrt) - expect_error(prepare_app(dir_before=dbef, - projects=dproj, - top_data_dir=ddata, - metfrag_db_dir=ddbdir, - metfrag_runtime="absent.jar"), - class="mf-jar-absent") - expect_error(prepare_app(dir_before=dbef, projects="absent", - top_data_dir=ddata, - metfrag_db_dir=ddbdir, - metfrag_runtime=mrt), + top_data_dir=ddata), class="projects-absent") expect_error(prepare_app(dir_before=dbef, projects=dproj, - top_data_dir="absent", - metfrag_db_dir=ddbdir, - metfrag_runtime=mrt), + top_data_dir="absent"), class="top-data-dir-absent") - expect_error(prepare_app(dir_before=dbef, - projects=dproj, - top_data_dir=ddata, - metfrag_db_dir="absent", - metfrag_runtime=mrt), - class="mf-db-dir-absent") + })}) diff --git a/tests/testthat/test-shiny-state.R b/tests/testthat/test-shiny-state.R index 0b57b7cc72e08a98bdfa648c7ba892466aa3ea27..8b137891791fe96927ad78e64b0aad7bded08bdc 100644 --- a/tests/testthat/test-shiny-state.R +++ b/tests/testthat/test-shiny-state.R @@ -1,37 +1 @@ -test_that("Test make_metfrag_panel (local and remote)",{ - withr::with_tempdir({ - mfdb = "demodb.csv" - mfdbdir = "demodir" - dir.create(mfdbdir) - mfjar = "demomf.jar" - saveRDS("",file.path(mfdbdir,mfdb)) - saveRDS("",mfjar) - eo = envopts(metfrag_db_dir = mfdbdir, - metfrag_jar = mfjar) - - xx = make_metfrag_panel(eo) - res = sapply(METFRAG_DATABASE_TYPE,function (p) {grepl(p,xx[[6L]])}) - expect_true(all(res)) - }) -}) - -test_that("Test make_metfrag_panel (remote)",{ - withr::with_tempdir({ - mfjar = "demomf.jar" - saveRDS("",mfjar) - eo = envopts(metfrag_jar = mfjar) - xx = make_metfrag_panel(eo) - res = sapply(METFRAG_REMOTE_DATABASE_TYPE,function (p) {grepl(p,xx[[6L]])}) - expect_true(all(res)) - - res2 = sapply(METFRAG_LOCAL_DATABASE_TYPE,function (p) {grepl(p,xx[[6L]])}) - expect_false(any(res2)) - }) -}) - -test_that("Test make_metfrage_panel (disabled)",{ - eo = envopts() - xx = make_metfrag_panel(eo) - expect_true(length(xx)==1L) -}) diff --git a/tests/testthat/test-state.R b/tests/testthat/test-state.R index 51696a2db285a6f1510464bfe26823ab60f8cc8d..dc26280903d27d7e5775055f0f6181b155fce36a 100644 --- a/tests/testthat/test-state.R +++ b/tests/testthat/test-state.R @@ -33,9 +33,11 @@ test_that("Test full project creation.",{ dir.create(db_dir) mf_jar = "bingo.jar" saveRDS(" ",mf_jar) - mf_db = file.path(db_dir,"bingo.csv") - saveRDS(" ",mf_db) - conf$metfrag$db_file = basename(mf_db) + db = data.frame(a=1,b=2) + mf_or_db = system.file("testdata","example_db.csv",package="shinyscreen") + file.copy(from = mf_or_db, + to = db_dir) + conf$metfrag$db_file = basename(mf_or_db) yaml::write_yaml(conf,file.path(ppath,FN_CONF)) eo = envopts(metfrag_db_dir=db_dir, metfrag_jar=mf_jar)