Exemple #1
0
def convert_to_annotation(file, output):
    """Convert a namespace file to an annotation file."""
    resource = parse_bel_resource(file)

    write_annotation(
        keyword=resource['Namespace']['Keyword'],
        values={k: ''
                for k in resource['Values']},
        citation_name=resource['Citation']['NameString'],
        description=resource['Namespace']['DescriptionString'],
        file=output,
    )
Exemple #2
0
 def write_annotation(self, file: Optional[TextIO] = None) -> None:
     """Serialize this ontology as a BEL annotation."""
     write_annotation(
         keyword=self.preferred_prefix,
         values={x: '' for x in self._get_values()},
         citation_name=self.title,
         description=self.description,
         version=self.version,
         author_name='Charles Tapley Hoyt',
         author_contact='*****@*****.**',
         author_copyright='Creative Commons by 4.0',
         file=file
     )
Exemple #3
0
    def write_bel_annotation(self, file: TextIO) -> None:
        """Write as a BEL annotation file."""
        if not self.is_populated():
            self.populate()

        values = self._get_namespace_name_to_encoding(desc='writing names')

        write_annotation(
            keyword=self._get_namespace_keyword(),
            citation_name=self._get_namespace_name(),
            description='',
            values=values,
            file=file,
        )