Skip to content

Use as_tibble() - #28

Open
DavisVaughan wants to merge 1 commit into
ngthomas:masterfrom
DavisVaughan:fix/dplyr
Open

Use as_tibble()#28
DavisVaughan wants to merge 1 commit into
ngthomas:masterfrom
DavisVaughan:fix/dplyr

Conversation

@DavisVaughan

Copy link
Copy Markdown

Hi there, we are working on the next version of dplyr and your package was flagged in our reverse dependency checks.

We've advanced our deprecation of dplyr::as.tbl() and dplyr::tbl_df(), both of which have been deprecated since dplyr 1.0.0 in 2020.

You'll need to update your package to use tibble::as_tibble() instead to stay on CRAN.

dplyr will be released on January 31, 2026. If you could please send an update of your package to CRAN before then, that would help us out a lot! Thanks!

ltalignani referenced this pull request in ltalignani/microhaplot-2 Jul 21, 2026
Field selector (#24), Genotype Call AR Refinement (#25) and Summaries (#26),
Criteria Cutoff tab (#27), and Table view types + About tab (#28).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ltalignani referenced this pull request in ltalignani/microhaplot-2 Jul 22, 2026
…d diplotype calling

Adds the "Genotype Call" navbar tab with an "AR Refinement" sub-tab: the
interactive read-depth x allelic-ratio biplot for visually setting
homozygote/heterozygote thresholds per locus, restoring the central
analysis view from v1.

Key decisions:
- classify_call() treats a missing rank-2 haplotype (NA ar) as homozygote
  unconditionally, since an individual with only a rank-1 call has no
  second allele to compare against the AR thresholds.
- Per-locus thresholds are stored in a moduleServer-local reactiveValues()
  keyed by locus name (not a data.frame table) — lookup by locus is a
  single indexed access, and reactiveValuesToList() gives the same
  "one row per locus" shape the issue asked for when inspected.
- Slider lower bound is refreshed via updateSliderInput(min = ...) on every
  locus change, driven by min_observed_ar() for that locus, per the issue's
  "slider bounds constrained by minimum observed AR" requirement.
- ggiraph was a declared but previously unused Imports entry (from
  DESCRIPTION) and was not installed in the local dev environment; installed
  it locally to get real (non-skipped) test coverage of genotypeCallModule.R
  rather than relying on testthat's silent skip-if-missing behavior.
- fieldSelectorServer (#24) is instantiated once for the Genotype Call tab
  (id "genotype_call_fields") and its $current_locus is threaded into
  genotypeCallServer — the same instance will drive the Summaries sub-tab
  (#26) once it exists, so both sub-tabs stay in sync on locus navigation.

Files changed:
- app/R/genotype_call.R (new): default_ar_params(), classify_call(),
  locus_biplot_data(), pie_call_counts(), haplotype_distributions(),
  min_observed_ar()
- app/R/genotypeCallModule.R (new): genotypeCallUI/genotypeCallServer —
  pie chart, ggiraph biplot, DT calls table, per-haplotype depth/AR
  boxplots, per-locus threshold persistence
- app/app.R: source new files, add "Genotype Call" nav_panel (field
  selector + AR Refinement navset_tab), wire fieldSelectorServer +
  genotypeCallServer in the main server function
- tests/testthat/test-genotype-call.R (new): 31 tests for the pure
  classification/aggregation helpers
- tests/testthat/test-genotype-call-server.R (new): 7 testServer cycles
  covering default thresholds, save/persist across locus navigation,
  biplot_data reactivity, and has_data state

Verification: full R test suite — 485 pass, 1 pre-existing unrelated
failure in test-input-validation.R:118 (BAI path matching, present before
this change). Confirmed app.R sources and builds ui/server without error.

Blockers/notes for next iteration: #26 (Genotype Call > Summaries) should
reuse the same fieldSelectorServer("genotype_call_fields") instance already
wired in app.R and add its nav_panel inside the existing navset_tab
alongside "AR Refinement". #28's "Genotype call table" view depends on
genotypeCallServer's $biplot_data (or a per-locus aggregate built from
$saved_thresholds across all loci) — that reactive is only computed for the
currently active locus today, so #28 will need to iterate saved_thresholds
across all loci to build a full genotype-call table.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ltalignani referenced this pull request in ltalignani/microhaplot-2 Jul 22, 2026
… pairwise, by-group, sequence alignment

Adds the "Summaries" sub-tab alongside AR Refinement in the Genotype Call
navbar tab, sharing the existing fieldSelectorServer("genotype_call_fields")
instance and current_locus reactive from #24/#25.

Key decisions:
- Diploid allele counting (haplotype_frequencies / haplotype_frequencies_by_group
  in genotype_summaries.R) follows hwe_entropy.R's existing convention: a
  homozygous individual (rank-1 only) contributes two copies of its allele,
  a heterozygous individual one copy each of rank-1/rank-2 — kept consistent
  rather than inventing a second counting rule.
- HWE pairwise plot reuses haplo_freq_tbl() (hwe_entropy.R) via a thin
  locus_hwe_pairs() wrapper instead of recomputing observed/expected
  diplotype frequencies — that logic already existed and is tested.
- Haplotype frequency plot uses ggiraph (already a project dependency from
  #25's biplot) with opts_selection(type = "single") for bar-click
  highlighting; input$hapFreq_selected is exposed via a plain reactive
  (selected_haplo) that filters the sequence alignment display, mirroring
  how #25 wired ggiraph interactivity.
- Haplotype sequence alignment is long-format (haplo x position x base) from
  strsplit() on each unique haplotype string, rendered as geom_tile() —
  works for any haplotype length without hardcoding SNP count.

Files changed:
- app/R/genotype_summaries.R (new): haplotype_frequencies(),
  haplotype_frequencies_by_group(), locus_hwe_pairs(), haplotype_sequences()
- app/R/genotypeSummariesModule.R (new): genotypeSummariesUI/Server —
  hapFreq ggiraph bar chart, PairWiseHap scatter, hapByGroupPlot, hapSeq tile
  display
- app/app.R: source new files, add "Summaries" nav_panel inside the
  Genotype Call navset_tab, wire genotypeSummariesServer with the shared
  field selector and result$color_map
- tests/testthat/test-genotype-summaries.R (new): 23 assertions for the
  pure aggregation helpers
- tests/testthat/test-genotype-summaries-server.R (new): 9 testServer
  cycles covering has_data, hap_freq/hwe_pairs/hap_freq_by_group/hap_seq
  reactivity, and ggiraph selection wiring
- CHANGELOG.md: document the new sub-tab

Verification: full R test suite — 517 pass, 1 pre-existing unrelated
failure in test-input-validation.R:118 (BAI path matching, present before
this change). Confirmed app.R sources and builds ui/server without error.

Blockers/notes for next iteration: #28 (Table view types + About tab) is
unblocked — its "Genotype call table" view needs to iterate
genotypeCallServer's saved_thresholds across all loci (not just the active
one) to build a full per-individual-per-locus call table, as noted when
#25 shipped.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ltalignani referenced this pull request in ltalignani/microhaplot-2 Jul 22, 2026
…ummary, session info

Adds a radioButtons selector to the Download/Table tab for three views
(Haplotype / Summary / Genotype call) and a new About tab as the last
navbar item, closing the final open issue in the v1 feature-restoration
backlog.

Key decisions:
- genotype_call_table() (genotype_call.R) iterates every locus in
  haplo_data, applying saved_thresholds[[locus]] where present and
  default_ar_params() otherwise, reusing locus_biplot_data()/classify_call()
  rather than reimplementing diplotype logic. Table columns are id, locus,
  h1, h2, depth, ar, status, max_ar_hm, min_ar_hz.
- summary_table_wide() (output_utils.R) is a straight pivot_wider() on
  (id, locus) x haplo -> depth across the whole dataset — matches
  microhaplot::tableIndLocus() semantics without hardcoding haplotype
  columns per locus.
- Dropped outputServer()'s filtered_data argument: the old "filtered
  diploid" view is subsumed by the genotype call table (same diploid
  pairing plus AR-based call status), so app.R now threads
  genotypeCallServer's saved_thresholds reactive into outputServer instead.
  app.R previously discarded genotypeCallServer's return value entirely —
  now captured as genotype_call_res.
- Genotype call view is gated behind an info message until at least one
  locus's thresholds have been saved (acceptance criteria requirement),
  rather than silently falling back to defaults for every locus.
- Internal reactives not part of a module's public return (current_table,
  has_thresholds) are tested by calling them directly inside
  shiny::testServer(), following the existing pattern in
  test-pop-genetics-server.R rather than session$returned$.
- app_metadata() reads name/version/license/url from DESCRIPTION via
  read.dcf() rather than hardcoding, so the About tab stays in sync with
  package metadata.

Files changed:
- app/R/output_utils.R: add summary_table_wide()
- app/R/genotype_call.R: add genotype_call_table()
- app/R/outputModule.R: rewritten — radioButtons view selector, single
  download button/preview, field selector only for the haplotype view
- app/R/aboutModule.R (new): app_metadata(), aboutUI/aboutServer —
  metadata card, citation, license, GitHub link, collapsible sessionInfo()
- app/app.R: source aboutModule.R, add "About" nav_panel as last item,
  capture genotypeCallServer's return as genotype_call_res and thread
  saved_thresholds into outputServer, wire aboutServer
- tests/testthat/test-output-utils.R: 4 new tests for summary_table_wide()
- tests/testthat/test-genotype-call.R: 5 new tests for genotype_call_table()
- tests/testthat/test-output-server.R (new): 10 testServer cycles covering
  view switching, field selection, and threshold gating
- tests/testthat/test-about.R (new): app_metadata() assertions
- CHANGELOG.md: document the new views and About tab
- issues/28-table-types-about-tab.md moved to issues/done/

Verification: full R test suite — 547 pass, 1 pre-existing unrelated
failure in test-input-validation.R:118 (BAI path matching, present before
this change). Confirmed app.R sources and builds ui/server without error.

Blockers/notes for next iteration: none — this was the last open issue in
the backlog (issues/ is now empty except issues/done/).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant