I have a database which stores information about organisms collected
during sediment toxicology research. For each sample, organisms in
sediment are collected and identified taxonomically (Order, Family,
Genus, Species).
Taxonomy lookup information in the database is stored in a recursive
table in the form:
TSN (taxa serial number)
Rank (Order, Family, Genus, Species)
Name
Parent_TSN (related Taxa at higher taxonomic level)
When the number of a particlar organism collected is entered into the
database, the count is stored along with the lowest level TSN the
organisms were identified to.
Okay - now the problem. Depending on the type of analysis being done,
a user may want organism counts at the lowest level, or rolled up to a
higher taxonomic level (usually Family). Can I write a recursive
function which will cycle through the Taxonomy database, and provide
the name of the organism at the appropriate taxonomic level? Is this a
reasonable approach with regard to speed and efficiency?
Something Like:
SELECT sample_id, 'Get Name Function(Rank, TSN)', Sum([count]) AS
NoTaxa FROM dbo.tblbenthic
Results could then be grouped and summed on the Name, to summarise
data for each sample/taxa.
Is this a reasonable approach? Or is there a better one? Did I explain
the problem well enough?
Thanks in advance,
Tim
during sediment toxicology research. For each sample, organisms in
sediment are collected and identified taxonomically (Order, Family,
Genus, Species).
Taxonomy lookup information in the database is stored in a recursive
table in the form:
TSN (taxa serial number)
Rank (Order, Family, Genus, Species)
Name
Parent_TSN (related Taxa at higher taxonomic level)
When the number of a particlar organism collected is entered into the
database, the count is stored along with the lowest level TSN the
organisms were identified to.
Okay - now the problem. Depending on the type of analysis being done,
a user may want organism counts at the lowest level, or rolled up to a
higher taxonomic level (usually Family). Can I write a recursive
function which will cycle through the Taxonomy database, and provide
the name of the organism at the appropriate taxonomic level? Is this a
reasonable approach with regard to speed and efficiency?
Something Like:
SELECT sample_id, 'Get Name Function(Rank, TSN)', Sum([count]) AS
NoTaxa FROM dbo.tblbenthic
Results could then be grouped and summed on the Name, to summarise
data for each sample/taxa.
Is this a reasonable approach? Or is there a better one? Did I explain
the problem well enough?
Thanks in advance,
Tim
Comment