12
12
# ' x <- system.file("extdata/virusbreakend/virusbreakend.vcf.summary.tsv", package = "gpgr")
13
13
# ' (vb <- virusbreakend_summary_read(x))
14
14
# ' @testexamples
15
- # ' expect_equal(colnames(vb)[ncol(vb)], "QCStatus ")
15
+ # ' expect_equal(colnames(vb$tab )[ncol(vb$tab )], "QC ")
16
16
# '
17
17
# ' @export
18
18
virusbreakend_summary_read <- function (x ) {
19
-
20
19
nm <- c(
21
20
" taxid_genus" = " c" ,
22
21
" name_genus" = " c" ,
@@ -44,7 +43,6 @@ virusbreakend_summary_read <- function(x) {
44
43
" integrations" = " i" ,
45
44
" QCStatus" = " c"
46
45
)
47
-
48
46
ctypes <- paste(nm , collapse = " " )
49
47
virusbreakend_summary <- readr :: read_tsv(x , col_types = ctypes )
50
48
@@ -54,13 +52,13 @@ virusbreakend_summary_read <- function(x) {
54
52
55
53
virusbreakend_summary <- virusbreakend_summary | >
56
54
dplyr :: select(
57
- Virus = " name_assigned" ,
58
- Length = " endpos" ,
59
- Reads = " numreads" ,
60
- Coverage = " coverage" ,
61
- `Mean depth` = " meandepth" ,
62
- Intergrations = " integrations" ,
63
- QC = " QCStatus" ,
55
+ Virus = " name_assigned" ,
56
+ Length = " endpos" ,
57
+ Reads = " numreads" ,
58
+ Coverage = " coverage" ,
59
+ `Mean depth` = " meandepth" ,
60
+ Intergrations = " integrations" ,
61
+ QC = " QCStatus" ,
64
62
)
65
63
}
66
64
@@ -71,7 +69,7 @@ virusbreakend_summary_read <- function(x) {
71
69
" Reads" , " Number of reads mapped to adjusted viral reference" ,
72
70
" Coverage" , " Percentage of viral positions with at least one read mapped" ,
73
71
" Mean depth" , " Mean alignment depth" ,
74
- " Intergrations " , " Number of detected integration breakpoints" ,
72
+ " Integrations " , " Number of detected integration breakpoints" ,
75
73
" QC" , " QC status of viral intergrations" ,
76
74
)
77
75
@@ -95,29 +93,28 @@ virusbreakend_summary_read <- function(x) {
95
93
# ' x <- system.file("extdata/virusbreakend/virusbreakend.vcf", package = "gpgr")
96
94
# ' (vb <- virusbreakend_vcf_read(x))
97
95
# ' @testexamples
98
- # ' expect_equal(colnames(vb)[ncol(vb)], "QC")
96
+ # ' expect_equal(colnames(vb$tab )[ncol(vb$tab )], "QC")
99
97
# '
100
98
# ' @export
101
99
virusbreakend_vcf_read <- function (x ) {
102
-
103
100
d <- bedr :: read.vcf(x , split.info = TRUE , verbose = FALSE )
104
101
105
102
if (nrow(d $ vcf ) > 0 ) {
106
103
virusbreakend_integrations <- tibble :: as_tibble(d $ vcf ) | >
107
104
dplyr :: select(
108
- Contig = " CHROM" ,
109
- Position = " POS" ,
110
- " Fragment support" = " BVF" ,
111
- " Fragment support (unmapped)" = " BUM" ,
112
- " Softclip read support" = " BSC" ,
113
- Reference = " REF" ,
114
- Alt = " ALT" ,
115
- `Breakend ID` = " ID" ,
116
- `Mate ID` = " MATEID" ,
117
- QC = " FILTER" ,
105
+ Contig = " CHROM" ,
106
+ Position = " POS" ,
107
+ " Fragment support" = " BVF" ,
108
+ " Fragment support (unmapped)" = " BUM" ,
109
+ " Softclip read support" = " BSC" ,
110
+ Reference = " REF" ,
111
+ Alt = " ALT" ,
112
+ `Breakend ID` = " ID" ,
113
+ `Mate ID` = " MATEID" ,
114
+ QC = " FILTER" ,
118
115
)
119
116
} else {
120
- virusbreakend_integrations <- tibble :: tibble()
117
+ virusbreakend_integrations <- tibble :: tibble()
121
118
}
122
119
123
120
descr <- dplyr :: tribble(
0 commit comments