KennthShang / CHERRY_MAGs

MAG version of CHERRY
GNU General Public License v3.0
1 stars 1 forks source link

KeyError issue #1

Open liangjinsong opened 8 months ago

liangjinsong commented 8 months ago

Hi, thank you for providing this usefull software! When I am using this software to explore the interaction between my phage contigs and my bacterial genomes, an issue regarding "KeyError" occurred (see a part of issue below). can you please help to address this issue?

------a part of issue--------- Creating blast database... Running blastn... Creating blast database... Running blastn... folder GCN_data exist... cleaning dictionary Dictionary cleaned Namespace(dataset='virus-host', gpus=0, learning_rate=0.001, mode='virus', model='pretrain', t=0.5, topk=1) adj: (3578, 3578) features: (3578, 256) x : tensor([[0.8381, 0.7619, 0.4762, ..., 0.7238, 0.4381, 1.0000], [0.9222, 0.9000, 0.4889, ..., 0.6444, 0.4444, 1.0000], [0.0925, 0.0939, 0.1257, ..., 0.0773, 0.0939, 0.0925], ..., [0.2126, 0.2518, 0.3834, ..., 0.2588, 0.2345, 0.2188], [0.2297, 0.1968, 0.3956, ..., 0.2107, 0.2093, 0.2293], [0.0521, 0.1075, 0.1238, ..., 0.0878, 0.0967, 0.0573]], device='cuda:0') sp: tensor([[0.5000, 0.5000, 0.0000, ..., 0.0000, 0.0000, 0.0000], [0.5000, 0.5000, 0.0000, ..., 0.0000, 0.0000, 0.0000], [0.0000, 0.0000, 0.0294, ..., 0.0000, 0.0000, 0.0000], ..., [0.0000, 0.0000, 0.0000, ..., 0.2000, 0.0000, 0.0000], [0.0000, 0.0000, 0.0000, ..., 0.0000, 0.3333, 0.0000], [0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.1429]], device='cuda:0') input dim: 256 output dim: 256 num_features_nonzero: 0 Traceback (most recent call last): File "run_Cherry.py", line 296, in if crispr_pred[contig]: KeyError: 'cherry_0_1506' folder input exist... cleaning dictionary folder pred exist... cleaning dictionary folder Split_files exist... cleaning dictionary Dictionary cleaned folder tmp_pred exist... cleaning dictionary Dictionary cleaned folder train_phage/ exist... cleaning dictionary Dictionary cleaned folder nodefeature exist... cleaning dictionary Dictionary cleaned GCN Error for file contig{i}

The log file (nohup.out.txt) is attached for your information. nohup.out.txt

The prokaryote.csv file has been edited according to the input bacterial genome, and a beginning part of this file is below: Accession,Superkingdom,Phylum,Class,Order,Family,Genus,Species,Name G1_1_2_bin_24,G1_1_2_bin_24,G1_1_2_bin_24,G1_1_2_bin_24,G1_1_2_bin_24,G1_1_2_bin_24,G1_1_2_bin_24,G1_1_2_bin_24,G1_1_2_bin_24 G1_1_2_bin_25,G1_1_2_bin_25,G1_1_2_bin_25,G1_1_2_bin_25,G1_1_2_bin_25,G1_1_2_bin_25,G1_1_2_bin_25,G1_1_2_bin_25,G1_1_2_bin_25 G1_1_2_bin_27,G1_1_2_bin_27,G1_1_2_bin_27,G1_1_2_bin_27,G1_1_2_bin_27,G1_1_2_bin_27,G1_1_2_bin_27,G1_1_2_bin_27,G1_1_2_bin_27

KennthShang commented 8 months ago

Hi,

Thanks for reporting the bug. I have fixed it and you can redownload the code: run_Cherry.py Or you can directly revise the code in line 296 in run_Cherry.py

image

Best, Jiayu

liangjinsong commented 8 months ago

Hi, thank you for your timely reply! I replaced the old run_Cherry.py with the revised version and rerun the script. The KeyError issue disppearred this time, but a new issue regarding "SyntaxError: invalid syntax" emerged (see below). Can you please help to address this new issue? Thanks in advance! -------------new issue regarding "SyntaxError: invalid syntax"----------------- Running blastn... Creating blast database... Running blastn... Creating blast database... Running blastn... folder GCN_data exist... cleaning dictionary Dictionary cleaned File "runCherry.py", line 297 = crispr_pred[contig]:

SyntaxError: invalid syntax folder input exist... cleaning dictionary folder pred exist... cleaning dictionary folder Split_files exist... cleaning dictionary Dictionary cleaned folder tmp_pred exist... cleaning dictionary Dictionary cleaned folder train_phage/ exist... cleaning dictionary Dictionary cleaned folder nodefeature exist... cleaning dictionary Dictionary cleaned GCN Error for file contig{i}

The full log file is attached here for your information. nohup.out.txt

KennthShang commented 8 months ago

I am sorry that the ":" should be deleted in line 297: _ = crispr_pred[contig]

Best, Jiayu

liangjinsong commented 8 months ago

I am sorry that the ":" should be deleted in line 297: _ = crispr_pred[contig]

Best, Jiayu

Hi, jiayu. The revised script worked. Thank you for your super quick response.^_^