
org.monarchinitiative.phenol.annotations.assoc.GeneIdentifierLoader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of phenol-annotations Show documentation
Show all versions of phenol-annotations Show documentation
phenol-annotation contains the annotation functionality for ontologies
package org.monarchinitiative.phenol.annotations.assoc;
import org.monarchinitiative.phenol.annotations.formats.GeneIdentifiers;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
/**
* An interface for loading {@link GeneIdentifiers} from various sources.
*/
public interface GeneIdentifierLoader {
/**
* Load {@link GeneIdentifiers} from the provided reader
.
*
* @param reader the reader to read.
* @return gene IDs
*/
GeneIdentifiers load(Reader reader) throws IOException;
/**
* Load {@link GeneIdentifiers} from the input stream using {@link StandardCharsets#UTF_8}.
*
* @param is the input stream to read.
* @return gene IDs.
*/
default GeneIdentifiers load(InputStream is) throws IOException {
return load(new InputStreamReader(is, StandardCharsets.UTF_8));
}
/**
* Load {@link GeneIdentifiers} from the provided path
using {@link StandardCharsets#UTF_8}.
*
* @param path path to the file to read.
* @return gene IDs.
*/
default GeneIdentifiers load(Path path) throws IOException {
try (InputStream is = FileUtils.newInputStream(path)) {
return load(is);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy