@@ -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+
0 commit comments