Nicole Anguiano Electronic Lab Notebook: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
(→‎5/19/2015: added step 9)
(→‎Step 9: GenMAPP & MAPPFinder: add some more steps)
Line 547: Line 547:
==== Preparing the Input File for GenMAPP ====
==== Preparing the Input File for GenMAPP ====


* Insert a new worksheet and name it STRAIN_GenMAPP.
* Insert a new worksheet and name it dGLN3_GenMAPP.
* Go back to the "ANOVA" worksheet for your strain and Select All and Copy.
* Go back to the "ANOVA" worksheet for your strain and Select All and Copy.
* Go to your new sheet and click on cell A1 and select Paste Special, click on the Values radio button, and click OK.   
* Go to your new sheet and click on cell A1 and select Paste Special, click on the Values radio button, and click OK.   
** Delete the columns containing the "ss" calculations, just retaining the individual log fold change data, the average log fold change data, the Fstat and p value.  For the Bonferroni and B&H p values, just keep one column where we replaced all values > 1 with 1.
** Delete the columns containing the "ss" calculations as well as the fstat, just retaining the individual log fold change data, the average log fold change data, and p value.  For the Bonferroni and B&H p values, just keep one column where we replaced all values > 1 with 1.
* Now go to your "_ttest" worksheet.  Copy just the columns containing the Fstats and P values for the individual timepoints and Paste special > Paste values into your GenMAPP worksheet to the right of the previous data.  For the Bonferroni and B&H p values, just keep one column where we replaced all values > 1 with 1.
** Rename the "dGLN3_p-value" column to "dGLN3_ANOVA_p-value", the "dGLN3_Bonferroni_p-value" column to "dGLN3_Bonferroni_ANOVA_p-value", and the "dGLN3_B-H_p-value" to "dGLN3_B-H_ANOVA_p-value".
* Now go to your "_ttest" worksheet.  Copy just the columns containing the P values for the individual timepoints and Paste special > Paste values into your GenMAPP worksheet to the right of the previous data.  For the Bonferroni and B&H p values, just keep one column where we replaced all values > 1 with 1.
** Move the columns with ANOVA in the name to before the AvgLogFC columns (Y-AA). To do this, select the columns and then right click and select "cut" (or press Ctrl + x). Right-click the "dGLN3_AvgLogFC_15" column and select "Insert Cut Cells". Use this same system to rearrange the remaining columns in the following order after the ANOVA columns:
*** dGLN3_AvgLogFC_tx | dGLN3_Pval_tx | dGLN3_Bonferroni_tx | dGLN3_B-H_tx, with x being the timepoint.
** Repeat this for each timepoint, so that the values for each timepoint are organized in that fashion.
* Select all of the columns containing Fold Changes.  Select the menu item Format > Cells.  Under the number tab, select 2 decimal places.  Click OK.
* Select all of the columns containing Fold Changes.  Select the menu item Format > Cells.  Under the number tab, select 2 decimal places.  Click OK.
* Select all of the columns containing T statistics or P values.  Select the menu item Format > Cells.  Under the number tab, select 4 decimal places. Click OK.
* Select all of the columns containing T statistics or P values.  Select the menu item Format > Cells.  Under the number tab, select 4 decimal places. Click OK.

Revision as of 14:03, 19 May 2015

5/18/2015

  • The files to be analyzed were downloaded from Lionshare. The files already had been analyzed by GenePix Pro, thus completing steps 1-3. The protocol for today can be found in full from here.

Steps 4-5: Within- and Between-chip Normalization

  • A more detailed protocol can be found on this page. An abbreviated protocol is summarized below.

Installing R 3.1.0 and the limma package

The following protocol was developed to normalize GCAT and Ontario DNA microarray chip data from the Dahlquist lab using the R Statistical Software and the limma package (part of the Bioconductor Project).

  • The normalization procedure has been verified to work with version 3.1.0 of R released in April 2014 (link to download site) and and version 3.20.1 of the limma package ( direct link to download zipped file) on the Windows 7 platform.
    • Note that using other versions of R or the limma package might give different results.
    • Note also that using the 32-bit versus the 64-bit versions of R 3.1.0 will give different results for the normalization out in the 10-13 or 10-14 decimal place. The Dahlquist Lab is standardizing on using the 64-bit version of R.
  • To install R for the first time, download and run the installer from the link above, accepting the default installation.
  • To use the limma package, unzip the file and place the contents into a folder called "limma" in the library directory of the R program. If you accept the default location, that will be C:\Program Files\R\R-3.1.0\library (this will be different on the computers in S120 since you do not have administrator rights).

Running the Normalization Scripts

Within Array Normalization for the Ontario Chips
  • Launch R x64 3.1.0 (make sure you are using the 64-bit version).
  • Change the directory to the folder containing the targets file and the GPR files for the Ontario chips by selecting the menu item File > Change dir... and clicking on the appropriate directory. You will need to click on the + sign to drill down to the right directory. Once you have selected it, click OK.
  • In R, select the menu item File > Source R code..., and select the Ontario_Chip_Within-Array_Normalization_modified_20150514.R script.
    • You will be prompted by an Open dialog for the Ontario targets file. Select the file Ontario_Targets_wt-dCIN5-dGLN3-dHAP4-dHMO1-dSWI4-dZAP1-Spar_20150514.csv and click Open.
    • Wait while R processes your files.

Within Array Normalization for the GCAT Chips and Between Array Normalization for All Chips

  • These instructions assume that you have just completed the Within Array Normalization for the Ontario Chips in the section above.
  • In R, select the menu item File > Source R code..., and select the Within-Array_Normalization_GCAT_and_Merged_Ontario-GCAT_Between-Chip_Normalization_modified_20150514.R script.
    • You will be prompted by an Open dialog for the GCAT targets file. Select the file GCAT_Targets.csv and click Open.
    • Wait while R processes your files.
  • When the processing has finished, you will find two files called GCAT_and_Ontario_Within_Array_Normalization.csv and GCAT_and_Ontario_Final_Normalized_Data.csv in the same folder.
    • Save these files to LionShare and/or to a flash drive.

Visualizing the Normalized Data

Create MA Plots and Box Plots for the GCAT Chips

Input the following code, line by line, into the main R window. Press the enter key after each block of code.

GCAT.GeneList<-RGG$genes$ID
lg<-log2((RGG$R-RGG$Rb)/(RGG$G-RGG$Gb))
  • If you get a message saying "NaNs produced" this is OK, proceed to the next step.
r0<-length(lg[1,])
rx<-tapply(lg[,1],as.factor(GCAT.GeneList),mean)
r1<-length(rx)
MM<-matrix(nrow=r1,ncol=r0)
for(i in 1:r0) {MM[,i]<-tapply(lg[,i],as.factor(GCAT.GeneList),mean)}
MC<-matrix(nrow=r1,ncol=r0)
for(i in 1:r0) {MC[,i]<-dw[i]*MM[,i]}
MCD<-as.data.frame(MC)
colnames(MCD)<-chips
rownames(MCD)<-gcatID
la<-(1/2*log2((RGG$R-RGG$Rb)*(RGG$G-RGG$Gb)))
  • If you get these Warning messages, it's OK:
1: In (RGG$R - RGG$Rb) * (RGG$G - RGG$Gb) :
NAs produced by integer overflow
2: NaNs produced
r2<-length(la[1,])
ri<-tapply(la[,1],as.factor(GCAT.GeneList),mean)
r3<-length(ri)
AG<-matrix(nrow=r3,ncol=r2)
for(i in 1:r2) {AG[,i]<-tapply(la[,i],as.factor(GCAT.GeneList),mean)}
par(mfrow=c(3,3))
for(i in 1:r2) {plot(AG[,i],MC[,i],main=chips[i],xlab='A',ylab='M',ylim=c(-5,5),xlim=c(0,15))}
browser()
  • Maximize the window in which the graphs have appeared. Save the graphs as a JPEG (File>Save As>JPEG>100% quality...). Once the graphs have been saved, close the window. To continue with the rest of the code, press Enter.
x0<-tapply(MAG$A[,1],as.factor(MAG$genes$ID),mean)
y0<-length(MAG$A[1,])
x1<-length(x0)
AAG<-matrix(nrow=x1,ncol=y0)
for(i in 1:y0) {AAG[,i]<-tapply(MAG$A[,i],as.factor(MAG$genes$ID),mean)}
par(mfrow=c(3,3))
for(i in 1:y0) {plot(AAG[,i],MG2[,i],main=chips[i],xlab='A',ylab='M',ylim=c(-5,5),xlim=c(0,15))}
browser()
  • Maximize the window in which the graphs have appeared. Save the graphs as a JPEG (File>Save As>JPEG>100% quality...). Once the graphs have been saved, close the window. To continue with the rest of the code, press Enter.
par(mfrow=c(1,3))
boxplot(MCD,main="Before Normalization",ylab='Log Fold Change',ylim=c(-5,5),xaxt='n')
axis(1,at=xy.coords(chips)$x,tick=TRUE,labels=FALSE)
text(xy.coords(chips)$x-1,par('usr')[3]-0.6,labels=chips,srt=45,cex=0.9,xpd=TRUE)
boxplot(MG2,main='After Within Array Normalization',ylab='Log Fold Change',ylim=c(-5,5),xaxt='n')
axis(1,at=xy.coords(chips)$x,labels=FALSE)
text(xy.coords(chips)$x-1,par('usr')[3]-0.6,labels=chips,srt=45,cex=0.9,xpd=TRUE)
boxplot(MAD[,Gtop$MasterList],main='After Between Array Normalization',ylab='Log Fold Change',ylim=c(-5,5),xaxt='n')
axis(1, at=xy.coords(chips)$x,labels=FALSE)
text(xy.coords(chips)$x-1,par('usr')[3]-0.6,labels=chips,srt=45,cex=0.9,xpd=TRUE)
  • Maximize the window in which the plots have appeared. You may not want to actually maximize them because you might lose the labels on the x axis, but make them as large as you can. Save the plots as a JPEG (File>Save As>JPEG>100% quality...). Once the graphs have been saved, close the window.
Create MA Plots and Box Plots for the Ontario Chips

Input the following code, line by line, into the main R window. Press the enter key after each block of code.

Ontario.GeneList<-RGO$genes$Name
lr<-log2((RGO$R-RGO$Rb)/(RGO$G-RGO$Gb))
  • Warning message: "NaNs produced" is OK.
z0<-length(lr[1,])
v0<-tapply(lr[,1],as.factor(Ontario.GeneList),mean)
z1<-length(v0)
MT<-matrix(nrow=z1,ncol=z0)
for(i in 1:z0) {MT[,i]<-tapply(lr[,i],as.factor(Ontario.GeneList),mean)}
MI<-matrix(nrow=z1,ncol=z0)
for(i in 1:z0) {MI[,i]<-ds[i]*MT[,i]}
MID<-as.data.frame(MI)
colnames(MID)<-headers
rownames(MID)<-ontID
ln<-(1/2*log2((RGO$R-RGO$Rb)*(RGO$G-RGO$Gb)))
  • Warning messages are OK:
1: In (RGO$R - RGO$Rb) * (RGO$G - RGO$Gb) :
NAs produced by integer overflow
2: NaNs produced
z2<-length(ln[1,])
zi<-tapply(ln[,1],as.factor(Ontario.GeneList),mean)
z3<-length(zi)
AO<-matrix(nrow=z3,ncol=z2)
for(i in 1:z0) {AO[,i]<-tapply(ln[,i],as.factor(Ontario.GeneList),mean)}
strains<-c('wt','dCIN5','dGLN3','dHAP4','dHMO1','dSWI4','dZAP1','Spar')
  • After entering the call browser() below, maximize the window in which the graphs have appeared. Save the graphs as a JPEG (File>Save As>JPEG>100% quality...). Once the graphs have been saved, close the window and press Enter for the next set of graphs to appear.
for (i in 1:length(strains)) {
  st<-strains[i]
  lt<-which(Otargets$Strain %in% st)
  if (st=='wt') {
      par(mfrow=c(3,5))
  } else {
      par(mfrow=c(4,5))
  }
  for (i in lt) {
    plot(AO[,i],MI[,i],main=headers[i],xlab="A",ylab="M",ylim=c(-5,5),xlim=c(0,15))
  }
  browser()
} 
  • To continue generating plots, press enter.
j0<-tapply(MAO$A[,1],as.factor(MAO$genes[,5]),mean)
k0<-length(MAO$A[1,])
j1<-length(j0)
AAO<-matrix(nrow=j1,ncol=k0)
for(i in 1:k0) {AAO[,i]<-tapply(MAO$A[,i],as.factor(MAO$genes[,5]),mean)}
  • Remember, that after entering the call readline('Press Enter to continue'), maximize the window in which the graphs have appeared. Save the graphs as a JPEG (File>Save As>JPEG>100% quality...). Once the graphs have been saved, close the window and press Enter for the next set of graphs to appear.
for (i in 1:length(strains)) {
  st<-strains[i]
  lt<-which(Otargets$Strain %in% st)
  if (st=='wt') {
      par(mfrow=c(3,5))
  } else {
      par(mfrow=c(4,5))
  }
  for (i in lt) {
    plot(AAO[,i],MD2[,i],main=headers[i],xlab="A",ylab="M",ylim=c(-5,5),xlim=c(0,15))
  }
  browser()
}
  • To continue generating plots, press enter.
for (i in 1:length(strains)) {
  par(mfrow=c(1,3))
  st<-strains[i]
  lt<-which(Otargets$Strain %in% st)
  if (st=='wt') {
      xcoord<-xy.coords(lt)$x-1
      fsize<-0.9
  } else {
      xcoord<-xy.coords(lt)$x-1.7
      fsize<-0.8
  }
  boxplot(MID[,lt],main='Before Normalization',ylab='Log Fold Change',ylim=c(-5,5),xaxt='n')
  axis(1,at=xy.coords(lt)$x,labels=FALSE)
  text(xcoord,par('usr')[3]-0.65,labels=headers[lt],srt=45,cex=fsize,xpd=TRUE)
  boxplot(MD2[,lt],main='After Within Array Normalization',ylab='Log Fold Change',ylim=c(-5,5),xaxt='n')
  axis(1,at=xy.coords(lt)$x,labels=FALSE)
  text(xcoord,par('usr')[3]-0.65,labels=headers[lt],srt=45,cex=fsize,xpd=TRUE)
  ft<-Otargets$MasterList[which(Otargets$Strain %in% st)]
  boxplot(MAD[,ft],main='After Between Array Normalization',ylab='Log Fold Change',ylim=c(-5,5),xaxt='n')
  axis(1,at=xy.coords(lt)$x,labels=FALSE)
  text(xcoord,par('usr')[3]-0.65,labels=headers[lt],srt=45,cex=fsize,xpd=TRUE)
  browser()
} 
  • To continue generating plots, press enter.
  • Warnings are OK.
  • Zip the files of the plots together and upload to LionShare and/or save to a flash drive.

Step 6: Statistical Analysis

  • For the statistical analysis, we will begin with the file "GCAT_and_Ontario_Final_Normalized_Data.csv" that you generated in the previous step.
  • Open this file in Excel and Save As an Excel Workbook *.xlsx. It is a good idea to add your initials and the date (yyyymmdd) to the filename as well.
  • Rename the worksheet with the data "Compiled_Normalized_Data".
    • Type the header "ID" in cell A1.
    • Insert a new column after column A and name it "Standard Name". Column B will contain the common names for the genes on the microarray.
      • Copy the entire column of IDs from Column A.
      • Paste the names into the "Value" field of the ORF List <-> Gene List tool in YEASTRACT. Then, click on the "Transform" button.
      • Select all of the names in the "Gene Name" column of the resulting table.
      • Copy and paste these names into column B of the *.xlsx file. Save your work.
    • Insert a new column on the very left and name it "MasterIndex". We will create a numerical index of genes so that we can always sort them back into the same order.
      • Type a "1" in cell A2 and a "2" in cell A3.
      • Select both cells. Hover your mouse over the bottom-right corner of the selection until it makes a thin black + sign. Double-click on the + sign to fill the entire column with a series of numbers from 1 to 6189 (the number of genes on the microarray).
  • Insert a new worksheet and call it "Rounded_Normalized_Data". We are going to round the normalization results to four decimal places because of slight variations seen in different runs of the normalization script.
    • Copy the first three columns of the "Compiled_Normalized_Data" sheet and paste it into the first three columns of the "Rounded_Normalized_Data" sheet.
    • Copy the first row of the "Compiled_Normalized_Data" sheet and paste it into the first row of the "Rounded_Normalized_Data" sheet.
    • In cell C2, type the equation =ROUND(Compiled_Normalized_Data!C2,4).
    • Copy and paste this equation in the rest of the cells of row 2.
    • Select all of the cells of row 2 and hover your mouse over the bottom right corner of the selection. When the cursor changes to a thin black "plus" sign, double-click on it to paste the equation to all the rows in the worksheet. Save your work.
  • Insert a new worksheet and call it "Master_Sheet".
    • Go back to the "Rounded_Normalized_Data" sheet and Select All and Copy.
    • Click on cell A1 of the "Master_Sheet" worksheet. Select Paste special > Paste values to paste the values, but not the formulas from the previous sheet. Save your work.
    • There will be some #VALUE! errors in cells where there was missing data for genes that existed on the Ontario chips, but not the GCAT chips.
      • Select the menu item Find/Replace and Find all cells with "#VALUE!" and replace them with a single space character. Record how many replacements were made to your electronic lab notebook. Save your work.
        • There were 477 replacements.
  • This will be the starting point for our statistical analysis below.

Within-strain ANOVA

  • The purpose of the witin-stain ANOVA test is to determine if any genes had a gene expression change that was significantly different than zero at any timepoint.
  • Each student in the lab group will be assigned one strain to analyze from this point forward.
    • Anu and Natalie: wt
    • Grace and Monica: dHAP4
    • Kevin M. and Nicole: dGLN3
    • Kevin W. and Dr. Dahlquist: dSWI4
    • Tessa and Trixie: dCIN5
  1. Create a new worksheet, naming it either "dGLN3_ANOVA".
  2. Copy all of the data from the "Master_Sheet" worksheet for your strain and paste it into your new worksheet.
    • From here on, we will be using dGLN3 as the strain.
  3. Starting at X1, create five column headers of the form dGLN3_AvgLogFC_(TIME) where (TIME) is 15, 30, etc.
  4. In X2r, type =AVERAGE(
  5. Then highlight all the data in row 2 associated with dGLN3 and t15 (D2-G2), press the closing paren key (shift 0),and press the "enter" key.
  6. This cell now contains the average of the log fold change data from the first gene at t=15 minutes.
  7. Click on this cell and position your cursor at the bottom right corner. You should see your cursor change to a thin black plus sign (not a chubby white one). When it does, double click, and the formula will magically be copied to the entire column of 6188 other genes.
  8. Repeat steps (4) through (8) with the t30, t60, t90, and the t120 data.
  9. Now in the first empty column to the right of the dGLN3_AvgLogFC_t120 calculation (AC1), create the column header dGLN3_ss_HO.
  10. In the first cell below this header (AC2), type =SUMSQ(
  11. Highlight all the LogFC data in row 2 for dGLN3 (but not the AvgLogFC), press the closing paren key (shift 0),and press the "enter" key. Click the small black plus sign again to apply to all columns.
  12. In the next empty column to the right of dGLN3_ss_HO (AD1), create the column headers dGLN3_ss_(TIME) as in (3).
  13. Make a note of how many data points you have at each time point for your strain. For dHAP4, it will be "3", but for the wild type it will be "4" or "5". Count carefully. Also, make a note of the total number of data points. For dHAP4, this number will be 15, but for wt it should be 23 (double-check).
    • 15: 4
    • 30: 4
    • 60: 4
    • 90: 4
    • 120: 4
    • Total: 20
  14. In the first cell below the header dGLN3_ss_t15, type =SUMSQ(<range of cells for logFC_t15>)-<number of data points>*<AvgLogFC_t15>^2 and hit enter.
    • The phrase <range of cells for logFC_t15> should be replaced by the data range associated with t15.
    • The phrase <number of data points> should be replaced by the number of data points for that timepoint (either 3, 4, or 5).
    • The phrase <AvgLogFC_t15> should be replaced by the cell number in which you computed the AvgLogFC for t15, and the "^2" squares that value.
    • Upon completion of this single computation, use the Step (7) trick to copy the formula throughout the column.
  15. Repeat this computation for the t30 through t120 data points. Again, be sure to get the data for each time point, type the right number of data points, and get the average from the appropriate cell for each time point, and copy the formula to the whole column for each computation.
  16. In the first column to the right of dGLN3_ss_t120, create the column header dGLN3_SS_full.
  17. In the first row below this header, type =sum(<range of cells containing "ss" for each timepoint>) and hit enter.
  18. In the next two columns to the right, create the headers dGLN3_Fstat and dGLN3_p-value.
  19. Recall the number of data points from (13): call that total n.
  20. In the first cell of the dGLN3_Fstat column (AJ2), type =((n-5)/5)*(<dGLN3_ss_HO>-<dGLN3_SS_full>)/<dGLN3_SS_full> and hit enter.
    • Don't actually type the n but instead use the number from (13).
    • Replace the phrase dGLN3_ss_HO with the cell designation (AC2).
    • Replace the phrase <dGLN3_SS_full> with the cell designation (AI2).
    • Copy to the whole column.
  21. In the first cell below the dGLN3_p-value header, type =FDIST(<dGLN3_Fstat>,5,n-5) replacing the phrase <dGLN3_Fstat> with the cell designation (AJ2) and the "n" as in (13) with the number of data points total. Copy to the whole column.
  22. Before we move on to the next step, we will perform a quick sanity check to see if we did all of these computations correctly.
    • Click on cell A1 and click on the Data tab. Select the Filter icon (looks like a funnel). Little drop-down arrows should appear at the top of each column. This will enable us to filter the data according to criteria we set.
    • Click on the drop-down arrow on your dGLN3_p-value column. Select "Number Filters". In the window that appears, set a criterion that will filter your data so that the p value has to be less than 0.05.
    • Excel will now only display the rows that correspond to data meeting that filtering criterion. A number will appear in the lower left hand corner of the window giving you the number of rows that meet that criterion. We will check our results with each other to make sure that the computations were performed correctly.
      • 1856 records were found with p < 0.05.
Calculate the Bonferroni and p value Correction
  1. Now we will perform adjustments to the p value to correct for the multiple testing problem. Label the next two columns to the right (AL1 and AM1) with the same label, dGLN3_Bonferroni_p-value.
  2. Type the equation =<dGLN3_p-value>*6189, Upon completion of this single computation, use the Step (10) trick to copy the formula throughout the column.
  3. Replace any corrected p value that is greater than 1 by the number 1 by typing the following formula into the first cell below the second dGLN3_Bonferroni_p-value header: =IF(AL2>1,1, AL2). Use the Step (10) trick to copy the formula throughout the column.
Calculate the Benjamini & Hochberg p value Correction
  1. Insert a new worksheet named "dGLN3_B&H".
  2. Copy and paste the "MasterIndex" and "ID" columns from your previous worksheet into the first two columns of the new worksheet.
  3. For the following, use Paste special > Paste values. Copy your unadjusted p values from your ANOVA worksheet and paste it into Column C.
  4. Select all of columns A, B, and C. Sort by ascending values on Column C. Click the sort button from A to Z on the toolbar, in the window that appears, sort by column C, smallest to largest.
  5. Type the header "Rank" in cell D1. We will create a series of numbers in ascending order from 1 to 6189 in this column. This is the p value rank, smallest to largest. Type "1" into cell D2 and "2" into cell D3. Select both cells A2 and A3. Double-click on the plus sign on the lower right-hand corner of your selection to fill the column with a series of numbers from 1 to 6189.
  6. Now you can calculate the Benjamini and Hochberg p value correction. Type dGLN3_B-H_p-value in cell E1. Type the following formula in cell E2: =(C2*6189)/D2 and press enter. Copy that equation to the entire column.
  7. Type "dGLN3_B-H_p-value" into cell F1.
  8. Type the following formula into cell F2: =IF(E2>1,1,E2) and press enter. Copy that equation to the entire column.
  9. Select columns A through F. Now sort them by your MasterIndex in Column A in ascending order.
  10. Copy column F and use Paste special > Paste values to paste it into the next column on the right of your ANOVA sheet.
  • Upload the .xlsx file that you have just created to LionShare. Send Dr. Dahlquist an e-mail with the link to the file (e-mail kdahlquist at lmu dot edu).
Sanity Check: Number of genes significantly changed

Before we move on to further analysis of the data, we want to perform a more extensive sanity check to make sure that we performed our data analysis correctly. We are going to find out the number of genes that are significantly changed at various p value cut-offs.

  • Go to your dGLN3_ANOVA worksheet.
  • Select row 1 (the row with your column headers) and select the menu item Data > Filter > Autofilter (The funnel icon on the Data tab). Little drop-down arrows should appear at the top of each column. This will enable us to filter the data according to criteria we set.
  • Click on the drop-down arrow for the unadjusted p value. Set a criterion that will filter your data so that the p value has to be less than 0.05.
    • How many genes have p < 0.05? and what is the percentage (out of 6189)?
      • 1856 (29.98%)
    • How many genes have p < 0.01? and what is the percentage (out of 6189)?
      • 1007 (16.27%)
    • How many genes have p < 0.001? and what is the percentage (out of 6189)?
      • 398 (6.43%)
    • How many genes have p < 0.0001? and what is the percentage (out of 6189)?
      • 121 (1.96%)
  • When we use a p value cut-off of p < 0.05, what we are saying is that you would have seen a gene expression change that deviates this far from zero by chance less than 5% of the time.
  • We have just performed 6189 hypothesis tests. Another way to state what we are seeing with p < 0.05 is that we would expect to see this a gene expression change for at least one of the timepoints by chance in about 5% of our tests, or 309 times. Since we have more than 309 genes that pass this cut off, we know that some genes are significantly changed. However, we don't know which ones. To apply a more stringent criterion to our p values, we performed the Bonferroni and Benjamini and Hochberg corrections to these unadjusted p values. The Bonferroni correction is very stringent. The Benjamini-Hochberg correction is less stringent. To see this relationship, filter your data to determine the following:
    • How many genes are p < 0.05 for the Bonferroni-corrected p value? and what is the percentage (out of 6189)?
      • 20 (0.32%)
    • How many genes are p < 0.05 for the Benjamini and Hochberg-corrected p value? and what is the percentage (out of 6189)?
      • 889 (14.36%)
  • In summary, the p value cut-off should not be thought of as some magical number at which data becomes "significant". Instead, it is a moveable confidence level. If we want to be very confident of our data, use a small p value cut-off. If we are OK with being less confident about a gene expression change and want to include more genes in our analysis, we can use a larger p value cut-off.
  • Comparing results with known data: the expression of the gene NSR1 (ID: YGR159C)is known to be induced by cold shock. Find NSR1 in your dataset. What is its unadjusted, Bonferroni-corrected, and B-H-corrected p values? What is its average Log fold change at each of the timepoints in the experiment? Note that the average Log fold change is what we called "dGLN3_AvgLogFC_(TIME)" in step 3 of the ANOVA analysis.
    • Unadjusted p-value: 0.000515223
    • Bonferroni-corrected p-value: 1
    • B-h-corrected p-value: 0.011071929
    • Average log fold change 15: 3.30235
    • Average log fold change 30: 4.373575
    • Average log fold change 60: 2.598175
    • Average log fold change 90: -1.822175
    • Average log fold change 120: -1.80175
  • We will compare the numbers we get between the wild type strain and the other strains studied, organized as a table. Use this sample PowerPoint slide to see how your table should be formatted.

5/19/2015

Modified t test for each timepoint

In the analysis above we performed an ANOVA to determine if any genes had a gene expression change that was significantly different than zero at any timepoint. Now we will perform a modified t test to determine if any genes had a gene expression change that was significantly different than zero at each timepoint. You will perform your analysis on the same strain that you did above, adding these calculations to the same Excel workbook.

  • Insert a new worksheet into your Excel workbook and name it "dGLN3_ttest".
  • Go back to the "Master_Sheet" worksheet for your strain, Select All and Copy. Go to your new "dGLN3_ttest" worksheet, click on the upper, left-hand cell (cell A1) and Select "Paste Special" from the Edit menu. A window will open: click on the radio button for "Values" and click OK. This will paste the numerical result into your new worksheet instead of the equation which must make calculations on the fly.
    • Value errors were corrected yesterday.
  • Go to the empty columns to the right on your worksheet. Create new column headings in the top cells to label the average log fold changes that you will compute. Name them with the pattern dGLN3_AvgLogFC_<tx> where you use the appropriate text within the <> and where x is the time. For example, "dGLN3_AvgLogFC_t15".
  • Compute the average log fold change for the replicates for each timepoint by typing the equation:
=AVERAGE(range of cells in the row for that timepoint)

into the second cell below the column heading. For example, your equation might read

=AVERAGE(D2:G2)

Copy this equation and paste it into the rest of the column.

  • Create the equation for the rest of the timepoints and paste it into their respective columns. Note that you can save yourself some time by completing the first equation for all of the averages and then copy and paste all the columns at once.
  • Go to the empty columns to the right on your worksheet. Create new column headings in the top cells to label the T statistic that you will compute. Name them with the pattern dGLN3_Tstat_<tx> where you use the appropriate text within the <> and where x is the time. For example, "dGLN3_Tstat_t15". You will now compute a T statistic that tells you whether the normalized average log fold change is significantly different than 0 (no change in expression). Enter the equation into the second cell below the column heading:
=AVERAGE(range of cells)/(STDEV(range of cells)/SQRT(number of replicates))

For example, your equation might read:

=AVERAGE(D2:G2)/(STDEV(D2:G2)/SQRT(4))

(NOTE: in this case the number of replicates is 4. Be careful that you are using the correct number of parentheses.) Copy the equation and paste it into all rows in that column. Create the equation for the rest of the timepoints and paste it into their respective columns. Note that you can save yourself some time by completing the first equation for all of the T statistics and then copy and paste all the columns at once.

  • Go to the empty columns to the right on your worksheet. Create new column headings in the top cells to label the P value that you will compute. Name them with the pattern dGLN3_Pval_<tx> where you use the appropriate text within the <> and where x is the time. For example, "dGLN3_Pval_t15". In the cell below the label, enter the equation:
=TDIST(ABS(cell containing T statistic),degrees of freedom,2)

For example, your equation might read:

=TDIST(ABS(AC2),3,2)

The number of degrees of freedom is the number of replicates minus one. Copy the equation and paste it into all rows in that column.

  • As with the ANOVA, we encounter the multiple testing problem here as well.
Bonferroni Correction
  • We need to perform the Bonferroni correction to each p value similar to what we did for the within-strain ANOVA.
  1. Now we will perform adjustments to the p value to correct for the multiple testing problem. Label the columns to the right with the label, dGLN3_Bonferroni_<tx>, where you use the appropriate text within the <> and where x is the time. Copy all 5 headers into the columns to the right so that there are 2 copies of each.
  2. Type the equation =<dGLN3_Pval_tx>*6189. Apply to the full column.
  3. Replace any corrected p value that is greater than 1 by the number 1 by typing the following formula into the first cell below the second dGLN3_Bonferroni_p-value header: =IF(AM2>1,1, AM2). Copy the formula throughout the column.
Benjamini & Hochberg Correction
  • We need to perform the Benjamini & Hochberg correction to each p value similar to what we did for the within-strain ANOVA.
  • Note: the following instructions were created before the official instructions were updated, so they will differ from what is seen on the main page.
  1. Insert a new worksheet named "dGLN3_ttest_B&H".
  2. Copy and paste the "MasterIndex", "ID", and "Standard Name" columns from your previous worksheet into the first two columns of the new worksheet.
  3. For the following, use Paste special > Paste values. Copy your unadjusted p values from your ANOVA worksheet and paste it into Column D. Place a blank column between column D and E. Name this column "Rank_t15". Repeat this so that each timepoint has a corresponding rank column. The ranks should be in columns E, G, I, K, and M.
  4. Select all of the columns. Sort by ascending values on Column D, dGLN3_Pval_t15. Click the sort button from A to Z on the toolbar, in the window that appears, sort by column D, smallest to largest.
  5. Type "1" into cell E2 and "2" into cell E3. Select both cells, and double-click on the plus sign on the lower right-hand corner of your selection to fill the column with a series of numbers from 1 to 6189.
  6. Now you can calculate the Benjamini and Hochberg p value correction. Type dGLN3_B-H_t15 in cell N1, to the right of all the unadjusted p-values and ranks. Add this same header for each timepoint into the next 4 columns. Type the following formula in cell N2: =(D2*6189)/E2 and press enter. Copy that equation to the entire column. Repeat steps 4-6 with the remaining timepoints, sorting by each respective timepoint and ranking them accordingly. Be sure to undo the filters before continuing to the next timepoint.
  7. Copy the headers "dGLN3_B-H_t15" to "dGLN3_B-H_t120" into the empty columns to the right starting at S1.
  8. Type the following formula into cell S2: =IF(N2>1,1,N2) and press enter. Copy that equation to the entire column. Repeat for the remaining timepoints.
  9. Select all columns. Now sort them by your MasterIndex in Column A in ascending order.
  10. Copy columns S through W and use Paste special > Paste values to paste it into the next column on the right of your dGLN3_ttest sheet.
Sanity Check
  • We will also perform the "sanity check" as follows:
    • Determine how many genes have a p value < 0.05 at each timepoint.
      • 15: 1027 (16.59%)
      • 30: 1622 (26.21%)
      • 60: 628 (10.15%)
      • 90: 558 (9.11%)
      • 120: 403 (6.51%)
    • Keeping the "Pval" filter at p < 0.05, How many have an average log fold change of > 0.25 and p < 0.05 at each timepoint? How many have an average log fold change of < -0.25 and p < 0.05 at each timepoint? (These log fold change cut-offs represent about a 20% fold change in expression.)
      • LogFC > 0.25
        • 15: 559 (9.03%)
        • 30: 897 (14.49%)
        • 60: 319 (5.15%)
        • 90: 265 (4.28%)
        • 120: 190 (3.07%)
      • LogFC < -0.25
        • 15: 458 (7.4%)
        • 30: 711 (11.49%)
        • 60: 304 (4.91%)
        • 90: 289 (4.67%)
        • 120: 207 (3.34%)
    • How many genes have B&H corrected p < 0.05?
      • 15: 0 (0%)
      • 30: 5 (0.08%)
      • 60: 0 (0%)
      • 90: 0 (0%)
      • 120: 0 (0%)
    • How many genes have a Bonferroni corrected p < 0.05?
      • 15: 0 (0%)
      • 30: 1 (0.016%)
      • 60: 0 (0%)
      • 90: 0 (0%)
      • 120: 0 (0%)
  • Use this sample PowerPoint slide to see how your table should be formatted.


Step 9: GenMAPP & MAPPFinder

Preparing the Input File for GenMAPP

  • Insert a new worksheet and name it dGLN3_GenMAPP.
  • Go back to the "ANOVA" worksheet for your strain and Select All and Copy.
  • Go to your new sheet and click on cell A1 and select Paste Special, click on the Values radio button, and click OK.
    • Delete the columns containing the "ss" calculations as well as the fstat, just retaining the individual log fold change data, the average log fold change data, and p value. For the Bonferroni and B&H p values, just keep one column where we replaced all values > 1 with 1.
    • Rename the "dGLN3_p-value" column to "dGLN3_ANOVA_p-value", the "dGLN3_Bonferroni_p-value" column to "dGLN3_Bonferroni_ANOVA_p-value", and the "dGLN3_B-H_p-value" to "dGLN3_B-H_ANOVA_p-value".
  • Now go to your "_ttest" worksheet. Copy just the columns containing the P values for the individual timepoints and Paste special > Paste values into your GenMAPP worksheet to the right of the previous data. For the Bonferroni and B&H p values, just keep one column where we replaced all values > 1 with 1.
    • Move the columns with ANOVA in the name to before the AvgLogFC columns (Y-AA). To do this, select the columns and then right click and select "cut" (or press Ctrl + x). Right-click the "dGLN3_AvgLogFC_15" column and select "Insert Cut Cells". Use this same system to rearrange the remaining columns in the following order after the ANOVA columns:
      • dGLN3_AvgLogFC_tx | dGLN3_Pval_tx | dGLN3_Bonferroni_tx | dGLN3_B-H_tx, with x being the timepoint.
    • Repeat this for each timepoint, so that the values for each timepoint are organized in that fashion.
  • Select all of the columns containing Fold Changes. Select the menu item Format > Cells. Under the number tab, select 2 decimal places. Click OK.
  • Select all of the columns containing T statistics or P values. Select the menu item Format > Cells. Under the number tab, select 4 decimal places. Click OK.
  • We will now format this file for use with GenMAPP.
    • Currently, the "MasterIndex" column is the first column in the worksheet. We need the "ID" column to be the first column. Select Column B and Cut. Right-click on Cell A1 and select "Insert cut cells". This will reverse the position of the columns.
    • Insert a new empty column in Column B. Type "SystemCode" in the first cell and "D" in the second cell of this column. Use our trick to fill this entire column with "D".
    • Make sure to save this work as your .xlsx file. Now save this worksheet as a tab-delimited text file for use with GenMAPP in the next section.

Running GenMAPP

Each time you launch GenMAPP, you need to make sure that the correct Gene Database (.gdb) is loaded.

  • Look in the lower left-hand corner of the window to see which Gene Database has been selected.
  • If you need to change the Gene Database, select Data > Choose Gene Database. Navigate to the directory C:\GenMAPP 2 Data\Gene Databases and choose the correct one for your species.
  • For the exercise today, if the yeast Gene Database is not present on your computer, you will need to download it. Click this link to download the yeast Gene Database.
  • Unzip the file and save it, Sc-Std_20060526.gdb, to the folder C:\GenMAPP 2 Data\Gene Databases.

GenMAPP Expression Dataset Manager Procedure

  • Launch the GenMAPP Program. Check to make sure the correct Gene Database is loaded.
  • Select the Data menu from the main Drafting Board window and choose Expression Dataset Manager from the drop-down list. The Expression Dataset Manager window will open.
  • Select New Dataset from the Expression Datasets menu. Select the tab-delimited text file that you formatted for GenMAPP (.txt) in the procedure above from the file dialog box that appears.
  • The Data Type Specification window will appear. GenMAPP is expecting that you are providing numerical data. If any of your columns has text (character) data, check the box next to the field (column) name.
    • The column StandardName has text data in it, but none of the rest do.
  • Allow the Expression Dataset Manager to convert your data.
    • This may take a few minutes depending on the size of the dataset and the computer’s memory and processor speed. When the process is complete, the converted dataset will be active in the Expression Dataset Manager window and the file will be saved in the same folder the raw data file was in, named the same except with a .gex extension; for example, MyExperiment.gex.
    • A message may appear saying that the Expression Dataset Manager could not convert one or more lines of data. Lines that generate an error during the conversion of a raw data file are not added to the Expression Dataset. Instead, an exception file is created. The exception file is given the same name as your raw data file with .EX before the extension (e.g., MyExperiment.EX.txt). The exception file will contain all of your raw data, with the addition of a column named ~Error~. This column contains either error messages or, if the program finds no errors, a single space character.
      • Record the number of errors in your lab notebook.
  • Customize the new Expression Dataset by creating new Color Sets which contain the instructions to GenMAPP for displaying data on MAPPs.
    • Color Sets contain the instructions to GenMAPP for displaying data from an Expression Dataset on MAPPs. Create a Color Set by filling in the following different fields in the Color Set area of the Expression Dataset Manager: a name for the Color Set, the gene value, and the criteria that determine how a gene object is colored on the MAPP. Enter a name in the Color Set Name field that is 20 characters or fewer. You will have one Color Set per strain per time point.
    • The Gene Value is the data displayed next to the gene box on a MAPP. Select the column of data to be used as the Gene Value from the drop down list or select [none]. We will use "Avg_LogFC_" for the the appropriate time point.
    • Activate the Criteria Builder by clicking the New button.
    • Enter a name for the criterion in the Label in Legend field.
    • Choose a color for the criterion by left-clicking on the Color box. Choose a color from the Color window that appears and click OK.
    • State the criterion for color-coding a gene in the Criterion field.
      • A criterion is stated with relationships such as "this column greater than this value" or "that column less than or equal to that value". Individual relationships can be combined using as many ANDs and ORs as needed. A typical relationship is
[ColumnName] RelationalOperator Value

with the column name always enclosed in brackets and character values enclosed in single quotes. For example:

[Fold Change] >= 2
[p value] < 0.05
[Quality] = 'high'

This is the equivalent to queries that you performed on the command line when working with the PostgreSQL movie database. GenMAPP is using a graphical user interface (GUI) to help the user format the queries correctly. The easiest and safest way to create criteria is by choosing items from the Columns and Ops (operators) lists shown in the Criteria Builder. The Columns list contains all of the column headings from your Expression Dataset. To choose a column from the list, click on the column heading. It will appear at the location of the cursor in the Criterion box. The Criteria Builder surrounds the column names with brackets.

The Ops (operators) list contains the relational operators that may be used in the criteria: equals ( = ) greater than ( > ), less than ( < ), greater than or equal to ( >= ), less than or equal to ( <= ), is not equal to ( <> ). To choose an operator from the list, click on the symbol. It will appear at the location of the insertion bar (cursor) in the Criterion box. The Criteria Builder automatically surrounds the operators with spaces. The Ops list also contains the conjunctions AND and OR, which may be used to make compound criteria. For example:

[Fold Change] > 1.2 AND [p value] <= 0.05

Parentheses control the order of evaluation. Anything in parentheses is evaluated first. Parentheses may be nested. For example:

[Control Average] = 100 AND ([Exp1 Average] > 100 OR [Exp2 Average] > 100)

Column names may be used anywhere a value can, for example:

[Control Average] < [Experiment Average]
  • After completing a new criterion, add the criterion entry (label, criterion, and color) to the Criteria List by clicking the Add button.
    • For the yeast dataset, you will create two criterion for each Color Set. "Increased" will be [<strain>_Avg_LogFC_<timepoint>] > 0.25 AND [<strain>Pval_<timepoint>] < 0.05 and "Decreased will be [<strain>_Avg_LogFC_<timepoint>] < -0.25 AND [<strain>Pval_<timepoint>] < 0.05. Make sure that the increased and decreased average log fold change values match the timepoint of the Color Set.
    • You may continue to add criteria to the Color Set by using the previous steps.
      • The buttons to the right of the list represent actions that can be performed on individual criteria. To modify a criterion label, color, or the criterion itself, first select the criterion in the list by left-clicking on it, and then click the Edit button. This puts the selected criterion into the Criteria Builder to be modified. Click the Save button to save changes to the modified criterion; click the Add button to add it to the list as a separate criterion. To remove a criterion from the list, left-click on the criterion to select it, and then click on the Delete button. The order of Criteria in the list has significance to GenMAPP. When applying an Expression Dataset and Color Set to a MAPP, GenMAPP examines the expression data for a particular gene object and applies the color for the first criterion in the list that is true. Therefore, it is imperative that when criteria overlap the user put the most important or least inclusive criteria in the list first. To change the order of the criteria in the list, left-click on the criterion to select it and then click the Move Up or Move Down buttons. No criteria met and Not found are always the last two positions in the list.
  • You will also create two ColorSets to view the ANOVA p values for both strains, with criteria for viewing the unadjusted, Bonferroni-corrected, and B&H corrected p values.
  • Save the entire Expression Dataset by selecting Save from the Expression Dataset menu. Changes made to a Color Set are not saved until you do this.
  • Exit the Expression Dataset Manager to view the Color Sets on a MAPP. Choose Exit from the Expression Dataset menu or click the close box in the upper right hand corner of the window.
  • Upload your .gex file to Lionshare and share it with Dr. Dahlquist. E-mail the link to the file to Dr. Dahlquist.
  • Dr. Dahlquist will provide a set of MAPPs with which to view your Expression Dataset.
    • Links to a zipped archive of MAPPs and an Expression Dataset have been e-mailed to your lion e-mail accounts.

Links

Nicole Anguiano

Links

Electronic Lab Notebook
Master Powerpoint