序列、组装与测序数据查询:参数与补充说明¶
用法和示例见功能教程。
各功能按作用、API、输入、输出、示例代码和结果说明介绍。运行前按说明准备凭据、本地文件与可选依赖;远程结果随数据库版本与查询时间变化。
按分类与关键词检索 ENA 生物样本¶
dnakit.databases.enaportal_search_samples(*, query, limit=None, fields=None, verbose=True)
| 参数 | 类型 | 必填 / 默认值 | 说明与约束 |
|---|---|---|---|
query |
string | 必填 | ENA search query. Examples: 'tax_tree(562)' (E. coli), 'description="liver"', 'tax_tree(9606) AND description="tumor"'. |
limit |
integer | null | None | Maximum results to return (1-100, default 10). |
fields |
string | null | None | Comma-separated fields. Default: 'sample_accession,sample_alias,description,tax_id,scientific_name,first_public'. |
verbose |
bool | True | 运行提示开关。 |
检索 ENA 测序研究项目¶
dnakit.databases.enaportal_search_studies(*, query, limit=None, fields=None, verbose=True)
| 参数 | 类型 | 必填 / 默认值 | 说明与约束 |
|---|---|---|---|
query |
string | 必填 | ENA search query. IMPORTANT: Plain text keywords (e.g., 'cancer') will cause HTTP 400. Always wrap text keywords with description="...". Examples: 'description="cancer"', 'tax_tree(9606)' (human), 'description="transcriptomics" AND tax_tree(10090)' (mouse transcriptomics). |
limit |
integer | null | None | Maximum results to return (1-100, default 10). |
fields |
string | null | None | Comma-separated fields to return. Default: 'study_accession,study_title,center_name,first_public,description'. Other fields: 'last_updated,tax_id,scientific_name'. |
verbose |
bool | True | 运行提示开关。 |
获取基因、转录本或区间序列¶
dnakit.databases.ensembl_get_sequence(*, id, type=None, species=None, multiple_sequences=None, verbose=True)
| 参数 | 类型 | 必填 / 默认值 | 说明与约束 |
|---|---|---|---|
id |
string | 必填 | Ensembl gene/transcript ID (e.g., 'ENSG00000139618' or 'ENST00000380152') |
type |
string | None | Sequence type: 'genomic' (genomic DNA), 'cds' (coding sequence), 'cdna' (cDNA), 'protein' (protein/peptide sequence -- 'peptide' is also accepted and mapped to 'protein', the name Ensembl's own REST API actually expects) |
species |
string | None | Species name (optional, defaults to human) |
multiple_sequences |
boolean | None | Return multiple sequences if available (e.g., all transcripts) |
verbose |
bool | True | 运行提示开关。 |
按 Ensembl 编号获取核酸或蛋白质序列¶
dnakit.databases.ensembl_seq_get_id_sequence(*, ensembl_id, type=None, verbose=True)
| 参数 | 类型 | 必填 / 默认值 | 说明与约束 |
|---|---|---|---|
ensembl_id |
string | 必填 | Ensembl stable ID. Examples: 'ENSP00000269305' (TP53 protein, 393 aa), 'ENST00000269305' (TP53-201 transcript), 'ENSG00000141510' (TP53 gene). Protein IDs start with ENSP, transcript with ENST, gene with ENSG. |
type |
string | None | Sequence type to return. Options: 'protein' (amino acid), 'cdna' (spliced cDNA), 'cds' (coding sequence), 'genomic' (unspliced DNA). Default: 'protein' for ENSP IDs, auto-detected for others. |
verbose |
bool | True | 运行提示开关。 |
按基因组坐标获取 Ensembl 参考序列¶
dnakit.databases.ensembl_seq_get_region_sequence(*, region, species=None, verbose=True)
| 参数 | 类型 | 必填 / 默认值 | 说明与约束 |
|---|---|---|---|
region |
string | 必填 | Genomic region in format 'chr:start-end' or 'chr:start..end:strand'. Examples: '17:7668421-7668520' (TP53 locus, 100bp), '7:140424943-140425043' (BRAF locus, 100bp), 'X:15560138-15602945' (MECP2 gene). Strand: 1 for forward, -1 for reverse. |
species |
string | None | Ensembl species name. Default: 'homo_sapiens'. Examples: 'mus_musculus', 'danio_rerio', 'drosophila_melanogaster'. |
verbose |
bool | True | 运行提示开关。 |
将 GenBank UID 转换为序列编号¶
dnakit.databases.ncbi_fetch_accessions(*, operation=None, uids, verbose=True)
| 参数 | 类型 | 必填 / 默认值 | 说明与约束 |
|---|---|---|---|
operation |
object | None | None | Operation type (fixed: fetch_accession) |
uids |
object | 必填 | GenBank UID(s) from NCBI_search_nucleotide. Can be single UID or array of UIDs. {"oneOf": [{"type": "array", "items": {"type": "string"}}, {"type": "string"}]} |
verbose |
bool | True | 运行提示开关。 |
按 NCBI 序列编号获取核酸记录¶
dnakit.databases.ncbi_get_sequence(*, operation=None, accession, format=None, verbose=True)
| 参数 | 类型 | 必填 / 默认值 | 说明与约束 |
|---|---|---|---|
operation |
object | None | None | Operation type (fixed: fetch_sequence) |
accession |
string | 必填 | NCBI accession number (e.g., 'U00096', 'NC_045512', 'NM_000546'). Works with GenBank, EMBL, and RefSeq accessions. |
format |
string | None | Sequence format: 'fasta' for FASTA, 'gb' for GenBank, 'embl' for EMBL, 'gp' for GenPept protein. Default: fasta |
verbose |
bool | True | 运行提示开关。 |
按物种、基因或菌株检索核酸记录¶
dnakit.databases.ncbi_search_nucleotide(*, operation=None, organism=None, gene=None, strain=None, keywords=None, seq_type=None, query=None, limit=None, sort=None, verbose=True)
| 参数 | 类型 | 必填 / 默认值 | 说明与约束 |
|---|---|---|---|
operation |
object | None | None | Operation type (fixed: search) |
organism |
string | None | Organism name to search (e.g., 'Escherichia coli', 'Homo sapiens'). Searches in [Organism] field. |
gene |
string | None | Gene name to search (e.g., 'BRCA1', 'TP53'). Searches in [Gene] field. |
strain |
string | None | Strain name to filter (e.g., 'K-12', 'MG1655'). Searches in [Strain] field. |
keywords |
string | None | Keywords to search in titles (e.g., 'complete genome', 'mitochondrial'). Searches in [Title] field. |
seq_type |
string | None | Sequence type filter: 'complete_genome' for complete genomes, 'mrna' for mRNA sequences, 'refseq' for RefSeq curated sequences |
query |
string | None | Free-form search query if not using structured filters. Use NCBI query syntax (e.g., '(Escherichia coli[Organism]) AND (K-12[Strain])') |
limit |
integer | None | Maximum number of results to return (default: 20, max: 100) |
sort |
string | None | Sort order for results (default: relevance) |
verbose |
bool | True | 运行提示开关。 |
按研究与实验条件检索 SRA 测序运行¶
dnakit.databases.ncbi_sra_search_runs(*, operation=None, study=None, organism=None, strategy=None, platform=None, source=None, query=None, limit=None, sort=None, verbose=True)
| 参数 | 类型 | 必填 / 默认值 | 说明与约束 |
|---|---|---|---|
operation |
object | None | None | Operation type (fixed: search) |
study |
string | None | Study accession to search (e.g., 'SRP000001', 'ERP000001', 'DRP000001'). Searches in [Study] field. |
organism |
string | None | Organism name to filter (e.g., 'Homo sapiens', 'Mus musculus', 'SARS-CoV-2'). Searches in [Organism] field. |
strategy |
string | None | Sequencing strategy to filter. Common values: 'RNA-Seq' (transcriptomics), 'WGS' (whole genome), 'WXS' (exome), 'ChIP-Seq' (chromatin), 'ATAC-Seq' (accessibility), 'Bisulfite-Seq' (methylation), 'AMPLICON' (targeted), 'Hi-C' (3D genome) |
platform |
string | None | Sequencing platform to filter. Common values: 'ILLUMINA', 'OXFORD_NANOPORE', 'PACBIO_SMRT', 'ION_TORRENT', 'BGISEQ' |
source |
string | None | Library source to filter. Common values: 'GENOMIC' (DNA), 'TRANSCRIPTOMIC' (RNA), 'METAGENOMIC', 'METATRANSCRIPTOMIC', 'SYNTHETIC', 'VIRAL_RNA' |
query |
string | None | Free-form search query if not using structured filters. Use NCBI query syntax (e.g., '(Homo sapiens[Organism]) AND (RNA-Seq[Strategy])') |
limit |
integer | None | Maximum number of results to return (default: 20, max: 100) |
sort |
string | None | Sort order for results (default: relevance) |
verbose |
bool | True | 运行提示开关。 |
查询基因组组装的版本与元数据¶
dnakit.databases.ncbidatasets_get_genome_assembly(*, accession, verbose=True)
| 参数 | 类型 | 必填 / 默认值 | 说明与约束 |
|---|---|---|---|
accession |
string | 必填 | Assembly accession, e.g. 'GCF_000005845.2' (E. coli K-12) or 'GCF_000001405.40' (human GRCh38.p14). |
verbose |
bool | True | 运行提示开关。 |
获取组装中染色体与支架的序列报告¶
dnakit.databases.ncbidatasets_get_sequence_reports(*, accession, page_size=None, page_token=None, verbose=True)
| 参数 | 类型 | 必填 / 默认值 | 说明与约束 |
|---|---|---|---|
accession |
string | 必填 | Assembly accession, e.g. 'GCF_000005845.2'. |
page_size |
integer | null | None | Maximum sequence records in this page (default 100, maximum 1000). |
page_token |
string | null | None | Opaque next_page_token returned by a previous call. Omit for the first page. {"minLength": 1, "pattern": ".\S."} |
verbose |
bool | True | 运行提示开关。 |
按分类编号查询物种谱系与统计¶
dnakit.databases.ncbidatasets_get_taxonomy(*, tax_id, verbose=True)
| 参数 | 类型 | 必填 / 默认值 | 说明与约束 |
|---|---|---|---|
tax_id |
string | 必填 | NCBI Taxonomy ID (numeric). Examples: '9606' (Homo sapiens), '10090' (Mus musculus), '7227' (Drosophila melanogaster), '562' (E. coli). |
verbose |
bool | True | 运行提示开关。 |
列出指定分类单元的基因组组装¶
dnakit.databases.ncbidatasets_list_genomes_by_taxon(*, taxon, limit=None, reference_only=None, verbose=True)
| 参数 | 类型 | 必填 / 默认值 | 说明与约束 |
|---|---|---|---|
taxon |
string | 必填 | NCBI tax id or scientific name, e.g. '562', 'Escherichia coli', 'Saccharomyces cerevisiae'. {"minLength": 1, "pattern": ".\S."} |
limit |
integer | null | None | Max assemblies to return (default 20, max 100). |
reference_only |
boolean | null | None | If true, return only reference/representative genomes. |
verbose |
bool | True | 运行提示开关。 |
按部分名称查找物种分类候选¶
dnakit.databases.ncbidatasets_suggest_taxonomy(*, query, verbose=True)
| 参数 | 类型 | 必填 / 默认值 | 说明与约束 |
|---|---|---|---|
query |
string | 必填 | Partial organism name to search. Examples: 'drosophila', 'escherichia', 'arabidopsis', 'saccharomyces'. {"minLength": 1, "pattern": ".\S."} |
verbose |
bool | True | 运行提示开关。 |
按实验编号查询 SRA 测序元数据¶
dnakit.databases.sra_get_experiment(*, accession, verbose=True)
| 参数 | 类型 | 必填 / 默认值 | 说明与约束 |
|---|---|---|---|
accession |
string | 必填 | SRA accession number (e.g., 'SRX26927637', 'SRP000001', 'SRS000001') |
verbose |
bool | True | 运行提示开关。 |
检索 SRA 测序实验¶
dnakit.databases.sra_search_experiments(*, query=None, organism=None, library_strategy=None, platform=None, limit=None, verbose=True)
| 参数 | 类型 | 必填 / 默认值 | 说明与约束 |
|---|---|---|---|
query |
string | None | Search keywords (e.g., 'human gut metagenome', 'BRCA1 RNA-Seq', 'single cell lung cancer') |
organism |
string | None | Organism name to filter by (e.g., 'Homo sapiens', 'Mus musculus', 'human gut metagenome') |
library_strategy |
string | None | Sequencing strategy filter (e.g., 'RNA-Seq', 'WGS', 'WXS', 'ChIP-Seq', 'ATAC-seq', 'Bisulfite-Seq', 'AMPLICON') |
platform |
string | None | Sequencing platform filter (e.g., 'ILLUMINA', 'PACBIO_SMRT', 'OXFORD_NANOPORE', 'ION_TORRENT') |
limit |
integer | None | Maximum results to return (1-50, default 10) |
verbose |
bool | True | 运行提示开关。 |
批量将序列 UID 解析为带版本的编号¶
dnakit.search.ncbi.accessions(uids, *, database='nuccore', config=None, api_base_url='https://eutils.ncbi.nlm.nih.gov/entrez/eutils', verbose=True)
| 参数 | 类型 | 必填 / 默认值 | 说明与约束 |
|---|---|---|---|
uids |
Sequence[str | int] | 必填 | NCBI 序列 UID 列表,按每批 200 个解析。 |
database |
Literal['nuccore', 'protein'] | 'nuccore' | NCBI 序列数据库 nuccore 或 protein。 |
config |
SearchConfig | None | None | 查询使用 SearchConfig;下载使用 DownloadConfig。 |
api_base_url |
str | 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils' | 服务 API 根地址;默认值见签名。 |
verbose |
bool | True | 是否显示 DNAKit 运行提示;不会改变返回值。 |