Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121334679
taxonomy_collection.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jul 10, 03:05
Size
1 KB
Mime Type
text/x-python
Expires
Sat, Jul 12, 03:05 (2 d)
Engine
blob
Format
Raw Data
Handle
27294589
Attached To
R2010 molecular_data_processing
taxonomy_collection.py
View Options
#!/usr/bin/env python
# -*- coding: utf-8 -*-
" todo:: "
##########################################################################
from
taxonomy
import
Taxonomy
##########################################################################
class
TaxonomyCollection
(
object
):
"""
class TaxonomyCollection: stores a collection of taxonomic affiliations in a dictionary self.dict with referenceID as key
"""
# ------------------------------------------------------------------ #
# Constructors/Destructors #
# ------------------------------------------------------------------ #
def
__init__
(
self
):
"""__init__: A taxonomic collection is initialised with a dictionnary of taxonomy containing the unknown taxonomy, the other taxonomy are added after with the function addTaxonomy """
# Members ---------------------- #
# create an unknown taxonomy
unknown_taxonomy
=
Taxonomy
([
'k__unknown'
,
'p__unknown'
,
'c__unknown'
,
'o__unknown'
,
'f__unknown'
,
'g__unknown'
,
's__unknown'
])
# dictionnary containing the clusters
self
.
dict
=
{
'NONE'
:
unknown_taxonomy
}
def
__del__
(
self
):
"""__del__: to be implemented"""
pass
def
addTaxonomy
(
self
,
ref_id
,
new_taxonomy
):
""" addTaxonomy : add the argument ref_id as key in the taxonomy collection and the new_taxonomy as value """
self
.
dict
[
ref_id
]
=
new_taxonomy
return
0
def
getTaxonomy
(
self
,
ref_id
):
""" getTaxonomy : return the taxonomy corresponding to the reference id given in argument """
return
self
.
dict
[
ref_id
]
##########################################################################
if
__name__
==
'__main__'
:
test
=
ClusterCollection
()
Event Timeline
Log In to Comment