liftoff (for lift-over GFF or GTF ) UnboundLocalError: local variable 'feature_db' referenced before assignment
2
0
Entering edit mode
3.3 years ago
kofuji ▴ 10

Hi,

I want to map annotations from rich gencode human gtf or gff3 to great apes' genome.

I tried to run liftoff (https://github.com/agshumate/Liftoff)

but it returns error the below. Following the github issue's post, I confirmed

  1. there's no _db file before running,
  2. the annotation file is .gff3,
  3. the permission of the annotation file is -rwxrwxrwx, and I did umask 0000 as default permission setting.

However, there comes still the similar error like,

Traceback (most recent call last): 
File "/home/usr/anaconda3/envs/liftoff/bin/liftoff", line 10, in sys.exit(main()) 
File "/home/usr/anaconda3/envs/liftoff/lib/python3.6/site-packages/liftoff/run_liftoff.py", line 10, in main run_all_liftoff_steps(args) 
File "/home/usr/anaconda3/envs/liftoff/lib/python3.6/site-packages/liftoff/run_liftoff.py", line 25, in run_all_liftoff_steps parent_features_to_lift) 
File "/home/usr/anaconda3/envs/liftoff/lib/python3.6/site-packages/liftoff/liftover_types.py", line 13, in lift_original_annotation parents_to_lift, args) 
File "/home/usr/anaconda3/envs/liftoff/lib/python3.6/site-packages/liftoff/extract_features.py", line 17, in extract_features_to_lift feature_db = create_feature_db_connections(args) 
File "/home/usr/anaconda3/envs/liftoff/lib/python3.6/site-packages/liftoff/extract_features.py", line 32, in create_feature_db_connections feature_db = build_database(args.db, args.g, disable_transcripts, disable_genes) 
File "/home/usr/anaconda3/envs/liftoff/lib/python3.6/site-packages/liftoff/extract_features.py", line 47, in build_database 
return feature_db 
UnboundLocalError: local variable 'feature_db' referenced before assignment

My command is

liftoff /home/usr/genome/seq/PTRv2_chrxm.fa /home/usr/genome/seq/GRCh38p12_chrxm.fa -g gencode.GRCh38p13_chrxm_wo_header.gff3 -o lifted_off.panTro6_chrxm.gff3 -u NOT_liftedoff.panTro6_chrxm.gff3 -p 32 2>&1 1> chimp_liftoff.log

My liftoff version is v1.6.1

Does anyone successfully solve this problem?

Thank you in advance,

gtf gff3 liftoff annotation comparative_genomics • 2.0k views
ADD COMMENT
1
Entering edit mode
2.9 years ago
markfilan ▴ 10

An UnboundLocalError is raised when a local variable is referenced before it has been assigned. In most cases this will occur when trying to modify a local variable before it is actually assigned within the local scope. Python doesn't have variable declarations, so it has to figure out the scope of variables itself. It does so by a simple rule: If there is an assignment to a variable inside a function, that variable is considered local.

Python has lexical scoping by default, which means that although an enclosed scope can access values in its enclosing scope, it cannot modify them (unless they're declared global with the global keyword). A closure binds values in the enclosing environment to names in the local environment. The local environment can then use the bound value, and even reassign that name to something else, but it can't modify the binding in the enclosing environment. UnboundLocalError happend because when python sees an assignment inside a function then it considers that variable as local variable and will not fetch its value from enclosing or global scope when we execute the function. However, to modify a global variable inside a function, you must use the global keyword.

ADD COMMENT
0
Entering edit mode
3.2 years ago
kofuji ▴ 10

It turned out to be the permission problem.

I had changed default permission by chmod 777 and umask 0000, but there was no change until the problem was data server setting where I tried to install and run liftoff.

After all, I re-set up liftoff, and run successfully without any problem.

It took around 1hour on my local settings: Core i7-9700 (8core CPU), 64GB(RAM), Ubuntu(WSL)

Best,

ADD COMMENT

Login before adding your answer.

Traffic: 2000 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6