Tessa A. Morris Electronic Lab Notebook 2015-2016: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
(→‎9 October 2015: add anova swi4)
(→‎Within-Strain ANOVA: add p-value less than 0.05 for swi4)
Line 256: Line 256:
#*  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 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 (STRAIN)_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.
#* Click on the drop-down arrow on your (STRAIN)_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.
#** CIN5: 2438
#** ΔSWI4: 2167
#** GLN3: 2255
#** HAP4: 2491
#* 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.
#* 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.


{{Template:Tessa A. Morris ELN}}
{{Template:Tessa A. Morris ELN}}

Revision as of 10:35, 9 October 2015

22 September 2015

Normalization

Github issue 127

Installing R 3.1.0 and the limma package

  • Download 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.
  • 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.
  • There was an error when trying to find limma. A solution was to install limma on R, open R and type the following, which was taken from Section 2.2

Running the Normalization Script

  • Create a folder on your Desktop to store your files for the microarray analysis procedure (Microarray_Analysis_TM-2015-09-22).
  • Download the zipped file that contains the .gpr files and save it to this folder (or move it if it saved in a different folder).
    • Unzip this file using 7-zip. Right-click on the file and select the menu item, "7-zip > Extract Here".
  • Download the GCAT_Targets.csv file and Ontario_Targets_wt-dCIN5-dGLN3-dHAP4-dHMO1-dSWI4-dZAP1-Spar_20150514.csv files and save them to this folder (or move them if they saved to a different folder).
  • Download the bigFatNormalization2.R script and save (or move) it to this folder.
  • Download the generatePlots1.R script and save (or move) it to this folder.
  • 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 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 bigFatNormalization2.R script.
    • Wait while R processes your files.
  • When the processing has finished, you will find three files called GCAT_and_Ontario_Unnormalized.csv, GCAT_and_Ontario_Within_Array_Normalization.csv, GCAT_and_Ontario_Between_Array_Normalization.csv. The latter file is the one that you will need going forward.
    • Save these files to LionShare.

Visualizing the Normalized Data

  • Immediately after running the normalization script, select the menu item File > Source R code..., and select the generatePlots1.R script.
    • Wait while R processes your files. You will see the individual plots being created in a new window. R will save them automatically to the same folder that contains the data and scripts.
      • The box plots for each strain (comparison of the before, after within- and after between-chip normalization in the same file) are saved under the name of the strain, e.g., dCIN5.jpg.
      • The MA plots are saved under a name for the individual chip, e.g., dCIN5_LogFC_t15-1.jpg, and show the plots both before and after normalization.
  • Zip the files of the plots together and upload to LionShare and/or save to a flash drive.

Statistical Analysis

  • For the statistical analysis, we will begin with the file "GCAT_and_Ontario_Between_Array_Normalization.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 D2, type the equation =ROUND(Compiled_Normalized_Data!D2,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 41998 replacements
  • This will be the starting point for our statistical analysis below.

Assignments for Normalization

Github issue 137

  • Kevin & Monica: Δswi4, Δhap4
  • Tessa: Δgln3, Δcin5, Δhap4
  • Kristen: Δzap1, Δgln3, Δswi4
  • Kayla: Δzap1, Δcin5, wt
  • Natalie: spar, wt, Δhmo1
  • Grace: Δhmo1, wt, spar

Converting Test_files into .xlsx

Github issue 126

  1. Download "Git" from this link
  2. Go through the instillation process (no changes needed)
  3. Once installed open "Git Bash" from the programs menu on the computer
  4. To have the GRNmap folder to edit on the desktop type cd Desktop then press enter
  5. To clone into GRNmap type git clone https://github.com/kdahlquist/GRNmap.git then press enter
  6. To edit GRNmap, type cd GRNmap then press enter
  7. To edit the Beta version, type git checkout beta
  8. There will now be a file on the desktop titled "GRNmap"
  9. Open this folder and navigate to the "test_files" folder.
    • Type git checkout beta then press enter
    • Type git status then press enter will show the changes that you made in red
    • Type git add ., which will add all folders.
    • Type git status then press enter
    • Type git commit -m "convert all test files from xls format to xlsx" (description of the change that was made) then press enter
    • In order to configure the computer to your user name Type git config --global user.name "github username" then press enter and then type git config --global user.email "email used for github" then press enter
    • To update anything that was changed while you were working type git pull then press enter
    • To update the website with your changes type git push then press enter and enter your username and password when prompted.
  10. Comment on 126 on Github explaining what was done and change the label to "review requested" and select Dr. Dahlquist.

28 September 2015

Within-Strain ANOVA

Github Issue 137

  1. Create a new worksheet, naming it either "(STRAIN)_ANOVA" as appropriate. For example, you might call yours "wt_ANOVA" or "dHAP4_ANOVA"
  2. 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 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 (STRAIN)_AvgLogFC_(TIME) where (STRAIN) is your strain designation and (TIME) is 15, 30, etc.
  4. In the cell below the (STRAIN)_AvgLogFC_t15 header, type =AVERAGE(
  5. Then highlight all the data in row 2 associated with (STRAIN) 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 (STRAIN)_AvgLogFC_t120 calculation, create the column header (STRAIN)_ss_HO.
  10. In the first cell below this header, type =SUMSQ(
  11. Highlight all the LogFC data in row 2 for your (STRAIN) (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 (STRAIN)_ss_HO, create the column headers (STRAIN)_ss_(TIME) as in (3).
  13. Make a note of how many data points you have at each time point for your strain. For most of the strains, it will be 4, but for dHAP4 t90 or t120, it will be "3", and for the wild type it will be "4" or "5". Count carefully. Also, make a note of the total number of data points. Again, for most strains, this will be 20, but for example, dHAP4, this number will be 18, and for wt it should be 23 (double-check).
    • CIN5 - 20 replicates
      • 15: 4; 30: 4; 60: 4; 90: 4; 120: 4
    • GLN3 - 20 replicates
      • 15: 4; 30: 4; 60: 4; 90: 4; 120: 4
    • HAP4 - 18 replicates
      • 15: 4; 30: 4; 60: 4; 90: 3; 120: 3
  14. In the first cell below the header (STRAIN)_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 (STRAIN)_ss_t120, create the column header (STRAIN)_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 (STRAIN)_Fstat and (STRAIN)_p-value.
  19. Recall the number of data points from (13): call that total n.
  20. In the first cell of the (STRAIN)_Fstat column, type =((n-5)/5)*(<(STRAIN)_ss_HO>-<(STRAIN)_SS_full>)/<(STRAIN)_SS_full> and hit enter.
    • Don't actually type the n but instead use the number from (13). Also note that "5" is the number of timepoints and the dSWI4 strain has 4 timepoints (it is missing t15).
    • Replace the phrase (STRAIN)_ss_HO with the cell designation.
    • Replace the phrase <(STRAIN)_SS_full> with the cell designation.
    • Copy to the whole column.
  21. In the first cell below the (STRAIN)_p-value header, type =FDIST(<(STRAIN)_Fstat>,5,n-5) replacing the phrase <(STRAIN)_Fstat> with the cell designation and the "n" as in (13) with the number of data points total. (Again, note that the number of timepoints is actually "4" for the dSWI4 strain). 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 (STRAIN)_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.
      • CIN5: 2438
      • GLN3: 2255
      • HAP4: 2491
    • 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, (STRAIN)_Bonferroni_p-value.
  2. Type the equation =<(STRAIN)_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 (STRAIN)_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 "(STRAIN)_ANOVA_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 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 (STRAIN)_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 "STRAIN_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.
  • 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 (STRAIN)_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)?
    • How many genes have p < 0.01? and what is the percentage (out of 6189)?
    • How many genes have p < 0.001? and what is the percentage (out of 6189)?
    • How many genes have p < 0.0001? and what is the percentage (out of 6189)?
  • 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)?
    • How many genes are p < 0.05 for the Benjamini and Hochberg-corrected p value? and what is the percentage (out of 6189)?
  • 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 "STRAIN)_AvgLogFC_(TIME)" in step 3 of the ANOVA analysis.
  • 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.

Results of Sanity Check

Sanity Check
ΔCIN5 ΔGLN3 ΔHAP4
p < 0.05 2438 (39.39%) 2255 (36.44%) 2491(40.25%)
p < 0.01 1529 (24.71%) 1325 (21.41%) 1591(25.71%)
p < 0.001 838 (13.54%) 616 (9.95%) 769 (12.43%)
p < 0.0001 458 (7.40%) 259 (4.18%) 308 (4.98%)
Bonferroni p < 0.05 232 (3.75%) 106 (1.71%) 103 (1.66%)
B-H p < 0.05 1683 (27.29%) 1356 (21.91%) 1749 (28.26%)


For NSR1
ΔCIN5 ΔGLN3 ΔHAP4
unadjusted p-value 6.37625E-08 0.00050676 0.016364209
Bonferroni p-value 0.000394626 1 1
B-H p-value 5.5581E-06 0.00660287 0.055192421
AvgLogFC_t15 4.070025 3.506225 2.69945
AvgLogFC_t30 3.611475 4.5319 3.2508
AvgLogFC_t60 4.2985 2.7592 3.519975
AvgLogFC_t90 -2.900925 -1.85025 -1.1005667
AvgLogFC_t120 -0.9315 -1.867425 -1.797667

9 October 2015

Repeat Within Strain ANOVA, Bonferroni, B-H, and sanity check for ΔSWI4

Within-Strain ANOVA

  1. Create a new worksheet, naming it either "(STRAIN)_ANOVA" as appropriate. For example, you might call yours "wt_ANOVA" or "dHAP4_ANOVA"
  2. 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 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 (STRAIN)_AvgLogFC_(TIME) where (STRAIN) is your strain designation and (TIME) is 15, 30, etc.
  4. In the cell below the (STRAIN)_AvgLogFC_t15 header, type =AVERAGE(
  5. Then highlight all the data in row 2 associated with (STRAIN) 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 (STRAIN)_AvgLogFC_t120 calculation, create the column header (STRAIN)_ss_HO.
  10. In the first cell below this header, type =SUMSQ(
  11. Highlight all the LogFC data in row 2 for your (STRAIN) (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 (STRAIN)_ss_HO, create the column headers (STRAIN)_ss_(TIME) as in (3).
  13. Make a note of how many data points you have at each time point for your strain. For most of the strains, it will be 4, but for dHAP4 t90 or t120, it will be "3", and for the wild type it will be "4" or "5". Count carefully. Also, make a note of the total number of data points. Again, for most strains, this will be 20, but for example, dHAP4, this number will be 18, and for wt it should be 23 (double-check).
    • SWI4 -16 replicates
      • 15: 0; 30: 4; 60: 4; 90: 4; 120: 4
  14. In the first cell below the header (STRAIN)_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 (STRAIN)_ss_t120, create the column header (STRAIN)_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 (STRAIN)_Fstat and (STRAIN)_p-value.
  19. Recall the number of data points from (13): call that total n.
  20. In the first cell of the (STRAIN)_Fstat column, type =((n-5)/5)*(<(STRAIN)_ss_HO>-<(STRAIN)_SS_full>)/<(STRAIN)_SS_full> and hit enter.
    • Don't actually type the n but instead use the number from (13). Also note that "5" is the number of timepoints and the dSWI4 strain has 4 timepoints (it is missing t15).
    • Replace the phrase (STRAIN)_ss_HO with the cell designation.
    • Replace the phrase <(STRAIN)_SS_full> with the cell designation.
    • Copy to the whole column.
  21. In the first cell below the (STRAIN)_p-value header, type =FDIST(<(STRAIN)_Fstat>,5,n-5) replacing the phrase <(STRAIN)_Fstat> with the cell designation and the "n" as in (13) with the number of data points total. (Again, note that the number of timepoints is actually "4" for the dSWI4 strain). 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 (STRAIN)_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.
      • ΔSWI4: 2167
    • 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.

Dahlquist Lab Navigation