SAM fold change calculation doubt

Help
2009-08-19
2013-05-20
  • SAM significant genes calculates the fold-change value just like the way below.

    why it calculated over the unlogged value? Mev Internally converts the values into log2?

        private double getFoldChange(int gene) {
            float[] currentGene = new float[numExps];
            for (int i = 0; i < numExps; i++) {
                currentGene[i] = imputedMatrix.A[gene][i];
            }
            double unloggedCurrentGene[] = new double[currentGene.length];
           
            for (int i = 0; i < unloggedCurrentGene.length; i++) {
                unloggedCurrentGene[i] = Math.pow(2, (double)currentGene[i]);
            }
           
            double[] groupAValues = new double[1];
            double[] groupBValues = new double[1];

            if (studyDesign == SAMInitDialog.TWO_CLASS_UNPAIRED) {
                int groupACounter = 0;
                int groupBCounter = 0;
               
                for (int i = 0; i < groupAssignments.length; i++) {
                    if (groupAssignments[i] == SAMInitDialog.GROUP_A) {
                        groupACounter++;
                    } else if (groupAssignments[i] == SAMInitDialog.GROUP_B) {
                        groupBCounter++;
                    }
                }
               
                groupAValues = new double[groupACounter];
                groupBValues = new double[groupBCounter];
                int groupAIndex = 0;
                int groupBIndex = 0;
               
                for (int i = 0; i < groupAssignments.length; i++) {
                    if (groupAssignments[i] == SAMInitDialog.GROUP_A) {
                        groupAValues[groupAIndex] = unloggedCurrentGene[i];
                        groupAIndex++;
                    } else if (groupAssignments[i] == SAMInitDialog.GROUP_B) {
                        groupBValues[groupBIndex] = unloggedCurrentGene[i];
                        groupBIndex++;
                    }
                }
               
            } else if (studyDesign == SAMInitDialog.TWO_CLASS_PAIRED) {
                groupAValues = new double[pairedGroupAExpts.length];
                groupBValues = new double[pairedGroupBExpts.length];
               
                for (int i = 0; i < groupAValues.length; i++) {
                    groupAValues[i] = unloggedCurrentGene[pairedGroupAExpts[i]];
                    groupBValues[i] = unloggedCurrentGene[pairedGroupBExpts[i]];
                }
            }
           
            double meanA = getMean(groupAValues);
            double meanB = getMean(groupBValues);  
           
            return (double)(meanB/meanA);
    }

    best regards

    Kenji

     
    • Sarita Nair
      Sarita Nair
      2009-08-20

      Hi Kenji,

      SAM assumes that your data is log2 transformed and so it proceeds to un log it, which is what the function does.  We do plan on addressing this in our next release.

      Hope that helps,
      Thanks,
      Sarita

       
  • Hello,

    I have been using SAM analysis in TMEV using single channel Illumina Human 6 Sentrix Arrays.

    My input file has been non-log2 transformed data as a text file. I first use TMEV to log2 transform the data as I wish to use log2 transformed data on my analysis. I then use this data as my input for SAM analysis. My understanding is that SAM in TMEV first creates a list of differentially expressed genes assuming that the data is log2 transformed (see above), and the program then produces a fold change that is based on the un-log2 data after the test has been performed. Is this correct?

    I am little uncertain as I have had some recent information that suggests that when I upload my data either TMEV and / or the SAM function, TMEV automatically converts the data into a log2 transformation which would mean that if I log2 transform the data, it would be log2 transformed twice. You input would be appreciated. In this particular case, the person used two-colour arrays. Would this make any difference and is the data automatically log2 transformed here as it is making a pairwise comparison?

    Regards,

    William d'Avigdor

     
  • Hello William,

    You are correct that MeV assumes that data has been log2 transformed when running SAM analysis.  If your data is unlogged you need to perform the transformation as you have done.  MeV does not automatically log2 your data when you load it.
    Pairwise comparisons are often already logged, but are not necessarily.  If you are not sure if it has already been logged, a quick way to tell is to quickly glance over your data.  Is the average 0, with about half of the values negative?  It has probably already been logged.
    If all your values are positive with a median of about 1, it's probably not logged.

    Dan