Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: " during aligning features #165

Open
avramiaharonoff opened this issue Mar 7, 2024 · 2 comments
Open

KeyError: " during aligning features #165

avramiaharonoff opened this issue Mar 7, 2024 · 2 comments

Comments

@avramiaharonoff
Copy link

avramiaharonoff commented Mar 7, 2024

Hello,

I am using liftoff version 1.6.1 (because it is already installed on my institution's hpc), and am getting an odd error.

Here is my script.

liftoff -g ${annot_dir}/reference.gtf -p 8 ${genome_dir}/target.fasta ${genome_dir}/reference.fasta

This is the error I'm getting:

2024-03-07 17:39:05,142 - INFO - Running ANALYZE features
extracting features
[M::main::1.2020.78] loaded/built the index for 46 target sequence(s)
[M::mm_mapopt_update::1.507
0.82] mid_occ = 131
[M::mm_idx_stat] kmer size: 15; skip: 10; is_hpc: 0; #seq: 46
[M::mm_idx_stat::1.7130.84] distinct minimizers: 19216266 (81.35% are singletons); average occurrences: 1.509; average spacing: 5.463; total length: 158432396
[M::worker_pipeline::14.900
6.38] mapped 28896 sequences
[M::main] Version: 2.18-r1015
[M::main] CMD: minimap2 -o intermediate_files/reference_all_to_target_all.sam -a --end-bonus 5 --eqx -N 50 -p 0.5 -t 8 /home/aa7013/genomes/reference/target.fa.mmi intermediate_files/reference_all_genes.fa
[M::main] Real time: 14.914 sec; CPU: 95.032 sec; Peak RSS: 1.592 GB
aligning features
Traceback (most recent call last):
File "/ext3/miniconda3/bin/liftoff", line 10, in
sys.exit(main())
File "/ext3/miniconda3/lib/python3.8/site-packages/liftoff/run_liftoff.py", line 10, in main
run_all_liftoff_steps(args)
File "/ext3/miniconda3/lib/python3.8/site-packages/liftoff/run_liftoff.py", line 22, in run_all_liftoff_steps
feature_db, feature_hierarchy, ref_parent_order = liftover_types.lift_original_annotation(ref_chroms, target_chroms,
File "/ext3/miniconda3/lib/python3.8/site-packages/liftoff/liftover_types.py", line 15, in lift_original_annotation
align_and_lift_features(ref_chroms, target_chroms, args, feature_hierarchy, liftover_type, unmapped_features,
File "/ext3/miniconda3/lib/python3.8/site-packages/liftoff/liftover_types.py", line 23, in align_and_lift_features
aligned_segments= align_features.align_features_to_target(ref_chroms, target_chroms, args,
File "/ext3/miniconda3/lib/python3.8/site-packages/liftoff/align_features.py", line 28, in align_features_to_target
return parse_all_sam_files(feature_hierarchy, unmapped_features, liftover_type, sam_files)
File "/ext3/miniconda3/lib/python3.8/site-packages/liftoff/align_features.py", line 118, in parse_all_sam_files
aligned_segments = parse_alignment(file, feature_hierarchy, unmapped_features, liftover_type)
File "/ext3/miniconda3/lib/python3.8/site-packages/liftoff/align_features.py", line 132, in parse_alignment
aln_id = add_alignment(ref_seq, align_count_dict, search_type, name_dict,aln_id, feature_hierarchy,
File "/ext3/miniconda3/lib/python3.8/site-packages/liftoff/align_features.py", line 149, in add_alignment
aligned_blocks = get_aligned_blocks(ref_seq, aln_id, feature_hierarchy, search_type)
File "/ext3/miniconda3/lib/python3.8/site-packages/liftoff/align_features.py", line 170, in get_aligned_blocks
parent = feature_hierarchy.parents[liftoff_utils.convert_id_to_original(alignment.query_name)]
KeyError: ''
done

Would anyone be able to tell me what this means?

Thank you,

Avrami

@avramiaharonoff
Copy link
Author

Update: I didn't find out the reason for the error, but was able to figure out that it didn't like my annotation file. It wasn't difficult to switch the source of my annotation file, so I did that, and it ran.

@SidG13
Copy link

SidG13 commented Apr 18, 2024

Some more input here. I had the same problem. Not sure why this works, but I used gffread to convert my GFF3 to a GTF, and specified the feature file with transcript, exon, and CDS (whatever features you have works). It worked after that.

Another edit from my future self: gffread is the true hero. Was having issues with another custom GTF where liftoff wasn't transferring every gene (only a subset for some reason), and gffread -T -o fixed my issues. For what it's worth, agat_sp_convert did nothing for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants