Changeset 5697


Ignore:
Timestamp:
Aug 15, 2011, 8:52:47 AM (12 years ago)
Author:
Nicklas Nordborg
Message:

References #1153: Handling short read transcript sequence data

Re-added image import functionality to ScanImporter.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/DataFileType.java

    r5689 r5697  
    2424import java.util.Set;
    2525
    26 import net.sf.basedb.core.Transactional.Action;
    2726import net.sf.basedb.core.data.DataFileTypeData;
    2827import net.sf.basedb.core.query.Expressions;
     
    143142  */
    144143  public static final String BAM = "assembly.bam";
    145  
     144
     145  /**
     146    The external ID for the file type representing
     147    scanned microarray image.
     148    @since 3.0
     149  */
     150  public static final String MICROARRAY_IMAGE = "microarray.image";
     151
    146152  /**
    147153    The maximum length of the file extension that can be stored in the database.
  • trunk/src/core/net/sf/basedb/core/DerivedBioAssay.java

    r5696 r5697  
    2323
    2424import java.util.Collection;
     25import java.util.Collections;
    2526import java.util.Date;
    2627import java.util.HashSet;
     
    389390  public Collection<FileSet> getParentFileSets()
    390391  {
     392    DerivedBioAssay parent = getParent();
    391393    Collection<FileSet> parents = null;
    392     // TODO - part of #1153
     394    if (parent != null && parent.hasFileSet())
     395    {
     396      parents = Collections.singleton(parent.getFileSet());
     397    }
    393398    return parents;
    394399  }
  • trunk/src/core/net/sf/basedb/core/Install.java

    r5696 r5697  
    684684      if (progress != null) progress.display((int)(progressStep*progress_factor), "--Creating clients...");
    685685      createClient(rootUser, "net.sf.basedb.clients.test", "Test programs", "This client is used by test programs", keyEveryoneUse);
    686       createClient(rootUser, "net.sf.basedb.clients.migration", "Migration tool", "This client is used to migrate BASE 1.2.x data to BASE 2", null);
    687686      createClient(rootUser, "net.sf.basedb.clients.jobagent", "Job agent client", "This client is used by all job agents", keyJobAgentUse);
    688687      createClient(rootUser, "net.sf.basedb.clients.internal", "Internal",
     
    857856        Item.DERIVEDBIOASSAY, "bam", alignedType
    858857      );
     858      DataFileTypeData scanImageFile = createDataFileType(
     859        DataFileType.MICROARRAY_IMAGE, "Microarray image",
     860        "Scanned image from a microarray slide.",
     861        Item.DERIVEDBIOASSAY, "tif", imageType
     862      );
    859863     
    860864      // Platforms and variants
  • trunk/src/plugins/core/net/sf/basedb/plugins/batchimport/ScanImporter.java

    r5689 r5697  
    2222package net.sf.basedb.plugins.batchimport;
    2323
     24import net.sf.basedb.core.DataFileType;
    2425import net.sf.basedb.core.DbControl;
    2526import net.sf.basedb.core.DerivedBioAssay;
     
    9293      );
    9394 
    94   protected static final PluginParameter<String> imageNameColumnMapping = new PluginParameter<String>(
    95       "imageColumnMapping",
    96       "Image name",
    97       "Mapping that picks the name the image from the data columns. " +     
    98       "Example: \\Image\\",
    99       optionalColumnMapping
    100       );
    101  
    102   protected static final PluginParameter<String> imageFormatColumnMapping = new PluginParameter<String>(
    103       "imageFormatColumnMapping",
    104       "Image format",
    105       "Mapping that picks the format of the given image from the data columns. " +
    106       "The plug-in tries to parse the given format into one of the supported in BASE. " +
    107       "The image will get format 'unknown' if this isn't specified or has null-value." +
    108       "The column can either be empty or has one of the values 'TIFF', 'JPEG' or 'Unknown'."+
    109       "Example: \\Image format\\",
    110       optionalColumnMapping
    111       );
    112  
    113   protected static final PluginParameter<String> imagePreviewColumnMapping = new PluginParameter<String>(
    114       "imagePreviewColumnMapping",
    115       "Image preview",
    116       "Mapping that picks the preview flag of the given image from the data columns. " +
    117       "Example: \\Image preview\\",
    118       optionalColumnMapping
    119       );
    120  
    121   protected static final PluginParameter<String> imageDescriptionColumnMapping = new PluginParameter<String>(
    122       "imageDescriptionColumnMapping",
    123       "Image description",
    124       "Mapping that picks the description of the given image from the data columns. " +
    125       "Example: \\Image description\\",
    126       optionalColumnMapping
    127       );
    128 
    129  
    13095  public ScanImporter()
    13196  {}
     
    153118  private Mapper hybridizationMapper;
    154119  private Mapper imageFileMapper;
    155   private Mapper imageNameMapper;
    156   private Mapper imageFormatMapper;
    157   private Mapper imagePreviewMapper;
    158   private Mapper imageDescriptionMapper;
    159120  private String imagesDirectory;
    160121 
     
    189150    parameters.add(hardwareColumnMapping);
    190151    parameters.add(imageFileColumnMapping);
    191     parameters.add(imageNameColumnMapping);
    192     parameters.add(imageFormatColumnMapping);
    193     parameters.add(imagePreviewColumnMapping);
    194     parameters.add(imageDescriptionColumnMapping);
    195152    parameters.add(permissionTemplateColumnMapping);
    196153  }
     
    241198    hybridizationMapper = getMapper(ffp, (String)job.getValue("hybridizationColumnMapping"), null, null);
    242199    imageFileMapper = getMapper(ffp, (String)job.getValue("imageFileColumnMapping"), null, null);
    243     imageNameMapper = getMapper(ffp, (String)job.getValue("imageColumnMapping"), null, null);
    244     imageFormatMapper = getMapper(ffp, (String)job.getValue("imageFormatColumnMapping"), null, null);
    245     imagePreviewMapper = getMapper(ffp, (String)job.getValue("imagePreviewColumnMapping"), null, null);
    246     imageDescriptionMapper = getMapper(ffp, (String)job.getValue("imageDescriptionColumnMapping"), null, null);
    247200    imagesDirectory = (String)job.getValue("imagesDirectory");
    248201    if (imagesDirectory != null && !imagesDirectory.startsWith("/"))
     
    291244  protected void updateMultiLineItem(DbControl dc, DerivedBioAssay scan, FlatFileParser.Data data, int multiLineNum)
    292245  {
    293 //    TODO (#1153)
    294   //  Image image = null;
    295     File imageFile = null;
    296     String imageName = null;
     246
    297247    // Get the imagefile
    298     if (imageFileMapper != null && imageFileMapper.getValue(data) != null)
     248    if (imageFileMapper != null)
    299249    {
    300250      String filePath = imageFileMapper.getValue(data);
     
    303253        filePath = imagesDirectory + filePath;
    304254      }
    305       imageFile = File.getByPath(dc, new Path(filePath, Path.Type.FILE), false);
    306   //    image = findImage(dc, scan, imageFile);
    307     }
    308     if (imageNameMapper != null)
    309     {
    310       imageName = imageNameMapper.getValue(data);
    311     }
    312     /*
    313     TODO (#1153)
    314     else if (image != null)
    315     {
    316       imageName = image.getName();
    317     }
    318     if (image != null)
    319     {
    320       image.setName(imageName != null ? imageName : scan.getName() + "." + imageFile.getName());
    321       if (imageDescriptionMapper != null) image.setDescription(imageDescriptionMapper.getValue(data));
    322       if (imageFormatMapper != null && imageFormatMapper.getValue(data) != null) image.setFormat(Image.Format.valueOf(imageFormatMapper.getValue(data)));
    323       if (imagePreviewMapper != null) image.setPreview(Boolean.getBoolean(imagePreviewMapper.getValue(data)));
    324     }
    325     */
     255      File imageFile = File.getByPath(dc, new Path(filePath, Path.Type.FILE), false);
     256      DataFileType imageType = DataFileType.getByExternalId(dc, DataFileType.MICROARRAY_IMAGE);
     257      if (imageFile != null)
     258      {
     259        scan.getFileSet().setMember(imageFile, imageType);
     260      }
     261      else
     262      {
     263        scan.getFileSet().removeMember(imageType);
     264      }
     265    }
    326266  }
    327267  // ------------------------------------
Note: See TracChangeset for help on using the changeset viewer.