@@ -175,7 +175,7 @@ ped2com <- function(ped, component,
175175 }
176176 # Garbage collection if gc is TRUE
177177 if (gc ) {
178- rm(parList , lens )
178+ rm(parList , lens , list_of_adjacencies )
179179 gc()
180180 }
181181 }
@@ -278,8 +278,17 @@ ped2com <- function(ped, component,
278278 rm(isPar , newIsPar )
279279 gc()
280280 }
281+
282+ if (component == " generation" ) { # no need to do the rest
283+ return (gen )
284+ } else {
285+ if (verbose ) {
286+ cat(" Completed RAM path tracing\n " )
287+ }
288+ }
289+
281290 # --- Step 3: I-A inverse times diagonal multiplication ---
282- if (resume && file.exists(checkpoint_files $ final_matrix )) {
291+ if (resume && file.exists(checkpoint_files $ r2_checkpoint )) {
283292 if (verbose ) cat(" Resuming: Loading I-A inverse...\n " )
284293 r2 <- readRDS(checkpoint_files $ r2_checkpoint )
285294 } else {
@@ -302,15 +311,13 @@ ped2com <- function(ped, component,
302311 if (verbose ) cat(" Resuming: Loading tcrossprod...\n " )
303312 r <- readRDS(checkpoint_files $ tcrossprod_checkpoint )
304313 } else {
305- r <- compute_transpose (r2 = r2 , transpose_method = transpose_method , verbose = verbose )
314+ r <- .computeTranspose (r2 = r2 , transpose_method = transpose_method , verbose = verbose )
306315 if (saveable ) {
307316 saveRDS(r , file = checkpoint_files $ tcrossprod_checkpoint )
308317 }
309318 }
310319
311- if (component == " generation" ) {
312- return (gen )
313- } else {
320+
314321 if (component == " mitochondrial" ) {
315322 r @ x <- rep(1 , length(r @ x ))
316323 # Assign 1 to all nonzero elements for mitochondrial component
@@ -326,7 +333,6 @@ ped2com <- function(ped, component,
326333 saveRDS(r , file = checkpoint_files $ final_matrix )
327334 }
328335 return (r )
329- }
330336}
331337
332338# ' Take a pedigree and turn it into an additive genetics relatedness matrix
@@ -338,7 +344,7 @@ ped2add <- function(ped, max.gen = 25, sparse = FALSE, verbose = FALSE,
338344 gc = FALSE ,
339345 flatten.diag = FALSE , standardize.colnames = TRUE ,
340346 transpose_method = " tcrossprod" ,
341- adjacency_method = " indexed " ,
347+ adjacency_method = " direct " ,
342348 saveable = FALSE ,
343349 resume = FALSE ,
344350 save_rate = 5 ,
@@ -377,7 +383,7 @@ ped2mit <- ped2mt <- function(ped, max.gen = 25,
377383 flatten.diag = FALSE ,
378384 standardize.colnames = TRUE ,
379385 transpose_method = " tcrossprod" ,
380- adjacency_method = " indexed " ,
386+ adjacency_method = " direct " ,
381387 saveable = FALSE ,
382388 resume = FALSE ,
383389 save_rate = 5 ,
@@ -416,6 +422,7 @@ ped2cn <- function(ped, max.gen = 25, sparse = FALSE, verbose = FALSE,
416422 saveable = FALSE ,
417423 resume = FALSE ,
418424 save_rate = 5 ,
425+ adjacency_method = " indexed" ,
419426 save_rate_gen = save_rate ,
420427 save_rate_parlist = 1000 * save_rate ,
421428 save_path = " checkpoint/" ,
@@ -427,6 +434,7 @@ ped2cn <- function(ped, max.gen = 25, sparse = FALSE, verbose = FALSE,
427434 verbose = verbose ,
428435 gc = gc ,
429436 component = " common nuclear" ,
437+ adjacency_method = adjacency_method ,
430438 flatten.diag = flatten.diag ,
431439 standardize.colnames = standardize.colnames ,
432440 transpose_method = transpose_method ,
@@ -453,7 +461,7 @@ ped2ce <- function(ped,
453461# ' @inherit ped2com details
454462# ' @param r2 a relatedness matrix
455463# '
456- compute_transpose <- function (r2 , transpose_method = " tcrossprod" , verbose = FALSE ) {
464+ .computeTranspose <- function (r2 , transpose_method = " tcrossprod" , verbose = FALSE ) {
457465 if (! transpose_method %in% c(" tcrossprod" , " crossprod" , " star" , " tcross.alt.crossprod" , " tcross.alt.star" )) {
458466 stop(" Invalid method specified. Choose from 'tcrossprod', 'crossprod', or 'star'." )
459467 }
0 commit comments