TCGABioLinks getManifest() function. How to alter saved file name?

1

In the TCGABioLinks R package there is a function called getManifest() which allows you to download queries samples manifest files. I have two datasets that I'm trying to pull. One is a set of tumor samples with a specific mutation, the other is the set of samples without said mutation.

What I've done so far is to query these both using the GDCquery() function. My code is below

query <- GDCquery(project = "TCGA-BRCA", 
                 data.category = "Transcriptome Profiling",
                 data.type = "Gene Expression Quantification", 
                 workflow.type = "HTSeq - FPKM",
                 barcode = samples$V2)

# Samples without mutation
control_query <- GDCquery(project = "TCGA-BRCA", 
data.category = "Transcriptome Profiling", 
data.type = "Gene Expression Quantification", workflow.type = "HTSeq - FPKM", barcode = control$V2)

#Download manifest files
 getManifest(query, save=TRUE)
 getManifest(control_query, save=TRUE)

However, the problem lies with the fact that the saved manifest file is named gdc-manifest.txt, and there is no argument to change file name, so when I try to download two manifest files, one gets overwritten. How would I go about changing the file name?


TCGA


R


Bioconductor

• 180 views

Perhaps you can write a custom modified function, as Ram suggested, to change the file name:

getManifest.mod <- function(query, save = FALSE, save.dir = "gdc_manifest.txt") {
manifest <- query$results[[1]][,c("file_id","file_name","md5sum","file_size","state")]
colnames(manifest) <- c("id","filename","md5","size","state")
if(save)  {
    fname <- save.dir
    write_delim(manifest,fname,delim = "t")
    file <- file.path(getwd(),fname)
    message("Manifest saved as: ", file)
}
return(manifest)
}

Without changing too much of the original code, just be sure to set your working directory to the path where you want the file to save. Change save.dir from the default "gdc_manifest.txt" to the file name you want.


Login
before adding your answer.

Traffic: 1194 users visited in the last hour



Source link