bio-read-sequences
БесплатноЗапускает вложенные скриптыНе проверенRead biological sequence files (FASTA, FASTQ, GenBank, EMBL, ABI, SFF) using Biopython Bio.SeqIO. Use when parsing sequence files, iterating multi-sequence…
от FridrichMethod★ 17 звёзд на GitHubОб этом скилле
Version Compatibility
Reference examples tested with: BioPython 1.83+
Before using code patterns, verify installed versions match. If versions differ:
- Python:
pip show biopythonthenhelp(module.function)to check signatures
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
Read Sequences
Read biological sequence data from files using Biopython's Bio.SeqIO module.
"Read sequences from a file" → Parse file into a collection of SeqRecord objects with IDs, sequences, and annotations accessible.
- Python:
SeqIO.parse()orSeqIO.read()(BioPython) - R:
readDNAStringSet()orreadAAStringSet()(Biostrings)
Required Import
Core import
from Bio import SeqIO
Core Functions
SeqIO.parse() - Multiple Records
Use for files with one or more sequences. Returns an iterator of SeqRecord objects.
for record in SeqIO.parse('sequences.fasta', 'fasta'):
print(record.id, len(record.seq))
Important: Always specify the format explicitly as the second argument.
SeqIO.read() - Single Record
Use when file contains exactly one sequence. Raises error if zero or multiple records.
record = SeqIO.read('single.fasta', 'fasta')
SeqIO.to_dict() - Load All Into Memory
Use for random access by record ID. Loads entire file into memory.
records = SeqIO.to_dict(SeqIO.parse('sequences.fasta', 'fasta'))
seq = records['sequence_id'].seq
SeqIO.index() - Large File Random Access
Use for large files when random access is needed without loading everything into memory.
records = SeqIO.index('large.fasta', 'fasta')
seq = records['sequence_id'].seq
records.close()
SeqIO.index_db() - SQLite-Backed Indexing
Use for very large files or multiple files. Creates persistent SQLite index.
# Create index (first time - parses file)
records = SeqIO.index_db('index.sqlite', 'large.fasta', 'fasta')
seq = records['sequence_id'].seq
records.close()
# Reuse existing index (instant load)
records = SeqIO.index_db('index.sqlite')
# Index multiple files together
records = SeqIO.index_db('combined.sqlite', ['file1.fasta', 'file2.fasta'], 'fasta')
Advantages over index():
- Persistent index survives program restarts
- Can index multiple files as one database
- Lower memory for extremely large files
- SQLite file can be shared across processes
High-Performance Parsing
For maximum throughput on large files, use low-level parsers (3-6x faster than SeqIO.parse):
SimpleFastaParser
Goal: Parse large FASTA files at maximum speed without SeqRecord overhead.
Approach: Use low-level tuple-based parser returning (title, sequence) strings.
Reference (BioPython 1.83+):
from Bio.SeqIO.FastaIO import SimpleFastaParser
with open('large.fasta') as handle:
for title, sequence in SimpleFastaParser(handle):
if len(sequence) > 1000:
print(title.split()[0]) # First word is usually ID
Returns (title, sequence) tuples as strings (no SeqRecord overhead).
FastqGeneralIterator
Goal: Parse large FASTQ files at maximum speed.
Approach: Use low-level tuple-based parser returning (title, sequence, quality_string) strings.
Reference (BioPython 1.83+):
from Bio.SeqIO.QualityIO import FastqGeneralIterator
with open('reads.fastq') as handle:
for title, sequence, quality in FastqGeneralIterator(handle):
avg_qual = sum(ord(c) - 33 for c in quality) / len(quality)
Returns (title, sequence, quality_string) tuples.
Common Formats
| Format | String | Typical Extension | Notes |
|---|---|---|---|
| FASTA | 'fasta' |
.fasta, .fa, .fna, .faa | Most common |
| FASTA 2-line | 'fasta-2line' |
.fasta | One line per sequence (no wrapping) |
| FASTQ | 'fastq' |
.fastq, .fq | With quality scores |
| FASTQ Solexa | 'fastq-solexa' |
.fastq | Old Solexa/Illumina (pre-1.3) |
| FASTQ Illumina | 'fastq-illumina' |
.fastq | Illumina 1.3-1.7 |
| GenBank | 'genbank' or 'gb' |
.gb, .gbk | With features/annotations |
| EMBL | 'embl' |
.embl | European format with features |
| Swiss-Prot | 'swiss' |
.dat | UniProt format |
Specialized Formats
| Format | String | Use Case |
|---|---|---|
| ABI | 'abi' |
Sanger sequencing trace files (.ab1) |
| ABI Trimmed | 'abi-trim' |
ABI with low-quality ends trimmed |
| SFF | 'sff' |
454/Ion Torrent flowgram data |
| SFF Trimmed | 'sff-trim' |
SFF with adapter/quality trimming |
| QUAL | 'qual' |
Quality scores file (pairs with FASTA) |
| PHD | 'phd' |
Phred/Phrap/Consed output |
| ACE | 'ace' |
Assembly format (Consed) |
| PDB SEQRES | 'pdb-seqres' |
Protein sequences from PDB files |
| PDB ATOM | 'pdb-atom' |
Sequences from ATOM records in PDB |
| SnapGene | 'snapgene' |
SnapGene .dna files |
| GCK | 'gck' |
Gene C |
Установить bio-read-sequences в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл bio-read-sequences?
Read biological sequence files (FASTA, FASTQ, GenBank, EMBL, ABI, SFF) using Biopython Bio.SeqIO. Use when parsing sequence files, iterating multi-sequence files, random access to large files, or high-performance parsing.
Как установить скилл bio-read-sequences?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл bio-read-sequences запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic