From 957fd896bbbc95834e715ccd7fc64ca74291f23c Mon Sep 17 00:00:00 2001 From: Thomas Yu Date: Thu, 5 Nov 2020 11:28:52 -0800 Subject: [PATCH] Hot fixes (#365) Co-authored-by: Thomas Yu --- genie/dashboardTemplate.Rmd | 47 ++++++++++++++++++++---------------- genie/database_to_staging.py | 2 +- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/genie/dashboardTemplate.Rmd b/genie/dashboardTemplate.Rmd index 3da0899b..4259ef4e 100644 --- a/genie/dashboardTemplate.Rmd +++ b/genie/dashboardTemplate.Rmd @@ -349,37 +349,42 @@ possible_retracted = public_sampledf[!exist_idx & !in_db_samples_idx, # Determine if sample is explicitly or implicitly retracted # assume most samples are implicitly retracted -possible_retracted$RETRACTION = "implicit" -# Get explicitly retracted -retracted_patient = synTableQuery( - sprintf("select geniePatientId from %s", patient_retract_synid) -) -retracted_patientdf = retracted_patient$asDataFrame() -retracted_sample = synTableQuery( - sprintf("select genieSampleId from %s", sample_retract_synid) -) -retracted_sampledf = retracted_sample$asDataFrame() - -retracted_patients_idx = possible_retracted$PATIENT_ID %in% - retracted_patientdf$geniePatientId -retracted_samples_idx = possible_retracted$SAMPLE_ID %in% - retracted_sampledf$genieSampleId - -possible_retracted$RETRACTION[ - retracted_patients_idx & retracted_samples_idx -] = 'explicit' +if (nrow(possible_retracted) > 0) { + possible_retracted$RETRACTION = "implicit" + # Get explicitly retracted + retracted_patient = synTableQuery( + sprintf("select geniePatientId from %s", patient_retract_synid) + ) + retracted_patientdf = retracted_patient$asDataFrame() + retracted_sample = synTableQuery( + sprintf("select genieSampleId from %s", sample_retract_synid) + ) + retracted_sampledf = retracted_sample$asDataFrame() + + retracted_patients_idx = possible_retracted$PATIENT_ID %in% + retracted_patientdf$geniePatientId + retracted_samples_idx = possible_retracted$SAMPLE_ID %in% + retracted_sampledf$genieSampleId + + possible_retracted$RETRACTION[ + retracted_patients_idx & retracted_samples_idx + ] = 'explicit' +} write.csv(possible_retracted, "samples_to_retract.csv", row.names=F, quote=F) ent = synStore(File("samples_to_retract.csv", parent=release_synid)) unlink("samples_to_retract.csv") - ``` This table below lists the number of samples explicitly or implicitly retracted by centers. ```{r} -kable(table(possible_retracted$CENTER, possible_retracted$RETRACTION)) +if (nrow(possible_retracted) > 0) { + kable(table(possible_retracted$CENTER, possible_retracted$RETRACTION)) +} else { + kable(possible_retracted) +} ``` These sample/patient IDs have been marked for retraction from GENIE: `r paste0("https://www.synapse.org/#!Synapse:", ent$properties$id)` and have been removed from the GENIE database. However, removal from public release files occurs according to the following fixed schedule. Please apprise your patients of this schedule so that they are aware of the timeline for retraction of their data. If you see samples that should not be retracted, please upload a fix to your data or let Tom Yu from Sage know immediately. diff --git a/genie/database_to_staging.py b/genie/database_to_staging.py index 0b6025e6..26790b9e 100644 --- a/genie/database_to_staging.py +++ b/genie/database_to_staging.py @@ -88,7 +88,7 @@ def store_file(syn, filePath, genieVersion="database", name=None, if cBioFileFormat is not None: ent.cBioFileFormat = cBioFileFormat if tag_or_commit is None: - tag_or_commit = f"v{__version__.__version__}" + tag_or_commit = f"v{__version__}" ent = syn.store( ent, used=f"https://github.com/Sage-Bionetworks/Genie/tree/{tag_or_commit}"