[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-db92e1eb-184a-4ef1-b202-8e0bc6d93108":3,"$fHSCkCzsQZYFfweVV_7WFAFlw1eVmRdNGiGYOuvtlbcw":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"db92e1eb-184a-4ef1-b202-8e0bc6d93108","biopython","Biopython 是一套免费的 Python 生物计算工具集。它提供了序列操作、文件输入输出、数据库访问、结构生物信息学、系统发育学和许多其他生物信息学任务的功能。","cat_life_career","mod_other","sickn33,other","---\nname: biopython\ndescription: \"Biopython is a comprehensive set of freely available Python tools for biological computation. It provides functionality for sequence manipulation, file I\u002FO, database access, structural bioinformatics, phylogenetics, and many other bioinformatics tasks.\"\nlicense: Unknown\nmetadata:\n    skill-author: K-Dense Inc.\nrisk: unknown\nsource: \"https:\u002F\u002Fgithub.com\u002Fbiopython\u002Fbiopython\"\n---\n\n# Biopython: Computational Molecular Biology in Python\n\n## Overview\n\nBiopython is a comprehensive set of freely available Python tools for biological computation. It provides functionality for sequence manipulation, file I\u002FO, database access, structural bioinformatics, phylogenetics, and many other bioinformatics tasks. The current version is **Biopython 1.85** (released January 2025), which supports Python 3 and requires NumPy.\n\n## When to Use This Skill\n\nUse this skill when:\n\n- Working with biological sequences (DNA, RNA, or protein)\n- Reading, writing, or converting biological file formats (FASTA, GenBank, FASTQ, PDB, mmCIF, etc.)\n- Accessing NCBI databases (GenBank, PubMed, Protein, Gene, etc.) via Entrez\n- Running BLAST searches or parsing BLAST results\n- Performing sequence alignments (pairwise or multiple sequence alignments)\n- Analyzing protein structures from PDB files\n- Creating, manipulating, or visualizing phylogenetic trees\n- Finding sequence motifs or analyzing motif patterns\n- Calculating sequence statistics (GC content, molecular weight, melting temperature, etc.)\n- Performing structural bioinformatics tasks\n- Working with population genetics data\n- Any other computational molecular biology task\n\n## Core Capabilities\n\nBiopython is organized into modular sub-packages, each addressing specific bioinformatics domains:\n\n1. **Sequence Handling** - Bio.Seq and Bio.SeqIO for sequence manipulation and file I\u002FO\n2. **Alignment Analysis** - Bio.Align and Bio.AlignIO for pairwise and multiple sequence alignments\n3. **Database Access** - Bio.Entrez for programmatic access to NCBI databases\n4. **BLAST Operations** - Bio.Blast for running and parsing BLAST searches\n5. **Structural Bioinformatics** - Bio.PDB for working with 3D protein structures\n6. **Phylogenetics** - Bio.Phylo for phylogenetic tree manipulation and visualization\n7. **Advanced Features** - Motifs, population genetics, sequence utilities, and more\n\n## Installation and Setup\n\nInstall Biopython using pip (requires Python 3 and NumPy):\n\n```python\nuv pip install biopython\n```\n\nFor NCBI database access, always set your email address (required by NCBI):\n\n```python\nfrom Bio import Entrez\nEntrez.email = \"your.email@example.com\"\n\n# Optional: API key for higher rate limits (10 req\u002Fs instead of 3 req\u002Fs)\nEntrez.api_key = \"your_api_key_here\"\n```\n\n## Using This Skill\n\nThis skill provides comprehensive documentation organized by functionality area. When working on a task, consult the relevant reference documentation:\n\n### 1. Sequence Handling (Bio.Seq & Bio.SeqIO)\n\n**Reference:** `references\u002Fsequence_io.md`\n\nUse for:\n- Creating and manipulating biological sequences\n- Reading and writing sequence files (FASTA, GenBank, FASTQ, etc.)\n- Converting between file formats\n- Extracting sequences from large files\n- Sequence translation, transcription, and reverse complement\n- Working with SeqRecord objects\n\n**Quick example:**\n```python\nfrom Bio import SeqIO\n\n# Read sequences from FASTA file\nfor record in SeqIO.parse(\"sequences.fasta\", \"fasta\"):\n    print(f\"{record.id}: {len(record.seq)} bp\")\n\n# Convert GenBank to FASTA\nSeqIO.convert(\"input.gb\", \"genbank\", \"output.fasta\", \"fasta\")\n```\n\n### 2. Alignment Analysis (Bio.Align & Bio.AlignIO)\n\n**Reference:** `references\u002Falignment.md`\n\nUse for:\n- Pairwise sequence alignment (global and local)\n- Reading and writing multiple sequence alignments\n- Using substitution matrices (BLOSUM, PAM)\n- Calculating alignment statistics\n- Customizing alignment parameters\n\n**Quick example:**\n```python\nfrom Bio import Align\n\n# Pairwise alignment\naligner = Align.PairwiseAligner()\naligner.mode = 'global'\nalignments = aligner.align(\"ACCGGT\", \"ACGGT\")\nprint(alignments[0])\n```\n\n### 3. Database Access (Bio.Entrez)\n\n**Reference:** `references\u002Fdatabases.md`\n\nUse for:\n- Searching NCBI databases (PubMed, GenBank, Protein, Gene, etc.)\n- Downloading sequences and records\n- Fetching publication information\n- Finding related records across databases\n- Batch downloading with proper rate limiting\n\n**Quick example:**\n```python\nfrom Bio import Entrez\nEntrez.email = \"your.email@example.com\"\n\n# Search PubMed\nhandle = Entrez.esearch(db=\"pubmed\", term=\"biopython\", retmax=10)\nresults = Entrez.read(handle)\nhandle.close()\nprint(f\"Found {results['Count']} results\")\n```\n\n### 4. BLAST Operations (Bio.Blast)\n\n**Reference:** `references\u002Fblast.md`\n\nUse for:\n- Running BLAST searches via NCBI web services\n- Running local BLAST searches\n- Parsing BLAST XML output\n- Filtering results by E-value or identity\n- Extracting hit sequences\n\n**Quick example:**\n```python\nfrom Bio.Blast import NCBIWWW, NCBIXML\n\n# Run BLAST search\nresult_handle = NCBIWWW.qblast(\"blastn\", \"nt\", \"ATCGATCGATCG\")\nblast_record = NCBIXML.read(result_handle)\n\n# Display top hits\nfor alignment in blast_record.alignments[:5]:\n    print(f\"{alignment.title}: E-value={alignment.hsps[0].expect}\")\n```\n\n### 5. Structural Bioinformatics (Bio.PDB)\n\n**Reference:** `references\u002Fstructure.md`\n\nUse for:\n- Parsing PDB and mmCIF structure files\n- Navigating protein structure hierarchy (SMCRA: Structure\u002FModel\u002FChain\u002FResidue\u002FAtom)\n- Calculating distances, angles, and dihedrals\n- Secondary structure assignment (DSSP)\n- Structure superimposition and RMSD calculation\n- Extracting sequences from structures\n\n**Quick example:**\n```python\nfrom Bio.PDB import PDBParser\n\n# Parse structure\nparser = PDBParser(QUIET=True)\nstructure = parser.get_structure(\"1crn\", \"1crn.pdb\")\n\n# Calculate distance between alpha carbons\nchain = structure[0][\"A\"]\ndistance = chain[10][\"CA\"] - chain[20][\"CA\"]\nprint(f\"Distance: {distance:.2f} Å\")\n```\n\n### 6. Phylogenetics (Bio.Phylo)\n\n**Reference:** `references\u002Fphylogenetics.md`\n\nUse for:\n- Reading and writing phylogenetic trees (Newick, NEXUS, phyloXML)\n- Building trees from distance matrices or alignments\n- Tree manipulation (pruning, rerooting, ladderizing)\n- Calculating phylogenetic distances\n- Creating consensus trees\n- Visualizing trees\n\n**Quick example:**\n```python\nfrom Bio import Phylo\n\n# Read and visualize tree\ntree = Phylo.read(\"tree.nwk\", \"newick\")\nPhylo.draw_ascii(tree)\n\n# Calculate distance\ndistance = tree.distance(\"Species_A\", \"Species_B\")\nprint(f\"Distance: {distance:.3f}\")\n```\n\n### 7. Advanced Features\n\n**Reference:** `references\u002Fadvanced.md`\n\nUse for:\n- **Sequence motifs** (Bio.motifs) - Finding and analyzing motif patterns\n- **Population genetics** (Bio.PopGen) - GenePop files, Fst calculations, Hardy-Weinberg tests\n- **Sequence utilities** (Bio.SeqUtils) - GC content, melting temperature, molecular weight, protein analysis\n- **Restriction analysis** (Bio.Restriction) - Finding restriction enzyme sites\n- **Clustering** (Bio.Cluster) - K-means and hierarchical clustering\n- **Genome diagrams** (GenomeDiagram) - Visualizing genomic features\n\n**Quick example:**\n```python\nfrom Bio.SeqUtils import gc_fraction, molecular_weight\nfrom Bio.Seq import Seq\n\nseq = Seq(\"ATCGATCGATCG\")\nprint(f\"GC content: {gc_fraction(seq):.2%}\")\nprint(f\"Molecular weight: {molecular_weight(seq, seq_type='DNA'):.2f} g\u002Fmol\")\n```\n\n## General Workflow Guidelines\n\n### Reading Documentation\n\nWhen a user asks about a specific Biopython task:\n\n1. **Identify the relevant module** based on the task description\n2. **Read the appropriate reference file** using the Read tool\n3. **Extract relevant code patterns** and adapt them to the user's specific needs\n4. **Combine multiple modules** when the task requires it\n\nExample search patterns for reference files:\n```bash\n# Find information about specific functions\ngrep -n \"SeqIO.parse\" references\u002Fsequence_io.md\n\n# Find examples of specific tasks\ngrep -n \"BLAST\" references\u002Fblast.md\n\n# Find information about specific concepts\ngrep -n \"alignment\" references\u002Falignment.md\n```\n\n### Writing Biopython Code\n\nFollow these principles when writing Biopython code:\n\n1. **Import modules explicitly**\n   ```python\n   from Bio import SeqIO, Entrez\n   from Bio.Seq import Seq\n   ```\n\n2. **Set Entrez email** when using NCBI databases\n   ```python\n   Entrez.email = \"your.email@example.com\"\n   ```\n\n3. **Use appropriate file formats** - Check which format best suits the task\n   ```python\n   # Common formats: \"fasta\", \"genbank\", \"fastq\", \"clustal\", \"phylip\"\n   ```\n\n4. **Handle files properly** - Close handles after use or use context managers\n   ```python\n   with open(\"file.fasta\") as handle:\n       records = SeqIO.parse(handle, \"fasta\")\n   ```\n\n5. **Use iterators for large files** - Avoid loading everything into memory\n   ```python\n   for record in SeqIO.parse(\"large_file.fasta\", \"fasta\"):\n       # Process one record at a time\n   ```\n\n6. **Handle errors gracefully** - Network operations and file parsing can fail\n   ```python\n   try:\n       handle = Entrez.efetch(db=\"nucleotide\", id=accession)\n   except HTTPError as e:\n       print(f\"Error: {e}\")\n   ```\n\n## Common Patterns\n\n### Pattern 1: Fetch Sequence from GenBank\n\n```python\nfrom Bio import Entrez, SeqIO\n\nEntrez.email = \"your.email@example.com\"\n\n# Fetch sequence\nhandle = Entrez.efetch(db=\"nucleotide\", id=\"EU490707\", rettype=\"gb\", retmode=\"text\")\nrecord = SeqIO.read(handle, \"genbank\")\nhandle.close()\n\nprint(f\"Description: {record.description}\")\nprint(f\"Sequence length: {len(record.seq)}\")\n```\n\n### Pattern 2: Sequence Analysis Pipeline\n\n```python\nfrom Bio import SeqIO\nfrom Bio.SeqUtils import gc_fraction\n\nfor record in SeqIO.parse(\"sequences.fasta\", \"fasta\"):\n    # Calculate statistics\n    gc = gc_fraction(record.seq)\n    length = len(record.seq)\n\n    # Find ORFs, translate, etc.\n    protein = record.seq.translate()\n\n    print(f\"{record.id}: {length} bp, GC={gc:.2%}\")\n```\n\n### Pattern 3: BLAST and Fetch Top Hits\n\n```python\nfrom Bio.Blast import NCBIWWW, NCBIXML\nfrom Bio import Entrez, SeqIO\n\nEntrez.email = \"your.email@example.com\"\n\n# Run BLAST\nresult_handle = NCBIWWW.qblast(\"blastn\", \"nt\", sequence)\nblast_record = NCBIXML.read(result_handle)\n\n# Get top hit accessions\naccessions = [aln.accession for aln in blast_record.alignments[:5]]\n\n# Fetch sequences\nfor acc in accessions:\n    handle = Entrez.efetch(db=\"nucleotide\", id=acc, rettype=\"fasta\", retmode=\"text\")\n    record = SeqIO.read(handle, \"fasta\")\n    handle.close()\n    print(f\">{record.description}\")\n```\n\n### Pattern 4: Build Phylogenetic Tree from Sequences\n\n```python\nfrom Bio import AlignIO, Phylo\nfrom Bio.Phylo.TreeConstruction import DistanceCalculator, DistanceTreeConstructor\n\n# Read alignment\nalignment = AlignIO.read(\"alignment.fasta\", \"fasta\")\n\n# Calculate distances\ncalculator = DistanceCalculator(\"identity\")\ndm = calculator.get_distance(alignment)\n\n# Build tree\nconstructor = DistanceTreeConstructor()\ntree = constructor.nj(dm)\n\n# Visualize\nPhylo.draw_ascii(tree)\n```\n\n## Best Practices\n\n1. **Always read relevant reference documentation** before writing code\n2. **Use grep to search reference files** for specific functions or examples\n3. **Validate file formats** before parsing\n4. **Handle missing data gracefully** - Not all records have all fields\n5. **Cache downloaded data** - Don't repeatedly download the same sequences\n6. **Respect NCBI rate limits** - Use API keys and proper delays\n7. **Test with small datasets** before processing large files\n8. **Keep Biopython updated** to get latest features and bug fixes\n9. **Use appropriate genetic code tables** for translation\n10. **Document analysis parameters** for reproducibility\n\n## Troubleshooting Common Issues\n\n### Issue: \"No handlers could be found for logger 'Bio.Entrez'\"\n**Solution:** This is just a warning. Set Entrez.email to suppress it.\n\n### Issue: \"HTTP Error 400\" from NCBI\n**Solution:** Check that IDs\u002Faccessions are valid and properly formatted.\n\n### Issue: \"ValueError: EOF\" when parsing files\n**Solution:** Verify file format matches the specified format string.\n\n### Issue: Alignment fails with \"sequences are not the same length\"\n**Solution:** Ensure sequences are aligned before using AlignIO or MultipleSeqAlignment.\n\n### Issue: BLAST searches are slow\n**Solution:** Use local BLAST for large-scale searches, or cache results.\n\n### Issue: PDB parser warnings\n**Solution:** Use `PDBParser(QUIET=True)` to suppress warnings, or investigate structure quality.\n\n## Additional Resources\n\n- **Official Documentation**: https:\u002F\u002Fbiopython.org\u002Fdocs\u002Flatest\u002F\n- **Tutorial**: https:\u002F\u002Fbiopython.org\u002Fdocs\u002Flatest\u002FTutorial\u002F\n- **Cookbook**: https:\u002F\u002Fbiopython.org\u002Fdocs\u002Flatest\u002FTutorial\u002F (advanced examples)\n- **GitHub**: https:\u002F\u002Fgithub.com\u002Fbiopython\u002Fbiopython\n- **Mailing List**: biopython@biopython.org\n\n## Quick Reference\n\nTo locate information in reference files, use these search patterns:\n\n```bash\n# Search for specific functions\ngrep -n \"function_name\" references\u002F*.md\n\n# Find examples of specific tasks\ngrep -n \"example\" references\u002Fsequence_io.md\n\n# Find all occurrences of a module\ngrep -n \"Bio.Seq\" references\u002F*.md\n```\n\n## Summary\n\nBiopython provides comprehensive tools for computational molecular biology. When using this skill:\n\n1. **Identify the task domain** (sequences, alignments, databases, BLAST, structures, phylogenetics, or advanced)\n2. **Consult the appropriate reference file** in the `references\u002F` directory\n3. **Adapt code examples** to the specific use case\n4. **Combine multiple modules** when needed for complex workflows\n5. **Follow best practices** for file handling, error checking, and data management\n\nThe modular reference documentation ensures detailed, searchable information for every major Biopython capability.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,209,2023,"2026-05-16 13:08:49",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"其他","other","mdi-page-next-outline","其他类型Skill",5,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"职场发展","career","mdi-briefcase-outline","面试准备、简历优化、职业规划",4,575,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"f2aa96ad-80eb-4929-a130-c4a34e41f9c2","1.0.0","biopython.zip",5052,"uploads\u002Fskills\u002Fdb92e1eb-184a-4ef1-b202-8e0bc6d93108\u002Fbiopython.zip","9c6aac1d9c7be1eddfcf8bf0f343094869711e2fc5462d59abcfc1be28d8e88e","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":14141}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]