@@ -34,6 +34,7 @@ samples_df <- fread(patients)|>
3434
3535pdx_samps <- subset(samples_df ,model_type == ' patient derived xenograft' )
3636tumor_samps <- subset(samples_df ,model_type == ' tumor' )
37+ mt_samps <- subset(samples_df ,model_type == ' organoid' )
3738
3839# #now get the manifest from synapse
3940manifest <- synapser :: synTableQuery(" select * from syn53503360" )$ asDataFrame()| >
@@ -45,14 +46,19 @@ manifest<-synapser::synTableQuery("select * from syn53503360")$asDataFrame()|>
4546# #they each get their own sample identifier
4647pdx_data <- manifest | > dplyr :: select(common_name ,starts_with(" PDX" ))| >
4748 left_join(pdx_samps )| >
48- dplyr :: select(improve_sample_id ,RNASeq = ' PDX_RNASeq' ,Mutations = ' PDX_Somatic_Mutations' ,CopyNumber = ' PDX_CNV' ,Proteomics = ' PDX_Proteomics' )
49+ dplyr :: select(improve_sample_id ,common_name , model_type , RNASeq = ' PDX_RNASeq' ,Mutations = ' PDX_Somatic_Mutations' ,CopyNumber = ' PDX_CNV' ,Proteomics = ' PDX_Proteomics' )
4950
5051tumor_data <- manifest | > dplyr :: select(common_name ,starts_with(" Tumor" ))| >
5152 left_join(tumor_samps )| >
52- dplyr :: select(improve_sample_id ,RNASeq = ' Tumor_RNASeq' ,Mutations = ' Tumor_Somatic_Mutations' ,CopyNumber = ' Tumor_CNV' )| >
53+ dplyr :: select(improve_sample_id ,common_name , model_type , RNASeq = ' Tumor_RNASeq' ,Mutations = ' Tumor_Somatic_Mutations' ,CopyNumber = ' Tumor_CNV' )| >
5354 mutate(Proteomics = ' ' ) # #we dont have tumor proteomics from these samples
5455# print(tumor_data)
5556
57+ mt_data <- manifest | > dplyr :: select(common_name ,starts_with(" PDX" ))| >
58+ left_join(mt_samps )| >
59+ dplyr :: select(improve_sample_id ,common_name ,model_type , RNASeq = ' PDX_RNASeq' ,Mutations = ' PDX_Somatic_Mutations' ,CopyNumber = ' PDX_CNV' ,Proteomics = ' PDX_Proteomics' )# #we dont have mt data yet, so collecting PDX instead
60+ # print(tumor_data)
61+
5662
5763combined <- rbind(pdx_data ,tumor_data )| > distinct()
5864
@@ -61,10 +67,10 @@ genes_df <- fread(genefile)
6167
6268
6369# #added proteomics first
64- proteomics <- do.call(' rbind' ,lapply(setdiff(combined $ Proteomics ,c(' ' ,NA ," NA" )),function (x ){
70+ proteomics <- do.call(' rbind' ,lapply(setdiff(mt_data $ Proteomics ,c(' ' ,NA ," NA" )),function (x ){
6571 # if(x!=""){
6672 # print(x)
67- sample <- subset(combined ,Proteomics == x )
73+ sample <- subset(mt_data ,Proteomics == x )
6874 # print(sample)
6975 res <- fread(synGet(x )$ path )| >
7076 # tidyr::separate(Name,into=c('other_id','vers'),sep='\\.')|>
@@ -88,10 +94,10 @@ fwrite(proteomics,'/tmp/mpnst_proteomics.csv.gz')
8894
8995# ### FIRST WE GET RNASeq Data
9096
91- rnaseq <- do.call(' rbind' ,lapply(setdiff(combined $ RNASeq ,c(NA ," NA" )),function (x ){
97+ rnaseq <- do.call(' rbind' ,lapply(setdiff(mt_data $ RNASeq ,c(NA ," NA" )),function (x ){
9298 # if(x!=""){
9399 # print(x)
94- sample <- subset(combined ,RNASeq == x )
100+ sample <- subset(mt_data ,RNASeq == x )
95101 # print(sample)
96102 res <- fread(synGet(x )$ path )| >
97103 tidyr :: separate(Name ,into = c(' other_id' ,' vers' ),sep = ' \\ .' )| >
@@ -114,11 +120,11 @@ fwrite(rnaseq,'/tmp/mpnst_transcriptomics.csv.gz')
114120
115121# ####NEXT WE DO WES DATA
116122print(" Getting WES" )
117- wes <- do.call(rbind ,lapply(setdiff(combined $ `Mutations` ,c(NA ," NA" )),function (x ){
123+ wes <- do.call(rbind ,lapply(setdiff(mt_data $ `Mutations` ,c(NA ," NA" )),function (x ){
118124
119125 x2 = x # gsub('"','',gsub("[",'',gsub("]",'',x,fixed=T),fixed=T),fixed=T)
120126 print(x )
121- sample <- subset(combined ,Mutations == x )
127+ sample <- subset(mt_data ,Mutations == x )
122128 print(sample $ improve_sample_id )
123129 res <- NULL
124130 try(res <- fread(synGet(x2 )$ path )| >
@@ -141,11 +147,11 @@ fwrite(wes,'/tmp/mpnst_mutations.csv.gz')
141147
142148print(paste(" getting CNV" ))
143149# #next let's do CNVs!
144- cnv <- do.call(rbind ,lapply(setdiff(combined $ CopyNumber ,c(NA ," NA" )),function (x ){
150+ cnv <- do.call(rbind ,lapply(setdiff(mt_data $ CopyNumber ,c(NA ," NA" )),function (x ){
145151
146152 x2 = x # gsub('"','',gsub("[",'',gsub("]",'',x,fixed=T),fixed=T),fixed=T)
147153 print(x )
148- sample <- subset(combined ,CopyNumber == x )
154+ sample <- subset(mt_data ,CopyNumber == x )
149155 print(sample $ improve_sample_id )
150156 res <- fread(synGet(x2 )$ path )
151157
0 commit comments