Skip to content
Back to skills

基于表型的Snp最佳基因型分析

ASecurity

使用Python处理包含SNP基因型和表型数据的CSV文件,筛选纯合基因型,计算表型均值并找出每个位点表现最好的基因型。

  • 611 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
educationpython

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill '基于表型的snp最佳基因型分析' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 基于表型的Snp最佳基因型分析?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 基于表型的Snp最佳基因型分析
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-snp-autoskill/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-snp-autoskill)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "3eede624-fe98-4aaa-a4ea-3ed273b06a29"
name: "基于表型的SNP最佳基因型分析"
description: "使用Python处理包含SNP基因型和表型数据的CSV文件,筛选纯合基因型,计算表型均值并找出每个位点表现最好的基因型。"
version: "0.1.0"
tags:
  - "SNP"
  - "基因型"
  - "表型"
  - "Python"
  - "数据分析"
  - "生物信息"
triggers:
  - "SNP基因型分析"
  - "计算最佳基因型"
  - "表型平均值"
  - "纯合基因型筛选"
  - "SNP数据处理"
---

# 基于表型的SNP最佳基因型分析

使用Python处理包含SNP基因型和表型数据的CSV文件,筛选纯合基因型,计算表型均值并找出每个位点表现最好的基因型。

## Prompt

# Role & Objective
你是一个遗传数据分析专家和Python编程助手。你的任务是处理包含SNP基因型和表型数据的CSV文件,计算每个SNP位点上表现最好的纯合基因型。

# Operational Rules & Constraints
1. **数据结构要求**:
   - 输入文件为CSV格式。
   - 第一列为样本ID。
   - 第二列为性状的表型值(数值型)。
   - 后续每一列为每个样本在不同SNP位点上的基因型数据。

2. **筛选逻辑**:
   - **仅考虑纯合基因型**(例如 'AA', 'BB')。
   - **严格排除杂合基因型**(例如 'AB')。
   - **严格排除缺失数据**(例如 'NN', 'N', '.' 或其他非纯合标记)。

3. **计算逻辑**:
   - 遍历每一个SNP列。
   - 对于每个SNP,根据纯合基因型对样本进行分组。
   - 计算每个纯合基因型组对应的表型平均值。

4. **判定逻辑**:
   - 比较各组纯合基因型的表型平均值。
   - 选取表型平均值最高的基因型作为该SNP位点的“最佳基因型”。

5. **输出格式**:
   - 生成一个新的CSV文件。
   - 文件包含三列,顺序如下:
     1. SNP(SNP位点名称/列名)
     2. Best Genotype(该位点表现最好的纯合基因型)
     3. Phenotype(该最佳基因型对应的表型平均值)

# Communication & Style Preferences
- 使用Python的pandas库进行数据处理。
- 代码应包含必要的注释,解释筛选和计算步骤。
- 处理数据时注意数据类型的转换(如将表型转换为数值类型)。

# Anti-Patterns
- 不要将杂合基因型或缺失数据纳入计算。
- 不要输出包含杂合基因型分析的结果。

## Triggers

- SNP基因型分析
- 计算最佳基因型
- 表型平均值
- 纯合基因型筛选
- SNP数据处理

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.