This is a test version of Biostars. For the public version, visit https://www.biostars.org.
DeconstructSigs - Multiple sample size(~90 samples)

Hi,

I have around 90 Samples (taken from same tissues from different patients) in my .maf files, and i am planning to use deconstructsigs package . I am not stuck about how should be determining the signatures contributing to these 90 samples at a go? Its very difficult to provide sample.id every time. It would be really helpful if you can please help me in this case

For example:

sample_1 = whichSignatures(tumor.ref = sigs.input,
signatures.ref = signatures.nature2013,
sample.id = 1,
contexts.needed = TRUE,
tri.counts.method = 'default')

Should i manually change this every time and generate a graph or can i run these 90 samples together and generate graph at once? Its very confusing to run manually every sample.Please help.

Thanks a ton, Zac

deconstructsigs maf multiple samples

If your sample IDs are 1 to 90 why not simply do a loop instead of manually test them all?

sapply(1:90, function(x) whichSignatures(tumor.ref = sigs.input,
signatures.ref = signatures.nature2013,
sample.id = x,
contexts.needed = TRUE,
tri.counts.method = 'default'))

Then combine the results as a single dataframe and process it to graph your results as you like (all together or one by one)

Thanks a lot for your reply, i have sample ids as tumor sample bar codes, like TCGA-IC-A6RF-01A-13D-A33E-09 (96 samples altogether), Can you please guide how best i can run this? i have limited knowledge about coding. Thanks alot

1 answer

  1. Create a vector with your sample IDs:

    ids <- c("ID1", "ID2", ... , "IDn")

NB: This can maybe be obtained elsewhere. If you have a dataframe that contain all the IDs in one column you could load this dataframe and extract the IDs:

data <- read.table("file", sep="\t", header=T)
ids <- unique(data$sampleID)
  1. Run the loop using those IDs:

    results <- sapply(ids, function(x) whichSignatures(tumor.ref = sigs.input, signatures.ref = signatures.nature2013, sample.id = x, contexts.needed = TRUE, tri.counts.method = 'default'))
    

This simply says "take my vector of IDs and use them one by one to repeat this function". X will be your ID1 then ID2 then ... up to IDn.

The results should be a dataframe with columns equals to your sample IDs and in the same order so rename the columns:

colnames(results) <- ids

Something like this should work.

Thanks a Lot this Worked !!! I am very very thankful to you .... I have one last concerns how to save "results" in a .txt file?

write.table(results, "/path/to/your/file.txt", sep="\t", quote=F, row.names=F)

Thanks Lot !!! Its a great help. Thanks again :)

Hi VHahaut, using this method I have a dataframe of my samples. However when I try to do sapply(ids, function(x) makePie(x, sub = x) it gives me an error saying Error in[[.default(sigs.output, "weights") : subscript out of bounds. Any way I should be processing this data?

Log in to answer this question.