52 lines
1.8 KiB
Python
52 lines
1.8 KiB
Python
from gfa_core.mas.utils.intent_parser import parse_ncbi_fetch_request
|
|||
|
|
|
||
|
|
|
||
|
|
def test_ncbi_fetch_accepts_ids_suffix_and_protein_keywords():
|
||
|
|
message = (
|
||
|
|
"我的拟南芥spl基因家族的id列表放在"
|
||
|
|
"/home/xia-lab/wutx/plantAnalysisAgent/ath_family/At.SPL.ids,"
|
||
|
|
"请你帮我下载蛋白序列"
|
||
|
|
)
|
||
|
|
|
||
|
|
params = parse_ncbi_fetch_request(message)
|
||
|
|
|
||
|
|
assert params["ncbiGeneIds"] == "/home/xia-lab/wutx/plantAnalysisAgent/ath_family/At.SPL.ids"
|
||
|
|
assert params["ncbiSpecies"] == "Arabidopsis thaliana"
|
||
|
|
assert params["ncbiSeqTypes"] == "protein"
|
||
|
|
assert params["prefix"] == "At.SPL"
|
||
|
|
|
||
|
|
|
||
|
|
def test_ncbi_fetch_accepts_uploaded_filename_without_absolute_path():
|
||
|
|
message = "我已经上传了 At.SPL.ids,请用这个id列表下载拟南芥SPL蛋白序列"
|
||
|
|
|
||
|
|
params = parse_ncbi_fetch_request(message)
|
||
|
|
|
||
|
|
assert params["ncbiGeneIds"] == "At.SPL.ids"
|
||
|
|
assert params["ncbiSpecies"] == "Arabidopsis thaliana"
|
||
|
|
assert params["ncbiSeqTypes"] == "protein"
|
||
|
|
assert params["prefix"] == "At.SPL"
|
||
|
|
|
||
|
|
|
||
|
|
def test_ncbi_fetch_accepts_according_to_filename_without_spaces():
|
||
|
|
message = "帮我根据At.SPL.ids下载蛋白序列"
|
||
|
|
|
||
|
|
params = parse_ncbi_fetch_request(message)
|
||
|
|
|
||
|
|
assert params["ncbiGeneIds"] == "At.SPL.ids"
|
||
|
|
assert params["ncbiSeqTypes"] == "protein"
|
||
|
|
assert params["prefix"] == "At.SPL"
|
||
|
|
|
||
|
|
|
||
|
|
def test_ncbi_fetch_does_not_truncate_filename_when_adjacent_to_chinese():
|
||
|
|
params = parse_ncbi_fetch_request("请根据gene_ids.txt下载cds")
|
||
|
|
|
||
|
|
assert params["ncbiGeneIds"] == "gene_ids.txt"
|
||
|
|
assert params["ncbiSeqTypes"] == "cds"
|
||
|
|
assert params["prefix"] == "gene_ids"
|
||
|
|
|
||
|
|
|
||
|
|
def test_ncbi_fetch_does_not_treat_downloaded_result_view_as_new_download():
|
||
|
|
params = parse_ncbi_fetch_request("帮我把下载好的At.SPL家族序列的基因id列展示一下")
|
||
|
|
|
||
|
|
assert params == {}
|