BFQL API

Biofacet SAS

12 May 2017

Generic Classes

Applicative Classes

Support Classes

Functions

Class Descriptions

class Class

class Class extends Object { // methods string getName(); // returns the class name bool isSubclassOf(Class cls [, bool strict = false]); // returns true if the given class is a subclass of the class instance or, if and only if strict is not true, the same class as the class instance Class getSuperclass(); // returns the superclass of this class string hashcode(); // returns the hashcode of the class List<string> getAttributeList([bool include_inheritance = false [, bool scoped_names = false]]); // returns the list of the class attributes; if include_inheritance is set to true, includes also the superclass attributes; if scoped_named is true, the attribute name is prefixed by the class name SortedMap<string,Class> getAttributeMap([bool include_inheritance = false [, bool scoped_names = false]]); // returns a sorted map of the class attributes, each key being the attribute name; if include_inheritance is set to true, includes also the superclass attributes; if scoped_named is true, the attribute name is prefixed by the class name; each value of the map is the class of the attribute List<string> getMethodList([bool include_inheritance = false [, bool scoped_names = false]]); // returns the list of the class methods; if include_inheritance is set to true, includes also the superclass methods; if scoped_named is true, the method name is prefixed by the class name SortedMap<string,List<Class,int,int>> getMethodMap([bool include_inheritance = false [, bool scoped_names = false]]); // returns a sorted map of the class methods, each key being the method name; if include_inheritance is set to true, includes also the superclass methods; if scoped_named is true, the attribute name is prefixed by the class name; each value of the map is a list containing the class of the method, the minimum and the maximum argument count of this method any getAttributeValue(any obj, string attrname); // returns the value of the attribute named attrname of this object obj any newInstance([<constructor_args>]); // constructs a new instance invoking the class constructor with the given arguments any newInstanceArgList(List<any> constructor_arglist); // constructs a new instance invoking the class constructor with the given arguments contained the list static Class newClass(string name, List<string> attrs, Class parent = NULL, List<string> static_attrs = NULL); // creates a class with the given name, instance attributes, optional parent and static attributes any invokeMethodArgList(any obj, string mthname, List<any> method_arglist); // invokes the instance method named mthname using the given arguments contained in the list on the object obj any invokeMethod(any obj, string mthname [, <method_args>]); // invokes the instance method named mthname using the given arguments on the object obj any invokeStaticMethodArgList(string mthname, List<any> method_arglist); // invokes the static method named mthname using the given arguments contained in the list any invokeStaticMethod(string mthname [, <method_args>]); // invokes the static method named mthname using the given arguments void display(SortedMap<string,string> hints = NULL); // not yet implemented static Class getClassByName(string name); // returns class whose name is given; returns NULL if no class found };

class Object

class Object { // methods Class getClass(); // returns the class of the object int id(); // returns the unique identifier of the object void release(); // release the object; after that call, object cannot be used anymore bool equals(any value); // returns true if the instance is equals to the given argument bool equalsRef(any value); // returns true if the instance is equals by reference to the given argument string serialize(SerializeHints hints = NULL); // returns the serialized string of the object void fserialize(file fd, SerializeHints hints = NULL); // dumps the serialized string of the object in file fd static any unserialize(string str, SerializeHints hints = NULL); // unserializes the given string static any json(string str); // decodes the given json string string json(); // returns the json representation of the object void fjson(file fd); // dumps the json representation of the object in file fd string toString(); // returns the string representation of the object void help(); // displays the class documentation of the object; if object is a string matching a class, function or method name,
// displays the corresponding documentation bool isInteger(); // returns true if the object is an integer bool isBoolean(); // returns true if the object is a boolean bool isDouble(); // returns true if the object is a double bool isCharacter(); // returns true if the object is a character bool isString(); // returns true if the object is a string bool isSeqID(); // returns true if the object is a seqid bool isResID(); // returns true if the object is a resid bool isGroupID(); // returns true if the object is a groupid bool isNull(); // returns true if the object is null List<string> getKeys(string key, bool kwi := false); // returns a List of strings containing all keys of matching key;
// if kwi is true, the =kwi operator is applied instead of an exact match List flattenPathValues($path := ""); // returns a map of path expression keys / values, each key starting with $path List flattenPaths($path := "", $indices := true); // returns a list of path expression keys, each key starting with $path and including list indices or not according to $indices List flatten(); // used to flatten nested lists string convertStringValues(); // convert container items to string recursively void p_print($hints := "", $fd := $::stdout); // pretty print object to file $fd; $hints must be an empty string or a comma separated list of the
// following key values: indent_incr=SIZE, indent_begin=SIZE, align_keys=true|false,
// display_path=true|false, nl_before=true|false, skip_empty=true|false string tojson([$hints := NULL]); // recursively converts object to json };

class Integer

class Integer extends Object { // methods static string setDefaultFormat(string printf_fmt | NULL); // uses the given printf default format when displaying integers (echo operator or string function);
// if argument is NULL, resets format to the built-in default one; returns the previous default format static string getDefaultFormat(); // returns the default printf format for integers, if any; NULL otherwise string format(string printf_fmt | NULL); // formats the integer instance according to the given printf format; if argument is NULL, uses the original built-in default format bool isInteger(); // returns true };

class Boolean

class Boolean extends Object { // methods static string setDefaultFormat(string printf_fmt | NULL); // uses the given printf default format when displaying booleans (echo operator or string function);
// if argument is NULL, resets format to the built-in default one; returns the previous default format static string getDefaultFormat(); // returns the default printf format for booleans, if any; NULL otherwise string format(string printf_fmt | NULL); // formats the boolean instance according to the given printf format; if argument is NULL, uses the original built-in default format bool isBoolean(); // returns true };

class Double

class Double extends Object { // methods static string setDefaultFormat(string printf_fmt | NULL); // uses the given printf default format when displaying doubles (echo operator or string function);
// if argument is NULL, resets format to the built-in default one; returns the previous default format static string getDefaultFormat(); // returns the default printf format for doubles, if any; NULL otherwise string format(string printf_fmt | NULL); // formats the double instance according to the given printf format; if argument is NULL, uses the original built-in default format bool isDouble(); // returns true };

class Character

class Character extends Object { // methods static string setDefaultFormat(string printf_fmt | NULL); // uses the given printf default format when displaying characters (echo operator or string function);
// if argument is NULL, resets format to the built-in default one; returns the previous default format static string getDefaultFormat(); // returns the default printf format for characters, if any; NULL otherwise string format(string printf_fmt | NULL); // formats the character instance according to the given printf format; if argument is NULL, uses the original built-in default format bool isCharacter(); // returns true };

class String

class String extends Object { // methods static string setDefaultFormat(string printf_fmt | NULL); // uses the given printf default format when displaying strings (echo operator or string function);
// if argument is NULL, resets format to the built-in default one; returns the previous default format static string getDefaultFormat(); // returns the default printf format for strings, if any; NULL otherwise string format(string printf_fmt | NULL); // formats the string instance according to the given printf format; if argument is NULL, uses the original built-in default format int size(); // returns the length of the string bool isString(); // returns true string canConvertToInt(); // returns true if the string matches a regular expression convertable to an integer string canConvertToDouble(); // returns true if the string matches a regular expression convertable to a double string tojson([$hints := NULL]); // converts string to json };

class SeqID

class SeqID extends Object { // methods static string setDefaultFormat(string printf_fmt | NULL); // uses the given printf default format when displaying SeqIDs (echo operator or string function);
// if argument is NULL, resets format to the built-in default one; returns the previous default format static string getDefaultFormat(); // returns the default printf format for SeqIDs, if any; NULL otherwise string format(string printf_fmt | NULL); // formats the SeqID instance according to the given printf format; if argument is NULL, uses the original built-in default format bool isSeqID(); // returns true };

class ResID

class ResID extends Object { // methods static string setDefaultFormat(string printf_fmt | NULL); // uses the given printf default format when displaying ResIDs (echo operator or string function);
// if argument is NULL, resets format to the built-in default one; returns the previous default format static string getDefaultFormat(); // returns the default printf format for ResIDs, if any; NULL otherwise string format(string printf_fmt | NULL); // formats the ResID instance according to the given printf format bool isResID(); // returns true };

class GroupID

class GroupID extends Object { // methods static string setDefaultFormat(string printf_fmt | NULL); // uses the given printf default format when displaying GroupIDs (echo operator or string function);
// if argument is NULL, resets format to the built-in default one; returns the previous default format static string getDefaultFormat(); // returns the default printf format for GroupIDs, if any; NULL otherwise string format(string printf_fmt | NULL); // formats the GroupID instance according to the given printf format; if argument is NULL, uses the original built-in default format bool isGroupID(); // returns true };

class Null

class Null extends Object { // methods bool isNull(); // returns true string tojson([$hints := NULL]); // converts null to json };

class File

class File extends Object { };

class List

class List extends Object { // methods List([int size = 0 [, any inival = UNDEFINED]]); // constructs a list of the specified size, initializing each element to inival int size(); // returns the size of the list void append(any value); // appends value to the list void appendAll(List<any> list); // appends all the elements of the given list to the object list void resize(int size [, any inival = UNDEFINED]); // sets the list size to the specified size, initializing each new element to inival void clear(); // remove contents any get(int indice); // returns the value at the index indice void set(int ind, any value); // set value at the index ind bool contains(any value); // returns true if the list contains value List clone(); // returns a clone of the list List sort([function bool less_fun($o1, $o2 [, extra_arg]) = NULL [, any less_fun_extra_arg = NULL]]); // if no arguments given, sorts the list in the natural ascending order; if less_fun is set, sorts the list according to this function; if less_fun_extra_arg is set, this extra argument is added to the call of less_fun; returns the list instance List rsort(); // sorts the list in the natural descending order; returns the list instance List uniq(); // filters adjacent duplicates in the list; returns the list instance bool hasKey(string key, bool kwi := false); // scans List values; if value is a Map, returns true if key is present;
// if value is a List, applied this method to value;
// if kwi is true, the =kwi operator is applied instead of an exact match List<any> convertStringValues(); // convert list items to string recursively any for_each(for_each_fun); // applies for_each_fun(element) to each element of the list; returns for_each_fun(last_element) any for_each_(for_each_fun, arg); // applies for_each_fun(element, arg) to each element of the list; returns for_each_fun(last_element, arg) bool any(any_fun); // returns true is any_fun(element) is true for one element in the list bool any_(any_fun, arg); // returns true is any_fun(element, arg) is true for one element in the list bool every(every_fun); // returns true is every_fun(element) is true for all elements in the list;
// returns false if list is empty bool every_(every_fun, arg); // returns true is every_fun(element, arg) is true for all elements in the list;
// returns false if list is empty bool everyOrEmpty(every_fun); // returns true is every_fun(element) is true for all elements in the list;
// returns true if list is empty bool everyOrEmpty_(every_fun, arg); // returns true is every_fun(element, arg) is true for all elements in the list;
// returns true if list is empty any find(find_fun); // return the first element of list for which find_fun(element) is not false any find_(find_fun, arg); // return the first element of list for which find_fun(element, arg) is not false List<any> findAll(find_fun); // return all elements of the list for which find_fun(element) is not false List<any> findAll_(find_fun, arg); // return all elements of the list for which find_fun(element, arg) is not false List<any> collect(collect_fun); // applies collect_fun(element) to all element of the list and collected returns values
// tinto a list which is returned List<any> collect_(collect_fun, arg); // applies collect_fun(element, arg) to all element of the list and collected returns values
// tinto a list which is returned any min(); // returns the minimal element of the list any max(); // returns the maximal element of the list string tojson([$hints := NULL]); // recursively converts list to json };

class Map

class Map extends Object { // methods Map([List<any> lst]); // constructs a sorted map or a hash map depending of the default map type, and creates a mapping associating each key of the lst elements (if present) and the boolean true bool hasKey(string key, bool kwi := false); // returns true if the Map has the given key; method recursively applied to List and Map values;
// if kwi is true, the =kwi operator is applied instead of an exact match Map<any, any> convertStringValues(); // convert map values to string recursively any for_each(for_each_fun); // applies for_each_fun(key, value) to each key/value of the map; returns for_each_fun(last_key, last_value) any for_each_(for_each_fun, arg); // applies for_each_fun(key, value, arg) to each key/value of the map; returns for_each_fun(last_key, last_value) bool any(any_fun); // returns true is any_fun(key, value) is true for one key/value in the map bool any_(any_fun, arg); // returns true is any_fun(key, value, arg) is true for one key/value in the map bool every(every_fun); // returns true is every_fun(key, value) is true for all key/values in the map;
// returns false if map is empty bool every_(every_fun, arg); // returns true is every_fun(key, value, arg) is true for all key/values in the map;
// returns false if map is empty bool everyOrEmpty(every_fun); // returns true is every_fun(key, value) is true for all key/values in the map;
// returns true if map is empty bool everyOrEmpty_(every_fun, arg); // returns true is every_fun(key, value, arg) is true for all key/values in the map;
// returns true if list is empty any find(find_fun); // return the first key of map for which find_fun(key, value) is not false bool every_(every_fun, arg); // returns true is every_fun(key, value, arg) is true for all key/values in the map;
// returns false if list is empty List<any> findAll(find_fun); // return all keys of the map for which find_fun(key, value) is not false List<any> findAll_(find_fun, arg); // return all keys of the map for which find_fun(key, value, arg) is not false List<any> collect(collect_fun); // applies collect_fun(key, value) to all key/values of the map and collected returns values
// tinto a list which is returned List<any> collect_(collect_fun, arg); // applies collect_fun(key, value, arg) to all key/values of the map and collected returns values
// tinto a list which is returned string tojson([$hints := NULL]); // recursively converts map to json };

class StringBuffer

class StringBuffer extends Object { // methods StringBuffer StringBuffer(string str = ""); // constructs a StringBuffer: empty if no argument, using the specified string if present StringBuffer clone(); // returns a clone of the StringBuffer bool equals(string|StringBuffer arg); // returns true if and only if the string within the StringBuffer instance and the given argument are equals int length(); // returns the length of the StringBuffer int size(); // returns the length of the StringBuffer (identical to StringBuffer::length()) void reverse(); // reverse the StringBuffer string str(); // returns the underlying string of the StringBuffer char charAt(int pos); // returns the character at position #pos in the StringBuffer StringBuffer setCharAt(int pos, char c); // sets the character c at the position #pos in the StringBuffer; returns itself StringBuffer append(string|char|StringBuffer arg); // appends the given argument to the StringBuffer; returns itself StringBuffer truncate(int length); // truncates the StringBuffer to the given length; returns itself StringBuffer replaceAll(string|StringBuffer from, string|StringBuffer by [, int from_pos = 0]); // replaces all occurences of the string 'from' by the string 'by' in the StringBuffer, beginning at the position #from_pos; returns itself StringBuffer replace(int start, int end, string|StringBuffer arg); // replaces the portion of the StringBuffer between start (included) and end (excluded) by arg; returns itself StringBuffer insert(int offset, string|StringBufferchar arg); // inserts the given argument at the position #offset; returns itself StringBuffer delete(int start, int end); // deletes characters from position #start (included) to position #end (excluded) in the reStringBuffer; returns itself int find(string|StringBuffer search, int offset = 0); // returns the position of the first occurence of the string 'search' in the StringBuffer, searching forward from the position #offset int rfind(string|StringBuffer search, int offset = MAXINT); // returns the position of the last occurence of the string 'search' in the StringBuffer, searching backward from the position #offset StringBuffer toLower(); // converts the string in the StringBuffer to lower case; returns itself StringBuffer toUpper(); // converts the string in the StringBuffer to upper case; returns itself StringBuffer substrbuf(int offset, int size = MAXINT); // builds and returns a string buffer starting at position #offset with the given size string substr(int offset, int size = MAXINT); // builds and returns a string starting at position #offset with the given size };

class BinarySearch

class BinarySearch extends Object { // methods protected BinarySearch(int from, int to [, string flags = "upper|lower|closer"]); // constructs a BinarySearch engine; the first two arguments from and to are the inclusive boundaries of the search; the third argument indicates the way to choose the element if the searched value is not found; this constructor can only be called from a subclass int find(any value [, string flags = "upper|lower|closer"]); // returns the indice of the element whose value (given by the method getValue(int indice)) is equals to or near (according to the flags argument in the constructor or to the second argument of this method) the first argument abstract any getValue(int indice); // abstract method, must be overloaded by the subclass; returns the value of the element of the given indice };

class Program

class Program extends Object { // methods static Program getInstance(); // returns the instance of the Program string getCommandLine(); // returns the command line string getName(); // returns the name of the program List<string> getArguments(); // returns all the arguments of the command line List<string> getOptionNames(); // returns the name of the options (arguments starting with dash) bool isOptionSet(string optname); // return true if the given option is set string getOptionValue(string optname); // returns the value of the given option; returns NULL if the option is not set };

class Exception

class Exception extends Object { // methods Exception(string msg, int status = 0); // constructs an exception with the given message and status string getMessage(); // returns the message exception int getStatus(); // returns the status exception string where(); // returns the stack trace void setUserData(any data); // ties a user data to the exception any getUserData(); // returns the user data tied to the exception };

class SortedMap

class SortedMap extends Map { // methods SortedMap([List<any> lst]); // constructs a map and creates a mapping associating each key of the lst elements (if present) and the boolean true static void setDefaultMap(); // sets the default map type to SortedMap static bool isDefaultMap(); // returns true if default map type is SortedMap int size(); // returns the map size List<any> keys(); // returns a list of the map keys List<any> values(); // returns a list of the map values void put(any key, any value); // associates the specified value with the specified key; the value may be of any type; the key may be of any type except range (including collection) any get(any key); // returns the value associated with the specified bool isset(any key); // returns true if the map contains a mapping for the specified key void remove(any key); // returns the mapping for this key (if present) void clear(); // removes all mappings SortedMap clone(); // returns a clone of the map };

class HashMap

class HashMap extends Map { // methods HashMap([List<any> lst]); // constructs a map and creates a mapping associating each key of the lst elements (if present) and the boolean true static void setDefaultMap(); // sets the default map type to HashMap static bool isDefaultMap(); // returns true if default map type is HashMap int size(); // returns the map size List<any> keys(); // returns a list of the map keys List<any> values(); // returns a list of the map values void put(any key, any value); // associates the specified value with the specified key; the value may be of any type; the key may be of any type except range (including collection) any get(any key); // returns the value associated with the specified bool isset(any key); // returns true if the map contains a mapping for the specified key void remove(any key); // returns the mapping for this key (if present) void clear(); // removes all mappings HashMap clone(); // returns a clone of the map };

class Bitmap

class Bitmap extends Object { // methods Bitmap(int size [, int fill = 0]); // constructs a Bitmap of the given size, filling it with 0 by default, or 1 if fill is set to non zero int size(); // returns the size of the Bitmap int count(); // returns the count of bits set in the Bitmap int isset(int pos); // returns 1 if bit is set at the position #pos void set(int pos [, int|bool value = 1]); // sets the bit at position #pos to 1 or to the value if given int flip(int pos); // flips the bit at the position #pos void clear(); // clears the whole bitmap void fill([int value = 1]); // fills the bitmap with 1, or with the value if given Bitmap clone(); // returns a clone of the Bitmap };

class SerializeHints

class SerializeHints extends Object { // methods SerializeHints(); // not yet implemented void setFormat(string format); // not yet implemented void setHeaderOn(bool header_on); // not yet implemented string getFormat(); // not yet implemented void isHeaderOn(); // not yet implemented };

class Range

class Range extends Object { // methods Range([Range range | Collection coll | string filename, [bool ordered = NULL]]); // constructs a range: empty if no argument or if its first argument is equals to NULL, from another range or collection, or read it from filename; if ordered is set to NULL (default), the created range is ordered if and only if the first argument is a Range or a Collection and this Range or Collection is ordered; if ordered is set to false, the created range is not ordered; if ordered is set to true, the created range is ordered int size(); // returns the range size bool isOrdered(); // returns true if range is ordered void setOrdered(bool ordered); // sets the range ordered or not, according to the argument bool isIn(ID id); // returns true if id is present in the range Range add(ID from|Range range [, ID to]); // adds an id or a range to the range; returns itself abstract Range del(ID id|Range range); // abstract method: not implemented for anonymous ranges Range compact(); // compacts the range; returns itself bool isCompacted(); // returns true if the range is compacted Range clone(); // returns a clone of the range SortedMap<string,string> metainfo([int phynum]); // returns a sorted map containing the meta information of the collection Metainfo getMetainfo([int phynum]); // returns an object of class Metainfo containing the meta information of the range abstract void updateMetainfo(Metainfo metainfo [, int phynum]); // abstract method: not implemented for anonymous ranges abstract string date(); // abstract method: not implemented for anonymous ranges string filename(); // returns the filename of the range string type(); // returns "range" bool isAnonymous(); // returns true bool isCollection(); // returns true if the range is a collection Range intersect(Range range); // intersects the range with the specified range; returns itself Range shift(int offset); // shifts each element in the range of the value offset; returns itself void display([string flags="p"|"v"|"z"|"c", [file fd = stdout]]); // displays the range using the given file descriptor, according to flags: p: physical; v: virtual; p: physical; z: physical/virtual if not possible; c: complete (all attributes) string string(); // returns the string representation of the range Range window(int from, int to = from); // returns the #from to #to id in the range int getIntervalCount(); // returns the count of intervals in the range int getIntervalBegin(int indice); // returns the beginning of the interval #indice int getIntervalEnd(int indice); // returns the end of the interval #indice List<string> write(string filename [, List<SeqDB|ResDB> dbs]); // writes the range to the specified file (automatically suffixed by .reg), restricting the projection to the dbs list, if present };

class Collection

class Collection extends Range { // methods Collection([Collection coll|string filename]); // constructs a collection: empty if no argument, from the specified collection if present, or reads it from the specified file Collection complement([bool complement_on_collection = true]); // complements the collection: if the collection is a physical collection, the complement is done on the physical database not on the virtual database; if the database is a collection itself and if complement_on_collection is true (the default) the complement is done on the collection, not on the whole database; returns itself Collection vcomplement(); // complements the collection: the complement is performed on the virtual database even if the collection is a physical collection; returns itself string gname(); // returns the generic name of the collection int phynum(); // returns the number of the physical database if the collection is physical, else returns NULL Range toRange([bool phydb_shift]); // builds a range from the collection; if phydb_shift is true (default) and if the collection is tied to a physical database, the range is shifted of the physical database offset List<Collection> phySplit(); // if the collection is virtual, splits it into a list of physical collections; if the collection is physical, returns a list containing only this collection abstract void printf(string fmt, file fd = $stdout, int win_start = 1, int win_stop = -1); // applies the biofacet printf using the format fmt to the collection; displays output on fd from #win_start to #win_stop abstract string sprintf(string fmt); // applies the biofacet printf using the format fmt to the collection; returns output abstract View group(string criteria); // groups records in the collection according to criteria; returns the view abstract View sort(string criteria [, int proc_count = 1]); // sorts records in the collection according to criteria using proc_count parallel processes; returns the view abstract Collection select(string criteria); // selects records in the collection according to criteria; returns the collection of records bool isAnonymous(); // returns false Collection del(ID id|Collection coll); // suppresses id or coll from the collection; returns itself string date(); // returns a string containing the date of the collection };

class SeqColl

class SeqColl extends Collection { // methods SeqColl(SeqDB seqdb [, Range range]); // constructs a sequence collection tied to seqdb; collection is initialized from range if specified; range cannot be ordered SeqVirtDB seqDB(); // if the collection is virtual, returns the sequence virtual database of the collection; if the collection is physical, returns the sequence virtual database containing this physical database SeqPhyDB seqPhyDB(); // if the collection is physical, returns the physical database of the collection; if the collection is virtual, returns NULL List<SeqPhyDB> seqPhyDBSplit([bool skip_empty_range = false]); // if the collection is physical, returns a list containing only the sequence physical database of the collection; if the collection is virtual, returns a list containing all the sequence databases if skip_empty_range is false, only the sequence databases of the non empty collections if skip_empty_range is true SeqColl warmup(); // warms up the sequence collection by mapping and touching each element SeqColl masterExpand(); // expands the masters in the sequence collection; returns itself SeqColl masterReduce(); // reduces the masters in the sequence collection; returns itself ResColl rescoll(); // works in lspres context only, the sequence collection must be a collection of queries or subjects of the result database; returns the result collection composed of results in which the query (or the subject) belongs to the sequence collection int seqcnt(); // returns the number of sequence records in the collection int residcnt(); // computes and returns the number of residues in the collection int maxseqlen(); // computes and returns the maximum sequence length in the collection int minseqlen(); // computes and returns the minimum sequence length in the collection SeqColl clone(); // returns a clone of the sequence collection string type(); // returns "seqcoll" void updateMetainfo(Metainfo metainfo [, int phynum]); // updates the meta information in the sequence collection; if phynum is given, updates only the physical collection #phynum List<string> write(string filename [, List<SeqDB> dbs [, "ind|"no_ind"]]); // writes the sequence collection to the specified file, restricting the projection to the dbs list, if present void printf(string fmt, file fd = $stdout, int win_start = 1, int win_stop = -1); // applies the biofacet printf using the format fmt to the sequence collection; displays output on fd from #win_start to #win_stop SeqView group(string criteria); // groups sequence records in the collection according to criteria; returns the sequence view SeqView sort(string criteria [, int proc_count = 1]); // sorts sequence records in the collection according to criteria using proc_count parallel processes; returns the sequence view string sprintf(string fmt); // applies the biofacet printf using the format fmt to the sequence collection; returns output SeqColl select(string criteria); // selects records in the sequence collection according to criteria; returns the sequence collection of records Sequence findElement(any value, string seqattrname [, string flags = "upper|lower|closer"]); // returns the first sequence record in the collection whose seqattrname annotation is equals to or "near" (according to the second argument) the given value; as a binary search is used, the collection must be sorted by seqattrname in an ascending mode SeqColl findElements(any minvalue, any maxvalue, string|List<string> seqattrname(s)); // returns all sequence records in the collection whose annotation(s) (given by the second argument) value(s) are between minvalue and maxvalue (inclusive); as a binary search is used, the collection must be sorted by seqattrname annotation(s) in an ascending mode static SeqView mergeSorted(List<SeqColl> sorted_seqcolls, string sort_criteria [, bool check_sorted = true]); // not yet implemented void dump(string filename); // dumps the sequence collection to the given file void vdump(string filename); // vdumps the sequence collection to the given file SeqColl castDB(SeqDB seqdb); // changes the sequence database of the sequence collection; returns itself };

class ResColl

class ResColl extends Collection { // methods ResColl(ResDB resdb [, Range range]); // constructs a result collection tied to resdb; collection is initialized from range if specified; range cannot be ordered ResVirtDB resDB(); // returns the result database tied to the collection ResPhyDB resPhyDB(); // if the result collection is tied to only one physical database, returns this physical database; returns NULL otherwise List<ResPhyDB> resPhyDBSplit([bool skip_empty_ranges = false]); // if skip_empty_ranges is false (the default), returns the list of result physical databases of the database tied to the collection; if skip_empty_ranges is true, returns the list of physical databases in which collection has at least one element int rescnt(); // returns the count of results in the collection SeqColl qcoll(); // returns a sequence collection composed of all the queries of the results elements of the result collection SeqColl scoll(); // returns a sequence collection composed of all the subjects of the results elements of the result collection ResColl clone(); // returns a clone of the result collection string type(); // returns "rescoll" void updateMetainfo(Metainfo metainfo [, int phynum]); // updates the meta information in the result collection; if phynum is given, updates only the physical collection #phynum List<string> write(string filename [, List<ResDB> dbs [, "resinfo"|"no_resinfo"]]); // writes the result collection to the specified file, restricting the projection to the dbs list, if present void printf(string fmt, file fd = $stdout, int win_start = 1, int win_stop = -1); // applies the biofacet printf using the format fmt to the result collection; displays output on fd from #win_start to #win_stop ResView group(string criteria); // groups result records in the collection according to criteria; returns the result view ResView sort(string criteria [, int proc_count = 1]); // sorts result records in the collection according to criteria using proc_count parallel processes; returns the result view string sprintf(string fmt); // applies the biofacet printf using the format fmt to the result collection; returns output ResColl select(string criteria); // selects records in the result collection according to criteria; returns the result collection of records Result findElement(any value, string resattrname [, string flags = "upper|lower|closer"]); // returns the first result record in the collection whose resattrname attribute is equals to or "near" (according to the second argument) the given value; as a binary search is used, the collection must be sorted by resattrname in an ascending mode ResColl findElements(any minvalue, any maxvalue, string|List<string> resattrname(s); // returns all result records in the collection whose attribute(s) (given by the second argument) value(s) are between minvalue and maxvalue (inclusive); as a binary search is used, the collection must be sorted by resattrname attribute(s) in an ascending mode static ResView mergeSorted(List<ResColl> sorted_rescolls, string sort_criteria [, bool check_sorted = true]); // not yet implemented void dump(string filename); // dumps the result collection to the given file void vdump(string filename); // vdumps the result collection to the given file void dumpall(string filename); // not yet implemented ResColl castDB(ResDB resdb); // changes the result database of the result collection; returns itself };

class CollectionList

class CollectionList extends Object { // methods CollectionList(string filename); // constructs a collection list from filename List<Collection> collections(); // returns a list of the collections in the CollectionList object Collection collUnion(); // performs an union of all the collections in the CollectionList void display(); // displays the CollectionList };

class View

class View extends Object { // methods View(); // constructs an empty anonymous View int size(); // returns the number of groups in the view View clone(); // returns a clone of the view View removeGroups(GroupID from [, GroupID to=from]); // remove groups from the GroupID #from to the GroupID #to in the view; returns itself View keepGroups(GroupID from [, GroupID to=from]); // keep groups from the GroupID #from to the GroupID #to in the view; returns itself View mergeGroups([GroupID from, GroupID to]); // if no argument, merge all groups; if arguments specified merge groups from the GroupID #from to the GroupID #to in the view; returns itself View addGroup(Group group|Range range|List<SeqID|ResID> idlist [, GroupID where_id = -1]); // adds the given group, range or list of numeric ID to the view before the position #where_id, at the end if where_id is equals to -1, at the begining if where_id is equals to 1 (even if the group is empty); returns itself bool isTiedToDB(); // returns true if the view is tied to the current database Collection toColl(); // casts the view to a collection Group group(GroupID id); // returns the #id group of the view List<SeqID|ResID> IDList(GroupID id); // returns the #id record ID list of the view abstract void printf(string fmt, file fd = $stdout, int win_start = 1, int win_stop = -1); // applies the biofacet printf using the format fmt to the sequence or result view; displays output on fd from #win_start to #win_stop abstract string sprintf(string fmt); // applies the biofacet printf using the format fmt to the sequence view; returns output void write(string filename); // writes the view to the given file };

class SeqView

class SeqView extends View { // methods SeqView(SeqDB seqdb [, string filename | Range range]); // constructs a sequence view tied to seqdb: view is read from filename or initialized from range if specified; range may be ordered SeqDB seqDB(); // returns the sequence database tied to the sequence view void printf(string fmt, file fd = $stdout); // applies the biofacet printf using the format fmt to the sequence view; displays output on fd string sprintf(string fmt); // applies the biofacet printf using the format fmt to the sequence collection; returns output Sequence findElement(any value, string seqattrname [, string flags = "upper|lower|closer"]); // returns the first sequence record in the view whose seqattrname annotation is equals to or "near" (according to the second argument) the given value; as a binary search is used, the view must be sorted by seqattrname in an ascending mode SeqView findElements(any minvalue, any maxvalue, string|List<string> seqattrname(s)) [, bool flatten_groups = true]); // returns all sequence records in the view whose annotation(s) (given by the second argument) value(s) are between minvalue and maxvalue (inclusive); as a binary search is used, the view must be sorted by seqattrname annotation(s) in an ascending mode static SeqView mergeSorted(List<SeqView> seqviews, string sort_criteria [, bool check_sorted = true]); // not yet implemented void dump(string filename); // dumps the sequence view to the given file SeqView castDB(SeqDB seqdb); // changes the sequence database of the sequence view; returns itself };

class ResView

class ResView extends View { // methods ResView(ResDB resdb [, string filename | Range range]); // constructs a result view tied to seqdb: view is read from filename or initialized from range if specified; range may be ordered ResDB resDB(); // returns the result database tied to the result view void printf(string fmt, file fd = $stdout); // applies the biofacet printf using the format fmt to the result view; displays output on fd string sprintf(string fmt); // applies the biofacet printf using the format fmt to the result view; returns output Result findElement(any value, string resattrname [, string flags = "upper|lower|closer"]); // returns the first result record in the view whose resattrname attribute is equals to or "near" (according to the second argument) the given value; as a binary search is used, the view must be sorted by resattrname in an ascending mode ResView findElements(any minvalue, any maxvalue, string|List<string> resattrname(s) [, bool flatten_groups = true]); // returns all result records in the view whose attribute(s) (given by the second argument) value(s) are between minvalue and maxvalue (inclusive); as a binary search is used, the view must be sorted by resattrname attribute(s) in an ascending mode static ResView mergeSorted(List<ResView> resviews, string sort_criteria [, bool check_sorted = true]); // not yet implemented void dump(string filename); // dumps the result view to the given file void dumpall(string filename); // not yet implemented ResView castDB(ResDB resdb); // changes the result database of the result view; returns itself };

class Metainfo

class Metainfo extends Object { // methods Metainfo Metainfo([SortedMap<string, string> map]); // constructs a Metainfo object; initializes it with the key/values contained in map if given SeqDB SeqDB(); // returns the sequence database tied to the meta information or NULL if no database is tied to it ResDB ResDB(); // returns the result database tied to the meta information or NULL if no database is tied to it int phynum(); // returns the number of the physical database tied to the meta information; in the case of the database is an instance of the class SeqVirtDB or ResVirtDB, -1 is returned IntervalIndex intervalIndex(); // not yet implemented int size(); // returns the number of key/value pairs in the meta information List<string> getKeys([bool include_syskeys = false]); // returns a list of the keys of the meta information; if include_syskeys is set to true, the system meta information keys (starting with biofacet.) are also included List<string> getKeysInNamespace(string namespace); // returns a list of the keys in the given namespace (starting with namespace.) of the meta information List<string> getSystemKeys([string namespace = ""]); // returns a list of the system keys of the meta information abstract string getValue(string key); // returns the value associated with the given key in the metainforation; if key is not associated with any value, NULL is returned void setValue(string key, string value); // associates the given value to the given key in the meta information bool hasKey(string key); // returns true if key is associated with a value in the meta information void clear(); // removes all key/value pairs from the meta information void remove(string key); // removes the value associated with the given key in the meta information; is no value is associated with key, no action is performed SortedMap<string,string> getMap([bool include_syskeys = false]); // returns a sorted map of the key/value pairs of the meta information; if include_syskeys is set to true, the system keys (starting with biofacet.) are also included SortedMap<string,string> getMapWithKeysInNamespace(string namespace); // returns a sorted map of the key/value pairs of the meta information restricted to the keys in the given namespace (starting with namespace.) SortedMap<string,string> getSystemMap([string namespace = ""]); // returns a sorted map of the key/value pairs of the meta information restricted to the system keys (starting with biofacet.) static bool isSystemKey(string key); // returns true if the given key is a system key (starting with biofacet.) };

class FinalObject

class FinalObject extends Object { // attributes Collection coll; // final collection View view; // final view // methods int size(); // returns the FinalObject collection size List<string> write(string filename [, List<SeqDB|ResDB> dbs, ["ind"|"no_ind"|"resinfo"|"no_resinfo"]]); // writes the FinalObject collection to the specified file, restricting the projection to the dbs list, if present SeqColl qcoll(); // returns a sequence collection composed of all the queries of the results elements of the final result collection; available in lspres only SeqColl scoll(); // returns a sequence collection composed of all the subjects of the results elements of the final result collection; available in lspres only };

class SeqFile

class SeqFile extends Object { // methods SeqFile(string filename, string type, string gname, List<string> annots [, string format]); // creates a sequence database in filename using type, gname and the annotation list; encapsulates this database in a SeqFile object void addSeq(SortedMap<string,string>|List<string> annot_values, string sequence); // adds a sequence record to the seqfile; the sequence annotations are described by a sorted map or by a list (in this last case, annotations must be in the same order as the annotations given at the SeqFile construction); the second argument the nucleic or protein sequence of the record int seqcnt(); // returns the current number of sequence records List<string> annots(); // returns the list of annotations given at the object construction void setMetainfo(SortedMap<string,string> metainfo); // sets the meta information in the Sequence File void close([bool exc_if_errors = false]); // writes information in the .ind file and closes the sequence database ied to the seqfile object; if exc_if_errors is set to true, throw an exception if errors have been detected while database building };

class ResFile

class ResFile extends Object { // methods ResFile(string filename, SortedMap map_resfile [[map keys: DBFILED, DBFILEQ, ALGO, RS_NAME, RE_NAME, RP_NAME, MATRIX, MATRIX_TYPE, MATCH_CTRL_EQ, MATCH_CTRL_NOT, CMDLINE, GAPO, GAPE, NGCD, NGCQ]] [, string featureDBFile]); // creates a result database in filename using properties described in map_resfile; associates the featureDBFile if given void addRes(SortedMap map_res [[map keys: ND, OBD, OED, FD, NQ, OBQ, OEQ, FQ, RS, RP, RE, RP1, RP2, RE1, RE2, SCORE, SCSNUC, NBHITS, MAPQ, TLEN, MIDGAP, MIDGPOS, PNEXT, RNEXT, XF0, XF1]] | Result res [, SortedMap map_diff_res]); // adds a result record to the resfile; the result attributes are given either by the SortedMap map_res or by the result record res and the map_diff_res containing only the updated attributes int rescnt(); // returns the number of current result records ResDB resDB(); // returns the result database tied to the resfile object void setMetainfo(SortedMap<string,string> metainfo); // sets the meta information in the Result File SeqFile seqfile(); // returns the seqfile of the feature database void close(); // writes information to the .resinfo file and closes the result database tied to the resfile object };

class Sequence

class Sequence extends Object { // attributes SeqID N; // original sequence number SeqVirtDB seqDB; // virtual database of the sequence SeqPhyDB seqPhyDB; // physical database of the sequence string <annot>; // annotations string s; // sequence int l; // sequence len // methods any annotValue(int an_num|string an [, bool raw = false]); // returns the value of the annotation #an_num or named an; if raw is true, data is returned as it is stored in database List<string> annotValueList(); // returns a list of the annotation values SortedMap<string,string> annotValueMap(); // returns a sorted map of the annotation values string seq([int from [, int size]]); // returns the sequence of this record; the whole sequence if no argument, or a fragment of the sequence if arguments are specified };

class SeqDB

class SeqDB extends Object { // attributes List<string> annots; // annotation list List<string> typedAnnots; // typed annotation list SeqColl coll; // database collection SeqColl workcoll; // working collection SeqColl rangemask; // range option mask int NGC; // genetic code index string GC; // genetic code int NDBTYPE; // sequence db type index string DBTYPE; // sequence db type int NBSEL; // sequence number before reduce int NBSEQS; // sequence number int ONBSEQS; // original sequence number int COLLNBSEQS; // sequence collection number int OCOLLNBSEQS; // original sequence collection number int NBMASTERS; // master count int ONBMASTERS; // original master count int64 NBRESIDS; // residues count int MAXLEN; // max sequence length int NBANNOTS; // annotation count string GNAME; // sequence db generic name string DBFILE; // sequence db file name // methods SeqDB(string filename); // opens the sequence database and constructs a SeqDB object abstract CollectionList collList(); // abstract method implemented in subclasses SortedMap getIndexInfo(); // returns a sorted map describing indexes in database Sequence seq(SeqID seqid); // returns the sequence record #seqid (starting at 1) in the database void strategy_control(preselect|on_the_fly|select_all); // changes the access strategy of the sequence records in the database; expert level method, refer to the Biofacet documentation bool isVirtual(); // returns true if the sequence database is a virtual database bool isPhysical(); // returns true if the sequence database is a physical database abstract SortedMap<string,string> metainfo(); // abstract method: not implemented for abstract SeqDB abstract Metainfo getMetainfo(); // abstract method: not implemented for abstract SeqDB abstract void updateMetainfo(Metainfo metainfo); // abstract method: not implemented for abstract SeqDB void startServer(string name); // starts the given server for this sequence database string getStringCryptoIdent(); // returns the crypto ident string of the sequence database SortedMap<string,string> getCryptoIdent(); // returns a sorted map containing the crypto ident of the sequence database };

class SeqPhyDB

class SeqPhyDB extends SeqDB { // attributes int num; // number in the virtual database int offset; // range offset in the virtual database // methods bool isVirtual(); // returns true if the sequence database is a virtual database bool isPhysical(); // returns true if the sequence database is a physical database SortedMap<string,string> metainfo(); // returns a sorted map containing the meta information of the sequence database void compileAnnots(string annots, string configfile = NULL); // not yet implemented Metainfo getMetainfo(); // returns an object of class Metainfo containing the meta information of the sequence database void updateMetainfo(Metainfo metainfo); // updates the meta information in the physical database CollectionList collList(); // abstract method implemented in subclasses };

class SeqVirtDB

class SeqVirtDB extends SeqDB { // attributes List<SeqPhyDB> seqPhyDBs; // list of physical databases // methods bool isVirtual(); // returns true if the sequence database is a virtual database bool isPhysical(); // returns true if the sequence database is a physical database SortedMap<string,string> metainfo([int phynum]); // returns a sorted map containing the meta information of the sequence database Metainfo getMetainfo([int phynum]); // returns an object of class Metainfo containing the meta information of the sequence database void updateMetainfo(Metainfo metainfo [, int phynum); // updates the meta information in the virtual database; if phynum is given, updates only the physical database #phynum CollectionList collList(); // abstract method implemented in subclasses static SeqVirtDB makeSeqVirtDB(List<SeqDB> seqDBs [, string title = "tempseqdb", [string dbfile = NULL]]); // builds a sequence virtual database from the given list of sequence databases using the given title; if dbfile is NULL (default), creates it in a temporary file which will be immediately deleted };

class Result

class Result extends Object { // attributes ResID ID; // result number ResID OID; // result original number Sequence q; // query sequence Sequence s; // subject sequence List<Map<string, any> > ali; // alignment information Features ft; // features ResVirtDB resDB; // virtual database of the result ResPhyDB resPhyDB; // physical database of the result int FID; // result file number int QID; // query file index int DID; // subject file index int NQ; // query index int ND; // subject index int RS; // result field1 (score,nberr,...) int SCORE; // result score int SCSNUC; // result nucleic score (colorspace only) double RE; // result field2 (E-value,...) double RP; // result field3 (P-value,...) double COV; // hsp coverage over subject int RP1; // result field3 subfield 1 int NBHITS; // number of hits int RP2; // result field3 subfield 2 int RP1.1; // result field3 subfield 1 int RP1.2; // result field3 subfield 1 int RP2.1; // result field3 subfield 2 int RP2.2; // result field3 subfield 2 int MIDGAP; // midgap size int MIDGPOS; // midgap offset in alignment int RP1.1.1; // result field3 subfield 1 int RP1.1.2; // result field3 subfield 1 int RP1.2.1; // result field3 subfield 1 int RP1.2.2; // result field3 subfield 1 int RP2.1.1; // result field3 subfield 2 int RP2.1.2; // result field3 subfield 2 int RP2.2.1; // result field3 subfield 2 int RP2.2.2; // result field3 subfield 2 int RE1; // result field2 subfield 1 int PNEXT; // OBD position of the next read (paired reads mapping) int RE2; // result field2 subfield 2 int RE1.1; // result field2 subfield 1 int RE1.2; // result field2 subfield 1 int RE2.1; // result field2 subfield 2 int TLEN; // insert size (paired reads mapping) int RNEXT; // ND of the reference sequence of the next read (paired reads mapping) int RE2.2; // result field2 subfield 2 int RE1.1.1; // result field2 subfield 1 int RE1.1.2; // result field2 subfield 1 int RE1.2.1; // result field2 subfield 1 int RE1.2.2; // result field2 subfield 1 int RE2.1.1; // result field2 subfield 2 int MAPQ; // phread mapping quality int RE2.1.2; // result field2 subfield 2 int RE2.2.1; // result field2 subfield 2 int RE2.2.2; // result field2 subfield 2 int RL; // alignment length double RM; // perc. positifs over alignment length double RI; // perc. identity over alignment length double RCD; // perc. coverage over subject length double RCQ; // perc. coverage over query length double RID; // perc. identity over subject length double RIQ; // perc. identity over query length double RIG; // perc. identity over shortest of subject, query length double RF; // min_length(query, subject)/alignment length double RZ; // alignment length/min_length(query, subject) int OBQ; // query alignment begin position int OBD; // subject alignment begin position int OEQ; // query alignment end position int OED; // subject alignment end position int OOBQ; // original query alignment begin position int OOBD; // original subject alignment begin position int OOEQ; // original query alignment end position int OOED; // original subject alignment end position int SLQ; // query sequence length int SLD; // subject sequence length int MATC; // alignment match type string SQ; // query sequence string SD; // subject sequence int FQ; // query frame int FD; // subject frame int XF0; // alignment status 0 int XF1; // alignment status 1 int STQ; // query strand int STD; // subject strand string QTALI; // encoded alignment int QTL; // qt alignment length unknown NRA; // non redundant alignment unknown TLD; // tagged subject length compare string GNAMED; // subject generic name int NGNAMED; // subject generic name index string GNAMEQ; // query generic name int NGNAMEQ; // query generic name index int GAPD; // subject gap count int GAPQ; // query gap count // methods bool issetFlagNucOK(); // returns true if the colorspace alignment is succesfully converted to nucleic space bool issetFlagAnchorOK(); // returns true if the colorspace alignment is correctly anchored bool issetFlagNoGap(); // returns true if the alignment is not gapped bool issetFlagStatsClamped(); // returns true if the alignment statistics are saturated bool issetFlagCutLeft(); // returns true if the alignment is local and cut on the left bool issetFlagCutRight(); // returns true if the alignment is local and cut on the right bool issetFlagSecondary(); // returns true if the alignment is secondary bool issetFlagPaired(); // returns true if the alignment was performed from paired reads bool issetFlagNextUnmapped(); // returns true if the mate read of the pair is not mapped bool issetFlagNextReverse(); // returns true if the mate read of the pair is mapped in reverse bool issetFlagNotSameRef(); // returns true if the mate read of the pair maps on a different reference sequence bool issetFlagProperlyPaired(); // returns true if both reads are correctly mapped on the same reference sequence and within expected insert size range bool issetFlagMidgap(); // returns true if the alignment has a large gap in its middle bool isPaired(); // returns true if both reads of the pair were mapped bool isProperlyPaired(); // returns true if both reads are correctly mapped on the same reference sequence and within expected insert size range bool isDiffReference(); // returns true if both reads are mapped but on different reference sequences bool isSingleMate(); // returns true if the read is mapped and the mate read of the pair is not mapped void ali2(List ali); // fills the ali list with the alignment information };

class ResDB

class ResDB extends Object { // attributes ResColl coll; // database collection ResColl workcoll; // working collection SeqVirtDB qdb; // query database SeqVirtDB sdb; // subject database int RESDBCNT; // result database count string RESFILE; // result file name int RESCNT; // result count int ORESCNT; // original result count int COLLCNT; // input collection count int OCOLLCNT; // original input collection count string CMDLINE; // command line // methods ResDB(string filename); // opens the result database and constructs a ResDB object abstract CollectionList collList(); // abstract method implemented in subclasses Result res(ResID resid); // returns the result record #resid (starting at 1) in the database bool isVirtual(); // returns true if the result database is a virtual database bool isPhysical(); // returns true if the result database is a physical database abstract SortedMap<string,string> metainfo(); // abstract method: not implemented for abstract ResDB abstract Metainfo getMetainfo(); // abstract method: not implemented for abstract ResDB abstract void updateMetainfo(Metainfo metainfo); // abstract method: not implemented for abstract ResDB string getStringCryptoIdent(); // returns the crypto ident string of the result database void startServer(string name); // starts the given server for this result database SortedMap<string,string> getCryptoIdent(); // returns a sorted map containing the crypto ident of the result database };

class ResPhyDB

class ResPhyDB extends ResDB { // attributes int num; // number in the virtual database int offset; // range offset in the virtual database FeaturePhyDB ftPhyDB; // feature database string RS_NAME; // RS name string RE_NAME; // RE name string RP_NAME; // RP name string MATCH_CTRL_EQ; // match control equal string MATCH_CTRL_NOT; // match control not int MATRIX_TYPE; // matrix type string MATRIX; // matrix name string ALGO; // algorithm name int GAPO; // gap open penalty int GAPE; // gap extend penalty // methods bool isVirtual(); // returns true if the result database is a virtual database bool isPhysical(); // returns true if the result database is a physical database bool hasExtend(); // returns true if the result database has an extension bool hasAux(); // returns true if the result database has an auxillary extension (QTL) SortedMap<string,string> metainfo(); // returns a sorted map containing the meta information of the result database Metainfo getMetainfo(); // returns an object of class Metainfo containing the meta information of the result database void updateMetainfo(Metainfo metainfo); // updates the meta information in the physical database CollectionList collList(); // abstract method implemented in subclasses void updateFeatureDB(string featuredb_file|SeqDB seqdb); // sets or changes the feature database of the result database to the given filename or sequence database void updateCryptoIdent(); // computes and sets cryptoident in the physical result database if not already set };

class ResVirtDB

class ResVirtDB extends ResDB { // attributes List<ResPhyDB> resPhyDBs; // list of physical databases FeatureVirtDB ftVirtDB; // virtual feature database // methods bool isVirtual(); // returns true if the result database is a virtual database bool isPhysical(); // returns true if the result database is a physical database SortedMap<string,string> metainfo([int phynum]); // returns a sorted map containing the meta information of the result database Metainfo getMetainfo([int phynum]); // returns an object of class Metainfo containing the meta information of the result database void updateMetainfo(Metainfo metainfo [, int phynum]); // updates the meta information in the virtual database; if phynum is given, updates only the physical database #phynum CollectionList collList(); // abstract method implemented in subclasses void updateCryptoIdent([int phynum]); // computes and sets cryptoident in the virtual result database and all tied physical databases when not already set; if phynum is given, updates only the physical database #phynum };

class Features

class Features extends Object { // attributes FeaturePhyDB ftPhyDB; // physical feature database string <annot>; // annotations string aln; // alignment int l; // alignment len };

class FeatureDB

class FeatureDB extends Object { // attributes List<string> annots; // annotation list };

class FeaturePhyDB

class FeaturePhyDB extends FeatureDB { // attributes string dbfile; // database file };

class FeatureVirtDB

class FeatureVirtDB extends FeatureDB { // attributes List<FeaturePhyDB> ftPhyDBs; // list of feature databases };

class Group

class Group extends Object { // attributes int size; // number of elements (Sequence or Result) in the group GroupID NID; // in the filtering and group sorting contexts, number of the group GroupID ONID; // in the filtering context, original number of the group // methods int size(); // returns the size of the group Sequence|Result first(); // returns the first element of the group Sequence|Result last(); // returns the last element of the group Sequence|Result elem(int indice); // returns the #indice (starting at 0) element (Sequence or Result) in the group Collection toColl(); // converts the group to a collection void printf(string fmt, file fd = $stdout, int win_start = 1, int win_stop = -1); // applies the biofacet printf using the format fmt to the sequence or result group; displays output on fd from #win_start to #win_stop void setTag(int tag); // sets the given tag to the group int getTag(); // returns the tag of the group SortedMap<any,any> mapTag(); // returns a reference to the sorted map tag of the group };

class GroupView

class GroupView extends Object { // attributes int size; // number of elements (Sequence or Result) in the groupview // methods Sequence|Result cur(); // returns the current element of the groupview Sequence|Result next(); // returns the next element of the group; returns NULL in case of the current element (given by the cur() method) is the last one Sequence|Result elem(int indice); // returns the #indice (starting at 0) element (Sequence or Result) in the groupview int curind(); // returns the indice of the current element of the groupview Group group(); // returns the current group (the group that is being built) of the groupview };

class Interval

class Interval extends Object { // methods Interval(int start = 0, int end = 0); // constructs an interval using the given parameters; start and end must be 32-bit positive integers int start(); // returns the starting position of the interval int end(); // returns the ending position of the interval Interval overlap(Interval interval); // returns the overlapping interval the given interval with the interval instance bool isEmpty(); // returns true if the interval is empty int length(); // returns the length of the interval bool equals(Interval interval); // returns true if the given interval is equals by value to the interval instance };

class AnnotatedInterval

class AnnotatedInterval extends Object { // methods AnnotatedInterval(int start, int end, ID id, int feature = 0); // constructs an annotated interval using the given parameters; start and end must be 32-bit positive integers, id must be an ID (non zero 64-bit positive integer), feature must be 64-bit signed integer int start(); // returns the starting position of the annotated interval int end(); // returns the ending position of the annotated interval ID id(); // returns the id of the annotated interval int feature(); // returns the feature of the annotated interval Interval interval(); // builds and returns the interval of the annotated interval int length(); // returns the length of the annotated interval bool equals(AnnotatedInterval annot_interval); // returns true if the given annotated interval is equals by value to the annotated interval instance };

class CoverageItem

class CoverageItem extends Object { // methods int start(); // returns the starting position of the coverage item int end(); // returns the ending position of the coverage item int coverage(); // returns the coverage };

class HistogramItem

class HistogramItem extends Object { // methods int start(); // returns the starting position of the histogram item int end(); // returns the ending position of the histogram item int intervalCount(); // returns the interval count of the histogram item Range range(); // returns the range of the histogram item (could be NULL) };

class ReferencedList

class ReferencedList extends Object { // methods void setReferenceInterval(Interval interval); // sets the reference interval of the referenced list Interval getReferenceInterval(); // returns the reference interval of the referenced list void setReferenceObject(any refobj); // sets the reference object of the referenced list any getReferenceObject(); // returns the reference object of the referenced list };

class IntervalList

class IntervalList extends ReferencedList { // methods IntervalList([List<Interval> intervals, [Interval refitv = NULL, [any refobj = NULL]]]); // constructs an interval list using the list of intervals, the reference interval refitv and the reference object refobj if given static IntervalList buildIntervalListFromFile(string interval_file, int col_cnt = 2, string str_sep = " "); // constructs an interval list from the given interval file using a simple parser; each line must contain the same number of columns, col_cnt indicates the number of columns (2 is the default : start end), only the first 2 columns are used; the string str_sep is the separator between each column static IntervalList buildIntervalListFromCollection(Collection coll, string printf_fmt); // builds an interval list from the output generated by the method Collection::printf(printf_fmt) applied to the given sequence or result collection; the parser used is the same as for the method buildIntervalListfromFile IntervalList clone(); // clones the interval list List<Interval> getList(); // returns a clone of the list of intervals in the interval list int size(); // returns the size of the interval list Interval getIntervalAt(int ind); // returns the interval at the given indice IntervalList addInterval(Interval interval); // adds the given interval to the interval list; returns itself IntervalList addIntervals(IntervalList interval_list); // adds the given intervals to the interval list; returns itself IntervalList sortByStart(); // sorts the interval list by start, then end; returns itself bool isSortedByStart(); // returns true if the interval list is sorted by start int getMin(); // returns the minimum position (32-bit positive integer) of the interval list int getMax(); // returns the maximum position (32-bit positive integer) of the interval list List<CoverageItem> coverage([Interval itv_ref = NULL]); // performs the coverage of the interval list within the given interval reference or the whole range if not given; returns a list of coverage items int getTotalLength(); // returns the sum of the length of each interval in the list IntervalList intersect(IntervalList interval_list); // returns the set intersection of the given interval list with the interval list instance IntervalList union(IntervalList interval_list); // returns the set union of the given interval list with the interval list instance IntervalList diff(IntervalList interval_list); // not yet implemented IntervalList projection(); // returns the projection of the interval list IntervalList complement(Interval itv_ref = NULL); // returns the complement of the interval list, according to the interval reference argument if given, or the interval reference of the object IntervalList overlap(Interval interval | IntervalList interval_list); // returns the overlapping intervals of the given interval or interval list with the interval list instance IntervalList deduplicate(); // skips the duplicates intervals in the interval list; returns itself void display(File fd); // displays the interval list to the file fd bool equals(IntervalList interval_list); // returns true if each interval of the given interval list is equals by value to each interval of the interval list instance };

class AnnotatedIntervalList

class AnnotatedIntervalList extends ReferencedList { // methods AnnotatedIntervalList([List<AnnotatedInterval> annot_intervals, [Interval refitv = NULL, [any objref = NULL]]]); // constructs an annotated interval list using the list of annotated intervals, the reference interval refitv and the reference object refobj if given static AnnotatedIntervalList buildAnnotatedIntervalListFromFile(string annot_interval_file, int col_cnt = 4, string str_sep = " "); // constructs an annotated interval list from the given annotated interval file using a simple parser; each line must contain the same number of columns, col_cnt indicates the number of columns (4 is the default : start end ID feature); col_cnt must be equals to 2 at least, in such a case IDs and features are ignored; if col_cnt is equals to 3, features are ignored; if col_cnt is greater than 4, columns after the #4 are ignored; the string str_sep is the separator between each column static AnnotatedIntervalList buildAnnotatedIntervalListFromCollection(Collection coll, string printf_fmt); // builds an annotated interval list from the output generated by the method Collection::printf(printf_fmt) applied to the given sequence or result collection; the parser used is the same as for the method buildAnnotatedIntervalListfromFile AnnotatedIntervalList clone(); // clones the annotated interval list int size(); // returns the size of the annotated interval list AnnotatedInterval getAnnotatedIntervalAt(int pos); // returns the annotated interval at the given position List<Interval> getList(); // returns a clone of the list of annotated intervals in the annotated interval list AnnotatedIntervalList addAnnotatedInterval(AnnotatedInterval annot_interval | int start, int end, ID id, int feature = 0); // adds the given annotated interval (object or three to four integers) to the annotated interval list; returns itself AnnotatedIntervalList addAnnotatedIntervals(AnnotatedIntervalList annot_interval_list); // adds the given annotated interval list to the annotated interval list; returns itself AnnotatedIntervalList sortByStart(); // sorts the annotated interval list by start, then end, then ID, then feature; returns itself bool isSortedByStart(); // returns true if the annotated interval list is sorted by start int getMin(); // returns the minimum position (32-bit positive integer) of the annotated interval list int getMax(); // returns the maximum position (32-bit positive integer) of the annotated interval list int getTotalLength(); // returns the sum of the length of each annotated interval in the list IntervalList buildIntervalList(); // returns an interval list built from the annotated interval list Range buildIDRange([bool keep_order = false]); // returns a range of IDs built from the annotated interval list; if keep_order is set to true, returns a range of IDs in the order of their associated intervals (sorted by start, then end), in which case the returned range is an ordered range Range buildFeatureRange([bool keep_order = false]); // returns a range of features (considered as IDs) built from the annotated interval list; if keep_order is set to true, returns a range of features in the order of their associated intervals (sorted by start, then end), in which case the returned range is an ordered range AnnotatedIntervalList intersect(AnnotatedIntervalList annot_interval_list); // returns the set intersection of the given annotated interval list with the annotated interval list instance AnnotatedIntervalList union(AnnotatedIntervalList annot_interval_list); // returns the set union of the given annotated interval list with the annotated interval list instance AnnotatedIntervalList diff(AnnotatedIntervalList annot_interval_list); // not yet implemented AnnotatedIntervalList deduplicate(); // skips the duplicates annotated intervals in the annotated interval list; returns itself void display(File fd); // displays the annotated interval list to the file fd bool equals(AnnotatedIntervalList annot_interval_list); // returns true if each annotated interval of the given annotated interval list is equals by value to each annotated interval of the annotated interval list instance };

class IntervalIndexBuilder

class IntervalIndexBuilder extends Object { // methods IntervalIndexBuilder(string itvidx_file, AnnotatedIntervalList annot_interval_list [, Metainfo metainfo = NULL [, int div = 100]]); // constructs an interval index builder object, initializing it with the given interval index file, the given annotated interval list and the meta information if given void buildIntervalIndex(); // builds the interval index IntervalIndex getIntervalIndex(); // returns the interval index if buildIntervalIndex() has been called successfully; otherwise, returns NULL };

class IntervalIndexPostFilter

class IntervalIndexPostFilter extends Object { // methods abstract bool accept(int query_start, int query_end, AnnotatedInterval subject_interval); // abstract method implemented in subclasses };

class QueryContainedInSubjectFilter

class QueryContainedInSubjectFilter extends IntervalIndexPostFilter { // methods QueryContainedInSubjectFilter(); // constructs an interval index post filter restricting the returned subject annotated intervals to those which contain the query intervals bool accept(int query_start, int query_end, AnnotatedInterval subject_interval); // returns true if the given query interval (query_start:query_end) is contained in the given annotated subject interval };

class SubjectContainedInQueryFilter

class SubjectContainedInQueryFilter extends IntervalIndexPostFilter { // methods SubjectContainedInQueryFilter(); // constructs an interval index post filter restricting the returned subject annotated intervals to those which are contained in the query intervals bool accept(int query_start, int query_end, AnnotatedInterval subject_interval); // returns true if the given query interval (query_start:query_end) contains the given annotated subject interval };

class IntervalIndex

class IntervalIndex extends Object { // methods IntervalIndex(string itvidx_file); // opens the given interval index file itvidx_file and constructs an interval index int size(); // returns the number of intervals in the interval index Interval getEnclosingInterval(); // returns the enclosing interval of the whole interval index string getFile(); // returns the file name of the interval index AnnotatedIntervalList findSubjectAnnotatedIntervalList([Interval|IntervalList query_interval_list [, IntervalIndexPostFilter filter = NULL]]); // searches into the subject interval index the annotated intervals which overlap (may be restricted according to the filter argument if given) with the given query intervals; if no argument is given, all the annotated intervals are returned List<AnnotatedIntervalList> findSplitSubjectAnnotatedIntervalList(IntervalList query_interval_list [, IntervalIndexPostFilter filter = NULL]); // searches into the subject interval index the annotated intervals which overlap (may be restricted according to the filter argument if given) with the given query intervals; returns a list of the annotated intervals found, one per interval within the query interval list int countSubjectAnnotatedIntervalList(Interval|IntervalList query_interval_list [, IntervalIndexPostFilter filter = NULL]); // searches into the subject interval index the annotated intervals which overlap (may be restricted according to the filter argument if given) with the given query intervals; returns the count of the annotated intervals found List<int> countSplitSubjectAnnotatedIntervalList(IntervalList query_interval_list [, IntervalIndexPostFilter filter = NULL]); // searches into the subject interval index the annotated intervals which overlap (may be restricted according to the filter argument if given) with the given query intervals; returns a list of the count of the annotated intervals found, one per interval within the query interval list IntervalList filterQueryIntervalList(IntervalList query_interval_list [, IntervalIndexPostFilter filter = NULL]); // returns a list of the given query intervals which overlap (may be restricted according to the filter argument if given) with the annotated intervals in the subject interval index AnnotatedIntervalList filterQueryAnnotatedIntervalList(AnnotatedIntervalList query_annot_interval_list [, IntervalIndexPostFilter filter = NULL]); // returns a list of the given query annotated intervals which overlap (may be restricted according to the filter argument if given) with the annotated intervals in the subject interval index int countQueryIntervalList(IntervalList query_interval_list [, IntervalIndexPostFilter filter = NULL]); // returns the count of the given query intervals which overlap (may be restricted according to the filter argument if given) with the annotated intervals in the subject interval index int countQueryAnnotatedIntervalList(AnnotatedIntervalList query_annot_interval_list [, IntervalIndexPostFilter filter = NULL]); // returns the count of the given annotated query intervals which overlap (may be restricted according to the filter argument if given) with the annotated intervals in the subject interval index Range findSubjectIDRange(Interval|IntervalList interval [, IntervalIndexPostFilter filter = NULL [, bool keep_order = false]]); // returns a range of the IDs of the annotated intervals in the subject interval index which overlap (may be restricted according to the filter argument if given) with the given query intervals; if keep_order is set to true, returns a range of IDs in the order of their associated intervals (sorted by start, then end), in which case the returned range is an ordered range Range findSubjectFeatureRange(Interval|IntervalList interval [, IntervalIndexPostFilter filter = NULL [, bool keep_order = false]]); // returns a range of the features (considered as IDs) of the annotated intervals in the subject interval index which overlap (may be restricted according to the filter argument if given) with the given query intervals; if keep_order is set to true, returns a range of features in the order of their associated intervals (sorted by start, then end), in which case the returned range is an ordered range List<HistogramItem> histogram(Interval interval, int slice, bool include_ranges = false); // performs the histogram of the interval index in the scope of the given interval using the given slice; if include_ranges is true, ranges are included in the histogram items; returns a list of histogram items void remove(); // removes the interval index files Metainfo getMetainfo(); // returns the meta information associated with the interval index void updateMetainfo(Metainfo metainfo); // not yet implemented };

class EyeDBSMDatabase

class EyeDBSMDatabase extends Object { // methods EyeDBSMDatabase(string dbname, string flags); // not yet implemented void transactionBegin(string mode = NULL); // not yet implemented void transactionCommit(); // not yet implemented void transactionAbort(); // not yet implemented void close(); // not yet implemented List<string> bench_create(any obj, int numobjs, bool serialize = false); // not yet implemented any bench_read(List<string> oid_list, bool unserialize = false); // not yet implemented bool bench_update(List<string> oid_list, any newobj, bool serialize = false); // not yet implemented void bench_delete(List<string> oid_list); // not yet implemented };

class Debugger

class Debugger extends Object { // methods Debugger(); // constructs a Debugger static Debugger getInstance(); // getInstance() description: TBD void on(); // on() description: TBD void off(); // off() description: TBD void bkp(); // bkp() description: TBD void where(); // where() description: TBD void up(); // up() description: TBD void down(); // down() description: TBD };

class Plink

class Plink extends Object { // methods Plink(SeqDB variantdb, SeqDB sampledb); // genotype table SeqColl getSampleRangeForVariant(SeqID variant, int bed_genotype, SeqColl sample_coll := [1:-1]); // returns a collection of samples of bed_genotype in variant, restricted to sample_coll SeqColl getVariantRangeForSample(SeqID sample, int bed_genotype, SeqColl variant_coll := [1:-1]); // returns a collection of variants having the bed_genotype in sample, restricted to variant_coll int getGenotype(SeqID variant, SeqID sample, SeqID ref_sample := ref_set); // return the genotype of variant for sample with ref_sample as reference, use 0 for default reference Map getPlinkSampleStats(SeqID sample, SeqColl variant_coll := [1:-1]); // returns a map of statistics for sample, restricted to variant_coll collection Map getPlinkStats(SeqID variant, SeqColl sample_coll := [1:-1]); // returns a map of statistics for variant, restricted to sample_coll collection SeqId SetRefSample(SeqId := 0); // set the reference sample, use 0 or no arg to set reference to default };

class Xlink

class Xlink extends Object { // methods Xlink(SeqDB variantdb, SeqDB sampledb); // genotype table SeqColl getSampleRangeForVariant(SeqID variant, int bed_genotype, SeqColl sample_coll := [1:-1]); // returns a collection of samples of bed_genotype in variant, restricted to sample_coll SeqColl getVariantRangeForSample(String filter, int chr, SeqColl variant_coll, SeqColl sample_coll, int max_nbr = 0); // returns a collection of variants having the filter condition true for sample_collection, restricted to variant_coll, number of results returne is limited to max_nbr, 0 means unlimited int getAlleState(SeqID variant, SeqID sample); // return the allele state of variant for sample Map getXlinkSampleStats(SeqID sample, SeqColl variant_coll := [1:-1]); // returns a map of statistics for sample, restricted to variant_coll collection Map getXlinkStats(SeqID variant, SeqColl sample_coll := [1:-1]); // returns a map of statistics for variant, restricted to sample_coll collection SeqId SetRefSample(SeqId := 0); // set the reference sample, use 0 or no arg to set reference to default PrintVCF(int chr, SeqColl variant_coll, SeqColl sample_coll, print_header := 0); // print VCF corresponding to variant and sample collections };

class BitArrayRange

class BitArrayRange extends Object { // methods BitArrayRange(SeqDB db); // bit array range BitMap getBitMap(); // returns the bit map Range convertToBlockRange(); // convert bit array range to range int size(); // returns the range size };

class PrinterContext

class PrinterContext extends Object { // attributes string ctxmap; // methods };

class Tracer

class Tracer extends Object { // methods Tracer([File fd = $stderr [, bool trace_returned_val = false [, string timestamp="none"|"real"|"user"|"sys"]]]); // constructs a Tracer using fd to display traces; returned values are displayed if trace_returned_val is set to true; timestamps are displayed if timestamp is not equals to none; the Tracer::on() method must be called to be active bool on([bool on=true [, file fd=$stderr [, bool trace_returned_val = false [, string timestamp="none"|"real"|"user"|"sys"]]]]); // sets the Tracer status to the value of on (default is true); returns the previous status; the parameters set in the constructor (fd, trace_returned_val, timestamp) can be overriden bool off(); // sets the Tracer status to off; returns the previous status static Tracer getInstance(); // returns the last instance of Tracer; NULL if no instance created };

class Profiler

class Profiler extends Object { // methods Profiler(); // constructs a Profiler bool on([int status=true]); // sets the Profiler status to status; returns the previous status bool off(); // sets the Profiler status to off; returns the previous status void dump(file fd, string criteria="user"|"sys"|"real"|"call"); // dumps the profile summary in file fd; sorts summary according to criteria void reset(); // resets the Profiler static Profiler getInstance(); // returns the last instance of Profiler; NULL if no instance created };

Functions

  List funlist();
  // returns the list of functions

  List mthlist();
  // returns the list of methods

  List clslist();
  // returns the list of classes

  void load_module(string module);
  // loads the given module in the bfql session

  string version();
  // returns the version of the bfql interpreter

  void void(any value);
  // converts the value to an undefined value

  void help([string any|clsname|funname|mthname]|["-html-api"]);
  // displays the class documentation of the argument; if argument is a string matching a class, function or method name, displays the corresponding documentation; with no arguments, displays the full documentation; if argument matches -html-api, displays the full documentation in html format

  string where([bool stack_trace = false]);
  // returns a string containing the line number and the filename of where the call occurs; if stack_trace is true, the stack is included in the returned string

  int|double min(int|double v1, int|double v2);
  // returns the minimum value of v1 and v2; returns an integer if both values are integers; otherwise, returns a double

  int|double max(int|double v1, int|double v2);
  // returns the maximum value of v1 and v2; returns an integer if both values are integers; otherwise, returns a double

  int|double abs(int|double v);
  // returns the absolute value of v; returns an integer if the value is a integer; otherwise, returns a double

  void print_words(string annot [, string regex [,+freq|-freq|+alpha|-alpha|+freq-alpha|-freq-alpha [, int max]]]);
  // prints to the standard output a statistic summary (word value and fequency) of all the words in the given annotation, using the regular expression if given, and sorting them using the third argument (default is -freq)

  string getenv(string envvar);
  // returns the value of the environment variable envvar or NULL if not set

  int strlen(string str);
  // returns the length of the string str

  string substr(string str, int offset, int size = MAXINT);
  // returns a substring of the string str starting at #offset and of size #size

  string strrev(string str);
  // returns the string reverse of str

  int strcount(string str, string search [, bool case_insensitive = false [, int offset = 0]]);
  // returns the count of occurences of the string search in the string str, ignoring the case of characters if case_insensitive is true, starting at #offset if given

  List strhisto(string str, List search_list [, bool case_insensitive = false [, int offset = 0]]);
  // returns a list containing the count of occurences of each item in search_list in the string str, ignoring the case of characters if case_insensitive is true, starting at #offset if given

  string strupper(string str);
  // converts str to upper case and returns this new string

  string strlower(string str);
  // converts str to lower case and returns this new string

  int strpos(string str, string search [, int offset = 0]);
  // returns the offset of the first occurence of the string search in the string str, starting at the given offset; returns -1 if search is not found

  int strrpos(string str, string search [, int offset = strlen(str)-1]);
  // returns the offset of the last occurence of the string search in the string str, starting at the given offset; returns -1 if search is not found

  List strsplit(string str [, string regex = "[ \t]+"]);
  // splits the string str using the given regular expression as a separator

  List strsplit_s(string str [, string split_str]);
  // splits the string str using the given string as a separator

  string strreplace(string str, string|list from, string|list to [, int offset = 0]);
  // replaces the first occurence of from by to in the string str, starting at the given offset; if from is a string list, iterates on each element of the list and replaces the first occurence of the element by to, if to is a string, or by the corresponding element in to, if to is a string list

  string strreplace_all(string str, string|list from, string|list to [, int offset = 0]);
  // replaces all occurences of from by to in the string str, starting at the given offset; if from is a string list, iterates on each element of the list and replaces all occurences of the element by to, if to is a string, or by the corresponding element in to, if to is a string list

  string strtrim(string str);
  // returns a copy of the string, which leading and trailing whitespaces, tabulars and newlines are omitted

  string urldecode(string str);
  // decodes the given URL

  string typeof(any value);
  // returns the type name of value

  File fopen(string filename, string mode);
  // opens the file filename using mode and returns a file handle

  string fgetline(File fd);
  // reads an entire line from file handle; returns NULL at the end of the file

  void fputs(File fd, string str);
  // writes the string str to the given file handle

  void fflush(File fd);
  // flushes forces a write of the buffer used internaly by the given file handle

  void fseek(File fd, int offset, string whence = "set"|"cur"|"end");
  // repositions the offset of the given file handle; if whence is equals to "set", the offset is absolute; if whence is equals to "cur", the offset is relative to the current position; if whence is equals to "end", the offset is relative to the end of the file

  void frewind(File fd);
  // repositions the offset to the beginning of the file handle

  void fclose(File fd);
  // closes the give file

  bool file_exists(string filename);
  // returns true if file exists

  bool file_remove(string filename);
  // removes the file; returns true if the operation is successful, false otherwise

  void file_put_contents(string filename, string contents);
  // opens the given file for writing, writes the string contents to it and closes the file

  string file_get_contents(string filename);
  // opens the given file in read mode, returns its contents as a string and closes it

  void fwriteInt8(File fd, int|char|bool value);
  // writes 8 bit integer LSB first to the given file handle

  void fwriteInt16(File fd, int value);
  // writes 16 bit integer LSB first to the given file handle

  void fwriteInt32(File fd, int value);
  // writes 32 bit integer LSB first to the given file handle

  void fwriteInt64(File fd, int value);
  // writes 64 bit integer LSB first to the given file handle

  void fwriteChar(File fd, char|bool value);
  // writes 8 bit character to the given file handle

  void fwriteDouble(File fd, double|int value);
  // writes 64 bit double to the given file handle

  void fwriteString(File fd, string value);
  // writes the string to the given file handle

  void fwriteBoundedString(File fd, string str [, int size = strlen(str)]);
  // writes the string bounded to size to the given file handle

  int freadInt8(File fd);
  // reads 8 bit integer from the given file handle LSB first and sign extends it to a 64 bit integer

  int freadInt16(File fd);
  // reads 16 bit integer from the given file handle LSB first and sign extends it to a 64 bit integer

  int freadInt32(File fd);
  // reads 32 bit integer from the given file handle LSB first and sign extends it to a 64 bit integer

  int freadInt64(File fd);
  // reads 64 bit integer from the given file handle LSB first

  char freadChar(File fd);
  // reads 8 bit character from the given file handle

  double freadDouble(File fd);
  // reads 64 bit double from the given file handle

  string freadString(File fd);
  // reads string from the given file handle

  string freadBoundedString(File fd, int size);
  // reads string of length size from the given file handle

  int ftell(File fd);
  // returns the offset of the given file handle

  SortedMap stat(string filename);
  // stats the given file and returns a description map containing the following keys: st_dev, st_ino, st_mode, st_nlink, st_uid, st_gid, st_rdev, st_size, st_blksize, st_blocks, st_atime, st_mtime and st_ctime

  SortedMap fstat(File fd);
  // stats the given file handle and returns a description map containing the following keys: st_dev, st_ino, st_mode, st_nlink, st_uid, st_gid, st_rdev, st_size, st_blksize, st_blocks, st_atime, st_mtime and st_ctime

  File popen(string command, string mode);
  // open pipe stream

  int pclose(File fd);
  // close pipe stream

  void exit(int status);
  // exits program using status code

  void exit_if(bfql_expr condition, int status [, string msg]);
  // exits program using the given status code if and only if the condition is false; displays msg if given or the condition and the line number otherwise

  bool isset(variable var);
  // returns true if the variable var is defined

  bool isundef(any value);
  // returns true if value is undefined

  bool ieval([SortedMap hints]);
  // launchs a bfql evaluator; for debug purposes only

  void print_mem([bool garbage=false]);
  // displays memory status

  void print_stack();
  // displays stack

  List sort(List list [, bool less_fun($o1, $o2 [, extra_arg]) = NULL [, any less_fun_extra_arg = NULL]]);
  // if less_fun is not given, sorts the list in the natural ascending order; if less_fun is set, sorts the list according to this function; if less_fun_extra_arg is set, this extra argument is added to the call of less_fun ; returns the sorted list

  List rsort(List list);
  // sorts the list in the natural descending order; returns the sorted list

  int time();
  // returns the time since the Epoch measured in seconds

  int utime();
  // returns the time since the Epoch measured in microseconds

  int mstime();
  // returns the time since the Epoch measured in milliseconds

  string ctime([int epoch]);
  // converts the epoch time (current time if unspecified) to a string

  List rusage([List]);
  // returns a list containing the elapsed time, user time, system time, user time of children, system time of children, page reclaims, major page faults; all times in micro seconds; the optional list argument must be of size 5 at least

  int|SortedMap memusage(["alloc"|"stats"|"segms"|"stats+segms"]);
  // if no argument or if argument is "alloc" returns the amount of allocated memory in bytes; if argument is "stats" returns memory statistics; if argument is "segms" returns memory mapped segments; if argument is "stats+segms" returns memory statistics and memory mapped segments

  void system(string command);
  // executes the shell command

  List getenvvars(string "VAR1,VAR2,VAR3,...", bool create_if_dont_exist = false);
  // sets the bfql variables $VAR1, $VAR2, $VAR3 etc. to the value of the environment variables var1, var2 etc. if they exist or if create_if_dont_exist is set to true; the wildcard character * means all environment variables; returns the list of the created variables

  void set_printf_format(string fmt);
  // sets the format of the -printf option to fmt

  int fork();
  // forks a new process; returns 0 in the child, returns the pid of the child in the parent

  void wait();
  // waits for all children to finish

  void sleep(int secs);
  // sleeps during secs seconds

  double acos(double value);
  // arc cosine of value

  double asin(double value);
  // arc sine of value

  double atan(double value);
  // arc tangent of value

  double cos(double value);
  // cosine of value

  double sin(double value);
  // sine of value

  double tan(double value);
  // tangent of value

  double acosh(double value);
  // hyperbolic arc cosine of value

  double asinh(double value);
  // hyperbolic arc sine of value

  double atanh(double value);
  // hyperbolic arc tangent of value

  double cosh(double value);
  // hyperbolic cosine of value

  double sinh(double value);
  // hyperbolic sine of value

  double tanh(double value);
  // hyperbolic tangent of value

  double exp(double value);
  // exponential function of value

  double log(double value);
  // natural logarithm of value

  double log10(double value);
  // base-ten logarithm of value

  double exp2(double value);
  // compute base-2 exponential of value

  double log2(double value);
  // compute base-2 logarithm of value

  double pow(double value, double expon);
  // return value to the expon power

  double sqrt(double value);
  // return the square root of value

  double cbrt(double value);
  // return the cube root of value

  double ceil(double value);
  // smallest integral value not less than value

  double fabs(double value);
  // absolute value of value

  double floor(double value);
  // largest integer not greater than value

  double round(double value);
  // round value to nearest integral value, rounding halfway cases away from zero

  double trunc(double value);
  // round value to the integral value in floating-point format nearest but not larger in magnitude

  double rint(double value);
  // return the integer nearest value in the direction of the prevailing rounding mode

  double erf(double value);
  // erf of value

  string md5(string str);
  // compute the md5 sum of the given string

  string fmd5(string filename);
  // compute the md5 sum of the given file

  object open_index(int dbwhich, string name);
  // index API test function

  Range find_index(object index, any value, string op);
  // index API test function

  List find_dict(object index, string regex);
  // index API test function

  bool less(any a1, any a2);
  // returns a1 < a2

  bool less_eq(any a1, any a2);
  // returns a1 <= a2

  bool greater_eq(any a1, any a2);
  // returns a1 >= a2

  bool greater(any a1, any a2);
  // returns a1 >= a2

  bool eq_mi(string a1, string a2);
  // returns a1 =mi a2

  bool eq_m(string a1, string a2);
  // returns a1 =m a2

  bool eq_kwi(string a1, string a2);
  // returns a1 =kwi a2

  bool eq_kw(string a1, string a2);
  // returns a1 =kw a2

  bool eq_si(string a1, string a2);
  // returns a1 =si a2

  bool eq_s(string a1, string a2);
  // returns a1 =s a2

  bool eq_ri(string a1, string a2);
  // returns a1 =ri a2

  bool eq_r(string a1, string a2);
  // returns a1 =r a2

  bool neq_mi(string a1, string a2);
  // returns a1 !=mi a2

  bool neq_m(string a1, string a2);
  // returns a1 !=m a2

  bool neq_kwi(string a1, string a2);
  // returns a1 !=kwi a2

  bool neq_kw(string a1, string a2);
  // returns a1 !=kw a2

  bool neq_si(string a1, string a2);
  // returns a1 !=si a2

  bool neq_s(string a1, string a2);
  // returns a1 !=s a2

  bool neq_ri(string a1, string a2);
  // returns a1 !=ri a2

  bool neq_r(string a1, string a2);
  // returns a1 !=r a2

  bool not(any a1);
  // returns !a1

  any plus(any $a1, any $a2);
  // returns $a1 + $a2

  int|double minus(int|double a1, int|double a2);
  // returns a1 - a2

  int|double mul(int|double a1, int|double a2);
  // returns a1 * a2

  int|double div(int|double a1, int|double a2);
  // returns a1 / a2

  int modulo(int a1, int a2);
  // returns a1 % a2

  int and(int a1, int a2);
  // returns a1 & a2

  int or(int a1, int a2);
  // returns a1 | a2

  int xor(int a1, int a2);
  // returns a1 ^ a2

  int tilde(int a1);
  // returns ~a1

  int rshift(int a1, int a2);
  // returns a1 >> a2

  int lshift(int a1, int a2);
  // returns a1 << a2

  any unserialize(string str, SerializeHints hints = NULL);
  // returns unserialized object

  any json(string str);
  // decodes a json string

  string tojson($obj [, $hints := NULL]);
  // recursively converts the given object to json

  void printf(string fmt, ...);
  // produces output in stdout according to given format and arguments

  void fprintf(file fd, string fmt, ...);
  // produces output in give file according to given format and arguments

  string sprintf(string fmt, ...);
  // returns string according to given format and arguments

  string snprintf(int size, string fmt, ...);
  // returns string according to given format and arguments, limited to size bytes

  regex_t* regcomp(string pattern, int flags);
  // compiles pattern using the given flags and returns an opaque pointer to be used by regmatch; flags is a bitwise combination of: $REG_EXTENDED, $REG_ICASE, $REG_NEWLINE and $REG_NOSUB;
  // default flag is $REG_EXTENDED; the returned pointer must be freed using regfree()

  string regerror(string pattern, int flags);
  // in case of regcomp failed, returns the error diagnostic

  list regmatch(regex_t* regex, string str, int match_cnt, int eflags);
  // returns a list of matching positions of the regex (compiled with regcomp) in the string str; match_cnt controls the maximum number of matches returned (a negative number means all matches)

  string regreplace(string str, string pattern, string to, int nrep, int flags);
  // compiles pattern using the given flags (see regcomp), and replace nrep occurences of this pattern by the string to; if nrep is negative, replaces all occurences

  void regfree(regex_t* regex);
  // frees the given regex pointer previously returned by regcomp