Difference between revisions of "Kevin Wyllie Week 8"
(Added my GEX file.) |
(Began editing my protocol to be in past tense and to contain the correct cell designations.) |
||
Line 4: | Line 4: | ||
==Protocol - 10/15/15 >>NEEDS EDITING<<== | ==Protocol - 10/15/15 >>NEEDS EDITING<<== | ||
− | === | + | === Normalized the log ratios for the set of slides in the experiment === |
− | To scale and center the data (between chip normalization) | + | To scale and center the data (between chip normalization) the following operations were performed: |
− | * | + | * New worksheet was created, entitled "scaled_centered". |
− | * | + | * The contents of "compiled_raw_data" were copy/pasted into "scaled_centered." |
− | * | + | * Two rows were inserted after the top header row, titled "Average" (cell A2) and "StdDev" (cell A3). |
− | + | * To compute the Average log ratio for each chip (each column of data), the following equation was entered into A2: | |
− | * | + | =AVERAGE(B4:B5224) |
− | =AVERAGE(B4:B5224) | + | * To compute the standard deviation for each chip (each column of data), The following equation was typed into B3: |
− | + | ||
− | * | + | |
=STDEV(B4:B5224) | =STDEV(B4:B5224) | ||
− | + | * This equation was "dragged" through cell M2 and N2 (average and std dev respectively) to automatically calculate these values for the remaining columns. | |
− | + | * All column headings were copied and pasted again to the right of the last data column. The names of the new columns were then edited to read: A1_scaled_centered, A2_scaled_centered, etc. | |
− | * | + | |
− | + | ||
* In cell N4, type the following equation: | * In cell N4, type the following equation: | ||
=(B4-B$2)/B$3 | =(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?''''' | : 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?''''' | ||
+ | : To subtract the average (B2) subtracted from the data in B4...>>EDITING STOPPED HERE<< | ||
* 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 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. | * 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. |
Revision as of 21:42, 22 October 2015
File:Wyllie Merrell Compiled Raw Data Vibrio.xls File:Wyllie Merrell Compiled Raw Data Vibrio.gex
Contents
- 1 Protocol - 10/15/15 >>NEEDS EDITING<<
- 2 Protocol - 10/20/15 >>NEEDS EDITING<<
- 3 Links
Protocol - 10/15/15 >>NEEDS EDITING<<
Normalized the log ratios for the set of slides in the experiment
To scale and center the data (between chip normalization) the following operations were performed:
- New worksheet was created, entitled "scaled_centered".
- The contents of "compiled_raw_data" were copy/pasted into "scaled_centered."
- Two rows were inserted after the top header row, titled "Average" (cell A2) and "StdDev" (cell A3).
- To compute the Average log ratio for each chip (each column of data), the following equation was entered into A2:
=AVERAGE(B4:B5224)
- To compute the standard deviation for each chip (each column of data), The following equation was typed into B3:
=STDEV(B4:B5224)
- This equation was "dragged" through cell M2 and N2 (average and std dev respectively) to automatically calculate these values for the remaining columns.
- All column headings were copied and pasted again to the right of the last data column. The names of the new columns were then edited to 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?
- To subtract the average (B2) subtracted from the data in B4...>>EDITING STOPPED HERE<<
- 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
- 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
=S2*5221
, 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.
Protocol - 10/20/15 >>NEEDS EDITING<<
Perform statistical analysis on the ratios (continued)
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.
Sanity Check: Number of genes significantly changed
Before we move on to the GenMAPP/MAPPFinder analysis, we want to perform a 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 and also compare our data analysis with the published results of Merrell et al. (2002).
- Open your spreadsheet and go to the "forGenMAPP" tab.
- Click on cell A1 and select the menu item Data > Filter > Autofilter. 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 "Pvalue" column. Select "Custom". In the window that appears, set a criterion that will filter your data so that the Pvalue has to be less than 0.05.
- How many genes have p value < 0.05? and what is the percentage (out of 5221)?
- What about p < 0.01? and what is the percentage (out of 5221)?
- What about p < 0.001? and what is the percentage (out of 5221)?
- What about p < 0.0001? and what is the percentage (out of 5221)?
- 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 less than 5% of the time.
- We have just performed 5221 T tests for significance. Another way to state what we are seeing with p < 0.05 is that we would expect to see this magnitude of a gene expression change in about 5% of our T tests, or 261 times. (Test your understanding: http://xkcd.com/882/.) Since we have more than 261 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 5221)?
- How many genes are p < 0.05 for the Benjamini and Hochberg-corrected p value? and what is the percentage (out of 5221)?
- 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.
- The "Avg_LogFC_all" tells us the size of the gene expression change and in which direction. Positive values are increases relative to the control; negative values are decreases relative to the control.
- Keeping the (unadjusted) "Pvalue" filter at p < 0.05, filter the "Avg_LogFC_all" column to show all genes with an average log fold change greater than zero. How many are there? (and %)
- Keeping the (unadjusted) "Pvalue" filter at p < 0.05, filter the "Avg_LogFC_all" column to show all genes with an average log fold change less than zero. How many are there? (and %)
- What about an average log fold change of > 0.25 and p < 0.05? (and %)
- Or an average log fold change of < -0.25 and p < 0.05? (and %) (These are more realistic values for the fold change cut-offs because it represents about a 20% fold change which is about the level of detection of this technology.)
- 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. For the GenMAPP analysis below, we will use the fold change cut-off of greater than 0.25 or less than -0.25 and the unadjusted p value cut off of p < 0.05 for our analysis because we want to include several hundred genes in our analysis.
- What criteria did Merrell et al. (2002) use to determine a significant gene expression change? How does it compare to our method?
Sanity Check: Compare individual genes with known data
- Merrell et al. (2002) report that genes with IDs: VC0028, VC0941, VC0869, VC0051, VC0647, VC0468, VC2350, and VCA0583 were all significantly changed in their data. Look these genes up in your spreadsheet. What are their fold changes and p values? Are they significantly changed in our analysis?
</div>
Map Onto Biological Pathways (GenMAPP & MAPPFinder)
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.
GenMAPP Expression Dataset Manager Procedure
- Launch the GenMAPP Program. Check to make sure the correct Gene Database is loaded.
- Look in the lower, left-hand corner of the main GenMAPP Drafting Board window to see the name of the Gene Database that is loaded. If this is not the correct Gene Database or it says "No Gene Database", then go to the Data > Choose Gene Database menu item to select the Gene Database you need to perform the analysis.
- Remember, you and your partner are going to use different versions of the Vibrio cholerae Gene Database for this exercise.
- I chose to use the 2010 file.
- 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.
- You may need to download your .txt file from the wiki onto your Desktop if you have not already done so.
- 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, you would check the box next to the field (column) name.
- The Vibrio data we have been working with does not have any text (character) data in it.
- 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.
- 121 errors.
- Record the number of errors. For your journal assignment, open the .EX.txt file and use the Data > Filter > Autofilter function to determine what the errors were for the rows that were not converted. Record this information in your individual journal page.
- It is likely that you will have a different number of errors than your partner who is using a different version of the Vibrio cholerae Gene Database. Which of you has more errors? Why do you think that is? Record your answers in your journal page.
- Upload your exceptions file:
EX.txt
to your wiki page.
- 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.
- 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_all" for the Vibrio dataset you just created.
- 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 Vibrio dataset, you will create two criterion. "Increased" will be [Avg_LogFC_all] > 0.25 AND [Pvalue] < 0.05 and "Decreased will be [Avg_LogFC_all] < -0.25 AND [Pvalue] < 0.05.
- 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.
- 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 your journal entry page for later retrieval.
Links
- Kevin Wyllie Week 2 (See the original assignment and class journal.)
- Kevin Wyllie Week 3 (See the original assignment and class journal.)
- Kevin Wyllie Week 4 (See the original assignment and class journal.)
- Kevin Wyllie Week 5 (See the original assignment and class journal.)
- Kevin Wyllie Week 6 (See the original assignment and class journal.)
- Kevin Wyllie Week 7 (See the original assignment and class journal.)
- Kevin Wyllie Week 8 (See the original assignment and class journal.)
- Kevin Wyllie Week 9 (See the original assignment and class journal.)
- Kevin Wyllie Week 10 (See the original assignment.)
- Kevin Wyllie Week 11 (See the original assignment.)
- Kevin Wyllie Week 12 (See the original assignment.)
- Kevin Wyllie Week 14 (See the original assignment.)
- Kevin Wyllie Week 15 (See the original assignment.)