Delete a dbxref from a feature

Output:

    A standard apollo feature dictionary ({"features": [{...}]})
345708
def cli(ctx, feature_id, old_db, old_accession, new_db, new_accession, organism="", sequence=""):
    
    return ctx.gi.annotations.update_dbxref(feature_id, old_db, old_accession, new_db, new_accession, organism=organism, sequence=sequence)
663689
def cleanup(self):
        
        remove = []
        for handle, assoc in self.assocs.iteritems():
            if assoc.getExpiresIn() == 0:
                remove.append(handle)
        for handle in remove:
            del self.assocs[handle]
        return len(remove), len(self.assocs)
489752
def clear_feature_symlinks(self, feature_name):
        
        logger.debug("Clearing feature symlinks for %s" % feature_name)
        feature_path = self.install_directory(feature_name)
        for d in ('bin', 'lib'):
            if os.path.exists(os.path.join(self.root_dir, d)):
                for link in os.listdir(os.path.join(self.root_dir, d)):
                    path = os.path.join(self.root_dir, d, link)
                    if feature_path in os.path.realpath(path):
                        getattr(self, 'remove_from_%s' % d)(link)
801648
def unlink(self, definition, doc1, doc2) :
        ""
        links = self.database[definition].fetchByExample( {"_from": doc1._id,"_to" : doc2._id}, batchSize = 100)
        for l in links :
            self.deleteEdge(l)
967608
private void saveFeatureIndexes(FeatureIndex[] index, String outputDir) throws IOException
	{
		logger.info("");

		// save the indexes
		for (int i=0;i<index.length;i++)
		{
			logger.debug("dic" + i + " size " + index[i].size());

			File tmp = new File(outputDir + "dic" + i);
			//File tmp = File.createTempFile("dic" + i, null);
			//tmp.deleteOnExit();

			BufferedWriter bwd = new BufferedWriter(new FileWriter(tmp));
			index[i].write(bwd);
			bwd.close();

			// add the dictionary to the model
			//model.add(tmp, "dic" + i);
		} // end for
	}
984253
def clean(self, value):
        """"""

        if isinstance(value, (list, tuple)):
            return [super(FeatureCollectionParameter, self).clean(x) for x in value]

        raise ParameterNotValidError
395848
def _db_remove_prefix(self, spec, recursive = False):
        
        if recursive:
            prefix = spec['prefix']
            del spec['prefix']
            where, params = self._expand_prefix_spec(spec)
            spec['prefix'] = prefix
            params['prefix'] = prefix
            where = 'prefix <<= %(prefix)s AND ' + where
        else:
            where, params = self._expand_prefix_spec(spec)

        sql = "DELETE FROM ip_net_plan AS p WHERE %s" % where
        self._execute(sql, params)
515268
def removeIndexOnAttribute(self, attributeName):
        '''
            
        '''
        attributeName = attributeName.lower()
        if attributeName in self.otherAttributeIndexFunctions:
                del self.otherAttributeIndexFunctions[attributeName]
        if attributeName in self._otherAttributeIndexes:
                del self._otherAttributeIndexes[attributeName]
469166
public void removeDictionary(boolean isRemoveSegDict)	{
		if(cws != null && isRemoveSegDict)
			cws.removeDictionary();

		if(oldfeaturePipe != null){
			featurePipe = oldfeaturePipe;
		}
		LinearViterbi dv = new LinearViterbi(
				(LinearViterbi) getClassifier().getInferencer());
		getClassifier().setInferencer(dv);

		dictPipe = null;
		oldfeaturePipe = null;
	}
332738
def _clean_ctx(self):
        
        try:
            if self.ctx is not None:
                self.__ctxcleanup(self.ctx)
                libcrypto.EVP_CIPHER_CTX_free(self.ctx)
                del self.ctx
        except AttributeError:
            pass
        self.cipher_finalized = True
1356661
def prune_creds_json(creds: dict, cred_ids: set) -> str:
    

    rv = deepcopy(creds)
    for key in ('attrs', 'predicates'):
        for attr_uuid, creds_by_uuid in rv[key].items():
            rv[key][attr_uuid] = [cred for cred in creds_by_uuid if cred['cred_info']['referent'] in cred_ids]

        empties = [attr_uuid for attr_uuid in rv[key] if not rv[key][attr_uuid]]
        for attr_uuid in empties:
            del rv[key][attr_uuid]

    return json.dumps(rv)
1290111
def clean(ctx, docs=False, bytecode=False, extra=''):
    ''''''
    patterns = ['build', 'dist', 'cover', 'docs/_build', '**/*.pyc', '*.egg-info', '.tox']
    for pattern in patterns:
        print('Removing {0}'.format(pattern))
        with ctx.cd(ROOT):
            ctx.run('rm -rf {0}'.format(pattern))
1068462
function decodify (featureCollection, code, properties) {
  var feature = find(featureCollection.features, {'id': code});

  if (feature) {
    feature.properties = properties;
  }

  return feature;
}
650164
def removeRef(self, attr):
        
        if attr is None: attr__o = None
        else: attr__o = attr._o
        ret = libxml2mod.xmlRemoveRef(self._o, attr__o)
        return ret
1056566
def doDelete(self, WHAT={}):
		""""""

		if hasattr(WHAT, '_modified'):
			self._addDBParam('RECORDID', WHAT.RECORDID)
			self._addDBParam('MODID', WHAT.MODID)
		elif type(WHAT) == dict and WHAT.has_key('RECORDID'):
			self._addDBParam('RECORDID', WHAT['RECORDID'])
		else:
			raise FMError, 'Python Runtime: Object type (%s) given to function doDelete as argument WHAT cannot be used.' % type(WHAT)

		if self._layout == '':
			raise FMError, 'No layout was selected'

		if self._checkRecordID() == 0:
			raise FMError, 'RecordID is missing'

		return self._doAction('-delete')
685366
def _process_feature_dbxref(self, limit):
        
        if self.test_mode:
            graph = self.testgraph
        else:
            graph = self.graph
        model = Model(graph)
        line_counter = 0
        raw = '/'.join((self.rawdir, 'feature_dbxref'))
        LOG.info("processing feature_dbxref mappings")
        with open(raw, 'r') as f:
            f.readline()  # read the header row; skip
            filereader = csv.reader(f, delimiter='\t', quotechar='\"')
            for line in filereader:

                (feature_dbxref_id, feature_id, dbxref_id, is_current) = line

                # 431890	3091292	596211	t
                # 2	9	55044	t
                # 3	9	55045	t
                # 437595	4551668	277309	t
                # 437596	4551662	277307	t

                if is_current == 'f':
                    # not sure what to do with it?
                    continue

                feature_key = feature_id

                if self.test_mode and int(feature_key) not in \
                        self.test_keys['gene'] + self.test_keys['allele']:
                    continue

                if feature_key not in self.idhash['feature']:
                    # some features may not be found in the hash
                    # if they are "analysis features"
                    # LOG.debug("Feature %s not found in hash", feature_key)
                    continue
                feature_id = self.idhash['feature'][feature_key]
                dbxref_key = dbxref_id
                dbxrefs = self.dbxrefs.get(dbxref_key)

                if dbxrefs is not None:
                    for d in dbxrefs:
                        # need to filter based on db ?
                        # TODO make other species' identifiers primary??
                        # instead of flybase?
                        did = dbxrefs.get(d)
                        if did.endswith('&class=protein'):
                            did = did[0:len(dbxrefs)-15]
                        # don't make something sameAs itself
                        if did == feature_id:
                            continue
                        dlabel = self.label_hash.get(did)
                        if re.search(r'FB(gn|og)', feature_id):
                            # only want to add equivalences for fly things
                            if not re.match(r'OMIM', did):
                                # these are only omim diseases, not genes;
                                # we shouldn't be adding these here anyway
                                # model.addClassToGraph(did, dlabel)
                                # model.addXref(feature_id, did)
                                pass  # True  # that
                        elif did is not None and dlabel is not None \
                                and feature_id is not None:
                            model.addIndividualToGraph(did, dlabel)
                            model.addXref(feature_id, did)
                        line_counter += 1

                if not self.test_mode \
                        and limit is not None and line_counter > limit:
                    break

                # FIXME - some flybase genes are xrefed to OMIM diseases!!!!!!
                # for example,
                # FBog0000375495 xref to omim 601181 (gene)
                # and 608033 (phenotype)

        return
97232
def _strip_feature_version(featureid):
    
    version_detector = re.compile(r"(?P<featureid>.*)(?P<version>\.\d+)")
    match = version_detector.match(featureid)
    if match:
        return match.groupdict()["featureid"]
    else:
        return featureid