def get_agr_title(self): """Convert chars and sub/superscript tags in FlyBase title for AGR export.""" # First determine if there's any title and/or volumetitle. if self.title is not None and self.volumetitle is not None: title_to_use = self.title + ' ' + self.volumetitle elif self.title is not None: title_to_use = self.title else: # Special exception for compendia: use pub.miniref if pub.title is null. if self.pub_type == 'compendium': title_to_use = self.miniref else: self.processing_warnings.append('No pub.title available.') title_to_use = 'No title available.' # Once title to use had been chosen, convert problematic characters. title_to_use = sub_sup_sgml_to_html(title_to_use) try: title_to_use = sgml_to_unicode(title_to_use) except KeyError: self.processing_warnings.append( 'Atypical sgml character(s) in title.') self.agr_title = title_to_use return
def get_agr_citation(self): """Convert chars and sub/superscript tags in FlyBase miniref for AGR export.""" if self.miniref is None: self.processing_warnings.append('No pub.miniref available.') self.agr_citation = 'No citation available.' else: converted_miniref = sgml_to_unicode(self.miniref) self.agr_citation = sub_sup_sgml_to_html(converted_miniref) return
def convert_fullname_synonyms(self): """Convert all FB script designations in fullname synonyms to proper html.""" if self.fullname_synonym_list is None: log.warning( 'Feature {} has no fullname_synonym_list to convert.'.format( self.uniquename)) return else: self.fullname_synonym_list = [ sub_sup_sgml_to_html(i) for i in self.fullname_synonym_list ] return
def get_agr_abstract(self): """Convert chars and sub/superscript tags in FlyBase abstract for AGR export.""" if self.pubmed_abstract != []: if len(self.pubmed_abstract) > 1: self.processing_warnings.append( 'Pub has many abstracts ({}). Using the first one.') abstract_to_use = sub_sup_sgml_to_html(self.pubmed_abstract[0]) try: abstract_to_use = sgml_to_unicode(abstract_to_use) except KeyError: self.processing_warnings.append( 'Atypical sgml character(s) in abstract.') self.agr_abstract = abstract_to_use return
def get_agr_title(self): """Convert chars and sub/superscript tags in FlyBase title for AGR export.""" # First determine if there's any title and/or volumetitle. if self.title is None: self.processing_warnings.append('No pub.title available.') title_to_use = 'No title available.' elif self.volumetitle is None: title_to_use = self.title else: title_to_use = self.title + ' ' + self.volumetitle # Next convert, handling odd chars that will raise error in "sgml_to_unicode" function. title_to_use = sub_sup_sgml_to_html(title_to_use) try: title_to_use = sgml_to_unicode(title_to_use) except KeyError: self.processing_warnings.append( 'Atypical sgml character(s) in title.') self.agr_title = title_to_use return
def make_description(self): """Concatenate "nature_lesion" strings into a description.""" if self.molecular_info is None: log.warning( 'Allele {} missing "molecular_info" info for description.'. format(self.uniquename)) self.description = None elif self.aminoacid_rep is None: log.warning( 'Allele {} missing "aminoacid_rep" info for description.'. format(self.uniquename)) self.description = None elif self.nucleotide_sub is None: log.warning( 'Allele {} missing "nucleotide_sub" info for description.'. format(self.uniquename)) self.description = None else: nature_lesion_list = [] nature_lesion_list.extend(self.molecular_info) nature_lesion_list.extend(self.aminoacid_rep) nature_lesion_list.extend(self.nucleotide_sub) if len(nature_lesion_list) > 0: nature_lesion = ' '.join(nature_lesion_list) nature_lesion = nature_lesion.replace('@', '') nature_lesion = sub_sup_to_sgml( nature_lesion) # Convert brackets into FB sub/superscript. nature_lesion = sub_sup_sgml_to_html( nature_lesion) # Convert FB sub/superscript to html. nature_lesion = sgml_to_unicode( nature_lesion) # Convert FB "&.gr;" Greeks to unicode. self.description = nature_lesion else: log.debug( 'Allele {} has no nature_lesion to report for description'. format(self.uniquename)) self.description = None return
def get_agr_symbol(self): """Convert FB symbol_sgml to AGR format (proper html sub/superscripts.""" self.agr_symbol = self.symbol_sgml self.agr_symbol = sub_sup_sgml_to_html(self.symbol_sgml) return