Class DefaultMitabStreamSource
- java.lang.Object
-
- psidev.psi.mi.jami.tab.extension.datasource.DefaultMitabStreamSource
-
- All Implemented Interfaces:
InteractionStream,MIDataSource,MIFileDataSource,MIFileParserListener,MitabStreamSource,MitabParserListener
- Direct Known Subclasses:
DefaultMitabSource
public class DefaultMitabStreamSource extends Object implements MitabStreamSource
Generic class for Mitab streaming datasource. This datasource streams the interactions from a MITAB file- Since:
21/06/13
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Field Summary
-
Fields inherited from interface psidev.psi.mi.jami.datasource.MIFileDataSource
FILE_URI_PREFIX, URL_PREFIX_REGEXP
-
-
Constructor Summary
Constructors Constructor Description DefaultMitabStreamSource()Empty constructor for the factory
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()close.protected MitabStreamSourcegetDelegate()Getter for the fielddelegate.MIFileParserListenergetFileParserListener()getFileParserListener.Iterator<Interaction>getInteractionsIterator()getInteractionsIterator.voidinitialiseContext(Map<String,Object> options)Initialise the context of the MIDataSource given a map of optionsprotected voidinitialiseDelegate(Map<String,Object> options, MitabDataSourceFactory factory, InteractionCategory category, ComplexType type)initialiseDelegate.voidonAliasWithoutDbSource(MitabAlias alias)onAliasWithoutDbSource.voidonAliasWithoutName(FileSourceContext context)Listen to an event fired when an alias does not have a namevoidonAnnotationWithoutTopic(FileSourceContext context)Listen to an event fired when an annotation does not have a topicvoidonEmptyUniqueIdentifiers(int line, int column, int mitabColumn)onEmptyUniqueIdentifiers.voidonInteractionWithoutParticipants(Interaction interaction, FileSourceContext context)Listen to an event fired when an interaction is read and does not have any participants.voidonInvalidOrganismTaxid(String taxid, FileSourceContext context)Listen to an event fired when an organism does not have a valid taxid (positive integer or -1, -2, -3, -4, -5)voidonInvalidPosition(String message, FileSourceContext context)Listen to an event fired when a position is not validvoidonInvalidRange(String message, FileSourceContext context)Listen to an event fired when a range is not validvoidonInvalidStoichiometry(String message, FileSourceContext context)Listen to an event fired when a stoichiometry is not validvoidonInvalidSyntax(FileSourceContext context, Exception e)Listen to an invalid syntax causing an ExceptionvoidonMissingChecksumMethod(FileSourceContext context)Listen to an event fired when a checksum does not have a methodvoidonMissingChecksumValue(FileSourceContext context)Listen to an event fired when a checksum does not have a valuevoidonMissingConfidenceType(FileSourceContext context)Listen to an event fired when a confidence does not have a confidence typevoidonMissingConfidenceValue(FileSourceContext context)Listen to an event fired when a confidence does not have a valuevoidonMissingCvTermName(CvTerm term, FileSourceContext context, String message)Listen to an event fired when a CvTerm is read and does not have any names.voidonMissingExpansionId(MitabCvTerm expansion)onMissingExpansionId.voidonMissingInteractorIdentifierColumns(int line, int column, int mitabColumn)onMissingInteractorIdentifierColumns.voidonMissingInteractorName(Interactor interactor, FileSourceContext context)Listen to an event fired when an interactor is read and does not have any names.voidonMissingParameterType(FileSourceContext context)Listen to an event fired when a parameter does not have a typevoidonMissingParameterValue(FileSourceContext context)Listen to an event fired when a parameter does not have a valuevoidonParticipantWithoutInteractor(Participant participant, FileSourceContext context)Listen to en event fired when a Participant is read and no interactor details has been provided.voidonSeveralCreatedDateFound(Collection<MitabDate> dates)onSeveralCreatedDateFound.voidonSeveralCvTermsFound(Collection<MitabCvTerm> terms, FileSourceContext context, String message)Listen to an event where several CvTerms were found and only one was expected.voidonSeveralFirstAuthorFound(Collection<MitabAuthor> authors)onSeveralFirstAuthorFound.voidonSeveralHostOrganismFound(Collection<MitabOrganism> organisms, FileSourceContext context)Listen to an event where several host organisms were found in a single experiment and only one was expected.voidonSeveralOrganismFound(Collection<MitabOrganism> organisms)onSeveralOrganismFound.voidonSeveralSourceFound(Collection<MitabSource> sources)onSeveralSourceFound.voidonSeveralStoichiometryFound(Collection<MitabStoichiometry> stoichiometry)onSeveralStoichiometryFound.voidonSeveralUniqueIdentifiers(Collection<MitabXref> ids)onSeveralUniqueIdentifiers.voidonSeveralUpdatedDateFound(Collection<MitabDate> dates)onSeveralUpdatedDateFound.voidonSyntaxWarning(FileSourceContext context, String message)Listen to an event fired when the syntax of the file is valid but the content is not expected or some information may be lost.voidonTextFoundInConfidence(MitabConfidence conf)onTextFoundInConfidence.voidonTextFoundInIdentifier(MitabXref xref)onTextFoundInIdentifier.voidonXrefWithoutDatabase(FileSourceContext context)Listen to an event fired when a xref does not have a databasevoidonXrefWithoutId(FileSourceContext context)Listen to an event fired when a xref does not have an idvoidreset()reset.protected voidsetDelegate(MitabStreamSource delegate)Setter for the fielddelegate.voidsetFileParserListener(MIFileParserListener listener)setFileParserListenerbooleanvalidateSyntax()validateSyntax.booleanvalidateSyntax(MIFileParserListener listener)Validate the syntax of this MIFileDataSource and uses the provided MIFileParserListener to listen to the events.
-
-
-
Method Detail
-
getInteractionsIterator
public Iterator<Interaction> getInteractionsIterator() throws MIIOException
getInteractionsIterator.
- Specified by:
getInteractionsIteratorin interfaceInteractionStream- Returns:
- a
Iteratorobject. - Throws:
MIIOException- if any.
-
getFileParserListener
public MIFileParserListener getFileParserListener()
getFileParserListener.
- Specified by:
getFileParserListenerin interfaceMIFileDataSource- Returns:
- a
MIFileParserListenerobject.
-
setFileParserListener
public void setFileParserListener(MIFileParserListener listener)
setFileParserListener
- Specified by:
setFileParserListenerin interfaceMIFileDataSource- Parameters:
listener- aMIFileParserListenerobject.
-
validateSyntax
public boolean validateSyntax() throws MIIOExceptionvalidateSyntax.
- Specified by:
validateSyntaxin interfaceMIFileDataSource- Returns:
- a boolean.
- Throws:
MIIOException- if any.
-
validateSyntax
public boolean validateSyntax(MIFileParserListener listener) throws MIIOException
Validate the syntax of this MIFileDataSource and uses the provided MIFileParserListener to listen to the events. The provided listener will be set as the MIFileParserListener of this datasource- Specified by:
validateSyntaxin interfaceMIFileDataSource- Parameters:
listener- : the listener for parsing events- Returns:
- true if the file syntax is valid
- Throws:
MIIOException- : if some severe syntax errors are found in the file and it stops the parsing
-
initialiseContext
public void initialiseContext(Map<String,Object> options)
Initialise the context of the MIDataSource given a map of options- Specified by:
initialiseContextin interfaceMIDataSource- Parameters:
options- : the options provided by the user
-
initialiseDelegate
protected void initialiseDelegate(Map<String,Object> options, MitabDataSourceFactory factory, InteractionCategory category, ComplexType type)
initialiseDelegate.
- Parameters:
options- aMapobject.factory- aMitabDataSourceFactoryobject.category- aInteractionCategoryobject.type- aComplexTypeobject.
-
close
public void close() throws MIIOExceptionclose.
- Specified by:
closein interfaceMIDataSource- Throws:
MIIOException- if any.
-
reset
public void reset() throws MIIOExceptionreset.
- Specified by:
resetin interfaceMIDataSource- Throws:
MIIOException- if any.
-
onTextFoundInIdentifier
public void onTextFoundInIdentifier(MitabXref xref)
onTextFoundInIdentifier.
- Specified by:
onTextFoundInIdentifierin interfaceMitabParserListener- Parameters:
xref- aMitabXrefobject.
-
onTextFoundInConfidence
public void onTextFoundInConfidence(MitabConfidence conf)
onTextFoundInConfidence.
- Specified by:
onTextFoundInConfidencein interfaceMitabParserListener- Parameters:
conf- aMitabConfidenceobject.
-
onMissingExpansionId
public void onMissingExpansionId(MitabCvTerm expansion)
onMissingExpansionId.
- Specified by:
onMissingExpansionIdin interfaceMitabParserListener- Parameters:
expansion- aMitabCvTermobject.
-
onSeveralUniqueIdentifiers
public void onSeveralUniqueIdentifiers(Collection<MitabXref> ids)
onSeveralUniqueIdentifiers.
- Specified by:
onSeveralUniqueIdentifiersin interfaceMitabParserListener- Parameters:
ids- aCollectionobject.
-
onEmptyUniqueIdentifiers
public void onEmptyUniqueIdentifiers(int line, int column, int mitabColumn)onEmptyUniqueIdentifiers.
- Specified by:
onEmptyUniqueIdentifiersin interfaceMitabParserListener- Parameters:
line- a int.column- a int.mitabColumn- a int.
-
onMissingInteractorIdentifierColumns
public void onMissingInteractorIdentifierColumns(int line, int column, int mitabColumn)onMissingInteractorIdentifierColumns.
- Specified by:
onMissingInteractorIdentifierColumnsin interfaceMitabParserListener- Parameters:
line- a int.column- a int.mitabColumn- a int.
-
onSeveralOrganismFound
public void onSeveralOrganismFound(Collection<MitabOrganism> organisms)
onSeveralOrganismFound.
- Specified by:
onSeveralOrganismFoundin interfaceMitabParserListener- Parameters:
organisms- aCollectionobject.
-
onSeveralStoichiometryFound
public void onSeveralStoichiometryFound(Collection<MitabStoichiometry> stoichiometry)
onSeveralStoichiometryFound.
- Specified by:
onSeveralStoichiometryFoundin interfaceMitabParserListener- Parameters:
stoichiometry- aCollectionobject.
-
onSeveralFirstAuthorFound
public void onSeveralFirstAuthorFound(Collection<MitabAuthor> authors)
onSeveralFirstAuthorFound.
- Specified by:
onSeveralFirstAuthorFoundin interfaceMitabParserListener- Parameters:
authors- aCollectionobject.
-
onSeveralSourceFound
public void onSeveralSourceFound(Collection<MitabSource> sources)
onSeveralSourceFound.
- Specified by:
onSeveralSourceFoundin interfaceMitabParserListener- Parameters:
sources- aCollectionobject.
-
onSeveralCreatedDateFound
public void onSeveralCreatedDateFound(Collection<MitabDate> dates)
onSeveralCreatedDateFound.
- Specified by:
onSeveralCreatedDateFoundin interfaceMitabParserListener- Parameters:
dates- aCollectionobject.
-
onSeveralUpdatedDateFound
public void onSeveralUpdatedDateFound(Collection<MitabDate> dates)
onSeveralUpdatedDateFound.
- Specified by:
onSeveralUpdatedDateFoundin interfaceMitabParserListener- Parameters:
dates- aCollectionobject.
-
onAliasWithoutDbSource
public void onAliasWithoutDbSource(MitabAlias alias)
onAliasWithoutDbSource.
- Specified by:
onAliasWithoutDbSourcein interfaceMitabParserListener- Parameters:
alias- aMitabAliasobject.
-
onSeveralCvTermsFound
public void onSeveralCvTermsFound(Collection<MitabCvTerm> terms, FileSourceContext context, String message)
Listen to an event where several CvTerms were found and only one was expected. Can happen when reading a clustered interaction evidence for instance- Specified by:
onSeveralCvTermsFoundin interfaceMitabParserListener- Parameters:
terms- aCollectionobject.context- aFileSourceContextobject.message- aStringobject.
-
onSeveralHostOrganismFound
public void onSeveralHostOrganismFound(Collection<MitabOrganism> organisms, FileSourceContext context)
Listen to an event where several host organisms were found in a single experiment and only one was expected. Can happen when reading a clustered interaction evidence for instance- Specified by:
onSeveralHostOrganismFoundin interfaceMitabParserListener- Parameters:
organisms- aCollectionobject.context- aFileSourceContextobject.
-
onInvalidSyntax
public void onInvalidSyntax(FileSourceContext context, Exception e)
Listen to an invalid syntax causing an Exception- Specified by:
onInvalidSyntaxin interfaceMIFileParserListener- Parameters:
context- : file contexte- aExceptionobject.
-
onSyntaxWarning
public void onSyntaxWarning(FileSourceContext context, String message)
Listen to an event fired when the syntax of the file is valid but the content is not expected or some information may be lost.- Specified by:
onSyntaxWarningin interfaceMIFileParserListener- Parameters:
context- : file contextmessage- : warning message
-
onMissingCvTermName
public void onMissingCvTermName(CvTerm term, FileSourceContext context, String message)
Listen to an event fired when a CvTerm is read and does not have any names. At least a shortname is expected for each CvTerm so such a term may be loaded with an automatically generated shortname.- Specified by:
onMissingCvTermNamein interfaceMIFileParserListener- Parameters:
term- : cv without namecontext- : file contextmessage- : error message
-
onMissingInteractorName
public void onMissingInteractorName(Interactor interactor, FileSourceContext context)
Listen to an event fired when an interactor is read and does not have any names. At least a shortname is expected for each interactor so such an interactor may be loaded with an automatically generated shortname.- Specified by:
onMissingInteractorNamein interfaceMIFileParserListener- Parameters:
interactor- : interactor without namecontext- : file context
-
onParticipantWithoutInteractor
public void onParticipantWithoutInteractor(Participant participant, FileSourceContext context)
Listen to en event fired when a Participant is read and no interactor details has been provided. In such a case, the interactor can be automatically generated as an unknown interactor- Specified by:
onParticipantWithoutInteractorin interfaceMIFileParserListener- Parameters:
participant- : participant without interactorcontext- : file context
-
onInteractionWithoutParticipants
public void onInteractionWithoutParticipants(Interaction interaction, FileSourceContext context)
Listen to an event fired when an interaction is read and does not have any participants. The interaction may be loaded as an empty interaction.- Specified by:
onInteractionWithoutParticipantsin interfaceMIFileParserListener- Parameters:
interaction- : interaction without participantscontext- : file context
-
onInvalidOrganismTaxid
public void onInvalidOrganismTaxid(String taxid, FileSourceContext context)
Listen to an event fired when an organism does not have a valid taxid (positive integer or -1, -2, -3, -4, -5)- Specified by:
onInvalidOrganismTaxidin interfaceMIFileParserListener- Parameters:
taxid- : invalid taxidcontext- : file context
-
onMissingParameterValue
public void onMissingParameterValue(FileSourceContext context)
Listen to an event fired when a parameter does not have a value- Specified by:
onMissingParameterValuein interfaceMIFileParserListener- Parameters:
context- : file context
-
onMissingParameterType
public void onMissingParameterType(FileSourceContext context)
Listen to an event fired when a parameter does not have a type- Specified by:
onMissingParameterTypein interfaceMIFileParserListener- Parameters:
context- : file context
-
onMissingConfidenceValue
public void onMissingConfidenceValue(FileSourceContext context)
Listen to an event fired when a confidence does not have a value- Specified by:
onMissingConfidenceValuein interfaceMIFileParserListener- Parameters:
context- : file context
-
onMissingConfidenceType
public void onMissingConfidenceType(FileSourceContext context)
Listen to an event fired when a confidence does not have a confidence type- Specified by:
onMissingConfidenceTypein interfaceMIFileParserListener- Parameters:
context- : file context
-
onMissingChecksumValue
public void onMissingChecksumValue(FileSourceContext context)
Listen to an event fired when a checksum does not have a value- Specified by:
onMissingChecksumValuein interfaceMIFileParserListener- Parameters:
context- : file context
-
onMissingChecksumMethod
public void onMissingChecksumMethod(FileSourceContext context)
Listen to an event fired when a checksum does not have a method- Specified by:
onMissingChecksumMethodin interfaceMIFileParserListener- Parameters:
context- : file context
-
onInvalidPosition
public void onInvalidPosition(String message, FileSourceContext context)
Listen to an event fired when a position is not valid- Specified by:
onInvalidPositionin interfaceMIFileParserListener- Parameters:
message- : error messagecontext- : file context
-
onInvalidRange
public void onInvalidRange(String message, FileSourceContext context)
Listen to an event fired when a range is not valid- Specified by:
onInvalidRangein interfaceMIFileParserListener- Parameters:
message- : error messagecontext- : file context
-
onInvalidStoichiometry
public void onInvalidStoichiometry(String message, FileSourceContext context)
Listen to an event fired when a stoichiometry is not valid- Specified by:
onInvalidStoichiometryin interfaceMIFileParserListener- Parameters:
message- : : error messagecontext- : file context
-
onXrefWithoutDatabase
public void onXrefWithoutDatabase(FileSourceContext context)
Listen to an event fired when a xref does not have a database- Specified by:
onXrefWithoutDatabasein interfaceMIFileParserListener- Parameters:
context- : file context
-
onXrefWithoutId
public void onXrefWithoutId(FileSourceContext context)
Listen to an event fired when a xref does not have an id- Specified by:
onXrefWithoutIdin interfaceMIFileParserListener- Parameters:
context- : file context
-
onAnnotationWithoutTopic
public void onAnnotationWithoutTopic(FileSourceContext context)
Listen to an event fired when an annotation does not have a topic- Specified by:
onAnnotationWithoutTopicin interfaceMIFileParserListener- Parameters:
context- : file context
-
onAliasWithoutName
public void onAliasWithoutName(FileSourceContext context)
Listen to an event fired when an alias does not have a name- Specified by:
onAliasWithoutNamein interfaceMIFileParserListener- Parameters:
context- : file context
-
getDelegate
protected MitabStreamSource getDelegate()
Getter for the field
delegate.- Returns:
- a
MitabStreamSourceobject.
-
setDelegate
protected void setDelegate(MitabStreamSource delegate)
Setter for the field
delegate.- Parameters:
delegate- aMitabStreamSourceobject.
-
-