public class TaxaUtil extends Object
OtuUtil
.BuildTaxaTables
.Modifier and Type | Field and Description |
---|---|
static String |
NORMALIZED
File suffix appended to normalized taxa count tables: "norm"
|
protected static String |
TAXA_TABLE
Included in the file name of each file output.
|
Modifier and Type | Method and Description |
---|---|
static List<String> |
allTaxonomyLevels()
Returns a list of all taxonomy levels, not only the levels configured via
Config ."report.taxonomyLevels". |
static String |
bottomTaxaLevel()
Return the bottom configured taxonomy level from
Config ."report.taxonomyLevels" |
static String |
buildUnclassifiedTaxa(String taxa)
Build the name of an unclassified taxa using the given "taxa" parameter.
Returns a name like Unclassified (taxa name) Taxa |
static TreeSet<String> |
findUniqueTaxa(TreeSet<String> otus,
String level)
Extract taxonomy names at the given level from all given OTUs.
|
static TreeMap<String,TreeMap<String,Long>> |
getLevelTaxaCounts(TreeMap<String,TreeMap<String,Long>> sampleOtuCounts,
String level)
Return TreeMap keyed on Sample ID, each sample maps to an inner map(taxa, count).
Input param sampleOtuCounts contains OTUs for which many can share the same level taxonomy assignment. For example if sample42 contained the following 3 OTU values: phylum__Actinobacteria|class__Actinobacteria|order__Actinomycetales|family__Actinomycetaceae|genus__Actinomyces 1000 phylum__Bacteroidetes|class__Bacteroidia|order__Bacteroidales|family__Porphyromonadaceae|genus__Barnesiella 500 phylum__Bacteroidetes|class__Bacteroidia|order__Bacteroidales|family__Porphyromonadaceae|genus__Parabacteroides 77 The phylum level output would contain entries: TreeMap(sample42, TreeMap( Actinobacteria=1000, Bacteroidetes=577 ) ) |
static TreeMap<String,String> |
getTaxaByLevel(String otu)
Return a map of the given otu parameter split by level.
|
static List<String> |
getTaxaLevels()
Method ensures taxonomy levels are returned in descending order from top to bottom.
|
static List<String> |
getTaxaLevelSpan()
Return taxa levels from top to bottom level, including in-between levels not configured as part of
|
static String |
getTaxaName(String otu,
String level)
Extract a taxonomy name at the given level from the given OTU.
|
static File |
getTaxonomyTableFile(File dir,
String level,
String suffix)
Create File object of a taxonomy table at the given level, with the given suffix, in the given directory dir.
|
static String |
getTaxonomyTableLevel(File file)
Extract the table taxonomy level from an existing taxonomy table file.
|
static List<String> |
initTaxaLevels()
Set taxonomy levels ordered by level, from highest to lowest.
|
static boolean |
isLogNormalizedTaxaFile(File file)
Check the file name to determine if it is a Log normalized taxonomy table file.
|
static boolean |
isNormalizedTaxaFile(File file)
Check the file name to determine if it is a normalized taxonomy table file.
|
static boolean |
isTaxaFile(File file)
Check the file name to determine if it is a taxonomy table file.
|
static String |
parentTaxaLevel(String level)
Get parent level name of the given level parameter.
|
static String |
topTaxaLevel()
Return the top configured taxonomy level from
Config ."report.taxonomyLevels" |
public static final String NORMALIZED
protected static final String TAXA_TABLE
public static List<String> allTaxonomyLevels()
Config
."report.taxonomyLevels".public static String bottomTaxaLevel()
Config
."report.taxonomyLevels"public static String buildUnclassifiedTaxa(String taxa)
taxa
- Taxa namepublic static TreeSet<String> findUniqueTaxa(TreeSet<String> otus, String level)
otus
- TreeSet of OTUs in ParserModule
formatlevel
- Config
."report.taxonomyLevels"public static TreeMap<String,TreeMap<String,Long>> getLevelTaxaCounts(TreeMap<String,TreeMap<String,Long>> sampleOtuCounts, String level)
sampleOtuCounts
- TreeMap(sampleId, TreeMap(OTU, count)) OTU counts for every samplelevel
- Config
."report.taxonomyLevels"public static TreeMap<String,String> getTaxaByLevel(String otu)
otu
- OTU path valuepublic static List<String> getTaxaLevels()
public static List<String> getTaxaLevelSpan()
public static String getTaxaName(String otu, String level)
otu
- OTU name in ParserModule
formatlevel
- Config
."report.taxonomyLevels"public static File getTaxonomyTableFile(File dir, String level, String suffix) throws Exception
dir
- Target directorylevel
- Taxonomy levelsuffix
- File suffixException
- if errors occurpublic static String getTaxonomyTableLevel(File file)
file
- File Taxonomy Tablepublic static List<String> initTaxaLevels() throws ConfigNotFoundException, ConfigFormatException
ConfigNotFoundException
- if is undefinedConfigFormatException
- if is defined, but does not contain any
valid taxonomy levelspublic static boolean isLogNormalizedTaxaFile(File file)
file
- File to testpublic static boolean isNormalizedTaxaFile(File file)
file
- File to testpublic static boolean isTaxaFile(File file)
file
- File to testpublic static String parentTaxaLevel(String level)
level
- Taxonomy levelpublic static String topTaxaLevel()
Config
."report.taxonomyLevels"