Exemplo n.º 1
0
                FloatOption(self, 'width', hint_digits=2),
                FloatOption(self, 'height', hint_digits=2),
                IntOption(self, 'max_width', hint_maximum=300),
                IntOption(self, 'max_height', hint_maximum=300)]

class LocatorSetting(ComponentSetting):
    component_class = Locator
    setting_types = dict(alpha=FloatSetting,
                         always_show=BoolSetting,
                         height=FloatSetting,
                         max_height=IntSetting,
                         max_width=IntSetting,
                         timeout=FloatSetting,
                         width=FloatSetting)
    
presets.register_component_defaults(LocatorSetting)

# TODO: Selection appearance settings.

class SelectionOverlay(Overlay):
    __gproperties__ = dict(
        area_dash = (
            gobject.TYPE_PYOBJECT,
            'area dash',
            'edge dash for area selections',
            gobject.PARAM_READWRITE),
        area_fill = (
            gobject.TYPE_PYOBJECT,
            'area fill',
            'background fill for area selections',
            gobject.PARAM_READWRITE),
Exemplo n.º 2
0
            for i, f in enumerate(feature_list):
                if feature == f:
                    break
                if feature.mapping.start < f.mapping.start:
                    feature_list.insert(i, feature)
                    break
            else:
                feature_list.append(feature)
                new_features.append(feature)
        if new_features:
            self.emit('changed', Change('features', 'added', new_features))
   
class SequenceFeatureRegistrySetting(ComponentSetting):
    component_class = SequenceFeatureRegistry

presets.register_component_defaults(SequenceFeatureRegistrySetting)
        
# Actions:

def iter_gff_annotations(gff_file, filter=None):
    for line in gff_file:
        line = line.strip()
        if not line or line.startswith('#'):
            continue
        yield GFFFeature.from_gff_line(line)

class ImportGFFAnnotations(Action):
    action_name = 'import-gff-annotations'
    path = ['Import', 'Sequence features', 'gff annotations']
    tooltip = 'Import feature annotations from a general feature format file.'
    
Exemplo n.º 3
0
                self.categories[category][sequence_index] = None
                removed_entries.append(old_entry)
                changed_categories.add(category)
        if removed_entries:
            self.emit('changed', Change(changed_categories, 'removed', removed_entries))
        
    def get_entry(self, category, sequence_index):
        c = self.categories.get(category, None)
        if c:
            return c[sequence_index]
    
    def clear(self):
        self.categories = {}
        self.emit('changed', Change())
        
    def integrate(self, ancestor, name=None):
        msa = ancestor.find_descendant('data.msa')
        if msa is None:
            msa = ancestor.integrate_descendant('data.msa')
            if msa is None:
                raise TypeError('no suitable parent')
        self.msaview_name = msa.add(self, name)
        self.msa = msa
        return self.msaview_name

class SequenceInformationRegistrySetting(ComponentSetting):
    component_class = SequenceInformationRegistry

presets.register_component_defaults(SequenceInformationRegistrySetting)
        
Exemplo n.º 4
0
                    pos_region = self.get_position_region(pos_start, pos_end, sequence_index)
                    areas.append(Area(pos_region, Region(sequence_index, 1)))
        return areas
    
    def integrate(self, ancestor, name=None):
        self.msaview_name = ancestor.add(self, name)
        m = ancestor.find_ancestor('root')
        m.descendants.register(self.features, self.features.msaview_name)
        m.descendants.register(self.sequence_information, self.sequence_information.msaview_name)
        return self.msaview_name 

    
class MSASetting(ComponentSetting):
    component_class = MSA
    
presets.register_component_defaults(MSASetting)

# Actions

class ReadFasta(Action):
    action_name = 'open-fasta-alignment'
    path = ['Open', 'Fasta alignment']
    tooltip = 'Read a gapped fasta alignment file.'

    @classmethod
    def applicable(cls, target=None, coord=None):
        if target.msaview_classname == 'data.msa':
            return cls(target)

    def get_options(self):
        return [Option(propname='location', default='', value='', nick='Location', tooltip='The alignment file to read.')]