paiva-s-lab / FlowCT

FlowCT: A semi-automated workflow for deconvolution of immunophenotypic data and objective reporting on large datasets
4 stars 4 forks source link

unify.FCSheaders #11

Closed Aminach1 closed 5 months ago

Aminach1 commented 8 months ago

Hello,

I am encountering an issue while executing the unify.FCSheaders function. Specifically, when I set fix=F, the identification of name inconsistencies appears to be functioning correctly. In my example, three files exhibit variations in marker names.

library(FlowCT)
unify.FCSheaders(directory = "fresh_samples_healthy", pattern = "fcs", fix = F)
unify1 unify2

However, when I set the "fix" option to TRUE, the files with inconsistencies are not replaced by the corrected versions, resulting in the following error.

unify.FCSheaders(directory = "fresh_samples_healthy", pattern = "fcs", fix = T)

>>> Channels:makers pattern selected for correcting:
[1] "FSC-A:NA, FSC-H:NA, SSC-A:NA, SSC-B-A:NA, SSC-B-H:NA, SSC-H:NA, FJComp-APC-A:CD127, FJComp-APC-Fire 750-A:CD11c, FJComp-APC-Fire810-A:CD38, FJComp-Alexa Fluor 647-A:CD123, FJComp-BV421-A:CCR7, FJComp-BV510-A:CD45, FJComp-BV570-A:CD3, FJComp-BV605-A:IgD, FJComp-BV650-A:CD28, FJComp-BV711-A:CD24, FJComp-BV750-A:CD56, FJComp-BV785-A:CD14, FJComp-FITC-A:CD57, FJComp-PE Fire 810-A:HLA-DR, FJComp-PE-A:TCRgd, FJComp-PE-Cy7-A:CD27, FJComp-PE-Dazzle594-A:CD34, FJComp-PE-Fire 640-A:CD19, FJComp-PE-Fire 700-A:CD25, FJComp-Pacific Blue-A:CD16, FJComp-PerCP-A:CD8, FJComp-R718-A:CD161, FJComp-Spark Blue 550-A:CD4, FJComp-Spark NIR 685-A:CD45RA, FJComp-Zombie NIR-A:viab, Time:NA"
Error in aux@exprs[, o$channels] : subscript out of bounds

How can I resolve this problem? Thanks!

jgarces02 commented 8 months ago

Most probably this is because each group of files have non-overlapping channels and therefore cannnot unify names. Are these from different cytometers or with different settings?

Aminach1 commented 8 months ago

Thank you for your prompt response. All 11 files were measured with the same cytometer and also with the same settings (also with the same panel).

jgarces02 commented 8 months ago

Can you send me a couple of files for each one of the groups with different headers, please? (jgarces@unav.es)

Aminach1 commented 8 months ago

Okay, Thank you!

jgarces02 commented 6 months ago

Hi @Aminach1, thanks for your patience. It seems that the problem with your files is the header of the second one includes additional text in front of the channels’ names and this is crashing the function.

image

What I suggest to you is to adjust them manually through these lines:

file <- "flowframe2.fixed.fcs"

aux <- flowCore::read.FCS(file)
colnames(aux) <- gsub("FJComp-", "", colnames(aux))
flowCore::write.FCS(aux, filename = paste0(gsub("fcs", "", file), "fixed.fcs"))
jgarces02 commented 5 months ago

I'm closing this issue. Please, feel free to re-open it again if needed. Thanks.