public class GenomeFeatureMap
Created by jgw87 on 7/2/14. A map to hold genome features for lookup by name and by location. The features themselves are hierarchical and so can be traced up and down the tree.
As methods are added to return based on different filters, try to unify the results. That is, all filter-like methods should return the same sort of data structure, such as a HashSet of GenomeFeatures. It may be worthwhile to create a custom GenomeFeatureSet class to be able to string such operations together (mygenes = mygenes.ofType("exon").onChrom(1).inRange(1, 10000);), although whether such filters are needed for the bulk of this class's purpose (matching SNPs to genome annotations) is yet to be seen. This class shouldn't be created directly, but should instead use the GenomeFeatureMapBuilder class .build() method
public GenomeFeature getFeatureFromId(java.lang.String id)
public java.util.HashSet<net.maizegenetics.dna.map.GenomeFeature> getFeaturesInRange(java.lang.String chrom,
int start,
int end)
Get a HashSet of s at a specified genome location. Takes chromsome as a String for ones like "Pt", "scaffold487", etc.class GenomeFeature
chrom - The chromosome namestart - Beginning physical positionend - End physical positionHashSet of GenomeFeaturesclass GenomeFeaturepublic java.util.HashSet<net.maizegenetics.dna.map.GenomeFeature> getFeaturesAtLocation(int chrom,
int position)
Get a HashSet of s at a specified genome locationclass GenomeFeature
chrom - Chromosome number (should be the same as its name)position - Physical position (base pair)class GenomeFeaturepublic java.util.HashSet<net.maizegenetics.dna.map.GenomeFeature> getFeaturesAtLocation(java.lang.String chrom,
int position)
Get a HashSet of s at a specified genome location Takes chromsome as a String for ones like "Pt", "scaffold487", etc.class GenomeFeature
chrom - Chromosome nameposition - Physical position (base pair)class GenomeFeaturepublic java.util.HashSet<net.maizegenetics.dna.map.GenomeFeature> getFeaturesInRange(int chrom,
int start,
int end)
Get a HashSet of s at a specified genome location. Takes chromsome as a String for ones like "Pt", "scaffold487", etc.class GenomeFeature
chrom - The chromosome number (should be the same as its name)start - Beginning physical positionend - End physical positionclass GenomeFeaturepublic java.util.HashSet<net.maizegenetics.dna.map.GenomeFeature> getFeaturesOfType(java.lang.String type)
Get all s of a specified typeclass GenomeFeature
type - The type of feature to getHashSet of GenomeFeaturesclass GenomeFeaturepublic void writeLocationLookupToFile(java.lang.String filename)
Write just the location lookup to a tab-delimited file. This is mostly to check that your locations loaded properly, as there is no way to read them back in.
filename - The output file to be written topublic void writeMapAsJsonFile(java.lang.String filename)
Write the map data as a JSON file (which can be read in by ). Core attributes (unique ID, chromosome, start, stop, and parent ID) are output to all features. Any additional attributes are output only for those features that have them. Attributes are output in alphabetical order. Since the attribute name has to be output for every feature, this can waste space if all your features have the same attributes. In that case a tab-delimited flat file or precompiled binary file is probably a better choice.class GenomeFeatureMapBuilder
filename - The output file to be written toclass GenomeFeatureMapBuilderpublic void writeMapAsFlatFile(java.lang.String filename)
Write the map data as a flat, tab-delimited file (which can be read in by ). The writer first compiles a set of all attribute types across the map and sets these as the columns (in alphabetical order). Attributes that don't apply to a given feature are output as "NA". This can end up being very wasteful if you have some attributes that only apply to a small percentage of features; in that case, a JSON or binary file is probably a better choice.class GenomeFeatureMapBuilder
filename - The output file to be written toclass GenomeFeatureMapBuilderpublic void writeMapAsBinaryFile(java.lang.String filename)
Write the map data as a precompiled binary that can be read back in by ). Unlike JSON or flatfile format, this file is not human-readable and is simply a a representation of the Java data structures saved onto a disk. This makes it very compact and fast to read back in. This is the preferred format for long-term storage of a class GenomeFeatureMapBuilder since there is (almost) no risk of someone accidentally modifying the file.class GenomeFeatureMap
filename - The output file to be written toclass GenomeFeatureMapBuilder,
class GenomeFeatureMap