Changeset 471


Ignore:
Timestamp:
Nov 12, 2007, 5:49:52 PM (14 years ago)
Author:
dominic
Message:

added newly changed code. This source code is not in sycn with the current released version of the tab2mage importer.

Location:
trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/AnnotationTypeFileMapping.java

    r459 r471  
    4747    this.valueType = valueType;
    4848    this.parameter=parameter;
    49     this.itemTypes.addAll(itemTypes);
     49    this.itemTypes.addAll(itemTypes); // itemTpes =itemTypes doesn't work. the list of item gets truncated.
    5050  }
    5151 
     
    195195    this.enumeration = enumeration;
    196196  }
     197
     198
    197199}
  • trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/DetectablePluginTypes.java

    r459 r471  
    1010  @version 1.0
    1111  @email oyeniran@ebi.ac.uk
     12  @nutribase.modified $Date
    1213*/
    1314public enum DetectablePluginTypes
  • trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/io/Base2Tab2MageFileReader.java

    r417 r471  
    425425    try
    426426    {
    427       input = br.readLine();
     427      //input = br.readLine();
    428428      cont: // if a element was found in the for loop,
    429429          // the continue statement jumps to the next line
    430430      while((input = br.readLine()) != null)
    431431      {
    432         //if (input == "" || input.length() == 0 || input.startsWith(TAB2MAGE_PROTOCOL_SECTION)){
    433         //  break;        // The end of the experiment section found
    434         //}
    435432        for(Object man : mandatory)
    436433        {
     
    441438            testLine = input.substring(man.toString().length()+1);
    442439            log.info("header: " +man.toString()+ " = " +testLine);
    443             // sets the experiment object compulsory attributes : submitter, name and submitter email
     440            // sets the experiment object compulsory attributes : submitter, name and email
    444441            experiment.add(man.toString(), testLine);
    445442            continue cont;
     
    451448          {
    452449            testLine = input.substring(opt.toString().length()+1);
    453             log.debug("header: " +opt.toString()+ " = " +testLine);
     450            log.info("header: " +opt.toString()+ " = " +testLine);
    454451            //sets the experiment object optional attributes : organisation, domain etc
    455452            experiment.add(opt.toString(), testLine);
     
    457454          }
    458455        }
    459         log.warn("Can't identify a line of the experiment section: " + input);
     456        //log.warn("Can't identify a line of the experiment section: " + input);
    460457      }
    461458    }
     
    526523                continue cont;
    527524              }
    528             }catch(IndexOutOfBoundsException e)
     525            }
     526            catch(IndexOutOfBoundsException e)
    529527            {
    530528              hybLine.set( key, null, "" );
     
    533531         
    534532          for(String aKey : aKeys){
    535             if(headers[i].startsWith(aKey) && headers[i].indexOf("[") > 0){
     533            if(headers[i].startsWith(aKey) && headers[i].indexOf("[") > 0)
     534            {
    536535              String sub = headers[i].substring(aKey.length()+1, headers[i].length()-1);
    537               try{
     536              try
     537              {
    538538                String val = rowValues[i];
    539539                hybLine.set(aKey, sub, val);
    540               }catch(IndexOutOfBoundsException e){
     540              }
     541              catch(IndexOutOfBoundsException e)
     542              {
    541543                hybLine.set( aKey, sub, "" );
    542544              }
  • trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/io/RawDataImport.java

    r417 r471  
    148148      job.setParameterValue("file", new FileParameterType(), file);
    149149      job.setParameterValue("rawBioAssay", new ItemParameterType<RawBioAssay>(RawBioAssay.class, null), rba);
    150       job.setParameterValue("missingReporterError", new StringParameterType(), "skip");
    151       job.setParameterValue("featureMismatchError", new StringParameterType(), "skip");
    152      
    153       //job.setParameterValue("stringTooLongError", new StringParameterType(), "skip");
     150      job.setParameterValue("missingReporterError", new StringParameterType(), "null");
     151      //job.setParameterValue("featureMismatchError", new StringParameterType(), "skip");
     152      job.setParameterValue("stringTooLongError", new StringParameterType(), "crop");
    154153      //job.setParameterValue("invalidUseOfNullError", new StringParameterType(), "skip");
    155       job.setParameterValue("numberFormatError", new StringParameterType(), "skip");
     154      job.setParameterValue("numberFormatError", new StringParameterType(), "null");
    156155      //job.setParameterValue("numberOutOfRangeError", new StringParameterType(), "skip");
    157156     
  • trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/io/Tab2MageHybWriter.java

    r417 r471  
    4242
    4343import uk.ac.ebi.nugo.common.Helper;
     44import uk.ac.ebi.nugo.common.NutribasePluginException;
    4445import uk.ac.ebi.nugo.plugins.util.tab2mage.Tab2MageHelper;
    4546/**
    4647 
    47   @author Dominic Oyeniran
     48  This class writes the Hybridizations to the database.
     49    @author Dominic Oyeniran
     50    @version 1.0
    4851   
    4952 */
     
    5558  protected static Logger log= Logger.getLogger(Tab2MageHybWriter.class);
    5659 
    57   /**
    58     the protcols to be written to the database
    59    */
    60   //private Set<Tab2MAGEProtocol> protocols=null;
    6160 
    6261  /**
     
    6463   */
    6564  private ArrayList<Tab2MAGEHybridization> hybs=null;
    66   /**
    67     the session control of the  current logged in user
    68    */
    69   //private SessionControl  sc;
     65
    7066  /**
    7167    the database control
     
    8480
    8581  /**
    86     The set of experimnetal factors
     82    The set of experimental factors
    8783   */
    8884  private Set<String> expFactors= new HashSet<String>();
     
    163159                for (Map.Entry<String, String> fact : factorMap.entrySet())
    164160                {
    165                   //log.debug(" Factor Value is " + fact.getKey()+ ":" +fact.getValue());
    166161                  expFactors.add(fact.getKey());
    167162                }
     
    183178              } //end of Hybridization line
    184179
    185           // get Array Design. This must have been created by the admin
     180          // get Array Design. Array Design must have been created by a user with administrative rights
    186181              String accession=Tab2MageHelper.findTab2MageAccessionOrSerial(hyb.getArrayInformation(), "accession");
    187182              ArrayDesign arrayDesign = Helper.getArrayDesign(accession,dc);
     
    258253        {
    259254          log.warn("Annotation for BioMaterial Characteristics cannot be set. Check the allowed values for the annotation type");
    260           //roll back done in the write method
    261255        }
    262256        dc.saveItem(bio);
     
    305299        {
    306300          log.warn("Annotation for Sampling Protocol cannot be set. Check the allowed values for the annotation type");
    307           //roll back done in the write method
    308301        }
    309302       
     
    349342        catch (InvalidDataException ide)
    350343        {
    351           log.warn("Annotation for Extraction Protocol cannot be set.Check the allowed values for the annotation type");
    352           //roll back done in the write method
     344          log.warn("Annotation for Extraction Protocol cannot be set. Check the allowed values for the annotation type" + ide.getMessage());
    353345        }
    354346        // add the extract annotations for MAG- TAB sample characteristics
     
    394386      catch (InvalidDataException ide)
    395387      {
    396         log.warn("Annotation for Labeling Protocol cannot be set. Check the allowed values for the annotation type");
    397         //roll back done in the write method
     388        log.warn("Annotation for Labeling Protocol cannot be set. Check the allowed values for the annotation type in BASE");
    398389      }
    399390      //     add the labeled extract annotations for MAG- TAB sample characteristics
     
    428419    }
    429420    String accessionNo = getProtocolAccesion(proCatche,"hybridization"); //
    430     // temp comment this out and test......
    431     //BioMaterialEvent newHybEvent=newHyb.getCreationEvent();
    432421    bioMaterialEvent.setProtocol(getProtocol(accessionNo));
    433422    // add the  annotation for protocol parameters
     
    438427    catch (InvalidDataException ide)
    439428    {
    440       log.warn("Annotation for Hybridization Protocol cannot be set. Check that");
    441       //roll back done in the write method
     429      log.warn("Annotation for Hybridization Protocol cannot be set. Check the allowed values for the annotation type in BASE");
     430
    442431    }
    443432    dc.saveItem(newHyb);
     
    467456    catch (InvalidDataException ide)
    468457    {
    469       log.warn("Annotation for Scanning Protocol cannot be set. Check that");
    470       //roll back done in the write method
     458      log.warn("Annotation for Scanning Protocol cannot be set. Check the allowed values for the annotation type in BASE");
    471459    }
    472460    dc.saveItem(scan);
     
    491479      RawBioAssay rba = RawBioAssay.getNew(dc, rawDataType);
    492480      rba.setName(name);
    493       //dc.saveItem(rba);
    494481      rba.setScan(scan);
    495     if (!rba.hasArrayDesign()) rba.setArrayDesign(arrayDesign);
     482      if (!rba.hasArrayDesign()) rba.setArrayDesign(arrayDesign);
    496483    String accessionNo = getProtocolAccesion(protCatche,"feature extraction"); //could pass protocol type as parameter
    497484    rba.setProtocol(getProtocol(accessionNo));
     
    503490    catch (InvalidDataException ide)
    504491    {
    505       log.warn("Annotation for Feature Extraction Protocol cannot be set. Check the allowed values for the annotation type");
    506       //roll back done in the write method
     492      log.warn("Annotation for Feature Extraction Protocol cannot be set. Check the allowed values for the annotation type in BASE");
    507493    }
    508494    //  add the raw bioassay  annotations for implementing factor value annotation.
    509     //  This is a work around, avoiding the inherited annotation problem: i.e items to inherit factor value
    510     //  from are not available in tab2mage file neither si there an association.
     495    //  This is a work around, avoiding the inherited annotation problem: i.e. items to inherit factor value
     496    //  from are not available in the tab2mage file and specification neither is there an association.
    511497   
    512498    try
     
    516502    catch (InvalidDataException ide)
    517503    {
    518       log.warn("Annotation for RawBioAssay cannot be set. Check the allowed values for the annotation type");
    519       //roll back done in the write method
     504      log.warn("Annotation for RawBioAssay cannot be set. Check the allowed values for the annotation type in BASE");
    520505    }
    521506    dc.saveItem(rba);
     
    571556    for (Map.Entry<String, String> prot: protMap.entrySet())
    572557    {
    573       //log.debug(" Hyb Protocol is " + prot.getKey()+ ":" +prot.getValue());
     558      log.info(" Hyb section Protocol is " + prot.getKey()+ ":" +prot.getValue());
    574559      if (prot.getKey().equals(type.toUpperCase()))
    575560      {
     
    597582    return protocol;
    598583  }
    599  
    600   /**
    601     get all the experimental factors found in the Hybridization
    602     @return set of exprFactor
    603    */
    604   public Set<String> getExpFactors()
    605   {
    606     return expFactors;
    607   }
    608  
     584  /**
     585    sets annotations for biomaterial characteristics and factor values on raw bio assays
     586      @param annotatable, the item to be annotated
     587      @param annotationMap, map of [annotation types - value] pair
     588   */
    609589  private void setAnnotations(Annotatable annotatable, Map<String,String>annotationMap)
    610590  {
     
    622602      for (Map.Entry<AnnotationType, String> annt : annotationTypes.entrySet())
    623603      {
    624         //log.info("Annotation type - Value mapping is " + annt.getKey().toString()+ ":" +annt.getValue());
    625          
    626         // remove annotations if the annotatable item has annotations already
    627         // this is because, we consider the annotatable item as a new item  that
    628         // should not reference an already existing annotation  of an item with
    629         //the same name, even if the item has been deleted.
    630         //if (annotatable.isAnnotated()) annotatable.removeAnnotations();
     604        log.info("AnnotationType - Value mapping is [" + annt.getKey().toString()+ ":" +annt.getValue()+"]");
     605        AnnotationType at = annt.getKey();
     606        AnnotationSet as = annotatable.getAnnotationSet();
     607        String value = annt.getValue();
    631608        if (annotatable instanceof  RawBioAssay)
    632609        {
    633           AnnotationType t = annt.getKey();
    634           if (t.isEnabledForItem(Item.RAWBIOASSAY)) // if the annotation type is enable for raw bioassay item, set annotations
     610          if (at.isEnabledForItem(Item.RAWBIOASSAY)) // if the annotation type is enable for raw bioassay item, set annotations
    635611          {
    636             AnnotationSet as = annotatable.getAnnotationSet();
    637             String values= annt.getValue();
    638             log.info("Inserting: "+ annt.getValue()+" annotation for: "+ annotatable.toString());
    639            
    640             if (t.getValueType().equals(Type.FLOAT))
     612            log.warn("Inserting: "+ value+" annotation for: "+ annotatable.toString());
     613            if (at.getValueType().equals(Type.FLOAT))
    641614            {
    642               log.info("YES, the annotation value type is float");
    643               Float v = new Float(Float.parseFloat(values));
    644               as.getAnnotation(annt.getKey()).setValue(v);
    645              
     615              Float v = new Float(Float.parseFloat(value));
     616              as.getAnnotation(at).setValue(v);
    646617            }
    647618            else //if( t.getValueType().equals(Type.STRING))
    648619            {
    649               as.getAnnotation(annt.getKey()).setValue(annt.getValue());
     620              as.getAnnotation(at).setValue(value);
    650621            }
    651622          }
    652           // otherwise do nothing
     623          else
     624          {
     625            log.warn("AnnotationType: '"+ at +"' cannot annotate a RawBioAssay");
     626          }
    653627        }
    654628        else
    655         {
    656           AnnotationSet as = annotatable.getAnnotationSet();
    657           log.info("Inserting: "+ annt.getValue()+" annotation for: "+ annotatable.toString());
    658           as.getAnnotation(annt.getKey()).setValue(annt.getValue());
    659         }
    660        
     629          setAnnotations(at,as,value,annotatable);     
    661630      }
    662631    }
     
    673642    for (Map.Entry<String, String> an : annotationMap.entrySet())
    674643    {
    675       log.debug(" Annotation type [BioMat,Param] Value is " + an.getKey()+ ":" +an.getValue());
    676644      AnnotationType at =Helper.getAnnotationTypeByName(an.getKey(),dc);
    677645      if (at!=null)
     
    684652      for (Map.Entry<AnnotationType, String> anv : ats.entrySet())
    685653      {
     654        log.info("Parameter: AnnotationType - Value mapping is [" + anv.getKey().toString()+ ":" +anv.getValue()+"]");
    686655        if (annotatable.getProtocol()!=null)
    687656        {
    688657          if (annotatable.getProtocol().isParameter(anv.getKey()))
    689658          {
     659            AnnotationType a= anv.getKey();
     660            String value = anv.getValue();
    690661            AnnotationSet as = annotatable.getAnnotationSet();
    691             log.info("Inserting: "+ anv.getValue()+" annotation for: "+ annotatable.toString());
    692             as.getAnnotation(anv.getKey()).setValue(anv.getValue());
     662            setAnnotations(a,as,value,annotatable);
    693663          }
    694664        }
     
    697667  }
    698668 
     669  /**
     670    sets annotations
     671    @param at, annotation type
     672      @param as, annotationset for the annotatable item
     673      @param value, annotation value to be set
     674      @param annotatable, the annotatable item
     675   */
     676  private void setAnnotations(AnnotationType at, AnnotationSet as, String value, Annotatable annotatable)
     677  {
     678    try
     679    {
     680      if (at.getValueType().equals(Type.FLOAT))
     681      {
     682        try
     683        {
     684          Float v = new Float(Float.parseFloat(value));
     685          log.warn("Inserting: "+ v+" as annotation for item: "+ annotatable.toString());
     686          as.getAnnotation(at).setValue(v);
     687        }
     688        catch( Exception e)
     689        {
     690          log.warn("No float value or the value cannot be parsed");
     691        }
     692      }
     693      else if (at.getValueType().equals(Type.STRING))
     694      {
     695        if (at.isEnumeration())
     696        {
     697          String enumValue = at.findValue(value, true, true); // only works for string
     698          if (enumValue != null)
     699            as.getAnnotation(at).setValue(enumValue);
     700          else
     701            log.warn("The annotation :"+ value + "is not an allowed value for Annotation Type :"+ at.getName()) ; 
     702        }
     703        else
     704        {
     705          log.warn("Inserting: "+ value+" as annotation for item: "+ annotatable.toString());
     706          as.getAnnotation(at).setValue(value);
     707        }
     708      }
     709    }
     710    catch(Exception ex)
     711    {
     712      throw new NutribasePluginException("The annotations cannot be written"+ ex.getMessage());
     713    }
     714   
     715  }
     716 
    699717  public List<RawBioAssay> getRbaCatche()
    700718  {
    701719    return rbaCatche;
    702720  }
     721 
     722  /**
     723    get all the experimental factors found in the Hybridization
     724    @return set of exprFactor
     725   */
     726  public Set<String> getExpFactors()
     727  {
     728    return expFactors;
     729  }
    703730
    704731}
  • trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/io/Tab2MageWriterFactory.java

    r426 r471  
    200200      if (dc!=null)
    201201        dc.close();
     202        if(!bioSourceSamMap.isEmpty()) bioSourceSamMap.clear(); //clear the map
     203        if (!sampleExtMap.isEmpty()) sampleExtMap.clear(); //clear the map
     204        if (!extractLEMap.isEmpty()) extractLEMap.clear(); //clear the map
    202205    }
    203206    return done;
     
    210213  private void writeBiosourceSamplePoolItems(DbControl dc)
    211214  {
    212     Helper.write("....biosource - sample pooloing");
     215    log.info("....biosource - sample pooling");
    213216    for (Map.Entry<String , List<String>> entry : bioSourceSamMap.entrySet())
    214217    {
    215       Helper.write("\n++ The biosource sample from the bioSourceSamMap is : "+entry.getKey()+":"+ entry.getValue());
     218      log.info("\n++ The biosource sample from the bioSourceSamMap is : "+entry.getKey()+":"+ entry.getValue());
    216219      List<String> parents= entry.getValue();
    217220      List<Sample> children = new ArrayList<Sample>();
    218221      for (String parent : parents )
    219222      {
    220         Helper.write("++The current parent being checked is "+ parent);
     223        log.info("++The current parent being checked is "+ parent);
    221224        BioSource p = Helper.findBiosource(dc, parent); // get the parent - BioSource-  from the database
    222         Helper.write( "The Biosource : " + p.getName()+ "is found");
     225        log.info( "The Biosource : " + p.getName()+ "is found");
    223226        ItemQuery<Sample> childrenQuery  = p.getSamples(); // get all the samples( children of parents - BioSource)
    224227        childrenQuery.restrict(Restrictions.neq(Hql.property("name"), Expressions.string(entry.getKey())));
    225228        childrenQuery.include(Include.MINE, Include.NOT_REMOVED); // include those children created by the loggedin user only
    226         Helper.write("The number of samples found for biosource " + p.getName() + " is :" +childrenQuery.list(dc).size() );
     229        log.info("The number of samples found for biosource " + p.getName() + " is :" +childrenQuery.list(dc).size() );
    227230        if (childrenQuery.list(dc).size()!=0)
    228231          children.add(childrenQuery.list(dc).get(0));  // pick the first sample
    229232      }
    230233      String childofParent = entry.getKey(); // in this example this is the sample
    231       Helper.write("...The key from map is : " + childofParent );
     234      log.info("...The key from map is : " + childofParent );
    232235      Sample s= Helper.findSample(dc, childofParent, false);
    233       Helper.write("...the already created object fetched is : " + s.getName());
     236      log.info("...the already created object fetched is : " + s.getName());
    234237      String pooledSampleName = s.getName();
    235238      s.setPooled(true);
     
    238241        if (!pooledSampleName.equalsIgnoreCase(child.getName()))
    239242        {
    240           Helper.write("Adding parent sample : "+ child.getName() +" to pooled sample " + s.getName());
     243          log.info("Adding parent sample : "+ child.getName() +" to pooled sample " + s.getName());
    241244          s.getCreationEvent().addSource((MeasuredBioMaterial) child, Float.parseFloat("0.10"));
    242245        }
     
    252255  private void writeSampleExtractPoolItems(DbControl dc)
    253256  {
    254     Helper.write("....sample - extract pooloing");
     257    log.info("....sample - extract pooling");
    255258    for (Map.Entry<String , List<String>> entry : sampleExtMap.entrySet())
    256259    {
    257       Helper.write("\n++ The sample extract from the SampleExractMap is : "+entry.getKey()+":"+ entry.getValue());
     260      log.info("\n++ The sample extract from the SampleExractMap is : "+entry.getKey()+":"+ entry.getValue());
    258261      List<String> parents= entry.getValue();
    259262      List<Extract> children = new ArrayList<Extract>();
    260263      for (String parent : parents )
    261264      {
    262         Helper.write("\n++The current parent being checked is "+ parent);
     265        log.info("\n++The current parent being checked is "+ parent);
    263266        Sample p = Helper.findSample(dc, parent, true); // get the parent - sample- from the database, include pooled sample
    264         Helper.write( "The sample : " + p.getName()+ " is found");
     267        log.info( "The sample : " + p.getName()+ " is found");
    265268        ItemQuery<Extract> childrenQuery  = p.getExtracts(); // get all the extracts ( children of parents -Sample)
    266269        childrenQuery.restrict(Restrictions.neq(Hql.property("name"), Expressions.string(entry.getKey())));
    267270        for (Extract e : childrenQuery.list(dc))
    268271        {
    269           Helper.write("The extract obtained before filtering is " + e.getName());
     272          log.info("The extract obtained before filtering is " + e.getName());
    270273        }
    271274        childrenQuery.include(Include.MINE, Include.NOT_REMOVED); // include those children created by the loggedin user only
    272         Helper.write("The number of extract found for sample " + p.getName() + " is : " +childrenQuery.list(dc).size() );
     275        log.info("The number of extract found for sample " + p.getName() + " is : " +childrenQuery.list(dc).size() );
    273276        if (childrenQuery.list(dc).size()!=0)
    274277          children.add(childrenQuery.list(dc).get(0));  // pick the first child or extract in this case
     
    279282            Extract multiPooledExtract= Extract.getNew(dc);
    280283            multiPooledExtract.setName(p.getName());
    281             //ItemQuery<Sample> query = Sample.getQuery();
    282             //query.restrict(Restrictions.eq(Hql.property("name"), Expressions.string(parent)));
    283             //if (query.list(dc).size()!=0)
    284             //{
    285             //  multiPooledExtract.setSample(query.list(dc).get(0), Float.parseFloat("0.001"));
    286             //  Help.write("\nThe multi-pooled sample FOUND is: " +query.list(dc).get(0));
    287             //}
    288284            multiPooledExtract.setSample(p,Float.parseFloat("0.001"));
    289285            dc.saveItem(multiPooledExtract);
     
    297293      }
    298294      String childofParent = entry.getKey(); // in this example this is the extract
    299       Helper.write("...The key from map is : " + childofParent );
     295      log.info("...The key from map is : " + childofParent );
    300296      Extract e= Helper.findExtract(dc, childofParent, false);
    301       Helper.write("...the already created object fetched is : " + e.getName() );
     297      log.info("...the already created object fetched is : " + e.getName() );
    302298      String pooledExtractName = e.getName();
    303299      e.setPooled(true);
     
    306302        if (!pooledExtractName.equalsIgnoreCase(child.getName()))
    307303        {
    308           Helper.write("Adding parent extract : "+ child.getName() +" to pooled extract " + e.getName());
     304          log.info("Adding parent extract : "+ child.getName() +" to pooled extract " + e.getName());
    309305          e.getCreationEvent().addSource((MeasuredBioMaterial) child, Float.parseFloat("0.10"));
    310306        }
     
    319315  private void writeExtractLabeledExtractPoolItems(DbControl dc)
    320316  {
    321     Helper.write("....extract - labeled extract pooling");
     317    log.info("....extract - labeled extract pooling");
    322318    for (Map.Entry<String , List<String>> entry : extractLEMap.entrySet())
    323319    {
    324       Helper.write("\n++ The extract le from the extractLEMap is : "+entry.getKey()+":"+ entry.getValue());
     320      log.info("\n++ The extract le from the extractLEMap is : "+entry.getKey()+":"+ entry.getValue());
    325321      List<String> parents= entry.getValue();
    326322      List<LabeledExtract> children = new ArrayList<LabeledExtract>();
    327323      for (String parent : parents )
    328324      {
    329         Helper.write("++The current parent being checked is "+ parent);
     325        log.info("++The current parent being checked is "+ parent);
    330326        Extract p = Helper.findExtract(dc, parent, true); // get the parent - Extract- from the database, include pooled extract
    331         Helper.write( "The extract : " + p.getName()+ "is found");
     327        log.info( "The extract : " + p.getName()+ "is found");
    332328        ItemQuery<LabeledExtract> childrenQuery  = p.getLabeledExtracts(); // get all the labeled extracts ( children of parents - Extract)
    333329        childrenQuery.restrict(Restrictions.neq(Hql.property("name"), Expressions.string(entry.getKey())));
    334330        childrenQuery.include(Include.MINE, Include.NOT_REMOVED); // include those children created by the loggedin user only
    335         Helper.write("The number of labeled extract found for extract " + p.getName() + " is :" +childrenQuery.list(dc).size() );
     331        log.info("The number of labeled extract found for extract " + p.getName() + " is :" +childrenQuery.list(dc).size() );
    336332        if (childrenQuery.list(dc).size()!=0)
    337333          children.add(childrenQuery.list(dc).get(0));  // pick the first child or extract in this case
     
    340336      }
    341337      String childofParent = entry.getKey(); // in this example this is the labeled extract
    342       Helper.write("...The key from map is : " + childofParent );
     338      log.info("...The key from map is : " + childofParent );
    343339      LabeledExtract le= Helper.findLabeledExtract(dc, childofParent, false);
    344       Helper.write("...the already created object fetched is : " + le.getName() );
     340      log.info("...the already created object fetched is : " + le.getName() );
    345341      String pooledLabeledExtractName = le.getName();
    346342      le.setPooled(true);
     
    350346        {
    351347          // change this to log info for the users
    352           Helper.write("Adding parent labeled extract : "+ child.getName() +" to pooled labeled extract " + le.getName());
     348          log.info("Adding parent labeled extract : "+ child.getName() +" to pooled labeled extract " + le.getName());
    353349          le.getCreationEvent().addSource((MeasuredBioMaterial) child, Float.parseFloat("0.10"));
    354350        }
  • trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/io/parser/AgilentRDParser.java

    r459 r471  
    8787        if (values.startsWith(RAWDATASEPARATOR))
    8888        { // beginning of raw data
     89          //String head = values.replaceAll("\"", ""); // NOT REQQUIRES AS HEADERS DO NOT HAVE QUOTES
    8990          String[] headers = values.split("\t");
    9091          this.headers = headers;
  • trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/io/parser/Base2GenePixRDParser.java

    r459 r471  
    2323/**
    2424  This class parses the genepix raw data file for validation.
     25  A new class is required for base2 implementation to utilise base2 file system.Also we do read the
     26  raw data rows. The class also reused some code from Charles Giradot and Soaja at EMBL, Heildelberg
    2527  @author Dominic Oyeniran
    2628  @version 1.0
    27  
     29  @see org.embl.cg.bloader.io.rawdataparser.GenePixRDParser
    2830 */
    2931public class Base2GenePixRDParser
     
    8082      return;
    8183    }
     84   
    8285  }
    8386 
     
    116119      {
    117120        log.warn("Couldn't close the BufferedReader object.");
    118        
    119121      }
    120122      return null;
     
    215217      throw new RawDataParserException(e.getMessage());
    216218    }
    217   }
     219  }  // close the buffered reader : dom
    218220
    219221  public String[] getHeaders()
  • trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/io/parser/CSVParser.java

    r459 r471  
    2727 * Created on May 18, 2005
    2828 *
    29   This class is a modified version of   base Loader CVSParser to handle base2 file systems. The ideal way to solve
    30   the problem in BASELoader, I reckon, is to read
     29  This class is a modified version of  org.embl.cg.utilitytools.parser.csv.CVSParser to handle base2 file systems. The ideal way to solve
     30  the problem in BASELoader, I think, is to read
    3131  a system.database=BASE2 or system.platform=BASE2 property from the BASELoader /conf/baseloader.properties.
    3232  Pass the property as a string parameter to the getBufferedReader() method below.
     
    160160  }
    161161 
    162  
     162  /*
     163   * changed the parameter to the base2  temporary file created earlier so no need to create a new file
     164   */
    163165  /**
    164166   * @param filePath
     
    214216          continue;
    215217      }
    216      
     218      /*
     219        do not understand why this returns null
     220        [TODO] confirm with author: Charles
     221       
     222       
     223       */
    217224      if (!initColNumBasedOnFirstValidLine && !isValidLine(cols)) {
    218225          //log.debug("not a valid line");
     
    471478  protected BufferedReader getBufferedReader() throws FileNotFoundException {
    472479    BufferedReader bf = null; //get the file
     480    //File f = new File(this.filePath);
     481
     482      //if (!f.exists()) {
     483        //throw new FileNotFoundException(
     484        //  "File specified by path does not exists, path is: "
     485        //      + filePath);
     486    //  }
     487    //System.out.println("Filename in the cvs parser is : "+ file.getName());
     488    //File file = file.
    473489    bf = new BufferedReader(new InputStreamReader(this.file.getDownloadStream(0)));
    474490    return bf;
  • trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/mail/Tab2MageEMessaging.java

    r459 r471  
    3333  private String mailFrom = "";
    3434  private String mailTo = "";
     35  //private String host = "smtp.ebi.ac.uk";
    3536  private String host="";
    3637  private String body = "";
     
    113114    {
    114115      log.error("Email message cannot be sent, your email address maybe invalid. Or " +me.getMessage()+ ". Contact your smtp sever adminstrator");
     116     
     117      //throw new NutribasePluginException("Email message cannot be sent, your email address maybe invalid. Or " +me.getMessage()+ ". Contact your smtp sever adminstrator");
    115118    }
    116119    catch (UnsupportedEncodingException e)
    117120    {
    118121      log.error("You have some unsupported characters in your base/nutribase username or email address.");
     122     
     123      //throw new NutribasePluginException(e.getMessage());
    119124    }
    120125  }
  • trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/validation/AnnotationValidation.java

    r457 r471  
    8888        writer.write("\n+++ End of annotation validation warnings +++ \n");
    8989        writer.write("To avoid missing annotations, please ask the BASE administrator to add " +
    90             "the annotation values identified above to the enumeration values allowed for the annotation type in BASE \n ");
     90        "the annotation values identified above to the enumeration values allowed for the annotation type in BASE \n ");
    9191        writer.write("\n");
    9292        valid= false;
     
    142142                    "Annotation Type ["+at.getName()+"] in BASE");
    143143          }       
     144          //if (foundValue==null)
     145          //{
     146          //  warnings.add("The "+ type +" annotation value ["+ eb.getValue()+"] is not allowed for " +
     147          //      "Annotation Type ["+at.getName()+"] in BASE");
     148          //  log.warn("The "+ type +" annotation value ["+ eb.getValue()+"] is not allowed for " +
     149          //      "Annotation Type ["+at.getName()+"] in BASE");
     150          //}
    144151        }
    145152        else
  • trunk/uk/ac/ebi/Tab2MageImporter/src/uk/ac/ebi/nugo/plugins/tab2mageimport/validation/GenePixFileValidation.java

    r459 r471  
    7171        //log.info("\n..........The list of Genepix headers\n");
    7272        List<String> headerList = Helper.arrayContentToLowercase(headers);
     73        //int i=0;
     74        //for (String header :headerList )
     75        //{
     76        //  i++;
     77        //  log.info("Header " + i + ": "+ header);
     78        //}
     79      //  log.info("End of Genepix headers\n");
    7380        List<GenePixDataColumns> mandatoryColumns= Arrays.asList(GenePixDataColumns.values());
    7481        for (GenePixDataColumns man :mandatoryColumns )
     
    7683          if (!headerList.contains(man.getColumnName()))
    7784          {
    78             log.error("Mandatory Column: ["+man.getColumnName().toUpperCase()+ "] is missing in the genepix file: ["+ gprFile + "]. Must be rectified to continue");
     85            //log.error("Mandatory Column: ["+man.getColumnName().toUpperCase()+ "] is missing in the genepix file: ["+ gprFile + "]. Must be rectified to continue");
    7986            errors.add("Mandatory Column: ["+man.getColumnName().toUpperCase()+ "] is missing in the genepix file: ["+ gprFile + "]. Must be rectified to continue");
    8087           
Note: See TracChangeset for help on using the changeset viewer.