Body: <p>I am currently working on my PhD and as part of my thesis, I intend to analyse gene expression within multiple sclerosis (MS) lesions by looking at RNA-seq datasets on Gene Expression Omnibus (<a href="https://www.ncbi.nlm.nih.gov/geo/" rel="nofollow noreferrer">https://www.ncbi.nlm.nih.gov/geo/</a>)  , which I have selected already. Part of my analysis is using R to transform the count matrices provided on GEO into DGElists (differential gene expression lists), and I have been using both the edgeR handbook, as well as an R script provided by one of the groups whose dataset I am including in my analysis, to construct my own code (as I have had to teach myself R programming from scratch).</p>
  <p><em>[MS lesions are multiple sclerosis lesions. There are multiple subtypes that are included in this group's analysis - Active, Chronic active, inactive, remyelinating (or repairing) lesions and Normal Appearing White Matter. These classifications relate to the physiology of the lesion - active lesions are undergoing active inflammation, chronic active means it goes through periods of inflammation, inactive means inflammation isn't occurring at the moment, and remyelinating relates to a lesion that is undergoing healing.]</em></p>
  <p>My current issue is as follows: Following along with the script provided by the lab group, they appear to have calculated a &quot;PCA Vector&quot;, which they use in the creation of their design matrix. As far as I can tell, PCA, or Principal Component Analysis, is meant to account for the multi-dimensionality of a dataset, essentially transforming the data so that it can be plotted on a 2-dimensional set of axes and the variability of the points shown visually. Upon contacting the group, they said that they used PCA to find the biggest outliers as well as identify the largest patient bias, which they then normalised for.</p>
  <p>The group has also provided their data which can be opened in R. When I utilise their &quot;PCA vector&quot; in the construction of my design matrix, I get the same values as the group, however, any attempts at producing this PCA vector by performing PCA using R packages does not give me values that are in any way close to those in the group's DGE lists (also provided).</p>
  <p>My question therefore is this: Does anybody have an idea as to how one could create a &quot;PCA vector&quot; - a value of variation between patients - which could then be incorporated into a design matrix in order to account for patient variation? I feel I should mention - patient age, sex and MS lesion type are already accounted for as they are also used in the construction of the design matrix. Would anyone have any experience with this?</p>
  <p>I ask that you please be gentle/patient with me - I am still very new to the world of bioinformatics (and eager to learn!) and I apologise if I have not explained my issue very well. I will do my very utmost to clear up any confusion, and I would be incredibly grateful to anyone who can help!</p>
  <p>For those interested in seeing the journal article which includes links to the GEO repository which hosts their DGE lists and count matrix, as well as their github containing their R script and data, I have included the link below.</p>
  <p><a href="https://actaneurocomms.biomedcentral.com/articles/10.1186/s40478-019-0855-7#availability-of-data-and-materials" rel="nofollow noreferrer">https://actaneurocomms.biomedcentral.com/articles/10.1186/s40478-019-0855-7#availability-of-data-and-materials</a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-02-21T16:49:24.417Z
Comments.Text: Welcome @R_Cres_01! "PCA vectors" is kind of unclear. Maybe they mean principal components (PCs)? Do you know which PC they use, and why? Normally PCA is performed on a subset of the (log-normalized) count matrix, using the top N most variable genes. So if you want to recreate their PCA embedding matrix, i.e. a cell x PC matrix where PCs are ordered by variance explained, you need to know how they transformed the data (what normalization? with or without centering and scaling?), how many genes, how they were selected. Also this may not be a good idea, see https://www.biostars.org/p/379656/
Comments.UserDisplayName: gdagstn
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-02-21T18:27:26.527Z
Comments.Text: Your question title mentions MDS, (multidimensional scaling) but the question itself only mentions PCA (principal component analysis). These are similar concepts, but not the same. Can you confirm you want to do PCA adjustment (more common) rather than MDS adjustment?
Comments.UserDisplayName: gringer
Tags: <r><normalization><edger><pca>
Title: Using Multi-Dimensional Scaling (MDS) to produce a vector in order to account for patient bias when constructing DGE lists from RNA-seq datasets in R?
ThreadText: # Using Multi-Dimensional Scaling (MDS) to produce a vector in order to account for patient bias when constructing DGE lists from RNA-seq datasets in R?
  
  (Asked by: username_0 on 2023-02-20)
  
  I am currently working on my PhD and as part of my thesis, I intend to analyse gene expression within multiple sclerosis (MS) lesions by looking at RNA-seq datasets on Gene Expression Omnibus (<https://www.ncbi.nlm.nih.gov/geo/>) , which I have selected already. Part of my analysis is using R to transform the count matrices provided on GEO into DGElists (differential gene expression lists), and I have been using both the edgeR handbook, as well as an R script provided by one of the groups whose dataset I am including in my analysis, to construct my own code (as I have had to teach myself R programming from scratch).
  
  *[MS lesions are multiple sclerosis lesions. There are multiple subtypes that are included in this group's analysis - Active, Chronic active, inactive, remyelinating (or repairing) lesions and Normal Appearing White Matter. These classifications relate to the physiology of the lesion - active lesions are undergoing active inflammation, chronic active means it goes through periods of inflammation, inactive means inflammation isn't occurring at the moment, and remyelinating relates to a lesion that is undergoing healing.]*
  
  My current issue is as follows: Following along with the script provided by the lab group, they appear to have calculated a "PCA Vector", which they use in the creation of their design matrix. As far as I can tell, PCA, or Principal Component Analysis, is meant to account for the multi-dimensionality of a dataset, essentially transforming the data so that it can be plotted on a 2-dimensional set of axes and the variability of the points shown visually. Upon contacting the group, they said that they used PCA to find the biggest outliers as well as identify the largest patient bias, which they then normalised for.
  
  The group has also provided their data which can be opened in R. When I utilise their "PCA vector" in the construction of my design matrix, I get the same values as the group, however, any attempts at producing this PCA vector by performing PCA using R packages does not give me values that are in any way close to those in the group's DGE lists (also provided).
  
  My question therefore is this: Does anybody have an idea as to how one could create a "PCA vector" - a value of variation between patients - which could then be incorporated into a design matrix in order to account for patient variation? I feel I should mention - patient age, sex and MS lesion type are already accounted for as they are also used in the construction of the design matrix. Would anyone have any experience with this?
  
  I ask that you please be gentle/patient with me - I am still very new to the world of bioinformatics (and eager to learn!) and I apologise if I have not explained my issue very well. I will do my very utmost to clear up any confusion, and I would be incredibly grateful to anyone who can help!
  
  For those interested in seeing the journal article which includes links to the GEO repository which hosts their DGE lists and count matrix, as well as their github containing their R script and data, I have included the link below.
  
  <https://actaneurocomms.biomedcentral.com/articles/10.1186/s40478-019-0855-7#availability-of-data-and-materials>
  
  **Tags:** r, normalization, edger, pca
  
  > **Comments:**
  > **username_1**: Welcome @username_0! "PCA vectors" is kind of unclear. Maybe they mean principal components (PCs)? Do you know which PC they use, and why? Normally PCA is performed on a subset of the (log-normalized) count matrix, using the top N most variable genes. So if you want to recreate their PCA embedding matrix, i.e. a cell x PC matrix where PCs are ordered by variance explained, you need to know how they transformed the data (what normalization? with or without centering and scaling?), how many genes, how they were selected. Also this may not be a good idea, see https://www.biostars.org/p/379656/  
  > **username_2**: Your question title mentions MDS, (multidimensional scaling) but the question itself only mentions PCA (principal component analysis). These are similar concepts, but not the same. Can you confirm you want to do PCA adjustment (more common) rather than MDS adjustment?  
  
  ---
  
  ## 0 answers
  
  