Opened 15 years ago

Closed 9 years ago

#213 closed enhancement (discarded)

generalize ACI to work with groups

Reported by: epruesse Owned by: westram
Priority: normal Milestone:
Component: Library (DB) Version: SVN
Keywords: ACI, tree, taxonomy Cc:

Description (last modified by westram)

Currently, ACI et al always operate on single sequences. The only exception that I know of is taxonomy which also works on groups.

It would be very helpful for a number of tasks to be able to work with groups more flexibly.

Examples:

  • counting the number of species in a group (all or marked)
  • computing the fraction that is marked

Also allow to configure group-number shown at groups in tree-display using an ACI (see discussion in #209)

related: #652

Change History (4)

comment:1 Changed 15 years ago by westram

Quite difficult because

  • the ACI always operates on one DB-item (e.g. species, organism, gene or SAI)
  • groups are no DB-items, they are just a property of the (currently selected) tree.

Possible implementation:

  • add ACI commands to generate selections of DB-Items:
    • selections could be stored as string
      • e.g. "SELECTION!SPECIESELEMCOUNT:id1,id2,id3,...,idN"
    • possible commands:
      • select(ITEMTYPE[,attribute,value])
        where
        • ITEMTYPE=['SPECIES','GENE','ORGANISM','SAI']
        • attribute=ACI
        • value=string Returns selection of items for which 'attribute' evaluates to 'value'.
      • select_marked(ITEMTYPE)
      • tree_members(ITEMTYPE[,treename]) — only for SPECIES and ORGANISM
  • add ACI commands modifying selection(s) of DB-Items:
    • union(selection1,selection2,…)
    • intersection(selection1,selection2,…)
    • difference(selection1,selection2)
    • keep_elements(selection,attribute,value) — keep all elements where 'attribute' evaluates to 'value'
    • remove_elements(selection,attribute,value) — remove all elements where 'attribute' evaluates to 'value'
    • genes_of(ORGANISM-selection)
    • organisms_of(GENE-selection)
  • add ACI commands retrieving information from selections:
    • elements(selection) — retrieves number of elements

Your example

E.g. counting the number of species in a group that are marked. Or computing the fraction that is marked.

could be done with the above commands using

tree_members(SPECIES)|keep_elements("taxonomy","your/wanted/group")|dd;intersection(select_marked(SPECIES))|elements|swap|per_cent

comment:2 Changed 9 years ago by westram

  • Description modified (diff)

comment:3 Changed 9 years ago by westram

  • Description modified (diff)

comment:4 Changed 9 years ago by westram

  • Owner changed from devel to westram
  • Resolution set to discarded
  • Status changed from new to closed

Decided against implementing ACI commands for groups (at least atm/in the way sketched above).

Reasons:

  • I fear commands sketched above would be far too slow for use in tree display
  • beside counting marked/all of groups I got no ideas for useful commands
  • group-ACIs would only apply to
    • displayed tree and
    • planned group-search (#652)

For now, I'll implement some predefined ways to display group/marked counters together with #118.

For later, a better way to implement group-specific commands would be to implement a possibility to inject commands into ACI by caller (e.g. group-search or tree-display).

Note: See TracTickets for help on using tickets.