Class ImportUtilities
- java.lang.Object
-
- com.biomatters.geneious.publicapi.utilities.ImportUtilities
-
public class ImportUtilities extends java.lang.Object
Provides methods for importing documents into Geneious. Other import methods are also available inPluginUtilities
such asPluginUtilities.importDocuments
- Since:
- API 4.40 (Geneious 5.4)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ImportUtilities.ActionWhenInvalid
Specifies what to do when a sequence with invalid bases/residues is encountered during importstatic class
ImportUtilities.ImportDocumentType
whether to import ambiguous files as alignments of sequence lists.static class
ImportUtilities.ImportSource
An enum representing the source of an import.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
importDocuments(java.io.File file, DocumentFileImporter.ImportCallback callback, ImportUtilities.ActionWhenInvalid actionWhenInvalid, ImportUtilities.ImportDocumentType importDocumentType, SequenceDocument.Alphabet alphabet, jebl.util.ProgressListener progressListener)
Imports the given file, using any available importer.static void
importDocuments(java.io.File file, DocumentFileImporter.ImportCallback callback, ImportUtilities.ActionWhenInvalid actionWhenInvalid, ImportUtilities.ImportDocumentType importDocumentType, jebl.util.ProgressListener progressListener)
Imports the given file, using any available importer.static void
importDocuments(java.io.File file, DocumentFileImporter.ImportCallback callback, ImportUtilities.ActionWhenInvalid actionWhenInvalid, jebl.util.ProgressListener progressListener)
static java.util.List<AnnotatedPluginDocument>
importDocuments(java.io.File file, DocumentFileImporter importer, ImportUtilities.ActionWhenInvalid actionWhenInvalid, jebl.util.ProgressListener progressListener)
Imports the given file with a specific importer and default options.static void
importDocuments(java.util.List<java.io.File> files, DocumentFileImporter.ImportCallback callback, ImportUtilities.ActionWhenInvalid actionWhenInvalid, ImportUtilities.ImportDocumentType importDocumentType, SequenceDocument.Alphabet alphabet, jebl.util.ProgressListener progressListener)
Imports the given files, using any available importer.static SequenceAlignmentDocument
importFastaAlignment(java.io.File fastaFile, SequenceDocument.Alphabet alphabet, jebl.util.ProgressListener progressListener)
Imports the given fasta file as a list of aligned sequences, padding the sequences with trailing gaps if necessary.static java.util.List<SequenceDocument>
importFastaSequences(java.io.File fastaFile, SequenceDocument.Alphabet alphabet, jebl.util.ProgressListener progressListener)
Imports the given fasta file as a list of unaligned sequences.
-
-
-
Method Detail
-
importFastaSequences
public static java.util.List<SequenceDocument> importFastaSequences(java.io.File fastaFile, SequenceDocument.Alphabet alphabet, jebl.util.ProgressListener progressListener) throws java.io.IOException, DocumentImportException
Imports the given fasta file as a list of unaligned sequences.- Parameters:
fastaFile
- the fasta file to importalphabet
- the alphabet (either nucleotide or protein) of the file to import. May be null to automatically guess the correct type.progressListener
- a progress listener for reporting progress and allowing the import to be cancelled.- Returns:
- the imported sequences
- Throws:
java.io.IOException
- if there is a problem reading the fileDocumentImportException
- if there is a problem importing the alignment or if the progress listener requests the import be cancelled.
-
importFastaAlignment
public static SequenceAlignmentDocument importFastaAlignment(java.io.File fastaFile, SequenceDocument.Alphabet alphabet, jebl.util.ProgressListener progressListener) throws java.io.IOException, DocumentImportException
Imports the given fasta file as a list of aligned sequences, padding the sequences with trailing gaps if necessary.- Parameters:
fastaFile
- the fasta file to importalphabet
- the alphabet (either nucleotide or protein) of the file to import. May be null to automatically guess the correct type.progressListener
- a progress listener for reporting progress and allowing the import to be cancelled.- Returns:
- the imported alignment
- Throws:
java.io.IOException
- if there is a problem reading the fileDocumentImportException
- if there is a problem importing the alignment or if the progress listener requests the import be cancelled.
-
importDocuments
public static java.util.List<AnnotatedPluginDocument> importDocuments(java.io.File file, DocumentFileImporter importer, ImportUtilities.ActionWhenInvalid actionWhenInvalid, jebl.util.ProgressListener progressListener) throws java.io.IOException, DocumentImportException
Imports the given file with a specific importer and default options. If you need to use non-default options, you will need to call the importer directly.- Parameters:
file
- the file to importimporter
- importer to useactionWhenInvalid
- action to take when a sequence with invalid bases/residues is encountered. Note that usingImportUtilities.ActionWhenInvalid.ImportWithInvalidBases
will cause this method to throw a DocumentImportException on invalid documentsprogressListener
- a progress listener for reporting progress and allowing the import to be cancelled.- Returns:
- the imported documents
- Throws:
java.io.IOException
- if there is a problem reading the fileDocumentImportException
- if there is a problem importing the documents or if the progress listener requests the import be cancelled.
-
importDocuments
public static void importDocuments(java.io.File file, DocumentFileImporter.ImportCallback callback, ImportUtilities.ActionWhenInvalid actionWhenInvalid, jebl.util.ProgressListener progressListener) throws java.io.IOException, DocumentImportException
Equivalent toimportDocuments(file, callback, actionWhenInvalid, ImportDocumentType.AskUser, progressListener)
- Throws:
java.io.IOException
DocumentImportException
-
importDocuments
public static void importDocuments(java.io.File file, DocumentFileImporter.ImportCallback callback, ImportUtilities.ActionWhenInvalid actionWhenInvalid, ImportUtilities.ImportDocumentType importDocumentType, jebl.util.ProgressListener progressListener) throws java.io.IOException, DocumentImportException
Imports the given file, using any available importer. Sequences will be grouped into a sequence list. If the importer used uses options, the default options will be used without any dialogs popping up.- Parameters:
file
- the file to importcallback
- callback to pass imported documents back toactionWhenInvalid
- action to take when a sequence with invalid bases/residues is encounteredprogressListener
- a progress listener for reporting progress and allowing the import to be cancelled.importDocumentType
- whether to import ambiguous files as alignments of sequence lists. For example fasta format that contains ungapped sequences all of which are the same length- Throws:
java.io.IOException
- if there is a problem reading the fileDocumentImportException
- if there is a problem importing the documents or if the progress listener requests the import be cancelled.- Since:
- API 4.710 (Geneious 7.1.0)
-
importDocuments
public static void importDocuments(java.io.File file, DocumentFileImporter.ImportCallback callback, ImportUtilities.ActionWhenInvalid actionWhenInvalid, ImportUtilities.ImportDocumentType importDocumentType, SequenceDocument.Alphabet alphabet, jebl.util.ProgressListener progressListener) throws java.io.IOException, DocumentImportException
Imports the given file, using any available importer. Sequences will be grouped into a sequence list. If the importer used uses options, the default options will be used without any dialogs popping up.- Parameters:
file
- the file to importcallback
- callback to pass imported documents back toactionWhenInvalid
- action to take when a sequence with invalid bases/residues is encounteredprogressListener
- a progress listener for reporting progress and allowing the import to be cancelled.importDocumentType
- whether to import ambiguous files as alignments of sequence lists. For example fasta format that contains ungapped sequences all of which are the same lengthalphabet
- the alphabet to use when the file format is ambiguous (for example fasta format). null indicates auto-detect the format (and potentially prompt the user)- Throws:
java.io.IOException
- if there is a problem reading the fileDocumentImportException
- if there is a problem importing the documents or if the progress listener requests the import be cancelled.- Since:
- API 4.800 (Geneious 8.0.0)
-
importDocuments
public static void importDocuments(java.util.List<java.io.File> files, DocumentFileImporter.ImportCallback callback, ImportUtilities.ActionWhenInvalid actionWhenInvalid, ImportUtilities.ImportDocumentType importDocumentType, SequenceDocument.Alphabet alphabet, jebl.util.ProgressListener progressListener) throws java.io.IOException, DocumentImportException
Imports the given files, using any available importer. Sequences will be grouped into a sequence list. If the importer used uses options, the default options will be used without any dialogs popping up.- Parameters:
files
- the files to importcallback
- callback to pass imported documents back toactionWhenInvalid
- action to take when a sequence with invalid bases/residues is encounteredprogressListener
- a progress listener for reporting progress and allowing the import to be cancelled.importDocumentType
- whether to import ambiguous files as alignments of sequence lists. For example fasta format that contains ungapped sequences all of which are the same lengthalphabet
- the alphabet to use when the file format is ambiguous (for example fasta format). null indicates auto-detect the format (and potentially prompt the user)- Throws:
java.io.IOException
- if there is a problem reading the fileDocumentImportException
- if there is a problem importing the documents or if the progress listener requests the import be cancelled.- Since:
- API 4.202020 (Geneious 2020.2.0)
-
-