Class RawBioAssayImporter
java.lang.Object
net.sf.basedb.core.plugin.AbstractPlugin
net.sf.basedb.plugins.AbstractFlatFileImporter
net.sf.basedb.plugins.batchimport.AbstractItemImporter<RawBioAssay>
net.sf.basedb.plugins.batchimport.RawBioAssayImporter
- All Implemented Interfaces:
AutoDetectingImporter
,InteractivePlugin
,Plugin
,SignalTarget
,ConfigureByExample
Plug-in for importing raw bioassay items in a batch. The plug-in can create new
items and updated existing items.
- Version:
- 2.8
- Author:
- nicklas
- Last modified
- $Date: 2022-01-13 07:45:03 +0100 (Thu, 13 Jan 2022) $
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.sf.basedb.core.plugin.Plugin
Plugin.MainType
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final PluginParameter<String>
private Mapper
protected static final PluginParameter<String>
private Mapper
private String
private DefaultItemFunction<ArrayDesign>
private DefaultItemFunction<Protocol>
private DefaultItemFunction<Software>
private Mapper
protected static final PluginParameter<String>
private Mapper
protected static final PluginParameter<String>
private Mapper
private Mapper
protected static final PluginParameter<String>
protected static final PluginParameter<String>
private Mapper
private static final Set<GuiContext>
private Mapper
protected static final PluginParameter<String>
private Mapper
private Mapper
protected static final PluginParameter<String>
private Mapper
private Mapper
protected static final PluginParameter<String>
private Mapper
protected static final PluginParameter<String>
private Mapper
Fields inherited from class net.sf.basedb.plugins.batchimport.AbstractItemImporter
addMembersMode, createMode, defaultsSection, descriptionColumnMapping, externalIdColumnMapping, idAnnotationColumnMapping, identificationSection, internalIdColumnMapping, kitColumnMapping, nameColumnMapping, optionalColumnMapping, permissionTemplateColumnMapping, protocolColumnMapping, registeredColumnMapping, removeMembersMode, requiredColumnMapping, subtypeColumnMapping, updateMode
Fields inherited from class net.sf.basedb.plugins.AbstractFlatFileImporter
complexMappings, dataFooterRegexpParameter, dataHeaderRegexpParameter, dataSplitterRegexpParameter, defaultErrorParameter, errorSection, excelSheetParameter, fileParameter, fileType, headerRegexpParameter, ignoreRegexpParameter, invalidUseOfNullErrorParameter, mappingSection, maxDataColumnsParameter, minDataColumnsParameter, numberFormatErrorParameter, numberOutOfRangeErrorParameter, numDataColumnsType, optionalRegexpType, parserSection, requiredRegexpType, sectionRegexpParameter, stringTooLongErrorParameter, trimQuotesParameter
Fields inherited from class net.sf.basedb.core.plugin.AbstractPlugin
annotationSection, configuration, COPY_ANNOTATIONS, job, OVERWRITE_ANNOTATIONS, sc
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addMoreColumnMappingParameters
(List<PluginParameter<?>> parameters) Adds column mappings for name, externalId, description, protocol, creation date, original quantity, pooled, parent and used quantity from parent.protected void
addMoreJobParameters
(List<PluginParameter<?>> parameters) Add parameter for "Data directory" directory where data files may be located.protected void
createColumnMappers
(FlatFileParser ffp, boolean cropStrings) Create mappers that can be used to extract data values from the file that is currently being parsed by theffp
FlatFileParser
.protected RawBioAssay
createItem
(DbControl dc, FlatFileParser.Data data) Create a new item and populate it with data from the current line.protected ItemQuery<RawBioAssay>
CallsRawBioAssay.getQuery()
.protected void
doneWithItem
(DbControl dc, RawBioAssay rba, int numMultiLines) Validate data files if they have been set.Get a set containing all items that the plugin handles.protected IdMethod[]
protected Item
Enable annotations as item identifier.protected void
updateItem
(DbControl dc, RawBioAssay rba, FlatFileParser.Data data) Update an item with data from the current line.protected void
updateMultiLineItem
(DbControl dc, RawBioAssay rba, FlatFileParser.Data data, int multiLineNum) Add data filesMethods inherited from class net.sf.basedb.plugins.batchimport.AbstractItemImporter
addMoreErrorParameters, addMoreParsingParameters, begin, beginData, configure, createItemQuery, end, findAnnotationTypeCategory, findArrayBatch, findArrayDesign, findArraySlide, findBioPlate, findBioPlateType, findBioSource, findBioSource, findBioWell, findDataFileType, findDerivedBioAssay, findExtract, findExtract, findFileServer, findHardware, findHardware, findHybridization, findItemSubtype, findItemSubtype, findKit, findLabeledExtract, findPermissionTemplate, findPhysicalBioAssay, findPlateGeometry, findPlatform, findProtocol, findProtocol, findRawDataType, findReferencedItem, findReferencedItemWithSubtype, findSample, findSample, findSoftware, findSoftware, findTag, findTag, findUnit, findVariant, getAnnotationIdMethods, getConfigureOptionsParameters, getConfigureParserParameters, getDefaultItemFunction, getIdMethod, getItemForSubtypes, getProjectDefaultPlatform, getProjectDefaultRawDataType, getProjectDefaultVariant, getRequestInformation, getSuccessMessage, handleData, initReferenceQuery, isInContext, parseDate, requiresConfiguration, setOrAddFile, setUpErrorHandling, supportsConfigurations, updateItemSubtype, updatePermissions
Methods inherited from class net.sf.basedb.plugins.AbstractFlatFileImporter
addErrorHandler, checkColumnMapping, checkColumnMapping, continueWithNextFileAfterError, doImport, finish, getCharset, getCharset, getDateFormatter, getDecimalSeparator, getErrorHandler, getErrorOption, getFileIterator, getInitializedFlatFileParser, getInitializedFlatFileParser, getMainType, getMapper, getMapper, getNumberFormat, getNumBytes, getPattern, getPattern, getProgress, getSignalHandler, getTimestampFormatter, getTotalFileSize, handleHeader, handleSection, isImportable, isImportable, log, log, log, log, run, start, wrapInputStream
Methods inherited from class net.sf.basedb.core.plugin.AbstractPlugin
cloneParameterWithDefaultValue, closeLogFile, createLogFile, done, getCopyAnnotationsParmeter, getCurrentConfiguration, getCurrentJob, getJobOrConfigurationValue, getOverwriteAnnotationsParameters, getPermissions, init, isLogging, log, log, storeValue, storeValue, storeValues, validateRequestParameters
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.sf.basedb.core.plugin.Plugin
done, getMainType, getPermissions, init, run
-
Field Details
-
guiContexts
-
platformColumnMapping
-
variantColumnMapping
-
rawDataTypeColumnMapping
-
softwareColumnMapping
-
bioAssayColumnMapping
-
extractColumnMapping
-
arrayDesignColumnMapping
-
fileTypeColumnMapping
-
fileColumnMapping
-
fileSpotsMapping
-
nameMapper
-
descriptionMapper
-
registeredMapper
-
protocolMapper
-
defaultProtocolFunction
-
softwareMapper
-
defaultSoftwareFunction
-
bioAssayMapper
-
extractMapper
-
arrayDesignMapper
-
defaultArrayDesignFunction
-
platformMapper
-
variantMapper
-
rawDataTypeMapper
-
fileTypeMapper
-
fileMapper
-
fileSpotsMapper
-
dataDirectory
-
-
Constructor Details
-
RawBioAssayImporter
public RawBioAssayImporter()
-
-
Method Details
-
getGuiContexts
Description copied from interface:InteractivePlugin
Get a set containing all items that the plugin handles. Ie. if the plugin imports reporters, return a set containingItem.REPORTER
. This information is used by client applications to put the plugin in the proper place in the user interface.- Returns:
- A
Set
containingItem
:s, or null if the plugin is not concerned about items
-
getIdMethods
Useable methods are:- Overrides:
getIdMethods
in classAbstractItemImporter<RawBioAssay>
-
getItemForAnnotationTypes
Enable annotations as item identifier.- Overrides:
getItemForAnnotationTypes
in classAbstractItemImporter<RawBioAssay>
- Returns:
- An Item or null
-
addMoreJobParameters
Add parameter for "Data directory" directory where data files may be located.- Overrides:
addMoreJobParameters
in classAbstractItemImporter<RawBioAssay>
- Parameters:
parameters
- The list of parameters to add the column mapping parameters to
-
addMoreColumnMappingParameters
Adds column mappings for name, externalId, description, protocol, creation date, original quantity, pooled, parent and used quantity from parent.- Overrides:
addMoreColumnMappingParameters
in classAbstractItemImporter<RawBioAssay>
- Parameters:
parameters
- The list of parameters to add the column mapping parameters to
-
createItemQuery
CallsRawBioAssay.getQuery()
.- Specified by:
createItemQuery
in classAbstractItemImporter<RawBioAssay>
- Returns:
- A query
-
createColumnMappers
Description copied from class:AbstractItemImporter
Create mappers that can be used to extract data values from the file that is currently being parsed by theffp
FlatFileParser
. This method is called during initialisation of the plug-in when theFlatFileParser.parseHeaders()
has successfully found the start of data. Use theAbstractFlatFileImporter.getMapper(FlatFileParser, String, Integer, Mapper)
to create column mappers. Example:nameMapper = getMapper(ffp, job.getValue("nameColumnMapping"), cropStrings ? Nameable.MAX_NAME_LENGTH : null, null);
- Overrides:
createColumnMappers
in classAbstractItemImporter<RawBioAssay>
- Parameters:
ffp
- The parser that is parsing the data filecropStrings
- If strings that are too long to fit in the database should be cropped or not (=generate an error)
-
createItem
Description copied from class:AbstractItemImporter
Create a new item and populate it with data from the current line. Do not callDbControl.saveItem(BasicItem)
. This is done automatically by the core implementation.BioSource bs = BioSource.getNew(dc); // Set properties. See example on updateItem method return bs;
If the current data line doesn't have data for all required properties, this method should throw an
InvalidUseOfNullException
exception.This method is called during import when current item can be found and if the user has selected to create missing item.
- Specified by:
createItem
in classAbstractItemImporter<RawBioAssay>
- Parameters:
dc
- The DbControl to use for database accessdata
- The current data line- Returns:
- A new item
-
updateItem
Description copied from class:AbstractItemImporter
Update an item with data from the current line. Example:if (nameMapper != null) item.setName(nameMapper.getValue(data)); if (descriptionMapper != null) item.setDescription(descriptionMapper.getValue(data)); ...
This method is called during import to update an existing item.- Specified by:
updateItem
in classAbstractItemImporter<RawBioAssay>
- Parameters:
dc
- The DbControl to use for database accessrba
- The item to updatedata
- The current data line
-
updateMultiLineItem
protected void updateMultiLineItem(DbControl dc, RawBioAssay rba, FlatFileParser.Data data, int multiLineNum) Add data files- Overrides:
updateMultiLineItem
in classAbstractItemImporter<RawBioAssay>
- Parameters:
dc
- The DbControl to use for database accessrba
- The item to updatedata
- The current data linemultiLineNum
- The number of the multi-line entry, starting with 1 for the first multi-line
-
doneWithItem
Validate data files if they have been set.- Overrides:
doneWithItem
in classAbstractItemImporter<RawBioAssay>
- Parameters:
dc
- The DbControl to use for database accessrba
- The item to updatenumMultiLines
- The number of the multi-line entries, starting with 1 for the first multi-line (0 for single-line entries)
-