Limma contrasts question
1
0
Entering edit mode
Daniel Brewer ★ 1.9k
@daniel-brewer-1791
Last seen 9.6 years ago
Hello, I have three types of samples PC3M (the control cell line), Knockdown (PC3M with an siRNA knockdown vector) and Scramble (PC3M with a vector with a scrambled sequence). I have set up my design matrix like this: design <- modelMatrix(targets,ref="PC3M") As one of the comparisons I would like to compare the knockdown vs the controls. How would one do this? Is something like this correct? contrast.matrix <- makeContrasts("Knockdown vs Controls"=(2*Knockdown - Scramble)/2) Thanks Dan -- ************************************************************** Daniel Brewer, Ph.D. Institute of Cancer Research Molecular Carcinogenesis Email: daniel.brewer at icr.ac.uk ************************************************************** The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP. This e-mail message is confidential and for use by the a...{{dropped:2}}
Cancer Cancer • 1.0k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 43 minutes ago
United States
Hi Dan, Daniel Brewer wrote: > Hello, > > I have three types of samples PC3M (the control cell line), Knockdown > (PC3M with an siRNA knockdown vector) and Scramble (PC3M with a vector > with a scrambled sequence). I have set up my design matrix like this: > > design <- modelMatrix(targets,ref="PC3M") > > As one of the comparisons I would like to compare the knockdown vs the > controls. How would one do this? > > Is something like this correct? > > contrast.matrix <- makeContrasts("Knockdown vs Controls"=(2*Knockdown - > Scramble)/2) I doubt it, but given the amount of information we have here, I can't be sure. Please read the posting guide and follow its recommendations. At the very least we will need to know what type of arrays you are running (I assume spotted arrays of some stripe), and what your targets file looks like. Best, Jim > > Thanks > > Dan > -- James W. MacDonald, M.S. Biostatistician Hildebrandt Lab 8220D MSRB III 1150 W. Medical Center Drive Ann Arbor MI 48109-0646 734-936-8662
ADD COMMENT
0
Entering edit mode
James W. MacDonald wrote: > Hi Dan, > > Daniel Brewer wrote: >> Hello, >> >> I have three types of samples PC3M (the control cell line), Knockdown >> (PC3M with an siRNA knockdown vector) and Scramble (PC3M with a vector >> with a scrambled sequence). I have set up my design matrix like this: >> >> design <- modelMatrix(targets,ref="PC3M") >> >> As one of the comparisons I would like to compare the knockdown vs the >> controls. How would one do this? >> >> Is something like this correct? >> >> contrast.matrix <- makeContrasts("Knockdown vs Controls"=(2*Knockdown - >> Scramble)/2) > > I doubt it, but given the amount of information we have here, I can't be > sure. Please read the posting guide and follow its recommendations. At > the very least we will need to know what type of arrays you are running > (I assume spotted arrays of some stripe), and what your targets file > looks like. > > Best, > > Jim > > >> >> Thanks >> >> Dan >> > Hello, Apologies for not providing enough information. It is a two colour Agilent array. I was trying to keep the post short, but here is the full information (note I didn't design the experiment). Targets file: SlideNumber ArrayNumber FileName Name Cy3 Cy5 1 1 Input/1_1.txt 1_1 Scramble Knockdown 1 2 Input/1_2.txt 1_2 Knockdown PC3M 1 3 Input/1_3.txt 1_3 PNT2 PC3M 1 4 Input/1_4.txt 1_4 Pooled PNT2 2 2 Input/2_2.txt 2_2 PC3M Scramble 2 3 Input/2_3.txt 2_3 PNT2 Scramble 3 1 Input/3_1.txt 3_1 PC3M Pooled 3 2 Input/3_2.txt 3_2 Pooled Knockdown 3 3 Input/3_3.txt 3_3 Scramble Pooled 3 4 Input/3_4.txt 3_4 Knockdown PNT2 PC3M = the control cell line Knockdown = PC3M with an siRNA knockdown vector Scramble = PC3M with a vector with a scrambled sequence PNT2 = Another cell line (not of interest here) Pooled = poll of knockdowns before you get specific clone, intermediate between PCM3 and knockdown - a hetrogenious group (not considered here) Here is the relevant code (before this the standard steps were used to give normalised data without any controls): #Differential analysis design <- modelMatrix(targets,ref="PC3M") fit <- lmFit(normNoC, design) contrast.matrix <- makeContrasts("Knockdown vs Controls"=(2*Knockdown - Scramble)/2, levels=design) fit2 <- contrasts.fit(fit, contrast.matrix) fit3 <- eBayes(fit2)) > design Knockdown PNT2 Pooled Scramble [1,] 1 0 0 -1 [2,] -1 0 0 0 [3,] 0 -1 0 0 [4,] 0 1 -1 0 [5,] 0 0 0 1 [6,] 0 -1 0 1 [7,] 0 0 1 0 [8,] 1 0 -1 0 [9,] 0 0 1 -1 [10,] -1 1 0 0 > sessionInfo() R version 2.7.2 (2008-08-25) x86_64-pc-linux-gnu locale: LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB .UTF-8;LC_MONETARY=C;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_N AME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTI FICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] limma_2.14.7 So I would like to compare the two controls (scramble and PNT2) with the knockdown, but I am not sure how to compare one variable in the model with two. I would really appreciate your help with this. Many thanks Dan -- ************************************************************** Daniel Brewer, Ph.D. Institute of Cancer Research Molecular Carcinogenesis Email: daniel.brewer at icr.ac.uk ************************************************************** The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP. This e-mail message is confidential and for use by the a...{{dropped:2}}
ADD REPLY
0
Entering edit mode
Daniel Brewer wrote: > Hello, > > Apologies for not providing enough information. It is a two colour > Agilent array. I was trying to keep the post short, but here is the > full information (note I didn't design the experiment). > > Targets file: > SlideNumber ArrayNumber FileName Name Cy3 Cy5 > 1 1 Input/1_1.txt 1_1 Scramble Knockdown > 1 2 Input/1_2.txt 1_2 Knockdown PC3M > 1 3 Input/1_3.txt 1_3 PNT2 PC3M > 1 4 Input/1_4.txt 1_4 Pooled PNT2 > 2 2 Input/2_2.txt 2_2 PC3M Scramble > 2 3 Input/2_3.txt 2_3 PNT2 Scramble > 3 1 Input/3_1.txt 3_1 PC3M Pooled > 3 2 Input/3_2.txt 3_2 Pooled Knockdown > 3 3 Input/3_3.txt 3_3 Scramble Pooled > 3 4 Input/3_4.txt 3_4 Knockdown PNT2 > > PC3M = the control cell line > Knockdown = PC3M with an siRNA knockdown vector > Scramble = PC3M with a vector with a scrambled sequence > PNT2 = Another cell line (not of interest here) > Pooled = poll of knockdowns before you get specific clone, intermediate > between PCM3 and knockdown - a hetrogenious group (not considered here) > > Here is the relevant code (before this the standard steps were used to > give normalised data without any controls): > > #Differential analysis > design <- modelMatrix(targets,ref="PC3M") > fit <- lmFit(normNoC, design) > contrast.matrix <- makeContrasts("Knockdown vs Controls"=(2*Knockdown - > Scramble)/2, levels=design) > fit2 <- contrasts.fit(fit, contrast.matrix) > fit3 <- eBayes(fit2)) > >> design > Knockdown PNT2 Pooled Scramble > [1,] 1 0 0 -1 > [2,] -1 0 0 0 > [3,] 0 -1 0 0 > [4,] 0 1 -1 0 > [5,] 0 0 0 1 > [6,] 0 -1 0 1 > [7,] 0 0 1 0 > [8,] 1 0 -1 0 > [9,] 0 0 1 -1 > [10,] -1 1 0 0 > >> sessionInfo() > R version 2.7.2 (2008-08-25) > x86_64-pc-linux-gnu > > locale: > LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_ GB.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC _NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDEN TIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] limma_2.14.7 > > So I would like to compare the two controls (scramble and PNT2) with the > knockdown, but I am not sure how to compare one variable in the model > with two. I assume you mean PC3M rather than PNT2. Now it depends on whether or not you want to assume (or maybe check) that the two controls are essentially the same, and hence want to pool, or if you want to do knockdown to each control separately. For the former, this should suffice: contrast.matrix <- makeContrasts("KvC" = Knockdown - (Scramble + PC3M)/2, levels = design) So what we are asking for is the difference between the knockdown and the average of the two control samples. An implicit assumption here is that the scramble and PC3M samples have similar expression values, so you might want to check by adding an additional term: contrast.matrix <- makeContrasts("KvC" = Knockdown - (Scramble + PC3M)/2, "SvP" = Scramble - PC3M, levels = design) If there are loads of significantly different genes in the SvP contrast, you might want to rethink the control status of these samples. For the latter: contrast.matrix <- makeContrasts("KvS" = Knockdown - Scramble "KvsC" = Knockdown - PC3M, levels = design) Here we don't assume the scramble and PC3M samples are similar, and simply make comparisons individually. If you then wanted to see if the two control samples seemed similar, you could use decideTests() followed by vennCounts() and vennDiagram() to make a Venn diagram. Best, Jim > > I would really appreciate your help with this. > > Many thanks > > Dan > -- James W. MacDonald, M.S. Biostatistician Hildebrandt Lab 8220D MSRB III 1150 W. Medical Center Drive Ann Arbor MI 48109-0646 734-936-8662
ADD REPLY
0
Entering edit mode
James W. MacDonald wrote: > Daniel Brewer wrote: >> Hello, >> >> Apologies for not providing enough information. It is a two colour >> Agilent array. I was trying to keep the post short, but here is the >> full information (note I didn't design the experiment). >> >> Targets file: >> SlideNumber ArrayNumber FileName Name Cy3 Cy5 >> 1 1 Input/1_1.txt 1_1 Scramble Knockdown >> 1 2 Input/1_2.txt 1_2 Knockdown PC3M >> 1 3 Input/1_3.txt 1_3 PNT2 PC3M >> 1 4 Input/1_4.txt 1_4 Pooled PNT2 >> 2 2 Input/2_2.txt 2_2 PC3M Scramble >> 2 3 Input/2_3.txt 2_3 PNT2 Scramble >> 3 1 Input/3_1.txt 3_1 PC3M Pooled >> 3 2 Input/3_2.txt 3_2 Pooled Knockdown >> 3 3 Input/3_3.txt 3_3 Scramble Pooled >> 3 4 Input/3_4.txt 3_4 Knockdown PNT2 >> >> PC3M = the control cell line >> Knockdown = PC3M with an siRNA knockdown vector >> Scramble = PC3M with a vector with a scrambled sequence >> PNT2 = Another cell line (not of interest here) >> Pooled = poll of knockdowns before you get specific clone, intermediate >> between PCM3 and knockdown - a hetrogenious group (not considered here) >> >> Here is the relevant code (before this the standard steps were used to >> give normalised data without any controls): >> >> #Differential analysis >> design <- modelMatrix(targets,ref="PC3M") >> fit <- lmFit(normNoC, design) >> contrast.matrix <- makeContrasts("Knockdown vs Controls"=(2*Knockdown - >> Scramble)/2, levels=design) >> fit2 <- contrasts.fit(fit, contrast.matrix) >> fit3 <- eBayes(fit2)) >> >>> design >> Knockdown PNT2 Pooled Scramble >> [1,] 1 0 0 -1 >> [2,] -1 0 0 0 >> [3,] 0 -1 0 0 >> [4,] 0 1 -1 0 >> [5,] 0 0 0 1 >> [6,] 0 -1 0 1 >> [7,] 0 0 1 0 >> [8,] 1 0 -1 0 >> [9,] 0 0 1 -1 >> [10,] -1 1 0 0 >> >>> sessionInfo() >> R version 2.7.2 (2008-08-25) >> x86_64-pc-linux-gnu >> >> locale: >> LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en _GB.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;L C_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDE NTIFICATION=C >> >> >> attached base packages: >> [1] stats graphics grDevices utils datasets methods base >> >> other attached packages: >> [1] limma_2.14.7 >> >> So I would like to compare the two controls (scramble and PNT2) with the >> knockdown, but I am not sure how to compare one variable in the model >> with two. > > I assume you mean PC3M rather than PNT2. Now it depends on whether or > not you want to assume (or maybe check) that the two controls are > essentially the same, and hence want to pool, or if you want to do > knockdown to each control separately. > > For the former, this should suffice: > > contrast.matrix <- makeContrasts("KvC" = Knockdown - (Scramble + > PC3M)/2, levels = design) > > So what we are asking for is the difference between the knockdown and > the average of the two control samples. > > An implicit assumption here is that the scramble and PC3M samples have > similar expression values, so you might want to check by adding an > additional term: > > contrast.matrix <- makeContrasts("KvC" = Knockdown - (Scramble + > PC3M)/2, "SvP" = Scramble - PC3M, levels = design) > > If there are loads of significantly different genes in the SvP contrast, > you might want to rethink the control status of these samples. > > For the latter: > > contrast.matrix <- makeContrasts("KvS" = Knockdown - Scramble > "KvsC" = Knockdown - PC3M, levels = design) > > Here we don't assume the scramble and PC3M samples are similar, and > simply make comparisons individually. If you then wanted to see if the > two control samples seemed similar, you could use decideTests() followed > by vennCounts() and vennDiagram() to make a Venn diagram. > > Best, > > Jim > > >> >> I would really appreciate your help with this. >> >> Many thanks >> >> Dan >> > Thanks for that information. Yes I did mean PC3M as a contol ... doh. Unfortunately I am still having problems. > contrast.matrix <- makeContrasts("KvC" = Knockdown - (Scramble + PC3M)/2, levels = design) Error in eval(expr, envir, enclos) : object "PC3M" not found I believe this is because PC3M is not in the design matrix as I am using it as the reference. As a structure for this I have been using the direct 2-color design example of the "Limma User guide" (Section 7.4). There is a discrepancy between the straight comparisons that you have given me and the example in the guide. Your suggestion: contrast.matrix <- makeContrasts("KvsC" = Knockdown - PC3M, levels = design) Their suggestion: contrast.matrix <- makeContrasts("KvsC" = Knockdown, levels = design) I think this will have something to do with PC3M being described as the reference (the intercept in the linear model???) in their approach but maybe you use a different reference. Not sure. Many thanks for your time. I really would like to get an understanding of this. Thanks Dan -- ************************************************************** Daniel Brewer Institute of Cancer Research Molecular Carcinogenesis MUCRC 15 Cotswold Road Sutton, Surrey SM2 5NG United Kingdom Tel: +44 (0) 20 8722 4109 Fax: +44 (0) 20 8722 4141 Email: daniel.brewer at icr.ac.uk ************************************************************** The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP. This e-mail message is confidential and for use by the a...{{dropped:2}}
ADD REPLY
0
Entering edit mode
Daniel Brewer wrote: > > Thanks for that information. Yes I did mean PC3M as a contol ... doh. > > Unfortunately I am still having problems. >> contrast.matrix <- makeContrasts("KvC" = Knockdown - (Scramble + > PC3M)/2, levels = design) > Error in eval(expr, envir, enclos) : object "PC3M" not found > > I believe this is because PC3M is not in the design matrix as I am using > it as the reference. As a structure for this I have been using the > direct 2-color design example of the "Limma User guide" (Section 7.4). > There is a discrepancy between the straight comparisons that you have > given me and the example in the guide. > > Your suggestion: > contrast.matrix <- makeContrasts("KvsC" = Knockdown - PC3M, levels = design) > Their suggestion: > contrast.matrix <- makeContrasts("KvsC" = Knockdown, levels = design) > > I think this will have something to do with PC3M being described as the > reference (the intercept in the linear model???) in their approach but > maybe you use a different reference. Not sure. Oh yeah. Sorry - I didn't look closely at the design matrix. I don't do two color stuff so this doesn't come second nature to me. Anyway, I think your original contrasts matrix should be OK. Algebraically (2*Knockdown - Scramble)/2 should equal Knockdown - (Scramble + PC3M)/2. Sorry for the noise. Best, Jim > > Many thanks for your time. I really would like to get an understanding > of this. > > Thanks > > Dan > -- James W. MacDonald, M.S. Biostatistician Hildebrandt Lab 8220D MSRB III 1150 W. Medical Center Drive Ann Arbor MI 48109-0646 734-936-8662
ADD REPLY
0
Entering edit mode
James W. MacDonald wrote: > Daniel Brewer wrote: >> >> Thanks for that information. Yes I did mean PC3M as a contol ... doh. >> >> Unfortunately I am still having problems. >>> contrast.matrix <- makeContrasts("KvC" = Knockdown - (Scramble + >> PC3M)/2, levels = design) >> Error in eval(expr, envir, enclos) : object "PC3M" not found >> >> I believe this is because PC3M is not in the design matrix as I am using >> it as the reference. As a structure for this I have been using the >> direct 2-color design example of the "Limma User guide" (Section 7.4). >> There is a discrepancy between the straight comparisons that you have >> given me and the example in the guide. >> >> Your suggestion: >> contrast.matrix <- makeContrasts("KvsC" = Knockdown - PC3M, levels = >> design) >> Their suggestion: >> contrast.matrix <- makeContrasts("KvsC" = Knockdown, levels = design) >> >> I think this will have something to do with PC3M being described as the >> reference (the intercept in the linear model???) in their approach but >> maybe you use a different reference. Not sure. > > Oh yeah. Sorry - I didn't look closely at the design matrix. I don't do > two color stuff so this doesn't come second nature to me. > > Anyway, I think your original contrasts matrix should be OK. > Algebraically (2*Knockdown - Scramble)/2 should equal Knockdown - > (Scramble + PC3M)/2. Sorry for the noise. > > > Best, > > Jim > > > >> >> Many thanks for your time. I really would like to get an understanding >> of this. >> >> Thanks >> >> Dan >> > Hi Jim, Could you go into the maths of the contrast formulas a bit? I would like to get a really solid understanding of what it is doing for future analyses. Many thanks Dan -- ************************************************************** Daniel Brewer Institute of Cancer Research Molecular Carcinogenesis MUCRC 15 Cotswold Road Sutton, Surrey SM2 5NG United Kingdom Tel: +44 (0) 20 8722 4109 Fax: +44 (0) 20 8722 4141 Email: daniel.brewer at icr.ac.uk ************************************************************** The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP. This e-mail message is confidential and for use by the a...{{dropped:2}}
ADD REPLY
0
Entering edit mode
Daniel Brewer wrote: > Hi Jim, > > Could you go into the maths of the contrast formulas a bit? I would > like to get a really solid understanding of what it is doing for future > analyses. Once you understand what the coefficients are, the contrasts are just simple algebra. In your case, all of the coefficients are estimating the difference between the sample and PC3M (e.g., Knockdown - PC3M). So the algebra is something like this: 2(Knockdown - PC3M) - (Scramble - PC3M) = 2Knockdown - 2PC3M - Scramble + PC3M = 2Knockdown - Scramble - PC3M = Knockdown - (Scramble + PC3M)/2 Which is knockdown minus the mean of the controls. Note that this will be the numerator of the resulting t-statistic. The denominator will be sort of an average of the variability within each of the three groups being compared. So the question being answered is 'What genes are different in Knockdown as compared to the average of the controls?'. However, there is nothing here to test if the two controls are similar at all (and you might not care). So for instance, you might have a gene with average expression like this: Knockdown = 10 PC3M = 4 Scramble = 7 If the intra-group variability is small for each sample type, then you will likely get a significant t-statistic even though the two controls are probably significantly different as well. Which is why I mentioned earlier that you might want to test the Scramble - PC3M contrast as well. Best, Jim > > Many thanks > > Dan > -- James W. MacDonald, M.S. Biostatistician Hildebrandt Lab 8220D MSRB III 1150 W. Medical Center Drive Ann Arbor MI 48109-0646 734-936-8662
ADD REPLY
0
Entering edit mode
James W. MacDonald wrote: > Daniel Brewer wrote: > >> Hi Jim, >> >> Could you go into the maths of the contrast formulas a bit? I would >> like to get a really solid understanding of what it is doing for future >> analyses. > > Once you understand what the coefficients are, the contrasts are just > simple algebra. In your case, all of the coefficients are estimating the > difference between the sample and PC3M (e.g., Knockdown - PC3M). > > So the algebra is something like this: > > 2(Knockdown - PC3M) - (Scramble - PC3M) > = > 2Knockdown - 2PC3M - Scramble + PC3M > = > 2Knockdown - Scramble - PC3M > = > Knockdown - (Scramble + PC3M)/2 > > Which is knockdown minus the mean of the controls. > > Note that this will be the numerator of the resulting t-statistic. The > denominator will be sort of an average of the variability within each of > the three groups being compared. So the question being answered is 'What > genes are different in Knockdown as compared to the average of the > controls?'. However, there is nothing here to test if the two controls > are similar at all (and you might not care). > > So for instance, you might have a gene with average expression like this: > > Knockdown = 10 > PC3M = 4 > Scramble = 7 > > If the intra-group variability is small for each sample type, then you > will likely get a significant t-statistic even though the two controls > are probably significantly different as well. Which is why I mentioned > earlier that you might want to test the Scramble - PC3M contrast as well. > > Best, > > Jim > > >> >> Many thanks >> >> Dan >> > Thanks for that, that is brilliant and has clarified everything. I did a comparison of the controls and there were no significant genes found which is encouraging. Many thanks Dan -- ************************************************************** Daniel Brewer, Ph.D. Institute of Cancer Research Molecular Carcinogenesis Email: daniel.brewer at icr.ac.uk ************************************************************** The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP. This e-mail message is confidential and for use by the a...{{dropped:2}}
ADD REPLY

Login before adding your answer.

Traffic: 893 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6