Ejemplo n.º 1
0
def write_ice_entry(ice_client, ice_id1, ice_id2, typ, write_seq, group_names):
    '''Write a composite ICE entry (part in plasmid, or plasmid in strain).'''
    comp1 = ice_client.get_ice_entry(ice_id1)
    comp2 = ice_client.get_ice_entry(ice_id2)

    name = comp1.get_metadata()['name'] + \
        ' (' + comp2.get_metadata()['name'] + ')'

    product = ICEEntry(typ=typ)
    product.set_values({'name': name[:127], 'shortDescription': name})

    taxonomy = comp1.get_parameter('Taxonomy')

    if taxonomy:
        product.set_parameter('Taxonomy', taxonomy)

    ice_client.set_ice_entry(product)
    ice_client.add_link(product.get_ice_id(), comp1.get_ice_id())
    ice_client.add_link(product.get_ice_id(), comp2.get_ice_id())

    if write_seq:
        product.set_dna(dna_utils.concat(
            [comp1.get_dna(), comp2.get_dna()]))

    ice_client.set_ice_entry(product)

    if group_names:
        groups = ice_client.get_groups()

        for group_name in group_names:
            ice_client.add_permission(product.get_ice_id(),
                                      groups[group_name])

    return product, comp1, comp2
Ejemplo n.º 2
0
    def test_set_dna(self):
        '''Tests set_dna method.'''
        dna1 = _read('sbol.xml')
        dna2 = _read('sbol2.xml')

        ice_entry = ICEEntry(typ='PLASMID', dna=dna1)
        self.__ice_client.set_ice_entry(ice_entry)

        ice_entry.set_dna(dna2)
        self.__ice_client.set_ice_entry(ice_entry)

        self.assertEqual(ice_entry.get_seq(), dna2['seq'])
Ejemplo n.º 3
0
    def test_set_dna(self):
        '''Tests set_dna method.'''
        dna1 = _read('sbol.xml')
        dna2 = _read('sbol2.xml')

        ice_entry = ICEEntry(typ='PLASMID', dna=dna1)
        self.__ice_client.set_ice_entry(ice_entry)

        ice_entry.set_dna(dna2)
        self.__ice_client.set_ice_entry(ice_entry)

        self.assertEqual(ice_entry.get_seq(), dna2['seq'])
Ejemplo n.º 4
0
    def __write_plasmid(self, design):
        '''Writes plasmids to ICE.'''
        ice_entry = ICEEntry(typ='PLASMID')
        self.__ice_client.set_ice_entry(ice_entry)
        self.__add_permissions(ice_entry)
        design['ice_id'] = ice_entry.get_ice_id()

        _set_metadata(ice_entry, design['name'], ' '.join(design['design']),
                      'PLASMID')

        ice_entry.set_dna(design['plasmid'])
        self.__ice_client.set_ice_entry(ice_entry)

        # Add link from plasmid -> parts:
        for part_id in design['design']:
            self.__ice_client.add_link(design['ice_id'], part_id)