Package psidev.psi.mi.jami.tab.io.writer
Class AbstractMitab25BinaryWriter<T extends BinaryInteraction,P extends Participant>
- java.lang.Object
-
- psidev.psi.mi.jami.tab.io.writer.AbstractMitab25BinaryWriter<T,P>
-
- All Implemented Interfaces:
InteractionWriter<T>
- Direct Known Subclasses:
AbstractMitab26BinaryWriter
,LightMitab25BinaryWriter
,Mitab25BinaryEvidenceWriter
,Mitab25BinaryEvidenceWriter
,Mitab25BinaryWriter
,Mitab25ModelledBinaryWriter
,Mitab25ModelledBinaryWriter
public abstract class AbstractMitab25BinaryWriter<T extends BinaryInteraction,P extends Participant> extends Object implements InteractionWriter<T>
Abstract class for BinaryInteraction writer.- Since:
19/06/13
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Constructor Description AbstractMitab25BinaryWriter()
Constructor for AbstractMitab25BinaryWriter.AbstractMitab25BinaryWriter(File file)
Constructor for AbstractMitab25BinaryWriter.AbstractMitab25BinaryWriter(OutputStream output)
Constructor for AbstractMitab25BinaryWriter.AbstractMitab25BinaryWriter(Writer writer)
Constructor for AbstractMitab25BinaryWriter.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
close.void
end()
end.void
flush()
flush.protected MitabColumnFeeder<T,P>
getColumnFeeder()
Getter for the fieldcolumnFeeder
.MitabVersion
getVersion()
Getter for the fieldversion
.protected Writer
getWriter()
Getter for the fieldwriter
.protected boolean
hasStarted()
hasStarted.protected abstract void
initialiseColumnFeeder()
initialiseColumnFeeder.void
initialiseContext(Map<String,Object> options)
Initialise the context of the InteractionWriter given a map of optionsboolean
isWriteHeader()
isWriteHeader.void
reset()
reset.protected void
setColumnFeeder(MitabColumnFeeder<T,P> columnFeeder)
Setter for the fieldcolumnFeeder
.protected void
setStarted(boolean start)
setStarted.protected void
setVersion(MitabVersion version)
Setter for the fieldversion
.void
setWriteHeader(boolean writeHeader)
Setter for the fieldwriteHeader
.void
start()
start.void
write(Collection<? extends T> interactions)
Writes a collection of binary interactions.void
write(Iterator<? extends T> interactions)
Writes Interaction objects using iteratorvoid
write(T interaction)
Writes a binary interaction.protected void
writeBinary(T interaction, P a, P b)
Writes the binary interaction and its participants in MITAB 2.5protected void
writeHeader()
Write the header
-
-
-
Constructor Detail
-
AbstractMitab25BinaryWriter
public AbstractMitab25BinaryWriter()
Constructor for AbstractMitab25BinaryWriter.
-
AbstractMitab25BinaryWriter
public AbstractMitab25BinaryWriter(File file) throws IOException
Constructor for AbstractMitab25BinaryWriter.
- Parameters:
file
- aFile
object.- Throws:
IOException
- if any.
-
AbstractMitab25BinaryWriter
public AbstractMitab25BinaryWriter(OutputStream output)
Constructor for AbstractMitab25BinaryWriter.
- Parameters:
output
- aOutputStream
object.
-
-
Method Detail
-
getVersion
public MitabVersion getVersion()
Getter for the field
version
.- Returns:
- a
MitabVersion
object.
-
isWriteHeader
public boolean isWriteHeader()
isWriteHeader.
- Returns:
- a boolean.
-
setWriteHeader
public void setWriteHeader(boolean writeHeader)
Setter for the field
writeHeader
.- Parameters:
writeHeader
- a boolean.
-
initialiseContext
public void initialiseContext(Map<String,Object> options)
Initialise the context of the InteractionWriter given a map of options- Specified by:
initialiseContext
in interfaceInteractionWriter<T extends BinaryInteraction>
- Parameters:
options
- : the options given by the user
-
end
public void end() throws MIIOException
end.
- Specified by:
end
in interfaceInteractionWriter<T extends BinaryInteraction>
- Throws:
MIIOException
- if any.
-
start
public void start() throws MIIOException
start.
- Specified by:
start
in interfaceInteractionWriter<T extends BinaryInteraction>
- Throws:
MIIOException
- if any.
-
write
public void write(T interaction) throws MIIOException
Writes a binary interaction. Does not write any extended properties from participants, interaction and features This method will write empty columns for interaction detection method, publication author and identifier, source and confidences. It will also ignore experimental roles, host organism, interaction parameters and participant identification methods- Specified by:
write
in interfaceInteractionWriter<T extends BinaryInteraction>
- Parameters:
interaction
- a T object.- Throws:
MIIOException
- if any.
-
write
public void write(Collection<? extends T> interactions) throws MIIOException
Writes a collection of binary interactions. Does not write any extended properties from participants, interaction and features This method will write empty columns for interaction detection method, publication author and identifier, source and confidences. It will also ignore experimental roles, host organism, interaction parameters and participant identification methods- Specified by:
write
in interfaceInteractionWriter<T extends BinaryInteraction>
- Parameters:
interactions
- aCollection
object.- Throws:
MIIOException
- if any.
-
write
public void write(Iterator<? extends T> interactions) throws MIIOException
Writes Interaction objects using iterator- Specified by:
write
in interfaceInteractionWriter<T extends BinaryInteraction>
- Parameters:
interactions
- : the iterator of interactions to write- Throws:
MIIOException
- : if cannot write
-
flush
public void flush() throws MIIOException
flush.
- Specified by:
flush
in interfaceInteractionWriter<T extends BinaryInteraction>
- Throws:
MIIOException
- if any.
-
close
public void close() throws MIIOException
close.
- Specified by:
close
in interfaceInteractionWriter<T extends BinaryInteraction>
- Throws:
MIIOException
- if any.
-
reset
public void reset() throws MIIOException
reset.
- Specified by:
reset
in interfaceInteractionWriter<T extends BinaryInteraction>
- Throws:
MIIOException
- if any.
-
getColumnFeeder
protected MitabColumnFeeder<T,P> getColumnFeeder()
Getter for the field
columnFeeder
.- Returns:
- a
MitabColumnFeeder
object.
-
setColumnFeeder
protected void setColumnFeeder(MitabColumnFeeder<T,P> columnFeeder)
Setter for the field
columnFeeder
.- Parameters:
columnFeeder
- aMitabColumnFeeder
object.
-
initialiseColumnFeeder
protected abstract void initialiseColumnFeeder()
initialiseColumnFeeder.
-
writeBinary
protected void writeBinary(T interaction, P a, P b) throws IOException
Writes the binary interaction and its participants in MITAB 2.5- Parameters:
interaction
- a T object.a
- a P object.b
- a P object.- Throws:
IOException
- if any.
-
writeHeader
protected void writeHeader() throws IOException
Write the header- Throws:
IOException
- if any.
-
setVersion
protected void setVersion(MitabVersion version)
Setter for the field
version
.- Parameters:
version
- aMitabVersion
object.
-
hasStarted
protected boolean hasStarted()
hasStarted.
- Returns:
- a boolean.
-
setStarted
protected void setStarted(boolean start)
setStarted.
- Parameters:
start
- a boolean.
-
-