FAQ  •  Register  •  Login

Cytofkit treats two panels edited by Premessa as different??

Forum rules
Please be as geeky as possible. Reference, reference, reference.
Also, please note that this is a mixed bag of math-gurus and mathematically challenged, so choose your words wisely :-)
<<

sudhcha

Participant

Posts: 4

Joined: Tue Jul 24, 2018 8:37 am

Post Fri May 08, 2020 10:23 am

Cytofkit treats two panels edited by Premessa as different??

Hi Everyone,
I recently edited/harmonized cytof panels from two different runs that had different channel names with premessa. All looks good with Flowjo or Cytobank, but when I tried to run the files from these 2 runs on Cytofkit, probably channels are treated as different as you can see in attach, while files from same run works perfectly. I am wondering if some channels info may still remain in the files that are conflicting with each other. I will highly appreciate your opinion. Please see the attached files, screenshot from Cytofkit and premessa.

Thanks,
Sudhir
Attachments
Cytofkit problem after channels editing by Premessa.png
<<

thinkCara

Participant

Posts: 5

Joined: Thu Sep 17, 2015 2:17 pm

Location: Bergen, Norway

Post Fri May 08, 2020 11:26 am

Re: Cytofkit treats two panels edited by Premessa as differe

Hi Sudhir,

I can think of a few possible issues. As long as your channel names are the same, Cytobank won't care what order the channels are in, however, channel order might be an issue elsewhere. Try looking at the channel details in Cytobank for the files from the different runs and see if the channel orders are the same.

I haven't run tSNE in cytofkit, but it looks as though there is a batch effect happening which could explain why the cells from the different runs don't overlap. Have you performed batch correction on these datasets? What happens if you run viSNE/tSNE on another platform, like Cytobank for example? It looks like you have kept some channels that were absent from run or the other. That might cause an issue. make sure you are not using any of those channels as input channels for tSNE. It also looks like run5 was collected on a Helios and run1 was not (based on the Center channel). These datasets might be too different even if you are able to apply a batch correction algorithm. You might end up having to run tSNE separately and analyzing the data in parallel instead together.

I hope some of this was helpful. Good luck!

Best,
Cara
Cara E Wogsland PhD
Senior Researcher at KinN Therapeutics AS
University of Bergen
CyTOF user since 2012
<<

sgranjeaud

Master

Posts: 123

Joined: Wed Dec 21, 2016 9:22 pm

Location: Marseille, France

Post Fri May 08, 2020 11:50 am

Re: Cytofkit treats two panels edited by Premessa as differe

Hi Sudhir,

Harmonizing channel names is one step towards integrating 2 batches. Maybe you also need to normalize the intensities. Here is a pointer to the two recent articles on that subject Quantile normalisation of batches.

I think that the numbers superimposed on the map refer to cluster identifiers and the two panels correspond to the two batches. If you have access to other sotware, did you try to compute and visualize a tSNE (or UMAP, whatever you like) map? That would help to understand if there is a bug in Cytofkit or if there is a problem of intensity.

Best.
<<

dtelad11

Master

Posts: 129

Joined: Mon Oct 31, 2016 6:26 pm

Post Fri May 08, 2020 1:05 pm

Re: Cytofkit treats two panels edited by Premessa as differe

I will second Samuel. This is not a technical issue with the FCS file, it's a batch effect. See more here: https://www.youtube.com/watch?v=pW9cEXgy9Q8
<<

sudhcha

Participant

Posts: 4

Joined: Tue Jul 24, 2018 8:37 am

Post Fri May 08, 2020 3:08 pm

Re: Cytofkit treats two panels edited by Premessa as differe

Thanks for the replies. I run a quick viSNE on CD3/CD14/CD19/CD56 ,and seems batch effect is not very strong between the runs. Also looking at bi-parametric plots for most of parameters does not suggest significant batch effect (plz see viSNe plot attached, Figure 3). but I agree batch normalization is very useful in automated clustering.

I looked at the panel editing that I did in Premessa. I tried two ways.

A.) files from both runs were edited together (Fig.1), in the end I could see one channel per parameter .

B.) files from both runs were edited individually in Premessa (Fig.2), and then I looked at files for both runs again in premessa and I still see 2 channels for each parameter, but the files from both runs works well together in flowjo.

May be we can infer something from here why they behave differently on cytofkit?

Thanks,
Sudhir
Attachments
Sudhir_PPT.pptx
(633.66 KiB) Downloaded 272 times
<<

mleipold

Guru

Posts: 5792

Joined: Fri Nov 01, 2013 5:30 pm

Location: Stanford HIMC, CA, USA

Post Fri May 08, 2020 4:20 pm

Re: Cytofkit treats two panels edited by Premessa as differe

Hi Sudhir,

As another test, you might try putting the files through Cytofcore: https://github.com/nolanlab/cytofCore#E ... _FCS_Files

This will force harmonization of the files: you use one file as a template, and force all other files to look like that. Then, see how Premessa and Cytofkit "see" those.


That might help you (and others) figure out whether this is firmly a cytofkit issue, or still a panel issue. I know that FlowJo and Cytobank can sometimes "deal" with a parameter that's not completely consistent between files, so that's not always a solid test. For example: I've run into cases where, say, Event_length, somehow got screwed up in one file. As I'm clicking through the files while gating, all of a sudden that one file winds up with a drastically different scaling than all the others. But once I fix the scaling on it, the templated gate still appears, etc, so it's still "seeing" that file's EL as compatible with the gating template.


Mike
<<

dtelad11

Master

Posts: 129

Joined: Mon Oct 31, 2016 6:26 pm

Post Fri May 08, 2020 4:22 pm

Re: Cytofkit treats two panels edited by Premessa as differe

Also, if you're interested, I'm happy to take a look at the files. Email me at el-ad@astrolabediagnostics.com.
<<

sgranjeaud

Master

Posts: 123

Joined: Wed Dec 21, 2016 9:22 pm

Location: Marseille, France

Post Fri May 08, 2020 5:30 pm

Re: Cytofkit treats two panels edited by Premessa as differe

Thanks El-ad, nice introduction, experimentation and solution.

Sudhir, what is strange is the fact that Premessa does not match the channels when batch are treated separately.
Maybe Premessa requires that the channels are is the same order, but I don't know the code enough.

I think the best way to solve your question is to share one file of each batch, by PM is you want.
Alternatively you can try flowIO to check the order of the markers and compliance.

If you want to try these few commands, they might help.

  Code:
# considering that all FCS files are in the same folder
# check that all FCS could be imported as a flowSet
library(flowCore)
# choose a file
fcs_dir = dirname(file.choose())
# read all FCS files as a flowSet
if (dir.exists(fcs_dir)) {
  fs = read.flowSet(path = fcs_dir, pattern = "\\.fcs$", transformation = FALSE, which.lines = 1:99)
  fs
}
# read all FCS files as a list of flowFrame
if (dir.exists(fcs_dir)) {
  filenames = dir(path = fcs_dir, pattern = "\\.fcs$")
  ff_list = lapply(file.path(fcs_dir, filenames),
                   function(filename) read.FCS(filename, transformation = FALSE, which.lines = 1:99))
  names(ff_list) = filenames
  # check the number of channels
  sapply(ff_list, ncol)
  # check the names of channels
  t(sapply(ff_list, colnames))
}


Best.
<<

dtelad11

Master

Posts: 129

Joined: Mon Oct 31, 2016 6:26 pm

Post Sun May 10, 2020 3:36 pm

Re: Cytofkit treats two panels edited by Premessa as differe

Sudhir, thank you for sharing the files. First of all, the post-premessa files have a carriage return character appended after each of the mass names in the FCS file "name" field:
  Code:
flowFrame object 'BC17-20200505_ICON run5_89Y+115-In+.fcs'
with 80339 cells and 52 observables:
               name         desc  range minRange maxRange
$P1       Ba138Di\r        138Ba 262144        0   262143
$P2       Bi209Di\r     CD16-209 262144        0   262143
$P3       Ce140Di\r       EQ-140 262144        0   262143
$P4       Cs133Di\r        133Cs 262144        0   262143
$P5       Dy160Di\r     CD39-160 262144        0   262143
$P6       Dy161Di\r     Ki67-161 262144        0   262143
$P7       Dy162Di\r    CD11c-162 262144        0   262143
$P8       Dy163Di\r     CD33-163 262144        0   262143
$P9       Dy164Di\r    CD161-164 262144        0   262143
$P10      Er166Di\r    CD15s-166 262144        0   262143
$P11      Er167Di\r     CD27-167 262144        0   262143
$P12      Eu151Di\r     ICOS-151 262144        0   262143
$P13      Eu153Di\r     TIM3-153 262144        0   262143
$P14 Event_length\r         <NA> 262144        0   262143
$P15      Sm152Di\r    TCRgd-152 262144        0   262143
$P16      Gd155Di\r      PD1-155 262144        0   262143
$P17      Gd156Di\r    CXCR3-156 262144        0   262143
$P18      Gd158Di\r     CCR4-158 262144        0   262143
$P19      Ho165Di\r CD127-EQ-165 262144        0   262143
$P20      In115Di\r     CD45-115 262144        0   262143
$P21      Ir191Di\r       Ir-191 262144        0   262143
$P22      Ir193Di\r       Ir-193 262144        0   262143
$P23      Lu175Di\r     PDL1-175 262144        0   262143
$P24      Nd142Di\r     CD19-142 262144        0   262143
$P25      Nd143Di\r   CD45RA-143 262144        0   262143
$P26      Nd144Di\r     CD38-144 262144        0   262143
$P27      Nd145Di\r    CD163-145 262144        0   262143
$P28      Nd146Di\r      IgD-146 262144        0   262143
$P29      Pd104Di\r     CD45-104 262144        0   262143
$P30      Pd106Di\r     CD45-106 262144        0   262143
$P31      Pd108Di\r     CD45-108 262144        0   262143
$P32      Pd110Di\r     CD45-110 262144        0   262143
$P33      Pr141Di\r     CCR6-141 262144        0   262143
$P34      Pt194Di\r      cis-194 262144        0   262143
$P35      Sm147Di\r    BDCA2-147 262144        0   262143
$P36      Nd148Di\r     CD14-148 262144        0   262143
$P37      Sm149Di\r     CD25-149 262144        0   262143
$P38      Nd150Di\r      KIR-150 262144        0   262143
$P39      Sm154Di\r    TIGIT-154 262144        0   262143
$P40      Sn120Di\r        120Sn 262144        0   262143
$P41      Tb159Di\r     CCR7-159 262144        0   262143
$P42      Tm169Di\r    NKG2A-169 262144        0   262143
$P43      Xe131Di\r        131Xe 262144        0   262143
$P44        Y89Di\r      CD45-89 262144        0   262143
$P45      Er168Di\r      CD8-168 262144        0   262143
$P46      Er170Di\r      CD3-170 262144        0   262143
$P47      Yb171Di\r     GzmB-171 262144        0   262143
$P48      Yb172Di\r     CD57-172 262144        0   262143
$P49      Yb173Di\r   HLA-DR-173 262144        0   262143
$P50      Yb174Di\r      CD4-174 262144        0   262143
$P51      Yb176Di\r   176Yb_CD56 262144        0   262143
$P52         Time\r         <NA> 262144        0   262143
283 keywords are stored in the 'description' slot

Furthermore, the "range", "minRange", and "maxRange" parameters have been reset.

I don't know whether this explains the cytofkit issues you are seeing, but I suspect it will interfere with some R packages and algorithms. You might want to consider going back to your original files and harmonizing them using the cytutils package (https://github.com/ismms-himc/cytutils) instead of premessa.
<<

sgranjeaud

Master

Posts: 123

Joined: Wed Dec 21, 2016 9:22 pm

Location: Marseille, France

Post Mon May 11, 2020 10:56 am

Re: Cytofkit treats two panels edited by Premessa as differe

Hi Sudhir,

Thanks for sharing. That's help to understand the problem.

As El-ad reported, there are those unattended "\r" characters, but they are not very likely to fail the analysis. That would be interesting to know if you are working on Mac/windows/linux while running premessa.

The main problem for Cytofkit is that the channels are not column aligned. For example CD19 is initially linked to Cd142 in one batch and Nd142 in the other batch. After renaming the parameter is Cd142 in both batches and the associated name is also the same. But, CD19 is at column 4 in one batch and column 24 in the other. Cytofkit considers that all FCS have markers in the same columns/channels. It does not do any marker realignment while reading FCS files. I think that FlowJo and CytoBank (those you cited) have some kind of automatic alignment of markers, that makes you think that the panel have harmonized. Premessa's panel editor is also realigning the names in the interface, but does not change the position of the markers in the channel matrix of intensities. It just (but nicely) renames parameters. This is sufficient for many software, especially commercial ones, but not for cytofkit.

As El-ad already reported, cytutils is a good package for renaming channels in a batch fashion. I must admit that El-ad and I have contributed to that package (very minor contributions for my side). But this also mean that we read the code and approve what and how it is done. cytutils does the same job as premessa's panel editor (If I Remember Correctly, and premessa is working correctly as far as I know), so this will not realign columns, what is the main problem in re-conciliating the batches. This task is addressed by cytofcore. cytofcore could add and remove channels, but it mainly write the selected channels in the same order. This is what is needed by cytofkit.

In my lab, we have set up a procedure to achieve this. Please do follow the script at the end of the page http://impact-cyto.inserm.fr/harmoniser-des-panels/ The rest of the page is in french and I didn't take time to translate it.
I did have apply this procedure to your files, leading to a correct alignment of columns. I will send you back the files.

To be noticed:
* in the cytutils step, the channels are ordered by mass, what eases the renaming. We renamed both the name and the description of each mass that duplicated. We use the typical convention <mass><metal>_<marker> because it is widely used and our pipeline is based on it. I added a formula to highlight the channels that need to be checked. This column has to be removed before saving the CSV file.
2020-05-11 11_21_15-channel_rename.csv - Excel.png
cytutils CSV file


* in the cytofcore step, you have to add zero to missing channels, otherwise these unbalanced missing channels will create mis-alignment in the matrix of intensities. I will add this to my resource.
2020-05-11 11_49_22-C__data_active_support_200510-Sudhir - RStudio.png
cytofcore important notice


The cytofkit result is maybe better than the one you get, but I feel there is still a batch effect. I noticed differences in the range of CD4 and CD8, but I only checked a few.
2020-05-11 12_44_05-C__data_active_support_200510-Sudhir - RStudio.png
cytofkit setting

2020-05-11 12_39_57-cytofkit explorer - Vivaldi.png
cytofkit result


I thank you for reporting this problem in cytofkit. I will add a quick check in cytofkit in my fork and push it to the authors.

Hope this will improve your analysis. Now you have work to do on your side.

Stay safe,
Samuel
Next

Return to CyTOF data analysis

Who is online

Users browsing this forum: No registered users and 13 guests

cron