immunomethylomics / FlowSorted.Blood.EPIC

This package includes a new cell reference for adult peripheral blood deconvolution arrayed using Illumina HumanMethylationEPIC
7 stars 5 forks source link

Fix default platform for CordBloodCombined #7

Closed mcanouil closed 2 years ago

mcanouil commented 3 years ago

This PR fix a typo when setting the default platform for CordBloodCombined when not setting referenceset (detected because of #6 ). https://github.com/immunomethylomics/FlowSorted.Blood.EPIC/blob/2a11906c0d4660a9411ebf7d45062d9e730ea00f/R/estimateCellCounts2.R#L343-L344

This PR also trimmed all trailing spaces (not intentional though).

lucassalas commented 3 years ago

Hi @mcanouil ,

Sorry, I detected this typo and somehow I missed to fix it. Please see the example and you will see why you got the problem. Line 344 is just for those who do not follow the example and input EPIC as a reference set. In this case the reference platform refers to the last part of the name of the library in this case 450k, If you input EPIC, the program will miss it. I had to add that line because it was a recurring problem, but it also generates a problem. If in the future a package named FlowSorted.CordBloodCombined.EPIC is developed, the function will miss it.

I will check the functions, though. The merge will take some time to propagate.

mcanouil commented 3 years ago

I had to fix this, because of the issue reported in #6

If the idea is to allow for FlowSorted.CordBloodCombined.EPIC, then we can add a "fall back" condition to check if it exists (or more accurately, if it is installed).

if (
  compositeCellType == "CordBloodCombined" && 
    !require(referencePkg)
) {
  platform <- "450k"
}

Or with get (I would avoid it because of #6)

if (
  compositeCellType == "CordBloodCombined" && 
    inherits(try(get(referencePkg), silent = TRUE), "try-error")
) {
  platform <- "450k"
}