Get PubChem Compound Identifier (CID), obtained via REST call to PubChem
 @return [String]
970124
def cid
      pug_uri = "https://pubchem.ncbi.nlm.nih.gov/rest/pug/"
      update(:cid => RestClientWrapper.post(File.join(pug_uri, "compound", "inchi", "cids", "TXT"),{:inchi => inchi}).strip) unless self["cid"] 
      self["cid"]
    end
375531
def get_compound_ids(self):
        
        cursor = self.conn.cursor()
        cursor.execute('SELECT inchikey_id FROM metab_compound')
        self.conn.commit()
        for row in cursor:
            if not row[0] in self.compound_ids:
                self.compound_ids.append(row[0])
750271
function getIdsFromPayload(payload, conf, path) {
    return payload.map(function (payloadPiece) { return getId(payloadPiece, conf, path, payload); });
}
584389
def register_pubkey(self):
        
        p = pkcs_os2ip(self.dh_p)
        g = pkcs_os2ip(self.dh_g)
        pn = dh.DHParameterNumbers(p, g)

        y = pkcs_os2ip(self.dh_Ys)
        public_numbers = dh.DHPublicNumbers(y, pn)

        s = self.tls_session
        s.server_kx_pubkey = public_numbers.public_key(default_backend())

        if not s.client_kx_ffdh_params:
            s.client_kx_ffdh_params = pn.parameters(default_backend())
554173
def IdentifiersIndexer(instance):
    
    identifiers = instance.Schema()['Identifiers'].get(instance)
    return [safe_unicode(i['Identifier']) for i in identifiers]
1000613
public void loadFromDirectAccess(){
		String pdbId = "1A4W";

		StructureProvider pdbreader = new MMCIFFileReader();

		try {
			Structure s = pdbreader.getStructureById(pdbId);

			System.out.println("Getting chain H of 1A4W");

			List<Chain> hs = s.getNonPolyChainsByPDB("H");

			Chain h = hs.get(0);
			List<Group> ligands = h.getAtomGroups();

			System.out.println("These ligands have been found in chain " + h.getName());

			for (Group l:ligands){
				System.out.println(l);
			}

			System.out.println("Accessing QWE directly: ");
			Group qwe = s.getNonPolyChainsByPDB("H").get(2).getGroupByPDB(new ResidueNumber("H",373,null));

			System.out.println(qwe.getChemComp());

			System.out.println(h.getSeqResSequence());
			System.out.println(h.getAtomSequence());
			System.out.println(h.getAtomGroups(GroupType.HETATM));

			System.out.println("Entities: " + s.getEntityInfos());

		} catch (Exception e) {
			e.printStackTrace();
		}


	}
1009050
public PubType getPubTypeList(int i) {
    if (Header_Type.featOkTst && ((Header_Type)jcasType).casFeat_pubTypeList == null)
      jcasType.jcas.throwFeatMissing("pubTypeList", "de.julielab.jules.types.Header");
    jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Header_Type)jcasType).casFeatCode_pubTypeList), i);
    return (PubType)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Header_Type)jcasType).casFeatCode_pubTypeList), i)));}
1083205
private String getProducerId(final ProceedingJoinPoint pjp, final String aPId, final boolean withMethod) {
		if (!StringUtils.isEmpty(aPId))
			return aPId;

		String res = pjp.getSignature().getDeclaringTypeName();
		try {
			res = MoskitoUtils.producerName(res);
		} catch (final RuntimeException e) {
			if (logger.isTraceEnabled())
				logger.trace(e.getMessage(), e);
		}
		if (withMethod) {
			res += DOT + getMethodStatName(pjp.getSignature());
		}
		return res;
	}
1335998
def getResourceMapPid(self):
        
        ore = [
            o for o in self.subjects(predicate=rdflib.RDF.type, object=ORE.ResourceMap)
        ][0]
        pid = [str(o) for o in self.objects(predicate=DCTERMS.identifier, subject=ore)][
            0
        ]
        return pid
389603
def _get_persistent_id(self, o):
        
        if type(o) in self.hash_dedup:
            oid = o.__class__.__name__ + "-" + str(hash(o))
            self._object_cache[oid] = o
            return oid

        if any(isinstance(o,c) for c in self.unsafe_key_baseclasses):
            return None

        try:
            return self._uuid_cache[o]
        except KeyError:
            pass
        except TypeError:
            return None

        #if type(o) in self.uuid_dedup:
        #    return self._get_id(o)
        if o.__class__.__module__.split('.')[0] in self.module_dedup or o.__class__ in self.uuid_dedup:
            oid = o.__class__.__name__.split(".")[-1] + '-' + str(uuid.uuid4())
            self._object_cache[oid] = o
            self._uuid_cache[o] = oid
            return oid

        return None
975602
def identify(label, column_type = :integer)
      if column_type == :uuid
        NamedSeeds.uuid_v5(label)
      else
        Zlib.crc32(label.to_s) % MAX_ID
      end
    end
1193450
def get_composition(self):
        '''
        '''
        strc = self.get_output_structure()
        counts = Counter(strc.get_chemical_symbols())
        return ''.join(k if counts[k]==1 else '%s%d'%(k,counts[k]) \
                for k in sorted(counts))
1011617
def compound_id(obj):
    """"""
    if isinstance(obj, (Category, Session)):
        raise TypeError('Compound IDs are not supported for this entry type')
    elif isinstance(obj, Event):
        return unicode(obj.id)
    elif isinstance(obj, Contribution):
        return '{}.{}'.format(obj.event_id, obj.id)
    elif isinstance(obj, SubContribution):
        return '{}.{}.{}'.format(obj.contribution.event_id, obj.contribution_id, obj.id)
31972
def mol(self):
        
        if self._mol is None:
            apiurl = 'http://www.chemspider.com/MassSpecAPI.asmx/GetRecordMol?csid=%s&calc3d=false&token=%s' % (self.csid,TOKEN)
            response = urlopen(apiurl)
            tree = ET.parse(response)
            self._mol = tree.getroot().text
        return self._mol
1142349
def get(identifier, namespace='cid', domain='compound', operation=None, output='JSON', searchtype=None, **kwargs):
    """"""
    if (searchtype and searchtype != 'xref') or namespace in ['formula']:
        response = request(identifier, namespace, domain, None, 'JSON', searchtype, **kwargs).read()
        status = json.loads(response.decode())
        if 'Waiting' in status and 'ListKey' in status['Waiting']:
            identifier = status['Waiting']['ListKey']
            namespace = 'listkey'
            while 'Waiting' in status and 'ListKey' in status['Waiting']:
                time.sleep(2)
                response = request(identifier, namespace, domain, operation, 'JSON', **kwargs).read()
                status = json.loads(response.decode())
            if not output == 'JSON':
                response = request(identifier, namespace, domain, operation, output, searchtype, **kwargs).read()
    else:
        response = request(identifier, namespace, domain, operation, output, searchtype, **kwargs).read()
    return response
791187
def pdbechem_parse(download = False, filename = '/kortemmelab/shared/mirror/PDBeChem/chem_comp.xml'):
    ''''''

    xml_data = None
    if download:
        # this URL will go out of date
        try:
            resource = ['ftp.ebi.ac.uk', '/pub/databases/msd/pdbechem/chem_comp.xml']
            xml_data = get_insecure_resource(resource[0], resource[1])
        except FTPException550, e:
            colortext.error("This resource ftp://%s appears to be missing. The link may need to be updated in the script." % "".join(resource))
            raise
        except Exception, e:
            colortext.error("An error occurred downloading ftp://%s:\n%s" % ("".join(resource), str(e)))
            raise
    else:
        xml_data = read_file(filename)

    _dom = parseString(xml_data)

    main_tag = _dom.getElementsByTagName("chemCompList")
    assert(len(main_tag) == 1)
    main_tag = main_tag[0]
    entries = main_tag.getElementsByTagName("chemComp")

    parsed_dict = {}
    properties = ["id", "name", "formula", "systematicName", "stereoSmiles", "nonStereoSmiles", "InChi"]
    for e in entries:
        d = {}
        for p in properties:
            t = e.getElementsByTagName(p)
            assert(len(t) <= 1)
            if p == "id":
                assert(len(t) == 1 and t[0].childNodes)
            if len(t):
                if t[0].childNodes:
                    d[p] = t[0].firstChild.nodeValue
                else:
                    d[p] = None
            else:
                d[p] = None
        parsed_dict[d['id']] = d
    return parsed_dict
612036
def fetch_identifier_component(self, endpoint_name, identifier_data, query_params=None):
        """"""

        if query_params is None:
            query_params = {}

        identifier_input = self.get_identifier_input(identifier_data)

        return self._api_client.fetch(endpoint_name, identifier_input, query_params)