galaaz 0.4.10 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -0
- data/LICENSE +0 -0
- data/README.md +3123 -882
- data/Rakefile +62 -41
- data/bin/galaaz-bootstrap +137 -0
- data/bin/galaaz-jruby +14 -0
- data/bin/galaaz_jruby_env.inc.sh +6 -0
- data/bin/gbookdown +64 -0
- data/bin/gknit +223 -6
- data/bin/gknit-draft +105 -0
- data/bin/gknit-draft.rb +28 -0
- data/bin/gknit_Rscript +127 -0
- data/bin/grun +27 -1
- data/bin/gstudio +49 -4
- data/bin/{gstudio.rb → gstudio_irb.rb} +0 -0
- data/bin/gstudio_pry.rb +7 -0
- data/bin/install-tinytex +6 -0
- data/bin/run_all_rspec +43 -0
- data/bin/run_example +14 -0
- data/bin/run_old_rspec +19 -0
- data/bin/run_rspec +23 -0
- data/bin/run_rspec_subset +38 -0
- data/bin/run_slow_rspec +19 -0
- data/blogs/R-on-Rails-Planning-Document.md +940 -0
- data/blogs/README.md +100 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot.Rmd +38 -66
- data/blogs/galaaz_ggplot/galaaz_ggplot.log +754 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot.md +364 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot.tex +607 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/midwest_rb.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/scatter_plot_rb.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/midwest_rb.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/scatter_plot_rb.png +0 -0
- data/blogs/galaaz_ggplot/midwest.Rmd +3 -3
- data/blogs/galaaz_ggplot/midwest_external_png +0 -0
- data/blogs/gknit/gknit.Rmd +52 -55
- data/blogs/gknit/gknit.md +94 -94
- data/blogs/gknit/gknit_files/figure-html/bubble-1.png +0 -0
- data/blogs/gknit/gknit_files/figure-html/diverging_bar.png +0 -0
- data/blogs/gknit/lst.rds +0 -0
- data/blogs/gknit/model.rb +1 -1
- data/blogs/gknit/stats.bib +0 -0
- data/blogs/manual/include_model_local_repro.Rmd +14 -0
- data/blogs/manual/include_model_local_repro.md +75 -0
- data/blogs/manual/lst.rds +0 -0
- data/blogs/manual/manual.Rmd +1582 -196
- data/blogs/manual/manual.log +1786 -0
- data/blogs/manual/manual.md +3107 -890
- data/blogs/manual/manual.tex +3018 -1086
- data/blogs/manual/manual_files/figure-html/bubble-1.png +0 -0
- data/blogs/manual/manual_files/figure-html/diverging_bar.png +0 -0
- data/blogs/manual/manual_files/figure-latex/bubble-1.png +0 -0
- data/blogs/manual/model.rb +41 -0
- data/blogs/nse_dplyr/nse_dplyr.Rmd +277 -151
- data/blogs/nse_dplyr/nse_dplyr.log +928 -0
- data/blogs/nse_dplyr/nse_dplyr.md +457 -293
- data/blogs/oh_my/not_so.rb +0 -0
- data/blogs/oh_my/oh_my.Rmd +1234 -25
- data/blogs/oh_my/oh_my.log +804 -0
- data/blogs/oh_my/oh_my.md +1808 -228
- data/blogs/oh_my/oh_my.tex +821 -0
- data/blogs/oh_my/old.Rmd +15 -14
- data/blogs/ruby_plot/ruby_plot.Rmd +58 -82
- data/blogs/ruby_plot/ruby_plot.log +885 -0
- data/blogs/ruby_plot/ruby_plot.md +71 -103
- data/blogs/ruby_plot/ruby_plot.tex +940 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/dose_len.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_delivery.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_dose.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color2.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_decorations.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_points.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/final_box_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/dose_len.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_delivery.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_dose.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color2.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_decorations.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_points.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_box_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
- data/blogs/test/test.Rmd +14 -0
- data/examples/50Plots_MasterList/Images/midwest-scatterplot.PNG +0 -0
- data/examples/50Plots_MasterList/ScatterPlot.rb +0 -0
- data/examples/50Plots_MasterList/scatter_plot.rb +0 -0
- data/examples/Bibliography/master.bib +50 -0
- data/examples/Bibliography/stats.bib +72 -0
- data/examples/R/calc.R +0 -0
- data/examples/R/java_interop.R +0 -0
- data/examples/bioconductor_deseq2_airway/Documentation/DESeq2-airway-walkthrough.md +56 -0
- data/examples/bioconductor_deseq2_airway/bench_galaaz_three_same_process.rb +53 -0
- data/examples/bioconductor_deseq2_airway/bench_r_three_same_process.R +34 -0
- data/examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb +33 -0
- data/examples/bioconductor_deseq2_airway/deseq2_airway_galaaz_optimized.rb +34 -0
- data/examples/bioconductor_deseq2_airway/deseq2_airway_minimal.R +30 -0
- data/examples/bioconductor_deseq2_airway/deseq2_airway_pipeline_for_bench.R +36 -0
- data/examples/islr/all.rb +13 -0
- data/examples/islr/ch2.spec.rb +37 -7
- data/examples/islr/ch3.spec.rb +11 -2
- data/examples/islr/ch3_boston.rb +27 -0
- data/examples/islr/ch3_multiple_regression.rb +0 -0
- data/examples/islr/ch6.spec.rb +24 -1
- data/examples/islr/x_y_rnorm.jpg +0 -0
- data/examples/latex_templates/Test-acm_article/Makefile +16 -0
- data/examples/latex_templates/Test-acm_article/Test-acm_article.Rmd +65 -0
- data/examples/latex_templates/Test-acm_article/acm_proc_article-sp.cls +1670 -0
- data/examples/latex_templates/Test-acm_article/sensys-abstract.cls +703 -0
- data/examples/latex_templates/Test-acm_article/sigproc.bib +59 -0
- data/examples/latex_templates/Test-acs_article/Test-acs_article.Rmd +260 -0
- data/examples/latex_templates/Test-acs_article/acs-Test-acs_article.bib +11 -0
- data/examples/latex_templates/Test-acs_article/acs-my_output.bib +11 -0
- data/examples/latex_templates/Test-acs_article/acstest.bib +17 -0
- data/examples/latex_templates/Test-aea_article/AEA.cls +1414 -0
- data/{blogs/gknit/marshal.dump → examples/latex_templates/Test-aea_article/BibFile.bib} +0 -0
- data/examples/latex_templates/Test-aea_article/Test-aea_article.Rmd +108 -0
- data/examples/latex_templates/Test-aea_article/aea.bst +1269 -0
- data/examples/latex_templates/Test-aea_article/multicol.sty +853 -0
- data/examples/latex_templates/Test-aea_article/references.bib +0 -0
- data/examples/latex_templates/Test-aea_article/setspace.sty +546 -0
- data/examples/latex_templates/Test-amq_article/Test-amq_article.Rmd +256 -0
- data/examples/latex_templates/Test-amq_article/Test-amq_article.pdfsync +3397 -0
- data/examples/latex_templates/Test-ams_article/Test-ams_article.Rmd +215 -0
- data/examples/latex_templates/Test-ams_article/amstest.bib +436 -0
- data/examples/latex_templates/Test-asa_article/Test-asa_article.Rmd +153 -0
- data/examples/latex_templates/Test-asa_article/agsm.bst +1353 -0
- data/examples/latex_templates/Test-asa_article/bibliography.bib +233 -0
- data/examples/latex_templates/Test-ieee_article/IEEEtran.bst +2409 -0
- data/examples/latex_templates/Test-ieee_article/IEEEtran.cls +6346 -0
- data/examples/latex_templates/Test-ieee_article/Test-ieee_article.Rmd +175 -0
- data/examples/latex_templates/Test-ieee_article/mybibfile.bib +20 -0
- data/examples/latex_templates/Test-rjournal_article/RJournal.sty +335 -0
- data/examples/latex_templates/Test-rjournal_article/RJreferences.bib +18 -0
- data/examples/latex_templates/Test-rjournal_article/Test-rjournal_article.Rmd +52 -0
- data/examples/latex_templates/Test-springer_article/Test-springer_article.Rmd +65 -0
- data/examples/latex_templates/Test-springer_article/bibliography.bib +26 -0
- data/examples/latex_templates/Test-springer_article/spbasic.bst +1658 -0
- data/examples/latex_templates/Test-springer_article/spmpsci.bst +1512 -0
- data/examples/latex_templates/Test-springer_article/spphys.bst +1443 -0
- data/examples/latex_templates/Test-springer_article/svglov3.clo +113 -0
- data/examples/latex_templates/Test-springer_article/svjour3.cls +1431 -0
- data/examples/misc/baseball.csv +0 -0
- data/examples/misc/ggplot.rb +3 -2
- data/examples/misc/moneyball.rb +0 -0
- data/examples/misc/subsetting.rb +0 -0
- data/examples/multithread_shards_to_r/shards_to_r.rb +67 -0
- data/examples/rmarkdown/svm-rmarkdown-anon-ms-example/svm-rmarkdown-anon-ms-example.Rmd +73 -0
- data/examples/rmarkdown/svm-rmarkdown-article-example/svm-rmarkdown-article-example.Rmd +382 -0
- data/examples/rmarkdown/svm-rmarkdown-beamer-example/svm-rmarkdown-beamer-example.Rmd +164 -0
- data/examples/rmarkdown/svm-rmarkdown-cv/svm-rmarkdown-cv.Rmd +92 -0
- data/examples/rmarkdown/svm-rmarkdown-syllabus-example/attend-grade-relationships.csv +482 -0
- data/examples/rmarkdown/svm-rmarkdown-syllabus-example/svm-rmarkdown-syllabus-example.Rmd +280 -0
- data/examples/rmarkdown/svm-xaringan-example/svm-xaringan-example.Rmd +386 -0
- data/examples/sthda_ggplot/README.md +0 -0
- data/examples/sthda_ggplot/RUN.md +41 -0
- data/examples/sthda_ggplot/all.rb +0 -0
- data/examples/sthda_ggplot/one_variable_continuous/density_gg.rb +0 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_area.rb +0 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_density.rb +2 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_dotplot.rb +0 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_freqpoly.rb +0 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_histogram.rb +0 -0
- data/examples/sthda_ggplot/one_variable_continuous/histogram_density.rb +0 -0
- data/examples/sthda_ggplot/one_variable_continuous/stat.rb +0 -0
- data/examples/sthda_ggplot/one_variable_discrete/bar.rb +0 -0
- data/examples/sthda_ggplot/qplots/box_violin_dot.rb +0 -0
- data/examples/sthda_ggplot/qplots/scatter_plots.rb +0 -0
- data/examples/sthda_ggplot/scatter_gg.rb +0 -0
- data/examples/sthda_ggplot/two_variables_cont_bivariate/geom_bin2d.rb +0 -0
- data/examples/sthda_ggplot/two_variables_cont_bivariate/geom_density2d.rb +0 -0
- data/examples/sthda_ggplot/two_variables_cont_bivariate/geom_hex.rb +0 -0
- data/examples/sthda_ggplot/two_variables_cont_cont/geom_point.rb +0 -0
- data/examples/sthda_ggplot/two_variables_cont_cont/geom_smooth.rb +0 -0
- data/examples/sthda_ggplot/two_variables_cont_cont/misc.rb +0 -0
- data/examples/sthda_ggplot/two_variables_cont_function/geom_area.rb +4 -3
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_bar.rb +0 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_boxplot.rb +0 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_dotplot.rb +0 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_jitter.rb +0 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_line.rb +0 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_violin.rb +0 -0
- data/examples/sthda_ggplot/two_variables_disc_disc/geom_jitter.rb +0 -0
- data/examples/sthda_ggplot/two_variables_error/geom_crossbar.rb +0 -0
- data/ext/new_bridge/Makefile +46 -0
- data/ext/new_bridge/galaaz_gatekeeper_phase0.cpp +12 -0
- data/ext/new_bridge/galaaz_gatekeeper_phase1.cpp +1639 -0
- data/lib/R_interface/galaaz_device.R +20 -0
- data/lib/R_interface/include_engine.R +109 -0
- data/lib/R_interface/new_bridge_adapter.rb +824 -0
- data/lib/R_interface/r.rb +177 -25
- data/lib/R_interface/r_arrow.rb +113 -0
- data/lib/R_interface/r_libs.R +4 -4
- data/lib/R_interface/r_methods.rb +13 -116
- data/lib/R_interface/r_module_s.rb +0 -0
- data/lib/R_interface/rbinary_operators.rb +20 -2
- data/lib/R_interface/rclosure.rb +5 -1
- data/lib/R_interface/rdata_frame.rb +34 -70
- data/lib/R_interface/rdevice.rb +125 -0
- data/lib/R_interface/rdevices.R +0 -0
- data/lib/R_interface/renvironment.rb +10 -4
- data/lib/R_interface/rexpression.rb +5 -1
- data/lib/R_interface/rindexed_object.rb +41 -13
- data/lib/R_interface/rlanguage.rb +20 -62
- data/lib/R_interface/rlist.rb +115 -25
- data/lib/R_interface/rlogical_operators.rb +0 -0
- data/lib/R_interface/rmatrix.rb +2 -11
- data/lib/R_interface/rmd_indexed_object.rb +5 -1
- data/lib/R_interface/robject.rb +348 -290
- data/lib/R_interface/rpkg.rb +1 -0
- data/lib/R_interface/rsupport.rb +610 -331
- data/lib/R_interface/rsupport_scope.rb +2 -1
- data/lib/R_interface/rsymbol.rb +50 -0
- data/lib/R_interface/ruby_callback.rb +2 -3
- data/lib/R_interface/ruby_extensions.rb +225 -175
- data/lib/R_interface/runary_operators.rb +0 -0
- data/lib/R_interface/rvector.rb +147 -31
- data/lib/galaaz.rb +0 -0
- data/lib/galaaz_jruby.rb +22 -0
- data/lib/gknit/diagnostics.rb +50 -0
- data/lib/gknit/draft.rb +111 -0
- data/lib/gknit/include_engine.rb +15 -7
- data/lib/gknit/knitr_engine.rb +223 -107
- data/lib/gknit/rb_engine.rb +3 -3
- data/lib/gknit/ruby_engine.rb +0 -0
- data/lib/gknit.rb +3 -0
- data/lib/new_bridge/bootstrap/windows_bootstrap.rb +285 -0
- data/lib/new_bridge/envelope.rb +51 -0
- data/lib/new_bridge/eval_result.rb +26 -0
- data/lib/new_bridge/framing.rb +39 -0
- data/lib/new_bridge/instance_pool_client.rb +38 -0
- data/lib/new_bridge/r_instance_manager.rb +404 -0
- data/lib/new_bridge/session_client.rb +530 -0
- data/lib/new_bridge/tcp_framed.rb +44 -0
- data/lib/new_bridge.rb +9 -0
- data/lib/util/exec_ruby.rb +95 -46
- data/lib/util/inline_file.rb +35 -30
- data/new_bridge_specs/benchmark_phase5_5_unboxing_spec.rb +96 -0
- data/new_bridge_specs/eval_r_async_spec.rb +113 -0
- data/new_bridge_specs/integration_phase5_1_concurrent_spec.rb +50 -0
- data/new_bridge_specs/integration_phase5_1_eval_spec.rb +16 -0
- data/new_bridge_specs/integration_phase5_1_r_api_spec.rb +25 -0
- data/new_bridge_specs/integration_phase5_1_smoke_spec.rb +31 -0
- data/new_bridge_specs/integration_phase5_2_dataframe_unboxing_spec.rb +19 -0
- data/new_bridge_specs/integration_phase5_2_handle_eval_unboxing_spec.rb +25 -0
- data/new_bridge_specs/integration_phase5_3_callback_args_spec.rb +28 -0
- data/new_bridge_specs/integration_phase5_3_callback_error_spec.rb +22 -0
- data/new_bridge_specs/integration_phase5_3_callback_timeout_spec.rb +28 -0
- data/new_bridge_specs/integration_phase5_3_callbacks_smoke_spec.rb +22 -0
- data/new_bridge_specs/integration_phase5_3_edge_cases_spec.rb +52 -0
- data/new_bridge_specs/integration_phase5_3_nested_spec.rb +30 -0
- data/new_bridge_specs/integration_phase5_4_concurrent_sessions_spec.rb +53 -0
- data/new_bridge_specs/integration_phase5_4_nested_session_callbacks_spec.rb +49 -0
- data/new_bridge_specs/integration_phase5_4_session_routing_spec.rb +38 -0
- data/new_bridge_specs/integration_phase5_5_stress_concurrency_spec.rb +52 -0
- data/new_bridge_specs/integration_phase5_5_unbox_walk_spec.rb +46 -0
- data/new_bridge_specs/phase0_protocol_spec.rb +96 -0
- data/new_bridge_specs/phase1_req_ret_spec.rb +66 -0
- data/new_bridge_specs/phase2_multi_instance_spec.rb +67 -0
- data/new_bridge_specs/phase3_callbacks_spec.rb +71 -0
- data/new_bridge_specs/phase4_2_hardening_spec.rb +252 -0
- data/new_bridge_specs/phase4_3_r_instance_manager_spec.rb +85 -0
- data/new_bridge_specs/phase4_nested_callbacks_spec.rb +123 -0
- data/r_requires/ggplot.rb +0 -0
- data/r_requires/knitr.rb +0 -0
- data/specs/all.rb +15 -11
- data/specs/arrow_from_ruby_batches_spec.rb +50 -0
- data/specs/arrow_semantics_spec.rb +64 -0
- data/specs/bridge_concurrent_spec.rb +46 -0
- data/specs/bridge_nested_spec.rb +25 -0
- data/specs/dataframe_semantics_spec.rb +122 -0
- data/specs/dataframe_single_index_logical_filter_spec.rb +21 -0
- data/specs/dispatch_probe_cache_spec.rb +38 -0
- data/specs/dispatch_probe_error_class_fallback_spec.rb +20 -0
- data/specs/dispatch_probe_fallback_spec.rb +18 -0
- data/specs/environment_semantics_spec.rb +89 -0
- data/specs/field_access_spec.rb +31 -0
- data/specs/figures/bg.jpeg +0 -0
- data/specs/figures/bg.png +0 -0
- data/specs/figures/bg.svg +168 -57
- data/specs/figures/dose_len.png +0 -0
- data/specs/figures/no_args.jpeg +0 -0
- data/specs/figures/no_args.png +0 -0
- data/specs/figures/no_args.svg +168 -57
- data/specs/figures/width_height.jpeg +0 -0
- data/specs/figures/width_height.png +0 -0
- data/specs/figures/width_height_units1.jpeg +0 -0
- data/specs/figures/width_height_units1.png +0 -0
- data/specs/figures/width_height_units2.jpeg +0 -0
- data/specs/figures/width_height_units2.png +0 -0
- data/specs/formula_semantics_spec.rb +81 -0
- data/specs/galaaz_util_exec_ruby_spec.rb +85 -0
- data/specs/galaaz_util_inline_file_spec.rb +54 -0
- data/specs/gknit_cli_option_permutation_spec.rb +24 -0
- data/specs/gknit_include_engine_spec.rb +72 -0
- data/specs/gknit_install_timeout_report_spec.rb +69 -0
- data/specs/gknit_internal_error_report_spec.rb +57 -0
- data/specs/gknit_vector_map_output_spec.rb +59 -0
- data/specs/globalenv_guardrail_spec.rb +52 -0
- data/specs/language_expression_semantics_spec.rb +145 -0
- data/specs/list_semantics_spec.rb +111 -0
- data/specs/new_bridge_bulk_dataframe_transfer_spec.rb +44 -0
- data/specs/new_bridge_bulk_vector_transfer_spec.rb +73 -0
- data/specs/new_bridge_callback_timeout_spec.rb +69 -0
- data/specs/new_bridge_eval_r_fallback_spec.rb +55 -0
- data/specs/nil_null_spec.rb +42 -0
- data/specs/object_build_phase2_spec.rb +53 -0
- data/specs/phase1_callback_bridge_spec.rb +84 -0
- data/specs/phase2_gknit_generic_rendering_guardrail_spec.rb +46 -0
- data/specs/phase2_gknit_no_raw_code_leakage_spec.rb +43 -0
- data/specs/phase3_gknit_generic_graphics_capture_spec.rb +71 -0
- data/specs/plot_device_semantics_spec.rb +28 -0
- data/specs/plot_snapshot_semantics_spec.rb +58 -0
- data/specs/protocol_result_spec.rb +236 -0
- data/specs/r_batch_fail_fast_spec.rb +47 -0
- data/specs/r_bridge_bootstrap_spec.rb +11 -0
- data/specs/r_devices.spec.rb +1 -1
- data/specs/r_eval.spec.rb +16 -18
- data/specs/r_function.spec.rb +1 -1
- data/specs/r_instance_manager_spec.rb +285 -0
- data/specs/r_list_apply.spec.rb +15 -15
- data/specs/r_matrix.spec.rb +0 -0
- data/specs/r_nse.spec.rb +5 -5
- data/specs/r_object_send_dispatch_spec.rb +13 -0
- data/specs/r_vector_comparator_spec.rb +8 -0
- data/specs/r_vector_creation.spec.rb +0 -0
- data/specs/r_vector_functions.spec.rb +0 -0
- data/specs/r_vector_object.spec.rb +0 -0
- data/specs/r_vector_operators.spec.rb +0 -0
- data/specs/r_vector_structured_scalar_reads_spec.rb +35 -0
- data/specs/r_vector_subsetting.spec.rb +0 -0
- data/specs/range_helper_spec.rb +21 -0
- data/specs/rsupport_scope_spec.rb +28 -0
- data/specs/rsupport_var_name_thread_safety_spec.rb +24 -0
- data/specs/scalar_character_spec.rb +44 -0
- data/specs/scoped_symbol_dsl_refinement_spec.rb +40 -0
- data/specs/session_env_bridge_spec.rb +25 -0
- data/specs/simplecov_bootstrap_spec.rb +10 -0
- data/specs/spec_helper.rb +10 -0
- data/specs/tmp.rb +41 -20
- data/specs/unboxing_recursion_regression_spec.rb +30 -0
- data/specs/unboxing_spec.rb +49 -0
- data/specs/verify_callbacks.rb +42 -0
- data/sty/galaaz.sty +0 -0
- data/version.rb +1 -1
- metadata +239 -71
- data/blogs/galaaz_ggplot/galaaz_ggplot.aux +0 -41
- data/blogs/galaaz_ggplot/galaaz_ggplot.html +0 -705
- data/blogs/galaaz_ggplot/galaaz_ggplot.out +0 -10
- data/blogs/galaaz_ggplot/galaaz_ggplot.pdf +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-latex/midwest_rb.pdf +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-latex/scatter_plot_rb.pdf +0 -0
- data/blogs/galaaz_ggplot/midwest.html +0 -188
- data/blogs/gknit/gknit.html +0 -2266
- data/blogs/gknit/gknit.pdf +0 -0
- data/blogs/gknit/gknit.tex +0 -1358
- data/blogs/manual/graph.rb +0 -29
- data/blogs/manual/manual.html +0 -2995
- data/blogs/manual/manual.pdf +0 -0
- data/blogs/manual/manual_files/figure-latex/diverging_bar.pdf +0 -0
- data/blogs/nse_dplyr/nse_dplyr.html +0 -960
- data/blogs/nse_dplyr/nse_dplyr.pdf +0 -0
- data/blogs/nse_dplyr/nse_dplyr.tex +0 -1373
- data/blogs/oh_my/oh_my.html +0 -680
- data/blogs/ruby_plot/ruby_plot.Rmd_external_figs +0 -662
- data/blogs/ruby_plot/ruby_plot.html +0 -729
- data/blogs/ruby_plot/ruby_plot.pdf +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/dose_len.svg +0 -57
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_delivery.svg +0 -106
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_dose.svg +0 -110
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color.svg +0 -174
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color2.svg +0 -236
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.svg +0 -296
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_points.svg +0 -236
- data/blogs/ruby_plot/ruby_plot_files/figure-html/final_box_plot.svg +0 -218
- data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.svg +0 -128
- data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.svg +0 -150
- data/examples/paper/paper.rb +0 -36
- data/specs/r_dataframe.spec.rb +0 -379
- data/specs/r_environment.spec.rb +0 -140
- data/specs/r_formula.spec.rb +0 -232
- data/specs/r_language.spec.rb +0 -112
- data/specs/r_list.spec.rb +0 -293
- data/specs/r_plots.spec.rb +0 -72
- data/specs/ruby_expression.spec.rb +0 -315
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/blogs/test/test.Rmd
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Minimal gknit callback test"
|
|
3
|
+
output: html_document
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
```{r setup, echo=FALSE}
|
|
7
|
+
# Empty setup so structure matches oh_my; first engine run is the ruby chunk below.
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```{ruby fig.ext='png'}
|
|
11
|
+
# Minimal ruby chunk: triggers process_options and options['fig.ext'].unboxed_get(0).
|
|
12
|
+
# Same R code path as oh_my.Rmd first ruby chunk (sends .GlobalEnv$g2_vN <- g2_vM[[1]] for fig.ext).
|
|
13
|
+
puts "ok"
|
|
14
|
+
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
% This file was created with JabRef 2.10.
|
|
2
|
+
% Encoding: UTF-8
|
|
3
|
+
|
|
4
|
+
@Book{vasquez2009twp,
|
|
5
|
+
Title = {The War Puzzle Revisited},
|
|
6
|
+
Author = {Vasquez, John A},
|
|
7
|
+
Publisher = {New York, NY: Cambridge University Press},
|
|
8
|
+
Year = {2009}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@Book{wagner2007ws,
|
|
12
|
+
Title = {War and the State: The Theory of International Politics},
|
|
13
|
+
Author = {R. Harrison Wagner},
|
|
14
|
+
Publisher = {Ann Arbor, MI: The University of Michigan Press},
|
|
15
|
+
Year = {2007},
|
|
16
|
+
Owner = {steve},
|
|
17
|
+
Timestamp = {2016.02.12}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@Book{xie2013ddrk,
|
|
21
|
+
title = {Dynamic Documents with {R} and knitr},
|
|
22
|
+
author = {Yihui Xie},
|
|
23
|
+
publisher = {Chapman and Hall/CRC},
|
|
24
|
+
address = {Boca Raton, Florida},
|
|
25
|
+
year = {2015},
|
|
26
|
+
edition = {2nd},
|
|
27
|
+
note = {ISBN 978-1498716963},
|
|
28
|
+
url = {https://yihui.name/knitr/},
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@article{miller2013tdpi,
|
|
32
|
+
author = {Miller, Steven V.},
|
|
33
|
+
year = 2013,
|
|
34
|
+
title = {Territorial Disputes and the Politics of Individual Well-Being.},
|
|
35
|
+
journal = {Journal of Peace Research.},
|
|
36
|
+
volume = 50,
|
|
37
|
+
number = 6,
|
|
38
|
+
pages = {677-690}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@article{miller2016ieea,
|
|
42
|
+
author = {Gibler, Douglas M. and Steven V. Miller and Erin K. Little},
|
|
43
|
+
year = 2016,
|
|
44
|
+
title = {An Analysis of the Militarized Interstate Dispute (MID) Dataset, 1816-2001},
|
|
45
|
+
journal = {International Studies Quarterly.},
|
|
46
|
+
volume = 60,
|
|
47
|
+
number = 4,
|
|
48
|
+
pages = {719-730}
|
|
49
|
+
}
|
|
50
|
+
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
@book{Wilkinson:grammar_of_graphics,
|
|
2
|
+
author = {Wilkinson, Leland},
|
|
3
|
+
title = {The Grammar of Graphics (Statistics and Computing)},
|
|
4
|
+
year = {2005},
|
|
5
|
+
isbn = {0387245448},
|
|
6
|
+
publisher = {Springer-Verlag},
|
|
7
|
+
address = {Berlin, Heidelberg},
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@article{Knuth:literate_programming,
|
|
11
|
+
author = {Knuth, Donald E.},
|
|
12
|
+
title = {Literate Programming},
|
|
13
|
+
journal = {Comput. J.},
|
|
14
|
+
issue_date = {May 1984},
|
|
15
|
+
volume = {27},
|
|
16
|
+
number = {2},
|
|
17
|
+
month = may,
|
|
18
|
+
year = {1984},
|
|
19
|
+
issn = {0010-4620},
|
|
20
|
+
pages = {97--111},
|
|
21
|
+
numpages = {15},
|
|
22
|
+
url = {http://dx.doi.org/10.1093/comjnl/27.2.97},
|
|
23
|
+
doi = {10.1093/comjnl/27.2.97},
|
|
24
|
+
acmid = {479},
|
|
25
|
+
publisher = {Oxford University Press},
|
|
26
|
+
address = {Oxford, UK},
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@book{wickham2014advanced,
|
|
30
|
+
title={Advanced r},
|
|
31
|
+
author={Wickham, Hadley},
|
|
32
|
+
year={2014},
|
|
33
|
+
publisher={Chapman and Hall/CRC}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@book{wickham2016r,
|
|
37
|
+
title={R for data science: import, tidy, transform, visualize, and model data},
|
|
38
|
+
author={Wickham, Hadley and Grolemund, Garrett},
|
|
39
|
+
year={2016},
|
|
40
|
+
publisher={" O'Reilly Media, Inc."}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@book{kuhn2013applied,
|
|
44
|
+
title={Applied predictive modeling},
|
|
45
|
+
author={Kuhn, Max and Johnson, Kjell},
|
|
46
|
+
volume={26},
|
|
47
|
+
year={2013},
|
|
48
|
+
publisher={Springer}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@book{knaflic2015storytelling,
|
|
52
|
+
title={Storytelling with data: A data visualization guide for business professionals},
|
|
53
|
+
author={Knaflic, Cole Nussbaumer},
|
|
54
|
+
year={2015},
|
|
55
|
+
publisher={John Wiley \& Sons}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@book{silge2017text,
|
|
59
|
+
title={Text mining with R: A tidy approach},
|
|
60
|
+
author={Silge, Julia and Robinson, David},
|
|
61
|
+
year={2017},
|
|
62
|
+
publisher={" O'Reilly Media, Inc."}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@book{james2013introduction,
|
|
66
|
+
title={An introduction to statistical learning},
|
|
67
|
+
author={James, Gareth and Witten, Daniela and Hastie, Trevor and Tibshirani, Robert},
|
|
68
|
+
volume={112},
|
|
69
|
+
year={2013},
|
|
70
|
+
publisher={Springer}
|
|
71
|
+
}
|
|
72
|
+
|
data/examples/R/calc.R
CHANGED
|
File without changes
|
data/examples/R/java_interop.R
CHANGED
|
File without changes
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# DESeq2 Airway Walkthrough (Bioconductor + galaaz)
|
|
2
|
+
|
|
3
|
+
This document defines the first Bioconductor example we will implement with `galaaz`.
|
|
4
|
+
|
|
5
|
+
## Goal
|
|
6
|
+
|
|
7
|
+
Run a canonical differential expression analysis from Bioconductor using `DESeq2` and the `airway` dataset, then validate that the workflow executes correctly with `galaaz`.
|
|
8
|
+
|
|
9
|
+
## Scope
|
|
10
|
+
|
|
11
|
+
- Focus on workflow execution and interoperability.
|
|
12
|
+
- Install Bioconductor dependencies directly in R (outside `galaaz`).
|
|
13
|
+
- Keep biological interpretation minimal for this first example.
|
|
14
|
+
|
|
15
|
+
## Precondition
|
|
16
|
+
|
|
17
|
+
Before running this example in `galaaz`, install and verify in R:
|
|
18
|
+
|
|
19
|
+
- `BiocManager`
|
|
20
|
+
- `DESeq2`
|
|
21
|
+
- `airway`
|
|
22
|
+
|
|
23
|
+
## Primer (what we are doing)
|
|
24
|
+
|
|
25
|
+
- RNA-seq count data contains integer read counts per gene and per sample.
|
|
26
|
+
- We compare treated vs untreated samples to find genes with significant changes.
|
|
27
|
+
- `DESeq2` models count data and returns:
|
|
28
|
+
- `log2FoldChange` (effect size)
|
|
29
|
+
- `pvalue`
|
|
30
|
+
- `padj` (multiple-testing corrected p-value)
|
|
31
|
+
|
|
32
|
+
## Planned Workflow
|
|
33
|
+
|
|
34
|
+
1. Load `DESeq2` and `airway`.
|
|
35
|
+
2. Load airway data and inspect counts plus sample metadata.
|
|
36
|
+
3. Define a design formula for condition effect (with relevant covariate if used in canonical example).
|
|
37
|
+
4. Build a `DESeqDataSet` object.
|
|
38
|
+
5. Pre-filter low-count genes.
|
|
39
|
+
6. Run `DESeq()` to fit the model.
|
|
40
|
+
7. Extract `results()` for the treatment comparison.
|
|
41
|
+
8. Sort and inspect top hits by adjusted p-value.
|
|
42
|
+
9. Produce one standard QC/result plot (for example `plotMA`).
|
|
43
|
+
|
|
44
|
+
## Validation Checks
|
|
45
|
+
|
|
46
|
+
- Packages load without runtime errors in the target environment.
|
|
47
|
+
- `DESeqDataSet` object is created successfully.
|
|
48
|
+
- `DESeq()` completes.
|
|
49
|
+
- `results()` returns expected columns and non-empty output.
|
|
50
|
+
- At least one standard DESeq2 plot call runs successfully.
|
|
51
|
+
|
|
52
|
+
## Out of Scope (for now)
|
|
53
|
+
|
|
54
|
+
- Installing packages via `galaaz`.
|
|
55
|
+
- Performance tuning or optimization.
|
|
56
|
+
- Deep biological interpretation of gene-level findings.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Run a galaaz DESeq2 airway example three times in one JRuby process (warm-up semantics).
|
|
4
|
+
#
|
|
5
|
+
# Usage (from repository root):
|
|
6
|
+
# bin/galaaz-jruby examples/bioconductor_deseq2_airway/bench_galaaz_three_same_process.rb
|
|
7
|
+
# bin/galaaz-jruby examples/bioconductor_deseq2_airway/bench_galaaz_three_same_process.rb optimized
|
|
8
|
+
# bin/galaaz-jruby examples/bioconductor_deseq2_airway/bench_galaaz_three_same_process.rb original
|
|
9
|
+
|
|
10
|
+
require 'galaaz'
|
|
11
|
+
|
|
12
|
+
root = File.expand_path('../..', __dir__)
|
|
13
|
+
Dir.chdir(root)
|
|
14
|
+
|
|
15
|
+
variant = (ARGV[0] || 'optimized').downcase
|
|
16
|
+
script = case variant
|
|
17
|
+
when 'original'
|
|
18
|
+
'deseq2_airway_galaaz.rb'
|
|
19
|
+
when 'optimized'
|
|
20
|
+
'deseq2_airway_galaaz_optimized.rb'
|
|
21
|
+
else
|
|
22
|
+
warn "Unknown variant #{variant.inspect}; use 'optimized' or 'original'"
|
|
23
|
+
exit 1
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
path = File.expand_path(script, __dir__)
|
|
27
|
+
|
|
28
|
+
unless File.file?(path)
|
|
29
|
+
warn "Missing #{path}"
|
|
30
|
+
exit 1
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
puts "=== galaaz (#{variant}): three runs, same process (root: #{root})"
|
|
34
|
+
times = []
|
|
35
|
+
3.times do |i|
|
|
36
|
+
t0 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
37
|
+
load path
|
|
38
|
+
t1 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
39
|
+
sec = t1 - t0
|
|
40
|
+
times << sec
|
|
41
|
+
puts format('galaaz run %d/3: %.2f s', i + 1, sec)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
warm = times[1..2]
|
|
45
|
+
ws = warm.sort
|
|
46
|
+
warm_median = (ws[0] + ws[1]) / 2.0
|
|
47
|
+
all_sorted = times.sort
|
|
48
|
+
all_median = all_sorted[1]
|
|
49
|
+
|
|
50
|
+
puts '---'
|
|
51
|
+
puts format('Warm median (runs 2–3): %.2f s', warm_median)
|
|
52
|
+
puts format('Warm mean (runs 2–3): %.2f s', warm.sum / warm.size)
|
|
53
|
+
puts format('All-run median: %.2f s', all_median)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Run the DESeq2 airway pipeline three times in a single R process (fair vs galaaz warm-up).
|
|
2
|
+
#
|
|
3
|
+
# Usage (from repository root):
|
|
4
|
+
# Rscript examples/bioconductor_deseq2_airway/bench_r_three_same_process.R
|
|
5
|
+
# Rscript examples/bioconductor_deseq2_airway/bench_r_three_same_process.R /path/to/galaaz
|
|
6
|
+
|
|
7
|
+
args <- commandArgs(trailingOnly = TRUE)
|
|
8
|
+
root <- if (length(args) >= 1L) {
|
|
9
|
+
normalizePath(args[[1L]], winslash = "/", mustWork = TRUE)
|
|
10
|
+
} else {
|
|
11
|
+
normalizePath(getwd(), winslash = "/", mustWork = TRUE)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
Sys.setenv(GALAAZ_BENCH_ROOT = root)
|
|
15
|
+
pipeline <- file.path(root, "examples/bioconductor_deseq2_airway/deseq2_airway_pipeline_for_bench.R")
|
|
16
|
+
if (!file.exists(pipeline)) {
|
|
17
|
+
stop("Pipeline not found: ", pipeline, " (wrong GALAAZ_BENCH_ROOT?)")
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
cat("=== R: three runs, same process (repository root:", root, ")\n", sep = "")
|
|
21
|
+
times <- numeric(3L)
|
|
22
|
+
for (i in seq_len(3L)) {
|
|
23
|
+
st <- system.time({
|
|
24
|
+
sys.source(pipeline, envir = new.env(parent = globalenv()), keep.source = FALSE)
|
|
25
|
+
}, gcFirst = FALSE)
|
|
26
|
+
times[[i]] <- unname(st[["elapsed"]])
|
|
27
|
+
cat(sprintf("R run %d/3: %.2f s\n", i, times[[i]]))
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
warm <- times[2:3]
|
|
31
|
+
cat("---\n")
|
|
32
|
+
cat(sprintf("Warm median (runs 2–3): %.2f s\n", stats::median(warm)))
|
|
33
|
+
cat(sprintf("Warm mean (runs 2–3): %.2f s\n", mean(warm)))
|
|
34
|
+
cat(sprintf("All-run median: %.2f s\n", stats::median(times)))
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'galaaz'
|
|
2
|
+
|
|
3
|
+
R.library('DESeq2')
|
|
4
|
+
R.library('airway')
|
|
5
|
+
R.data('airway')
|
|
6
|
+
|
|
7
|
+
airway = ~:airway
|
|
8
|
+
|
|
9
|
+
# Build DESeq2 dataset with one-sided formula: ~ cell + dex.
|
|
10
|
+
dds = R.DESeqDataSet(airway, design: (:all.til :cell + :dex))
|
|
11
|
+
|
|
12
|
+
# Prefilter genes with almost no counts.
|
|
13
|
+
keep = R.rowSums(R.counts(dds)) >= 10
|
|
14
|
+
dds = dds[keep, :all]
|
|
15
|
+
|
|
16
|
+
# Fit DE model and extract treatment effect.
|
|
17
|
+
dds = R.DESeq(dds)
|
|
18
|
+
res = R.results(dds, contrast: R.c('dex', 'trt', 'untrt'))
|
|
19
|
+
|
|
20
|
+
# Compact sanity outputs for quick verification.
|
|
21
|
+
puts "Samples: #{R.ncol(dds)}"
|
|
22
|
+
puts "Genes after prefilter: #{R.nrow(dds)}"
|
|
23
|
+
puts "Result rows: #{R.nrow(res)}"
|
|
24
|
+
puts "Result columns: #{R.colnames(res)}"
|
|
25
|
+
puts "Significant genes (padj < 0.05): #{R.sum(res.padj < 0.05, na__rm: true)}"
|
|
26
|
+
|
|
27
|
+
res_ordered = res[R.order(res.padj), :all]
|
|
28
|
+
puts R.head(R.as__data__frame(res_ordered), 10)
|
|
29
|
+
|
|
30
|
+
# Standard DESeq2 plot call written to file.
|
|
31
|
+
R.pdf('examples/bioconductor_deseq2_airway/plotMA_galaaz.pdf')
|
|
32
|
+
R.plotMA(res, ylim: R.c(-5, 5))
|
|
33
|
+
R.dev__off
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'galaaz'
|
|
2
|
+
|
|
3
|
+
R.library('DESeq2')
|
|
4
|
+
R.library('airway')
|
|
5
|
+
R.data('airway')
|
|
6
|
+
|
|
7
|
+
airway = ~:airway
|
|
8
|
+
|
|
9
|
+
# Build DESeq2 dataset with one-sided formula: ~ cell + dex.
|
|
10
|
+
dds = R.DESeqDataSet(airway, design: (:all.til :cell + :dex))
|
|
11
|
+
|
|
12
|
+
# Prefilter genes with almost no counts.
|
|
13
|
+
keep = R.rowSums(R.counts(dds)) >= 10
|
|
14
|
+
dds = dds[keep, :all]
|
|
15
|
+
|
|
16
|
+
# Fit DE model and extract treatment effect.
|
|
17
|
+
dds = R.DESeq(dds)
|
|
18
|
+
res = R.results(dds, contrast: R.c('dex', 'trt', 'untrt'))
|
|
19
|
+
|
|
20
|
+
# Ruby-style optimization: delegate object rendering to R print/cat.
|
|
21
|
+
padj = res.padj
|
|
22
|
+
res_ordered = res[R.order(padj), :all]
|
|
23
|
+
|
|
24
|
+
R.cat('Samples:', R.ncol(dds), '\n')
|
|
25
|
+
R.cat('Genes after prefilter:', R.nrow(dds), '\n')
|
|
26
|
+
R.cat('Result rows:', R.nrow(res), '\n')
|
|
27
|
+
R.cat('Result columns:', R.paste(R.colnames(res), collapse: ', '), '\n')
|
|
28
|
+
R.cat('Significant genes (padj < 0.05):', R.sum(padj < 0.05, na__rm: true), '\n')
|
|
29
|
+
R.print(R.head(res_ordered, 10))
|
|
30
|
+
|
|
31
|
+
# Standard DESeq2 plot call written to file.
|
|
32
|
+
R.pdf('examples/bioconductor_deseq2_airway/plotMA_galaaz_optimized.pdf')
|
|
33
|
+
R.plotMA(res, ylim: R.c(-5, 5))
|
|
34
|
+
R.dev__off
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
library(DESeq2)
|
|
2
|
+
library(airway)
|
|
3
|
+
|
|
4
|
+
# Load canonical airway example data.
|
|
5
|
+
data(airway)
|
|
6
|
+
airway$dex <- relevel(airway$dex, ref = "untrt")
|
|
7
|
+
|
|
8
|
+
# Build DESeq2 dataset using cell line as covariate and dex as treatment.
|
|
9
|
+
dds <- DESeqDataSet(airway, design = ~ cell + dex)
|
|
10
|
+
|
|
11
|
+
# Prefilter genes with almost no counts.
|
|
12
|
+
keep <- rowSums(counts(dds)) >= 10
|
|
13
|
+
dds <- dds[keep, ]
|
|
14
|
+
|
|
15
|
+
# Fit DE model and extract treatment effect.
|
|
16
|
+
dds <- DESeq(dds)
|
|
17
|
+
res <- results(dds, contrast = c("dex", "trt", "untrt"))
|
|
18
|
+
|
|
19
|
+
# Compact sanity outputs for quick verification.
|
|
20
|
+
cat("Samples:", ncol(dds), "\n")
|
|
21
|
+
cat("Genes after prefilter:", nrow(dds), "\n")
|
|
22
|
+
cat("Result rows:", nrow(res), "\n")
|
|
23
|
+
cat("Result columns:", paste(colnames(res), collapse = ", "), "\n")
|
|
24
|
+
cat("Significant genes (padj < 0.05):", sum(res$padj < 0.05, na.rm = TRUE), "\n")
|
|
25
|
+
|
|
26
|
+
res_ordered <- res[order(res$padj), ]
|
|
27
|
+
print(head(as.data.frame(res_ordered), 10))
|
|
28
|
+
|
|
29
|
+
# Standard DESeq2 plot call used in the walkthrough.
|
|
30
|
+
plotMA(res, ylim = c(-5, 5))
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# DESeq2 airway pipeline for timing benchmarks.
|
|
2
|
+
# Logic matches deseq2_airway_minimal.R; plot goes to PDF like the galaaz examples
|
|
3
|
+
# (avoids default graphics device variance in headless/automated runs).
|
|
4
|
+
#
|
|
5
|
+
# Not loaded by default from other examples — use only via bench_r_three_same_process.R.
|
|
6
|
+
|
|
7
|
+
library(DESeq2)
|
|
8
|
+
library(airway)
|
|
9
|
+
|
|
10
|
+
data(airway)
|
|
11
|
+
airway$dex <- relevel(airway$dex, ref = "untrt")
|
|
12
|
+
|
|
13
|
+
dds <- DESeqDataSet(airway, design = ~ cell + dex)
|
|
14
|
+
|
|
15
|
+
keep <- rowSums(counts(dds)) >= 10
|
|
16
|
+
dds <- dds[keep, ]
|
|
17
|
+
|
|
18
|
+
dds <- DESeq(dds)
|
|
19
|
+
res <- results(dds, contrast = c("dex", "trt", "untrt"))
|
|
20
|
+
|
|
21
|
+
cat("Samples:", ncol(dds), "\n")
|
|
22
|
+
cat("Genes after prefilter:", nrow(dds), "\n")
|
|
23
|
+
cat("Result rows:", nrow(res), "\n")
|
|
24
|
+
cat("Result columns:", paste(colnames(res), collapse = ", "), "\n")
|
|
25
|
+
cat("Significant genes (padj < 0.05):", sum(res$padj < 0.05, na.rm = TRUE), "\n")
|
|
26
|
+
|
|
27
|
+
res_ordered <- res[order(res$padj), ]
|
|
28
|
+
print(head(as.data.frame(res_ordered), 10))
|
|
29
|
+
|
|
30
|
+
root <- Sys.getenv("GALAAZ_BENCH_ROOT", unset = "")
|
|
31
|
+
if (!nzchar(root)) {
|
|
32
|
+
stop("Set GALAAZ_BENCH_ROOT to the galaaz repository root before sourcing this file (see bench_r_three_same_process.R).")
|
|
33
|
+
}
|
|
34
|
+
pdf(file.path(root, "examples/bioconductor_deseq2_airway/plotMA_bench_R.pdf"))
|
|
35
|
+
plotMA(res, ylim = c(-5, 5))
|
|
36
|
+
invisible(dev.off())
|
data/examples/islr/all.rb
CHANGED
|
@@ -27,6 +27,19 @@ require 'ggplot'
|
|
|
27
27
|
# load ISLR and MASS Libraries
|
|
28
28
|
R.install_and_loads('ISLR', 'MASS')
|
|
29
29
|
|
|
30
|
+
def galaaz_islr_all_debug(msg)
|
|
31
|
+
STDERR.puts "[DEBUG islr][all] #{Time.now.strftime('%H:%M:%S')} #{msg}"
|
|
32
|
+
STDERR.flush
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
galaaz_islr_all_debug('before require ch2.spec')
|
|
30
36
|
require_relative 'ch2.spec'
|
|
37
|
+
galaaz_islr_all_debug('after require ch2.spec')
|
|
38
|
+
|
|
39
|
+
galaaz_islr_all_debug('before require ch3.spec')
|
|
31
40
|
require_relative 'ch3.spec'
|
|
41
|
+
galaaz_islr_all_debug('after require ch3.spec')
|
|
42
|
+
|
|
43
|
+
galaaz_islr_all_debug('before require ch6.spec')
|
|
32
44
|
require_relative 'ch6.spec'
|
|
45
|
+
galaaz_islr_all_debug('after require ch6.spec')
|
data/examples/islr/ch2.spec.rb
CHANGED
|
@@ -69,8 +69,11 @@ context "ISLR" do
|
|
|
69
69
|
R.set__seed(3)
|
|
70
70
|
x = R.rnorm(50)
|
|
71
71
|
y = x + R.rnorm(50, mean: 40, sd: 0.1)
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
cor_xy = R.cor(x, y)
|
|
73
|
+
expected = 0.995717314227608
|
|
74
|
+
expect(cor_xy.respond_to?(:all__equal) ? cor_xy.all__equal(expected) : (cor_xy - expected).abs < 1e-9).to eq true
|
|
75
|
+
cor_xy2 = x.cor(y)
|
|
76
|
+
expect(cor_xy2.respond_to?(:all__equal) ? cor_xy2.all__equal(expected) : (cor_xy2 - expected).abs < 1e-9).to eq true
|
|
74
77
|
end
|
|
75
78
|
|
|
76
79
|
it "should allow to setting the seed" do
|
|
@@ -84,16 +87,24 @@ context "ISLR" do
|
|
|
84
87
|
it "should calculate the mean" do
|
|
85
88
|
R.set__seed(3)
|
|
86
89
|
y = R.rnorm(100)
|
|
87
|
-
|
|
90
|
+
m = y.mean
|
|
91
|
+
expect(m.respond_to?(:all__equal) ? m.all__equal(0.0110355710) : (m - 0.0110355710).abs < 1e-9).to eq true
|
|
88
92
|
end
|
|
89
93
|
|
|
90
94
|
it "should calculate the variance" do
|
|
91
95
|
R.set__seed(3)
|
|
92
96
|
y = R.rnorm(100)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
v = y.var
|
|
98
|
+
sd = y.sd
|
|
99
|
+
expected_var = 0.732867501277449
|
|
100
|
+
expected_sd = 0.856076808047881
|
|
101
|
+
expect(v.respond_to?(:all__equal) ? v.all__equal(expected_var) : (v - expected_var).abs < 1e-9).to eq true
|
|
102
|
+
expect(sd.respond_to?(:all__equal) ? sd.all__equal(expected_sd) : (sd - expected_sd).abs < 1e-9).to eq true
|
|
103
|
+
# var.sqrt should match sd when both are available
|
|
104
|
+
if v.respond_to?(:sqrt)
|
|
105
|
+
s = v.sqrt
|
|
106
|
+
expect(s.respond_to?(:all__equal) ? s.all__equal(expected_sd) : (s - expected_sd).abs < 1e-9).to eq true
|
|
107
|
+
end
|
|
97
108
|
end
|
|
98
109
|
|
|
99
110
|
end
|
|
@@ -101,8 +112,15 @@ context "ISLR" do
|
|
|
101
112
|
context "Chapter 2 - Graphics" do
|
|
102
113
|
|
|
103
114
|
it "should plot graphics" do
|
|
115
|
+
def galaaz_islr_debug(msg)
|
|
116
|
+
STDERR.puts "[DEBUG islr][ch2.spec][#{Time.now.strftime('%H:%M:%S')}] #{msg}"
|
|
117
|
+
STDERR.flush
|
|
118
|
+
end
|
|
119
|
+
|
|
104
120
|
# To see the graphic we need to set the device to awt
|
|
121
|
+
galaaz_islr_debug 'before R.awt'
|
|
105
122
|
R.awt
|
|
123
|
+
galaaz_islr_debug 'after R.awt'
|
|
106
124
|
x = R.rnorm(100)
|
|
107
125
|
y = R.rnorm(100)
|
|
108
126
|
# plot commands do not work. Need to work with ggplot or grid
|
|
@@ -113,16 +131,28 @@ context "ISLR" do
|
|
|
113
131
|
ylab: "this is the y-axis",
|
|
114
132
|
main: "Plot of X vs Y")
|
|
115
133
|
.print
|
|
134
|
+
galaaz_islr_debug 'after qplot.print'
|
|
116
135
|
# the graphics dies when the script ends... waiting 3 secs
|
|
117
136
|
# so that the graphic can be seen
|
|
137
|
+
galaaz_islr_debug 'before sleep(3)'
|
|
118
138
|
sleep(3)
|
|
139
|
+
galaaz_islr_debug 'after sleep(3)'
|
|
140
|
+
R.dev__off
|
|
119
141
|
end
|
|
120
142
|
|
|
121
143
|
it "should create a jpeg file" do
|
|
144
|
+
def galaaz_islr_debug(msg)
|
|
145
|
+
STDERR.puts "[DEBUG islr][ch2.spec][#{Time.now.strftime('%H:%M:%S')}] #{msg}"
|
|
146
|
+
STDERR.flush
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
galaaz_islr_debug 'jpeg test: start'
|
|
122
150
|
R.jpeg("/home/rbotafogo/desenv/galaaz/examples/islr/x_y_rnorm.jpg")
|
|
123
151
|
R.df = R.data__frame(x: R.rnorm(100), y: R.rnorm(100))
|
|
152
|
+
galaaz_islr_debug 'jpeg test: about to qplot'
|
|
124
153
|
puts R.qplot(:x, :y, data: :df, col: "green")
|
|
125
154
|
R.dev__off
|
|
155
|
+
galaaz_islr_debug 'jpeg test: after R.dev__off'
|
|
126
156
|
end
|
|
127
157
|
|
|
128
158
|
it "creates sequences with 'seq'" do
|
data/examples/islr/ch3.spec.rb
CHANGED
|
@@ -24,5 +24,14 @@
|
|
|
24
24
|
require 'galaaz'
|
|
25
25
|
require 'ggplot'
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
context "ISLR" do
|
|
28
|
+
context "Chapter 3 - Lab" do
|
|
29
|
+
it "runs ch3_boston (graphics + regression)" do
|
|
30
|
+
load File.expand_path('ch3_boston.rb', __dir__)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "runs ch3_multiple_regression (non-linear transformations)" do
|
|
34
|
+
load File.expand_path('ch3_multiple_regression.rb', __dir__)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|