Changeset 1590


Ignore:
Timestamp:
Mar 20, 2012, 7:07:31 PM (12 years ago)
Author:
pawels
Message:

added support for 2 channel

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/no.uib.cbu.base.magetabexport/trunk/src/main/java/no/uib/cbu/base/magetabexport/SDRFCreator.java

    r1474 r1590  
    175175        }
    176176       
     177       
    177178        // add experimental factors
    178179        if (!rba.isAnnotated()) {
     
    180181                        "Can't retrieve experimental factor(s).");
    181182        }
     183       
    182184        for (AnnotationType at : factors) {
     185         
    183186          List<AnnotationSnapshot> as = snapMan.findAnnotations(dc, rba, new AnnotationTypeFilter(at), true);
     187         
    184188          if (as == null || as.isEmpty()) {
    185189            throw new MageTabException("raw bioassay ["+rba.getName()+"] is not annotated with "+
    186190                "an experimental factor ["+at.getName()+"].");
    187           }
    188           if (as.size() > 1) {
     191          }
     192          else if (as.size() == 1) {        // one-channel experiment
     193            AnnotationSnapshot a = as.get(0);
     194            se.addExperimentalFactor(at.getName(), getValueForAnnotation(a));
     195          }
     196          else if (as.size() == 2) {        // two-channel experiment
     197            // find the correct annotation looking at sample annotation of this SDRFEntry
     198            for (AnnotationSnapshot a : as) {   
     199              String ann = getValueForAnnotation(a);
     200              ItemInfo ii = se.getItems().get(ItemInfo.TYPE.SAMPLE);
     201              if (ii != null && ii.getAllCharacteristicsNames().contains(at.getName())) {
     202                if (ann.equals(ii.getCharacteristicValue(at.getName()))) {
     203                  se.addExperimentalFactor(at.getName(), ann);
     204                  break;
     205                }
     206              }
     207            }
     208          } else {
    189209            throw new MageTabException("raw bioassay ["+rba.getName()+"] has multiple annotations "+
    190210                "of type ["+at.getName()+"].");
    191211          }
    192           AnnotationSnapshot a = as.get(0);
    193           se.addExperimentalFactor(at.getName(), getValueForAnnotation(a));
     212         
     213         
    194214        }
    195215   
Note: See TracChangeset for help on using the changeset viewer.