MahShaaban / pcr

Quality assessing, analyzing and testing the statistical significance of real-time quantitative PCR data
https://CRAN.R-project.org/package=pcr
GNU General Public License v3.0
27 stars 8 forks source link

Use column in data table for grouping when column name is passed as string to group_var #31

Open marcora opened 3 years ago

marcora commented 3 years ago

It would be nice if I could specify a column name as grouping variable instead of supplying it as a vector.

For example:

pcr_analyze(ct1,
group_var = 'tissue',
reference_gene = 'GAPDH',
reference_group = 'brain',
method = 'delta_delta_ct')

would use values in the 'tissue' column as grouping variable.

Same approach could be used for specifying covariates for lm, if covariate (or target_gene) column name(s) could be specified rather than implying all columns correspond to genes.

MahShaaban commented 3 years ago

The problem with this approach is that the user would have to also specify the column names for the genes of interest. I chose early on to make the main input data.frame to be only the Ct values to simplify things.

marcora commented 3 years ago

The column names for the genes of interest can be automatically generated by subtracting the columns specified in the "reference_gene" and "group_var" parameter (and an additional "covars" parameter listing, as a string or string vector, column name(s) for covariate(s)). No need for the user to list the names of all "genes of interest" columns.