db = $db; } function __destruct(){ } /** * login() * Accetps username & password OR user id. * Username & password is needed every time you login a new user, * while the user id is used when you need a temporary user class instance. * * After verifying the login all private class variables are updated with * current user data. */ public function login($username, $password, $id='') { if ($id == '') { $sql = "SELECT * " . "FROM user " . "WHERE (username = '$username' " . "AND password = PASSWORD('$password')) or (username = '$username' " . "AND password = old_password('$password'))"; $result = $this->db->query_get_array($sql); } else{ $sql = "SELECT * " . "FROM user " . "WHERE id = '$id'"; $result = $this->db->query_get_array($sql); } if (isset($result['id'])) { $this->id = $result['id']; $this->fullname = $result['fullname']; $this->email = $result['email']; $this->address = $result['address']; $this->phone = $result['phone']; $this->fax = $result['fax']; $this->username = $result['username']; $this->password = $result['password']; $this->access = $result['access']; $this->affiliation = $result['affiliation']; $this->title = $result['title']; $this->egon = $result['egon']; $this->annotdb = $result['annotdb']; $this->country = $result['country']; $this->first_login = $result['first_login']; $this->last_login = $result['last_login']; $this->egon_login = $result['egon_login']; $this->annotdb_login = $result['annotdb_login']; $this->currentTool = $result['currentTool']; $this->currentFolder = 0; // Update last_login if user logged in with username & password if ($username && $password){ $sql = "UPDATE user SET last_login = NOW(), egon_login = (egon_login +1) WHERE id = '$this->id'"; $this->db->query_commit($sql); } $this->tmp = 1; return $this; } //The user doesn't exists in new nor old database $this->tmp = 0; return $this; } /** * Validates a user. * This function is meant to give an easy interface to verify if the User * class initialization succeeded. * * Returns true the User class is properly initialized and false otherwise. */ public function validate() { if ($this->id == '') return 0; // User invalid else return 1; // User valid } public function return_tmp() { return $this->tmp; } /** * Validates a user's full name. * Currently this function does nothing more than to verify that the name * is not an empty string. * * Returns true if full name is accepted otherwise false. */ public function validate_fullname($fullname) { if ($fullname) { return 1; } else { return 0; } } /** * Validates a user's email. * * Returns true if email address is accepted otherwise false. */ public function validate_email($email) { $valid_chars = preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i",$email); if ($valid_chars) { return 1; } else { return 0; } } /** * Checks if a username is already in use. * * Returns true if username is used by a user, otherwise false. */ public function username_exists($username) { $result = $this->db->query_commit("SELECT * " . "FROM user " . "WHERE username='$username'"); if ($result > 0 && $username != '') return 1; return 0; } /** * Validates a user's password. * Note: It currently only checks if $password == "" or $password1 == * $password2. This could easily be extended to require minimum X characters * etc. * * Returns 2 if passwords are accepted, 1 if password is too short and 0 if * passwords doesn't match. */ public function validate_password($password1, $password2) { if (!$password1) return 1; if ($password1 == $password2) return 2; else return 0; } /** * Commits current userdata to database. * * Returns 1 on success and 0 on database failure. */ public function commit_to_db($affiliation, $address, $country, $email, $fax, $fullname, $password, $phone, $username, $title) { $affiliation = addslashes($affiliation); $address = addslashes($address); $sql = "INSERT INTO user VALUES (NULL, '$fullname', '$email', '$address', '$phone', '$fax', '$username', PASSWORD('$password'), '', '$affiliation', '$title', '0', '1', NOW(), '$country', NOW(), '0', '0', 'adb')"; $res = $this->db->query_commit($sql); $id = mysql_insert_id(); //This defines the default values in preferences for a new user $sql = "INSERT into user_preferences (`user_id_fk`, `single_value`, `batch_value`, `export_value`, `preferences_id_fk`) VALUES ($id, '1', '1', '1', 1), ($id, '1','1','1','2'), ($id, '1', '1', '1', 7), ($id, '1', '1', '1', 9), ($id, '1', '1', '1', 15), ($id, '1', '1', '1', 16), ($id, '1', '1', '1', 18), ($id, '1', '1', '1', 21), ($id, '1', '1', '1', 24), ($id, '1', '1', '1', 27), ($id, '1', '1', '1', 28)"; $this->db->query_commit($sql); $sql = "INSERT INTO `egon_pref` (`user_id_fk`) VALUES ($id)"; $this->db->query_commit($sql); if ($res == 1) return 1; else return 0; } /** * Check if given email address exists in the database. * * Returns 1 if email exists, 0 otherwise. */ public function email_exists($email) { $result = $this->db->query_commit("SELECT id " . "FROM user " . "WHERE email='$email'"); if ($result) return 1; return 0; } /** * Checks if the current user have admin rights. If yes; delete given user. * * Returns 1 on success and 0 on failure. */ public function delete_user($user_id) { if ($this->db->query_commit("DELETE FROM user WHERE id = $user_id")) return 1; return 0; } /** * Returns current $fullname. */ public function get_fullname() { return $this->fullname; } /** * Returns current $username. */ public function get_username() { return $this->username; } /** * Returns current $email address. */ public function get_email() { return $this->email; } /** * Returns current $id. */ public function get_id() { return $this->id; } /** * Returns current user data in an assoc. array. */ public function get_info_array() { $sql = "SELECT title FROM titles WHERE id = '$this->title'"; $title_text = $this->db->query_get_value($sql); $sql = "SELECT country FROM countries WHERE id = '$this->country'"; $country_text = $this->db->query_get_value($sql); return array("fullname" => $this->fullname, "affiliation" => $this->affiliation, "title" => $this->title, "title_text" => $title_text, "address" => $this->address, "country" => $this->country, "country_text" => $country_text, "phone" => $this->phone, "fax" => $this->fax, "email" => $this->email, "id" => $this->id, "egon" => $this->egon, "egon_login" => $this->egon_login, "annotdb" => $this->annotdb, "annotdb_login" => $this->annotdb_login, "email" => $this->email, "first_login" => $this->first_login, "last_login" => $this->last_login, "access" => $this->access, "current_tool" => $this->currentTool, "username" => $this->username); } /** * Checks if current user is admin or not. * * Returns true is user is admin and 0 otherwise. */ public function get_isAdmin() { return ($this->access == 'admin'); } /** * Updates the current user information to database. * * Returns a string: "ok" on success and error message upon failure. */ public function update_user_info($data) { if (!$this->validate_fullname($data['fullname'])) return "Name field not accepted"; if (!$this->validate_email($data['email'])) return "Email address in invalid"; if ($data['username'] != $this->username) { if ($this->username_exists($data['username'])) return "Username already in use! Try another one."; } if ($data['email'] != $this->email){ if ($this->email_exists($data['email'])) return "Mail address is used by another user"; } if (!$this->validate_password($data['password1'], $data['password2'])) return "Massword mismatch"; $sql = "UPDATE `user` SET `email` = '$data[email]', " . "`fullname` = '$data[fullname]', " . "`phone` = '$data[phone]', " . "`fax` = '$data[fax]', " . "`affiliation` = '$data[affiliation]', " . "`address` = '$data[address]', " . "`title` = '$data[title]', " . "`country` = '$data[country]', " . "`username` = '$data[username]' "; if ($data['password1'] != "") $sql .= ",password = PASSWORD('$data[password1]') "; $sql .= "WHERE id = '$this->id'"; $this->db->query_commit($sql); $this->fullname = $data['fullname']; $this->email = $data['email']; $this->address = $data['address']; $this->phone = $data['phone']; $this->fax = $data['fax']; $this->username = $data['username']; $this->password = $data['password1']; $this->affiliation = $data['affiliation']; $this->title = $data['title']; $this->country = $data['country']; return "ok"; } /** * Returns an array of possible titles. */ public function get_titles_list() { return $this->db->query_get_table("SELECT * FROM titles"); } /** * Returns an array of possible countries. */ public function get_countries_list() { return $this->db->query_get_table("SELECT * FROM countries"); } /** * Returns the total number of users. */ public function get_num_of_users() { return $this->db->query_get_value("SELECT COUNT(*) FROM user"); } /** * Returns a valid and random user password. */ public function generate_password() { $password = ""; $passwordLength = 8; $validCharacters = "ABCDEFGHIJKLMNOPQRTSUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; $i=0; while ($i < $passwordLength) { $char = substr($validCharacters, mt_rand(0, strlen($validCharacters) -1), 1); $password .= $char; $i++; } return $password; } /** * Returns the $id of another user (). */ public function get_another_user_id($username) { $sql = "SELECT id from user WHERE username='$username'"; return $this->db->query_get_value($sql); } /** * Returns the current tool (adb or egon) */ public function get_currentTool() { return $this->currentTool; } /** * Sets the current tool (adb or egon) */ public function set_currentTool($tool) { $sql = "UPDATE user " . "SET currentTool='$tool' " . "WHERE username='$this->username'"; if ($this->db->query_commit($sql)) { $this->currentTool = $tool; return true; } return false; } /** * Gets the id of the current open folder (0 = root). */ public function get_currentFolder() { return $this->currentFolder; } /** * Sets the current open folder. Default is 'root'. */ public function set_currentFolder($folder = 0) { $this->currentFolder = $folder; } } .::NTNU Gene Tools::.
[AnnotDB] [Genetools] [NTNU] [NMC]
  

GeneTools - a collection of resources for functional annotations


GENETOOLS is a collection of web-based tools on top of a database that brings together information from a broad range of resources, and provides this in a manner particularly useful for genome-wide analyses. Today, the two main tools connected to this database are the NMC Annotation Tool and eGOn V2.0 (explore Gene Ontology). More tools will be added in the future.
 
Citing GeneTools:
Beisvag et al.: "GeneTools - application for functional annotation and statistical hypothesis testing" (BMC Bioinformatics 2006, 7:470)
 
The NMC Annotation Tool provides information from UniGene (NCBI), EntrezGene, SwissProt and Gene Ontology (GO). The underlying database is updated weekly and contains the most recent and accurate information available for most model organisms.
 
The 6 major features are:
  • Single search: extraction of data for one gene or protein.
  • Batch search: extraction of data for batches of genes or proteins.
  • Both single and batch mode allow for search with a large variety of reporter IDs including UniGene Cluster IDs, GeneBank accession numbers, Entrez Gene IDs, Affymetrix IDs, Arabidopsis IDs, symbols and names.
  • Manage reporter lists: in folders and share selected lists with other users. When new information is available the user is noticed and the lists can be updated.
  • Manual GO Annotation: our GO Annotator Tool allows users to add their own Gene Ontology (GO) annotations to their genes of interest.
  • Export: selected information can be exported in excel, text or XML format.
 
 
eGOn V2.0 facilitates interpretation of GO annotation. GO terms are retrieved in batch modus from EntrezGene and the GO database and displayed in the GO di-acyclic hierarchical graph (DAG).
 
Essential features of eGOn V2.0 are:
  • Visualization: gene annotations are visualized in the GO DAG or as a table view. The granularity of the GO DAG can be edited freely by the user.
  • Filtering: GO annotations can be filtered on evidence codes.
  • Include user defined GO annotations: previously added to the Annotation database.
  • Statistical analysis: Several gene lists are analyzed simultaneously to compare the distribution of the annotated genes over the GO hierarchy. Statistical tests are implemented to allow the user to compute GO annotation dissimilarity within or between gene lists.
  • Connection to Annotation database: Links to Annotation database gene and protein information are offered directly from the GO DAG or in exported data.
  • Export: GO DAG information, statistical results and gene and protein information can be exported in excel, text or XML format.