bin/reference_data.py
def upload_species_without_genome(species_name):
    """
    This function only adds a new species without the need for a new genome.
    An existing genome will be associated with the new species.
    """
    scientific_name = ncbi.get_species_name(species_name)
    if not scientific_name:
        raise EGCGError('Species %s could not be resolved in NCBI please check the spelling.', species_name)

    species = rest_communication.get_document('species', where={'name': scientific_name})
    if species:
        raise EGCGError('Species %s already exist in the API' % species_name)

    genome_version = input(
        "Enter genome version to use as the default genome for %s " % scientific_name
    )
    genome_data = rest_communication.get_document('genomes', where={'assembly_name': genome_version})
    if not genome_data:
        raise EGCGError('Genome %s does not exist in the API. Add it separately with its own species' % genome_version)
    genome_size = float(int(genome_data.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(scientific_name)
    if info:
        q, taxid, scientific_name, common_name = info
    else:
        taxid, scientific_name, common_name = ncbi.fetch_from_eutils(scientific_name)

    rest_communication.post_entry(
        'species',
        {
            'name': scientific_name,
            'default_version': genome_version,
            'taxid': taxid,
            'approximate_genome_size': float(genome_size)
        }
    )

    This function only adds a new species without the need for a new genome.
    An existing genome will be associated with the new species.
    
This function only adds a new species without the need for a new genome.
An existing genome will be associated with the new species.
This function only adds a new species without the need for a new genome . An existing genome will be associated with the new species .
def upload_species_without_genome(species_name):
    scientific_name = ncbi.get_species_name(species_name)
    if not scientific_name:
        raise EGCGError('Species %s could not be resolved in NCBI please check the spelling.', species_name)
    species = rest_communication.get_document('species', where={'name': scientific_name})
    if species:
        raise EGCGError('Species %s already exist in the API' % species_name)
    genome_version = input(
        "Enter genome version to use as the default genome for %s " % scientific_name
    )
    genome_data = rest_communication.get_document('genomes', where={'assembly_name': genome_version})
    if not genome_data:
        raise EGCGError('Genome %s does not exist in the API. Add it separately with its own species' % genome_version)
    genome_size = float(int(genome_data.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(scientific_name)
    if info:
        q, taxid, scientific_name, common_name = info
    else:
        taxid, scientific_name, common_name = ncbi.fetch_from_eutils(scientific_name)
    rest_communication.post_entry(
        'species',
        {
            'name': scientific_name,
            'default_version': genome_version,
            'taxid': taxid,
            'approximate_genome_size': float(genome_size)
        }
    )
def upload_species_without_genome ( species_name ) : scientific_name = ncbi . get_species_name ( species_name ) if not scientific_name : raise EGCGError ( 'Species %s could not be resolved in NCBI please check the spelling.' , species_name ) species = rest_communication . get_document ( 'species' , where = { 'name' : scientific_name } ) if species : raise EGCGError ( 'Species %s already exist in the API' % species_name ) genome_version = input ( "Enter genome version to use as the default genome for %s " % scientific_name ) genome_data = rest_communication . get_document ( 'genomes' , where = { 'assembly_name' : genome_version } ) if not genome_data : raise EGCGError ( 'Genome %s does not exist in the API. Add it separately with its own species' % genome_version ) genome_size = float ( int ( genome_data . 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 ( scientific_name ) if info : q , taxid , scientific_name , common_name = info else : taxid , scientific_name , common_name = ncbi . fetch_from_eutils ( scientific_name ) rest_communication . post_entry ( 'species' , { 'name' : scientific_name , 'default_version' : genome_version , 'taxid' : taxid , 'approximate_genome_size' : float ( genome_size ) } )
This function only adds a new species without the need for a new genome.
This function only adds a new species without the need for a new genome .
"""
    This function only adds a new species without the need for a new genome.
    An existing genome will be associated with the new species.
    """
species_name