bin/reference_data.py
def upload_to_rest_api(self):
        """Upload the genome and optionally the species metadata."""
        if not self.upload:
            print(self.payload)
            return

        rest_communication.post_or_patch('genomes', [self.payload], id_field='assembly_name')

        species = rest_communication.get_document('species', where={'name': self.species})
        if species:
            species_payload = {'genomes': [self.genome_version]}
            if input("Enter 'y' if the current genome version should be set as the default for this species. ") == 'y':
                species_payload['default_version'] = self.genome_version

            rest_communication.patch_entry(
                'species',
                species_payload,
                'name',
                self.species,
                update_lists=['genomes']
            )
        else:
            genome_size = float(int(self.payload.get('genome_size')) / 1000000)
            genome_size = input(
                "Enter species genome size (in Mb) to use for yield calculation. (default: %.0f) " % genome_size
            ) or genome_size

            # FIXME: Probably should expose the taxid in EGCG-Core so we do not have to access the private methods
            info = ncbi._fetch_from_cache(self.species)
            if info:
                q, taxid, scientific_name, common_name = info
            else:
                taxid, scientific_name, common_name = ncbi._fetch_from_eutils(self.species)

            rest_communication.post_entry(
                'species',
                {
                    'name': self.species,
                    'genomes': [self.genome_version],
                    'default_version': self.genome_version,
                    'taxid': taxid,
                    'approximate_genome_size': float(genome_size)
                }
            )
Upload the genome and optionally the species metadata.
Upload the genome and optionally the species metadata.
Upload the genome and optionally the species metadata .
def upload_to_rest_api(self):
        if not self.upload:
            print(self.payload)
            return
        rest_communication.post_or_patch('genomes', [self.payload], id_field='assembly_name')
        species = rest_communication.get_document('species', where={'name': self.species})
        if species:
            species_payload = {'genomes': [self.genome_version]}
            if input("Enter 'y' if the current genome version should be set as the default for this species. ") == 'y':
                species_payload['default_version'] = self.genome_version
            rest_communication.patch_entry(
                'species',
                species_payload,
                'name',
                self.species,
                update_lists=['genomes']
            )
        else:
            genome_size = float(int(self.payload.get('genome_size')) / 1000000)
            genome_size = input(
                "Enter species genome size (in Mb) to use for yield calculation. (default: %.0f) " % genome_size
            ) or genome_size
            info = ncbi._fetch_from_cache(self.species)
            if info:
                q, taxid, scientific_name, common_name = info
            else:
                taxid, scientific_name, common_name = ncbi._fetch_from_eutils(self.species)
            rest_communication.post_entry(
                'species',
                {
                    'name': self.species,
                    'genomes': [self.genome_version],
                    'default_version': self.genome_version,
                    'taxid': taxid,
                    'approximate_genome_size': float(genome_size)
                }
            )
def upload_to_rest_api ( self ) : if not self . upload : print ( self . payload ) return rest_communication . post_or_patch ( 'genomes' , [ self . payload ] , id_field = 'assembly_name' ) species = rest_communication . get_document ( 'species' , where = { 'name' : self . species } ) if species : species_payload = { 'genomes' : [ self . genome_version ] } if input ( "Enter 'y' if the current genome version should be set as the default for this species. " ) == 'y' : species_payload [ 'default_version' ] = self . genome_version rest_communication . patch_entry ( 'species' , species_payload , 'name' , self . species , update_lists = [ 'genomes' ] ) else : genome_size = float ( int ( self . payload . get ( 'genome_size' ) ) / 1000000 ) genome_size = input ( "Enter species genome size (in Mb) to use for yield calculation. (default: %.0f) " % genome_size ) or genome_size info = ncbi . _fetch_from_cache ( self . species ) if info : q , taxid , scientific_name , common_name = info else : taxid , scientific_name , common_name = ncbi . _fetch_from_eutils ( self . species ) rest_communication . post_entry ( 'species' , { 'name' : self . species , 'genomes' : [ self . genome_version ] , 'default_version' : self . genome_version , 'taxid' : taxid , 'approximate_genome_size' : float ( genome_size ) } )
Upload the genome and optionally the species metadata.
Upload the genome and optionally the species metadata .
"""Upload the genome and optionally the species metadata.""" # FIXME: Probably should expose the taxid in EGCG-Core so we do not have to access the private methods
self