Troque Week 8
Source
- The methods described in Part 1 of this page are taken from this openwetware page.
- The methods for Part 2 have been adapted from this page.
Files created
- The Excel file created on Thursday (October 15, 2015) can be downloaded here.
- A more updated Excel file with the B-H p-value correction can be downloaded here.
- The tab delimited txt file can be seen here
Things to remember
- Always save your work when you have a chance.
Part 1
Normalize the log ratios for the set of slides in the experiment
To scale and center the data (between chip normalization) I performed the following operations:
- Insert a new Worksheet into my Excel file, and named it "scaled_centered".
- Go back to the "compiled_raw_data" worksheet, Select All and Copy. I went to my new "scaled_centered" worksheet, click on the upper, left-hand cell (cell A1) and Paste.
- Insert two rows in between the top row of headers and the first data row.
- In cell A2, type "Average" and in cell A3, type "StDev".
- I then computed the Average log ratio for each chip (each column of data). In cell B2, type the following equation:
=AVERAGE(B4:B5224)
(Note: We tried to do a keyboard shortcut using CTRL + Shift + Down buttons, but row 363 has a missing data so we had to manually type in "B5224" for the end of the data.)
- and press "Enter". Excel is computing the average value of the cells specified in the range given inside the parentheses. Instead of typing the cell designations, you can click on the beginning cell, scroll down to the bottom of the worksheet, and shift-click on the ending cell.
- You will now compute the Standard Deviation of the log ratios on each chip (each column of data). In cell B3, type the following equation:
=STDEV(B4:B5224)
- and press "Enter".
- Excel will now do some work for you. Copy these two equations (cells B2 and B3) and paste them into the empty cells in the rest of the columns. Excel will automatically change the equation to match the cell designations for those columns.
- You have now computed the average and standard deviation of the log ratios for each chip. Now we will actually do the scaling and centering based on these values.
- Copy the column headings for all of your data columns and then paste them to the right of the last data column so that you have a second set of headers above blank colums of cells. Edit the names of the columns so that they now read: A1_scaled_centered, A2_scaled_centered, etc.
- In cell N4, type the following equation:
=(B4-B$2)/B$3
- In this case, we want the data in cell B4 to have the average subtracted from it (cell B2) and be divided by the standard deviation (cell B3). We use the dollar sign symbols in front of the "2" and "3" to tell Excel to always reference that row in the equation, even though we will paste it for the entire column of 5221 genes. Why is this important?
- Copy and paste this equation into the entire column. One easy way to do this is to click on the original cell with your equation 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 genes.
- Copy and paste the scaling and centering equation for each of the columns of data with the "_scaled_centered" column header. Be sure that your equation is correct for the column you are calculating.
Perform statistical analysis on the ratios
We are going to perform this step on the scaled and centered data you produced in the previous step.
- Insert a new worksheet and name it "statistics".
- Go back to the "scaling_centering" worksheet and copy the first column ("ID").
- Paste the data into the first column of your new "statistics" worksheet.
- Go back to the "scaling_centering" worksheet and copy the columns that are designated "_scaled_centered".
- Go to your new worksheet and click on the B1 cell. 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.
- Delete Rows 2 and 3 where it says "Average" and "StDev" so that your data rows with gene IDs are immediately below the header row 1.
- Go to a new column on the right of your worksheet. Type the header "Avg_LogFC_A", "Avg_LogFC_B", and "Avg_LogFC_C" into the top cell of the next three columns.
- Compute the average log fold change for the replicates for each patient by typing the equation:
=AVERAGE(B2:E2)
- into cell N2. Copy this equation and paste it into the rest of the column.
- Create the equation for patients B and C and paste it into their respective columns.
- Now you will compute the average of the averages. Type the header "Avg_LogFC_all" into the first cell in the next empty column. Create the equation that will compute the average of the three previous averages you calculated and paste it into this entire column.
- Insert a new column next to the "Avg_LogFC_all" column that you computed in the previous step. Label the column "Tstat". This will compute a T statistic that tells us whether the scaled and centered average log ratio is significantly different than 0 (no change). Enter the equation:
=AVERAGE(N2:P2)/(STDEV(N2:P2)/SQRT(number of replicates))
- (NOTE: in this case the number of replicates is 3. Be careful that you are using the correct number of parentheses.) Copy the equation and paste it into all rows in that column.
- Label the top cell in the next column "Pvalue". In the cell below the label, enter the equation:
=TDIST(ABS(R2),degrees of freedom,2)
The number of degrees of freedom is the number of replicates minus one, so in our case there are 2 degrees of freedom. Copy the equation and paste it into all rows in that column.
Calculate the Bonferroni p value Correction
- Before doing the following, I selected all of the first row and clicked on "Sort & Filter" -> "Filter". On the dropdown button for the Pvalue header, go to "Number Filters". Then select "Less Than" and enter "0.05" for the text box next to "is less than". You should get 948 results in the bottom left corner
- 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, Bonferroni_Pvalue.
- Type the equation
=(Pvalue)*5221
, (in this case, the Pvalue = in cell S2) Upon completion of this single computation, use the trick to copy the formula throughout the column. - 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 Bonferroni_Pvalue header:
=IF(T2>1,1,T2)
. Use the trick to copy the formula throughout the column.
Checkpoint: The Excel file can be located here.
Calculate the Benjamini & Hochberg p value Correction
- Insert a new worksheet named "B-H_Pvalue".
- Copy and paste the "ID" column from your previous worksheet into the first column of the new worksheet.
- 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 5221 (the number of genes on the microarray).
- For the following, use Paste special > Paste values. Copy your unadjusted p values from your previous worksheet and paste it into Column C.
- 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.
- Type the header "Rank" in cell D1. We will create a series of numbers in ascending order from 1 to 5221 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 D2 and D3. 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 5221.
- Now you can calculate the Benjamini and Hochberg p value correction. Type B-H_Pvalue in cell E1. Type the following formula in cell E2:
=(C2*5221)/D2
and press enter. Copy that equation to the entire column. - Type "B-H_Pvalue" into cell F1.
- Type the following formula into cell F2:
=IF(E2>1,1,E2)
and press enter. Copy that equation to the entire column. - Select columns A through F. Now sort them by your MasterIndex in Column A in ascending order.
- Copy column F and use Paste special > Paste values to paste it into the next column on the right of your "statistics" sheet.
Prepare file for GenMAPP
- Insert a new worksheet and name it "forGenMAPP".
- Go back to the "statistics" worksheet 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. We will now format this worksheet for import into GenMAPP.
- Select Columns B through Q (all the fold changes). Select the menu item Format > Cells. Under the number tab, select 2 decimal places. Click OK.
- Select all the columns containing p values. Select the menu item Format > Cells. Under the number tab, select 4 decimal places. Click OK.
- Delete the left-most Bonferroni p value column, preserving the one that shows the result of your "if" statement.
- Insert a column to the right of the "ID" column. Type the header "SystemCode" into the top cell of this column. Fill the entire column (each cell) with the letter "N".
- Select the menu item File > Save As, and choose "Text (Tab-delimited) (*.txt)" from the file type drop-down menu. Excel will make you click through a couple of warnings because it doesn't like you going all independent and choosing a different file type than the native .xls. This is OK. Your new *.txt file is now ready for import into GenMAPP. But before we do that, we want to know a few things about our data as shown in the next section.
- Upload both the .xls and .txt files that you have just created to your journal page in the class wiki. Make sure that your file name is distinct from your other classmates so that nobody overwrites anyone else's file.
Checkpoint: The files created can be found here (Excel) and here (txt).
Part 2
- I will be working on the 2009 data.
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, you will need to download the appropriate Vibrio cholerae Gene Database.
- Half of the class will use the Vc-Std_External_20090622.gdb Gene Database that was initially created by the Fall 2008 Biological Databases class.
- To download this Gene Database, follow this link to the XMLPipeDB SourceForge Download page.
- Half of the class will use a new Vc-Std_External_20101022.gdb Gene Database that was created by Drs. Dahlquist and Dionisio a year later.
- To download this Gene Database, follow this link to the XMLPipeDB SourceForge Download page.
- The members of a pair should each choose a different gene database.
- Half of the class will use the Vc-Std_External_20090622.gdb Gene Database that was initially created by the Fall 2008 Biological Databases class.
- Click on the link for the Gene Database to which you have been assigned, download the file, and save it into the folder C:\GenMAPP 2 Data\Gene Databases, and extract it.
Checkpoint: There were 772 errors in the 2009 data file. The gex file is located here. The EX.txt file can be found here.
Assignment Links
Weekly Assignments
- Week 1
- Week 2
- Week 3
- Week 4
- Week 5
- Week 6
- Week 7
- Week 8
- Week 9
- Week 10
- Week 11
- Week 12
- No Week 13 Assignment
- Week 14
- Week 15
Individual Journal Entries
- Week 1 - This is technically the user page.
- Week 2
- Week 3
- Week 4
- Week 5
- Week 6
- Week 7
- Week 8
- Week 9
- Week 10
- Week 11
- Week 12
- No Week 13 Assignment
- Week 14
- Week 15