scripts/export/genomes/fetch_gen_metadata.py
def import_chromosome_names():
    """
    Parse GCA accession XML to import chromosome name and chromosome types
    into genseq table.
    """
    import django

    import django
    sys.path.append("/Users/ikalvari/RfamWorkspace/Rfam_resource/rfam_schemas")
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "rfam_schemas.rfam_schemas.settings")
    django.setup()

    from rfam_schemas.RfamLive.models import Genome, Genseq

    for genome in Genome.objects.exclude(assembly_acc__isnull=True).all():
        print (genome.assembly_acc)
        if 'GCF' in genome.assembly_acc:
            continue
        if genome.assembly_acc == '':
            continue

        data = fetch_gca_data(genome.upid, genome.assembly_acc, 'kingdom')

        if 'fields' in data and 'chromosomes' in data and data['fields']['chromosomes']:
            for chromosome in data['fields']['chromosomes']:
                genseq = Genseq.objects.filter(rfamseq_acc=chromosome['accession'], upid=genome.upid).first()
                if genseq:
                    genseq.chromosome_type = chromosome['type']
                    genseq.chromosome_name = chromosome['name']
                    genseq.save(commit=True)

    Parse GCA accession XML to import chromosome name and chromosome types
    into genseq table.
    
Parse GCA accession XML to import chromosome name and chromosome types
into genseq table.
Parse GCA accession XML to import chromosome name and chromosome types into genseq table .
def import_chromosome_names():
    import django
    import django
    sys.path.append("/Users/ikalvari/RfamWorkspace/Rfam_resource/rfam_schemas")
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "rfam_schemas.rfam_schemas.settings")
    django.setup()
    from rfam_schemas.RfamLive.models import Genome, Genseq
    for genome in Genome.objects.exclude(assembly_acc__isnull=True).all():
        print (genome.assembly_acc)
        if 'GCF' in genome.assembly_acc:
            continue
        if genome.assembly_acc == '':
            continue
        data = fetch_gca_data(genome.upid, genome.assembly_acc, 'kingdom')
        if 'fields' in data and 'chromosomes' in data and data['fields']['chromosomes']:
            for chromosome in data['fields']['chromosomes']:
                genseq = Genseq.objects.filter(rfamseq_acc=chromosome['accession'], upid=genome.upid).first()
                if genseq:
                    genseq.chromosome_type = chromosome['type']
                    genseq.chromosome_name = chromosome['name']
                    genseq.save(commit=True)
def import_chromosome_names ( ) : import django import django sys . path . append ( "/Users/ikalvari/RfamWorkspace/Rfam_resource/rfam_schemas" ) os . environ . setdefault ( "DJANGO_SETTINGS_MODULE" , "rfam_schemas.rfam_schemas.settings" ) django . setup ( ) from rfam_schemas . RfamLive . models import Genome , Genseq for genome in Genome . objects . exclude ( assembly_acc__isnull = True ) . all ( ) : print ( genome . assembly_acc ) if 'GCF' in genome . assembly_acc : continue if genome . assembly_acc == '' : continue data = fetch_gca_data ( genome . upid , genome . assembly_acc , 'kingdom' ) if 'fields' in data and 'chromosomes' in data and data [ 'fields' ] [ 'chromosomes' ] : for chromosome in data [ 'fields' ] [ 'chromosomes' ] : genseq = Genseq . objects . filter ( rfamseq_acc = chromosome [ 'accession' ] , upid = genome . upid ) . first ( ) if genseq : genseq . chromosome_type = chromosome [ 'type' ] genseq . chromosome_name = chromosome [ 'name' ] genseq . save ( commit = True )
Parse GCA accession XML to import chromosome name and chromosome types
into genseq table.
Parse GCA accession XML to import chromosome name and chromosome types into genseq table .
"""
    Parse GCA accession XML to import chromosome name and chromosome types
    into genseq table.
    """