Set the evidence PMID of Statements that have been extracted.

        Parameters
        ----------
        pmid : str or None
            The PMID to be used in the Evidence objects of the Statements
            that were extracted by the processor.
194690
def set_statements_pmid(self, pmid):
        
        # Replace PMID value in JSON dict first
        for stmt in self.json_stmts:
            evs = stmt.get('evidence', [])
            for ev in evs:
                ev['pmid'] = pmid
        # Replace PMID value in extracted Statements next
        for stmt in self.statements:
            for ev in stmt.evidence:
                ev.pmid = pmid
428367
def set_copyright(self):
        """"""
        try:
            self.copyright = self.soup.find('copyright').string
        except AttributeError:
            self.copyright = None
960145
def extract_statements(self):
        """"""
        for p_info in self._json:
            para = RlimspParagraph(p_info, self.doc_id_type)
            self.statements.extend(para.get_statements())
        return
434607
def set(self, key_or_attrs, value=None, unset=False):
        
        if isinstance(key_or_attrs, dict) and value is None:
            attrs = key_or_attrs
            keys = attrs.keys()
            for k in keys:
                if isinstance(attrs[k], LocalProxy):
                    attrs[k] = attrs[k]._get_current_object()
        else:
            key = key_or_attrs
            if isinstance(value, LocalProxy):
                value = value._get_current_object()
            attrs = {key: utils.decode(key, value)}

        if unset:
            for k in attrs.keys():
                attrs[k] = operation.Unset()

        self.validate(attrs)

        self._merge_metadata(attrs)

        keys = list(attrs.keys())
        for k in keys:
            v = attrs[k]
            # TODO: Relation

            if not isinstance(v, operation.BaseOp):
                v = operation.Set(v)

            self._attributes[k] = v._apply(self._attributes.get(k), self, k)
            if self._attributes[k] == operation._UNSET:
                del self._attributes[k]
            self._changes[k] = v._merge(self._changes.get(k))

        return self
89312
def get_text_content_for_pmids(pmids):
    
    pmc_pmids = set(pmc_client.filter_pmids(pmids, source_type='fulltext'))

    pmc_ids = []
    for pmid in pmc_pmids:
        pmc_id = pmc_client.id_lookup(pmid, idtype='pmid')['pmcid']
        if pmc_id:
            pmc_ids.append(pmc_id)
        else:
            pmc_pmids.discard(pmid)

    pmc_xmls = []
    failed = set()
    for pmc_id in pmc_ids:
        if pmc_id is not None:
            pmc_xmls.append(pmc_client.get_xml(pmc_id))
        else:
            failed.append(pmid)
        time.sleep(0.5)

    remaining_pmids = set(pmids) - pmc_pmids | failed
    abstracts = []
    for pmid in remaining_pmids:
        abstract = pubmed_client.get_abstract(pmid)
        abstracts.append(abstract)
        time.sleep(0.5)

    return [text_content for source in (pmc_xmls, abstracts)
            for text_content in source if text_content is not None]
913130
def get_pmid(doc_id):
    
    url_pmid = 'https://www.ebi.ac.uk/chembl/api/data/document.json'
    params = {'document_chembl_id': doc_id}
    res = requests.get(url_pmid, params=params)
    js = res.json()
    pmid = str(js['documents'][0]['pubmed_id'])
    return pmid
1242688
def set_attributes(self, **kwargs):
        
        kwargs = dict(kwargs)
        for name,value in kwargs.items():
            # Raise AttributeError if param not found
            self.__getattr__(name) 
            # Set attributes
            try: self.setp(name,**value)
            except TypeError:
                try:  self.setp(name,*value)
                except (TypeError,KeyError):  
                    self.__setattr__(name,value)
507872
def _prepare_data(self):
        
        self._extract_genes()
        self._extract_total_number_of_chars()
        self._extract_number_of_taxa()
        self._extract_reading_frames()

        Data = namedtuple('Data', ['gene_codes', 'number_taxa', 'number_chars',
                                   'seq_records', 'gene_codes_and_lengths',
                                   'reading_frames'])
        self.data = Data(self.gene_codes, self.number_taxa, self.number_chars,
                         self.seq_records, self._gene_codes_and_lengths,
                         self.reading_frames)
552894
def set_value(self, comp_str):
        

        self._is_negated = False
        self._encoded_value = comp_str
        self._standard_value = super(
            CPEComponent2_3_URI_edpacked, self)._decode()
368095
def set_attr(self):
        
        setattr(self.attrs, self.kind_attr, self.values)
        setattr(self.attrs, self.meta_attr, self.meta)
        if self.dtype is not None:
            setattr(self.attrs, self.dtype_attr, self.dtype)
821150
def build_pmid_inclusion_filter(pmids: Strings) -> EdgePredicate:
    
    if isinstance(pmids, str):
        @edge_predicate
        def pmid_inclusion_filter(edge_data: EdgeData) -> bool:
            """Pass for edges with PubMed citations matching the contained PubMed identifier."""
            return has_pubmed(edge_data) and edge_data[CITATION][CITATION_REFERENCE] == pmids

    elif isinstance(pmids, Iterable):
        pmids = set(pmids)

        @edge_predicate
        def pmid_inclusion_filter(edge_data: EdgeData) -> bool:
            """Pass for edges with PubMed citations matching one of the contained PubMed identifiers."""
            return has_pubmed(edge_data) and edge_data[CITATION][CITATION_REFERENCE] in pmids

    else:
        raise TypeError

    return pmid_inclusion_filter
539861
def _set_attributes(self, response, attribute_dict):
        
        status_code = response.get(
            'HTTPStatusCode',
            response['ResponseMetadata']['HTTPStatusCode']
        )
        if status_code == 200:
            for k, v in attribute_dict.items():
                setattr(self, k, v)
92399
def get_pubmed_for_beleditor(pmid: str) -> Mapping[str, Any]:
    

    pubmed = get_pubmed(pmid)
    pubtator = get_pubtator(pmid)
    pubmed["annotations"] = copy.deepcopy(pubtator["annotations"])

    # Add entity types and annotation types to annotations
    pubmed = enhance_pubmed_annotations(pubmed)

    return pubmed
993265
def refs(soup):
    """"""
    tags = raw_parser.ref_list(soup)
    refs = []
    position = 1

    article_doi = doi(soup)

    for tag in tags:
        ref = {}

        ref['ref'] = ref_text(tag)

        # ref_id
        copy_attribute(tag.attrs, "id", ref)

        # article_title
        if raw_parser.article_title(tag):
            ref['article_title'] = node_text(raw_parser.article_title(tag))
            ref['full_article_title'] = node_contents_str(raw_parser.article_title(tag))

        if raw_parser.pub_id(tag, "pmid"):
            ref['pmid'] = node_contents_str(first(raw_parser.pub_id(tag, "pmid")))

        if raw_parser.pub_id(tag, "isbn"):
            ref['isbn'] = node_contents_str(first(raw_parser.pub_id(tag, "isbn")))

        if raw_parser.pub_id(tag, "doi"):
            ref['reference_id'] = node_contents_str(first(raw_parser.pub_id(tag, "doi")))
            ref['doi'] = doi_uri_to_doi(node_contents_str(first(raw_parser.pub_id(tag, "doi"))))

        uri_tag = None
        if raw_parser.ext_link(tag, "uri"):
            uri_tag = first(raw_parser.ext_link(tag, "uri"))
        elif raw_parser.uri(tag):
            uri_tag = first(raw_parser.uri(tag))
        if uri_tag:
            set_if_value(ref, "uri", uri_tag.get('xlink:href'))
            set_if_value(ref, "uri_text", node_contents_str(uri_tag))
        # look for a pub-id tag if no uri yet
        if not ref.get('uri') and raw_parser.pub_id(tag, "archive"):
            pub_id_tag = first(raw_parser.pub_id(tag, pub_id_type="archive"))
            set_if_value(ref, "uri", pub_id_tag.get('xlink:href'))

        # accession, could be in either of two tags
        set_if_value(ref, "accession", node_contents_str(first(raw_parser.object_id(tag, "art-access-id"))))
        if not ref.get('accession'):
            set_if_value(ref, "accession", node_contents_str(first(raw_parser.pub_id(tag, pub_id_type="accession"))))
        if not ref.get('accession'):
            set_if_value(ref, "accession", node_contents_str(first(raw_parser.pub_id(tag, pub_id_type="archive"))))

        if(raw_parser.year(tag)):
            set_if_value(ref, "year", node_text(raw_parser.year(tag)))
            set_if_value(ref, "year-iso-8601-date", raw_parser.year(tag).get('iso-8601-date'))

        if(raw_parser.date_in_citation(tag)):
            set_if_value(ref, "date-in-citation", node_text(first(raw_parser.date_in_citation(tag))))
            set_if_value(ref, "iso-8601-date", first(raw_parser.date_in_citation(tag)).get('iso-8601-date'))

        if(raw_parser.patent(tag)):
            set_if_value(ref, "patent", node_text(first(raw_parser.patent(tag))))
            set_if_value(ref, "country", first(raw_parser.patent(tag)).get('country'))

        set_if_value(ref, "source", node_text(first(raw_parser.source(tag))))
        set_if_value(ref, "elocation-id", node_text(first(raw_parser.elocation_id(tag))))
        if raw_parser.element_citation(tag):
            copy_attribute(first(raw_parser.element_citation(tag)).attrs, "publication-type", ref)
        if "publication-type" not in ref and raw_parser.mixed_citations(tag):
            copy_attribute(first(raw_parser.mixed_citations(tag)).attrs, "publication-type", ref)

        # authors
        person_group = raw_parser.person_group(tag)
        authors = []

        for group in person_group:

            author_type = None
            if "person-group-type" in group.attrs:
                author_type = group["person-group-type"]

            # Read name or collab tag in the order they are listed
            for name_or_collab_tag in extract_nodes(group, ["name", "string-name", "collab"]):
                author = {}

                # Shared tag attribute
                set_if_value(author, "group-type", author_type)

                # name tag attributes
                if name_or_collab_tag.name in ["name", "string-name"]:
                    set_if_value(author, "surname", node_text(first(raw_parser.surname(name_or_collab_tag))))
                    set_if_value(author, "given-names", node_text(first(raw_parser.given_names(name_or_collab_tag))))
                    set_if_value(author, "suffix", node_text(first(raw_parser.suffix(name_or_collab_tag))))

                # collab tag attribute
                if name_or_collab_tag.name == "collab":
                    set_if_value(author, "collab", node_contents_str(name_or_collab_tag))

                if len(author) > 0:
                    authors.append(author)

            # etal for the person group
            if first(raw_parser.etal(group)):
                author = {}
                author['etal'] = True
                set_if_value(author, "group-type", author_type)
                authors.append(author)

        # Check for collab tag not wrapped in a person-group for backwards compatibility
        if len(person_group) == 0:
            collab_tags = raw_parser.collab(tag)
            for collab_tag in collab_tags:
                author = {}
                set_if_value(author, "group-type", "author")
                set_if_value(author, "collab", node_contents_str(collab_tag))

                if len(author) > 0:
                    authors.append(author)

        if len(authors) > 0:
            ref['authors'] = authors

        set_if_value(ref, "volume", node_text(first(raw_parser.volume(tag))))
        set_if_value(ref, "issue", node_text(first(raw_parser.issue(tag))))
        set_if_value(ref, "fpage", node_text(first(raw_parser.fpage(tag))))
        set_if_value(ref, "lpage", node_text(first(raw_parser.lpage(tag))))
        set_if_value(ref, "collab", node_text(first(raw_parser.collab(tag))))
        set_if_value(ref, "publisher_loc", node_text(first(raw_parser.publisher_loc(tag))))
        set_if_value(ref, "publisher_name", node_text(first(raw_parser.publisher_name(tag))))
        set_if_value(ref, "edition", node_contents_str(first(raw_parser.edition(tag))))
        set_if_value(ref, "version", node_contents_str(first(raw_parser.version(tag))))
        set_if_value(ref, "chapter-title", node_contents_str(first(raw_parser.chapter_title(tag))))
        set_if_value(ref, "comment", node_text(first(raw_parser.comment(tag))))
        set_if_value(ref, "data-title", node_contents_str(first(raw_parser.data_title(tag))))
        set_if_value(ref, "conf-name", node_text(first(raw_parser.conf_name(tag))))

        # If not empty, add position value, append, then increment the position counter
        if(len(ref) > 0):
            ref['article_doi'] = article_doi

            ref['position'] = position

            refs.append(ref)
            position += 1

    return refs
1099247
def agp(args):
    
    p = OptionParser(agp.__doc__)
    opts, args = p.parse_args(args)

    if len(args) != 2:
        sys.exit(not p.print_help())

    evidencefile, contigs = args
    ef = EvidenceFile(evidencefile, contigs)

    agpfile = evidencefile.replace(".evidence", ".agp")
    ef.write_agp(agpfile)
900587
private String[] getLoadline(Pair<BrainRegion, BrainRegion> pair, int pmId) {

        BrainRegion br1 = pair.getKey();
        BrainRegion br2 = pair.getValue();

        return new String[] {
                pmId + "",//
                br1.getCoveredText().replaceAll("(\\r|\\n|\\t)", ""),
                br1.getBegin() + "",
                br1.getEnd() + "",//
                br2.getCoveredText().replaceAll("(\\r|\\n|\\t)", ""),
                br2.getBegin() + "", br2.getEnd() + "" };
    }
1304495
def p_with_statement(self, p):
        """"""
        p[0] = self.asttypes.With(expr=p[3], statement=p[5])
        p[0].setpos(p)