refgenie / refgenconf

A Python object for standardized reference genome assets.
http://refgenie.databio.org
BSD 2-Clause "Simplified" License
3 stars 6 forks source link

error in list_assets_by_genome #107

Closed nsheff closed 4 years ago

nsheff commented 4 years ago
 rgc.list_assets_by_genome("Musa_acuminata_Genescope-Cirad")           
-------------------------------------------
KeyError  Traceback (most recent call last)
~/.local/lib/python3.6/site-packages/attmap/ordattmap.py in __getitem__(self, item)
     44         try:
---> 45             return super(OrdAttMap, self).__getitem__(item)
     46         except KeyError:

KeyError: 'assets'

During handling of the above exception, another exception occurred:

KeyError  Traceback (most recent call last)
<ipython-input-6-af5872629c1a> in <module>
----> 1 rgc.list_assets_by_genome("Musa_acuminata_Genescope-Cirad")

~/.local/lib/python3.6/site-packages/refgenconf/refgenconf.py in list_assets_by_genome(self, genome, order, include_tags)
    718             collection available asset type names
    719         """
--> 720         return self.list(genome, order, include_tags=include_tags)[genome] if genome is not None \
    721             else self.list(order, include_tags=include_tags)
    722 

~/.local/lib/python3.6/site-packages/refgenconf/refgenconf.py in list(self, genome, order, include_tags)
    254         self.run_plugins(POST_LIST_HOOK)
    255         return OrderedDict([(g, sorted(list(self[CFG_GENOMES_KEY][g][CFG_ASSETS_KEY].keys()), key=order))
--> 256                             for g in refgens])
    257 
    258     def get_asset_table(self, genomes=None, server_url=None,

~/.local/lib/python3.6/site-packages/refgenconf/refgenconf.py in <listcomp>(.0)
    254         self.run_plugins(POST_LIST_HOOK)
    255         return OrderedDict([(g, sorted(list(self[CFG_GENOMES_KEY][g][CFG_ASSETS_KEY].keys()), key=order))
--> 256                             for g in refgens])
    257 
    258     def get_asset_table(self, genomes=None, server_url=None,

~/.local/lib/python3.6/site-packages/attmap/pathex_attmap.py in __getitem__(self, item, expand)
     49         :raise KeyError: if the requested key is unmapped.
     50         """
---> 51         v = super(PathExAttMap, self).__getitem__(item)
     52         return _safely_expand(v) if expand else v
     53 

~/.local/lib/python3.6/site-packages/attmap/ordattmap.py in __getitem__(self, item)
     45             return super(OrdAttMap, self).__getitem__(item)
     46         except KeyError:
---> 47             return AttMap.__getitem__(self, item)
     48 
     49     def __setitem__(self, key, value, finalize=True):

~/.local/lib/python3.6/site-packages/attmap/attmap.py in __getitem__(self, item)
     30 
     31     def __getitem__(self, item):
---> 32         return self.__dict__[item]
     33 
     34     def __setitem__(self, key, value):

KeyError: 'assets'
nsheff commented 4 years ago

is it possible this function was not updated to the new alias system?

if so, we should make sure to add a unit test for this

stolarczyk commented 4 years ago

that's not the reason, I think. I can't reproduce the error. I presume your config is corrupted? Can you confirm there is "assets" key under the genome you're trying to list assets for?

nsheff commented 4 years ago

you are correct, I had missed that. I'm not used to looking at the new yaml with the checksum levels!

  4591f237dfa34c1b426f6596e2ce5bb5cb92581dc5ea883c:
    aliases: ['Musa_acuminata_Genescope-Cirad']
  5c4b1c6db7adc2e56eefda511971c62f7c78b503b55f1e7f:
    aliases: ['Nannochloropsis_gaditana__ENSEMBL_protist_release_28']
    assets:
      fasta:
        asset_description: DNA sequences in the FASTA format, indexed FASTA (produced with samtools index) and chromosome sizes fil
e
        tags:
          default:
            asset_path: fasta
            asset_digest: dcdd85c5a4224a583a5d77f6d7797993
            seek_keys:
              fasta: 5c4b1c6db7adc2e56eefda511971c62f7c78b503b55f1e7f.fa
              fai: 5c4b1c6db7adc2e56eefda511971c62f7c78b503b55f1e7f.fa.fai
              chrom_sizes: 5c4b1c6db7adc2e56eefda511971c62f7c78b503b55f1e7f.chrom.sizes
            asset_parents: []
        default_tag: default
    genome_description: Nannochloropsis gaditana  ENSEMBL protist release 28