@@ -10,14 +10,12 @@ if(length(args) > 1 ){
1010 stop(" Up to one argument is allowed. This is the filepath to the previously run samples file." )
1111}
1212
13-
1413if (length(args ) == 0 || is.na(args [1 ]) || args [1 ] == " " || ! file.exists(args [1 ])) {
1514 orig_samples <- " "
1615} else {
1716 orig_samples <- fread(args [1 ])
1817}
1918
20-
2119# Check if Synapse token is available from the environment
2220synapse_token <- Sys.getenv(" SYNAPSE_AUTH_TOKEN" )
2321if (synapse_token == " " ) {
@@ -28,6 +26,10 @@ synapser::synLogin(authToken=synapse_token)
2826manifest <- synapser :: synTableQuery(" select * from syn53503360" )$ asDataFrame()| >
2927 as.data.frame()
3028
29+ # Drop contaminated sample JH-2-009
30+ manifest <- manifest %> %
31+ filter(Sample != " JH-2-009" )
32+
3133
3234# ##sample file has a strict schema
3335# # - improve_sample_id
@@ -61,31 +63,13 @@ main<-rbind(sampTable,pdxmt)|>
6163 dplyr :: select(- MicroTissueDrugFolder )| >
6264 rbind(tumorTable )
6365
64- # main <- fread("mpnst/NF_MPNST_samples.csv")
65- # previous_aml <- fread(args[1])#"beatAML/beataml_samples.csv")
66-
6766# If there is no previous samples file - start at 1, else, continue where the previous one left off.
6867if (identical(orig_samples , " " )) {
6968 max_id <- 1
7069} else {
7170 max_id <- max(orig_samples $ improve_sample_id , na.rm = TRUE )
7271}
7372
74-
7573main $ improve_sample_id <- seq(from = max_id + 1 , length.out = nrow(main ))
7674
77- # synapse_main <- fread("mpnst/synapse_NF-MPNST_samples.csv")
78- # Step 1: Create a dictionary from 'main'
79- # id_dict <- setNames(main$improve_sample_id, main$other_id)
80-
81- # Step 2: Update 'ID' in 'synapse_main'
82- # synapse_main$ID <- id_dict[synapse_main$Sample]
83-
84- # Handling NA values if any mismatch occurs (Optional based on your data integrity)
85- # If there are NAs generated, you might need to check for unmatched keys
86- # synapse_main$ID[is.na(synapse_main$ID)] <- -1 # Assign a placeholder like -1 for unmatched rows
87-
88- # Step 3: Save the updated 'synapse_main'
89- # fwrite(synapse_main, "mpnst/synapse_NF-MPNST_samples.csv")
90- # fwrite(main, "mpnst/NF_MPNST_samples.csv") # updated sample file
9175fwrite(main ,' /tmp/mpnst_samples.csv' )
0 commit comments