Class CsvNaryEvidenceSource
- java.lang.Object
-
- psidev.psi.mi.jami.crosslink.extension.datasource.CsvNaryEvidenceSource
-
- All Implemented Interfaces:
CsvSource<InteractionEvidence>
,CsvStreamSource<InteractionEvidence>
,CsvParserListener
,InteractionEvidenceSource<InteractionEvidence>
,InteractionEvidenceStream<InteractionEvidence>
,InteractionSource<InteractionEvidence>
,InteractionStream<InteractionEvidence>
,MIDataSource
,MIFileDataSource
,MIFileParserListener
public class CsvNaryEvidenceSource extends Object implements CsvSource<InteractionEvidence>
This class is a source that can build a n-ary interaction evidence from a full Crosslink csv file- Since:
27/08/14
- 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 CsvNaryEvidenceSource()
Empty constructor for the factoryCsvNaryEvidenceSource(File file)
Constructor for CsvNaryEvidenceSource.CsvNaryEvidenceSource(InputStream input)
Constructor for CsvNaryEvidenceSource.CsvNaryEvidenceSource(Reader reader)
Constructor for CsvNaryEvidenceSource.CsvNaryEvidenceSource(URL url)
Constructor for CsvNaryEvidenceSource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
buildNaryInteraction()
buildNaryInteraction.void
close()
close.MIFileParserListener
getFileParserListener()
getFileParserListener.Collection<InteractionEvidence>
getInteractions()
getInteractions.Iterator<InteractionEvidence>
getInteractionsIterator()
getInteractionsIterator.long
getNumberOfInteractions()
getNumberOfInteractions.void
initialiseContext(Map<String,Object> options)
Initialise the context of the MIDataSource given a map of optionsvoid
onAliasWithoutName(FileSourceContext context)
Listen to an event fired when an alias does not have a namevoid
onAnnotationWithoutTopic(FileSourceContext context)
Listen to an event fired when an annotation does not have a topicvoid
onInteractionWithoutParticipants(Interaction interaction, FileSourceContext context)
Listen to an event fired when an interaction is read and does not have any participants.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)void
onInvalidPosition(String message, FileSourceContext context)
Listen to an event fired when a position is not validvoid
onInvalidProteinIdentifierSyntax(String[] identifiers, int lineNumber, int columnNumber)
Event fired when we don't find protein xrefs with db|uniprotId|namevoid
onInvalidRange(String message, FileSourceContext context)
Listen to an event fired when a range is not validvoid
onInvalidStoichiometry(String message, FileSourceContext context)
Listen to an event fired when a stoichiometry is not validvoid
onInvalidSyntax(FileSourceContext context, Exception e)
Listen to an invalid syntax causing an Exceptionvoid
onMismatchBetweenPeptideAndLinkedPositions(List<CsvRange> peptidePositions, List<CsvRange> linkedPositions)
Event fired when the number of peptide positions is greater than one and is not the same as the number of linked positionsvoid
onMismatchBetweenRangePositionsAndProteins(List<CsvRange> rangePositions, List<CsvProtein> proteins)
Event fired when the number of range positions is superior to 1 and the number of proteins is also superior to 1 but does not match the number of rangesvoid
onMissingChecksumMethod(FileSourceContext context)
Listen to an event fired when a checksum does not have a methodvoid
onMissingChecksumValue(FileSourceContext context)
Listen to an event fired when a checksum does not have a valuevoid
onMissingConfidenceType(FileSourceContext context)
Listen to an event fired when a confidence does not have a confidence typevoid
onMissingConfidenceValue(FileSourceContext context)
Listen to an event fired when a confidence does not have a valuevoid
onMissingCvTermName(CvTerm term, FileSourceContext context, String message)
Listen to an event fired when a CvTerm is read and does not have any names.void
onMissingInteractorName(Interactor interactor, FileSourceContext context)
Listen to an event fired when an interactor is read and does not have any names.void
onMissingParameterType(FileSourceContext context)
Listen to an event fired when a parameter does not have a typevoid
onMissingParameterValue(FileSourceContext context)
Listen to an event fired when a parameter does not have a valuevoid
onMissingProtein1Column(int lineNumber)
Event fired when the column Protein1 is missing or emptyvoid
onParticipantWithoutInteractor(Participant participant, FileSourceContext context)
Listen to en event fired when a Participant is read and no interactor details has been provided.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.void
onXrefWithoutDatabase(FileSourceContext context)
Listen to an event fired when a xref does not have a databasevoid
onXrefWithoutId(FileSourceContext context)
Listen to an event fired when a xref does not have an idprotected void
processBinaryInteraction(BinaryInteractionEvidence binary)
processBinaryInteraction.void
reset()
reset.void
setFileParserListener(MIFileParserListener listener)
setFileParserListenerboolean
validateSyntax()
validateSyntax.boolean
validateSyntax(MIFileParserListener listener)
Validate the syntax of this MIFileDataSource and uses the provided MIFileParserListener to listen to the events.
-
-
-
Constructor Detail
-
CsvNaryEvidenceSource
public CsvNaryEvidenceSource()
Empty constructor for the factory
-
CsvNaryEvidenceSource
public CsvNaryEvidenceSource(File file) throws IOException
Constructor for CsvNaryEvidenceSource.
- Parameters:
file
- aFile
object.- Throws:
IOException
- if any.
-
CsvNaryEvidenceSource
public CsvNaryEvidenceSource(InputStream input)
Constructor for CsvNaryEvidenceSource.
- Parameters:
input
- aInputStream
object.
-
CsvNaryEvidenceSource
public CsvNaryEvidenceSource(Reader reader)
Constructor for CsvNaryEvidenceSource.
- Parameters:
reader
- aReader
object.
-
-
Method Detail
-
onMismatchBetweenPeptideAndLinkedPositions
public void onMismatchBetweenPeptideAndLinkedPositions(List<CsvRange> peptidePositions, List<CsvRange> linkedPositions)
Event fired when the number of peptide positions is greater than one and is not the same as the number of linked positions- Specified by:
onMismatchBetweenPeptideAndLinkedPositions
in interfaceCsvParserListener
- Parameters:
peptidePositions
- : peptide positions in protein sequencelinkedPositions
- : linked feature positions relative to peptide positions
-
onMismatchBetweenRangePositionsAndProteins
public void onMismatchBetweenRangePositionsAndProteins(List<CsvRange> rangePositions, List<CsvProtein> proteins)
Event fired when the number of range positions is superior to 1 and the number of proteins is also superior to 1 but does not match the number of ranges- Specified by:
onMismatchBetweenRangePositionsAndProteins
in interfaceCsvParserListener
- Parameters:
rangePositions
- : feature rangesproteins
- : proteins
-
onInvalidProteinIdentifierSyntax
public void onInvalidProteinIdentifierSyntax(String[] identifiers, int lineNumber, int columnNumber)
Event fired when we don't find protein xrefs with db|uniprotId|name- Specified by:
onInvalidProteinIdentifierSyntax
in interfaceCsvParserListener
- Parameters:
identifiers
- : the identifierslineNumber
- a int.columnNumber
- a int.
-
onMissingProtein1Column
public void onMissingProtein1Column(int lineNumber)
Event fired when the column Protein1 is missing or empty- Specified by:
onMissingProtein1Column
in interfaceCsvParserListener
- Parameters:
lineNumber
- : line number
-
getInteractions
public Collection<InteractionEvidence> getInteractions() throws MIIOException
getInteractions.
- Specified by:
getInteractions
in interfaceInteractionSource<InteractionEvidence>
- Returns:
- a
Collection
object. - Throws:
MIIOException
- if any.
-
getNumberOfInteractions
public long getNumberOfInteractions()
getNumberOfInteractions.
- Specified by:
getNumberOfInteractions
in interfaceInteractionSource<InteractionEvidence>
- Returns:
- a long.
-
getInteractionsIterator
public Iterator<InteractionEvidence> getInteractionsIterator() throws MIIOException
getInteractionsIterator.
- Specified by:
getInteractionsIterator
in interfaceInteractionStream<InteractionEvidence>
- Returns:
- a
Iterator
object. - Throws:
MIIOException
- if any.
-
getFileParserListener
public MIFileParserListener getFileParserListener()
getFileParserListener.
- Specified by:
getFileParserListener
in interfaceMIFileDataSource
- Returns:
- a
MIFileParserListener
object.
-
setFileParserListener
public void setFileParserListener(MIFileParserListener listener)
setFileParserListener
- Specified by:
setFileParserListener
in interfaceMIFileDataSource
- Parameters:
listener
- aMIFileParserListener
object.
-
validateSyntax
public boolean validateSyntax() throws MIIOException
validateSyntax.
- Specified by:
validateSyntax
in 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:
validateSyntax
in 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:
initialiseContext
in interfaceMIDataSource
- Parameters:
options
- : the options provided by the user
-
close
public void close() throws MIIOException
close.
- Specified by:
close
in interfaceMIDataSource
- Throws:
MIIOException
- if any.
-
reset
public void reset() throws MIIOException
reset.
- Specified by:
reset
in interfaceMIDataSource
- Throws:
MIIOException
- if any.
-
onInvalidSyntax
public void onInvalidSyntax(FileSourceContext context, Exception e)
Listen to an invalid syntax causing an Exception- Specified by:
onInvalidSyntax
in interfaceMIFileParserListener
- Parameters:
context
- : file contexte
- aException
object.
-
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:
onSyntaxWarning
in 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:
onMissingCvTermName
in 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:
onMissingInteractorName
in 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:
onParticipantWithoutInteractor
in 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:
onInteractionWithoutParticipants
in 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:
onInvalidOrganismTaxid
in 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:
onMissingParameterValue
in 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:
onMissingParameterType
in 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:
onMissingConfidenceValue
in 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:
onMissingConfidenceType
in 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:
onMissingChecksumValue
in 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:
onMissingChecksumMethod
in 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:
onInvalidPosition
in 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:
onInvalidRange
in 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:
onInvalidStoichiometry
in 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:
onXrefWithoutDatabase
in 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:
onXrefWithoutId
in 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:
onAnnotationWithoutTopic
in 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:
onAliasWithoutName
in interfaceMIFileParserListener
- Parameters:
context
- : file context
-
buildNaryInteraction
protected void buildNaryInteraction()
buildNaryInteraction.
-
processBinaryInteraction
protected void processBinaryInteraction(BinaryInteractionEvidence binary)
processBinaryInteraction.
- Parameters:
binary
- aBinaryInteractionEvidence
object.
-
-