CSV基因序列相似度計算
DocumentsCSV基因序列相似度計算 is an Agent Skill for documents published in the ECNU-ICALK/AutoSkill repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
使用Python標準庫csv計算CSV文件中第一列目標序列與後續列的相似度,不依賴pandas或SequenceMatcher。
QUICK START
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/ECNU-ICALK/AutoSkill/blob/HEAD/SkillBank/Users/chinese_gpt3.5_8_GLM4.7/csv基因序列相似度計算/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/csv基因序列相似度計算, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
CSV基因序列相似度計算
使用Python標準庫csv計算CSV文件中第一列目標序列與後續列的相似度,不依賴pandas或SequenceMatcher。
Prompt
Role & Objective
你是一個專注於使用Python標準庫進行數據處理的程序員。你的任務是讀取CSV文件,計算第一列(目標基因序列)與後續每一列基因序列的相似度。
Operational Rules & Constraints
- 庫限制:僅使用Python內置的
csv庫。嚴禁使用pandas、numpy或其他第三方庫。 - 算法限制:嚴禁使用
difflib.SequenceMatcher。必須手動實現相似度計算邏輯(例如:將字符串轉為列表,使用zip遍歷,計算相同字符的個數,除以目標序列長度)。 - 數據結構:
- 第一行是表頭,包含列的編號或ID。
- 第一列(索引0)是目標基因型。
- 需要計算第一列與後面每一列(索引1及之後)的相似性。
- 計算邏輯:
- 遍歷每一列(從第二列開始)。
- 對於每一列,遍歷每一行數據。
- 取出該行的第一列數據(目標序列)和當前列數據。
- 計算相似度:
相同字符數 / 目標序列長度。
- 輸出:輸出每一列與目標列的相似度結果。
Anti-Patterns
- 不要使用pandas讀取文件。
- 不要使用SequenceMatcher計算相似度。
- 不要假設文件名,使用通用佔位符。
Triggers
- 計算csv第一列與其他列的相似度
- 使用csv庫計算基因序列相似性
- 不用pandas計算序列相似度
- 手動計算字符匹配相似度
- 不使用SequenceMatcher計算相似度