Package org.biojava.nbio.structure.scop
Class Astral
- java.lang.Object
-
- org.biojava.nbio.structure.scop.Astral
-
public class Astral extends 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:
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LinkedHashMap<Integer,String>
getFailedLines()
Gets a map describing lines read in the file that weren't understood.Set<String>
getNames()
static Set<String>
getRepresentatives(String id)
Get a list of representatives' names for the specified ASTRAL cutoff.static Set<String>
getRepresentatives(Astral.AstralSet cutoff)
Get a list of representatives' names for the specified ASTRAL cutoff.
-
-
-
Constructor Detail
-
Astral
public Astral(Astral.AstralSet cutoff)
Constructs a new Astral object. Generally, client code should prefer callinggetRepresentatives(AstralSet)
instead. This constructor should only be used when an ASTRAL set not included inAstral(AstralSet)
is required.- Parameters:
cutoff
- The ASTRAL sequence-identity cutoff required- Throws:
RuntimeException
- If the Astral set could not be parsed or accessed for any reason
-
Astral
public Astral(String id, URL url)
Constructs a new Astral object. Generally, client code should prefer callinggetRepresentatives(AstralSet)
instead. This constructor should only be used when an ASTRAL set not included inAstral(AstralSet)
is required.- Throws:
RuntimeException
- If the Astral set could not be parsed or accessed for any reason
-
Astral
public Astral(String id, Reader reader)
Constructs a new Astral object. Generally, client code should prefer callinggetRepresentatives(AstralSet)
instead. This constructor should only be used when an ASTRAL set not included inAstral(AstralSet)
is required.- Throws:
RuntimeException
- If the Astral set could not be parsed or accessed for any reason
-
-
Method Detail
-
getRepresentatives
public static Set<String> getRepresentatives(Astral.AstralSet cutoff)
Get a list of representatives' names for the specified ASTRAL cutoff.
-
getRepresentatives
public static Set<String> getRepresentatives(String id)
Get a list of representatives' names for the specified ASTRAL cutoff.- Parameters:
id
- An ASTRAL Id, such as 1.75A_95.
-
getFailedLines
public LinkedHashMap<Integer,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
-
-