public class Utils extends Object
| Modifier and Type | Method and Description | 
|---|---|
static TreeMap<String,Integer> | 
computeTupleFrequencies(File[] files,
                       int n)
Loads a FASTA file and returns the n-tuple frequencies of its letters. 
 | 
static TreeMap<String,Integer> | 
computeTupleFrequencies(File file,
                       int n,
                       char[] base)
Loads a FASTA file and returns the n-tuple frequencies of its letters. 
 | 
static TreeMap<String,Integer> | 
computeTupleFrequencies(int n)
Loads a FASTA file and returns the n-tuple frequencies of its letters. 
 | 
static TreeMap<String,Integer> | 
computeTupleFrequencies(int n,
                       char[] base)
Asks the user to select a FASTA file, loads it and returns the n-tuple 
  frequencies of its letters. 
 | 
static String | 
getAsCSVTable(Map<String,Integer> map)
Returns the specified map as a CSV data table string, with data aligned in columns. 
 | 
static String | 
getAsCSVTable(Map<String,Integer> map,
             int minimum)
Returns the specified map as a CSV data table string, with data aligned in columns. 
 | 
protected static String | 
getAsCSVTableRows(Map<String,Integer> map)
Returns the specified map as a CSV data table string, with data aligned in rows. 
 | 
static String | 
getFrequenciesAsHTMLGraph(Map<String,Integer> frequencies)
Returns the frequency distribution of amino acid triplets as HTML graph. 
 | 
static void | 
save(String fileName,
    CharSequence string)
Saves the specified character sequence. 
 | 
static void | 
saveOccurrencesAsText(String fileName,
                     TreeMap<String,Integer> distribution,
                     int frequency)
Saves those occurrences of a frequency distribution which have the specified 
  frequency into a text file. 
 | 
static void | 
saveOccurrencesAsText(String fileName,
                     TreeMap<String,Integer> distribution,
                     int frequency,
                     char[] ignore)
Saves those occurrences of a frequency distribution which have the specified 
  frequency into a text file. 
 | 
static void | 
saveWordFrequenciesAsCSV()
This method asks the user to select a list of files, 
  computes the word frequencies and saves them in a CSV file. 
 | 
static File[] | 
selectFASTAFiles()
Asks the user to select a directory and returns a list of FASTA files. 
 | 
public static String getAsCSVTable(Map<String,Integer> map)
map - the map to be savedpublic static String getAsCSVTable(Map<String,Integer> map, int minimum)
map - the map to be savedminimum - the minimum frequency number to be savedprotected static String getAsCSVTableRows(Map<String,Integer> map)
map - a map of datapublic static String getFrequenciesAsHTMLGraph(Map<String,Integer> frequencies)
frequencies - frequency distributionpublic static TreeMap<String,Integer> computeTupleFrequencies(int n)
n - the tuple sizepublic static TreeMap<String,Integer> computeTupleFrequencies(int n, char[] base)
n - the tuple sizebase - the base alphabet (important for finding zero occurrences)public static File[] selectFASTAFiles()
public static TreeMap<String,Integer> computeTupleFrequencies(File[] files, int n)
files - an array of FASTA filen - the tuple sizepublic static TreeMap<String,Integer> computeTupleFrequencies(File file, int n, char[] base)
file - a FASTA filen - the tuple sizebase - the base alphabet (important for finding zero occurrences)public static void saveOccurrencesAsText(String fileName, TreeMap<String,Integer> distribution, int frequency)
fileName - the file name (without extension) in which the text is storeddistribution - the frequency distributionfrequency - the frequency which filters the occurrencespublic static void saveOccurrencesAsText(String fileName, TreeMap<String,Integer> distribution, int frequency, char[] ignore)
fileName - the file name (without extension) in which the text is storeddistribution - the frequency distributionfrequency - the frequency which filters the occurrencesignore - list of characters to be ignoredpublic static void saveWordFrequenciesAsCSV()
public static void save(String fileName, CharSequence string)
fileName - name of the filestring - a sequence of characters