Class Astral


  • public class Astral
    extends java.lang.Object
    Provides programmatic access to ASTRAL representative sets. See the paper by Chandonia et. al. for more information. Example:
     Set<String> astralSet = Astral.getRepresentatives(Astral.AstralSet.NINETY_FIVE_175B);
     
    This class uses a multiton pattern with soft references for caching. In short: the first time you call the above, it will fetch the data from ASTRAL; the second time will (probably) not have to; and the instances can still be garbage-collected if necessary (meaning they don't require heap memory).
    Since:
    3.0.6
    Author:
    dmyerstu
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Astral.AstralSet
      An ASTRAL sequence-identity cutoff with an identifier such as:
    • Constructor Summary

      Constructors 
      Constructor Description
      Astral​(java.lang.String id, java.io.Reader reader)
      Constructs a new Astral object.
      Astral​(java.lang.String id, java.net.URL url)
      Constructs a new Astral object.
      Astral​(Astral.AstralSet cutoff)
      Constructs a new Astral object.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.LinkedHashMap<java.lang.Integer,​java.lang.String> getFailedLines()
      Gets a map describing lines read in the file that weren't understood.
      java.util.Set<java.lang.String> getNames()  
      static java.util.Set<java.lang.String> getRepresentatives​(java.lang.String id)
      Get a list of representatives' names for the specified ASTRAL cutoff.
      static java.util.Set<java.lang.String> getRepresentatives​(Astral.AstralSet cutoff)
      Get a list of representatives' names for the specified ASTRAL cutoff.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Astral

        public Astral​(Astral.AstralSet cutoff)
        Constructs a new Astral object. Generally, client code should prefer calling getRepresentatives(AstralSet) instead. This constructor should only be used when an ASTRAL set not included in Astral(AstralSet) is required.
        Parameters:
        cutoff - The ASTRAL sequence-identity cutoff required
        Throws:
        java.lang.RuntimeException - If the Astral set could not be parsed or accessed for any reason
      • Astral

        public Astral​(java.lang.String id,
                      java.net.URL url)
        Constructs a new Astral object. Generally, client code should prefer calling getRepresentatives(AstralSet) instead. This constructor should only be used when an ASTRAL set not included in Astral(AstralSet) is required.
        Throws:
        java.lang.RuntimeException - If the Astral set could not be parsed or accessed for any reason
      • Astral

        public Astral​(java.lang.String id,
                      java.io.Reader reader)
        Constructs a new Astral object. Generally, client code should prefer calling getRepresentatives(AstralSet) instead. This constructor should only be used when an ASTRAL set not included in Astral(AstralSet) is required.
        Throws:
        java.lang.RuntimeException - If the Astral set could not be parsed or accessed for any reason
    • Method Detail

      • getRepresentatives

        public static java.util.Set<java.lang.String> getRepresentatives​(Astral.AstralSet cutoff)
        Get a list of representatives' names for the specified ASTRAL cutoff.
      • getRepresentatives

        public static java.util.Set<java.lang.String> getRepresentatives​(java.lang.String id)
        Get a list of representatives' names for the specified ASTRAL cutoff.
        Parameters:
        id - An ASTRAL Id, such as 1.75A_95.
      • getNames

        public java.util.Set<java.lang.String> getNames()
        Returns:
        The names of representatives in this ASTRAL set.
      • getFailedLines

        public java.util.LinkedHashMap<java.lang.Integer,​java.lang.String> getFailedLines()
        Gets a map describing lines read in the file that weren't understood.
        Returns:
        A LinkedHashMap mapping line numbers of failures to the lines themselves