INNER CODE UNIT · Python

write_dmp

steineggerlab/Metabuli · util/gtdb_to_taxdump.py:157

    def write_dmp(self, outdir='.', embl_code='XX'):   
        """ Writing names.dmp & nodes.dmp """
        names_file = os.path.join(outdir, 'names.dmp')
        nodes_file = os.path.join(outdir, 'nodes.dmp')
        # iterating over all vertices starting at the root
        ## writing root
        ### names
        names = [[str(self.__graph_nodeIDs['root']), 'all', '', 'synonym']]
        names.append([str(self.__graph_nodeIDs['root']), 'root', '', 'scientific name'])
        ### nodes
        nodes = [[self.__graph_nodeIDs['root'], 1, 'no rank', embl_code,
                  0, 0, 11, 1, 1, 0, 0, 0]]
        ## Child names & nodes
        self._write_dmp_iter('root', names, nodes, embl_code)
        # Sorting by taxID & writing
        ## names
        with open(names_file, 'w') as outName:
            for x in sorted(names, key = lambda x: int(x[0])):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…