Skip to content

Commit e73fbd0

Browse files
committed
igblastr 1.0.23
Rename the following functions: compute_imgt_intdata -> compute_V_gene_delineations read_V_ndm_data -> read_ndm_data write_V_ndm_data -> write_ndm_data check_V_ndm_data -> validate_ndm_rows
1 parent fcbc0f8 commit e73fbd0

22 files changed

Lines changed: 493 additions & 399 deletions

‎DESCRIPTION‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Description: The igblastr package provides functions to conveniently install
1717
biocViews: Immunology, Immunogenetics, ImmunoOncology, CellBiology
1818
URL: https://bioconductor.org/packages/igblastr
1919
BugReports: https://github.com/HyrienLab/igblastr/issues
20-
Version: 1.0.22
20+
Version: 1.0.23
2121
License: Artistic-2.0
2222
Encoding: UTF-8
2323
Authors@R: c(
@@ -48,8 +48,8 @@ Collate:
4848
file-utils.R
4949
loci-utils.R
5050
db-utils.R
51-
intdata-IO-utils.R
52-
compute_imgt_intdata.R
51+
ndm_data-IO.R
52+
compute_V_gene_delineations.R
5353
clean_allele_set.R
5454
compute_auxdata.R
5555
LATIN_NAMES.R

‎NAMESPACE‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,14 @@ export(
8181
## allele2gene.R:
8282
allele2gene,
8383

84-
## intdata-IO-utils.R:
85-
check_V_ndm_data,
86-
read_V_ndm_data,
87-
write_V_ndm_data,
88-
89-
## compute_imgt_intdata.R:
84+
## ndm_data-IO.R:
85+
validate_ndm_rows,
86+
read_ndm_data,
87+
write_ndm_data,
88+
same_ndm_data,
89+
90+
## compute_V_gene_delineations.R:
91+
compute_V_gene_delineations,
9092
compute_imgt_intdata,
9193

9294
## compute_auxata.R:
@@ -153,7 +155,6 @@ export(
153155

154156
## download_OGRDB_germline_json.R:
155157
download_OGRDB_germline_json,
156-
same_intdata,
157158
makeogrannote,
158159

159160
## install_OGRDB_germline_db.R:

‎R/clean_allele_set.R‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ checkarg_with.intdata <- function(with.intdata, gapped)
9090
### Returns a DNAStringSet object that:
9191
### - is parallel to input DNAStringSet object 'dna';
9292
### - carries the names and metadata columns of input object 'dna';
93-
### - also carries the annotations obtained with compute_imgt_intdata()
93+
### - also carries the annotations obtained with compute_V_gene_delineations()
9494
### in additional metadata columns.
9595
.annotate_V_alleles <- function(dna)
9696
{
@@ -102,7 +102,7 @@ checkarg_with.intdata <- function(with.intdata, gapped)
102102
.check_locus(locus, "the \"locus\" metadata column on 'dna'")
103103

104104
## Annotate the V alleles based on their gaps.
105-
intdata <- compute_imgt_intdata(dna)
105+
intdata <- compute_V_gene_delineations(dna)
106106
stopifnot(identical(names(dna), intdata[ , "allele_name"]))
107107

108108
## Add "chain_type" column.
@@ -119,7 +119,7 @@ checkarg_with.intdata <- function(with.intdata, gapped)
119119
stopifnot(is(dna, "DNAStringSet"))
120120
## We only care about the annotations found in the Metadata Columns
121121
## Of Interest listed in 'MCOI' when comparing the V allele annotations.
122-
MCOI <- setdiff(names(IGBLAST_INTDATA_COL2CLASS), "chain_type")
122+
MCOI <- setdiff(names(NDM_COL2CLASS), "chain_type")
123123
ok <- .repeated_vector_elts_have_identical_metadata(dna, MCOI=MCOI)
124124
if (!ok) {
125125
msg <- c("V alleles with identical ungapped sequences and names ",
@@ -285,8 +285,8 @@ checkarg_with.intdata <- function(with.intdata, gapped)
285285
### Returns a DNAStringSet object that contains the ungapped allele sequences
286286
### and carries the metadata columns of input object 'dna', if any.
287287
### Furthermore, if 'with.intdata' is TRUE, the returned object will also
288-
### carry the annotations obtained with compute_imgt_intdata() in additional
289-
### metadata columns.
288+
### carry the annotations obtained with compute_V_gene_delineations() in
289+
### additional metadata columns.
290290
### Note that "repeated" alleles (i.e. alleles with identical **ungapped**
291291
### DNA sequences **and** names) are dropped.
292292
### If, after dropping the "repeated" alleles, the names of the remaining
Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ clean_imgt_fasta_header_lines <- function(headers, what="some allele names")
6868

6969

7070
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
71-
### compute_imgt_intdata()
71+
### compute_V_gene_delineations()
7272
###
7373

7474
### The IMGT unique numbering provides a standardized delimitation of
@@ -192,10 +192,10 @@ clean_imgt_fasta_header_lines <- function(headers, what="some allele names")
192192

193193
### 'gapped_V_alleles' can be a named DNAStringSet or BStringSet object,
194194
### or the path to a FASTA file. Note that **all** the sequences
195-
### in 'gapped_V_alleles' are expected to have gaps (compute_imgt_intdata()
196-
### will issue a warning if that's not the case).
195+
### in 'gapped_V_alleles' are expected to have gaps (the function will
196+
### issue a warning if that's not the case).
197197
### Returns a data.frame with 1 row per sequence in 'gapped_V_alleles'.
198-
compute_imgt_intdata <- function(gapped_V_alleles, as.IRangesList=FALSE)
198+
compute_V_gene_delineations <- function(gapped_V_alleles, as.IRangesList=FALSE)
199199
{
200200
if (!isTRUEorFALSE(as.IRangesList))
201201
stop(wmsg("'as.IRangesList' must be TRUE or FALSE"))
@@ -224,8 +224,14 @@ compute_imgt_intdata <- function(gapped_V_alleles, as.IRangesList=FALSE)
224224

225225
names(gapped_V_alleles) <- clean_imgt_fasta_header_lines(allele_names, what)
226226

227+
## How many nucleotides sequences are missing on their 3' end
228+
## in order to have a complete FWR3.
229+
fwrcdr_max_nucs <- .IMGT_FWRCDR_MAX_LENGTHS * 3L
230+
fwr3_trimmed <- sum(fwrcdr_max_nucs) - width(gapped_V_alleles)
231+
fwr3_trimmed[fwr3_trimmed < 0L] <- 0L
232+
227233
## IMGT FWR/CDR fixed intervals in nucleotide space.
228-
imgt_bins <- PartitioningByWidth(.IMGT_FWRCDR_MAX_LENGTHS * 3L)
234+
imgt_bins <- PartitioningByWidth(fwrcdr_max_nucs)
229235
midx <- vmatchPattern(GAP_LETTER, gapped_V_alleles)
230236

231237
## Note that lengths() should propagate the names by default but it
@@ -247,7 +253,8 @@ compute_imgt_intdata <- function(gapped_V_alleles, as.IRangesList=FALSE)
247253
all_gaps_contained <-
248254
vapply(all_real_lens, attr, logical(1), "all_gaps_contained")
249255
coding_frame_start <- 2L - (starting_gap + 2L) %% 3L
250-
mcols(IRL) <- DataFrame(coding_frame_start=coding_frame_start,
256+
mcols(IRL) <- DataFrame(fwr3_trimmed=fwr3_trimmed,
257+
coding_frame_start=coding_frame_start,
251258
starting_gap=starting_gap,
252259
all_gaps_in_frame=all_gaps_in_frame,
253260
all_gaps_contained=all_gaps_contained)
@@ -256,3 +263,9 @@ compute_imgt_intdata <- function(gapped_V_alleles, as.IRangesList=FALSE)
256263
.IRL_to_data_frame(IRL)
257264
}
258265

266+
compute_imgt_intdata <- function(...)
267+
{
268+
.Deprecated("compute_V_gene_delineations")
269+
compute_V_gene_delineations(...)
270+
}
271+

‎R/create_region_db.R‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@
149149
internal_data_path <- file.path(destdir, "internal_data")
150150
stopifnot(!dir.exists(internal_data_path))
151151

152-
V_ndm_data <- as.data.frame(dna_mcols[ , names(IGBLAST_INTDATA_COL2CLASS)])
153-
check_V_ndm_data_col2class(V_ndm_data)
152+
ndm_data <- as.data.frame(dna_mcols[ , names(NDM_COL2CLASS)])
153+
check_ndm_data_col2class(ndm_data)
154154
dir.create(internal_data_path)
155155
destfile <- file.path(internal_data_path, "V.ndm.imgt")
156-
write_V_ndm_data(V_ndm_data, destfile)
156+
write_ndm_data(ndm_data, destfile)
157157
}
158158

159159

‎R/download_OGRDB_germline_json.R‎

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -156,33 +156,13 @@ makeogrannote <- function(ogrdb_json_file)
156156
"in JSON file: ", ogrdb_json_file))
157157
data <- character(0)
158158
}
159-
col2class <- head(IGBLAST_INTDATA_COL2CLASS, n=-1L)
159+
col2class <- head(NDM_COL2CLASS, n=-1L)
160160
m <- matrix(data, ncol=length(col2class), byrow=TRUE)
161161
df <- matrix2df(m, col2class)
162162
cbind(df, coding_frame_start=integer(nrow(df)))
163163
}
164164

165165

166-
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
167-
### same_intdata()
168-
###
169-
170-
### Returns TRUE if the 2 data.frames contain the same intdata (possibly
171-
### with their rows in different order).
172-
same_intdata <- function(intdata1, intdata2)
173-
{
174-
if (!identical(dim(intdata1), dim(intdata2)))
175-
return(FALSE)
176-
allele_names1 <- intdata1[ , "allele_name"]
177-
allele_names2 <- intdata2[ , "allele_name"]
178-
if (!setequal(allele_names1, allele_names2))
179-
return(FALSE)
180-
m <- match(allele_names1, allele_names2)
181-
intdata2 <- S4Vectors:::extract_data_frame_rows(intdata2, m)
182-
identical(intdata1, intdata2)
183-
}
184-
185-
186166
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
187167
### validate_OGRDB_intdata()
188168
###
@@ -207,10 +187,10 @@ same_intdata <- function(intdata1, intdata2)
207187
}
208188
stopifnot(length(V_fasta_file) == 1L)
209189

210-
intdata <- compute_imgt_intdata(V_fasta_file)
190+
intdata <- compute_V_gene_delineations(V_fasta_file)
211191
locus <- extract_loci_from_OGRDB_set_names(organism, names(germline_set))
212192
intdata$chain_type <- paste0("V", substr(locus, 3L, 3L))
213-
intdata[ , names(IGBLAST_INTDATA_COL2CLASS)]
193+
intdata[ , names(NDM_COL2CLASS)]
214194
}
215195

216196
### Returns the intdata in a data.frame.
@@ -258,6 +238,6 @@ validate_OGRDB_intdata <- function(organism, germline_set, source_set=FALSE,
258238
recache=recache, ...)
259239

260240
## Compare.
261-
same_intdata(intdata1, intdata2)
241+
same_ndm_data(intdata1, intdata2)
262242
}
263243

‎R/intdata-IO-utils.R‎

Lines changed: 0 additions & 130 deletions
This file was deleted.

‎R/intdata-utils.R‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ load_intdata <- function(organism, for.aa=FALSE,
7171
intdata_path <- get_intdata_path(organism, for.aa=for.aa,
7272
domain_system=domain_system,
7373
which=which)
74-
read_V_ndm_data(intdata_path)
74+
read_ndm_data(intdata_path)
7575
}
7676

7777

0 commit comments

Comments
 (0)