55
66
77# ## Not exported!
8- # ## Not the true colnames used in IgBLAST intdata files: ours are all
8+ # ## Not the true colnames used in IgBLAST "ndm" files: ours are all
99# ## lowercase and we've replaced spaces with underscores.
1010# ## Note that many columns are redundant:
1111# ## - columns 'cdr1_start', 'fwr2_start', 'cdr2_start', and 'fwr3_start'
1414# ## - columns 'fwr1_start' and 'coding_frame_start' are redundant (and
1515# ## column 'fwr1_start' is a dumb column anyways because it should always
1616# ## be set to 1).
17- NDM_COL2CLASS <- c(
17+ NDM_DATA_COL2CLASS <- c(
1818 allele_name = " character" ,
1919 fwr1_start = " integer" ,
2020 fwr1_end = " integer" ,
@@ -34,7 +34,7 @@ NDM_COL2CLASS <- c(
3434V_GENE_SEGMENTS <- c(" fwr1" , " cdr1" , " fwr2" , " cdr2" , " fwr3" )
3535V_GENE_DELINEATION_COLNAMES <- paste0(rep(V_GENE_SEGMENTS , each = 2L ),
3636 c(" _start" , " _end" ))
37- stopifnot(all(V_GENE_DELINEATION_COLNAMES %in% names(NDM_COL2CLASS )))
37+ stopifnot(all(V_GENE_DELINEATION_COLNAMES %in% names(NDM_DATA_COL2CLASS )))
3838
3939
4040# ## - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -46,16 +46,16 @@ check_ndm_data_col2class <- function(ndm_data, what="'ndm_data'")
4646{
4747 if (! is.data.frame(ndm_data ))
4848 stop(wmsg(what , " must be a data.frame" ))
49- expected_colnames <- names(NDM_COL2CLASS )
49+ expected_colnames <- names(NDM_DATA_COL2CLASS )
5050 if (! identical(colnames(ndm_data ), expected_colnames )) {
5151 in1string <- paste(expected_colnames , collapse = " , " )
5252 stop(wmsg(what , " must have the following columns " ,
5353 " (in this order): " , in1string ))
5454 }
5555 col2class <- vapply(ndm_data , function (x ) class(x )[[1L ]], character (1 ))
56- if (! identical(col2class , NDM_COL2CLASS )) {
57- in1string <- paste0(" " , names(NDM_COL2CLASS ), " -> " ,
58- NDM_COL2CLASS , collapse = " \n " )
56+ if (! identical(col2class , NDM_DATA_COL2CLASS )) {
57+ in1string <- paste0(" " , names(NDM_DATA_COL2CLASS ), " -> " ,
58+ NDM_DATA_COL2CLASS , collapse = " \n " )
5959 stop(wmsg(what , " must have the following column types:" ), " \n " ,
6060 in1string )
6161 }
@@ -107,7 +107,7 @@ validate_ndm_rows <- function(ndm_data, allow.repeated.rows=FALSE)
107107
108108read_ndm_data <- function (filepath )
109109{
110- read_broken_table(filepath , NDM_COL2CLASS )
110+ read_broken_table(filepath , NDM_DATA_COL2CLASS )
111111}
112112
113113write_ndm_data <- function (ndm_data , file = " " , check.data = FALSE )
0 commit comments