M
- Molecule type.I
- MarsMetadata type.P
- MoleculeArchiveProperties type.public interface MoleculeArchive<M extends Molecule,I extends MarsMetadata,P extends MoleculeArchiveProperties<M,I>,X extends MoleculeArchiveIndex<M,I>> extends JsonConvertibleRecord
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.
See AbstractMoleculeArchive
for further information.
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 metadata record with the UID given.
|
X |
createIndex()
Create empty MoleculeArchiveIndex.
|
X |
createIndex(com.fasterxml.jackson.core.JsonParser jParser)
Create empty MoleculeArchiveIndex using the JsonParser stream given.
|
I |
createMetadata(com.fasterxml.jackson.core.JsonParser jParser)
Create MarsMetadata record using JsonParser stream.
|
I |
createMetadata(java.lang.String metaUID)
Create empty MarsMetadata record with the metaUID specified.
|
M |
createMolecule()
Create empty Molecule record.
|
M |
createMolecule(com.fasterxml.jackson.core.JsonParser jParser)
Create Molecule record using the JsonParser stream given.
|
M |
createMolecule(java.lang.String UID)
Create empty Molecule record with the UID specified.
|
M |
createMolecule(java.lang.String UID,
MarsTable table)
Create Molecule record using the UID and
MarsTable specified. |
P |
createProperties()
Create empty MoleculeArchiveProperties record.
|
P |
createProperties(com.fasterxml.jackson.core.JsonParser jParser)
Create MoleculeArchiveProperties record using JsonParser stream.
|
void |
deleteMetadatasWithTag(java.lang.String tag)
Removes all metadata records with the tag provided.
|
void |
deleteMoleculesWithTag(java.lang.String tag)
Removes all molecule records with the tag provided.
|
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 metadata record.
|
java.lang.String |
getMetadataTagList(java.lang.String UID)
Comma separated list of tags for the metadata record with the given UID.
|
java.util.Set<java.lang.String> |
getMetadataTagSet(java.lang.String UID)
Tags for the metadata 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 metadata 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 metadata 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.
|
void |
log(java.lang.String str)
Add a log message to all MarsImageMetadata records.
|
void |
logln(java.lang.String str)
Add a log message to all MarsImageMetadata 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 MARSImageMetadata record has a tag.
|
boolean |
moleculeHasNoTags(java.lang.String UID)
Check if a molecule record has no tags.
|
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 multithreaded Molecule stream.
|
java.util.stream.Stream<M> |
parallelMolecules()
Convenience method to retrieve a multithreaded Molecule stream.
|
MoleculeArchiveProperties<M,I> |
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 MarsMetadata 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 in smile format.
|
java.lang.String |
saveAs(java.lang.String url)
Saves MoleculeArchive to the given file destination in smile format.
|
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 and with .json file extensions.
|
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 and with .json file extensions.
|
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 and with .json file extensions.
|
java.io.File |
saveAsVirtualStore(java.io.File virtualDirectory)
Creates the directory given and a virtual store inside.
|
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.
|
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.
|
dumpJSON, fromJSON, getJsonGenerator, getJsonParser, setJsonField, setShowWarnings, toJSON
void rebuildIndexes() throws java.io.IOException
java.io.IOException
- if something goes wrong saving the indexes.void rebuildIndexes(int nThreads) throws java.io.IOException
nThreads
- The thread count.java.io.IOException
- if something goes wrong saving the indexes.void save() throws java.io.IOException
java.io.IOException
- if something goes wrong saving the data.java.io.File saveAs(java.io.File file) throws java.io.IOException
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.java.lang.String saveAs(java.lang.String url) throws java.io.IOException
url
- a yama file destination. If the .yama is not present it will be
added.java.io.IOException
- if something goes wrong saving the data.java.io.File saveAsJson(java.io.File file) throws java.io.IOException
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.java.lang.String saveAsJson(java.lang.String url) throws java.io.IOException
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.java.io.File saveAsVirtualStore(java.io.File virtualDirectory) throws java.io.IOException
virtualDirectory
- a directory destination for the virtual store.java.io.IOException
- if something goes wrong creating the virtual store.java.lang.String saveAsVirtualStore(java.lang.String url) throws java.io.IOException
url
- the destination for the virtual store.java.io.IOException
- if something goes wrong creating the virtual store.java.lang.String saveAsVirtualStore(java.lang.String url, int nThreads) throws java.io.IOException
url
- the destination for the virtual store.nThreads
- The thread count.java.io.IOException
- if something goes wrong creating the virtual store.java.io.File saveAsVirtualStore(java.io.File virtualDirectory, int nThreads) throws java.io.IOException
virtualDirectory
- a directory destination for the virtual store.nThreads
- The thread count.java.io.IOException
- if something goes wrong creating the virtual store.java.io.File saveAsJsonVirtualStore(java.io.File virtualDirectory) throws java.io.IOException
virtualDirectory
- a directory destination for the virtual store.java.io.IOException
- if something goes wrong creating the virtual store.java.lang.String saveAsJsonVirtualStore(java.lang.String url) throws java.io.IOException
url
- the destination for the virtual store.java.io.IOException
- if something goes wrong creating the virtual store.java.lang.String saveAsJsonVirtualStore(java.lang.String url, int nThreads) throws java.io.IOException
url
- the destination for the virtual store.nThreads
- The thread count.java.io.IOException
- if something goes wrong creating the virtual store.java.io.File saveAsJsonVirtualStore(java.io.File virtualDirectory, int nThreads) throws java.io.IOException
virtualDirectory
- a directory destination for the virtual store.nThreads
- The thread count.java.io.IOException
- if something goes wrong creating the virtual store.void put(M molecule)
molecule
- a record to add or update.void putMetadata(I metadata)
metadata
- a metadata record to add or update.void removeMetadata(java.lang.String metaUID)
metaUID
- the UID of the metadata record to remove.void removeMetadata(I meta)
meta
- metadata record to remove.I getMetadata(int index)
index
- The index of the MarsMetadata record to retrieve.I getMetadata(java.lang.String metaUID)
metaUID
- The UID of the metadata record to retrieve.java.util.List<java.lang.String> getMetadataUIDs()
int getNumberOfMolecules()
int getNumberOfMetadatas()
java.lang.String getComments()
void setComments(java.lang.String comments)
comments
- A string of global comments to set.boolean isVirtual()
void remove(java.lang.String UID)
UID
- The UID of the molecule record to remove.void remove(M molecule)
molecule
- The molecule record to remove.java.util.List<java.lang.String> getMoleculeUIDs()
java.lang.String getTagList(java.lang.String UID)
UID
- The UID of the molecule to retrieve the tag list for.java.util.Set<java.lang.String> getTagSet(java.lang.String UID)
UID
- The UID of the molecule to retrieve the tag set for.int getChannel(java.lang.String UID)
UID
- The UID of the molecule to retrieve the channel of.int getImage(java.lang.String UID)
UID
- The UID of the molecule to retrieve the image index of.java.lang.String getMetadataTagList(java.lang.String UID)
UID
- The UID of the metadata record to retrieve the tag list for.java.util.Set<java.lang.String> getMetadataTagSet(java.lang.String UID)
UID
- The UID of the metadata record to retrieve the tag list for.MoleculeArchiveSource getSource()
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)
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.boolean moleculeHasTag(java.lang.String UID, java.lang.String tag)
UID
- The UID of the molecule to check for the tag.tag
- The tag to check for.boolean moleculeHasTags(java.lang.String UID)
UID
- The UID of the molecule to check.boolean moleculeHasNoTags(java.lang.String UID)
UID
- The UID of the molecule to check.void addMoleculeTags(java.util.Map<java.lang.String,java.lang.String> tagMap)
tagMap
- The UID to tag map for add to molecules.java.util.Set<java.lang.String> moleculeTags(java.lang.String UID)
UID
- The UID of the molecule to retrieve the tags of.boolean metadataHasTag(java.lang.String UID, java.lang.String tag)
UID
- The UID of the MARSImageMetadata record to check for the tag.tag
- The tag to check for.void deleteMoleculesWithTag(java.lang.String tag)
tag
- Molecule records with this tag will be removed.void deleteMetadatasWithTag(java.lang.String tag)
tag
- metadata records with this tag will be removed.boolean contains(java.lang.String UID)
UID
- Check for a molecule record with this UID.boolean containsMetadata(java.lang.String UID)
UID
- Check for a metadata record with this UID.M get(java.lang.String UID)
UID
- The UID of the record to retrieve.M get(int index)
index
- The integer index position of the molecule record.java.util.stream.Stream<M> molecules()
java.util.stream.Stream<I> metadata()
java.util.stream.Stream<I> parallelMetadata()
java.util.stream.Stream<M> parallelMolecules()
java.lang.String getMetadataUIDforMolecule(java.lang.String UID)
UID
- The UID of the molecule to get the metadata UID for.void setName(java.lang.String name)
name
- The new name of the archive.java.lang.String getName()
MoleculeArchiveWindow getWindow()
void setWindow(MoleculeArchiveWindow win)
win
- Set the MoleculeArchiveWindow that contains this archive.void log(java.lang.String str)
str
- The String message to add to all MarsMetadata logs.void logln(java.lang.String str)
str
- The String message to add to all MarsImageMetadata logs.X createIndex()
X createIndex(com.fasterxml.jackson.core.JsonParser jParser) throws java.io.IOException
jParser
- JsonParser to use to create the MoleculeArchiveIndex.java.io.IOException
- Thrown if unable to read Json from JsonParser stream.MoleculeArchiveProperties<M,I> properties()
MoleculeArchiveProperties
which contain general information
about the archive. This includes numbers of records, comments, and global
lists of table columns, tags, and parameters.MoleculeArchiveProperties
for the
MoleculeArchive
.P createProperties()
P createProperties(com.fasterxml.jackson.core.JsonParser jParser) throws java.io.IOException
jParser
- JsonParser to use to create archive properties.java.io.IOException
- Thrown if unable to read Json from JsonParser stream.I createMetadata(com.fasterxml.jackson.core.JsonParser jParser) throws java.io.IOException
jParser
- JsonParser to use to create metadata.java.io.IOException
- Thrown if unable to read Json from JsonParser stream.I createMetadata(java.lang.String metaUID)
metaUID
- The metaUID to use during creation of the empty MarsMetadata
record.M createMolecule()
M createMolecule(com.fasterxml.jackson.core.JsonParser jParser) throws java.io.IOException
jParser
- JsonParser to use to create the molecule.java.io.IOException
- Thrown if unable to read Json from JsonParser stream.M createMolecule(java.lang.String UID)
UID
- The UID to use during creation.