FlyBase for Developers

FlyBase for Developers

  • HowTo
  • API
  • Chado
  • Downloads
  • GitHub
  • Help

›Functions

HowTos

  • Index
  • Symbol Lookup

API

  • Overview

Chado

  • General Information
  • Functions

    • FlyBase Specific

Downloads

  • Overview

FlyBase Chado Functions

Description

This page describes custom database functions that FlyBase has added to Chado to simplify working with FlyBase data. For general Chado functions please refer to the GMOD Chado documentation.

Source Code

  • chado/schema (GitHub)

ID Utilities

data_class

flybase.data_class(FlyBase_ID)

Takes a FlyBase ID and returns the 4 letter FlyBase data class.

e.g. FBgn0000490 -> FBgn

select flybase.data_class('FBgn0000490');

update_ids

flybase.update_ids(FlyBase_ID)

Takes a single ID or an array of FlyBase Gene IDs (FBgn) and validates them against the current database. A 3 column result set is returned containing the submitted ID, the updated ID, and an update status.

Update status

StatusDescription
currentSubmitted ID is current, there are no changes.
updatedThe submitted ID is not current but the ID was cleanly updated to the current ID.
splitThe submitted ID is not current and there are multiple possible new IDs.

An ID that is involved in a split will have two or more entries in the result. One for each of the possible new gene IDs.

Parameters

NameDescriptionRequiredDefault
FlyBase_IDOne ID or an array of IDsYN/A

Returns

NameDescription
submitted_idThe ID originally submitted.
updated_idThe updated ID
statusUpdate status (current, updated, split)
select * from flybase.update_ids('FBgn0000490');
select * from flybase.update_ids(ARRAY['FBgn0000490','FBgn0002675','FBgn0030866','FBgn0031810']);

Symbols and Names

current_symbol

flybase.current_symbol(FlyBase_ID)

Takes a current FlyBase ID and returns the current symbol. Any current FlyBase data class ID can be passed in regardless of the hub table that is used for that data class.

select flybase.current_symbol('FBgn0000490');
select flybase.current_symbol('FBgg0000546');
select f.uniquename, flybase.current_symbol(f.uniquename)
  from feature f
  where f.uniquename ~ '^FBgn[0-9]+$'
    and f.is_obsolete=false
limit 5;

current_fullname

flybase.current_fullname(FlyBase_ID)

Takes a current FlyBase ID and returns the current full name. Any current FlyBase data class ID can be passed in regardless of the hub table that is used for that data class.

select flybase.current_fullname('FBgn0000490');
select flybase.current_fullname('FBgg0000546');
select f.uniquename, flybase.current_fullname(f.uniquename)
  from feature f
  where f.uniquename ~ '^FBgn[0-9]+$'
    and f.is_obsolete=false
limit 5;

current_synonym

flybase.current_synonym(FlyBase_ID, synonym_type)

Takes a current FlyBase ID and a synonym type and returns the current synonym.synonym_sgml value.

select flybase.current_synonym('FBgn0000490','symbol'),
       flybase.current_synonym('FBgn0000490','fullname');

Relationships

These functions are for querying object relationships using tables such as feature_relationship.

get_feature_relationship

flybase.get_feature_relationship(FlyBase_ID(s), relationship_type, data_class, relationship_direction)

Takes one or more FlyBase IDs, relationship type(s), data class(es) (optional), and relationship direction (optional) and returns the related entities.

This can be used to fetch all transcripts of a gene, all alleles of a gene, orthologs, etc.

Parameters

NameDescriptionRequiredDefault
FlyBase_IDOne ID or an array of IDs to find other related entities for.YN/A
relationship_typeOne or more cvterm.name values used to type the relationship via feature_relationship.type_id.YN/A
data_classOne or more FlyBase data classes to limit the results to.Nall data classes
relationship_directionThe direction you wish to fetch objects for ('object' or 'subject').Nsubject

Multiple values in the relationship_type and data_class parameters need to be delimited with a pipe '|' character.

e.g. 'associated_with|partof' or 'FBal|FBtp|FBti'

Returns

NameDescription
feature_relationship_idSame as feature_relationship table
object_idSame as feature_relationship table
subject_idSame as feature_relationship table
uniquenamefeature.uniquename of the related entity.
symbolCurrent symbol of the related entity.
rankSame as feature_relationship table.
valueSame as feature_relationship table.
typeThe corresponding cvterm.name value for the feature_relationship.type_id field.
-- Single IDs
select * from flybase.get_feature_relationship('FBgn0000490', 'associated_with|partof', 'FBti|FBtr');
select * from flybase.get_feature_relationship('FBgn0000490', 'alleleof', 'FBal');
select * from flybase.get_feature_relationship('FBgn0000490', 'alleleof', 'FBal', 'subject');
select * from flybase.get_feature_relationship('FBgn0000490', 'orthologous_to', 'FBgn|FBog');

-- Multiple IDs
-- Using an array literal
select *
   from flybase.get_feature_relationship(
     array['FBgn0000490','FBgn0013765'],
     'alleleof',
     NULL,
     'subject')
;
-- From a query result.
select *
   from flybase.get_feature_relationship(
     array(
       select f.uniquename
         from feature f
         where uniquename in ('FBgn0000490','FBgn0013765')
     ),
     'alleleof',
     NULL,
     'subject')
;
← General InformationOverview →
  • Description
  • Source Code
  • ID Utilities
    • data_class
    • update_ids
  • Symbols and Names
    • current_symbol
    • current_fullname
    • current_synonym
  • Relationships
    • get_feature_relationship
Docs
HowToAPIChadoDownloads
Community
TwitterYouTubeGoogle GroupsEmail
More
FlyBase.orgGitHubStar
Copyright © 2019 FlyBase and the Genetics Society of America