Skip to content

Commit 2075a4c

Browse files
Tiago SilvaTiago Silva
Tiago Silva
authored and
Tiago Silva
committed
#546 Updating days_to_follow_up and vital status
Should we add a parameter to control this update?
1 parent 3d99f1c commit 2075a4c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

R/clinical.R

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,22 @@ GDCprepare_clinic <- function(
540540
clin$primary_pathology <- NULL
541541
}
542542

543+
# Update clinical data with follow-ups: days_to_last_followup and vital_status
544+
message("Updating days_to_last_followup and vital_status from follow_up information using last entry")
545+
followup <- parseFollowup(files,xpath,clinical.info)
546+
547+
followup_last <- followup %>% dplyr::group_by(bcr_patient_barcode) %>% dplyr::summarise(
548+
days_to_last_followup = max(as.numeric(days_to_last_followup),na.rm = TRUE),
549+
vital_status = vital_status[
550+
ifelse(
551+
any(followup$days_to_last_followup %in% ""),
552+
which(followup$days_to_last_followup %in% ""),
553+
which.max(days_to_last_followup)
554+
)
555+
]
556+
)
557+
clin$days_to_last_followup <- followup_last$days_to_last_followup[match(clin$bcr_patient_barcode,followup_last$bcr_patient_barcode)]
558+
clin$vital_status <- followup_last$vital_status[match(clin$bcr_patient_barcode,followup_last$bcr_patient_barcode)]
543559
}
544560

545561
if (tolower(clinical.info) == "sample") {

0 commit comments

Comments
 (0)