All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.broadinstitute.gatk.nativebindings.smithwaterman.SWAlignerNativeBinding Maven / Gradle / Ivy

The newest version!
package org.broadinstitute.gatk.nativebindings.smithwaterman;


import org.broadinstitute.gatk.nativebindings.NativeLibrary;

import java.io.Closeable;

/**
 * Provides access to the native kernel of the Smith-Waterman computation.
 * GATK will call {@link #align(byte[], byte[], SWParameters, SWOverhangStrategy)} to perform
 * an alignment.
 *
 * Subclasses may override {@link #close()} if they need to release resources.
 *
 * Only one thread will call methods on any given object of classes that implement this interface.
 */
public interface SWAlignerNativeBinding extends NativeLibrary, Closeable {

    /**
     * Perform a Smith-Waterman alignment of the alt against the reference
     *
     * @param ref byte[] to use as the reference, bytes must correspond to uppercase chars
     * @param alt byte[] to use as the alt, bytes must correspond to uppercase chars
     * @return alignment result
     */
    SWNativeAlignerResult align(byte[] ref, byte[] alt, SWParameters parameters, SWOverhangStrategy overhangStrategy);


    /**
     * Subclasses may optionally implement close in order to release any native resources that they are holding.
     *
     * Behavior of {@link #align(byte[], byte[], SWParameters, SWOverhangStrategy)} must not result in an incorrect alignment
     * but is otherwise undefined.
     *
     * It is good practice for implementations that rely on close to recover resources to fail with {@link IllegalStateException}
     * if {@link #align(byte[], byte[], SWParameters, SWOverhangStrategy)} is called after close.
     *
     */
    @Override
    default void close() {
        //do nothing by default
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy