QFeatures icon indicating copy to clipboard operation
QFeatures copied to clipboard

Create QFeatures from multiple files

Open lgatto opened this issue 5 years ago • 2 comments

There is a need for a constructor or an example that creates a QFeatures from multiple input files where each produces an assay. One way to do this would be to lapply over the csv files, importing each one with readSummarizedExperiment() to get a list and then use that one to manually construct the QFeatures object.

@cvanderaa - any input from your scp data experience?

lgatto avatar Jul 16 '20 19:07 lgatto

I would draw your attention on the following aspects:

  • The ecol should be constant for all files supplied to readSummarizedExperiment unless we use mapply.
  • If the ecols are constant across files, we need to rename the column names because column names in each SummarizedExperiment should be different between assays, otherwise this will break the SampleMap and colData.
  • The colData of the QFeatures object needs to be supplied separately.

In order to automate this process, I let the user supply a metadata table. Each row holds information about a single sample (or tag in case of multiplexing). The information that the rows contain are:

  • File name to extract the quantitative data from
  • Name of the ecol that contains the quantitative data for that sample (or tag)
  • (optional) batch- and sample-specific variables to use to build the colData

From this table, we can easily extract the required information to set up an mapply call (or a for loop) that automatically extracts the SummarizedExperiments and automatically builds the colData.

cvanderaa avatar Jul 17 '20 10:07 cvanderaa

I think the easiest here would be to:

  1. iterate over all files and use readSummarizedExperiment()
  2. Then create the final object with QFeatures(list(...))

lgatto avatar Aug 25 '22 10:08 lgatto