Page MenuHomec4science

sequence.py
No OneTemporary

File Metadata

Created
Sat, Jul 12, 16:32

sequence.py

#!/usr/bin/env python
# -*- coding: utf-8 -*-
" module containing class Sequence"
class Sequence(object):
"""
class Sequence: are used to store information about a molecular sequences (DNA, RNA or protein). These sequence are noted as a succession of letters, usually ATTCG, and have a name (seqID). The sample id of the sequence is also stored and will allow to retrieve the metadata linked with this sample. Optionally the sequence can be in a cluster of sequences and have a quality score.
"""
# ------------------------------------------------------------------ #
# Constructors/Destructors #
# ------------------------------------------------------------------ #
def __init__(self,ID, sample,sequence):
"""__init__: Documentation TODO """
# Members ---------------------- #
# string seqID
self.seqID = ID
# Sample seq_sample
self.seq_sample = sample
# int seq_lenght
self.seq_lenght = len(sequence)
# string seq
self.seq = sequence
# Cluster seq_cluster is attributed after initialization
self.seq_cluster_id = None
# sequence quality score (optional)
self.qual = None
def __del__(self):
"""__del__: not implemented """
pass
def printSequence(self, cluster_info = False):
""" printSequence : print information about the object of type Sequence"""
print 'sequence ', self.seqID,'\n'
print self.seq,'\n'
print 'lenght : ', self.seq_lenght,'\n'
print 'sample ', self.seq_sample,'\n'
print 'cluster : ', self.seq_cluster_id,'\n'
#to implement : add a mean to print information about the cluster
#if cluster_info :
# print 'taxonomic affiliation : ', self.seq_cluster.taxonomic_affiliation
# print 'with ', self.seq_cluster.taxon_similarity, ' %','\n'
##########################################################################
if __name__ == '__main__':
test = Sequence()

Event Timeline