Differential expression analysis of TCGA data based on tumor staging

Hi everyone
I wanted to analyze TCGA-BRCA data for identifying DEGs in different TNM stages (I to IV) between Normal and Tumor. How to change the following code to get the DEGs based on the staging?

CancerProject <- "TCGA-BRCA"
DataDirectory <- paste0("../GDC/",gsub("-","_",CancerProject))
FileNameData <- paste0(DataDirectory, "_","HTSeq_Counts",".rda")

query <- GDCquery(project = CancerProject,
              data.category = "Transcriptome Profiling",
              data.type = "Gene Expression Quantification", 
              workflow.type = "HTSeq - Counts")

samplesDown <- getResults(query,cols=c("cases"))

dataSmTP <- TCGAquery_SampleTypes(barcode = samplesDown,
                              typesample = "TP")

dataSmNT <- TCGAquery_SampleTypes(barcode = samplesDown,
                              typesample = "NT")


queryDown <- GDCquery(project = CancerProject, 
                  data.category = "Transcriptome Profiling",
                  data.type = "Gene Expression Quantification", 
                  workflow.type = "HTSeq - Counts",
                  barcode = c(dataSmTP, dataSmNT))

GDCdownload(query = queryDown,
        directory = DataDirectory)

dataPrep <- GDCprepare(query = queryDown, 
                   save = TRUE, 
                   directory =  DataDirectory,
                   save.filename = FileNameData)

dataPrep <- TCGAanalyze_Preprocessing(object = dataPrep, 
                                  cor.cut = 0.6,
                                  datatype = "HTSeq - Counts")                      

dataNorm <- TCGAanalyze_Normalization(tabDF = dataPrep,
                                  geneInfo = geneInfoHT,
                                  method = "gcContent") 

dataFilt <- TCGAanalyze_Filtering(tabDF = dataNorm,
                              method = "quantile", 
                              qnt.cut =  0.25)   

dataDEGs <- TCGAanalyze_DEA(mat1 = dataFilt[,dataSmTP],
                        mat2 = dataFilt[,dataSmNT],
                        Cond1type = "Tumor",
                        Cond2type = "Normal",
                        metadata = TRUE,
                        fdr.cut = 0.05 ,
                        logFC.cut = 1,
                        method = "glmLRT")

Source link