Skip to content

Commit bc39c70

Browse files
Fix 17 style issues in R/buildComponent.R
Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com>
1 parent f91324c commit bc39c70

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

R/buildComponent.R

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ ped2com <- function(ped, component,
150150
}
151151

152152
if (mz_method %in% c("merging") && mz_twins == TRUE && !is.null(mz_row_pairs) && length(mz_row_pairs) > 0 &&
153-
config$component %in% c("additive")) {
153+
config$component %in% c("additive")) {
154154
# replace all MZ twin IDs with the first twin's ID in each pair so they are merged for the path tracing and all subsequent steps. We will copy the values back to the second twin at the end.
155155
ped <- fuseTwins(ped = ped, mz_row_pairs = mz_row_pairs, mz_id_pairs = mz_id_pairs, config = config, beta = beta)
156156
if (config$verbose == TRUE) {
@@ -233,7 +233,7 @@ ped2com <- function(ped, component,
233233

234234

235235
if (config$resume == TRUE && file.exists(checkpoint_files$r_checkpoint) &&
236-
file.exists(checkpoint_files$gen_checkpoint) &&
236+
file.exists(checkpoint_files$gen_checkpoint) &&
237237
file.exists(checkpoint_files$mtSum_checkpoint) &&
238238
file.exists(checkpoint_files$newIsPar_checkpoint) &&
239239
file.exists(checkpoint_files$count_checkpoint)
@@ -341,7 +341,7 @@ ped2com <- function(ped, component,
341341
# --- Step 4: T crossproduct ---
342342

343343
if (config$resume == TRUE && file.exists(checkpoint_files$tcrossprod_checkpoint) &&
344-
config$component != "generation") {
344+
config$component != "generation") {
345345
if (config$verbose == TRUE) message("Resuming: Loading tcrossprod...\n")
346346
r <- readRDS(checkpoint_files$tcrossprod_checkpoint)
347347
} else {
@@ -428,7 +428,7 @@ ped2com <- function(ped, component,
428428
if (config$saveable == TRUE) {
429429
saveRDS(r, file = checkpoint_files$final_matrix, compress = config$compress)
430430
}
431-
return(r)
431+
r
432432
}
433433

434434
#' Take a pedigree and turn it into an additive genetics relatedness matrix
@@ -647,19 +647,19 @@ ped2ce <- function(ped, ...) {
647647
}
648648
)
649649

650-
return(result)
650+
result
651651
}
652652

653653
#' Initialize checkpoint files
654654
#' @inheritParams ped2com
655655
#' @keywords internal
656656

657657
initializeCheckpoint <- function(config = list(
658-
verbose = FALSE,
659-
saveable = FALSE,
660-
resume = FALSE,
661-
save_path = "checkpoint/"
662-
)) {
658+
verbose = FALSE,
659+
saveable = FALSE,
660+
resume = FALSE,
661+
save_path = "checkpoint/"
662+
)) {
663663
# Define checkpoint files
664664
# Ensure save path exists
665665
if (config$saveable == TRUE && !dir.exists(config$save_path)) {
@@ -693,7 +693,7 @@ initializeCheckpoint <- function(config = list(
693693
final_matrix = file.path(config$save_path, "final_matrix.rds")
694694
)
695695

696-
return(checkpoint_files)
696+
checkpoint_files
697697
}
698698

699699
#' Assign parent values based on component type
@@ -703,12 +703,12 @@ initializeCheckpoint <- function(config = list(
703703
if (component %in% c("generation", "additive")) {
704704
parVal <- .5
705705
} else if (component %in%
706-
c("common nuclear", "mitochondrial", "mtdna", "mitochondria")) {
706+
c("common nuclear", "mitochondrial", "mtdna", "mitochondria")) {
707707
parVal <- 1
708708
} else {
709709
stop("Don't know how to set parental value")
710710
}
711-
return(parVal)
711+
parVal
712712
}
713713

714714
#' Load or compute a checkpoint
@@ -726,12 +726,12 @@ loadOrComputeCheckpoint <- function(file, compute_fn,
726726
compress = TRUE) {
727727
if (config$resume == TRUE && file.exists(file)) {
728728
if (config$verbose == TRUE && !is.null(message_resume)) cat(message_resume)
729-
return(readRDS(file))
729+
readRDS(file)
730730
} else {
731731
if (config$verbose == TRUE && !is.null(message_compute)) cat(message_compute)
732732
result <- compute_fn()
733733
if (config$saveable == TRUE) saveRDS(result, file = file, compress = compress)
734-
return(result)
734+
result
735735
}
736736
}
737737

@@ -763,7 +763,7 @@ loadOrComputeCheckpoint <- function(file, compute_fn,
763763
compress = compress
764764
)
765765

766-
return(isPar)
766+
isPar
767767
}
768768

769769
#' Load or compute the isChild matrix
@@ -783,7 +783,7 @@ loadOrComputeCheckpoint <- function(file, compute_fn,
783783
compress = compress
784784
)
785785

786-
return(isChild)
786+
isChild
787787
}
788788

789789
#' Load or compute the inverse diagonal matrix
@@ -812,7 +812,7 @@ loadOrComputeCheckpoint <- function(file, compute_fn,
812812
rm(r, isChild)
813813
gc()
814814
}
815-
return(r2)
815+
r2
816816
}
817817

818818

@@ -834,7 +834,7 @@ loadOrComputeCheckpoint <- function(file, compute_fn,
834834
parList = NULL, lens = NULL,
835835
compress = TRUE) {
836836
if (config$resume == TRUE &&
837-
file.exists(checkpoint_files$parList) &&
837+
file.exists(checkpoint_files$parList) &&
838838
file.exists(checkpoint_files$lens)) {
839839
if (config$verbose == TRUE) {
840840
message("Resuming: Loading parent-child adjacency data...\n")
@@ -857,7 +857,7 @@ loadOrComputeCheckpoint <- function(file, compute_fn,
857857
}
858858

859859
if (config$resume == TRUE &&
860-
file.exists(checkpoint_files$iss) &&
860+
file.exists(checkpoint_files$iss) &&
861861
file.exists(checkpoint_files$jss)) { # fix to check actual
862862
if (config$verbose == TRUE) message("Resuming: Constructed matrix...\n")
863863
jss <- readRDS(checkpoint_files$jss)
@@ -894,5 +894,5 @@ loadOrComputeCheckpoint <- function(file, compute_fn,
894894
saveRDS(list_of_adjacencies$iss, file = checkpoint_files$iss, compress = compress)
895895
}
896896
}
897-
return(list_of_adjacencies)
897+
list_of_adjacencies
898898
}

0 commit comments

Comments
 (0)