Class ReferenceSource

  • All Implemented Interfaces:
    CRAMReferenceSource

    public class ReferenceSource
    extends Object
    implements CRAMReferenceSource
    Used to represent a CRAM reference, the backing source for which can either be a file or the EBI ENA reference service. NOTE: In a future release, this class will be renamed and the functionality it contains will be refactored and distributed into one or more separate reference source implementations, each corresponding to the type of resource backing the reference.
    • Constructor Detail

      • ReferenceSource

        public ReferenceSource​(File file)
      • ReferenceSource

        public ReferenceSource​(Path path)
    • Method Detail

      • getDefaultCRAMReferenceSource

        public static CRAMReferenceSource getDefaultCRAMReferenceSource()
        Attempts to construct a default CRAMReferenceSource for use with CRAM files when one has not been explicitly provided.
        Returns:
        CRAMReferenceSource if one can be acquired. Guaranteed to not be null if none of the listed exceptions is thrown.
        Throws:
        IllegalStateException - if no default reference source can be acquired
        IllegalArgumentException - if the reference_fasta environment variable refers to a a file that doesn't exist

        Construct a default reference source to use when an explicit reference has not been provided by checking for fallback sources in this order:

        • Defaults.REFERENCE_FASTA - the value of the system property "reference_fasta". If set, must refer to a valid reference file.
        • ENA Reference Service if it is enabled
      • clearCache

        public void clearCache()
      • getReferenceBases

        public byte[] getReferenceBases​(SAMSequenceRecord record,
                                        boolean tryNameVariants)
        Description copied from interface: CRAMReferenceSource
        getReferenceBases
        Specified by:
        getReferenceBases in interface CRAMReferenceSource
        Parameters:
        record - the SAMSequenceRecord identifying the reference being requested
        tryNameVariants - if true, attempt to match the requested sequence name against the reference by using common name variations, such as adding or removing a leading "chr" prefix from the requested name. if false, use exact match
        Returns:
        the upper cased, normalized (see Utils.normalizeBase(byte)) bases representing the requested sequence, or null if the sequence cannot be found
      • getDownloadTriesBeforeFailing

        public int getDownloadTriesBeforeFailing()
      • setDownloadTriesBeforeFailing

        public void setDownloadTriesBeforeFailing​(int downloadTriesBeforeFailing)