From 17d7f7cdf97cafc22ea6c979a31cf9fd79f2126e Mon Sep 17 00:00:00 2001 From: daphnehanse11 <128793799+daphnehanse11@users.noreply.github.com> Date: Fri, 9 Jun 2023 10:46:06 -0400 Subject: [PATCH 01/20] git practice --- R/hello.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/hello.R b/R/hello.R index aad5c3b..52820b1 100644 --- a/R/hello.R +++ b/R/hello.R @@ -1,5 +1,5 @@ # @ -# +# I am practicing pushing/commiting with git # This is an example function named 'hello' # which prints 'Hello, world!'. # From 8d6b1390c0bbdfd6dcbb1736e9ad68645fae4950 Mon Sep 17 00:00:00 2001 From: daphnehanse11 <128793799+daphnehanse11@users.noreply.github.com> Date: Tue, 13 Jun 2023 10:00:03 -0400 Subject: [PATCH 02/20] Create .Rapp.history --- data/.Rapp.history | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 data/.Rapp.history diff --git a/data/.Rapp.history b/data/.Rapp.history new file mode 100644 index 0000000..d5369f9 --- /dev/null +++ b/data/.Rapp.history @@ -0,0 +1,3 @@ +load("/Users/dhansell/Documents/GitHub/balselr/data/example_vcf.rda") +load("/Users/dhansell/Documents/GitHub/balselr/data/example_vcf.rda") +print("example_vcf.rda) From 001be297c5188db7e720093e709a96d06c754784 Mon Sep 17 00:00:00 2001 From: daphnehanse11 <128793799+daphnehanse11@users.noreply.github.com> Date: Tue, 13 Jun 2023 10:09:32 -0400 Subject: [PATCH 03/20] practice practice --- R/read_vcf.R | 1 + R/vcfpractice.R | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 R/vcfpractice.R diff --git a/R/read_vcf.R b/R/read_vcf.R index f6f22cd..7ab6b6d 100644 --- a/R/read_vcf.R +++ b/R/read_vcf.R @@ -22,3 +22,4 @@ read_vcf <- function(x = "inst/example.vcf", inp } } + diff --git a/R/vcfpractice.R b/R/vcfpractice.R new file mode 100644 index 0000000..2812dbc --- /dev/null +++ b/R/vcfpractice.R @@ -0,0 +1,6 @@ +library("data.table") +chrom_21b<-read_vcf("~/Documents/ALL.chr21.shapeit2_integrated_v1a.GRCh38.20181129.phased.vcf") + +read_vcf(example_vcf) + +parse_vcf("~/Documents/ALL.chr21.shapeit2_integrated_v1a.GRCh38.20181129.phased.vcf") From 29fe23590788010696b0fb14775450a46247d1f4 Mon Sep 17 00:00:00 2001 From: daphnehanse11 <128793799+daphnehanse11@users.noreply.github.com> Date: Wed, 14 Jun 2023 11:10:18 -0400 Subject: [PATCH 04/20] Update vcfpractice.R --- R/vcfpractice.R | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/R/vcfpractice.R b/R/vcfpractice.R index 2812dbc..b45858f 100644 --- a/R/vcfpractice.R +++ b/R/vcfpractice.R @@ -1,6 +1,7 @@ library("data.table") -chrom_21b<-read_vcf("~/Documents/ALL.chr21.shapeit2_integrated_v1a.GRCh38.20181129.phased.vcf") -read_vcf(example_vcf) -parse_vcf("~/Documents/ALL.chr21.shapeit2_integrated_v1a.GRCh38.20181129.phased.vcf") +read_vcf("example_vcf") + +read_vcf("chrom22.vcf") +parse_vcf("chrom22.vcf", type = "ncd1") From 2e18ac8c074fabe6233b423fa42798e99a9e5174 Mon Sep 17 00:00:00 2001 From: daphnehanse11 <128793799+daphnehanse11@users.noreply.github.com> Date: Wed, 14 Jun 2023 14:08:07 -0400 Subject: [PATCH 05/20] dot removal --- R/count_alleles.R | 8 ++++---- R/read_vcf.R | 2 +- R/split_geno.R | 2 +- R/vcf_ncd1.R | 6 +++--- R/vcfpractice.R | 7 +++++-- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/R/count_alleles.R b/R/count_alleles.R index ee66be5..95fda27 100644 --- a/R/count_alleles.R +++ b/R/count_alleles.R @@ -7,11 +7,11 @@ #' @param index 1 or 2 or c(1,2). Which alleles to consider. #' @examples data.table::data.table(col1="1|1", col2="1|0", col3="0|0") %>% #' dplyr::summarise(across(col1:col3, .count_alleles)) -.count_alleles<-function(x, split="|",index=c(1,2), der = F){ - x<-.split_geno(x = x, split = split, index = index) +count_alleles<-function(x, split="|",index=c(1,2), der = F){ + x<-split_geno(x = x, split = split, index = index) if(der == T){sum(x, na.rm=T)}else if (der == F){sum(!is.na(x))-sum(x, na.rm=T)} } -.count_nonmissing<-function(x, split="|",index=c(1,2)){ - x<-.split_geno(x = x, split = split, index = index) +count_nonmissing<-function(x, split="|",index=c(1,2)){ + x<-split_geno(x = x, split = split, index = index) sum(!is.na(x)) } diff --git a/R/read_vcf.R b/R/read_vcf.R index 7ab6b6d..90a8b17 100644 --- a/R/read_vcf.R +++ b/R/read_vcf.R @@ -6,7 +6,7 @@ #' @return Returns a data.table object #' @export #' -#' @examples read_vcf(x="inst/example.vcf", only.bi=T, inds="all") +#' @examples read_vcf(x="inst/example.vcf", only.bi=T") #' @import data.table #' @importFrom data.table ":=" read_vcf <- function(x = "inst/example.vcf", diff --git a/R/split_geno.R b/R/split_geno.R index 0f9c83f..db57260 100644 --- a/R/split_geno.R +++ b/R/split_geno.R @@ -6,7 +6,7 @@ #' #' @examples split_geno(x = c("0|0","0|1","1|1")) #' data.table(col1="1|1", col2="1|0", col3="0|0") %>% dplyr::summarise(across(col1:col3, .split_geno)) -.split_geno <- function(x, split="|",index=c(1,2)) { +split_geno <- function(x, split="|",index=c(1,2)) { #assertthat::assert_that(is.numeric(which.al), err = "Parameter which.al must be numeric") if(length(x) == 1){ diff --git a/R/vcf_ncd1.R b/R/vcf_ncd1.R index de31165..cc646b5 100644 --- a/R/vcf_ncd1.R +++ b/R/vcf_ncd1.R @@ -13,7 +13,7 @@ #' @examples inp = read_vcf("inst/example.vcf") #' vcf_ncd1(x=inp, outfile=outfile_path("inst/example.vcf"),nind=c(108), #' .vcf_ncd1(x=inp, outfile=outfile_path("inst/example.vcf"),nind=108, index.col=10, verbose=T) -.vcf_ncd1 <- function(x, +vcf_ncd1 <- function(x, outfile = outfile, nind = nind, index.col = index.col, @@ -45,11 +45,11 @@ tableout<-dplyr::bind_cols(tableout, x %>% dplyr::select(all_of(pop0_cols)) %>% dplyr::rowwise() %>% - dplyr::summarise(across(pop0_cols, .count_alleles)) %>% + dplyr::summarise(across(pop0_cols, count_alleles)) %>% dplyr::summarise(tx_1 = Reduce(`+`,.)), x %>% dplyr::select(all_of(pop0_cols)) %>% dplyr::rowwise() %>% - dplyr::summarise(across(pop0_cols, .count_nonmissing)) %>% + dplyr::summarise(across(pop0_cols, count_nonmissing)) %>% dplyr::summarise(tn_1 = Reduce(`+`,.)) ) %>% dplyr::select(CHR, POS, REF, ALT, tx_1, tn_1) %>% diff --git a/R/vcfpractice.R b/R/vcfpractice.R index b45858f..39cf016 100644 --- a/R/vcfpractice.R +++ b/R/vcfpractice.R @@ -3,5 +3,8 @@ library("data.table") read_vcf("example_vcf") -read_vcf("chrom22.vcf") -parse_vcf("chrom22.vcf", type = "ncd1") + +read_vcf("/Users/dhansell/Documents/GitHub//chrom22.vcf") +parsed_vcf22<-parse_vcf("/Users/dhansell/Documents/GitHub//chrom22.vcf", type = "ncd1") + +stat22<-ncd1(parsed_vcf22) From 8f705a410a337e3707eed85c811df56e659048d1 Mon Sep 17 00:00:00 2001 From: daphnehanse11 <128793799+daphnehanse11@users.noreply.github.com> Date: Wed, 14 Jun 2023 16:09:46 -0400 Subject: [PATCH 06/20] dot removal 2 --- R/parse_vcf.R | 2 +- R/vcfpractice.R | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/R/parse_vcf.R b/R/parse_vcf.R index 91126e6..563cc36 100644 --- a/R/parse_vcf.R +++ b/R/parse_vcf.R @@ -98,7 +98,7 @@ parse_vcf <- ) } else if (type == "ncd1") { res <- - .vcf_ncd1( + vcf_ncd1( x = inp, outfile = outfile, nind = nind, diff --git a/R/vcfpractice.R b/R/vcfpractice.R index 39cf016..aecdb97 100644 --- a/R/vcfpractice.R +++ b/R/vcfpractice.R @@ -6,5 +6,13 @@ read_vcf("example_vcf") read_vcf("/Users/dhansell/Documents/GitHub//chrom22.vcf") parsed_vcf22<-parse_vcf("/Users/dhansell/Documents/GitHub//chrom22.vcf", type = "ncd1") - stat22<-ncd1(parsed_vcf22) + + + +read_vcf("/Users/dhansell/Documents/GitHub//chrom13.vcf") +parsed_vcf13<-parse_vcf("/Users/dhansell/Documents/GitHub//chrom13.vcf", type = "ncd1") +stat13<-ncd1(parsed_vcf13) + +devtools::install_github("bitarellolab/balselr") +library(balselr) From 03f53fae3fef30b80eb2af4652e4eead8d7893e7 Mon Sep 17 00:00:00 2001 From: daphnehanse11 <128793799+daphnehanse11@users.noreply.github.com> Date: Thu, 15 Jun 2023 10:37:45 -0400 Subject: [PATCH 07/20] returning dots --- R/count_alleles.R | 8 ++++---- R/ncd1.R | 1 + R/parse_vcf.R | 2 +- R/split_geno.R | 2 +- R/vcf_ncd1.R | 6 +++--- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/R/count_alleles.R b/R/count_alleles.R index 95fda27..ee66be5 100644 --- a/R/count_alleles.R +++ b/R/count_alleles.R @@ -7,11 +7,11 @@ #' @param index 1 or 2 or c(1,2). Which alleles to consider. #' @examples data.table::data.table(col1="1|1", col2="1|0", col3="0|0") %>% #' dplyr::summarise(across(col1:col3, .count_alleles)) -count_alleles<-function(x, split="|",index=c(1,2), der = F){ - x<-split_geno(x = x, split = split, index = index) +.count_alleles<-function(x, split="|",index=c(1,2), der = F){ + x<-.split_geno(x = x, split = split, index = index) if(der == T){sum(x, na.rm=T)}else if (der == F){sum(!is.na(x))-sum(x, na.rm=T)} } -count_nonmissing<-function(x, split="|",index=c(1,2)){ - x<-split_geno(x = x, split = split, index = index) +.count_nonmissing<-function(x, split="|",index=c(1,2)){ + x<-.split_geno(x = x, split = split, index = index) sum(!is.na(x)) } diff --git a/R/ncd1.R b/R/ncd1.R index c7ad866..fefea79 100644 --- a/R/ncd1.R +++ b/R/ncd1.R @@ -28,6 +28,7 @@ ncd1 <- function(x = x, tf = 0.5, fold = T, + w = 3000, by.snp = TRUE, mid = FALSE, diff --git a/R/parse_vcf.R b/R/parse_vcf.R index 563cc36..91126e6 100644 --- a/R/parse_vcf.R +++ b/R/parse_vcf.R @@ -98,7 +98,7 @@ parse_vcf <- ) } else if (type == "ncd1") { res <- - vcf_ncd1( + .vcf_ncd1( x = inp, outfile = outfile, nind = nind, diff --git a/R/split_geno.R b/R/split_geno.R index db57260..0f9c83f 100644 --- a/R/split_geno.R +++ b/R/split_geno.R @@ -6,7 +6,7 @@ #' #' @examples split_geno(x = c("0|0","0|1","1|1")) #' data.table(col1="1|1", col2="1|0", col3="0|0") %>% dplyr::summarise(across(col1:col3, .split_geno)) -split_geno <- function(x, split="|",index=c(1,2)) { +.split_geno <- function(x, split="|",index=c(1,2)) { #assertthat::assert_that(is.numeric(which.al), err = "Parameter which.al must be numeric") if(length(x) == 1){ diff --git a/R/vcf_ncd1.R b/R/vcf_ncd1.R index cc646b5..de31165 100644 --- a/R/vcf_ncd1.R +++ b/R/vcf_ncd1.R @@ -13,7 +13,7 @@ #' @examples inp = read_vcf("inst/example.vcf") #' vcf_ncd1(x=inp, outfile=outfile_path("inst/example.vcf"),nind=c(108), #' .vcf_ncd1(x=inp, outfile=outfile_path("inst/example.vcf"),nind=108, index.col=10, verbose=T) -vcf_ncd1 <- function(x, +.vcf_ncd1 <- function(x, outfile = outfile, nind = nind, index.col = index.col, @@ -45,11 +45,11 @@ vcf_ncd1 <- function(x, tableout<-dplyr::bind_cols(tableout, x %>% dplyr::select(all_of(pop0_cols)) %>% dplyr::rowwise() %>% - dplyr::summarise(across(pop0_cols, count_alleles)) %>% + dplyr::summarise(across(pop0_cols, .count_alleles)) %>% dplyr::summarise(tx_1 = Reduce(`+`,.)), x %>% dplyr::select(all_of(pop0_cols)) %>% dplyr::rowwise() %>% - dplyr::summarise(across(pop0_cols, count_nonmissing)) %>% + dplyr::summarise(across(pop0_cols, .count_nonmissing)) %>% dplyr::summarise(tn_1 = Reduce(`+`,.)) ) %>% dplyr::select(CHR, POS, REF, ALT, tx_1, tn_1) %>% From 9d23726eb6834ec7ae874c420c2a339495dce3e7 Mon Sep 17 00:00:00 2001 From: daphnehanse11 <128793799+daphnehanse11@users.noreply.github.com> Date: Fri, 16 Jun 2023 12:42:50 -0400 Subject: [PATCH 08/20] correcting user error --- R/parse_vcf.R | 10 ++++++---- R/read_vcf.R | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/R/parse_vcf.R b/R/parse_vcf.R index 91126e6..2499e8d 100644 --- a/R/parse_vcf.R +++ b/R/parse_vcf.R @@ -22,9 +22,9 @@ parse_vcf <- function(infile = "*.vcf", outfile = NULL, - n0=108, - n1=NULL, - type = "ncd2", + n0= NULL, + n1= NULL, + type = NULL, fold = T, intern = T, verbose = T) { @@ -32,7 +32,9 @@ parse_vcf <- assertthat::assert_that(file.exists(infile), msg = glue::glue("VCF file {infile} does not exist.\n") ) - type <- tolower(type) + assertthat::assert_that(is.numeric(n0) + ) + type <- tolower(type) # Index No. of the individual to use as ``ancestral'' sequence if (fold == F & type == "ncd2") { outseq <- (index.col) + (sum(nind) - 1) diff --git a/R/read_vcf.R b/R/read_vcf.R index 90a8b17..773eb7d 100644 --- a/R/read_vcf.R +++ b/R/read_vcf.R @@ -22,4 +22,3 @@ read_vcf <- function(x = "inst/example.vcf", inp } } - From 916b6d99a9a6438af69a9f4d46d985fe0057e5f6 Mon Sep 17 00:00:00 2001 From: daphnehanse11 <128793799+daphnehanse11@users.noreply.github.com> Date: Fri, 16 Jun 2023 16:41:58 -0400 Subject: [PATCH 09/20] Update read_vcf.R --- R/read_vcf.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/read_vcf.R b/R/read_vcf.R index 7ab6b6d..90a8b17 100644 --- a/R/read_vcf.R +++ b/R/read_vcf.R @@ -6,7 +6,7 @@ #' @return Returns a data.table object #' @export #' -#' @examples read_vcf(x="inst/example.vcf", only.bi=T, inds="all") +#' @examples read_vcf(x="inst/example.vcf", only.bi=T") #' @import data.table #' @importFrom data.table ":=" read_vcf <- function(x = "inst/example.vcf", From b20552f34e5eb6517cace072d33c3e2b8bd8721b Mon Sep 17 00:00:00 2001 From: daphnehanse11 <128793799+daphnehanse11@users.noreply.github.com> Date: Tue, 20 Jun 2023 11:05:05 -0400 Subject: [PATCH 10/20] correcting user error --- R/parse_vcf.R | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/R/parse_vcf.R b/R/parse_vcf.R index 2499e8d..34b4721 100644 --- a/R/parse_vcf.R +++ b/R/parse_vcf.R @@ -34,9 +34,26 @@ parse_vcf <- ) assertthat::assert_that(is.numeric(n0) ) - type <- tolower(type) - # Index No. of the individual to use as ``ancestral'' sequence - if (fold == F & type == "ncd2") { + format_type <- function(type) { + incorrect_types_ncd1 <- c("ncd1", "ned1", "ncd_1", "ned_1") + incorrect_types_ncd2 <- c("ncd2", "ned2", "ncd_2", "ned_2") + + type <- tolower(type) + if (type %in% incorrect_types_ncd1) { + type <- "ncd1" + } else if (type %in% incorrect_types_ncd2) { + type <- "ncd2" + } + + return(type) + + } + if (is.null(type)) { + print("You must choose either 'ncd1' or 'ncd2'") + return(NULL) + } + # Index No. of the individual to use as ``ancestral'' sequence + if (fold == F & type == "ncd2") { outseq <- (index.col) + (sum(nind) - 1) if (verbose == T) { cat( From ec1a25994f5f6b2167becd3a27576e86e5c59b8e Mon Sep 17 00:00:00 2001 From: daphnehanse11 <128793799+daphnehanse11@users.noreply.github.com> Date: Wed, 21 Jun 2023 12:01:41 -0400 Subject: [PATCH 11/20] Update vcfpractice.R --- R/vcfpractice.R | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/R/vcfpractice.R b/R/vcfpractice.R index aecdb97..5726fd4 100644 --- a/R/vcfpractice.R +++ b/R/vcfpractice.R @@ -1,18 +1,18 @@ -library("data.table") +#library("data.table") -read_vcf("example_vcf") +#read_vcf("example_vcf") -read_vcf("/Users/dhansell/Documents/GitHub//chrom22.vcf") -parsed_vcf22<-parse_vcf("/Users/dhansell/Documents/GitHub//chrom22.vcf", type = "ncd1") -stat22<-ncd1(parsed_vcf22) +#read_vcf("/Users/dhansell/Documents/GitHub//chrom22.vcf") +#parsed_vcf22<-parse_vcf("/Users/dhansell/Documents/GitHub//chrom22.vcf", type = "ncd1") +#stat22<-ncd1(parsed_vcf22) -read_vcf("/Users/dhansell/Documents/GitHub//chrom13.vcf") -parsed_vcf13<-parse_vcf("/Users/dhansell/Documents/GitHub//chrom13.vcf", type = "ncd1") -stat13<-ncd1(parsed_vcf13) +#read_vcf("/Users/dhansell/Documents/GitHub//chrom13.vcf") +#parsed_vcf13<-parse_vcf("/Users/dhansell/Documents/GitHub//chrom13.vcf", type = "ncd1") +#stat13<-ncd1(parsed_vcf13) -devtools::install_github("bitarellolab/balselr") -library(balselr) +#devtools::install_github("bitarellolab/balselr") +#library(balselr) From 0b57a6c67defaadfbfc69eb9ec2e3f6a956e96c5 Mon Sep 17 00:00:00 2001 From: daphnehanse11 <128793799+daphnehanse11@users.noreply.github.com> Date: Wed, 21 Jun 2023 15:46:05 -0400 Subject: [PATCH 12/20] working on tests --- tests/test-readvcf.R | 0 tests/testthat.R | 5 ----- 2 files changed, 5 deletions(-) create mode 100644 tests/test-readvcf.R diff --git a/tests/test-readvcf.R b/tests/test-readvcf.R new file mode 100644 index 0000000..e69de29 diff --git a/tests/testthat.R b/tests/testthat.R index 29ea3ab..a621d1c 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -5,8 +5,3 @@ # Learn more about the roles of various files in: # * https://r-pkgs.org/tests.html # * https://testthat.r-lib.org/reference/test_package.html#special-files - -library(testthat) -library(balselr) - -test_check("balselr") From b0297ba929a629fb653ba2b7efc2aca299ce9f71 Mon Sep 17 00:00:00 2001 From: daphnehanse11 <128793799+daphnehanse11@users.noreply.github.com> Date: Thu, 22 Jun 2023 10:15:54 -0400 Subject: [PATCH 13/20] Update test-readvcf.R --- tests/test-readvcf.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test-readvcf.R b/tests/test-readvcf.R index e69de29..cd0beb7 100644 --- a/tests/test-readvcf.R +++ b/tests/test-readvcf.R @@ -0,0 +1,2 @@ +#the output should be a data.table +#the output should From 79fc2e3e17f705cc4bc54b4923141b1be44290bd Mon Sep 17 00:00:00 2001 From: daphnehanse11 <128793799+daphnehanse11@users.noreply.github.com> Date: Thu, 22 Jun 2023 12:31:03 -0400 Subject: [PATCH 14/20] writing tests --- man/read_vcf.Rd | 3 --- tests/test-readvcf.R | 8 +++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/man/read_vcf.Rd b/man/read_vcf.Rd index 1356f73..f12cc87 100644 --- a/man/read_vcf.Rd +++ b/man/read_vcf.Rd @@ -18,6 +18,3 @@ Returns a data.table object \description{ Read vcf } -\examples{ -read_vcf(x="inst/example.vcf", only.bi=T, inds="all") -} diff --git a/tests/test-readvcf.R b/tests/test-readvcf.R index cd0beb7..b07d954 100644 --- a/tests/test-readvcf.R +++ b/tests/test-readvcf.R @@ -1,2 +1,8 @@ #the output should be a data.table -#the output should + +testthat::test_that("output is a data table", { + readinvcf <- read_vcf(x="inst/example.vcf") + testthat::expect_type(readinvcf, "data.frame") +}) + + From 165b56496a36a7415abbfd33ff09477ef51d481c Mon Sep 17 00:00:00 2001 From: daphnehanse11 <128793799+daphnehanse11@users.noreply.github.com> Date: Thu, 22 Jun 2023 12:41:04 -0400 Subject: [PATCH 15/20] more tests --- tests/test-readvcf.R | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test-readvcf.R b/tests/test-readvcf.R index b07d954..d2610e8 100644 --- a/tests/test-readvcf.R +++ b/tests/test-readvcf.R @@ -1,8 +1,11 @@ #the output should be a data.table testthat::test_that("output is a data table", { - readinvcf <- read_vcf(x="inst/example.vcf") + readinvcf <- read_vcf(x="inst/example.vcf", only.bi = TRUE) testthat::expect_type(readinvcf, "data.frame") }) - +testthat::test_that("read_vcf correctly renames column", { + readinvcf <- read_vcf(vcf_file_path, only.bi = TRUE) + testthat::expect_true("CHR" %in% colnames(readinvcf)) +}) From d611326d74ac6680792e1102db41de44a031f4e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1rbara=20Bitarello?= Date: Thu, 18 Apr 2024 12:03:33 -0400 Subject: [PATCH 16/20] Delete hello.R --- R/hello.R | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 R/hello.R diff --git a/R/hello.R b/R/hello.R deleted file mode 100644 index 52820b1..0000000 --- a/R/hello.R +++ /dev/null @@ -1,18 +0,0 @@ -# @ -# I am practicing pushing/commiting with git -# This is an example function named 'hello' -# which prints 'Hello, world!'. -# -# You can learn more about package authoring with RStudio at: -# -# v -# -# Some useful keyboard shortcuts for package authoring: -# -# Install Package: 'Cmd + Shift + B' -# Check Package: 'Cmd + Shift + E' -# Test Package: 'Cmd + Shift + T' -#' @export -hello <- function() { - print("Hello, world!") -} From 122f4e6fcb0a291df008ca88814592abfb74641b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1rbara=20Bitarello?= Date: Thu, 18 Apr 2024 12:33:03 -0400 Subject: [PATCH 17/20] asfdasfs --- R/vcfpractice.R | 18 - example_parse_ncd2.out_ncd2.out | 839 -------------------------------- 2 files changed, 857 deletions(-) delete mode 100644 R/vcfpractice.R delete mode 100644 example_parse_ncd2.out_ncd2.out diff --git a/R/vcfpractice.R b/R/vcfpractice.R deleted file mode 100644 index 5726fd4..0000000 --- a/R/vcfpractice.R +++ /dev/null @@ -1,18 +0,0 @@ -#library("data.table") - - -#read_vcf("example_vcf") - - -#read_vcf("/Users/dhansell/Documents/GitHub//chrom22.vcf") -#parsed_vcf22<-parse_vcf("/Users/dhansell/Documents/GitHub//chrom22.vcf", type = "ncd1") -#stat22<-ncd1(parsed_vcf22) - - - -#read_vcf("/Users/dhansell/Documents/GitHub//chrom13.vcf") -#parsed_vcf13<-parse_vcf("/Users/dhansell/Documents/GitHub//chrom13.vcf", type = "ncd1") -#stat13<-ncd1(parsed_vcf13) - -#devtools::install_github("bitarellolab/balselr") -#library(balselr) diff --git a/example_parse_ncd2.out_ncd2.out b/example_parse_ncd2.out_ncd2.out deleted file mode 100644 index dcafcbb..0000000 --- a/example_parse_ncd2.out_ncd2.out +++ /dev/null @@ -1,839 +0,0 @@ -CHR POS REF ALT tx_1 tn_1 tx_2 tn_2 -1 92 A C 0 216 2 2 -1 177 C A 0 216 2 2 -1 283 T C 216 216 2 2 -1 289 C G 216 216 0 2 -1 327 G T 216 216 1 2 -1 331 T C 216 216 2 2 -1 332 C A 216 216 2 2 -1 368 A G 216 216 2 2 -1 382 A C 216 216 2 2 -1 394 A G 0 216 2 2 -1 398 C T 215 216 2 2 -1 441 C G 216 216 2 2 -1 471 C A 216 216 1 2 -1 473 A C 0 216 2 2 -1 522 A G 216 216 2 2 -1 568 C A 0 216 2 2 -1 585 T C 216 216 0 2 -1 627 A T 83 216 2 2 -1 669 C T 216 216 0 2 -1 674 T A 216 216 2 2 -1 687 C G 216 216 2 2 -1 706 T G 216 216 2 2 -1 719 C T 0 216 2 2 -1 743 A C 216 216 2 2 -1 835 G A 216 216 2 2 -1 868 C G 0 216 2 2 -1 904 A T 216 216 1 2 -1 956 C G 149 216 2 2 -1 976 C G 216 216 2 2 -1 1053 A G 216 216 2 2 -1 1155 A G 211 216 2 2 -1 1216 T A 216 216 2 2 -1 1290 G T 0 216 2 2 -1 1321 C G 216 216 0 2 -1 1328 C G 216 216 0 2 -1 1336 A G 213 216 2 2 -1 1345 G C 216 216 2 2 -1 1363 T G 0 216 0 2 -1 1365 T G 212 216 2 2 -1 1441 T A 212 216 2 2 -1 1456 G T 0 216 2 2 -1 1483 G C 160 216 2 2 -1 1497 T G 216 216 2 2 -1 1525 T G 0 216 2 2 -1 1561 T A 216 216 2 2 -1 1621 C A 0 216 0 2 -1 1685 A G 216 216 2 2 -1 1714 G A 216 216 2 2 -1 1721 G C 216 216 2 2 -1 1763 T A 216 216 1 2 -1 1798 A C 216 216 0 2 -1 1830 G A 214 216 2 2 -1 1865 C A 0 216 2 2 -1 1866 C T 93 216 2 2 -1 1919 G T 216 216 0 2 -1 1972 A C 215 216 2 2 -1 1981 A G 214 216 2 2 -1 1992 T A 216 216 2 2 -1 1995 A C 216 216 2 2 -1 2031 C A 216 216 2 2 -1 2085 G A 0 216 2 2 -1 2201 C A 216 216 0 2 -1 2212 T A 216 216 2 2 -1 2219 T A 215 216 2 2 -1 2261 A T 216 216 0 2 -1 2296 C T 216 216 0 2 -1 2346 A G 216 216 1 2 -1 2373 A C 215 216 2 2 -1 2376 G A 216 216 1 2 -1 2450 T C 202 216 2 2 -1 2463 C G 216 216 2 2 -1 2496 C T 209 216 2 2 -1 2607 T C 216 216 2 2 -1 2666 G T 216 216 0 2 -1 2766 T G 216 216 2 2 -1 2778 A C 216 216 2 2 -1 2810 T A 202 216 2 2 -1 2819 G A 216 216 0 2 -1 2827 A C 216 216 1 2 -1 2838 A G 216 216 2 2 -1 2861 C A 216 216 2 2 -1 2880 G T 0 216 2 2 -1 2911 A T 216 216 0 2 -1 2953 T A 213 216 2 2 -1 2955 C A 0 216 2 2 -1 2960 C A 216 216 0 2 -1 2969 C T 216 216 2 2 -1 2973 A T 216 216 2 2 -1 2979 T G 216 216 2 2 -1 3030 T G 0 216 2 2 -1 3033 T A 190 216 2 2 -1 3039 T C 203 216 2 2 -1 3048 G T 216 216 1 2 -1 3110 T A 216 216 2 2 -1 3167 C A 0 216 2 2 -1 3196 T A 0 216 2 2 -1 3201 A C 216 216 2 2 -1 3276 T C 216 216 1 2 -1 3279 G A 206 216 2 2 -1 3310 T G 215 216 2 2 -1 3321 G T 216 216 2 2 -1 3339 G T 216 216 2 2 -1 3351 T C 216 216 0 2 -1 3470 T A 0 216 2 2 -1 3476 C G 216 216 1 2 -1 3486 T A 214 216 2 2 -1 3506 C A 216 216 1 2 -1 3536 A G 213 216 2 2 -1 3542 G T 216 216 1 2 -1 3569 C A 216 216 2 2 -1 3604 G T 216 216 0 2 -1 3605 T G 216 216 0 2 -1 3609 C G 0 216 0 2 -1 3627 A G 216 216 0 2 -1 3643 T A 216 216 2 2 -1 3720 A G 216 216 2 2 -1 3725 G T 214 216 2 2 -1 3782 G A 0 216 2 2 -1 3845 G A 115 216 2 2 -1 3880 T C 216 216 0 2 -1 3929 A T 216 216 1 2 -1 3971 A C 216 216 2 2 -1 4001 A G 216 216 2 2 -1 4022 T G 216 216 0 2 -1 4026 G C 216 216 2 2 -1 4034 A T 215 216 2 2 -1 4129 T C 0 216 2 2 -1 4138 C A 0 216 2 2 -1 4162 T G 101 216 2 2 -1 4200 G C 216 216 2 2 -1 4276 T A 216 216 2 2 -1 4341 A T 214 216 2 2 -1 4436 C T 216 216 2 2 -1 4579 C T 216 216 0 2 -1 4590 T C 216 216 0 2 -1 4663 T G 195 216 2 2 -1 4797 A G 216 216 0 2 -1 4841 A G 191 216 2 2 -1 4918 C G 216 216 2 2 -1 4940 A G 216 216 2 2 -1 5062 C G 101 216 2 2 -1 5087 C A 216 216 2 2 -1 5146 G A 216 216 2 2 -1 5176 T C 216 216 2 2 -1 5212 T A 216 216 1 2 -1 5309 T C 216 216 2 2 -1 5321 A G 216 216 2 2 -1 5481 G T 215 216 2 2 -1 5483 C T 216 216 2 2 -1 5507 T A 0 216 2 2 -1 5508 T G 216 216 2 2 -1 5509 G C 214 216 2 2 -1 5522 G C 216 216 1 2 -1 5532 C A 216 216 0 2 -1 5590 G C 216 216 2 2 -1 5657 G T 216 216 0 2 -1 5692 A G 0 216 2 2 -1 5727 C A 216 216 2 2 -1 5807 T C 216 216 0 2 -1 5831 T A 115 216 2 2 -1 5832 T C 216 216 0 2 -1 5855 C T 216 216 2 2 -1 5898 A T 0 216 2 2 -1 5949 A G 216 216 2 2 -1 5954 A C 216 216 1 2 -1 5967 G T 216 216 2 2 -1 5978 T G 216 216 2 2 -1 6052 A C 216 216 2 2 -1 6149 C A 216 216 2 2 -1 6330 C A 216 216 0 2 -1 6438 G A 216 216 2 2 -1 6650 T C 0 216 2 2 -1 6702 G C 216 216 0 2 -1 6738 C G 115 216 2 2 -1 6790 C T 179 216 2 2 -1 6794 C A 216 216 2 2 -1 6901 G C 216 216 0 2 -1 6921 G T 216 216 0 2 -1 6978 G C 216 216 0 2 -1 6994 A C 0 216 2 2 -1 7017 T G 214 216 2 2 -1 7020 A C 216 216 2 2 -1 7049 C G 216 216 0 2 -1 7061 G T 216 216 2 2 -1 7062 T A 216 216 2 2 -1 7080 A C 203 216 2 2 -1 7098 A T 216 216 1 2 -1 7151 A T 216 216 0 2 -1 7161 G A 0 216 2 2 -1 7239 A G 216 216 0 2 -1 7323 T G 0 216 2 2 -1 7332 A C 216 216 0 2 -1 7354 A G 216 216 0 2 -1 7387 T A 0 216 2 2 -1 7394 C G 0 216 2 2 -1 7418 C G 214 216 2 2 -1 7464 T G 216 216 0 2 -1 7580 T C 214 216 2 2 -1 7604 C T 101 216 2 2 -1 7615 T A 216 216 0 2 -1 7640 G A 216 216 0 2 -1 7679 T G 216 216 1 2 -1 7724 G T 216 216 1 2 -1 7730 T C 216 216 2 2 -1 7736 G A 216 216 0 2 -1 7816 T C 215 216 2 2 -1 7822 G C 214 216 2 2 -1 7831 T A 216 216 0 2 -1 7838 G C 216 216 2 2 -1 7899 A G 216 216 2 2 -1 7976 A G 216 216 2 2 -1 8007 G T 179 216 2 2 -1 8097 A C 216 216 2 2 -1 8153 T G 216 216 2 2 -1 8163 A G 100 216 2 2 -1 8165 G A 116 216 2 2 -1 8236 A C 185 216 2 2 -1 8247 A C 216 216 2 2 -1 8251 C T 0 216 2 2 -1 8311 A C 0 216 2 2 -1 8341 A T 215 216 2 2 -1 8344 T G 215 216 2 2 -1 8357 C A 0 216 2 2 -1 8365 G T 0 216 2 2 -1 8440 T C 216 216 0 2 -1 8461 G T 0 216 2 2 -1 8468 T C 216 216 0 2 -1 8474 T G 0 216 2 2 -1 8571 C A 216 216 1 2 -1 8592 C A 216 216 1 2 -1 8594 C T 100 216 2 2 -1 8698 G C 216 216 2 2 -1 8778 C T 0 216 2 2 -1 8793 T C 216 216 0 2 -1 8801 C T 216 216 2 2 -1 8859 T C 215 216 2 2 -1 8883 A T 216 216 1 2 -1 8889 T C 216 216 2 2 -1 8891 G A 216 216 1 2 -1 8905 G C 0 216 2 2 -1 8946 T C 216 216 1 2 -1 8997 T G 216 216 0 2 -1 9011 C A 113 216 2 2 -1 9017 A T 216 216 2 2 -1 9020 A C 216 216 1 2 -1 9061 G A 216 216 1 2 -1 9080 A T 215 216 2 2 -1 9125 G A 216 216 1 2 -1 9137 C G 216 216 0 2 -1 9147 C T 216 216 2 2 -1 9196 A C 216 216 2 2 -1 9248 T A 216 216 2 2 -1 9260 T A 216 216 1 2 -1 9274 C G 216 216 2 2 -1 9298 C T 216 216 2 2 -1 9340 G C 216 216 2 2 -1 9373 T C 216 216 0 2 -1 9427 A G 216 216 1 2 -1 9447 A C 216 216 2 2 -1 9477 A G 216 216 2 2 -1 9497 G A 216 216 1 2 -1 9522 A T 117 216 2 2 -1 9572 A G 99 216 2 2 -1 9586 T G 216 216 2 2 -1 9608 T G 216 216 0 2 -1 9612 G T 216 216 0 2 -1 9625 C T 0 216 2 2 -1 9647 A T 216 216 1 2 -1 9665 C A 216 216 2 2 -1 9695 T C 99 216 2 2 -1 9716 G A 196 216 2 2 -1 9718 T A 216 216 1 2 -1 9763 C G 216 216 1 2 -1 9770 C A 117 216 2 2 -1 9895 C A 0 216 0 2 -1 9932 G T 216 216 1 2 -1 9937 G C 0 216 2 2 -1 9957 C G 216 216 2 2 -1 9962 C A 216 216 1 2 -1 9969 G T 215 216 2 2 -1 9978 A T 158 216 2 2 -1 9985 G A 216 216 0 2 -1 10015 T G 216 216 2 2 -1 10039 C A 99 216 2 2 -1 10042 A C 184 216 2 2 -1 10089 C A 216 216 1 2 -1 10172 G A 215 216 2 2 -1 10227 T G 216 216 2 2 -1 10243 A T 216 216 2 2 -1 10249 C T 216 216 2 2 -1 10268 G A 212 216 2 2 -1 10303 T G 0 216 0 2 -1 10336 G C 204 216 2 2 -1 10406 T C 216 216 2 2 -1 10407 T C 214 216 2 2 -1 10449 G C 216 216 0 2 -1 10450 C T 0 216 2 2 -1 10469 A C 0 216 2 2 -1 10489 A C 215 216 2 2 -1 10497 C A 216 216 0 2 -1 10505 T A 215 216 2 2 -1 10565 G T 216 216 1 2 -1 10669 G T 216 216 0 2 -1 10700 G T 216 216 2 2 -1 10778 G A 216 216 0 2 -1 10926 G A 216 216 0 2 -1 10954 G T 216 216 0 2 -1 10961 A T 0 216 2 2 -1 10968 C T 204 216 2 2 -1 11061 A C 0 216 2 2 -1 11080 T G 216 216 2 2 -1 11123 A T 205 216 2 2 -1 11147 T G 0 216 2 2 -1 11161 A T 215 216 2 2 -1 11228 G A 216 216 1 2 -1 11240 T A 215 216 2 2 -1 11249 G C 216 216 0 2 -1 11252 A T 216 216 1 2 -1 11286 T C 213 216 2 2 -1 11363 G A 162 216 2 2 -1 11414 G A 216 216 2 2 -1 11560 G C 216 216 0 2 -1 11570 C A 0 216 2 2 -1 11607 T A 191 216 2 2 -1 11625 T C 216 216 0 2 -1 11685 G A 0 216 2 2 -1 11698 T A 216 216 2 2 -1 11711 T G 0 216 2 2 -1 11720 A T 216 216 2 2 -1 11860 C G 150 216 2 2 -1 11869 A G 66 216 2 2 -1 11888 G A 216 216 0 2 -1 11978 G T 216 216 0 2 -1 12037 C G 0 216 2 2 -1 12087 G A 0 216 2 2 -1 12092 G A 202 216 2 2 -1 12127 A C 216 216 2 2 -1 12132 T A 216 216 0 2 -1 12152 G T 0 216 2 2 -1 12154 T G 0 216 2 2 -1 12206 T C 216 216 0 2 -1 12248 G C 216 216 2 2 -1 12316 G A 216 216 0 2 -1 12353 C G 216 216 0 2 -1 12410 T A 216 216 2 2 -1 12426 A C 0 216 2 2 -1 12497 A T 216 216 2 2 -1 12562 A C 0 216 2 2 -1 12624 C A 0 216 2 2 -1 12718 T C 213 216 2 2 -1 12735 A G 216 216 2 2 -1 12767 G C 216 216 2 2 -1 12768 T G 216 216 2 2 -1 12783 A T 0 216 2 2 -1 12810 T G 216 216 0 2 -1 12830 C G 0 216 2 2 -1 12857 A G 216 216 0 2 -1 12896 T A 164 216 2 2 -1 12921 G C 216 216 2 2 -1 12953 C G 216 216 2 2 -1 12997 G C 0 216 2 2 -1 13011 G T 216 216 0 2 -1 13108 G T 202 216 2 2 -1 13119 A T 0 216 2 2 -1 13122 G A 216 216 2 2 -1 13134 T C 211 216 2 2 -1 13223 A G 0 216 2 2 -1 13358 C G 216 216 2 2 -1 13368 C T 216 216 0 2 -1 13387 G C 23 216 2 2 -1 13410 C A 216 216 2 2 -1 13476 T A 216 216 0 2 -1 13481 C G 216 216 2 2 -1 13527 A T 216 216 0 2 -1 13571 A C 216 216 0 2 -1 13645 T G 216 216 2 2 -1 13687 A C 216 216 2 2 -1 13700 C T 0 216 2 2 -1 13761 G T 216 216 2 2 -1 13774 G C 0 216 2 2 -1 13777 T G 216 216 2 2 -1 13805 A T 215 216 2 2 -1 13820 G A 0 216 2 2 -1 13881 T C 212 216 2 2 -1 13976 G T 0 216 2 2 -1 13977 A C 216 216 0 2 -1 13985 G T 0 216 2 2 -1 13994 T A 216 216 0 2 -1 14020 G A 193 216 2 2 -1 14110 T C 0 216 2 2 -1 14132 C T 216 216 0 2 -1 14136 A G 216 216 0 2 -1 14159 T A 23 216 2 2 -1 14169 A G 215 216 2 2 -1 14221 A C 216 216 0 2 -1 14233 A T 216 216 0 2 -1 14240 T G 216 216 2 2 -1 14242 T G 193 216 2 2 -1 14251 A G 193 216 2 2 -1 14265 A T 0 216 2 2 -1 14272 A G 191 216 2 2 -1 14331 C G 216 216 0 2 -1 14371 A T 216 216 2 2 -1 14376 G C 216 216 2 2 -1 14439 T C 216 216 0 2 -1 14445 C G 216 216 2 2 -1 14452 G T 216 216 0 2 -1 14534 C T 191 216 2 2 -1 14568 G T 216 216 2 2 -1 14577 T C 60 216 2 2 -1 14583 T A 0 216 2 2 -1 14592 C T 206 216 2 2 -1 14640 G C 192 216 2 2 -1 14660 A T 216 216 0 2 -1 14722 T G 216 216 0 2 -1 14736 T C 216 216 2 2 -1 14772 T A 216 216 0 2 -1 14777 G C 216 216 0 2 -1 14788 G A 184 216 2 2 -1 14794 T C 216 216 2 2 -1 14815 G C 216 216 2 2 -1 14848 A G 216 216 0 2 -1 14852 T A 215 216 2 2 -1 14855 T C 216 216 0 2 -1 14859 A C 216 216 2 2 -1 14868 C G 84 216 2 2 -1 14898 T C 0 216 2 2 -1 14919 A T 0 216 2 2 -1 14943 T G 216 216 0 2 -1 14961 G T 171 216 2 2 -1 14996 T C 216 216 2 2 -1 15001 A G 84 216 2 2 -1 15039 G C 216 216 0 2 -1 15042 C T 176 216 2 2 -1 15081 C T 201 216 2 2 -1 15173 A T 84 216 2 2 -1 15193 A C 216 216 2 2 -1 15194 C G 216 216 0 2 -1 15330 C A 216 216 0 2 -1 15338 G C 0 216 0 2 -1 15349 G C 216 216 2 2 -1 15367 C G 0 216 2 2 -1 15381 C G 215 216 2 2 -1 15477 G C 209 216 2 2 -1 15484 T A 216 216 2 2 -1 15503 T A 216 216 2 2 -1 15571 T C 216 216 0 2 -1 15592 G A 216 216 2 2 -1 15602 C G 43 216 2 2 -1 15639 T G 216 216 0 2 -1 15645 C A 0 216 2 2 -1 15652 A G 216 216 2 2 -1 15663 T A 0 216 0 2 -1 15680 A G 216 216 2 2 -1 15681 G T 216 216 2 2 -1 15702 A G 216 216 0 2 -1 15721 C G 176 216 2 2 -1 15737 G A 216 216 0 2 -1 15840 A C 216 216 2 2 -1 15878 G A 216 216 2 2 -1 15928 T A 0 216 2 2 -1 15998 C A 215 216 2 2 -1 16020 G C 215 216 2 2 -1 16045 G C 213 216 2 2 -1 16070 A G 216 216 0 2 -1 16091 T G 0 216 2 2 -1 16157 A T 198 216 2 2 -1 16198 A T 156 216 2 2 -1 16364 C T 216 216 2 2 -1 16419 C T 216 216 2 2 -1 16441 C G 216 216 2 2 -1 16444 C A 198 216 2 2 -1 16490 C G 216 216 0 2 -1 16555 A G 216 216 2 2 -1 16633 G A 216 216 0 2 -1 16638 C T 216 216 0 2 -1 16647 G C 216 216 2 2 -1 16693 A T 216 216 2 2 -1 16701 C A 216 216 2 2 -1 16866 C G 156 216 2 2 -1 16914 A G 211 216 2 2 -1 16924 C T 0 216 2 2 -1 16936 T A 213 216 2 2 -1 17025 G T 0 216 2 2 -1 17084 C G 216 216 0 2 -1 17228 G A 0 216 2 2 -1 17281 A T 180 216 2 2 -1 17290 G T 216 216 2 2 -1 17319 T A 216 216 2 2 -1 17369 A T 191 216 2 2 -1 17536 C G 0 216 2 2 -1 17552 G T 216 216 2 2 -1 17567 C G 59 216 2 2 -1 17595 A T 216 216 0 2 -1 17599 C G 213 216 2 2 -1 17606 T G 216 216 0 2 -1 17618 G T 216 216 2 2 -1 17666 T C 157 216 2 2 -1 17679 T A 0 216 2 2 -1 17743 A C 216 216 0 2 -1 17752 C T 216 216 2 2 -1 17785 T G 214 216 2 2 -1 17804 T G 216 216 0 2 -1 17887 A G 216 216 0 2 -1 17970 G A 192 216 2 2 -1 18009 A C 216 216 2 2 -1 18046 C T 215 216 2 2 -1 18070 C T 0 216 2 2 -1 18163 C T 0 216 2 2 -1 18189 T G 216 216 0 2 -1 18192 G T 184 216 2 2 -1 18246 A G 212 216 2 2 -1 18393 A T 0 216 2 2 -1 18460 C T 216 216 2 2 -1 18503 G A 176 216 2 2 -1 18509 T G 216 216 2 2 -1 18534 C T 0 216 0 2 -1 18574 C G 192 216 2 2 -1 18601 A G 216 216 0 2 -1 18742 A G 216 216 0 2 -1 18793 A C 0 216 0 2 -1 18832 G A 216 216 2 2 -1 18838 T A 216 216 0 2 -1 18875 G A 216 216 0 2 -1 18956 G T 0 216 2 2 -1 19111 T C 216 216 2 2 -1 19133 C G 216 216 2 2 -1 19193 C G 216 216 2 2 -1 19221 A G 3 216 2 2 -1 19234 A C 215 216 2 2 -1 19295 C G 0 216 0 2 -1 19398 G A 216 216 0 2 -1 19485 C A 176 216 2 2 -1 19498 G A 216 216 2 2 -1 19585 A C 216 216 0 2 -1 19617 C G 216 216 0 2 -1 19671 A G 0 216 0 2 -1 19712 G T 216 216 2 2 -1 19766 A G 216 216 2 2 -1 19788 A C 216 216 0 2 -1 19833 A G 216 216 2 2 -1 19874 T C 216 216 2 2 -1 19879 C A 0 216 2 2 -1 19893 A C 0 216 0 2 -1 19917 C T 215 216 2 2 -1 19924 T C 216 216 2 2 -1 19986 T C 213 216 2 2 -1 19997 T C 0 216 0 2 -1 20033 T C 216 216 2 2 -1 20035 C G 0 216 2 2 -1 20055 A G 216 216 0 2 -1 20111 T A 216 216 2 2 -1 20177 G T 216 216 2 2 -1 20192 T G 0 216 0 2 -1 20196 G T 216 216 2 2 -1 20209 G T 216 216 0 2 -1 20259 C G 216 216 2 2 -1 20266 T C 216 216 0 2 -1 20270 C T 216 216 2 2 -1 20326 T A 216 216 0 2 -1 20417 C G 0 216 0 2 -1 20428 G T 216 216 2 2 -1 20446 C T 216 216 2 2 -1 20453 T C 0 216 2 2 -1 20454 A G 216 216 2 2 -1 20477 A G 0 216 2 2 -1 20488 G A 216 216 2 2 -1 20503 A G 215 216 2 2 -1 20506 T C 216 216 2 2 -1 20606 C A 0 216 0 2 -1 20837 A T 216 216 0 2 -1 20983 C T 216 216 0 2 -1 20998 G T 216 216 2 2 -1 21007 A T 0 216 2 2 -1 21043 C G 216 216 2 2 -1 21047 T C 0 216 0 2 -1 21052 A C 205 216 2 2 -1 21079 G T 216 216 2 2 -1 21094 G T 215 216 2 2 -1 21174 A C 216 216 2 2 -1 21179 G A 0 216 0 2 -1 21211 C T 212 216 2 2 -1 21247 G C 216 216 2 2 -1 21274 G C 0 216 0 2 -1 21356 A T 216 216 2 2 -1 21374 A G 216 216 2 2 -1 21384 C G 0 216 0 2 -1 21463 C G 203 216 2 2 -1 21499 C T 216 216 2 2 -1 21500 G A 44 216 2 2 -1 21592 A T 216 216 0 2 -1 21593 T G 0 216 0 2 -1 21603 A C 0 216 2 2 -1 21665 A C 214 216 2 2 -1 21678 A G 210 216 2 2 -1 21722 T G 216 216 2 2 -1 21723 A T 215 216 2 2 -1 21785 C T 0 216 0 2 -1 21811 T G 216 216 0 2 -1 22014 C A 216 216 2 2 -1 22019 G A 0 216 2 2 -1 22021 G A 216 216 2 2 -1 22028 G T 216 216 2 2 -1 22042 A T 215 216 2 2 -1 22046 G A 216 216 2 2 -1 22056 C T 216 216 0 2 -1 22057 C T 216 216 2 2 -1 22092 A T 216 216 2 2 -1 22095 G T 215 216 2 2 -1 22097 A T 216 216 2 2 -1 22152 A C 172 216 2 2 -1 22228 A G 216 216 2 2 -1 22334 A G 216 216 2 2 -1 22375 A G 212 216 2 2 -1 22413 G T 0 216 0 2 -1 22444 A C 216 216 2 2 -1 22484 G A 216 216 0 2 -1 22485 C T 216 216 2 2 -1 22566 T A 0 216 2 2 -1 22602 G A 215 216 2 2 -1 22603 C T 216 216 1 2 -1 22620 A C 216 216 0 2 -1 22622 G A 44 216 2 2 -1 22650 T G 216 216 2 2 -1 22698 T A 216 216 0 2 -1 22705 A C 0 216 2 2 -1 22723 A G 0 216 2 2 -1 22862 T C 0 216 2 2 -1 22912 T C 0 216 2 2 -1 22928 C A 216 216 0 2 -1 22960 G C 0 216 2 2 -1 23036 T C 216 216 2 2 -1 23048 C A 216 216 2 2 -1 23087 C G 0 216 2 2 -1 23117 G A 0 216 2 2 -1 23165 C A 0 216 2 2 -1 23211 G A 0 216 2 2 -1 23212 T C 0 216 2 2 -1 23228 T A 216 216 2 2 -1 23241 T A 216 216 2 2 -1 23256 A T 216 216 2 2 -1 23262 A G 0 216 2 2 -1 23299 A C 210 216 2 2 -1 23301 G T 216 216 2 2 -1 23310 C G 0 216 2 2 -1 23334 C G 161 216 2 2 -1 23371 C G 216 216 2 2 -1 23373 A C 170 216 2 2 -1 23392 C G 212 216 2 2 -1 23420 T A 216 216 2 2 -1 23440 C A 0 216 2 2 -1 23452 G T 216 216 2 2 -1 23495 A G 216 216 0 2 -1 23527 C T 216 216 2 2 -1 23636 T G 0 216 2 2 -1 23684 A T 216 216 0 2 -1 23686 C T 216 216 2 2 -1 23725 A C 206 216 2 2 -1 23783 A C 216 216 2 2 -1 23806 T C 211 216 2 2 -1 23834 A T 210 216 2 2 -1 23835 G T 216 216 0 2 -1 23958 T G 216 216 2 2 -1 24083 A G 216 216 2 2 -1 24116 A G 0 216 2 2 -1 24118 G A 216 216 2 2 -1 24142 G T 171 216 2 2 -1 24178 G T 216 216 0 2 -1 24184 A C 0 216 2 2 -1 24217 A G 214 216 2 2 -1 24238 C G 216 216 0 2 -1 24275 G C 216 216 2 2 -1 24294 C T 0 216 2 2 -1 24340 A C 216 216 2 2 -1 24365 T G 216 216 0 2 -1 24368 T G 216 216 0 2 -1 24394 C T 216 216 2 2 -1 24452 T G 216 216 2 2 -1 24585 T C 216 216 2 2 -1 24632 G T 6 216 2 2 -1 24636 C A 216 216 2 2 -1 24698 T A 210 216 2 2 -1 24707 G C 216 216 2 2 -1 24764 A T 216 216 0 2 -1 24812 C G 0 216 2 2 -1 24815 A T 216 216 0 2 -1 24840 T G 216 216 2 2 -1 24904 C A 216 216 2 2 -1 24930 A G 216 216 2 2 -1 25015 T G 216 216 0 2 -1 25091 C T 215 216 2 2 -1 25140 C G 216 216 0 2 -1 25192 C T 216 216 0 2 -1 25232 C G 216 216 2 2 -1 25308 G A 0 216 2 2 -1 25314 G A 216 216 2 2 -1 25326 C T 0 216 2 2 -1 25330 A C 216 216 0 2 -1 25353 C A 216 216 2 2 -1 25364 T C 216 216 2 2 -1 25398 G T 216 216 2 2 -1 25423 A T 215 216 2 2 -1 25430 A G 216 216 2 2 -1 25462 C T 216 216 0 2 -1 25466 A G 216 216 0 2 -1 25536 G T 214 216 2 2 -1 25557 C T 216 216 2 2 -1 25636 A G 216 216 0 2 -1 25668 T G 0 216 2 2 -1 25676 G A 216 216 0 2 -1 25696 G A 6 216 2 2 -1 25712 T A 0 216 2 2 -1 25721 T A 216 216 0 2 -1 25742 C T 214 216 2 2 -1 25793 T G 0 216 0 2 -1 25804 G T 216 216 1 2 -1 25806 G T 0 216 0 2 -1 25837 T A 216 216 2 2 -1 25894 T C 214 216 2 2 -1 25992 G A 216 216 2 2 -1 26004 A G 216 216 2 2 -1 26033 G C 210 216 2 2 -1 26117 G C 6 216 2 2 -1 26133 G A 214 216 2 2 -1 26169 A G 214 216 2 2 -1 26229 G C 0 216 2 2 -1 26232 C T 0 216 2 2 -1 26244 G A 211 216 2 2 -1 26300 T C 216 216 2 2 -1 26440 T A 0 216 2 2 -1 26456 C G 178 216 2 2 -1 26479 A G 216 216 0 2 -1 26524 A G 0 216 2 2 -1 26569 G A 0 216 2 2 -1 26616 G A 216 216 0 2 -1 26687 G T 216 216 0 2 -1 26722 A C 216 216 0 2 -1 26763 G A 216 216 2 2 -1 26837 G T 216 216 0 2 -1 26872 G T 216 216 2 2 -1 26886 T G 0 216 2 2 -1 26931 C A 216 216 2 2 -1 27058 T G 210 216 2 2 -1 27104 C G 216 216 2 2 -1 27106 T G 216 216 0 2 -1 27205 T C 216 216 2 2 -1 27211 A C 0 216 2 2 -1 27261 C G 216 216 2 2 -1 27312 G A 212 216 2 2 -1 27342 G T 210 216 2 2 -1 27387 C A 216 216 2 2 -1 27405 T A 0 216 2 2 -1 27414 A G 216 216 0 2 -1 27432 G A 216 216 2 2 -1 27455 A C 0 216 2 2 -1 27495 G A 216 216 2 2 -1 27567 A T 216 216 2 2 -1 27620 G T 216 216 2 2 -1 27651 G T 169 216 2 2 -1 27671 C T 216 216 0 2 -1 27732 A G 216 216 0 2 -1 27743 G T 216 216 2 2 -1 27748 T A 216 216 0 2 -1 27763 T A 0 216 2 2 -1 27779 T G 210 216 2 2 -1 27834 A G 216 216 2 2 -1 27850 T A 216 216 0 2 -1 27933 C A 168 216 2 2 -1 27947 A C 214 216 2 2 -1 28019 T G 216 216 0 2 -1 28035 C T 216 216 0 2 -1 28064 A G 216 216 0 2 -1 28107 T C 0 216 2 2 -1 28112 G T 216 216 2 2 -1 28129 C G 214 216 2 2 -1 28179 T A 0 216 2 2 -1 28254 A C 0 216 2 2 -1 28263 C G 216 216 0 2 -1 28293 A C 210 216 2 2 -1 28421 A G 216 216 2 2 -1 28426 T C 216 216 0 2 -1 28439 T A 214 216 2 2 -1 28449 G C 216 216 2 2 -1 28455 G T 105 216 2 2 -1 28465 G A 216 216 0 2 -1 28494 T A 216 216 2 2 -1 28510 A G 0 216 2 2 -1 28524 T C 216 216 2 2 -1 28546 C A 216 216 2 2 -1 28605 A G 216 216 2 2 -1 28632 T C 216 216 2 2 -1 28669 G C 216 216 2 2 -1 28687 T A 216 216 2 2 -1 28731 A T 213 216 2 2 -1 28742 C G 216 216 0 2 -1 28777 G A 0 216 2 2 -1 28819 T C 216 216 0 2 -1 28821 G C 0 216 2 2 -1 28880 C G 216 216 0 2 -1 28936 G A 0 216 2 2 -1 28953 C A 216 216 0 2 -1 28956 T A 208 216 2 2 -1 28970 A T 215 216 2 2 -1 28971 C T 210 216 2 2 -1 28975 T A 216 216 0 2 -1 28988 A G 0 216 2 2 -1 29018 C A 216 216 0 2 -1 29020 C A 0 216 2 2 -1 29042 T A 216 216 2 2 -1 29049 T G 216 216 2 2 -1 29052 C A 216 216 1 2 -1 29077 T G 212 216 2 2 -1 29106 A T 157 216 2 2 -1 29108 T G 216 216 2 2 -1 29249 C G 0 216 0 2 -1 29253 C A 210 216 2 2 -1 29255 T C 216 216 2 2 -1 29256 G A 216 216 2 2 -1 29258 G C 216 216 1 2 -1 29259 T A 163 216 2 2 -1 29322 C G 0 216 2 2 -1 29375 A C 216 216 0 2 -1 29377 A C 59 216 2 2 -1 29427 C G 0 216 2 2 -1 29436 A G 216 216 2 2 -1 29484 C T 0 216 2 2 -1 29501 T C 0 216 2 2 -1 29590 C A 216 216 0 2 -1 29592 T C 216 216 2 2 -1 29642 T G 0 216 2 2 -1 29669 G T 216 216 2 2 -1 29686 C G 0 216 0 2 -1 29727 G T 216 216 2 2 -1 29734 A T 163 216 2 2 -1 29761 T C 216 216 2 2 -1 29795 A T 215 216 2 2 -1 29915 C A 216 216 2 2 -1 29992 G T 205 216 2 2 From ba44052bcf25630e7a2f429d916fc4d123a8ff5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1rbara=20Bitarello?= Date: Thu, 18 Apr 2024 12:44:13 -0400 Subject: [PATCH 18/20] asdasa --- DESCRIPTION | 3 ++- NAMESPACE | 1 - R/read_vcf.R | 22 +++++++--------------- man/read_vcf.Rd | 10 +++++----- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 2b9108f..891b3f9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,7 +8,7 @@ Description: Produce input files for different balancing selection programs/test License: MIT + file LICENSE Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 LazyData: true Imports: assertthat, @@ -23,3 +23,4 @@ Imports: tictoc Depends: R (>= 2.10) +Config/testthat/edition: 3 diff --git a/NAMESPACE b/NAMESPACE index 64aed57..94c74e2 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,7 +1,6 @@ # Generated by roxygen2: do not edit by hand export("%>%") -export(hello) export(ncd1) export(ncd2) export(outfile_path) diff --git a/R/read_vcf.R b/R/read_vcf.R index 90a8b17..797953c 100644 --- a/R/read_vcf.R +++ b/R/read_vcf.R @@ -1,25 +1,17 @@ #' Read vcf #' #' @param x The path and name of a vcf file -#' @param only.bi Logical. If TRUE, only bi-allelic SNP positions from VCF file -#' are kept. -#' @return Returns a data.table object +#' @return Returns a data.table object containing only SNPs #' @export #' -#' @examples read_vcf(x="inst/example.vcf", only.bi=T") +#' @examples read_vcf(x=system.file(package="balselr", "example.vcf")) #' @import data.table #' @importFrom data.table ":=" -read_vcf <- function(x = "inst/example.vcf", - only.bi = T) { - REF <- ALT <- x2 <- NULL +#' +read_vcf <- function(x = "inst/example.vcf") { inp <- data.table::fread(x, skip = "##", header = T) data.table::setnames(inp, "#CHROM", "CHR") - if (only.bi == T) { - inp <- - inp[REF %in% c("A", "C", "T", "G")][ALT %in% c("A", "C", "T", "G")] - inp - } else { - inp - } + #inp <- + inp[REF %in% c("A", "C", "T", "G")][ALT %in% c("A", "C", "T", "G")] + #return(inp) } - diff --git a/man/read_vcf.Rd b/man/read_vcf.Rd index f12cc87..5bb927f 100644 --- a/man/read_vcf.Rd +++ b/man/read_vcf.Rd @@ -4,17 +4,17 @@ \alias{read_vcf} \title{Read vcf} \usage{ -read_vcf(x = "inst/example.vcf", only.bi = T) +read_vcf(x = "inst/example.vcf") } \arguments{ \item{x}{The path and name of a vcf file} - -\item{only.bi}{Logical. If TRUE, only bi-allelic SNP positions from VCF file -are kept.} } \value{ -Returns a data.table object +Returns a data.table object containing only SNPs } \description{ Read vcf } +\examples{ +read_vcf(x=system.file(package="balselr", "example.vcf")) +} From 0f5daa724225c3b4be62148ed93e5fcc19d8e53f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1rbara=20Bitarello?= Date: Thu, 18 Apr 2024 12:55:54 -0400 Subject: [PATCH 19/20] push to master Push to master --- data/.Rapp.history | 3 --- man/hello.Rd | 12 ------------ tests/test-readvcf.R | 11 ----------- 3 files changed, 26 deletions(-) delete mode 100644 data/.Rapp.history delete mode 100644 man/hello.Rd delete mode 100644 tests/test-readvcf.R diff --git a/data/.Rapp.history b/data/.Rapp.history deleted file mode 100644 index d5369f9..0000000 --- a/data/.Rapp.history +++ /dev/null @@ -1,3 +0,0 @@ -load("/Users/dhansell/Documents/GitHub/balselr/data/example_vcf.rda") -load("/Users/dhansell/Documents/GitHub/balselr/data/example_vcf.rda") -print("example_vcf.rda) diff --git a/man/hello.Rd b/man/hello.Rd deleted file mode 100644 index 0fa7c4b..0000000 --- a/man/hello.Rd +++ /dev/null @@ -1,12 +0,0 @@ -\name{hello} -\alias{hello} -\title{Hello, World!} -\usage{ -hello() -} -\description{ -Prints 'Hello, world!'. -} -\examples{ -hello() -} diff --git a/tests/test-readvcf.R b/tests/test-readvcf.R deleted file mode 100644 index d2610e8..0000000 --- a/tests/test-readvcf.R +++ /dev/null @@ -1,11 +0,0 @@ -#the output should be a data.table - -testthat::test_that("output is a data table", { - readinvcf <- read_vcf(x="inst/example.vcf", only.bi = TRUE) - testthat::expect_type(readinvcf, "data.frame") -}) - -testthat::test_that("read_vcf correctly renames column", { - readinvcf <- read_vcf(vcf_file_path, only.bi = TRUE) - testthat::expect_true("CHR" %in% colnames(readinvcf)) -}) From f9aebb2a567ec7b59ca2cc767300721c39a5528e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1rbara=20Bitarello?= Date: Thu, 18 Apr 2024 12:56:28 -0400 Subject: [PATCH 20/20] Update DATASET.R --- data-raw/DATASET.R | 3 --- 1 file changed, 3 deletions(-) diff --git a/data-raw/DATASET.R b/data-raw/DATASET.R index 6514a94..e69de29 100644 --- a/data-raw/DATASET.R +++ b/data-raw/DATASET.R @@ -1,3 +0,0 @@ -## code to prepare `DATASET` dataset goes here - -usethis::use_data(DATASET, overwrite = TRUE)