geronimp / enrichM

Toolbox for comparative genomics of MAGs
81 stars 22 forks source link

keyERROR #137

Open mengyuan09876 opened 8 months ago

mengyuan09876 commented 8 months ago

To run enrichment, I made a metadata table, but I always encounter keyerror problems. Could you tell me the correct metadata table template? thanks here is the error" [2023-12-27 15:12:16 PM] INFO: Command: /home/stefano/programs/anaconda3/envs/mamba/envs/enrichm/bin/enrichm enrichment --annotation_matrix ./merged_data_chao.txt --metadata metadatachao.txt --output ./enrichm_enrichment_ko/ --force [2023-12-27 15:12:16 PM] INFO: Running the enrichment pipeline [2023-12-27 15:12:16 PM] INFO: Parsing annotation matrix [2023-12-27 15:12:16 PM] INFO: Parsing metadata: metadatachao.txt [2023-12-27 15:12:16 PM] INFO: Comparing sets of genomes [2023-12-27 15:12:16 PM] INFO: Comparing gene frequency among groups: Group, UP [2023-12-27 15:12:16 PM] INFO: enrichment statistics not possible with only one genome to compare [2023-12-27 15:12:16 PM] INFO: See prevalence matrix for unique genes in groups [2023-12-27 15:12:16 PM] INFO: Comparing gene over-representation among genomes [2023-12-27 15:12:16 PM] INFO: Testing over-representation using Z score test Traceback (most recent call last): File "/home/stefano/programs/anaconda3/envs/mamba/envs/enrichm/bin/enrichm", line 351, in run.run_enrichm(args, sys.argv) File "/home/stefano/programs/anaconda3/envs/mamba/envs/enrichm/lib/python3.6/site-packages/enrichm/run.py", line 416, in run_enrichm pipeline(args) File "/home/stefano/programs/anaconda3/envs/mamba/envs/enrichm/lib/python3.6/site-packages/enrichm/run.py", line 335, in run_enrichment args.output) File "/home/stefano/programs/anaconda3/envs/mamba/envs/enrichm/lib/python3.6/site-packages/enrichm/enrichment.py", line 438, in enrichment_pipeline results = test.test_pipeline(attribute_dict) File "/home/stefano/programs/anaconda3/envs/mamba/envs/enrichm/lib/python3.6/site-packages/enrichm/enrichment.py", line 728, in test_pipeline gene_count = self.gene_frequencies(*combination, True) File "/home/stefano/programs/anaconda3/envs/mamba/envs/enrichm/lib/python3.6/site-packages/enrichm/enrichment.py", line 598, in gene_frequencies freq) File "/home/stefano/programs/anaconda3/envs/mamba/envs/enrichm/lib/python3.6/site-packages/enrichm/enrichment.py", line 569, in count if annotation in self.genome_annotations[genome]: KeyError: 'ID'

mengyuan09876 commented 8 months ago

after I delete the header, it still shows this error: "[2023-12-27 15:18:10 PM] INFO: Command: /home/stefano/programs/anaconda3/envs/mamba/envs/enrichm/bin/enrichm enrichment --annotation_matrix ./merged_data_chao.txt --metadata metadatachao.txt --output ./enrichm_enrichment_ko/ --force [2023-12-27 15:18:10 PM] INFO: Running the enrichment pipeline [2023-12-27 15:18:10 PM] INFO: Parsing annotation matrix [2023-12-27 15:18:10 PM] INFO: Parsing metadata: metadatachao.txt [2023-12-27 15:18:10 PM] INFO: Comparing sets of genomes [2023-12-27 15:18:10 PM] INFO: Comparing gene frequency among groups: UP, Down [2023-12-27 15:18:10 PM] INFO: Testing gene enrichment using Fisher's exact test Traceback (most recent call last): File "/home/stefano/programs/anaconda3/envs/mamba/envs/enrichm/bin/enrichm", line 351, in run.run_enrichm(args, sys.argv) File "/home/stefano/programs/anaconda3/envs/mamba/envs/enrichm/lib/python3.6/site-packages/enrichm/run.py", line 416, in run_enrichm pipeline(args) File "/home/stefano/programs/anaconda3/envs/mamba/envs/enrichm/lib/python3.6/site-packages/enrichm/run.py", line 335, in run_enrichment args.output) File "/home/stefano/programs/anaconda3/envs/mamba/envs/enrichm/lib/python3.6/site-packages/enrichm/enrichment.py", line 438, in enrichment_pipeline results = test.test_pipeline(attribute_dict) File "/home/stefano/programs/anaconda3/envs/mamba/envs/enrichm/lib/python3.6/site-packages/enrichm/enrichment.py", line 697, in test_pipeline gene_count = self.gene_frequencies(*combination) File "/home/stefano/programs/anaconda3/envs/mamba/envs/enrichm/lib/python3.6/site-packages/enrichm/enrichment.py", line 598, in gene_frequencies freq) File "/home/stefano/programs/anaconda3/envs/mamba/envs/enrichm/lib/python3.6/site-packages/enrichm/enrichment.py", line 569, in count if annotation in self.genome_annotations[genome]: KeyError: 'K00003“ ”