Mykrobe 预测器 JSON 到 TSV 转换器
Mykrobe predictor JSON to TSV Converter
我想问一个关于文件转换的问题。
我有一个 JSON 文件(在执行 AMR 预测后),我想根据 Mykrobe-predictor 脚本 (json_to_tsv.py) 将其转换为 TSV 文件,这是我的 JSON 输出 (result_TB.json).
./json_to_tsv.py /path/to/JSON_file
当我将命令粘贴到终端时,我在第 78 行遇到了 IndexError。
https://github.com/iqbal-lab/Mykrobe-predictor/blob/master/scripts/json_to_tsv.py#L78
def get_sample_name(f):
return f.split('/')[-2]
这是我得到的错误:
mykrobe_version file plate_name sample drug phylo_group species lineage phylo_group_per_covg species_per_covg lineage_per_covg phylo_group_depth species_depth lineage_depth susceptibility variants (gene:alt_depth:wt_depth:conf) genes (prot_mut-ref_mut:percent_covg:depth)
Traceback (most recent call last):
File "./json_to_tsv.py", line 157, in <module>
sample_name = get_sample_name(f)
File "./json_to_tsv.py", line 78, in get_sample_name
return f.split('/')[-2]
IndexError: list index out of range
如有任何建议,我们将不胜感激。
查看代码,我猜他们希望用类似的东西调用转换器:
python json_to_tsv.py plate/sample1/sample1.json
尝试将您的 JSON 文件复制到一个名为 plate
的目录中的一个名为 sample1
的目录中,看看您在调用它时是否会遇到与上述示例相同的错误。
更新
确实是上述问题
无效:
python json_to_tsv.py result_TB.json
mykrobe_version file plate_name sample drug phylo_group species lineage phylo_group_per_covg species_per_covg lineage_per_covg phylo_group_depth species_depth lineage_depth susceptibility variants
(gene:alt_depth:wt_depth:conf) genes
(prot_mut-ref_mut:percent_covg:depth)
Traceback (most recent call last): File "json_to_tsv.py", line 157, in <module>
sample_name = get_sample_name(f) File "json_to_tsv.py", line 78, in get_sample_name
return f.split('/')[-2] IndexError: list index out of range
作品:
python json_to_tsv.py plate/sample/result_TB.json
mykrobe_version file plate_name sample drug phylo_group species lineage phylo_group_per_covg species_per_covg lineage_per_covg phylo_group_depth species_depth lineage_depth susceptibility variants (gene:alt_depth:wt_depth:conf) genes (prot_mut-ref_mut:percent_covg:depth)
-1 result_TB plate sample NA
我想问一个关于文件转换的问题。
我有一个 JSON 文件(在执行 AMR 预测后),我想根据 Mykrobe-predictor 脚本 (json_to_tsv.py) 将其转换为 TSV 文件,这是我的 JSON 输出 (result_TB.json).
./json_to_tsv.py /path/to/JSON_file
当我将命令粘贴到终端时,我在第 78 行遇到了 IndexError。
https://github.com/iqbal-lab/Mykrobe-predictor/blob/master/scripts/json_to_tsv.py#L78
def get_sample_name(f):
return f.split('/')[-2]
这是我得到的错误:
mykrobe_version file plate_name sample drug phylo_group species lineage phylo_group_per_covg species_per_covg lineage_per_covg phylo_group_depth species_depth lineage_depth susceptibility variants (gene:alt_depth:wt_depth:conf) genes (prot_mut-ref_mut:percent_covg:depth)
Traceback (most recent call last):
File "./json_to_tsv.py", line 157, in <module>
sample_name = get_sample_name(f)
File "./json_to_tsv.py", line 78, in get_sample_name
return f.split('/')[-2]
IndexError: list index out of range
如有任何建议,我们将不胜感激。
查看代码,我猜他们希望用类似的东西调用转换器:
python json_to_tsv.py plate/sample1/sample1.json
尝试将您的 JSON 文件复制到一个名为 plate
的目录中的一个名为 sample1
的目录中,看看您在调用它时是否会遇到与上述示例相同的错误。
更新
确实是上述问题
无效:
python json_to_tsv.py result_TB.json
mykrobe_version file plate_name sample drug phylo_group species lineage phylo_group_per_covg species_per_covg lineage_per_covg phylo_group_depth species_depth lineage_depth susceptibility variants (gene:alt_depth:wt_depth:conf) genes (prot_mut-ref_mut:percent_covg:depth)
Traceback (most recent call last): File "json_to_tsv.py", line 157, in <module> sample_name = get_sample_name(f) File "json_to_tsv.py", line 78, in get_sample_name return f.split('/')[-2] IndexError: list index out of range
作品:
python json_to_tsv.py plate/sample/result_TB.json
mykrobe_version file plate_name sample drug phylo_group species lineage phylo_group_per_covg species_per_covg lineage_per_covg phylo_group_depth species_depth lineage_depth susceptibility variants (gene:alt_depth:wt_depth:conf) genes (prot_mut-ref_mut:percent_covg:depth)
-1 result_TB plate sample NA