zwdzwd / transvar

TransVar - multiway annotator for precision medicine
Other
118 stars 33 forks source link

AttributeError: 'RefGenome' object has no attribute 'faidx_handle' #53

Open LiviaMoura opened 2 years ago

LiviaMoura commented 2 years ago

Hello... I just installed transvar and I followed the Quick starting Guide

# set up databases
transvar config --download_anno --refversion hg19/hg38

# in case you don't have a reference
transvar config --download_ref --refversion hg19/hg38

It seems that the reference isn't being downloaded (arrow below)

--> transvar panno -i 'EGFR:p.D770_N771insNPG' --ucsc
Reference sequence doesn't exist
samtools faidx file doesn't exist for reference.    <------------------------
Traceback (most recent call last):
  File "/Users/liviamoura/.pyenv/versions/3.6.13/bin/transvar", line 197, in <module>
    args.func(args)
  File "/Users/liviamoura/.pyenv/versions/3.6.13/lib/python3.6/site-packages/transvar/anno.py", line 206, in main_anno
    db = AnnoDB(args, config)
  File "/Users/liviamoura/.pyenv/versions/3.6.13/lib/python3.6/site-packages/transvar/annodb.py", line 52, in __init__
    faidx.init_refgenome(args.reference if args.reference else None)
  File "/Users/liviamoura/.pyenv/versions/3.6.13/lib/python3.6/site-packages/transvar/faidx.py", line 103, in init_refgenome
    refgenome = RefGenome(r) if r else None
  File "/Users/liviamoura/.pyenv/versions/3.6.13/lib/python3.6/site-packages/transvar/faidx.py", line 26, in __init__
    self.load_faidx()
  File "/Users/liviamoura/.pyenv/versions/3.6.13/lib/python3.6/site-packages/transvar/faidx.py", line 37, in load_faidx
    for line in self.faidx_handle:
AttributeError: 'RefGenome' object has no attribute 'faidx_handle'
SophieS9 commented 2 years ago

Hi @LiviaMoura did you find a solution for this problem? I am also seeing the same issue!

tetedange13 commented 2 years ago

Hi both @SophieS9 and @LiviaMoura,

Maybe you should find your transvar.cfg (config file) => For @LiviaMoura, path should be like : "/Users/liviamoura/.pyenv/versions/3.6.13/lib/python3.6/site-packages/transvar/transvar.cfg" => Otherwise use find /path/to/install/transvar -name "transvar.cfg"

Then you open it with an editor and check for line reference = of your wanted assembly (add it if absent) => There you should put the path towards a FASTA corresponding to your assembly (it should be indexed too)

I have not tried it myself but I think you can also use transvar config --refversion hg19/hg38 --download_ref

Hope this helps ! Have a nice day. Felix.

joe-albert commented 3 months ago

For me setting the config looked like this (I had already downloaded and indexed the Fasta file manually) :

transvar config -k reference -v ./venv/lib/python3.9/site-packages/transvar/transvar.download/hg38.fa --refversion hg38

Once I finished this step my config file looked like this:

[DEFAULT]
refversion = hg38

[hg38]
reference = ./venv/lib/python3.9/site-packages/transvar/transvar.download/hg38.fa

I tried running a test and it failed with this error: [get_config] warning: refseq (hg38) has no default value, please specify

So I then used this command to manually set the database:

# if you only have the `.refseq.gff.gz` file you will need to run the index first `transvar index --refseq venv/lib/python3.9/site-packages/transvar/transvar.download/hg38.refseq.gff.gz`

transvar config -k refseq -v ./venv/lib/python3.9/site-packages/transvar/transvar.download/hg38.refseq.gff.gz.transvardb --refversion hg38

Hope this helps someone :)