3.1.1.1. obj_tables.bio package

3.1.1.1.1. Submodules

3.1.1.1.2. obj_tables.bio.seq module

Biological attributes

Author

Jonathan Karr <karr@mssm.edu>

Date

2017-05-10

Copyright

2017, Karr Lab

License

MIT

class obj_tables.bio.seq.FeatureLocAttribute(default=None, none_value=None, verbose_name='', description='', primary=False, unique=False)[source]

Bases: obj_tables.core.LiteralAttribute

Bio.SeqFeature.FeatureLocation attribute

default[source]

default value

Type

Bio.SeqFeature.FeatureLocation

Parameters
  • default (Bio.SeqFeature.FeatureLocation, optional) – default value

  • none_value (object, optional) – none value

  • verbose_name (str, optional) – verbose name

  • description (str, optional) – description

  • primary (bool, optional) – indicate if attribute is primary attribute

  • unique (bool, optional) – indicate if attribute value must be unique

deserialize(value)[source]

Deserialize value

Parameters

value (str) – semantically equivalent representation

Returns

tuple of cleaned value and cleaning error

Return type

tuple of numpy.array, core.InvalidAttribute or None

from_builtin(json)[source]

Decode a simple Python representation (dict, list, str, float, bool, None) of a value of the attribute that is compatible with JSON and YAML

Parameters

json (dict) – simple Python representation of a value of the attribute

Returns

decoded value of the attribute

Return type

Bio.SeqFeature.FeatureLocation

serialize(value)[source]

Serialize string

Parameters

value (numpy.array) – Python representation

Returns

simple Python representation

Return type

str

to_builtin(value)[source]

Encode a value of the attribute using a simple Python representation (dict, list, str, float, bool, None) that is compatible with JSON and YAML

Parameters

value (Bio.SeqFeature.FeatureLocation) – value of the attribute

Returns

simple Python representation of a value of the attribute

Return type

dict

validate(obj, value)[source]

Determine if value is a valid value

Parameters
  • obj (Model) – class being validated

  • value (numpy.array) – value of attribute to validate

Returns

None if attribute is valid, other return

list of errors as an instance of core.InvalidAttribute

Return type

core.InvalidAttribute or None

validate_unique(objects, values)[source]

Determine if the attribute values are unique

Parameters
  • objects (list of Model) – list of Model objects

  • values (list of Bio.SeqFeature.FeatureLocation) – list of values

Returns

None if values are unique, otherwise return

a list of errors as an instance of core.InvalidAttribute

Return type

core.InvalidAttribute or None

class obj_tables.bio.seq.SeqAttribute(min_length=0, max_length=inf, default=None, none_value=None, verbose_name='', description='', primary=False, unique=False)[source]

Bases: obj_tables.core.LiteralAttribute

Bio.Seq.Seq attribute

_alphabet[source]

alphabet

Type

Bio.Alphabet.Alphabet

min_length[source]

minimum length

Type

int

max_length[source]

maximum length

Type

int

default[source]

default value

Type

Bio.Seq.Seq

Parameters
  • min_length (int, optional) – minimum length

  • max_length (int, optional) – maximum length

  • default (Bio.Seq.Seq, optional) – default value

  • none_value (object, optional) – none value

  • verbose_name (str, optional) – verbose name

  • description (str, optional) – description

  • primary (bool, optional) – indicate if attribute is primary attribute

  • unique (bool, optional) – indicate if attribute value must be unique

deserialize(value)[source]

Deserialize value

Parameters

value (str) – semantically equivalent representation

Returns

tuple of cleaned value and cleaning error

Return type

tuple of Bio.Seq.Seq, core.InvalidAttribute or None

from_builtin(json)[source]

Decode a simple Python representation (dict, list, str, float, bool, None) of a value of the attribute that is compatible with JSON and YAML

Parameters

json (dict) – simple Python representation of a value of the attribute

Returns

decoded value of the attribute

Return type

Bio.Seq.Seq

serialize(value)[source]

Serialize string

Parameters

value (Bio.Seq.Seq) – Python representation

Returns

simple Python representation

Return type

str

to_builtin(value)[source]

Encode a value of the attribute using a simple Python representation (dict, list, str, float, bool, None) that is compatible with JSON and YAML

Parameters

value (Bio.Seq.Seq) – value of the attribute

Returns

simple Python representation of a value of the attribute

Return type

dict

validate(obj, value)[source]

Determine if value is a valid value

Parameters
  • obj (Model) – class being validated

  • value (Bio.Seq.Seq) – value of attribute to validate

Returns

None if attribute is valid, other return

list of errors as an instance of core.InvalidAttribute

Return type

core.InvalidAttribute or None

validate_unique(objects, values)[source]

Determine if the attribute values are unique

Parameters
  • objects (list of Model) – list of Model objects

  • values (list of Bio.Seq.Seq) – list of values

Returns

None if values are unique, otherwise return

a list of errors as an instance of core.InvalidAttribute

Return type

core.InvalidAttribute or None

class obj_tables.bio.seq.DnaSeqAttribute(min_length=0, max_length=inf, default=None, none_value=None, verbose_name='', description='', primary=False, unique=False)[source]

Bases: obj_tables.bio.seq.SeqAttribute

Bio.Seq.Seq attribute with Bio.Alphabet.DNAAlphabet

Parameters
  • min_length (int, optional) – minimum length

  • max_length (int, optional) – maximum length

  • default (Bio.Seq.Seq, optional) – default value

  • none_value (object, optional) – none value

  • verbose_name (str, optional) – verbose name

  • description (str, optional) – description

  • primary (bool, optional) – indicate if attribute is primary attribute

  • unique (bool, optional) – indicate if attribute value must be unique

class obj_tables.bio.seq.RnaSeqAttribute(min_length=0, max_length=inf, default=None, none_value=None, verbose_name='', description='', primary=False, unique=False)[source]

Bases: obj_tables.bio.seq.SeqAttribute

Bio.Seq.Seq attribute with Bio.Alphabet.RNAAlphabet

Parameters
  • min_length (int, optional) – minimum length

  • max_length (int, optional) – maximum length

  • default (Bio.Seq.Seq, optional) – default value

  • none_value (object, optional) – none value

  • verbose_name (str, optional) – verbose name

  • description (str, optional) – description

  • primary (bool, optional) – indicate if attribute is primary attribute

  • unique (bool, optional) – indicate if attribute value must be unique

class obj_tables.bio.seq.ProteinSeqAttribute(min_length=0, max_length=inf, default=None, none_value=None, verbose_name='', description='', primary=False, unique=False)[source]

Bases: obj_tables.bio.seq.SeqAttribute

Bio.Seq.Seq attribute with Bio.Alphabet.ProteinAlphabet

Parameters
  • min_length (int, optional) – minimum length

  • max_length (int, optional) – maximum length

  • default (Bio.Seq.Seq, optional) – default value

  • none_value (object, optional) – none value

  • verbose_name (str, optional) – verbose name

  • description (str, optional) – description

  • primary (bool, optional) – indicate if attribute is primary attribute

  • unique (bool, optional) – indicate if attribute value must be unique

class obj_tables.bio.seq.FreqPosMatrixAttribute(verbose_name='', description='')[source]

Bases: obj_tables.core.LiteralAttribute

Bio.motifs.matrix.FrequencyPositionMatrix attribute

Args: init_value (object, optional): initial value default (object, optional): default value default_cleaned_value (object, optional): value to replace

None values with during cleaning, or function which computes the value to replace None values

none_value (object, optional): none value verbose_name (str, optional): verbose name description (str, optional): description primary (bool, optional): indicate if attribute is primary attribute unique (bool, optional): indicate if attribute value must be unique unique_case_insensitive (bool, optional): if true, conduct case-insensitive test of uniqueness

deserialize(value)[source]

Deserialize value

Parameters

value (str) – string representation

Returns

tuple of cleaned value and cleaning error

Return type

tuple of Bio.motifs.matrix.FrequencyPositionMatrix, core.InvalidAttribute or None

from_builtin(json)[source]

Decode a simple Python representation (dict, list, str, float, bool, None) of a value of the attribute that is compatible with JSON and YAML

Parameters

json (dict) – simple Python representation of a value of the attribute

Returns

decoded value of the attribute

Return type

Bio.motifs.matrix.FrequencyPositionMatrix

serialize(value)[source]

Serialize value to a string

Parameters

value (Bio.motifs.matrix.FrequencyPositionMatrix) – Python representation

Returns

string representation

Return type

str

to_builtin(value)[source]

Encode a value of the attribute using a simple Python representation (dict, list, str, float, bool, None) that is compatible with JSON and YAML

Parameters

value (Bio.motifs.matrix.FrequencyPositionMatrix) – value of the attribute

Returns

simple Python representation of a value of the attribute

Return type

dict

validate(obj, value)[source]

Determine if value is a valid value

Parameters
  • obj (Model) – class being validated

  • value (Bio.motifs.matrix.FrequencyPositionMatrix) – value of attribute to validate

Returns

None if attribute is valid, otherwise return list

of errors as an instance of core.InvalidAttribute

Return type

core.InvalidAttribute or None

3.1.1.1.3. Module contents