From 95af2055f33679e5526e8a7c4947c852244ee28c Mon Sep 17 00:00:00 2001 From: karissawhiting Date: Tue, 27 Jun 2023 17:35:31 -0400 Subject: [PATCH 1/5] update names processing underlying data --- data-raw/accepted-column-names.csv | 1 + data/names_df.rda | Bin 6091 -> 6146 bytes tests/testthat/test-rename_columns.R | 23 ++++++++++++++--------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/data-raw/accepted-column-names.csv b/data-raw/accepted-column-names.csv index 62d7e765..eee06ce8 100644 --- a/data-raw/accepted-column-names.csv +++ b/data-raw/accepted-column-names.csv @@ -2,6 +2,7 @@ Hugo_Symbol,hugoGeneSymbol,yes,,yes,"  HUGO symbol for the gene (HUGO symbols are always in all caps). ""Unknown"" is used for regions that do not correspond to a gene",can be present in long format Entrez_Gene_Id,entrezGeneId,yes,yes,yes,"  Entrez gene ID (an integer). ""0"" is used for regions that do not correspond to a gene region or Ensembl ID",can be present in long format Tumor_Sample_Barcode,sampleId,yes,yes,yes,Aliquot barcode for the tumor sample,can be present in long format +Sample_ID,sampleId,yes,yes,yes,, Patient_ID,patientId,yes,yes,yes,,can be present in long format Study_ID,studyId,,yes,yes,,can be present in long format Molecular_Profile_ID,molecularProfileId,yes,yes,yes,,can be present in long format diff --git a/data/names_df.rda b/data/names_df.rda index 3222b803c700ffa35e1b41f5eb1d75e3c914dc88..229ed16ed7b40eb8f7b3b87d8df1b35bebf9e798 100644 GIT binary patch literal 6146 zcmV+d82#r$T4*^jL0KkKStw<3-vAo{fBgUd|L_0*{{FxJ|NsC0|ME)=qy$I+7(fsZ z00ZD1A9$Yedti62=RvBbnj6mdxF0|VqI=4>+~6&$ghtR?Eh(+AWB}HxkD;WA2Sd>5 zMB}+E4%%c7T`*{xjS~rydNd6~Ddfo01wArTG{rqnMnv?6$)xlnO+8OZr>Hijn9~%= zlhhug(E?C_lTSet0!>U$Nc2X^4FL5tJxv23G(Aj*rlZjS05oVC002mYCW)c}O+8c8 z+L%onP|)=NGynhq00003KmY&&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}^J zr9l%mXiz4jGQ|UILrH@dxS4S9YG%4?4j8^=8ks;kBBhmt zZXa}HbxWOxU=IJOR?goylQ{ES4-fSdzzb zf!=dEo;N#Afn%mVV&##8^k? z!NN!~zMg>`#Mq!62;V~D5FkU39mM^Pe-S;S+BY3X7p*#a311;DF^#lr8yHGL`BlMP zxP$Ew*q4;yH_A*fy;|933W5-&SY$v{5lSs$k9;f)@z+Y|RM9dr zF|%@5wH~Vj*dGHP2f8hn`6j-u)nIYr+^#G%{dPFn{4gX1~eMJ zkoqLu_Ko33}sL&9G)*amz|hs9+u1qRo{3NP8NFXV;VgUG+-% + dplyr::rename("Sample_ID" = sampleId) + + mut2 <- rename_columns(mut) + expect_false(any(stringr::str_detect(names(mut2), "Sample_ID"))) + expect_true(any(stringr::str_detect(names(mut2), "sample_id"))) + + expect_equal(nrow(mut), nrow(mut2)) + +}) + + From d366aa30b50bb7a0409cee014ef1cf38d01fc0e6 Mon Sep 17 00:00:00 2001 From: karissawhiting Date: Wed, 13 Sep 2023 17:25:58 -0400 Subject: [PATCH 2/5] add conditional eval --- vignettes/genie-bpc-vignette.Rmd | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vignettes/genie-bpc-vignette.Rmd b/vignettes/genie-bpc-vignette.Rmd index 54e9c198..98afdd63 100644 --- a/vignettes/genie-bpc-vignette.Rmd +++ b/vignettes/genie-bpc-vignette.Rmd @@ -48,6 +48,9 @@ library(genieBPC) # if credentials are not stored in your R environment set_synapse_credentials(username = "username", password = "password") +``` + +```{r, eval=genieBPC:::.is_connected_to_genie()} # if credentials are stored in your R environment set_synapse_credentials() From 8ea120c0f0a203c47c191d9c277ce25e3d68f4ca Mon Sep 17 00:00:00 2001 From: karissawhiting Date: Wed, 13 Sep 2023 18:00:26 -0400 Subject: [PATCH 3/5] fix warning message and add test --- R/summarize-by-gene.R | 6 +++++- tests/testthat/test-summarize-by-gene.R | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/R/summarize-by-gene.R b/R/summarize-by-gene.R index 0b875cfe..be343b02 100644 --- a/R/summarize-by-gene.R +++ b/R/summarize-by-gene.R @@ -74,9 +74,13 @@ summarize_by_gene <- function(gene_binary) { # genes with more than one type of event all_bin_more <- transp_alt_only %>% - filter(.data$gene %in% genes_multiple) %>% + filter(.data$gene %in% genes_multiple) + + if(length(genes_multiple) > 0) { + all_bin_more <- all_bin_more %>% group_by(.data$gene) %>% summarize(across(everything(), max)) + } # bind together and transpose all_bin <- rbind(all_bin_once, all_bin_more, make.row.names = FALSE) %>% diff --git a/tests/testthat/test-summarize-by-gene.R b/tests/testthat/test-summarize-by-gene.R index 0d410056..a4e7a78b 100644 --- a/tests/testthat/test-summarize-by-gene.R +++ b/tests/testthat/test-summarize-by-gene.R @@ -107,4 +107,20 @@ test_that("test what happens to columns with all NA", { }) +test_that("no warning message thrown when only 1 alt type", { + + bin.mut <- create_gene_binary( + samples = samples, mutation = gnomeR::mutations, + mut_type = "omit_germline", snp_only = FALSE, + include_silent = FALSE + ) + + expect_no_warning(summarize_by_gene(bin.mut) + + + +}) + + + From 87ce39582dcd192db4d89b93e9ec794675f65254 Mon Sep 17 00:00:00 2001 From: karissawhiting Date: Wed, 13 Sep 2023 18:03:42 -0400 Subject: [PATCH 4/5] update test --- tests/testthat/test-summarize-by-gene.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-summarize-by-gene.R b/tests/testthat/test-summarize-by-gene.R index a4e7a78b..5eb05cff 100644 --- a/tests/testthat/test-summarize-by-gene.R +++ b/tests/testthat/test-summarize-by-gene.R @@ -115,7 +115,7 @@ test_that("no warning message thrown when only 1 alt type", { include_silent = FALSE ) - expect_no_warning(summarize_by_gene(bin.mut) + expect_no_warning(summarize_by_gene(bin.mut)) From 2f8cf7e984f0487df1c115e07c5bd3850a8445b8 Mon Sep 17 00:00:00 2001 From: karissawhiting Date: Wed, 13 Sep 2023 18:34:18 -0400 Subject: [PATCH 5/5] fix test --- tests/testthat/test-summarize-by-gene.R | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/testthat/test-summarize-by-gene.R b/tests/testthat/test-summarize-by-gene.R index 5eb05cff..a83ad78a 100644 --- a/tests/testthat/test-summarize-by-gene.R +++ b/tests/testthat/test-summarize-by-gene.R @@ -109,6 +109,7 @@ test_that("test what happens to columns with all NA", { test_that("no warning message thrown when only 1 alt type", { + samples <- gnomeR::mutations$sampleId bin.mut <- create_gene_binary( samples = samples, mutation = gnomeR::mutations, mut_type = "omit_germline", snp_only = FALSE,