Returns the XML for pdb_id if the tag exists.
327572
def get_xml(self, pdb_id):
        ''' '''
        self.tmp_string = None
        context = etree.iterparse(io.BytesIO(self.xml_contents), events=('end',), tag=self.PDBTM_entry_tag_type)
        try:
            fast_iter(context, self._get_xml, pdb_id = pdb_id.upper())
        except EarlyOut: pass
        return self.tmp_string
783920
def statexml2pdb(topology, state, output=None):
    
    state = Restart.from_xml(state)
    system = SystemHandler.load(topology, positions=state.positions)
    if output is None:
        output = topology + '.pdb'
    system.write_pdb(output)
99984
def read_pdb(pdbfname, as_string=False):
    """"""
    pybel.ob.obErrorLog.StopLogging()  # Suppress all OpenBabel warnings
    if os.name != 'nt':  # Resource module not available for Windows
        maxsize = resource.getrlimit(resource.RLIMIT_STACK)[-1]
        resource.setrlimit(resource.RLIMIT_STACK, (min(2 ** 28, maxsize), maxsize))
    sys.setrecursionlimit(10 ** 5)  # increase Python recoursion limit
    return readmol(pdbfname, as_string=as_string)
1089286
def pdb(self):
        """"""
        pdb_str = write_pdb(
            [self], ' ' if not self.tags['chain_id'] else self.tags['chain_id'])
        return pdb_str
98242
def retrieve(pdb_id, cache_dir = None, strict = True, parse_ligands = False):
        ''''''

        # Check to see whether we have a cached copy
        pdb_id = pdb_id.upper()
        if cache_dir:
            filename = os.path.join(cache_dir, "%s.pdb" % pdb_id)
            if os.path.exists(filename):
                return PDB(read_file(filename), strict = strict, parse_ligands = parse_ligands)

        # Get a copy from the RCSB
        contents = rcsb.retrieve_pdb(pdb_id)

        # Create a cached copy if appropriate
        if cache_dir:
            write_file(os.path.join(cache_dir, "%s.pdb" % pdb_id), contents)

        # Return the object
        return PDB(contents, strict = strict, parse_ligands = parse_ligands)
1149671
@Override
	public  List<ScopDomain> getDomainsForPDB(String pdbId) {

		try {
			ensureClaInstalled();
		} catch (IOException e) {
			throw new ScopIOException(e);
		}

		List<ScopDomain> doms = domainMap.get(pdbId.toLowerCase());

		List<ScopDomain> retdoms = new ArrayList<ScopDomain>();

		if ( doms == null)
			return retdoms;

		for ( ScopDomain d : doms){
			try {
				ScopDomain n = (ScopDomain) d.clone();
				retdoms.add(n);
			}  catch (CloneNotSupportedException e){
				throw new RuntimeException(ScopDomain.class + " subclass does not support clone()", e);
			}


		}
		return retdoms;
	}
663168
def from_non_aligned_residue_IDs(Chain, StartResidueID, EndResidueID, Sequence = None):
        ''''''
        return PDBSection(Chain, PDB.ResidueID2String(StartResidueID), PDB.ResidueID2String(EndResidueID), Sequence = Sequence)
749177
def fetch_pdb(self, pdb_code):
        
        self.pdb_path, self.pdb_text = self._fetch_pdb(pdb_code)
        self._df = self._construct_df(pdb_lines=self.pdb_text.splitlines(True))
        return self
1011399
function getTagsByBook( $blog_id, $tag_group ) {

		/** @var $wpdb \wpdb */
		global $wpdb;

		$sql = "SELECT DISTINCT {$this->dbTagsTable}.id, {$this->dbTagsTable}.tag FROM {$this->dbTagsTable}
 				INNER JOIN {$this->dbLinkTable} ON {$this->dbLinkTable}.tags_id = {$this->dbTagsTable}.id
 				INNER JOIN {$this->dbTable} ON {$this->dbTable}.users_id = {$this->dbLinkTable}.users_id AND {$this->dbTable}.blogs_id = {$this->dbLinkTable}.blogs_id
 				WHERE {$this->dbLinkTable}.tags_group = %d AND {$this->dbLinkTable}.users_id = %d AND {$this->dbLinkTable}.blogs_id = %d
 				ORDER BY {$this->dbTagsTable}.tag ASC ";

		return $wpdb->get_results( $wpdb->prepare( $sql, $tag_group, $this->userId, $blog_id ), ARRAY_A ); // @codingStandardsIgnoreLine
	}
110463
def pp_xml(body):
    """"""
    pretty = xml.dom.minidom.parseString(body)
    return pretty.toprettyxml(indent="  ")
619466
public int getTag() throws MAPException {
        if (this.choice == PSSubscriberStateChoice.notProvidedFromSGSNorMME) {
            return _ID_notProvidedFromSGSNorMME;
        } else if (this.choice == PSSubscriberStateChoice.psDetached) {
            return _ID_ps_Detached;
        } else if (this.choice == PSSubscriberStateChoice.psAttachedNotReachableForPaging) {
            return _ID_ps_AttachedNotReachableForPaging;
        } else if (this.choice == PSSubscriberStateChoice.psAttachedReachableForPaging) {
            return _ID_ps_AttachedReachableForPaging;
        } else if (this.choice == PSSubscriberStateChoice.psPDPActiveNotReachableForPaging) {
            return _ID_ps_PDP_ActiveNotReachableForPaging;
        } else if (this.choice == PSSubscriberStateChoice.psPDPActiveReachableForPaging) {
            return _ID_ps_PDP_ActiveReachableForPaging;
        } else if (this.choice == PSSubscriberStateChoice.netDetNotReachable) {
            return Tag.ENUMERATED;
        }

        throw new MAPException("Error encoding " + _PrimitiveName + ": Bad hoice value");
    }
67587
def _get_schema(self, tag):
        
        schema = self._schema.children.get(tag)
        if not schema:
            raise WSDLParseError("Unknown tag '%s'" % tag)
        return schema
327653
public function getTagById( $id, $throwException = TRUE )
	{
		$xpath	= new DomXPath( $this->document );
		$query	= "//*[@id = '$id']";
		$tags	= $this->getTagsByXPath( $query );
		if( $tags )
			return $tags[0];
		if( $throwException )
			throw new RuntimeException( 'No Tag with ID "'.$id.'" found.' );
		return NULL;
	}
720855
def current_codes_from_pdb():
    
    url = 'http://www.rcsb.org/pdb/rest/getCurrent'
    r = requests.get(url)
    if r.status_code == 200:
        pdb_codes = [x.lower() for x in r.text.split('"') if len(x) == 4]
    else:
        print('Request for {0} failed with status code {1}'.format(url, r.status_code))
        return
    return pdb_codes
29449
def fetch_pdb(pdbid):
    """"""
    pdbid = pdbid.lower()
    write_message('\nChecking status of PDB ID %s ... ' % pdbid)
    state, current_entry = check_pdb_status(pdbid)  # Get state and current PDB ID

    if state == 'OBSOLETE':
        write_message('entry is obsolete, getting %s instead.\n' % current_entry)
    elif state == 'CURRENT':
        write_message('entry is up to date.\n')
    elif state == 'UNKNOWN':
        sysexit(3, 'Invalid PDB ID (Entry does not exist on PDB server)\n')
    write_message('Downloading file from PDB ... ')
    pdburl = 'http://www.rcsb.org/pdb/files/%s.pdb' % current_entry  # Get URL for current entry
    try:
        pdbfile = urlopen(pdburl).read().decode()
        # If no PDB file is available, a text is now shown with "We're sorry, but ..."
        # Could previously be distinguished by an HTTP error
        if 'sorry' in pdbfile:
            sysexit(5, "No file in PDB format available from wwPDB for the given PDB ID.\n")
    except HTTPError:
        sysexit(5, "No file in PDB format available from wwPDB for the given PDB ID.\n")
    return [pdbfile, current_entry]
339468
public static String getTagValue(Id id, String k) {
    Preconditions.checkNotNull(id, "id");
    return getTagValue(id.tags(), k);
  }
1255583
function elementGetXMLID(node) {
        return node && 'xml:id' in node.attributes ? node.attributes['xml:id'].value || null : null;
    }