3.0.2: 2012-01-25

net.sf.basedb.plugins.gtf
Class GtfReporterImporter

java.lang.Object
  extended by net.sf.basedb.core.plugin.AbstractPlugin
      extended by net.sf.basedb.plugins.AbstractFlatFileImporter
          extended by net.sf.basedb.plugins.ReporterFlatFileImporter
              extended by net.sf.basedb.plugins.gtf.GtfReporterImporter
All Implemented Interfaces:
AutoDetectingImporter, InteractivePlugin, Plugin, SignalTarget, ConfigureByExample, WrappedConfigureByExample

public class GtfReporterImporter
extends ReporterFlatFileImporter
implements WrappedConfigureByExample

Reporter importer implementation that create reporters from information in GTF files. The implementation builds on the regular ReporterFlatFileImporter but uses a GtfInputStream as a wrapper to generate a pure column-based output which can be used by the regular tools for file parsing. The importer will also skip lines with a non-unique transcript_id+seqname.

The default configuration is to use the transcript_id+seqname as the reporter id and name. gene_id is stored as "gene symbol" and seqname as "chromosome". The default configuration can be changed by user configurations depending on what additional attributes that are present in the GTF file.

Since:
3.0
Author:
Nicklas
Last modified
$Date: 2011-09-29 13:27:33 +0200 (Thu, 29 Sep 2011) $

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.sf.basedb.core.plugin.Plugin
Plugin.MainType
 
Field Summary
private  InputStreamTracker tracker
          Needed for progress reporting since reading from the source will produce less bytes when wrapped.
 
Fields inherited from class net.sf.basedb.plugins.ReporterFlatFileImporter
reporterIsUsedErrorParameter
 
Fields inherited from class net.sf.basedb.plugins.AbstractFlatFileImporter
complexMappings, dataFooterRegexpParameter, dataHeaderRegexpParameter, dataSplitterRegexpParameter, defaultErrorParameter, errorSection, 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
GtfReporterImporter()
           
 
Method Summary
protected  long getNumBytes(FlatFileParser ffp)
          Get the number of bytes read from the original file.
 void init(SessionControl sc, ParameterValues configuration, ParameterValues job)
          Store copies of the session control, plugin and job configuration.
 InputStream wrapInputStream(InputStream in)
          Wrap the input stream with a GtfInputStream.
 
Methods inherited from class net.sf.basedb.plugins.ReporterFlatFileImporter
begin, beginData, configure, end, getGuiContexts, getPermissions, getRequestInformation, getSuccessMessage, handleData, isInContext, requiresConfiguration, supportsConfigurations
 
Methods inherited from class net.sf.basedb.plugins.AbstractFlatFileImporter
addErrorHandler, checkColumnMapping, checkColumnMapping, continueWithNextFileAfterError, doImport, finish, getCharset, getCharset, getDecimalSeparator, getErrorHandler, getErrorOption, getFileIterator, getInitializedFlatFileParser, getMainType, getMapper, getNumberFormat, getProgress, getSignalHandler, getTotalFileSize, handleHeader, handleSection, isImportable, isImportable, log, log, log, log, run, setUpErrorHandling, start
 
Methods inherited from class net.sf.basedb.core.plugin.AbstractPlugin
cloneParameterWithDefaultValue, closeLogFile, createLogFile, done, getCopyAnnotationsParmeter, getCurrentConfiguration, getCurrentJob, getJobOrConfigurationValue, getOverwriteAnnotationsParameters, 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, requiresConfiguration, run, supportsConfigurations
 

Field Detail

tracker

private InputStreamTracker tracker
Needed for progress reporting since reading from the source will produce less bytes when wrapped.

Constructor Detail

GtfReporterImporter

public GtfReporterImporter()
Method Detail

init

public void init(SessionControl sc,
                 ParameterValues configuration,
                 ParameterValues job)
          throws BaseException
Description copied from class: AbstractPlugin
Store copies of the session control, plugin and job configuration. These are available to subclasses in the AbstractPlugin.sc, AbstractPlugin.configuration and AbstractPlugin.job variables. If a subclass overrides this method it is recommended that it also calls super.init(sc, configuration, job).

Specified by:
init in interface Plugin
Overrides:
init in class AbstractPlugin
Parameters:
sc - A SessionControl object that the plugin can use to communicate with the core.
configuration - The configuration parameters for the plugin
job - The job parameters for the plugin
Throws:
BaseException - if there is an error.

wrapInputStream

public InputStream wrapInputStream(InputStream in)
                            throws IOException
Wrap the input stream with a GtfInputStream.

Specified by:
wrapInputStream in interface WrappedConfigureByExample
Overrides:
wrapInputStream in class AbstractFlatFileImporter
Parameters:
in - The input stream to wrap
Returns:
The same or a different input stream
Throws:
IOException - If there is an error
See Also:
AbstractFlatFileImporter.getNumBytes(FlatFileParser)

getNumBytes

protected long getNumBytes(FlatFileParser ffp)
Get the number of bytes read from the original file.

Overrides:
getNumBytes in class AbstractFlatFileImporter
Parameters:
ffp - The file parser that is used to parsed the file
Returns:
The number of bytes read from the original file
See Also:
AbstractFlatFileImporter.wrapInputStream(InputStream), AbstractFlatFileImporter.getProgress(FlatFileParser)

3.0.2: 2012-01-25