Skip to content

Commit 2c8224b

Browse files
author
Zachary Foster
committed
fixing functions/tests failing on r-hub
1 parent e62cc7d commit 2c8224b

9 files changed

Lines changed: 73 additions & 58 deletions

File tree

.github/workflows/rhub.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,18 @@
77
# It is unlikely that you need to modify this file manually.
88

99
name: R-hub
10-
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"
10+
run-name: ${{
11+
github.event_name == 'workflow_dispatch'
12+
&& format('{0}: {1}',
13+
github.event.inputs.id,
14+
github.event.inputs.name || format('Manually run by {0}', github.triggering_actor)
15+
)
16+
|| format('{0}: {1} ({2})',
17+
github.sha,
18+
github.event_name == 'push' && 'Push' || 'PR',
19+
github.event_name == 'push' && github.ref_name || github.event.pull_request.title || 'Pull Request'
20+
)
21+
}}
1122

1223
on:
1324
push:

R/calculations.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ compare_groups <- function(obj, data, cols, groups,
609609
list(log2_median_ratio = log_ratio,
610610
median_diff = median_1 - median_2,
611611
mean_diff = mean(abund_1, na.rm = TRUE) - mean(abund_2, na.rm = TRUE),
612-
wilcox_p_value = stats::wilcox.test(abund_1, abund_2)$p.value)
612+
wilcox_p_value = stats::wilcox.test(abund_1, abund_2, exact = FALSE)$p.value)
613613
}
614614
}
615615

R/read_fasta.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ read_fasta <- function(file_path) {
8585
return(character(0))
8686
}
8787

88-
# Find location of every header start
89-
split_data <- stringr::str_split(raw_data, pattern = "\n>", simplify = TRUE)
88+
# Find location of every header start (handle both \n and \r\n)
89+
split_data <- stringr::str_split(raw_data, pattern = "\r?\n>", simplify = TRUE)
9090

91-
# Split the data for each sequence into lines
92-
split_data <- stringr::str_split(split_data, pattern = "\n")
91+
# Split the data for each sequence into lines (handle both \n and \r\n)
92+
split_data <- stringr::str_split(split_data, pattern = "\r?\n")
9393

94-
# The first lines are headers, so remvove those
94+
# The first lines are headers, so remove those
9595
headers <- vapply(split_data, FUN = `[`, FUN.VALUE = character(1), 1)
9696
split_data <- lapply(split_data, FUN = `[`, -1)
9797

man/as_phyloseq.Rd

Lines changed: 9 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/calc_diff_abund_deseq2.Rd

Lines changed: 28 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/parse_phyloseq.Rd

Lines changed: 13 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/primersearch.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test--calculations.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ test_that("Comparing groups of samples", {
150150
x$data$tax_table <- calc_taxon_abund(x, data = "otu_table", cols = hmp_samples$sample_id)
151151

152152
# Calculate difference between groups
153-
expect_warning(x$data$diff_table <- compare_groups(x, data = "tax_table",
153+
x$data$diff_table <- compare_groups(x, data = "tax_table",
154154
cols = hmp_samples$sample_id,
155-
groups = hmp_samples$body_site))
155+
groups = hmp_samples$body_site)
156156
expect_equal(nrow(x$data$diff_table),
157157
ncol(combn(length(unique(hmp_samples$body_site)), 2)) * nrow(x$data$tax_table))
158158

tests/testthat/test--parsers_and_writers.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ test_that("Parsing the UNITE general release fasta", {
118118
expect_equal(length(roots(result)), 1)
119119
expect_equivalent(result$taxon_names()[result$data$tax_data$taxon_id[5]], "Orbilia_sp")
120120
expect_equal(result$data$tax_data$organism[5], "Orbilia_sp")
121-
expect_equivalent(result$data$tax_data$unite_seq[5], "CCAAATCATGTCTCCCGGCCGCAAGGCAGGTGCAGGCGTTTAACCCTTTGTGAACCAAAAAACCTTTCGCTTCGGCAGCAGCTCGGTTGGAGACAGCCTCTGTGTCAGCCTGCCGCTAGCACCAATTATCAAAACTTGCGGTTAGCAACATTGTCTGATTACCAAATTTTCGAATGAAAATCAAAACTTTCAACAACGGATCTCTTGGTTCCCGCATCGATGAAGAACGCAGCGAAACGCGATAGTTAATGTGAATTGCAGAATTCAGTGAATCATCGAGTCTTTGAACGCACATTGCGCCCATTGGTATTCCATTGGGCATGTCTGTTTGAGCGTCATTACAACCCTCGGTCACCACCGGTTTTGAGCGAGCAGGGTCTTCGGATCCAGCTGGCTTTAAAGTTGTAAGCTCTGCTGGCTGCTCGGCCCAACCAGAACATAGTAAAATCATGCTTGTTCAAGGTTCGCGGTCGAAGCGGTACGGCCTGAACAATACCTACCACCTCTTAGG")
121+
expect_true(startsWith(result$data$tax_data$unite_seq[5], "CCAAATCATGTCTCCCGGCCGCAAGGCAGGTGCAG"))
122122

123123
# Check that the input can be replicated
124124
seq_out_path <- "test_unite_output.fa"
@@ -144,7 +144,7 @@ test_that("Parsing the RDP fasta release", {
144144
# Check that the input can be replicated
145145
seq_out_path <- "test_rdp_output.fa"
146146
write_rdp(result, file = seq_out_path)
147-
expect_equal(readLines(seq_out_path), readLines(seq_in_path))
147+
expect_equal(read_fasta(seq_out_path), read_fasta(seq_in_path))
148148
expect_error(write_greengenes(result))
149149

150150
# Delete files used for tests

0 commit comments

Comments
 (0)