Search in sources :

Example 1 with SequenceProviderFactory

use of com.milaboratory.core.sequence.provider.SequenceProviderFactory in project repseqio by repseqio.

the class AbstractRAFastaResolver method resolve.

@Override
public CachedSequenceProvider<NucleotideSequence> resolve(final SequenceAddress address) {
    final URI uri = address.getUri();
    CachedSequenceProvider<NucleotideSequence> provider = records.get(uri);
    if (provider == null) {
        final String recordId = resolveRecordId(uri);
        records.put(uri, provider = new CachedSequenceProvider<>(NucleotideSequence.ALPHABET, SequenceProviderUtils.lazyProvider(new SequenceProviderFactory<NucleotideSequence>() {

            @Override
            public SequenceProvider<NucleotideSequence> create() {
                RandomAccessFastaReader<NucleotideSequence> fasta = resolveReader(address);
                return fasta.getSequenceProvider(recordId);
            }
        })));
    }
    return provider;
}
Also used : NucleotideSequence(com.milaboratory.core.sequence.NucleotideSequence) CachedSequenceProvider(com.milaboratory.core.sequence.provider.CachedSequenceProvider) URI(java.net.URI) SequenceProviderFactory(com.milaboratory.core.sequence.provider.SequenceProviderFactory)

Aggregations

NucleotideSequence (com.milaboratory.core.sequence.NucleotideSequence)1 CachedSequenceProvider (com.milaboratory.core.sequence.provider.CachedSequenceProvider)1 SequenceProviderFactory (com.milaboratory.core.sequence.provider.SequenceProviderFactory)1 URI (java.net.URI)1