Changeset 626


Ignore:
Timestamp:
Mar 12, 2008, 9:24:06 AM (13 years ago)
Author:
Nicklas Nordborg
Message:

References #89, #100: Added formulas for better SNP gui. Gtype = ch(1), Log R Ratio = ch(2), B Allele Freq = ch(3)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/base2/net.sf.basedb.illumina/trunk/src/net/sf/basedb/illumina/install/Install.java

    r623 r626  
    2626
    2727import net.sf.basedb.core.BaseException;
     28import net.sf.basedb.core.Coloring;
    2829import net.sf.basedb.core.DataFileType;
    2930import net.sf.basedb.core.DbControl;
    3031import net.sf.basedb.core.FileType;
     32import net.sf.basedb.core.Formula;
    3133import net.sf.basedb.core.Hardware;
    3234import net.sf.basedb.core.HardwareType;
     
    9395    Original SNP data file is set to be optional.
    9496 
    95   <li>Hardwares, softwares and other items, that in some way are associated with
     97  <li>Optionally, hardwares, softwares and other items, that in some way are associated with
    9698    one or more of the variants, will be created next.
     99
     100  <li>Create formulas for the 3 SNP channels:
     101    <ul>
     102    <li>GType = ch(1)
     103    <li>Log R Ratio = ch(2)
     104    <li>B Allele Freq = ch(2)
     105    </ul>
     106   
    97107  </ul>
    98108*/
     
    236246        if (installExp1) expressionTypes.add(1);
    237247        if (installExp2) expressionTypes.add(2);
    238                
     248
    239249        installIlluminaItems(dc, installSnp, expressionTypes, ignoreExisingItems, progress);
    240250        if (installScanner)
     
    253263        }
    254264        dc.commit();
     265        if (installSnp)
     266        {
     267          dc = sc.newDbControl();
     268         
     269          Coloring gTypeColor = createColoring(false, -1f, 0f, 1f);
     270          Coloring ratioColor = createColoring(false, -1f, 0f, 1f);
     271          RawDataType snpRawData = Illumina.getSnpType();
     272          createFormula(dc, "GType", Formula.Type.COLUMN_EXPRESSION,
     273            snpRawData, Formula.AverageMethod.NONE, gTypeColor, "ch(1)");
     274          createFormula(dc, "Log R Ratio", Formula.Type.COLUMN_EXPRESSION,
     275            snpRawData, Formula.AverageMethod.GEOMETRIC_MEAN, ratioColor, "ch(2)");
     276          createFormula(dc, "B Allele Freq", Formula.Type.COLUMN_EXPRESSION,
     277              snpRawData, Formula.AverageMethod.NONE, null, "ch(3)");
     278          dc.commit();
     279        }
    255280      }
    256281      catch(Throwable ex)
     
    385410    @throws ItemAlreadyExistsException If ignoreInstalledItems = FALSE and one of the
    386411   */
    387   public void installIlluminaItems(DbControl dc, Boolean installSNP, Set<Integer> expressionTypes, boolean ignoreExistingItems, ProgressReporter progress)
     412  public void installIlluminaItems(DbControl dc, boolean installSNP, Set<Integer> expressionTypes, boolean ignoreExistingItems, ProgressReporter progress)
    388413    throws ItemAlreadyExistsException
    389414  {   
     
    473498   
    474499   
    475     if (installSNP != null && installSNP)
     500    if (installSNP)
    476501    {
    477502      PlatformVariant pfv = createPlatformVariant(dc, Illumina.SNP_VARIANT_ID,
     
    822847  }
    823848 
     849  public Formula createFormula(DbControl dc, String name, Formula.Type type, RawDataType rawDataType,
     850      Formula.AverageMethod averageMethod, Coloring coloring, String... formulas)
     851  {
     852    Formula formula = Formula.getNew(dc);
     853    formula.setName(name);
     854    formula.setRawDataType(rawDataType);
     855    formula.setFormulaType(type);
     856    formula.setAverageMethod(averageMethod);
     857    formula.setFormulas(Arrays.asList(formulas));
     858    if (coloring != null)
     859    {
     860      Coloring c = formula.getColoring();
     861      c.setUsingColors(coloring.isUsingColors());
     862      c.setLogarithmic(coloring.isLogarithmic());
     863      c.setMinValue(coloring.getMinValue());
     864      c.setMidValue(coloring.getMidValue());
     865      c.setMaxValue(coloring.getMaxValue());
     866    }
     867    dc.saveItem(formula);
     868    return formula;
     869  }
     870 
     871  public Coloring createColoring(boolean logarithmic, Float minValue, Float midValue, Float maxValue)
     872  {
     873    Coloring c = new Coloring();
     874    c.setUsingColors(true);
     875    c.setLogarithmic(logarithmic);
     876    c.setMinValue(minValue);
     877    c.setMidValue(midValue);
     878    c.setMaxValue(maxValue);
     879    return c;
     880  }
     881 
    824882  /*
    825883    Creates file-only platform variants, eg. SNP
Note: See TracChangeset for help on using the changeset viewer.