Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: Some data values of ... channel exceed its $PnR value 175864747 and will be truncated! To avoid truncation, either fix $PnR before generating FCS or set 'truncate_max_range = FALSE'? #249

Open
denvercal1234GitHub opened this issue Mar 17, 2023 · 3 comments

Comments

@denvercal1234GitHub
Copy link

denvercal1234GitHub commented Mar 17, 2023

Hi there,

Thank you for the package.

Following up on #109, I too encountered a warning/advice to "avoid truncation, either fix $PnR before generating FCS or set 'truncate_max_range = FALSE'" during write.FCS when performing the infinity_flow() (ebecht/infinityFlow#20)

Reading https://support.bioconductor.org/p/130629/, it looks like the solution is to perform range(fr, type = "data") after read.FCS() to use the min/max taken from the actual data so that when export, write.FCS will not use the default instrument values.

@SamGG seemed to hint at https://github.com/ParkerICI/premessa to append truncate_max_range = FALSE in #169

Is performing range what people typically do and all I should do?

Thank you again very much for your help.

fr <- read.FCS(fcs_file_path)
range(fr) # will default to instrument range
range(fr, type = "data") # Will use the actual values, as in summary
> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.2.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] infinityFlow_1.6.0 flowCore_2.10.0   

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.10         lattice_0.20-45     codetools_0.2-19    matrixStats_0.63.0  RProtoBufLib_2.10.0
 [6] png_0.1-8           grid_4.2.2          stats4_4.2.2        pbapply_1.7-0       sp_1.6-0           
[11] raster_3.6-20       S4Vectors_0.36.1    generics_0.1.3      tools_4.2.2         Biobase_2.58.0     
[16] parallel_4.2.2      compiler_4.2.2      terra_1.7-18        BiocGenerics_0.44.0 cytolib_2.10.1     
[21] matlab_1.0.4    
@denvercal1234GitHub denvercal1234GitHub changed the title Warning: Some data values of ... channel exceed its $PnR value 175864747 and will be truncated! To avoid truncation, either fix $PnR before generating FCS or set 'truncate_max_range = FALSE' Warning: Some data values of ... channel exceed its $PnR value 175864747 and will be truncated! To avoid truncation, either fix $PnR before generating FCS or set 'truncate_max_range = FALSE'? Mar 17, 2023
@mikejiang
Copy link
Member

range(fr, type = "data") is read-only accessor which doesn't mutate your data, besides once your data is read through fr <- read.FCS(fcs_file_path), data is potentially already truncated, there will be no point to further correct range information.
I think you just need to switch truncation off when you read the file
fr <- read.FCS(fcs_file_path,truncate_max_range=F)

@denvercal1234GitHub
Copy link
Author

Thank you @mikejiang.

In our case, unfortunately, having read.FCS(truncate_max_range=F) does not seem to solve the issue because I still got the warning when I ran the infinity_flow() function from infinityFlow package (ebecht/infinityFlow#20).

Looking into the codes of infinity_flow() at line 16 (https://github.com/ebecht/infinityFlow/blob/master/R/00_master.R), it appears that truncate_max_range was already set to FALSE.

#' @param extra_args_read_FCS list of named arguments to pass to flowCore:read.FCS. Defaults to list(emptyValue=FALSE,truncate_max_range=FALSE,ignore.text.offset=TRUE) which in our experience avoided issues with data loading. 

@gfinak
Copy link
Member

gfinak commented Mar 20, 2023

So what problem are you actually having and what makes you believe it's a flowcore issue? Do you have some code we can use to reproduce the issue to work off of?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants