M
- Molecule type.I
- MarsMetadata type.P
- MoleculeArchiveProperties type.public abstract class AbstractMoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>> extends AbstractJsonConvertibleRecord implements MoleculeArchive<M,I,P,X>
Molecule
records, which may also contain calculated
parameters, tags, notes, and kinetic change point segments. These records are
assigned a UID string at the time of creation. This string provides universal
molecule uniqueness throughout all datasets. MoleculeArchives contain a
collection of molecule records associated with a given experimental condition
or analysis pipeline.
MarsMetadata
records containing data collection information are also
stored in MoleculeArchives. They are identified using metaUID strings.
Molecule
records associated with a given data collection have a
metaUID string linking them to the correct MarsMetadata
record within
the same MoleculeArchive. Global properties of the MoleculeArchive, including
indexing, comments, etc.., are stored in a MoleculeArchiveProperties
record also contained within the MoleculeArchive.
Multiple MoleculeArchives can easily be merged with all Molecule
records preserving uniqueness due to their UIDs and unique
MarsMetadata
information. After a merge the archive will then have
additional Molecule
records and MarsMetadata
records.
Most Molecule Archive methods support multithreaded applications. threads and get and put records simultaneously. Molecule Archives allows for virtual storage in which molecule and metadata records are stored as individual files within an archive folder. These records are loaded and saved as needed with only a few records residing in memory at any given time.
MoleculeArchives are generated by several Mars commands, including
PeakTrackerCommand
, MoleculeIntegratorMultiViewCommand
and
BuildArchiveFromTableCommand
. Required input for all commands in the
molecule package, including RegionDifferenceCalculatorCommand
,
VarianceCalculatorCommand
, DriftCorrectorCommand
as well as
commands in the kcp package, including KCPCommand
, and
SigmaCalculatorCommand
.
MoleculeArchives can be saved in json (or smile) format as a single file or
in a virtual store using the saveAs(File)
and
saveAsVirtualStore(File)
methods, respectively. These files and
folders will have a .yama extension for Yet Another MoleculeArchive or
.yama.store extension to indicate a virtual store. The files have a json or
smile format with the .yama extension indicating they contain certain
expected field names and value types.
MoleculeArchive of different types can be opened using the
ImportVirtualStoreCommand
. This import command will automatically
detect the type and load the archive in accordingly.
MoleculeArchives can be loaded using the constructors
AbstractMoleculeArchive(File)
or
AbstractMoleculeArchive(String, File)
. Otherwise, MoleculeArchives
can be loaded using the Mars command ImportVirtualStoreCommand
through the GUI or in scripts.
Modifier and Type | Field and Description |
---|---|
protected MoleculeArchiveIndex<M,I> |
archiveIndex
Record index used for virtual archives.
|
protected P |
archiveProperties
Archive properties.
|
protected com.fasterxml.jackson.core.JsonFactory |
jFactory
JsonFactory instance used.
|
protected java.util.concurrent.ConcurrentSkipListMap<java.lang.String,I> |
metadataMap
Map from metadata UID to MarsMetadata object.
|
protected java.util.concurrent.ConcurrentSkipListMap<java.lang.String,M> |
moleculeMap
Map from molecule UID to Molecule object.
|
protected java.lang.String |
name |
protected java.util.concurrent.ConcurrentMap<java.lang.String,java.util.concurrent.locks.ReentrantLock> |
recordLocks
Map from molecule UID to ReentrantLock to ensure thread blocking when
accessing molecule files in virtual mode.
|
protected boolean |
smileEncoding
Encoding.
|
protected MoleculeArchiveSource |
source
The archive IO Source.
|
protected boolean |
virtual
Set to true if working from a virtual store.
|
protected MoleculeArchiveWindow |
win |
Constructor and Description |
---|
AbstractMoleculeArchive(java.io.File file)
Constructor for loading a MoleculeArchive.
|
AbstractMoleculeArchive(MoleculeArchiveSource source)
Constructor for loading a MoleculeArchive from a MoleculeArchiveSource.
|
AbstractMoleculeArchive(java.lang.String name)
Constructor for creating an empty MoleculeArchive.
|
AbstractMoleculeArchive(java.lang.String name,
java.io.File file)
Constructor for loading a MoleculeArchive.
|
AbstractMoleculeArchive(java.lang.String name,
MarsTable table)
Constructor for building a Molecule Archive from a MarsTable.
|
AbstractMoleculeArchive(java.lang.String name,
MarsTable table,
java.lang.String indexColumnName)
Constructor for building a molecule archive from a MarsTable.
|
AbstractMoleculeArchive(java.net.URI uri)
Constructor for loading a MoleculeArchive.
|
Modifier and Type | Method and Description |
---|---|
void |
addMoleculeTags(java.util.Map<java.lang.String,java.lang.String> tagMap)
Add tags to molecules using UID to tag map.
|
boolean |
contains(java.lang.String UID)
Used to check if there is a molecule record with the UID given.
|
boolean |
containsMetadata(java.lang.String UID)
Used to check if there is a MarsMetadata record with the UID given.
|
abstract X |
createIndex()
Create empty MoleculeArchiveIndex.
|
abstract X |
createIndex(com.fasterxml.jackson.core.JsonParser jParser)
Create MoleculeArchiveIndex using JsonParser stream.
|
protected void |
createIOMaps()
Must be implemented in subclasses to define how fields, objects, arrays
should be saved based on the Jackson streaming API.
|
abstract I |
createMetadata(com.fasterxml.jackson.core.JsonParser jParser)
Create MarsMetadata record using JsonParser stream.
|
abstract I |
createMetadata(java.lang.String metaUID)
Create empty MarsMetadata record with the metaUID specified.
|
abstract M |
createMolecule()
Create empty Molecule record.
|
abstract M |
createMolecule(com.fasterxml.jackson.core.JsonParser jParser)
Create Molecule record using the JsonParser stream given.
|
abstract M |
createMolecule(java.lang.String UID)
Create empty Molecule record with the UID specified.
|
abstract M |
createMolecule(java.lang.String UID,
MarsTable table)
Create Molecule record using the UID and
MarsTable specified. |
abstract P |
createProperties()
Create empty MoleculeArchiveProperties record.
|
abstract P |
createProperties(com.fasterxml.jackson.core.JsonParser jParser)
Create MoleculeArchiveProperties record using JsonParser stream.
|
void |
deleteMetadatasWithTag(java.lang.String tag)
Removes all MarsMetadata records with the tag provided.
|
void |
deleteMoleculesWithTag(java.lang.String tag)
Removes all molecule records with the tag provided.
|
protected com.fasterxml.jackson.core.JsonParser |
detectEncoding(java.io.InputStream inputStream) |
M |
get(int index)
Retrieves the molecule record at the provided index.
|
M |
get(java.lang.String UID)
Get the molecule record with the given UID.
|
int |
getChannel(java.lang.String UID)
Channel for the molecule with the given UID.
|
java.lang.String |
getComments()
Global comments.
|
int |
getImage(java.lang.String UID)
Image index for the molecule with the given UID.
|
I |
getMetadata(int index)
Retrieves an MarsMetadata record.
|
I |
getMetadata(java.lang.String metaUID)
Retrieves a MarsMetadata record.
|
java.lang.String |
getMetadataTagList(java.lang.String UID)
Comma separated list of tags for the MarsMetadata record with the given
UID.
|
java.util.Set<java.lang.String> |
getMetadataTagSet(java.lang.String UID)
Tags for the MarsMetadata record with the given UID.
|
java.lang.String |
getMetadataUIDforMolecule(java.lang.String UID)
Get the UID of the metadata for a molecule record.
|
java.util.List<java.lang.String> |
getMetadataUIDs()
Retrieves the list of UIDs of all MarsMetadata records.
|
java.util.List<double[][]> |
getMoleculeBatch(java.util.List<java.lang.String> UIDs,
java.lang.String tColumn,
java.lang.String signalColumn,
int rangeStart,
int rangeEnd,
java.util.List<java.lang.String> tagsToLearn,
int threads)
Utility function to generate batches of molecules data in an optimal format
for machine learning using keras.
|
java.util.List<java.lang.String> |
getMoleculeUIDs()
Retrieves the list of UIDs for all Molecule records.
|
java.lang.String |
getName()
Get the name of the archive.
|
int |
getNumberOfMetadatas()
Number of MarsMetadata records in the MoleculeArchive.
|
int |
getNumberOfMolecules()
Number of molecule records in the MoleculeArchive.
|
MoleculeArchiveSource |
getSource()
MoleculeArchiveSource backing the MoleculeArchive.
|
java.lang.String |
getTagList(java.lang.String UID)
Comma separated list of tags for the molecule with the given UID.
|
java.util.Set<java.lang.String> |
getTagSet(java.lang.String UID)
Tags for the molecule with the given UID.
|
MoleculeArchiveWindow |
getWindow()
Returns the MoleculeArchiveWindow holding this archive, if one exists.
|
boolean |
isVirtual()
True if the archive is virtual, false if not.
|
protected void |
load(MoleculeArchiveSource source) |
protected void |
loadVirtualStore(MoleculeArchiveSource virtualSource) |
void |
log(java.lang.String message)
Add a log message to all metadata records.
|
void |
logln(java.lang.String message)
Add a log message to all metadata records.
|
java.util.stream.Stream<I> |
metadata()
Convenience method to retrieve a metadata stream.
|
boolean |
metadataHasTag(java.lang.String UID,
java.lang.String tag)
Check if a MarsMetadata record has a tag.
|
boolean |
moleculeHasNoTags(java.lang.String UID)
Check if a molecule record has a tag.
|
boolean |
moleculeHasTag(java.lang.String UID,
java.lang.String tag)
Check if a molecule record has a tag.
|
boolean |
moleculeHasTags(java.lang.String UID)
Check if a molecule record has tags.
|
java.util.stream.Stream<M> |
molecules()
Convenience method to retrieve a Molecule stream.
|
java.util.Set<java.lang.String> |
moleculeTags(java.lang.String UID)
Retrieve the list of tags for a molecule.
|
java.util.stream.Stream<I> |
parallelMetadata()
Convenience method to retrieve a metadata stream.
|
java.util.stream.Stream<M> |
parallelMolecules()
Convenience method to retrieve a multithreaded Molecule stream.
|
P |
properties()
Get the
MoleculeArchiveProperties which contain general information
about the archive. |
void |
put(M molecule)
Adds a molecule to the archive.
|
void |
putMetadata(I metadata)
Adds a metadata record to the archive.
|
void |
rebuildIndexes()
Rebuild all indexes by inspecting the contents of store directories.
|
void |
rebuildIndexes(int nThreads)
Rebuild all indexes by inspecting the contents of store directories.
|
void |
remove(M molecule)
Removes the molecule record provided.
|
void |
remove(java.lang.String UID)
Removes the molecule record with the given UID.
|
void |
removeMetadata(I meta)
The Metadata record given is removed from the archive.
|
void |
removeMetadata(java.lang.String metaUID)
The metadata record with the UID given is removed from the archive.
|
void |
save()
Saves the MoleculeArchive to the file from which it was opened.
|
java.io.File |
saveAs(java.io.File file)
Saves MoleculeArchive to the given file destination.
|
java.lang.String |
saveAs(java.lang.String url)
Saves MoleculeArchive to the given file destination.
|
java.io.File |
saveAsJson(java.io.File file)
Saves MoleculeArchive to the given file destination in json format.
|
java.lang.String |
saveAsJson(java.lang.String url)
Saves MoleculeArchive to the given file destination in json format.
|
java.io.File |
saveAsJsonVirtualStore(java.io.File virtualDirectory)
Creates the directory given and a virtual store inside with all files in
json format with .json file extension.
|
java.io.File |
saveAsJsonVirtualStore(java.io.File virtualDirectory,
int nThreads)
Creates the directory given and a virtual store inside with all files in
json format with .json file extension.
|
java.lang.String |
saveAsJsonVirtualStore(java.lang.String url)
Creates the directory given and a virtual store inside with all files in
json format with .json file extension.
|
java.lang.String |
saveAsJsonVirtualStore(java.lang.String url,
int nThreads)
Creates the directory given and a virtual store inside with all files in
json format with .json file extension.
|
java.io.File |
saveAsVirtualStore(java.io.File virtualDirectory)
Creates the directory given and a virtual store inside with all files in
smile format with .sml file extension.
|
java.io.File |
saveAsVirtualStore(java.io.File virtualDirectory,
int nThreads)
Creates the directory given and a virtual store inside with all files in
smile format with .sml file extension.
|
java.lang.String |
saveAsVirtualStore(java.lang.String url)
Creates the directory given and a virtual store inside with all files in
smile format with .sml file extension.
|
java.lang.String |
saveAsVirtualStore(java.lang.String url,
int nThreads)
Creates the directory given and a virtual store inside with all files in
smile format with .sml file extension.
|
protected void |
saveMetadataToSource(MoleculeArchiveSource virtualSource,
I metadata,
com.fasterxml.jackson.core.JsonFactory jFactory)
Saves a MarsMetadata record as a json file.
|
protected void |
saveMoleculeToSource(MoleculeArchiveSource virtualSource,
M molecule,
com.fasterxml.jackson.core.JsonFactory jFactory)
Saves a molecule record as a json file.
|
void |
setComments(java.lang.String comments)
Sets the global comments.
|
void |
setName(java.lang.String name)
Set the name of the archive.
|
void |
setWindow(MoleculeArchiveWindow win)
Set the window containing this archive.
|
java.lang.String |
toString() |
dumpJSON, fromJSON, getJsonGenerator, getJsonParser, setJsonField, setShowWarnings, toJSON
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
dumpJSON, fromJSON, getJsonGenerator, getJsonParser, setJsonField, setShowWarnings, toJSON
protected java.lang.String name
protected MoleculeArchiveWindow win
protected MoleculeArchiveSource source
protected com.fasterxml.jackson.core.JsonFactory jFactory
protected P extends MoleculeArchiveProperties<M,I> archiveProperties
protected MoleculeArchiveIndex<M extends Molecule,I extends MarsMetadata> archiveIndex
protected java.util.concurrent.ConcurrentSkipListMap<java.lang.String,I extends MarsMetadata> metadataMap
protected java.util.concurrent.ConcurrentSkipListMap<java.lang.String,M extends Molecule> moleculeMap
protected java.util.concurrent.ConcurrentMap<java.lang.String,java.util.concurrent.locks.ReentrantLock> recordLocks
protected final boolean virtual
protected boolean smileEncoding
public AbstractMoleculeArchive(java.lang.String name)
name
- The name archive.public AbstractMoleculeArchive(java.io.File file) throws java.io.IOException
file
- The file or directory to load the archive from.java.io.IOException
- if there is a problem with the file location.public AbstractMoleculeArchive(java.net.URI uri) throws java.io.IOException
uri
- The URI to load the archive from.java.io.IOException
- if there is a problem with the file location.public AbstractMoleculeArchive(MoleculeArchiveSource source) throws java.io.IOException
source
- The MoleculeArchiveSource to load the archive from.java.io.IOException
- if there is a problem with the file location.public AbstractMoleculeArchive(java.lang.String name, java.io.File file) throws java.io.IOException
name
- The name of the archive.file
- The file or directory to load the archive from.java.io.IOException
- if there is a problem with the file provided.public AbstractMoleculeArchive(java.lang.String name, MarsTable table)
name
- The name of the archive.table
- A MarsTable to build the archive from.public AbstractMoleculeArchive(java.lang.String name, MarsTable table, java.lang.String indexColumnName)
name
- The name of the archive.table
- A MarsTable to build the archive from.indexColumnName
- Molecule index column.protected com.fasterxml.jackson.core.JsonParser detectEncoding(java.io.InputStream inputStream) throws java.io.IOException
java.io.IOException
protected void loadVirtualStore(MoleculeArchiveSource virtualSource) throws java.io.IOException
java.io.IOException
protected void load(MoleculeArchiveSource source) throws java.io.IOException
java.io.IOException
public void rebuildIndexes() throws java.io.IOException
rebuildIndexes
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
java.io.IOException
- if something goes wrong saving the indexes.public void rebuildIndexes(int nThreads) throws java.io.IOException
rebuildIndexes
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
nThreads
- The thread count.java.io.IOException
- if something goes wrong saving the indexes.public void save() throws java.io.IOException
save
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
java.io.IOException
- if something goes wrong saving the data.public java.io.File saveAs(java.io.File file) throws java.io.IOException
saveAs
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
file
- a yama file destination. If the .yama is not present it will be
added.java.io.IOException
- if something goes wrong saving the data.public java.lang.String saveAs(java.lang.String url) throws java.io.IOException
saveAs
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
url
- a url destination. If the .yama is not present it will be
added.java.io.IOException
- if there is a problem with the source.public java.io.File saveAsJson(java.io.File file) throws java.io.IOException
MoleculeArchive
saveAsJson
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
file
- a yama.json file destination. If the .yama.json is not present
it will be added.java.io.IOException
- if something goes wrong saving the data.public java.lang.String saveAsJson(java.lang.String url) throws java.io.IOException
MoleculeArchive
saveAsJson
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
url
- a yama.json file destination. If the .yama.json is not present
it will be added.java.io.IOException
- if something goes wrong saving the data.protected void createIOMaps()
AbstractJsonConvertibleRecord
createIOMaps
in class AbstractJsonConvertibleRecord
public java.io.File saveAsJsonVirtualStore(java.io.File virtualDirectory) throws java.io.IOException
saveAsJsonVirtualStore
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
virtualDirectory
- a directory destination for the virtual store.java.io.IOException
- if something goes wrong creating the virtual store.public java.lang.String saveAsJsonVirtualStore(java.lang.String url) throws java.io.IOException
saveAsJsonVirtualStore
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
url
- a url destination for the virtual store.java.io.IOException
- if something goes wrong creating the virtual store.public java.lang.String saveAsJsonVirtualStore(java.lang.String url, int nThreads) throws java.io.IOException
saveAsJsonVirtualStore
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
url
- a url destination for the virtual store.nThreads
- The thread count.java.io.IOException
- if something goes wrong creating the virtual store.public java.io.File saveAsJsonVirtualStore(java.io.File virtualDirectory, int nThreads) throws java.io.IOException
saveAsJsonVirtualStore
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
virtualDirectory
- a directory destination for the virtual store.nThreads
- The thread count.java.io.IOException
- if something goes wrong creating the virtual store.public java.io.File saveAsVirtualStore(java.io.File virtualDirectory) throws java.io.IOException
saveAsVirtualStore
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
virtualDirectory
- a directory destination for the virtual store.java.io.IOException
- if something goes wrong creating the virtual store.public java.lang.String saveAsVirtualStore(java.lang.String url) throws java.io.IOException
saveAsVirtualStore
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
url
- the destination for the virtual store.java.io.IOException
- if something goes wrong creating the virtual store.public java.lang.String saveAsVirtualStore(java.lang.String url, int nThreads) throws java.io.IOException
saveAsVirtualStore
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
url
- the destination for the virtual store.nThreads
- The thread count.java.io.IOException
- if something goes wrong creating the virtual store.public java.io.File saveAsVirtualStore(java.io.File virtualDirectory, int nThreads) throws java.io.IOException
saveAsVirtualStore
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
virtualDirectory
- a directory destination for the virtual store.nThreads
- The thread count.java.io.IOException
- if something goes wrong creating the virtual store.public void put(M molecule)
put
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
molecule
- a record to add or update.public void putMetadata(I metadata)
putMetadata
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
metadata
- a metadata record to add or update.public void removeMetadata(java.lang.String metaUID)
removeMetadata
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
metaUID
- the UID of the metadata record to remove.public void removeMetadata(I meta)
removeMetadata
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
meta
- Metadata record to remove.public I getMetadata(int index)
getMetadata
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
index
- The index of the MarsMetadata record to retrieve.public I getMetadata(java.lang.String metaUID)
getMetadata
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
metaUID
- The UID of the MarsMetadata record to retrieve.public final java.util.List<java.lang.String> getMetadataUIDs()
getMetadataUIDs
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
public int getNumberOfMolecules()
getNumberOfMolecules
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
public int getNumberOfMetadatas()
getNumberOfMetadatas
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
public java.lang.String getComments()
getComments
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
public void setComments(java.lang.String comments)
setComments
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
comments
- A string of global comments to set.public boolean isVirtual()
isVirtual
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
public M get(int index)
get
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
index
- The integer index position of the molecule record.public void remove(java.lang.String UID)
remove
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UID
- The UID of the molecule record to remove.public void remove(M molecule)
remove
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
molecule
- The molecule record to remove.public final java.util.List<java.lang.String> getMoleculeUIDs()
getMoleculeUIDs
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
public java.lang.String getTagList(java.lang.String UID)
getTagList
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UID
- The UID of the molecule to retrieve the tag list for.public java.util.Set<java.lang.String> getTagSet(java.lang.String UID)
getTagSet
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UID
- The UID of the molecule to retrieve the tag set for.public int getChannel(java.lang.String UID)
getChannel
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UID
- The UID of the molecule to retrieve the channel of.public int getImage(java.lang.String UID)
getImage
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UID
- The UID of the molecule to retrieve the image index of.public java.lang.String getMetadataTagList(java.lang.String UID)
getMetadataTagList
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UID
- The UID of the MarsMetadata record to retrieve the tag list for.public java.util.Set<java.lang.String> getMetadataTagSet(java.lang.String UID)
getMetadataTagSet
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UID
- The UID of the MarsMetadata record to retrieve the tag list for.public MoleculeArchiveSource getSource()
MoleculeArchive
getSource
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
protected void saveMoleculeToSource(MoleculeArchiveSource virtualSource, M molecule, com.fasterxml.jackson.core.JsonFactory jFactory) throws java.io.IOException
virtualSource
- The source to save the file to.molecule
- The molecule record to save.jFactory
- the JsonFactory to use when saving. Determines if smile or
text encoding is used.java.io.IOException
- if the molecule can't be saved to the file given.protected void saveMetadataToSource(MoleculeArchiveSource virtualSource, I metadata, com.fasterxml.jackson.core.JsonFactory jFactory) throws java.io.IOException
virtualSource
- The source to save the file to.metadata
- The MarsMetadata record to save.jFactory
- the JsonFactory to use when saving. Determines if smile or
text encoding is used.java.io.IOException
- if the MarsMetadata can't be saved to the file given.public java.util.List<double[][]> getMoleculeBatch(java.util.List<java.lang.String> UIDs, java.lang.String tColumn, java.lang.String signalColumn, int rangeStart, int rangeEnd, java.util.List<java.lang.String> tagsToLearn, int threads)
getMoleculeBatch
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UIDs
- The list of UIDs for the molecule to review data from.tColumn
- Name of the T column.signalColumn
- Name of the signal column.rangeStart
- Index of start of range in T column.rangeEnd
- Index of end of range in T column.tagsToLearn
- List of tags to use to build labels.threads
- Number of thread to use when building data.public boolean moleculeHasTag(java.lang.String UID, java.lang.String tag)
moleculeHasTag
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UID
- The UID of the molecule to check for the tag.tag
- The tag to check for.public boolean moleculeHasNoTags(java.lang.String UID)
moleculeHasNoTags
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UID
- The UID of the molecule to check for the tag.public java.util.Set<java.lang.String> moleculeTags(java.lang.String UID)
moleculeTags
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UID
- The UID of the molecule to retrieve the tags of.public boolean moleculeHasTags(java.lang.String UID)
moleculeHasTags
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UID
- The UID of the molecule to check.public boolean metadataHasTag(java.lang.String UID, java.lang.String tag)
metadataHasTag
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UID
- The UID of the MarsMetadata record to check for the tag.tag
- The tag to check for.public void addMoleculeTags(java.util.Map<java.lang.String,java.lang.String> tagMap)
addMoleculeTags
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
tagMap
- The UID to tag map for add to molecules.public void deleteMoleculesWithTag(java.lang.String tag)
deleteMoleculesWithTag
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
tag
- Molecule records with this tag will be removed.public void deleteMetadatasWithTag(java.lang.String tag)
deleteMetadatasWithTag
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
tag
- MarsMetadata records with this tag will be removed.public boolean contains(java.lang.String UID)
contains
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UID
- Check for a molecule record with this UID.public boolean containsMetadata(java.lang.String UID)
containsMetadata
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UID
- Check for a MarsMetadata record with this UID.public M get(java.lang.String UID)
get
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UID
- The UID of the record to retrieve.public java.util.stream.Stream<M> molecules()
molecules
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
public java.util.stream.Stream<I> metadata()
metadata
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
public java.util.stream.Stream<I> parallelMetadata()
parallelMetadata
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
public java.util.stream.Stream<M> parallelMolecules()
parallelMolecules
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
public java.lang.String getMetadataUIDforMolecule(java.lang.String UID)
getMetadataUIDforMolecule
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UID
- The UID of the molecule to get the metadata UID for.public void setName(java.lang.String name)
setName
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
name
- The new name of the archive.public java.lang.String getName()
getName
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
public MoleculeArchiveWindow getWindow()
getWindow
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
public void setWindow(MoleculeArchiveWindow win)
setWindow
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
win
- Set the MoleculeArchiveWindow that contains this archive.public void logln(java.lang.String message)
logln
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
message
- The String message to add to all metadata logs.public void log(java.lang.String message)
log
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
message
- The String message to add to all metadata logs.public P properties()
MoleculeArchiveProperties
which contain general information
about the archive. This includes numbers of records, comments, file
locations, and global lists of table columns, tags, and parameters.properties
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
MoleculeArchiveProperties
for this
AbstractMoleculeArchive
.public abstract X createIndex()
createIndex
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
public abstract X createIndex(com.fasterxml.jackson.core.JsonParser jParser) throws java.io.IOException
createIndex
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
jParser
- JsonParser to use to create the MoleculeArchiveIndex.java.io.IOException
- Thrown if unable to read Json from JsonParser stream.public abstract P createProperties()
createProperties
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
public abstract P createProperties(com.fasterxml.jackson.core.JsonParser jParser) throws java.io.IOException
createProperties
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
jParser
- JsonParser to use to create archive properties.java.io.IOException
- Thrown if unable to read Json from JsonParser stream.public abstract I createMetadata(com.fasterxml.jackson.core.JsonParser jParser) throws java.io.IOException
createMetadata
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
jParser
- JsonParser to use to create metadata.java.io.IOException
- Thrown if unable to read Json from JsonParser stream.public abstract I createMetadata(java.lang.String metaUID)
createMetadata
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
metaUID
- The metaUID to use during creation of the empty MarsMetadata
record.public abstract M createMolecule()
createMolecule
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
public abstract M createMolecule(com.fasterxml.jackson.core.JsonParser jParser) throws java.io.IOException
createMolecule
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
jParser
- JsonParser to use to create the molecule.java.io.IOException
- Thrown if unable to read Json from JsonParser stream.public abstract M createMolecule(java.lang.String UID)
createMolecule
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UID
- The UID to use during creation.public abstract M createMolecule(java.lang.String UID, MarsTable table)
MarsTable
specified.createMolecule
in interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>>
UID
- The UID to use during molecule creation.table
- The MarsTable set as the DataTable during creation.public java.lang.String toString()
toString
in class java.lang.Object