Katherine Grace Johnson Electronic Lab Notebook

From OpenWetWare
Revision as of 16:16, 19 May 2015 by Katherine Grace Johnson (talk | contribs) (added p values)
Jump to navigationJump to search

This is my lab notebook

February 6, 2015

Repeat microchip data normalization for Ontario and GCAT from protocol Dahlquist:Microarray Data Processing in R. Data processed 1/30/15, but repeated today in order to record protocol to this notebook. Both normalized Excel data sheets will be compared to each other and to Natalie's to determine if there is a difference in normalization from computer to computer.

R x64 3.1.0 version used

Within Array Normalization for the Ontario Chips and Within Array Normalization for the GCAT Chips (includes between chip normalization)

  • Change Directory - Must scroll down to "User" to locate kjohn102, then select folder "Microarray Data"
  • to unzip files - right click, 7Zip, Extract here - this will place the unzipped file in the folder you are currently in
  • R asks you to call the data file (.script), then an Excel target file (.csv) in which to put the normalized data. These must both be in the same folder (Microarray data), and downloaded before R is run
  • Excel files are not generated until both normalizations are run
  • Two Excel files generated: GCAT_and_Ontario_Within_Array_Normalization.csv and GCAT_and_Ontario_Final_Normalized_Data.csv. File desired is Normalized Data. Rename with suffix _date_GJ
  • created Excel file, Comparison_Finalized_Normalized_Data_GJNW_20150206.csv to compare three sets of Normalized data: GJ1, GJ2, and NW
    • GJ1 vs NW results - avg 10^-11 difference
    • GJ1 vs GJ2 results - 0 difference
    • Another normalization was run, named GJ3. This was compared to GJ2 in the Excel comparison document. Computer restarted, another normalization created - GJ4
    • GJ2 vs GJ 3 results - 0 difference
    • GJ3 vs GJ 4 results - 0 difference

Conclusions: Data normalization did not change from trial to trial on paradoxus computer, no matter the time of normalization. Normalization produced a slight difference between boulardii and paradoxus computers.

April 14, 2015

Completing Week 11 and Week 12 assignments from [BIOL398]. I will complete statistical testing of wild type data, and generate a network from this data.

Notes for improvement:

  • use COUNTIF function instead of filtering the numbers when looking at p-values
  • To prepare for analysis in STEM, columns containing #VALUE! had to be removed by using custom filter: does not equal #VALUE!. Remaining number values had to be copied and pasted into a new sheet.
  • On macs, cluster files from STEM are not recognized by Excel. Textedit files must be converted to csv by the following procedure:
    • Select a tab character and press Command F, Paste into top bar
    • Click replace, then type a comma into the replace bar. Click replace all.
    • Save with file extension .csv (type manually if it is not a drop down option)

YEASTRACT analysis of profile cluster #45

  • 19 significant transcription factors
Sfp1
Fkh2
Yhp1
Yox1
Cyc8
YLR278C
Ace2
Rif1
Msn2
Stb5
Asg1
Msn4
Mig2
Swi5
Snf6
Pdr1
Gcr2
Gat3
Mcm1
  • Our transcription factors from deletion strains (CIN5, GLN3, HMO1, ZAP1) are not included on this list.
  • Use "Only DNA binding evidence" selection choice when generating networks in YEASTRACT
    • Network should have 40-60 edges

April 29, 2015

Completing Week 13 and Week 14 assignments from [BIOL398]. I will use profile #45 from the YEASTRACT database as the basis for the network to be run through GRNmap. Including the four deletion strains, this network has 23 nodes and 46 edges.

  • Protocol for Week 13 and 14 assignments was followed to produce:
    • Outputs keeping b parameter fixed (i.e. fix_b is set to 1 on the optimization_parameters sheet of input workbook)
    • Outputs allowing b to be estimated (i.e. fix_b is set to 0 on the optimization_parameters sheet of input workbook)
    • Outputs for both runs include:
      • Estimation Excel sheet containing estimated production rates, estimated b values (if applicable), and optimized weights for each transcription factor in the network
      • Output graphs for each transcription factor in the network
  • Both networks were visualized using GRNsight:
    • The output Excel sheet can be used in GRNsight with one minor edit: change name of "out_network_optimized_weights" to "network_optimized_weights"

SURP

May 18, 2015

Microarray Data Analysis

  • Correct formatting:
    • Show file extensions
    • When downloading files, change Firefox settings to default save to Desktop; Firefox->Options->Change to Desktop->select always ask where to save
    • Store files with your name, then yyyymmdd
  • Microarray data
    • Chips used are of two types: GCAT and Ontario
      • GCAT has two gene blocks on each chip. WT data.
      • Ontario has technical replicates, duplicate spots directly next to eachother. Ontario contains more genes than GCAT. WT and deletion data.
  • Zipped files use compression algorithms
    • To unzip files with Microsoft:
      • right click on desired file
      • click arrow on 7-zip line

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.
    • To make sure that you save the clearest image, do not scroll in the window because a grey bar will appear if you do so.
  • The next set of code is for the generation of the GCAT boxplots for the wild-type data.
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.
    • The last graph to appear will be the spar graphs.
    • The graphs generated from this code are the before Ontario chips
  • Be sure to save the 8 graphs before moving on to the next step
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.
    • Again, the last graphs to appear will be the spar graphs.
    • These graphs that are produced are for the after Ontario chips
  • Again, be sure to save 8 graphs before moving on to the next part of the code.
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 the box plots, press enter.
    • You will have to save 8 plots before you have completed the procedure. The last box plot is for spar.
  • Warnings are OK.
  • Zip the files of the plots together and upload to LionShare and/or save to a flash drive.
Summary
  • Followed protocol of steps 4 and 5 from Dahlquist:Microarray_Data_Analysis_Workflow
  • MA plots generated show the log change vs intensity of red and green. Unbiased data should show straight, horizontal lines. Normalization forces conformation to straight lines, therefore after-normalization plots should be more straight than before normalization.
  • Data produced for these strains:
    • wt
    • dCIN5
    • dGLN3
    • dHAP4
    • dHMO1
    • dSWI4
    • dZAP1
    • Spar, or Saccharomyces paradoxus

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.
        • 477 items found and replaced
  • This will be the starting point for our statistical analysis below.
Within-strain ANOVA
  • Purpose of ANOVA: is there significance at any time point?
  • Within-Strain ANOVA testing begun for dHAP4 strain with Monica Hong
  • 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/Natalie: wt
    • Grace/Monica: Δhap4
    • Kevin M./Nicole: Δgln3
    • Kevin W./KD: Δswi4
    • Tessa/Trixie:Δcin5
    • Note that we chose not to do Δhmo1, Δzap1 or S. paradoxus so that students could work in pairs and check each others' work.
  1. Create a new worksheet, naming it "dHAP4_ANOVA"
  2. Copy all of the data from the "Master_Sheet" worksheet for your strain and paste it into your new worksheet.
  3. At the top of the first column to the right of your data, create five column headers of the form dHAP1_AvgLogFC_(TIME) where (TIME) is 15, 30, etc.
  4. In the cell below the dHAP4_AvgLogFC_t15 header, type =AVERAGE(
  5. Then highlight all the data in row 2 associated with dHAP4 and t15, 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 dHAP4_AvgLogFC_t120 calculation, create the column header dHAP4_ss_HO.
  10. In the first cell below this header, type =SUMSQ(
  11. Highlight all the LogFC data in row 2 for your dHAP4 (but not the AvgLogFC), press the closing paren key (shift 0),and press the "enter" key.
  12. In the next empty column to the right of dHAP4_ss_HO, create the column headers dHAP4_ss_(TIME) as in (3).
  13. Note: dHAP4 strain has 18 chips (4 replicates for t15, t30, t60 and 3 replicates for t90 and t120)
  14. In the first cell below the header dHAP4_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,or 4).
    • 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 dHAP4_ss_t120, create the column header dHAP4_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 dHAP4_Fstat and dHAP4_p-value.
  19. Recall the total number of data points - 18.
  20. In the first cell of the dHAP4_Fstat column, type =((18-5)/5)*(<dHAP4_ss_HO>-<dHAP4_SS_full>)/<dHAP4_SS_full> and hit enter.
    • Copy to the whole column.
  21. In the first cell below the dHAP4_p-value header, type =FDIST(<dHAP4_Fstat>,5,18-5) replacing the phrase <dHAP4_Fstat> . 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 dHAP4_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.
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 with the same label, dHAP4_Bonferroni_p-value.
  2. Type the equation =<dHAP4_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 dHAP4_Bonferroni_p-value header: =IF(r2>1,1,r2). 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 "dHAP4_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.
  4. Select all of columns A, B, C, and D. Sort by ascending values on Column D. 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 E1. 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 E2 and "2" into cell E3. Select both cells E2 and E3. 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 dHAP4_B-H_p-value in cell F1. Type the following formula in cell F2: =(D2*6189)/E2 and press enter. Copy that equation to the entire column.
  7. Type "dHAP4_B-H_p-value" into cell G1.
  8. Type the following formula into cell G2: =IF(F2>1,1,F2) and press enter. Copy that equation to the entire column.
  9. Select columns A through G. Now sort them by your MasterIndex in Column A in ascending order.
  10. Copy column G and use Paste special > Paste values to paste it into the next column on the right of your ANOVA sheet.
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 dHAP4_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)?
      • 2387 (38.6%)
    • How many genes have p < 0.01? and what is the percentage (out of 6189)?
      • 1489 (24.1%)
    • How many genes have p < 0.001? and what is the percentage (out of 6189)?
      • 679 (11.0%)
    • How many genes have p < 0.0001? and what is the percentage (out of 6189)?
      • 240 (3.88%)
  • The 0.05 p-value must be narrowed down. To apply a more stringent filter and account for the multiple testing problem, we will apply the Bonferroni (multiply p-value by 6189) and B&H (same as Bonferroni, but stringency decreases as p-value rank decreases)corrections.
    • How many genes are p < 0.05 for the Bonferroni-corrected p value? and what is the percentage (out of 6189)?
      • 61 (0.986%)
    • How many genes are p < 0.05 for the Benjamini and Hochberg-corrected p value? and what is the percentage (out of 6189)?
      • 1615 (26.1%)
  • Results of dHAP4 deletion compared to wt Media:DHAP1 p-value slide 20150518 GJ.pptx


  • 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?
    • unadjusted p-value:0.01505
    • Bonferroni-corrected: 93.11
    • B&H corrected: 0.05539
    • Log fold changes:
      • t15: 2.6095
      • t30: 3.1899
      • t60: 3.4241
      • t90: -1.1533
      • t120: -1.7281

May 19, 2015

Step 6: Statistical Analysis

Modified t-test for each timepoint
  • purpose of t-test: is there a significant change from zero at each time point?
  • analysis performed in same Excel workbook as above
  • Insert a new worksheet into your Excel workbook and name it "dHAP4_ttest"
  • Go back to the "Master_Sheet" worksheet for your strain. Copy the first three columns containing the "MasterIndex", "ID", and "Standard Name" from the "Master_Sheet" worksheet for your strain and paste it into your new worksheet. Copy the columns containing the data for dHAP4 and paste it into your new worksheet.
  • Go to the empty columns to the right on your worksheet (columns V through Z). Create new column headings in the top cells to label the average log fold changes that you will compute. Name them with the pattern <dHAP4>_<AvgLogFC>_<tx> where x is the time. For example, "dHAP4_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, the equation for t15 reads

=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.
  • Go to the empty columns to the right on your worksheet (AA through AE). Create new column headings in the top cells to label the T statistic that you will compute. Name them with the pattern <dHAP4>_<Tstat>_<tx> where x is the time. For example, "dHAP4_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 cell AA2 for the t15 time points:
=AVERAGE(D2:G2)/(STDEV(D2:G2)/SQRT(4))

(NOTE: in this case the number of replicates is 4. For dHAP4 strain, t90 and t120 only have 3 replicates. 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 (AF through AJ). Create new column headings in the top cells to label the P value that you will compute. Name them with the pattern <dHAP4>_<Pval>_<tx> where x is the time. For example, "dHAP4_Pval_t15". In the cell AF2 for t15, enter the equation:
=TDIST(ABS(AA2),3,2)

Where 3 is degrees of freedom (4 replicates -1), and 2 is the number of tails on the t-test. Note that t90 and t120 will have 2 degrees of freedom. 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
  1. Now we will perform adjustments to the p value to correct for the multiple testing problem. Label the columns to the right (AK through AT) with the label, dHAP4_Bonferroni-Pval_tx (do this twice in a row).
  2. Into cell AK2 type the equation =<AF2>*6189, Upon completion of this single computation, use the 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 dHAP2_Bonferroni-Pval_t15 header (cell AL2): =IF(AK2>1,1,AK2). Use the trick to copy the formula throughout the column.
  4. Repeat this for all five time points.
Benjamini & Hochberg Correction
  1. Insert a new worksheet named "dHAP_ttest_BH". You will need to perform the procedure below for the p values for each timepoint. Do them individually one at a time to avoid confusion.
  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 the first timepoint from your ttest worksheet and paste it into Column D.
  4. Select all of columns A, B, C, and D. Sort by ascending values on Column D. 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 the header "Rank" in cell E1. 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 E2 and "2" into cell E3. Select both cells E2 and E3. 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 dHAP4_BH_Pval_t15 in cell F1. Type the following formula in cell F2: =(D2*6189)/E2 and press enter. Copy that equation to the entire column.
  7. Type "dHAP4_B-H_Pval_t15" into cell G1 for the greater than 1 logic test.
  8. Type the following formula into cell G2: =IF(F2>1,1,F2) and press enter. Copy that equation to the entire column.
  9. Select columns A through G. Now sort them by your MasterIndex in Column A in ascending order.
  10. Copy column G and use Paste special > Paste values to paste it into the next column on the right of your ttest sheet.
  11. Repeat for the other four time points.
Sanity Check
  • We will also perform the "sanity check" as follows:
    • Determine how many genes have a p value < 0.05 at each timepoint.
      • t15: 1197
      • t30: 1772
      • t60: 2006
      • t90: 234
      • t120: 515
    • 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?'
      • t15: 690
      • t30: 947
      • t60: 1028
      • t90: 141
      • t120: 289
    • 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.)
      • t15: 501
      • t30: 814
      • t60: 967
      • t90: 83
      • t120: 216
    • How many genes have B&H corrected p < 0.05?
      • t15: 2
      • t30: 108
      • t60: 241
      • t90: 0
      • t120: 0
    • How many genes have a Bonferroni corrected p < 0.05?
      • t15: 2
      • t30: 0
      • t60: 1
      • t90: 0
      • t120: 0

Summarized results of modified t-test (and withing strain ANOVA from May 18) can be found on this document: Media:DHAP1 p-value slide 20150518 GJ.pptx

Between-Strain ANOVA

The detailed description of how this is done can be found on this page. A brief version of the protocol appears below.

  • All two strain comparisons were performed in MATLAB using the script Two_strain_compare_corrected_20140813_3pm.zip (within a zip file):
    • Download the zipped script file, extract it to the folder that contains your Excel file with the worksheet named "Master_Sheet". (The script and Excel file must be in the same folder to work.)
    • Launch MATLAB version 2014b.
    • In MATLAB, you will need to navigate to the folder containing the script and the Excel file.
      • Near the top of the page, you will see a a field that contains the path to the working directory. Just to the left of it, there is an icon that looks like a folder opening with a green down arrow. Click on this icon to open a dialog box where you can choose your folder containing the script and Excel file.
      • Once you have selected your folder, the left-hand pane should display the contents of that folder. To open the MATLAB script, you can double-click on it from that pane. The code for the script will appear in the center pane.
  • You will need to make a few edits to the code, depending on which strain comparison you want to make.
    • For the first block of code, the user must input the name of the Excel file to be imported as the variable "filename", the sheet from which the data will be imported as the variable "sheetname", and the two strains that will be compared as the variables "strain1" and "strain2", in this case "wt" and "dHAP4"
      • MATLAB will read either .xlsx or .xls
      • Also note that this script will not work for any comparison involving dSWI4 because it has been hard-coded to expect 5 timepoints instead of 4.
%% User must input filename, sheetname, and strains for comparison
filename = 'dHAP4_2StrainANOVA_20150519_GJ.xlsx'; % Name of input file
sheetname  = 'Master_Sheet'; % Name of sheet in input file containing data to analyze
% % If one of the two strains you are working on is the wildtype, keep that
% % wildtype as strain 1.
strain1    = 'wt'; %Here should be wt, dCIN5, dGLN3, dHAP4, dHMO1, dZAP1, or Spar
% % Select strain 2 to be one of the other strains you would like to
% % compare with the first strain.
strain2    = 'dHAP4'; %Here should be wt, dCIN5, dGLN3, dHAP4, dHMO1, dZAP1, or Spar
  • The user does not have to modify any of the code from here on.
  • The next two lines of code ask the user whether or not they would like to see plots for each gene with an unadjusted p-value < 0.05. If the user does want to see these plots, they enter "1". If they would not like to see these plots, the user enters "0". When prompted, enter a "1" to see the plots displayed.
disp('Do you want to view plots for each gene with an unadjusted p-value < 0.05?')
graph = input('If yes, enter "1". If no, enter "0". ');
  • Output files saved:
    • wt_dHAP4_ANOVA_out_data.xls
    • wt_dHAP4_out_data.mat
  • Output p-values
    • Number of genes with uncorrected p<0.05 for wt vs dHAP4(from column S of wt_dHAP4_ANOVA_out_data.xls): 640
    • Number of genes with B&H p<0.05 for wt vs dHAP4 (from column V of wt_dHAP4_ANOVA_out_data.xls): 23

Step 7-8: Clustering and GO Term Enrichment with stem

  1. Prepare your microarray data file for loading into STEM.
    • Insert a new worksheet into your Excel workbook, and name it "(STRAIN)_stem".
    • Select all of the data from your "(STRAIN)_ANOVA" worksheet and Paste special > paste values into your "(STRAIN)_stem" worksheet.
      • Your leftmost column should have the column header "MasterIndex". Rename this column to "SPOT". Column B should be named "ID". Rename this column to "Gene Symbol". Delete the column named "StandardName".
      • Filter the data on the B-H corrected p value to be > 0.05 (that's greater than in this case).
        • Once the data has been filtered, select all of the rows (except for your header row) and delete the rows by right-clicking and choosing "Delete Row" from the context menu. Undo the filter. This ensures that we will cluster only the genes with a "significant" change in expression and not the noise.
      • Delete all of the data columns EXCEPT for the Average Log Fold change columns for each timepoint (for example, wt_AvgLogFC_t15, etc.).
      • Rename the data columns with just the time and units (for example, 15m, 30m, etc.).
      • Save your work. Then use Save As to save this spreadsheet as Text (Tab-delimited) (*.txt). Click OK to the warnings and close your file.
        • Note that you should turn on the file extensions if you have not already done so.
  2. Now download and extract the STEM software. Click here to go to the STEM web site.
    • Click on the download link, register, and download the stem.zip file to your Desktop.
    • Unzip the file. In Seaver 120, you can right click on the file icon and select the menu item 7-zip > Extract Here.
    • This will create a folder called stem. Inside the folder, double-click on the stem.jar to launch the STEM program.
  3. Running STEM
    1. In section 1 (Expression Data Info) of the the main STEM interface window, click on the Browse... button to navigate to and select your file.
      • Click on the radio button No normalization/add 0.
      • Check the box next to Spot IDs included in the data file.
    2. In section 2 (Gene Info) of the main STEM interface window, select Saccharomyces cerevisiae (SGD), from the drop-down menu for Gene Annotation Source. Select No cross references, from the Cross Reference Source drop-down menu. Select No Gene Locations from the Gene Location Source drop-down menu.
    3. In section 3 (Options) of the main STEM interface window, make sure that the Clustering Method says "STEM Clustering Method" and do not change the defaults for Maximum Number of Model Profiles or Maximum Unit Change in Model Profiles between Time Points.
    4. In section 4 (Execute) click on the yellow Execute button to run STEM.
  4. Viewing and Saving STEM Results
    1. A new window will open called "All STEM Profiles (1)". Each box corresponds to a model expression profile. Colored profiles have a statistically significant number of genes assigned; they are arranged in order from most to least significant p value. Profiles with the same color belong to the same cluster of profiles. The number in each box is simply an ID number for the profile.
      • Click on the button that says "Interface Options...". At the bottom of the Interface Options window that appears below where it says "X-axis scale should be:", click on the radio button that says "Based on real time". Then close the Interface Options window.
      • Take a screenshot of this window (on a PC, simultaneously press the Alt and PrintScreen buttons to save the view in the active window to the clipboard) and paste it into a PowerPoint presentation to save your figures.
    2. Click on each of the SIGNIFICANT profiles (the colored ones) to open a window showing a more detailed plot containing all of the genes in that profile.
      • Take a screenshot of each of the individual profile windows and save the images in your PowerPoint presentation.
      • At the bottom of each profile window, there are two yellow buttons "Profile Gene Table" and "Profile GO Table". For each of the profiles, click on the "Profile Gene Table" button to see the list of genes belonging to the profile. In the window that appears, click on the "Save Table" button and save the file to your desktop. Make your filename descriptive of the contents, e.g. "wt_profile#_genelist.txt", where you replace the number symbol with the actual profile number.
      • For each of the significant profiles, click on the "Profile GO Table" to see the list of Gene Ontology terms belonging to the profile. In the window that appears, click on the "Save Table" button and save the file to your desktop. Make your filename descriptive of the contents, e.g. "wt_profile#_GOlist.txt", where you use "wt", "dGLN3", etc. to indicate the dataset and where you replace the number symbol with the actual profile number. At this point you have saved all of the primary data from the STEM software and it's time to interpret the results!
  5. Analyzing and Interpreting STEM Results
    1. Select one of the profiles you saved in the previous step for further intepretation of the data. I suggest that you choose one that has a pattern of up- or down-regulated genes at the early (first three) timepoints. You and your partner will choose the same profile so that you can compare your results between the two strains. Answer the following:
      • Why did you select this profile? In other words, why was it interesting to you?
      • How many genes belong to this profile?
      • How many genes were expected to belong to this profile?
      • What is the p value for the enrichment of genes in this profile? Bear in mind that we just finished computing p values to determine whether each individual gene had a significant change in gene expression at each time point. This p value determines whether the number of genes that show this particular expression profile across the time points is significantly more than expected.
      • Open the GO list file you saved for this profile in Excel. This list shows all of the Gene Ontology terms that are associated with genes that fit this profile. Select the third row and then choose from the menu Data > Filter > Autofilter. Filter on the "p-value" column to show only GO terms that have a p value of < 0.05. How many GO terms are associated with this profile at p < 0.05? The GO list also has a column called "Corrected p-value". This correction is needed because the software has performed thousands of significance tests. Filter on the "Corrected p-value" column to show only GO terms that have a corrected p value of < 0.05. How many GO terms are associated with this profile with a corrected p value < 0.05?
      • Select 10 Gene Ontology terms from your filtered list (either p < 0.05 or corrected p < 0.05).
        • Since you and your partner are going to compare the results from each strain for the same cluster, you can either:
          • Choose the same 10 terms that are in common between strains.
          • Choose 10 terms that are different between the strains (5 or so from each).
          • Choose some that are the same and some that are different.
        • Look up the definitions for each of the terms at http://geneontology.org. For your final lab report, you will discuss the biological interpretation of these GO terms. In other words, why does the cell react to cold shock by changing the expression of genes associated with these GO terms? Also, what does this have to do with HAP4 being deleted?
        • To easily look up the definitions, go to http://geneontology.org.
        • Copy and paste the GO ID (e.g. GO:0044848) into the search field at the upper left of the page called "Search GO Data".
        • In the results page, click on the button that says "Link to detailed information about <term>, in this case "biological phase"".
        • The definition will be on the next results page, e.g. here.


Step 9: GenMAPP & MAPPFinder

Preparing the Input File for GenMAPP
  • Insert a new worksheet and name it STRAIN_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, just retaining the individual log fold change data, the average log fold change data, and the p values. For the Bonferroni and B&H p values, just keep the one column where we replaced all values > 1 with 1.
  • 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.
  • It will be useful if we arrange the columns in a slightly different order: all individual log fold change data, then the ANOVA p values, then the AvgLogFC and p values for the individual timepoints clustered together (e.g., all t15 data together).
  • 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.