17 $function =
"tpps_{$type}_autocomplete";
18 if (function_exists($function)) {
19 $string = preg_replace(
'/\\\\/',
'\\\\\\\\', $string);
33 $results = chado_select_record(
'contact', array(
'name'), array(
37 'regex_columns' => array(
'name'),
40 foreach ($results as $row) {
41 $matches[$row->name] = check_plain($row->name);
44 drupal_json_output($matches);
56 $query = db_select(
'chado.plusgeno_view',
'p')
57 ->fields(
'p', array(
'title'))
58 ->condition(
'title', $string,
'~*')
61 while (($result = $query->fetchObject())) {
62 $matches[$result->title] = check_plain($result->title);
65 drupal_json_output($matches);
77 $query = db_select(
'chado.plusgeno_view',
'p')
78 ->fields(
'p', array(
'accession'))
79 ->condition(
'accession', $string,
'~*')
82 while (($result = $query->fetchObject())) {
83 $matches[$result->accession] = check_plain($result->accession);
86 drupal_json_output($matches);
98 $results = chado_select_record(
'contact', array(
'name'), array(
102 'regex_columns' => array(
'name'),
105 foreach ($results as $row) {
106 $matches[$row->name] = check_plain($row->name);
109 drupal_json_output($matches);
121 $results = chado_select_record(
'pub', array(
'series_name'), array(
122 'series_name' => $string,
124 'regex_columns' => array(
'series_name'),
127 foreach ($results as $row) {
128 $matches[$row->series_name] = check_plain($row->series_name);
131 drupal_json_output($matches);
143 $parts = explode(
" ", $string);
144 if (!isset($parts[1])) {
148 $results = chado_select_record(
'organism', array(
'genus',
'species'), array(
159 foreach ($results as $row) {
160 $matches[$row->genus .
" " . $row->species] = check_plain($row->genus .
" " . $row->species);
163 if (empty($matches)) {
167 drupal_json_output($matches);
180 $taxons = json_decode(json_encode($taxons))->Id;
182 $fetch =
new EFetch(
'taxonomy');
183 $fetch->addParam(
'id', implode(
',', $taxons));
184 $response = $fetch->get()->xml();
185 $species = json_decode(json_encode($response))->Taxon;
187 foreach ($species as $info) {
188 $name = $info->ScientificName;
189 if (!empty($name) and $info->Rank ==
'species') {
190 $matches[$name] =
"$name (autocomplete from NCBI)";
205 $results = chado_select_record(
'phenotype', array(
'name'), array(
212 foreach ($results as $row) {
213 $matches[$row->name] = check_plain($row->name);
216 drupal_json_output($matches);
228 $query = db_select(
'chado.phenotype',
'p');
229 $query->join(
'chado.cvterm',
'cvt',
'cvt.cvterm_id = p.attr_id');
230 $query->join(
'chado.cv',
'cv',
'cv.cv_id = cvt.cv_id');
231 $query->fields(
'cv', array(
'name'));
232 $query->condition(
'cv.name', $string,
'~*');
233 $query = $query->execute();
235 while (($result = $query->fetchObject())) {
236 $matches[$result->name] = check_plain($result->name);
239 drupal_json_output($matches);
251 $query = db_select(
'chado.tpps_search_genotype_name',
'g')
252 ->fields(
'g', array(
'name'))
253 ->condition(
'g.name', $string,
'~*')
256 while (($result = $query->fetchObject())) {
257 $matches[$result->name] = check_plain($result->name);
260 drupal_json_output($matches);
272 $query = db_select(
'chado.tpps_search_genotype_marker',
'g')
273 ->fields(
'g', array(
'name'))
274 ->condition(
'g.name', $string,
'~*')
277 while (($result = $query->fetchObject())) {
278 $matches[$result->name] = check_plain($result->name);
281 drupal_json_output($matches);
292 $attributes = array();
293 $attr_results = chado_select_record(
'phenotype', array(
'distinct attr_id'), array());
295 foreach ($attr_results as $result) {
296 $attributes[] = $result->attr_id;
299 $results = chado_select_record(
'cvterm', array(
'name'), array(
304 'cvterm_id' => $attributes,
307 foreach ($results as $row) {
308 $matches[$row->name] = check_plain($row->name);
311 drupal_json_output($matches);
323 $results = chado_select_record(
'phenotypeprop', array(
'value'), array(
331 foreach ($results as $row) {
332 $matches[$row->value] = check_plain($row->value);
335 drupal_json_output($matches);
346 $structures = array();
347 $struct_results = chado_select_record(
'phenotype', array(
'distinct observable_id'), array());
349 foreach ($struct_results as $result) {
350 $structures[] = $result->observable_id;
353 $results = chado_select_record(
'cvterm', array(
'name'), array(
358 'cvterm_id' => $structures,
361 if (empty($results)) {
362 $results = chado_select_record(
'cvterm', array(
'name'), array(
370 foreach ($results as $row) {
371 $matches[$row->name] = check_plain($row->name);
372 if (!empty($row->definition)) {
373 $matches[$row->name] = check_plain($row->name .
': ' . $row->definition);
377 drupal_json_output($matches);
389 ->condition(
'mail', $string,
'~*')
390 ->condition(
'name', $string,
'~*');
391 $result = db_select(
'users')
392 ->fields(
'users', array(
'uid',
'name'))
395 foreach ($result as $user) {
396 $user = user_load($user->uid);
397 $matches[
"$user->mail"] = check_plain($user->name);
400 drupal_json_output($matches);
419 $parents = $form_state[
'triggering_element'][
'#parents'];
422 $element = drupal_array_get_nested_value($form, $parents);
tpps_phenotype_ontology_autocomplete($string)
tpps_autocomplete($type, $string="")
tpps_units_autocomplete($string)
tpps_attribute_autocomplete($string)
tpps_journal_autocomplete($string)
tpps_ncbi_species_autocomplete($string)
tpps_author_autocomplete($string)
tpps_project_title_autocomplete($string)
tpps_ncbi_get_taxon_id($organism, $list=FALSE)
tpps_no_header_callback(array $form, array &$form_state)
tpps_species_autocomplete($string)
tpps_load_cvterm($term, array $options=array(), $version=NULL, $refresh_cache=FALSE)
tpps_project_accession_autocomplete($string)
tpps_user_autocomplete($string)
tpps_structure_autocomplete($string)
tpps_genotype_autocomplete($string)
tpps_organization_autocomplete($string)
tpps_phenotype_autocomplete($string)
tpps_genotype_marker_autocomplete($string)