public class OtuUtil extends Object
ParserModule.| Modifier and Type | Class and Description |
|---|---|
static class |
OtuUtil.OtuCountLine
This inner class is used to hold a single line from an OTU count file.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
buildOtuTaxa(String level,
String taxa)
Build taxa name into OTU path, returns: level + "__" + taxa
|
static TreeMap<String,Long> |
compileSampleOtuCounts(File file)
Compile OTU counts from an individual sample OTU count file
|
static TreeSet<String> |
findUniqueOtus(TreeMap<String,TreeMap<String,Long>> sampleOtuCounts)
Find every unique OTU across all samples.
|
static File |
getOtuCountFile(File dir,
String sampleId,
String prefix)
Build OTU count file using a standard format in the directory given.
Format: pipeline_name + prefix + "otuCount" + sampleId + ".tsv" |
static String |
getSampleId(File otuCountFile)
Extract the sampleId from the OTU count file name.
Input files should include a file name just before the .tsv file extension. |
static TreeMap<String,TreeMap<String,Long>> |
getSampleOtuCounts(Collection<File> files)
TreeMap OTU counts for each sample file formatted and named as in
ParserModule output. |
static boolean |
isOtuFile(File file)
Check the file name and contents to determine if file is an OTU count file.
|
public static String buildOtuTaxa(String level, String taxa)
level - Taxonomy leveltaxa - Taxa namepublic static TreeMap<String,Long> compileSampleOtuCounts(File file) throws OtuFileException, FileNotFoundException, IOException
file - OTU count fileOtuFileException - If the file is not formatted as an OTU file.IOException - if unable to parse the input fileFileNotFoundException - if the file path is not found in the file systempublic static TreeSet<String> findUniqueOtus(TreeMap<String,TreeMap<String,Long>> sampleOtuCounts)
sampleOtuCounts - TreeMap(SampleId, TreeMap(OTU, count)) OTU counts for every samplepublic static File getOtuCountFile(File dir, String sampleId, String prefix)
dir - File directorysampleId - Sample IDprefix - File prefix (after pipeline name)public static String getSampleId(File otuCountFile) throws OtuFileException
otuCountFile - "otuCount" fileOtuFileException - if the OTU count file name is improperly formattedpublic static TreeMap<String,TreeMap<String,Long>> getSampleOtuCounts(Collection<File> files) throws Exception
ParserModule output.files - Collection of OTU count filesException - if any of the input file names are missing "_"otuCount"_"public static boolean isOtuFile(File file)
file - File