def add_feature(self, feature, **kwargs): """ add_feature(self, feature, **args) o feature Bio.SeqFeature object o **kwargs Keyword arguments for Feature. Named attributes of the Feature Add a Bio.SeqFeature object to the diagram (will be stored internally in a Feature wrapper """ id = self.next_id # get id number self.features[id] = Feature(self, id, feature) # add feature for key in kwargs: if key == "colour" or key == "color": #Deal with "colour" as a special case by also mapping to color. #If Feature.py used a python property we wouldn't need to call #set_color explicitly. However, this is important to make sure #every color gets mapped to a colors object - for example color #numbers, or strings (may not matter for PDF, but does for PNG). self.features[id].set_color(kwargs[key]) continue setattr(self.features[id], key, kwargs[key]) self.next_id += 1 # increment next id
from _Saveable import Saveable from _Feature import Feature from _Feature_Data_Struct import Feature_Data_Struct from _Quiz import Quiz from _Question import Question from _Profile_Features import Profile_Features s = Saveable(file_location="bob") print(s) ##Feature testt f_1 = Feature(name="chicken", value=5, weight=6) f_2 = Feature(name="chicken", value=5, weight=6) f_3 = Feature(name="Bird", value=5, weight=6) f_4 = Feature(name="chicken", value=5, weight=6) print("f1", f_1) print("f2", f_2) print("f3", f_3) print("f1 = f2", f_1 == f_2) print("f1 = f3", f_1 == f_3) print("f1 > f2", f_1 > f_2) print("f1 > f3", f_1 > f_3) print("f1 < f2", f_1 < f_2) print("f1 < f3", f_1 < f_3) ##Feature_data_struct testt ls_f = [f_1, f_2, f_3, f_4] ls_f2 = [f_1, f_1, f_1, f_1] fds = Feature_Data_Struct(ls_f) print("ls_f", fds) fds.sort()