How to understand the formula：patient score = ∑PC1A−∑PC1B? Today I read a paper (doi: 10.1016/j.omtn.2020.08.030), in this paper, they used many methods and finally they got a matrix, and each row represents a gene, each column represents a patient sample. The genes were split into two groups, called gene set A and gene set B. Then they used the PCA(Principal component analysis) to give each patient a score, and the formula is as followed: patient score = ∑PC1A−∑PC1B, the PC1A represents the first component of gene set A, and PC1B represents the first component of gene set B. So how can I understand this formula, and if I also have a matrix like this, how to get the score using R language? You can find the article in

First, unsupervised clustering was employed to categorize the patients in TCGA as per the DEG [differentially expressed gene] values. Furthermore, DEG values that were positively and negatively correlated with the clusters signature were termed as the ICI gene signatures A and B, respectively. Furthermore, the Boruta algorithm was employed for the dimension reduction of the ICI gene signatures A and B, and principal component 1 was extracted as the signature score by employing the PCA. Lastly, we applied a method similar to Gene expression grade index to define the ICI score of each patient:

$$\text{ICI score} = \sum \text{PC1}_A -\sum \text{PC1}_B $$
The above describes how they get the score using PCA, but it's hard for me to understand.

This is just a complement to @NuclearHoagie's answer. The paper referenced by the OP in turn references the Gene  Expression  Grade  Index from Sotiriou C et 2006 as the basis for their ICI score. The gene expression index is (apologies about pasting a screenshot):

With ICI score the authors apply something similar to GGI to only one "gene" in each set, that "gene" being the first PC, so the summation is redundant in such case.
