@brainpilot/skills 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/01_Meta-Skills/workflow-skill-creator/SKILL.md +288 -0
- package/skills/01_Meta-Skills/workflow-skill-creator/references/cli_script_template.py +217 -0
- package/skills/06_fMRI_Neuroimaging/netneurotools-guide/SKILL.md +212 -0
- package/skills/06_fMRI_Neuroimaging/netneurotools-guide/references/datasets.md +252 -0
- package/skills/06_fMRI_Neuroimaging/netneurotools-guide/references/interface-plotting.md +238 -0
- package/skills/06_fMRI_Neuroimaging/netneurotools-guide/references/metrics.md +236 -0
- package/skills/06_fMRI_Neuroimaging/netneurotools-guide/references/networks.md +273 -0
- package/skills/06_fMRI_Neuroimaging/netneurotools-guide/references/spatial-modularity.md +291 -0
- package/skills/06_fMRI_Neuroimaging/netneurotools-guide/references/stats.md +290 -0
- package/skills/09_Cellular_Molecular_Neuroscience/alphafold-database-fetch-and-analyze/SKILL.md +116 -0
- package/skills/09_Cellular_Molecular_Neuroscience/alphafold-database-fetch-and-analyze/references/citation.bib +58 -0
- package/skills/09_Cellular_Molecular_Neuroscience/alphafold-database-fetch-and-analyze/scripts/analyze_pae.py +212 -0
- package/skills/09_Cellular_Molecular_Neuroscience/alphafold-database-fetch-and-analyze/scripts/analyze_plddt.py +125 -0
- package/skills/09_Cellular_Molecular_Neuroscience/alphafold-database-fetch-and-analyze/scripts/fetch_structure.py +168 -0
- package/skills/09_Cellular_Molecular_Neuroscience/gtex-database/SKILL.md +176 -0
- package/skills/09_Cellular_Molecular_Neuroscience/gtex-database/references/citation.bib +14 -0
- package/skills/09_Cellular_Molecular_Neuroscience/gtex-database/scripts/gtex_cli.py +281 -0
- package/skills/09_Cellular_Molecular_Neuroscience/human-protein-atlas-database/SKILL.md +181 -0
- package/skills/09_Cellular_Molecular_Neuroscience/human-protein-atlas-database/references/citation.bib +14 -0
- package/skills/09_Cellular_Molecular_Neuroscience/human-protein-atlas-database/references/search-api.md +137 -0
- package/skills/09_Cellular_Molecular_Neuroscience/human-protein-atlas-database/scripts/hpa_cli.py +263 -0
- package/skills/09_Cellular_Molecular_Neuroscience/pdb-database/SKILL.md +169 -0
- package/skills/09_Cellular_Molecular_Neuroscience/pdb-database/references/citation.bib +15 -0
- package/skills/09_Cellular_Molecular_Neuroscience/pdb-database/scripts/download_coordinate_files.py +113 -0
- package/skills/09_Cellular_Molecular_Neuroscience/pdb-database/scripts/fetch_pdb_metadata.py +70 -0
- package/skills/09_Cellular_Molecular_Neuroscience/pdb-database/scripts/fetch_schema.py +251 -0
- package/skills/09_Cellular_Molecular_Neuroscience/pdb-database/scripts/search_pdb.py +187 -0
- package/skills/09_Cellular_Molecular_Neuroscience/pymol/SKILL.md +146 -0
- package/skills/09_Cellular_Molecular_Neuroscience/pymol/references/PYMOL_REFERENCE.md +160 -0
- package/skills/09_Cellular_Molecular_Neuroscience/pymol/references/RECIPES.md +348 -0
- package/skills/09_Cellular_Molecular_Neuroscience/pymol/references/citation.bib +6 -0
- package/skills/17_Literature_Databases/literature-search-arxiv/SKILL.md +120 -0
- package/skills/17_Literature_Databases/literature-search-arxiv/references/citation.bib +18 -0
- package/skills/17_Literature_Databases/literature-search-arxiv/references/query_syntax.md +34 -0
- package/skills/17_Literature_Databases/literature-search-arxiv/scripts/download_paper.py +116 -0
- package/skills/17_Literature_Databases/literature-search-arxiv/scripts/download_paper_source.py +98 -0
- package/skills/17_Literature_Databases/literature-search-arxiv/scripts/search_arxiv.py +174 -0
- package/skills/17_Literature_Databases/literature-search-biorxiv/SKILL.md +169 -0
- package/skills/17_Literature_Databases/literature-search-biorxiv/references/citation.bib +12 -0
- package/skills/17_Literature_Databases/literature-search-biorxiv/scripts/search_by_dates.py +297 -0
- package/skills/17_Literature_Databases/literature-search-biorxiv/scripts/search_by_doi.py +72 -0
- package/skills/17_Literature_Databases/literature-search-europepmc/SKILL.md +229 -0
- package/skills/17_Literature_Databases/literature-search-europepmc/references/citation.bib +15 -0
- package/skills/17_Literature_Databases/literature-search-europepmc/scripts/europepmc_api.py +345 -0
- package/skills/17_Literature_Databases/literature-search-openalex/SKILL.md +169 -0
- package/skills/17_Literature_Databases/literature-search-openalex/references/authors.md +78 -0
- package/skills/17_Literature_Databases/literature-search-openalex/references/citation.bib +8 -0
- package/skills/17_Literature_Databases/literature-search-openalex/references/geo_and_language.md +37 -0
- package/skills/17_Literature_Databases/literature-search-openalex/references/institutions.md +64 -0
- package/skills/17_Literature_Databases/literature-search-openalex/references/publishers_funders.md +42 -0
- package/skills/17_Literature_Databases/literature-search-openalex/references/sources.md +79 -0
- package/skills/17_Literature_Databases/literature-search-openalex/references/taxonomy.md +52 -0
- package/skills/17_Literature_Databases/literature-search-openalex/references/topics.md +29 -0
- package/skills/17_Literature_Databases/literature-search-openalex/references/type_values.md +65 -0
- package/skills/17_Literature_Databases/literature-search-openalex/references/works.md +304 -0
- package/skills/17_Literature_Databases/literature-search-openalex/scripts/openalex_cli.py +633 -0
- package/skills/17_Literature_Databases/pubmed-database/SKILL.md +185 -0
- package/skills/17_Literature_Databases/pubmed-database/references/advanced-linking.md +128 -0
- package/skills/17_Literature_Databases/pubmed-database/references/advanced-search.md +98 -0
- package/skills/17_Literature_Databases/pubmed-database/references/bulk-workflows.md +88 -0
- package/skills/17_Literature_Databases/pubmed-database/references/citation-matching.md +155 -0
- package/skills/17_Literature_Databases/pubmed-database/references/citation.bib +15 -0
- package/skills/17_Literature_Databases/pubmed-database/references/cross-database-linking.md +93 -0
- package/skills/17_Literature_Databases/pubmed-database/references/fetch-and-resolve.md +125 -0
- package/skills/17_Literature_Databases/pubmed-database/references/search-and-discovery.md +106 -0
- package/skills/17_Literature_Databases/pubmed-database/references/utilities.md +42 -0
- package/skills/17_Literature_Databases/pubmed-database/scripts/pubmed_api.py +715 -0
- package/skills/18_Genetics_Genomics/alphagenome-single-variant-analysis/SKILL.md +251 -0
- package/skills/18_Genetics_Genomics/alphagenome-single-variant-analysis/pyproject.toml +15 -0
- package/skills/18_Genetics_Genomics/alphagenome-single-variant-analysis/references/citation.bib +12 -0
- package/skills/18_Genetics_Genomics/alphagenome-single-variant-analysis/scripts/analyze_ism.py +334 -0
- package/skills/18_Genetics_Genomics/alphagenome-single-variant-analysis/scripts/generate_ontology_mapping.py +170 -0
- package/skills/18_Genetics_Genomics/alphagenome-single-variant-analysis/scripts/interpret_splicing.py +305 -0
- package/skills/18_Genetics_Genomics/alphagenome-single-variant-analysis/scripts/lookup_gene_info.py +337 -0
- package/skills/18_Genetics_Genomics/alphagenome-single-variant-analysis/scripts/resolve_ontology_terms.py +155 -0
- package/skills/18_Genetics_Genomics/alphagenome-single-variant-analysis/scripts/visualize_genome_tracks.py +402 -0
- package/skills/18_Genetics_Genomics/alphagenome-single-variant-analysis/scripts/visualize_variant_effects.py +1198 -0
- package/skills/18_Genetics_Genomics/clinvar-database/SKILL.md +370 -0
- package/skills/18_Genetics_Genomics/clinvar-database/references/citation.bib +23 -0
- package/skills/18_Genetics_Genomics/clinvar-database/scripts/clinvar_api.py +711 -0
- package/skills/18_Genetics_Genomics/dbsnp-database/SKILL.md +350 -0
- package/skills/18_Genetics_Genomics/dbsnp-database/references/api-notes.md +88 -0
- package/skills/18_Genetics_Genomics/dbsnp-database/references/citation.bib +12 -0
- package/skills/18_Genetics_Genomics/dbsnp-database/scripts/dbsnp_cli.py +625 -0
- package/skills/18_Genetics_Genomics/gnomad-database/SKILL.md +73 -0
- package/skills/18_Genetics_Genomics/gnomad-database/references/citation.bib +14 -0
- package/skills/18_Genetics_Genomics/gnomad-database/scripts/get_gene_constraint.py +90 -0
- package/skills/18_Genetics_Genomics/gnomad-database/scripts/get_variant_frequency.py +181 -0
- package/skills/18_Genetics_Genomics/gnomad-database/scripts/search_variants.py +207 -0
- package/skills/19_Pharmacology/chembl-database/SKILL.md +283 -0
- package/skills/19_Pharmacology/chembl-database/references/api_endpoints.md +97 -0
- package/skills/19_Pharmacology/chembl-database/references/citation.bib +30 -0
- package/skills/19_Pharmacology/chembl-database/scripts/chembl_api.py +657 -0
- package/skills/19_Pharmacology/clinical-trials-database/SKILL.md +378 -0
- package/skills/19_Pharmacology/clinical-trials-database/references/citation.bib +11 -0
- package/skills/19_Pharmacology/clinical-trials-database/references/clinical_trials_api.md +187 -0
- package/skills/19_Pharmacology/clinical-trials-database/references/studies_schema.md +143 -0
- package/skills/19_Pharmacology/clinical-trials-database/scripts/clinical_trials_api.py +373 -0
- package/skills/19_Pharmacology/openfda-database/SKILL.md +225 -0
- package/skills/19_Pharmacology/openfda-database/references/api_endpoints.md +207 -0
- package/skills/19_Pharmacology/openfda-database/references/citation.bib +15 -0
- package/skills/19_Pharmacology/openfda-database/references/recipes.md +150 -0
- package/skills/19_Pharmacology/openfda-database/scripts/openfda_query.py +505 -0
- package/skills/19_Pharmacology/opentargets-database/SKILL.md +198 -0
- package/skills/19_Pharmacology/opentargets-database/references/OpenTargets_GraphQL_Guide.md +216 -0
- package/skills/19_Pharmacology/opentargets-database/references/citation.bib +15 -0
- package/skills/19_Pharmacology/opentargets-database/scripts/query_opentargets.py +533 -0
- package/skills/19_Pharmacology/pubchem-database/SKILL.md +164 -0
- package/skills/19_Pharmacology/pubchem-database/references/citation.bib +15 -0
- package/skills/19_Pharmacology/pubchem-database/references/endpoints.md +71 -0
- package/skills/19_Pharmacology/pubchem-database/references/workflows.md +32 -0
- package/skills/19_Pharmacology/pubchem-database/scripts/pubchem_api.py +327 -0
- package/skills/20_Infrastructure/uv/SKILL.md +30 -0
- package/skills/01_Meta-Skills/academic-research-hub/SKILL.md +0 -108
- package/skills/01_Meta-Skills/academic-research-hub/scripts/requirements.txt +0 -17
- package/skills/01_Meta-Skills/academic-research-hub/scripts/research.py +0 -781
- package/skills/01_Meta-Skills/beautiful-log/SKILL.md +0 -64
- package/skills/01_Meta-Skills/beautiful-log/scripts/beautiful_log.py +0 -274
- package/skills/01_Meta-Skills/ethoclaw-daily-paper/SKILL.md +0 -130
- package/skills/01_Meta-Skills/ethoclaw-daily-paper/assets/config.template.yaml +0 -54
- package/skills/01_Meta-Skills/ethoclaw-daily-paper/assets/top5_digest_template.md +0 -5
- package/skills/01_Meta-Skills/ethoclaw-daily-paper/scripts/build_top5_digest.py +0 -300
- package/skills/01_Meta-Skills/ethoclaw-daily-paper/scripts/common.py +0 -137
- package/skills/01_Meta-Skills/ethoclaw-daily-paper/scripts/merge_results.py +0 -106
- package/skills/01_Meta-Skills/ethoclaw-daily-paper/scripts/run_pipeline.py +0 -177
- package/skills/01_Meta-Skills/ethoclaw-daily-paper/scripts/search_arxiv.py +0 -162
- package/skills/01_Meta-Skills/ethoclaw-daily-paper/scripts/search_pubmed.py +0 -202
- package/skills/01_Meta-Skills/ethoclaw-normalize-tabular/SKILL.md +0 -173
- package/skills/01_Meta-Skills/ethoclaw-normalize-tabular/scripts/normalize_data.py +0 -874
- package/skills/01_Meta-Skills/ethoclaw-pdf-research/SKILL.md +0 -134
- package/skills/01_Meta-Skills/ethoclaw-pdf-research/references/confirmation-prompts.md +0 -31
- package/skills/01_Meta-Skills/ethoclaw-pdf-research/references/output-patterns.md +0 -45
- package/skills/01_Meta-Skills/ethoclaw-pdf-research/scripts/build_markdown_deliverables.py +0 -41
- package/skills/01_Meta-Skills/ethoclaw-pdf-research/scripts/build_research_log.py +0 -84
- package/skills/01_Meta-Skills/ethoclaw-pdf-research/scripts/build_summary_md.py +0 -63
- package/skills/01_Meta-Skills/ethoclaw-pdf-research/scripts/extract_pdf_bundle.py +0 -140
- package/skills/01_Meta-Skills/experiment-controller/SKILL.md +0 -140
- package/skills/01_Meta-Skills/knowledge-graph-builder/SKILL.md +0 -366
- package/skills/01_Meta-Skills/knowledge-graph-builder/scripts/entity_resolution.py +0 -120
- package/skills/01_Meta-Skills/knowledge-graph-builder/scripts/extraction_prompt_template.txt +0 -19
- package/skills/01_Meta-Skills/knowledge-graph-builder/scripts/graph_query.py +0 -106
- package/skills/01_Meta-Skills/knowledge-graph-builder/scripts/hypothesis_cli_reference.py +0 -42
- package/skills/01_Meta-Skills/knowledge-graph-builder/scripts/new_data_source_template.py +0 -116
- package/skills/01_Meta-Skills/knowledge-graph-builder/scripts/requirements.txt +0 -15
- package/skills/01_Meta-Skills/method-design/SKILL.md +0 -61
- package/skills/01_Meta-Skills/multi-search-engine/SKILL.md +0 -119
- package/skills/01_Meta-Skills/research-idea/SKILL.md +0 -65
- package/skills/05_EEG_ERP/eeg-skill/SKILL.md +0 -197
- package/skills/05_EEG_ERP/meg-skill/SKILL.md +0 -188
- package/skills/05_EEG_ERP/meg-skill/scripts/time_frequency.py +0 -223
- package/skills/05_EEG_ERP/mne-eeg-tool/SKILL.md +0 -165
- package/skills/05_EEG_ERP/mne-eeg-tool/scripts/eeg_pipeline_reference.py +0 -231
- package/skills/05_EEG_ERP/seed-iv-skill/SKILL.md +0 -184
- package/skills/05_EEG_ERP/seed-iv-skill/scripts/classify_seed_iv.py +0 -154
- package/skills/05_EEG_ERP/seed-iv-skill/scripts/extract_seed_iv_features.py +0 -190
- package/skills/05_EEG_ERP/seed-iv-skill/scripts/validate_seed_iv.py +0 -102
- package/skills/05_EEG_ERP/seed-vig-skill/SKILL.md +0 -182
- package/skills/05_EEG_ERP/seed-vig-skill/scripts/classify_seed_vig.py +0 -165
- package/skills/05_EEG_ERP/seed-vig-skill/scripts/extract_seed_vig_features.py +0 -185
- package/skills/05_EEG_ERP/seed-vig-skill/scripts/validate_seed_vig.py +0 -88
- package/skills/06_fMRI_Neuroimaging/abcd-skill/SKILL.md +0 -308
- package/skills/06_fMRI_Neuroimaging/abcd-skill/scripts/abcd_qc_summary.py +0 -449
- package/skills/06_fMRI_Neuroimaging/abcd-skill/scripts/extract_abcd_phenotype.py +0 -292
- package/skills/06_fMRI_Neuroimaging/abcd-skill/scripts/reorganize_abcd.py +0 -387
- package/skills/06_fMRI_Neuroimaging/abide-skill/SKILL.md +0 -302
- package/skills/06_fMRI_Neuroimaging/abide-skill/scripts/abide_qc_summary.py +0 -317
- package/skills/06_fMRI_Neuroimaging/abide-skill/scripts/extract_abide_phenotype.py +0 -267
- package/skills/06_fMRI_Neuroimaging/abide-skill/scripts/reorganize_abide.py +0 -387
- package/skills/06_fMRI_Neuroimaging/adhd200-skill/SKILL.md +0 -244
- package/skills/06_fMRI_Neuroimaging/adhd200-skill/scripts/adhd200_qc_summary.py +0 -98
- package/skills/06_fMRI_Neuroimaging/adhd200-skill/scripts/extract_adhd200_phenotype.py +0 -134
- package/skills/06_fMRI_Neuroimaging/adhd200-skill/scripts/reorganize_adhd200.py +0 -206
- package/skills/06_fMRI_Neuroimaging/adni-skill/SKILL.md +0 -358
- package/skills/06_fMRI_Neuroimaging/adni-skill/scripts/generate_adni_task_files.py +0 -1305
- package/skills/06_fMRI_Neuroimaging/adni-skill/scripts/generate_vqa_from_tasks.py +0 -766
- package/skills/06_fMRI_Neuroimaging/adni-skill/scripts/reorganize_adni.py +0 -491
- package/skills/06_fMRI_Neuroimaging/aibl-skill/SKILL.md +0 -295
- package/skills/06_fMRI_Neuroimaging/aibl-skill/scripts/aibl_qc_summary.py +0 -260
- package/skills/06_fMRI_Neuroimaging/aibl-skill/scripts/extract_aibl_phenotype.py +0 -365
- package/skills/06_fMRI_Neuroimaging/aibl-skill/scripts/reorganize_aibl.py +0 -394
- package/skills/06_fMRI_Neuroimaging/aomic-skill/SKILL.md +0 -292
- package/skills/06_fMRI_Neuroimaging/aomic-skill/scripts/aomic_qc_summary.py +0 -258
- package/skills/06_fMRI_Neuroimaging/aomic-skill/scripts/extract_aomic_phenotype.py +0 -284
- package/skills/06_fMRI_Neuroimaging/aomic-skill/scripts/reorganize_aomic.py +0 -322
- package/skills/06_fMRI_Neuroimaging/asl-skill/SKILL.md +0 -168
- package/skills/06_fMRI_Neuroimaging/asl-skill/scripts/compute_cbf.py +0 -224
- package/skills/06_fMRI_Neuroimaging/bids-organizer/SKILL.md +0 -241
- package/skills/06_fMRI_Neuroimaging/bold5000-skill/SKILL.md +0 -186
- package/skills/06_fMRI_Neuroimaging/bold5000-skill/scripts/bold5000_qc_summary.py +0 -96
- package/skills/06_fMRI_Neuroimaging/bold5000-skill/scripts/extract_bold5000_stimulus.py +0 -125
- package/skills/06_fMRI_Neuroimaging/bold5000-skill/scripts/reorganize_bold5000.py +0 -102
- package/skills/06_fMRI_Neuroimaging/camcan-skill/SKILL.md +0 -213
- package/skills/06_fMRI_Neuroimaging/camcan-skill/scripts/camcan_qc_summary.py +0 -131
- package/skills/06_fMRI_Neuroimaging/camcan-skill/scripts/extract_camcan_phenotype.py +0 -145
- package/skills/06_fMRI_Neuroimaging/camcan-skill/scripts/validate_camcan.py +0 -141
- package/skills/06_fMRI_Neuroimaging/cobre-skill/SKILL.md +0 -201
- package/skills/06_fMRI_Neuroimaging/cobre-skill/scripts/cobre_qc_summary.py +0 -95
- package/skills/06_fMRI_Neuroimaging/cobre-skill/scripts/extract_cobre_phenotype.py +0 -104
- package/skills/06_fMRI_Neuroimaging/cobre-skill/scripts/reorganize_cobre.py +0 -140
- package/skills/06_fMRI_Neuroimaging/conn-tool/SKILL.md +0 -180
- package/skills/06_fMRI_Neuroimaging/dcm2nii/SKILL.md +0 -189
- package/skills/06_fMRI_Neuroimaging/dmt-har-med-skill/SKILL.md +0 -183
- package/skills/06_fMRI_Neuroimaging/dmt-har-med-skill/scripts/dmt_har_med_qc_summary.py +0 -96
- package/skills/06_fMRI_Neuroimaging/dmt-har-med-skill/scripts/extract_dmt_har_med_phenotype.py +0 -121
- package/skills/06_fMRI_Neuroimaging/dmt-har-med-skill/scripts/reorganize_dmt_har_med.py +0 -125
- package/skills/06_fMRI_Neuroimaging/dwi-skill/SKILL.md +0 -359
- package/skills/06_fMRI_Neuroimaging/fmri-skill/SKILL.md +0 -371
- package/skills/06_fMRI_Neuroimaging/fmriprep-tool/SKILL.md +0 -228
- package/skills/06_fMRI_Neuroimaging/freesurfer-tool/SKILL.md +0 -286
- package/skills/06_fMRI_Neuroimaging/freesurfer-tool/scripts/freesurfer_processor.py +0 -145
- package/skills/06_fMRI_Neuroimaging/fsl-tool/SKILL.md +0 -208
- package/skills/06_fMRI_Neuroimaging/hbn-skill/SKILL.md +0 -271
- package/skills/06_fMRI_Neuroimaging/hbn-skill/scripts/extract_hbn_phenotype.py +0 -107
- package/skills/06_fMRI_Neuroimaging/hbn-skill/scripts/hbn_qc_summary.py +0 -96
- package/skills/06_fMRI_Neuroimaging/hbn-skill/scripts/reorganize_hbn.py +0 -150
- package/skills/06_fMRI_Neuroimaging/hcpa-skill/SKILL.md +0 -210
- package/skills/06_fMRI_Neuroimaging/hcpa-skill/scripts/extract_hcpa_phenotype.py +0 -146
- package/skills/06_fMRI_Neuroimaging/hcpa-skill/scripts/hcpa_qc_summary.py +0 -120
- package/skills/06_fMRI_Neuroimaging/hcpa-skill/scripts/reorganize_hcpa.py +0 -155
- package/skills/06_fMRI_Neuroimaging/hcpd-skill/SKILL.md +0 -210
- package/skills/06_fMRI_Neuroimaging/hcpd-skill/scripts/extract_hcpd_phenotype.py +0 -148
- package/skills/06_fMRI_Neuroimaging/hcpd-skill/scripts/hcpd_qc_summary.py +0 -125
- package/skills/06_fMRI_Neuroimaging/hcpd-skill/scripts/reorganize_hcpd.py +0 -146
- package/skills/06_fMRI_Neuroimaging/hcpep-skill/SKILL.md +0 -215
- package/skills/06_fMRI_Neuroimaging/hcpep-skill/scripts/extract_hcpep_phenotype.py +0 -157
- package/skills/06_fMRI_Neuroimaging/hcpep-skill/scripts/hcpep_qc_summary.py +0 -143
- package/skills/06_fMRI_Neuroimaging/hcpep-skill/scripts/reorganize_hcpep.py +0 -146
- package/skills/06_fMRI_Neuroimaging/hcppipeline-tool/SKILL.md +0 -217
- package/skills/06_fMRI_Neuroimaging/hcpya-skill/SKILL.md +0 -214
- package/skills/06_fMRI_Neuroimaging/hcpya-skill/scripts/extract_hcpya_phenotype.py +0 -190
- package/skills/06_fMRI_Neuroimaging/hcpya-skill/scripts/hcpya_qc_summary.py +0 -152
- package/skills/06_fMRI_Neuroimaging/hcpya-skill/scripts/reorganize_hcpya.py +0 -203
- package/skills/06_fMRI_Neuroimaging/ixi-skill/SKILL.md +0 -198
- package/skills/06_fMRI_Neuroimaging/ixi-skill/scripts/ixi_qc_summary.py +0 -137
- package/skills/06_fMRI_Neuroimaging/ixi-skill/scripts/reorganize_ixi.py +0 -190
- package/skills/06_fMRI_Neuroimaging/mnd-skill/SKILL.md +0 -191
- package/skills/06_fMRI_Neuroimaging/mnd-skill/scripts/extract_mnd_phenotype.py +0 -143
- package/skills/06_fMRI_Neuroimaging/mnd-skill/scripts/mnd_qc_summary.py +0 -120
- package/skills/06_fMRI_Neuroimaging/mnd-skill/scripts/validate_mnd.py +0 -107
- package/skills/06_fMRI_Neuroimaging/mschallenge-skill/SKILL.md +0 -203
- package/skills/06_fMRI_Neuroimaging/mschallenge-skill/scripts/analyze_lesions.py +0 -119
- package/skills/06_fMRI_Neuroimaging/mschallenge-skill/scripts/longitudinal_lesion.py +0 -148
- package/skills/06_fMRI_Neuroimaging/mschallenge-skill/scripts/mschallenge_qc_summary.py +0 -132
- package/skills/06_fMRI_Neuroimaging/mschallenge-skill/scripts/validate_mschallenge.py +0 -116
- package/skills/06_fMRI_Neuroimaging/nibabel-skill/SKILL.md +0 -184
- package/skills/06_fMRI_Neuroimaging/nibabel-skill/scripts/atlas_coordinate_reference.py +0 -61
- package/skills/06_fMRI_Neuroimaging/nibabel-skill/scripts/freesurfer_io_reference.py +0 -34
- package/skills/06_fMRI_Neuroimaging/nibabel-skill/scripts/nifti_inspection_reference.py +0 -35
- package/skills/06_fMRI_Neuroimaging/nifd-skill/SKILL.md +0 -205
- package/skills/06_fMRI_Neuroimaging/nifd-skill/scripts/extract_nifd_phenotype.py +0 -132
- package/skills/06_fMRI_Neuroimaging/nifd-skill/scripts/nifd_qc_summary.py +0 -111
- package/skills/06_fMRI_Neuroimaging/nifd-skill/scripts/validate_nifd.py +0 -111
- package/skills/06_fMRI_Neuroimaging/nii2dcm/SKILL.md +0 -143
- package/skills/06_fMRI_Neuroimaging/nilearn-tool/SKILL.md +0 -266
- package/skills/06_fMRI_Neuroimaging/nilearn-tool/scripts/connectome_reference.py +0 -65
- package/skills/06_fMRI_Neuroimaging/nilearn-tool/scripts/denoise_timeseries_reference.py +0 -58
- package/skills/06_fMRI_Neuroimaging/nilearn-tool/scripts/hierarchical_parcellation_reference.py +0 -53
- package/skills/06_fMRI_Neuroimaging/nilearn-tool/scripts/kmeans_parcellation_reference.py +0 -53
- package/skills/06_fMRI_Neuroimaging/nilearn-tool/scripts/preprocess_bold_reference.py +0 -76
- package/skills/06_fMRI_Neuroimaging/nilearn-tool/scripts/rest_dictlearning_reference.py +0 -56
- package/skills/06_fMRI_Neuroimaging/nilearn-tool/scripts/rest_ica_reference.py +0 -59
- package/skills/06_fMRI_Neuroimaging/nilearn-tool/scripts/second_level_glm_reference.py +0 -58
- package/skills/06_fMRI_Neuroimaging/nilearn-tool/scripts/spacenet_classifier_reference.py +0 -59
- package/skills/06_fMRI_Neuroimaging/nilearn-tool/scripts/svm_classifier_reference.py +0 -60
- package/skills/06_fMRI_Neuroimaging/nilearn-tool/scripts/task_glm_reference.py +0 -63
- package/skills/06_fMRI_Neuroimaging/nilearn-tool/scripts/zalff_summary_reference.py +0 -109
- package/skills/06_fMRI_Neuroimaging/nsd-skill/SKILL.md +0 -210
- package/skills/06_fMRI_Neuroimaging/nsd-skill/scripts/extract_nsd_stimulus.py +0 -171
- package/skills/06_fMRI_Neuroimaging/nsd-skill/scripts/nsd_qc_summary.py +0 -142
- package/skills/06_fMRI_Neuroimaging/nsd-skill/scripts/validate_nsd.py +0 -142
- package/skills/06_fMRI_Neuroimaging/oasis-skill/SKILL.md +0 -205
- package/skills/06_fMRI_Neuroimaging/oasis-skill/scripts/extract_oasis_phenotype.py +0 -126
- package/skills/06_fMRI_Neuroimaging/oasis-skill/scripts/oasis_qc_summary.py +0 -115
- package/skills/06_fMRI_Neuroimaging/oasis-skill/scripts/validate_oasis.py +0 -119
- package/skills/06_fMRI_Neuroimaging/pet-skill/SKILL.md +0 -173
- package/skills/06_fMRI_Neuroimaging/pet-skill/scripts/compute_suvr.py +0 -202
- package/skills/06_fMRI_Neuroimaging/pnc-skill/SKILL.md +0 -206
- package/skills/06_fMRI_Neuroimaging/pnc-skill/scripts/extract_pnc_phenotype.py +0 -136
- package/skills/06_fMRI_Neuroimaging/pnc-skill/scripts/pnc_qc_summary.py +0 -116
- package/skills/06_fMRI_Neuroimaging/pnc-skill/scripts/validate_pnc.py +0 -120
- package/skills/06_fMRI_Neuroimaging/ppmi-skill/SKILL.md +0 -209
- package/skills/06_fMRI_Neuroimaging/ppmi-skill/scripts/extract_ppmi_phenotype.py +0 -138
- package/skills/06_fMRI_Neuroimaging/ppmi-skill/scripts/ppmi_qc_summary.py +0 -111
- package/skills/06_fMRI_Neuroimaging/ppmi-skill/scripts/validate_ppmi.py +0 -117
- package/skills/06_fMRI_Neuroimaging/qsiprep-tool/SKILL.md +0 -320
- package/skills/06_fMRI_Neuroimaging/rest-mneta-mdd-skill/SKILL.md +0 -215
- package/skills/06_fMRI_Neuroimaging/rest-mneta-mdd-skill/scripts/extract_rest_mdd_phenotype.py +0 -132
- package/skills/06_fMRI_Neuroimaging/rest-mneta-mdd-skill/scripts/harmonize_sites.py +0 -152
- package/skills/06_fMRI_Neuroimaging/rest-mneta-mdd-skill/scripts/rest_mdd_qc_summary.py +0 -124
- package/skills/06_fMRI_Neuroimaging/rest-mneta-mdd-skill/scripts/validate_rest_mdd.py +0 -103
- package/skills/06_fMRI_Neuroimaging/smri-skill/SKILL.md +0 -302
- package/skills/06_fMRI_Neuroimaging/tcp-skill/SKILL.md +0 -204
- package/skills/06_fMRI_Neuroimaging/tcp-skill/scripts/extract_tcp_phenotype.py +0 -139
- package/skills/06_fMRI_Neuroimaging/tcp-skill/scripts/tcp_qc_summary.py +0 -111
- package/skills/06_fMRI_Neuroimaging/tcp-skill/scripts/validate_tcp.py +0 -99
- package/skills/06_fMRI_Neuroimaging/ucla-cnp-skill/SKILL.md +0 -217
- package/skills/06_fMRI_Neuroimaging/ucla-cnp-skill/scripts/extract_ucla_cnp_phenotype.py +0 -145
- package/skills/06_fMRI_Neuroimaging/ucla-cnp-skill/scripts/ucla_cnp_qc_summary.py +0 -111
- package/skills/06_fMRI_Neuroimaging/ucla-cnp-skill/scripts/validate_ucla_cnp.py +0 -113
- package/skills/06_fMRI_Neuroimaging/ukb-skill/SKILL.md +0 -310
- package/skills/06_fMRI_Neuroimaging/ukb-skill/scripts/build_ukb_survival.py +0 -210
- package/skills/06_fMRI_Neuroimaging/ukb-skill/scripts/extract_ukb_cases.py +0 -308
- package/skills/06_fMRI_Neuroimaging/ukb-skill/scripts/extract_ukb_phenotype.py +0 -232
- package/skills/06_fMRI_Neuroimaging/ukb-skill/scripts/ukb_qc_summary.py +0 -158
- package/skills/06_fMRI_Neuroimaging/wmh-segmentation/SKILL.md +0 -133
- package/skills/07_Computational_Modeling/detrending/SKILL.md +0 -118
- package/skills/07_Computational_Modeling/dictlearning/SKILL.md +0 -122
- package/skills/07_Computational_Modeling/filtering/SKILL.md +0 -121
- package/skills/07_Computational_Modeling/glm/SKILL.md +0 -153
- package/skills/07_Computational_Modeling/hierarchical/SKILL.md +0 -121
- package/skills/07_Computational_Modeling/ica/SKILL.md +0 -122
- package/skills/07_Computational_Modeling/kmeans/SKILL.md +0 -119
- package/skills/07_Computational_Modeling/run_models/SKILL.md +0 -427
- package/skills/07_Computational_Modeling/spacenet/SKILL.md +0 -122
- package/skills/07_Computational_Modeling/svm/SKILL.md +0 -120
- package/skills/08_Computational_Neuroscience/brain_gnn/SKILL.md +0 -183
- package/skills/08_Computational_Neuroscience/dipy-tool/SKILL.md +0 -239
- package/skills/08_Computational_Neuroscience/dipy-tool/scripts/dti_metrics_reference.py +0 -70
- package/skills/08_Computational_Neuroscience/dipy-tool/scripts/load_and_mask_reference.py +0 -76
- package/skills/08_Computational_Neuroscience/dipy-tool/scripts/roi_stats_reference.py +0 -59
- package/skills/08_Computational_Neuroscience/fm_app/SKILL.md +0 -195
- package/skills/08_Computational_Neuroscience/neurostorm/SKILL.md +0 -151
- package/skills/13_Visualization/brain-visualization/SKILL.md +0 -191
- package/skills/13_Visualization/brain-visualization/scripts/connectome_reference.py +0 -108
- package/skills/13_Visualization/brain-visualization/scripts/freesurfer_ply_reference.py +0 -54
- package/skills/13_Visualization/brain-visualization/scripts/zalff_summary_reference.py +0 -116
- package/skills/13_Visualization/ethoclaw-paper-figure-layout/SKILL.md +0 -78
- package/skills/13_Visualization/ethoclaw-paper-figure-layout/assets/naturecomm_figures.tex +0 -74
- package/skills/13_Visualization/ethoclaw-paper-figure-layout/scripts/layout_results_foldered.py +0 -579
- package/skills/14_Writing/overleaf-skill/SKILL.md +0 -184
- package/skills/14_Writing/overleaf-skill/scripts/install.sh +0 -30
- package/skills/14_Writing/paper-writing/SKILL.md +0 -146
- package/skills/14_Writing/paper-writing/scripts/data_statement_templates.py +0 -164
- package/skills/14_Writing/paper-writing/scripts/figure_templates.py +0 -315
- package/skills/14_Writing/paper-writing/scripts/nature_figure_style.py +0 -214
- package/skills/14_Writing/paper-writing/scripts/section_phrasebank.py +0 -246
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/SKILL.md +0 -274
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/assets/report_template_en.html +0 -112
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/assets/report_template_en.md +0 -21
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/assets/section_templates/cluster-section.md +0 -5
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/assets/section_templates/heatmap-section.md +0 -5
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/assets/section_templates/integrated-interpretation.md +0 -3
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/assets/section_templates/overview.md +0 -3
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/assets/section_templates/project-summary.md +0 -3
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/assets/section_templates/radar-section.md +0 -5
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/assets/section_templates/raw-trajectory.md +0 -3
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/assets/section_templates/sample-check.md +0 -3
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/assets/section_templates/single-subject-section.md +0 -3
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/assets/section_templates/stats-section.md +0 -5
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/references/experiment-types/epm.md +0 -52
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/references/experiment-types/fst.md +0 -37
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/references/experiment-types/nor.md +0 -39
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/references/experiment-types/oft.md +0 -43
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/references/experiment-types/tcst.md +0 -45
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/references/experiment-types/tst.md +0 -36
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/references/input-types.md +0 -59
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/references/interpretation-guardrails.md +0 -45
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/references/metadata-schema.md +0 -57
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/references/report-sections.md +0 -86
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/references/section-selection-rules.md +0 -169
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/scripts/build_report_manifest.py +0 -27
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/scripts/render_report.py +0 -34
- package/skills/16_Animal_Behavior/ethoclaw-analysis-report/scripts/report_utils.py +0 -1121
- package/skills/16_Animal_Behavior/ethoclaw-animal-grounding/SKILL.md +0 -390
- package/skills/16_Animal_Behavior/ethoclaw-animal-grounding/reference_code.py +0 -98
- package/skills/16_Animal_Behavior/ethoclaw-animal-pose-estimation/SKILL.md +0 -336
- package/skills/16_Animal_Behavior/ethoclaw-kinematic-parameter-generator/README.md +0 -21
- package/skills/16_Animal_Behavior/ethoclaw-kinematic-parameter-generator/SKILL.md +0 -41
- package/skills/16_Animal_Behavior/ethoclaw-kinematic-parameter-generator/batch_kinematic_generator.py +0 -663
- package/skills/16_Animal_Behavior/ethoclaw-kinematic-parameter-generator/config.json +0 -19
- package/skills/16_Animal_Behavior/ethoclaw-kinematic-parameter-generator/generate_kinematic_parameter.py +0 -401
- package/skills/16_Animal_Behavior/ethoclaw-kinematic-parameter-generator/kinematic_generator.py +0 -265
- package/skills/16_Animal_Behavior/ethoclaw-multiparameter-clustermap-generate/SKILL.md +0 -72
- package/skills/16_Animal_Behavior/ethoclaw-multiparameter-clustermap-generate/references/config.example.toml +0 -56
- package/skills/16_Animal_Behavior/ethoclaw-multiparameter-clustermap-generate/scripts/cluster_all_params.py +0 -232
- package/skills/16_Animal_Behavior/ethoclaw-multiparameter-clustermap-generate/scripts/cluster_all_params_from_config.py +0 -236
- package/skills/16_Animal_Behavior/ethoclaw-multiparameter-radar-generate/SKILL.md +0 -68
- package/skills/16_Animal_Behavior/ethoclaw-multiparameter-radar-generate/references/notes.md +0 -5
- package/skills/16_Animal_Behavior/ethoclaw-multiparameter-radar-generate/scripts/plot_h5_radar.py +0 -513
- package/skills/16_Animal_Behavior/ethoclaw-multiparameter-violin-stats-generate/SKILL.md +0 -52
- package/skills/16_Animal_Behavior/ethoclaw-multiparameter-violin-stats-generate/config.toml +0 -81
- package/skills/16_Animal_Behavior/ethoclaw-multiparameter-violin-stats-generate/references/stats-rule.md +0 -18
- package/skills/16_Animal_Behavior/ethoclaw-multiparameter-violin-stats-generate/scripts/h5_inspect.py +0 -79
- package/skills/16_Animal_Behavior/ethoclaw-multiparameter-violin-stats-generate/scripts/h5_violin_batch.py +0 -624
- package/skills/16_Animal_Behavior/ethoclaw-multiparameter-violin-stats-generate/scripts/h5_violin_stats.py +0 -438
- package/skills/16_Animal_Behavior/ethoclaw-trajectory-velocity-heatmap-generate/SKILL.md +0 -280
- package/skills/16_Animal_Behavior/ethoclaw-trajectory-velocity-heatmap-generate/core_scripts/heatmap_trajectory.py +0 -790
- package/skills/16_Animal_Behavior/ethoclaw-trajectory-velocity-heatmap-generate/core_scripts/heatmap_velocity.py +0 -855
- package/skills/16_Animal_Behavior/ethoclaw-trajectory-velocity-heatmap-generate/reference_data/reference_2d.csv +0 -101
- package/skills/16_Animal_Behavior/ethoclaw-trajectory-velocity-heatmap-generate/reference_data/reference_2d.h5 +0 -0
- package/skills/16_Animal_Behavior/ethoclaw-trajectory-velocity-heatmap-generate/reference_data/reference_data_readme.md +0 -126
package/skills/09_Cellular_Molecular_Neuroscience/human-protein-atlas-database/scripts/hpa_cli.py
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
# Copyright 2026 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
"""CLI wrapper for the Human Protein Atlas (HPA).
|
|
16
|
+
|
|
17
|
+
Follows HPA Terms of Use by fetching sequentially and handling requests.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
# /// script
|
|
21
|
+
# requires-python = ">=3.10"
|
|
22
|
+
# dependencies = [
|
|
23
|
+
# "polite-http",
|
|
24
|
+
# ]
|
|
25
|
+
# ///
|
|
26
|
+
|
|
27
|
+
import argparse
|
|
28
|
+
import json
|
|
29
|
+
import sys
|
|
30
|
+
import urllib.parse
|
|
31
|
+
import xml.etree.ElementTree as ET
|
|
32
|
+
|
|
33
|
+
from polite_http import http_client
|
|
34
|
+
|
|
35
|
+
BASE_URL = 'https://www.proteinatlas.org/'
|
|
36
|
+
CLIENT = http_client.HttpClient(BASE_URL, qps=2.0)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _fetch_json(params):
|
|
40
|
+
"""Fetches data from the HPA search API."""
|
|
41
|
+
params['format'] = 'json'
|
|
42
|
+
params['compress'] = 'no'
|
|
43
|
+
query_string = urllib.parse.urlencode(params)
|
|
44
|
+
base_api_url = urllib.parse.urljoin(BASE_URL, 'api/search_download.php')
|
|
45
|
+
full_url = f'{base_api_url}?{query_string}'
|
|
46
|
+
content = CLIENT.fetch_bytes(full_url)
|
|
47
|
+
if not content:
|
|
48
|
+
return []
|
|
49
|
+
return json.loads(content.decode('utf-8'))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _fetch_xml(ensembl_id):
|
|
53
|
+
"""Fetches and parses the XML entry for a given Ensembl ID."""
|
|
54
|
+
full_url = urllib.parse.urljoin(BASE_URL, f'{ensembl_id}.xml')
|
|
55
|
+
content = CLIENT.fetch_bytes(full_url)
|
|
56
|
+
return ET.fromstring(content)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def resolve_ensembl_id(gene_symbol, output_file):
|
|
60
|
+
"""Maps a common gene symbol to its Ensembl ID."""
|
|
61
|
+
params = {'search': gene_symbol, 'columns': 'g,eg,gs,gd'}
|
|
62
|
+
data = _fetch_json(params)
|
|
63
|
+
if not data:
|
|
64
|
+
sys.stderr.write(f"Error: Could not find Ensembl ID for '{gene_symbol}'.\n")
|
|
65
|
+
sys.exit(1)
|
|
66
|
+
|
|
67
|
+
# Return the best exact match if possible
|
|
68
|
+
best_match = data[0]
|
|
69
|
+
for d in data:
|
|
70
|
+
if d.get('Gene', '').lower() == gene_symbol.lower():
|
|
71
|
+
best_match = d
|
|
72
|
+
break
|
|
73
|
+
|
|
74
|
+
result = {
|
|
75
|
+
'gene_symbol': best_match.get('Gene'),
|
|
76
|
+
'ensembl_id': best_match.get('Ensembl'),
|
|
77
|
+
'synonyms': best_match.get('Gene synonym'),
|
|
78
|
+
'description': best_match.get('Gene description'),
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
with open(output_file, 'w') as f:
|
|
82
|
+
json.dump(result, f, indent=2)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def get_tissue_expression(ensembl_id, tissues, output_file):
|
|
86
|
+
"""Returns tissue protein expression levels (IHC)."""
|
|
87
|
+
root = _fetch_xml(ensembl_id)
|
|
88
|
+
|
|
89
|
+
# The XML namespace is usually specified, e.g.,
|
|
90
|
+
# xmlns="http://www.proteinatlas.org/search/download/proteinatlas.xsd"
|
|
91
|
+
# But we can search without namespace by using local name or wildcards if
|
|
92
|
+
# needed. We clean the tags by stripping namespaces for easier parsing.
|
|
93
|
+
for elem in root.iter():
|
|
94
|
+
if '}' in elem.tag:
|
|
95
|
+
elem.tag = elem.tag.split('}', 1)[1]
|
|
96
|
+
|
|
97
|
+
expression_data = []
|
|
98
|
+
|
|
99
|
+
# Find <tissueExpression source="HPA" technology="IHC" assayType="tissue">
|
|
100
|
+
for te in root.findall('.//tissueExpression'):
|
|
101
|
+
if te.get('technology') == 'IHC':
|
|
102
|
+
for data_node in te.findall('./data'):
|
|
103
|
+
tissue_node = data_node.find('tissue')
|
|
104
|
+
level_node = data_node.find('level')
|
|
105
|
+
|
|
106
|
+
if tissue_node is not None and level_node is not None:
|
|
107
|
+
tissue_name = tissue_node.text
|
|
108
|
+
level = level_node.text
|
|
109
|
+
expression_data.append({
|
|
110
|
+
'tissue': tissue_name,
|
|
111
|
+
'organ': tissue_node.get('organ'),
|
|
112
|
+
'level': level,
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
if tissues:
|
|
116
|
+
tissue_filter = [t.strip().lower() for t in tissues.split(',')]
|
|
117
|
+
expression_data = [
|
|
118
|
+
d for d in expression_data if d['tissue'].lower() in tissue_filter
|
|
119
|
+
]
|
|
120
|
+
|
|
121
|
+
with open(output_file, 'w') as f:
|
|
122
|
+
json.dump(expression_data, f, indent=2)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def get_subcellular_location(ensembl_id, output_file):
|
|
126
|
+
"""Retrieves subcellular locations for a protein."""
|
|
127
|
+
params = {'search': ensembl_id, 'columns': 'g,eg,scl,scml,scal'}
|
|
128
|
+
data = _fetch_json(params)
|
|
129
|
+
|
|
130
|
+
result = {}
|
|
131
|
+
if data:
|
|
132
|
+
result = {
|
|
133
|
+
'ensembl_id': data[0].get('Ensembl'),
|
|
134
|
+
'gene_symbol': data[0].get('Gene'),
|
|
135
|
+
'subcellular_locations': data[0].get('Subcellular location', []),
|
|
136
|
+
'main_locations': data[0].get('Subcellular main location', []),
|
|
137
|
+
'additional_locations': (
|
|
138
|
+
data[0].get('Subcellular additional location', [])
|
|
139
|
+
),
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
with open(output_file, 'w') as f:
|
|
143
|
+
json.dump(result, f, indent=2)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def get_atlas_entry(ensembl_id, format_type, output_file):
|
|
147
|
+
"""Fetches the full metadata entry."""
|
|
148
|
+
if format_type.lower() == 'json':
|
|
149
|
+
# Let's fetch all relevant columns for the entry
|
|
150
|
+
cols = [
|
|
151
|
+
'g',
|
|
152
|
+
'gs',
|
|
153
|
+
'eg',
|
|
154
|
+
'gd',
|
|
155
|
+
'up',
|
|
156
|
+
'scl',
|
|
157
|
+
'scml',
|
|
158
|
+
'scal',
|
|
159
|
+
'pc',
|
|
160
|
+
'ccdp',
|
|
161
|
+
'ectissue',
|
|
162
|
+
'rnats',
|
|
163
|
+
'rnatd',
|
|
164
|
+
'rnatss',
|
|
165
|
+
]
|
|
166
|
+
params = {'search': ensembl_id, 'columns': ','.join(cols)}
|
|
167
|
+
data = _fetch_json(params)
|
|
168
|
+
entry = data[0] if data else {}
|
|
169
|
+
|
|
170
|
+
# Also fetch the XML to get the verification reliability
|
|
171
|
+
try:
|
|
172
|
+
root = _fetch_xml(ensembl_id)
|
|
173
|
+
for elem in root.iter():
|
|
174
|
+
if '}' in elem.tag:
|
|
175
|
+
elem.tag = elem.tag.split('}', 1)[1]
|
|
176
|
+
|
|
177
|
+
ver = root.find('.//tissueExpression/verification')
|
|
178
|
+
if ver is not None:
|
|
179
|
+
entry['RNA_protein_agreement'] = {
|
|
180
|
+
'reliability': ver.text,
|
|
181
|
+
'description': ver.get('description'),
|
|
182
|
+
}
|
|
183
|
+
except (ET.ParseError, AttributeError, TypeError):
|
|
184
|
+
# If XML fetching or parsing fails, just ignore and return the JSON entry
|
|
185
|
+
pass
|
|
186
|
+
|
|
187
|
+
with open(output_file, 'w') as f:
|
|
188
|
+
json.dump(entry, f, indent=2)
|
|
189
|
+
else:
|
|
190
|
+
sys.stderr.write(
|
|
191
|
+
f"Error: Format '{format_type}' not supported currently. Only JSON is"
|
|
192
|
+
' supported.\n'
|
|
193
|
+
)
|
|
194
|
+
sys.exit(1)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def search_hpa(query, output_file):
|
|
198
|
+
"""Searches HPA based on specific criteria."""
|
|
199
|
+
params = {'search': query, 'columns': 'g,eg,gd,scl,ectissue'}
|
|
200
|
+
data = _fetch_json(params)
|
|
201
|
+
|
|
202
|
+
with open(output_file, 'w') as f:
|
|
203
|
+
json.dump(data, f, indent=2)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def main():
|
|
207
|
+
parser = argparse.ArgumentParser(description='Human Protein Atlas CLI')
|
|
208
|
+
subparsers = parser.add_subparsers(dest='command', required=True)
|
|
209
|
+
|
|
210
|
+
p_resolve = subparsers.add_parser(
|
|
211
|
+
'resolve-ensembl-id', help='Map a standard gene symbol to its Ensembl ID'
|
|
212
|
+
)
|
|
213
|
+
p_resolve.add_argument('gene_symbol', help='Gene symbol (e.g. TP53)')
|
|
214
|
+
p_resolve.add_argument('--output', default='/tmp/hpa_output.json')
|
|
215
|
+
|
|
216
|
+
p_tissue = subparsers.add_parser(
|
|
217
|
+
'get-tissue-expression', help='Get tissue protein levels'
|
|
218
|
+
)
|
|
219
|
+
p_tissue.add_argument('ensembl_id', help='Ensembl Gene ID')
|
|
220
|
+
p_tissue.add_argument(
|
|
221
|
+
'--tissues', help='Comma-separated list of tissue names'
|
|
222
|
+
)
|
|
223
|
+
p_tissue.add_argument('--output', default='/tmp/hpa_output.json')
|
|
224
|
+
|
|
225
|
+
p_subcell = subparsers.add_parser(
|
|
226
|
+
'get-subcellular-location', help='Get subcellular location'
|
|
227
|
+
)
|
|
228
|
+
p_subcell.add_argument('ensembl_id', help='Ensembl Gene ID')
|
|
229
|
+
p_subcell.add_argument('--output', default='/tmp/hpa_output.json')
|
|
230
|
+
|
|
231
|
+
p_entry = subparsers.add_parser(
|
|
232
|
+
'get-atlas-entry', help='Get full HPA metadata entry'
|
|
233
|
+
)
|
|
234
|
+
p_entry.add_argument('ensembl_id', help='Ensembl Gene ID')
|
|
235
|
+
p_entry.add_argument(
|
|
236
|
+
'--format',
|
|
237
|
+
default='json',
|
|
238
|
+
help='Format of the returned entry (e.g., json)',
|
|
239
|
+
)
|
|
240
|
+
p_entry.add_argument('--output', default='/tmp/hpa_output.json')
|
|
241
|
+
|
|
242
|
+
p_search = subparsers.add_parser('search-hpa', help='Search HPA by attribute')
|
|
243
|
+
p_search.add_argument('--query', required=True, help='Search query string')
|
|
244
|
+
p_search.add_argument('--output', default='/tmp/hpa_output.json')
|
|
245
|
+
|
|
246
|
+
args = parser.parse_args()
|
|
247
|
+
|
|
248
|
+
if args.command == 'resolve-ensembl-id':
|
|
249
|
+
resolve_ensembl_id(args.gene_symbol, args.output)
|
|
250
|
+
elif args.command == 'get-tissue-expression':
|
|
251
|
+
get_tissue_expression(args.ensembl_id, args.tissues, args.output)
|
|
252
|
+
elif args.command == 'get-subcellular-location':
|
|
253
|
+
get_subcellular_location(args.ensembl_id, args.output)
|
|
254
|
+
elif args.command == 'get-atlas-entry':
|
|
255
|
+
get_atlas_entry(args.ensembl_id, args.format, args.output)
|
|
256
|
+
elif args.command == 'search-hpa':
|
|
257
|
+
search_hpa(args.query, args.output)
|
|
258
|
+
else:
|
|
259
|
+
parser.print_help()
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
if __name__ == '__main__':
|
|
263
|
+
main()
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pdb-database
|
|
3
|
+
description: >
|
|
4
|
+
Use when you want to search for or download experimentally-determined 3D
|
|
5
|
+
structures for biomolecules (proteins, nucleic acids, bound ligands).
|
|
6
|
+
Supports searching by sequence similarity, structure similarity, chemical
|
|
7
|
+
and other attributes. Also use to get metadata about biomolecular structure
|
|
8
|
+
experiments.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# RCSB Protein Data Bank skill
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
1. **`uv`**: Read the `uv` skill and follow its Setup instructions to ensure
|
|
16
|
+
`uv` is installed and on PATH.
|
|
17
|
+
2. **User Notification**: If .licenses/pdb_database_LICENSE.txt does not
|
|
18
|
+
already exist in the workspace root directory then (1) prominently notify
|
|
19
|
+
the user to check the terms at https://www.rcsb.org/pages/usage-policy, then
|
|
20
|
+
(2) create the file recording the notification text and timestamp.
|
|
21
|
+
|
|
22
|
+
## Core Rules
|
|
23
|
+
|
|
24
|
+
- **Always prefer to use the provided scripts**. Only as a last resort use
|
|
25
|
+
`curl`, `urllib`, raw HTTP requests, or any other method to access PDB APIs.
|
|
26
|
+
The scripts automatically enforce required rate limits.
|
|
27
|
+
- **Always redirect output to a file**. Parse output with e.g. `jq`, `grep`,
|
|
28
|
+
or a short Python snippet. Do NOT print large API responses to stdout to
|
|
29
|
+
avoid truncation.
|
|
30
|
+
- **Notification**: If this skill is used, ensure this is mentioned in the
|
|
31
|
+
output.
|
|
32
|
+
- **Explain your queries** On completing a task that used PDB JSON/GraphQL
|
|
33
|
+
queries, explain in clear language what your query did so the user can
|
|
34
|
+
correct any bad assumptions.
|
|
35
|
+
|
|
36
|
+
## Attribute-based search workflow
|
|
37
|
+
|
|
38
|
+
1. **Fetch the relevant schema** to discover searchable attribute names. For
|
|
39
|
+
structure attributes: `uv run scripts/fetch_schema.py --api search_structure
|
|
40
|
+
--output schema_structure.txt` For chemical attributes: `uv run
|
|
41
|
+
scripts/fetch_schema.py --api search_chemical --output schema_chemical.txt`
|
|
42
|
+
|
|
43
|
+
2. **Grep the schema** to find relevant attributes. Grep one keyword at a time
|
|
44
|
+
and examine many lines — there are lots of similar attributes and you must
|
|
45
|
+
choose the **best match** for the user's intent.
|
|
46
|
+
|
|
47
|
+
3. **Compose and run a JSON search query** using the discovered attributes: `uv
|
|
48
|
+
run scripts/search_pdb.py --query '<JSON>' --return_type <RETURN_TYPE>
|
|
49
|
+
--output results.json` Pass the `--count_only` flag to get just the number
|
|
50
|
+
of matching entries.
|
|
51
|
+
|
|
52
|
+
### For step 2: some basic PDB concepts (helpful for attribute choice)
|
|
53
|
+
|
|
54
|
+
- **Entity**: A unique molecule found in a structure.
|
|
55
|
+
- **Instance / Chain**: A particular copy of an entity. E.g. if a structure
|
|
56
|
+
contains two protein chains with the same sequence, they are the same entity
|
|
57
|
+
but different instances / chains.
|
|
58
|
+
- **Assembly**: A biologically relevant collection of instances / chains. This
|
|
59
|
+
may be the same as the deposited structure, a subset, or multiple copies.
|
|
60
|
+
- **Label vs Auth**: Polymer instances get letter labels ("A", "B", "AA") and
|
|
61
|
+
their monomers are numbered. There are author-assigned ("auth") and
|
|
62
|
+
PDB-internal ("label") schemes. The label scheme is more consistent and is
|
|
63
|
+
always used in scripts and APIs. However, users and papers may refer to the
|
|
64
|
+
author scheme (clarify which scheme is being used if necessary).
|
|
65
|
+
- **Chemical component**: A small molecule / monomer, with an ID matching
|
|
66
|
+
`[A-Z]{1,3}`
|
|
67
|
+
- **Primary citation**: The main publication about a structure. Prefer
|
|
68
|
+
`primary_citation` attributes over `citation` attributes.
|
|
69
|
+
- **Resolution**: Frequently used measure of structure quality (lower is
|
|
70
|
+
better). Usually prefer `rcsb_entry_info.resolution_combined`, which
|
|
71
|
+
accounts for different experimental methods.
|
|
72
|
+
|
|
73
|
+
### For step 3: Example queries
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Non-human proteins published in Nature, newest first
|
|
77
|
+
uv run scripts/search_pdb.py --query '{ "type": "group", "logical_operator": "and", "nodes": [ { "type": "terminal", "service": "text", "parameters": { "operator": "exact_match", "negation": true, "value": "Homo sapiens", "attribute": "rcsb_entity_source_organism.taxonomy_lineage.name" } }, { "type": "terminal", "service": "text", "parameters": { "operator": "exact_match", "value": "Nature", "attribute": "rcsb_primary_citation.rcsb_journal_abbrev" } } ] }' --return_type entry --sort_by rcsb_accession_info.initial_release_date --sort_direction desc --page_start 0 --rows 100 --output results.json
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Structures containing the chemical component CA (Ca2+ ion)
|
|
82
|
+
uv run scripts/search_pdb.py --query '{ "type": "terminal", "service": "text_chem", "parameters": { "operator": "exact_match", "value": "CA", "attribute": "rcsb_chem_comp_container_identifiers.comp_id" } }' --return_type entry --output results.json
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Number of entries with disulfide bonds
|
|
87
|
+
uv run scripts/search_pdb.py --query '{ "type": "terminal", "service": "text", "parameters": { "operator": "exact_match", "value": "disulfide bridge", "attribute": "rcsb_polymer_struct_conn.connect_type" } }' --return_type entry --count-only --output count.json
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Common operators: `exact_match`, `equals`, `exists`, `contains_phrase`,
|
|
91
|
+
`contains_words`, `in`, `greater`, `less`
|
|
92
|
+
|
|
93
|
+
## Similarity-based search workflow
|
|
94
|
+
|
|
95
|
+
Similarity searches do not require a schema fetch. Basic examples:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Sequence similarity
|
|
99
|
+
uv run scripts/search_pdb.py --query '{ "query": { "type": "terminal", "service": "sequence", "parameters": { "evalue_cutoff": 1, "identity_cutoff": 0.9, "sequence_type": "protein", "value": "MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQ" } }, "request_options": { "scoring_strategy": "sequence" } }' --return_type polymer_entity --output results.json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Structure similarity
|
|
104
|
+
uv run scripts/search_pdb.py --query '{ "type": "terminal", "service": "structure", "parameters": { "value": {"entry_id": "6LU7", "asym_id": "A"}, "number_of_candidates": 2000 } }' --return_type polymer_entity --output results.json
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Sequence motif match
|
|
109
|
+
uv run scripts/search_pdb.py --query '{ "type": "terminal", "service": "seqmotif", "parameters": { "value": "C-x(2,4)-C-x(3)-[LIVMFYWC]-x(8)-H-x(3,5)-H.", "pattern_type": "prosite", "sequence_type": "protein" } }' --return_type polymer_entity --output results.json
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Chemical descriptor match
|
|
114
|
+
uv run scripts/search_pdb.py --query '{ "type": "terminal", "service": "chemical", "parameters": { "value": "InChI=1S/C8H9NO2/c1-6(10)9-7-2-4-8(11)5-3-7/h2-5,11H,1H3,(H,9,10)", "type": "descriptor", "descriptor_type": "InChI", "match_type": "graph-strict" } }' --return_type mol_definition --output results.json
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
See https://search.rcsb.org/#search-services for more details.
|
|
118
|
+
|
|
119
|
+
## Full text search workflow
|
|
120
|
+
|
|
121
|
+
Searches **all** text associated with an entry. Example:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
uv run scripts/search_pdb.py --query '{ "type": "terminal", "service": "full_text", "parameters": { "value": "isopeptide + ( collagen | fibrinogen )" } }' --return_type entry --output results.json
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
> **Important**: use `full_text` search as a **last resort** when there's no
|
|
128
|
+
> more precise attribute search available. Consider using the `struct.title` or
|
|
129
|
+
> `rcsb_pubmed_abstract_text` attributes instead.
|
|
130
|
+
|
|
131
|
+
## File download workflow
|
|
132
|
+
|
|
133
|
+
To download full PDB entries, use the `download_coordinate_files.py` script. Use
|
|
134
|
+
this when you need access to atomic coordinates, when asked for a pdb / mmcif
|
|
135
|
+
file, or when non-specifically asked to fetch a PDB code. Example:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
uv run scripts/download_coordinate_files.py --ids "4HHB,6BEA" --format "mmcif" --output_dir <OUTPUT_DIR>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Metadata query workflow
|
|
142
|
+
|
|
143
|
+
This flow is significantly more efficient than downloading full coordinate files
|
|
144
|
+
when you only need a few pieces of metadata about each entry / entity.
|
|
145
|
+
|
|
146
|
+
1. **Fetch the schema** for the relevant object type. E.g. `uv run
|
|
147
|
+
scripts/fetch_schema.py --api data_entry --output schema_entry.txt`
|
|
148
|
+
|
|
149
|
+
2. **Grep the schema** for relevant fields (one keyword at a time, many lines).
|
|
150
|
+
|
|
151
|
+
3. **Compose and run a GraphQL metadata query**: `uv run
|
|
152
|
+
scripts/fetch_pdb_metadata.py --query '<GraphQL>' --output results.json`
|
|
153
|
+
|
|
154
|
+
### For step 3: Example queries
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# Fetch structure titles and experimental methods
|
|
158
|
+
uv run scripts/fetch_pdb_metadata.py --query '{ entries(entry_ids: ["1STP", "2JEF", "1CDG"]) { rcsb_id struct { title } exptl { method } } }' --output results.json
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Fetch polymer entity taxonomy and cluster membership
|
|
163
|
+
uv run scripts/fetch_pdb_metadata.py --query '{ polymer_entities(entity_ids:["2CPK_1","3WHM_1","2D5Z_1"]) { rcsb_id rcsb_entity_source_organism { ncbi_taxonomy_id ncbi_scientific_name } rcsb_cluster_membership { cluster_id identity } } }' --output results.json
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# Fetch polymer entity external sequence database accessions
|
|
168
|
+
uv run scripts/fetch_pdb_metadata.py --query '{ entries(entry_ids:["7NHM", "5L2G"]){ polymer_entities { rcsb_id rcsb_polymer_entity_container_identifiers { reference_sequence_identifiers { database_accession database_name } } } } }' --output results.json
|
|
169
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@ARTICLE{Berman2000,
|
|
2
|
+
ABSTRACT = {The Protein Data Bank (PDB; http://www.rcsb.org/pdb/ ) is the single worldwide archive of structural data of biological macromolecules. This paper describes the goals of the PDB, the systems in place for data deposition and access, how to obtain further information, and near-term plans for the future development of the resource.},
|
|
3
|
+
AUTHOR = {Berman, Helen M. and Westbrook, John and Feng, Zukang and Gilliland, Gary and Bhat, T. N. and Weissig, Helge and Shindyalov, Ilya N. and Bourne, Philip E.},
|
|
4
|
+
URL = {https://doi.org/10.1093/nar/28.1.235},
|
|
5
|
+
DATE = {2000-01},
|
|
6
|
+
DOI = {10.1093/nar/28.1.235},
|
|
7
|
+
EPRINT = {https://academic.oup.com/nar/article-pdf/28/1/235/9895144/280235.pdf},
|
|
8
|
+
ISSN = {0305-1048},
|
|
9
|
+
JOURNALTITLE = {Nucleic Acids Research},
|
|
10
|
+
NUMBER = {1},
|
|
11
|
+
PAGES = {235--242},
|
|
12
|
+
TITLE = {The Protein Data Bank},
|
|
13
|
+
VOLUME = {28},
|
|
14
|
+
}
|
|
15
|
+
|
package/skills/09_Cellular_Molecular_Neuroscience/pdb-database/scripts/download_coordinate_files.py
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Copyright 2026 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
"""Downloads PDB coordinate files (mmCIF or PDB) from RCSB."""
|
|
16
|
+
|
|
17
|
+
# /// script
|
|
18
|
+
# requires-python = ">=3.10"
|
|
19
|
+
# dependencies = [
|
|
20
|
+
# "polite-http",
|
|
21
|
+
# ]
|
|
22
|
+
# ///
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
import argparse
|
|
26
|
+
import os
|
|
27
|
+
import sys
|
|
28
|
+
|
|
29
|
+
from polite_http import http_client
|
|
30
|
+
|
|
31
|
+
CLIENT = http_client.HttpClient("https://files-beta.rcsb.org", qps=5.0)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def sanitize_id(pdb_id: str) -> str:
|
|
35
|
+
"""Sanitize PDB ID."""
|
|
36
|
+
pdb_id = pdb_id.lower().strip()
|
|
37
|
+
if len(pdb_id) == 4:
|
|
38
|
+
return f"pdb_0000{pdb_id}"
|
|
39
|
+
return pdb_id
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def download_files(args: argparse.Namespace):
|
|
43
|
+
"""Downloads coordinate files."""
|
|
44
|
+
ids = [id.strip() for id in args.ids.split(",") if id.strip()]
|
|
45
|
+
|
|
46
|
+
if len(ids) > 1_000:
|
|
47
|
+
print(
|
|
48
|
+
"Aborting: this script is not recommended for bulk downloads."
|
|
49
|
+
"**Check with the user**, then consider downloading a copy of all"
|
|
50
|
+
f" {args.format} files using the recommended bulk script at "
|
|
51
|
+
"https://cdn.rcsb.org/wwpdb/docs/BetaArchiveBatchDownloader.py.",
|
|
52
|
+
file=sys.stderr,
|
|
53
|
+
)
|
|
54
|
+
return
|
|
55
|
+
|
|
56
|
+
# RCSB bulk download script suggests a higher QPS may be acceptable here (~5).
|
|
57
|
+
estimated_time_secs = len(ids) / 5.0
|
|
58
|
+
print(f"Estimated download time: {estimated_time_secs / 60:.1f} minutes).")
|
|
59
|
+
|
|
60
|
+
if not os.path.exists(args.output_dir):
|
|
61
|
+
os.makedirs(args.output_dir, exist_ok=True)
|
|
62
|
+
|
|
63
|
+
for pdb_id in ids:
|
|
64
|
+
sanitized_id = sanitize_id(pdb_id)
|
|
65
|
+
shard_chars = sanitized_id[-3:-1]
|
|
66
|
+
ext = "cif" if args.format == "mmcif" else "pdb"
|
|
67
|
+
|
|
68
|
+
url = (
|
|
69
|
+
f"/pub/wwpdb/pdb/data/entries/{shard_chars}/{sanitized_id}/"
|
|
70
|
+
f"structures/{sanitized_id}.{ext}.gz"
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
output_path = os.path.join(args.output_dir, f"{sanitized_id}.{ext}.gz")
|
|
74
|
+
|
|
75
|
+
print(f"Downloading {sanitized_id} from {url}...", file=sys.stderr)
|
|
76
|
+
|
|
77
|
+
try:
|
|
78
|
+
content = CLIENT.fetch_bytes(url)
|
|
79
|
+
with open(output_path, "wb") as f:
|
|
80
|
+
f.write(content)
|
|
81
|
+
print(f"Saved to {output_path}", file=sys.stderr)
|
|
82
|
+
except Exception as e:
|
|
83
|
+
print(f"Failed to download {pdb_id}: {e}", file=sys.stderr)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def parse_args() -> argparse.Namespace:
|
|
87
|
+
"""Parse command line arguments."""
|
|
88
|
+
parser = argparse.ArgumentParser(description="Download PDB coordinate files")
|
|
89
|
+
parser.add_argument(
|
|
90
|
+
"--format",
|
|
91
|
+
type=str,
|
|
92
|
+
required=True,
|
|
93
|
+
choices=["mmcif", "pdb"],
|
|
94
|
+
help="File format to download (mmcif or pdb)",
|
|
95
|
+
)
|
|
96
|
+
parser.add_argument(
|
|
97
|
+
"--ids",
|
|
98
|
+
type=str,
|
|
99
|
+
required=True,
|
|
100
|
+
help="Comma-separated list of PDB IDs",
|
|
101
|
+
)
|
|
102
|
+
parser.add_argument(
|
|
103
|
+
"--output_dir",
|
|
104
|
+
type=str,
|
|
105
|
+
required=True,
|
|
106
|
+
help="Directory to save files to",
|
|
107
|
+
)
|
|
108
|
+
return parser.parse_args()
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
if __name__ == "__main__":
|
|
112
|
+
main_args = parse_args()
|
|
113
|
+
download_files(main_args)
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Copyright 2026 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
"""Gets PDB data using the RCSB Data API (GraphQL)."""
|
|
16
|
+
|
|
17
|
+
# /// script
|
|
18
|
+
# requires-python = ">=3.10"
|
|
19
|
+
# dependencies = [
|
|
20
|
+
# "polite-http",
|
|
21
|
+
# ]
|
|
22
|
+
# ///
|
|
23
|
+
|
|
24
|
+
import argparse
|
|
25
|
+
import sys
|
|
26
|
+
import urllib.parse
|
|
27
|
+
|
|
28
|
+
from polite_http import http_client
|
|
29
|
+
|
|
30
|
+
CLIENT = http_client.HttpClient("https://data.rcsb.org", qps=2.0)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def get_pdb_metadata(args: argparse.Namespace):
|
|
34
|
+
"""Executes a GraphQL query against the PDB Data API.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
args: parsed command line arguments containing the query.
|
|
38
|
+
"""
|
|
39
|
+
encoded_query = urllib.parse.quote(args.query.strip())
|
|
40
|
+
url = f"https://data.rcsb.org/graphql?query={encoded_query}"
|
|
41
|
+
print(f"Querying PDB Data API from {url}...", file=sys.stderr)
|
|
42
|
+
|
|
43
|
+
content = CLIENT.fetch_bytes(url)
|
|
44
|
+
with open(args.output, "w") as f:
|
|
45
|
+
f.write(content.decode("utf-8"))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def parse_args() -> argparse.Namespace:
|
|
49
|
+
"""Parse command line arguments."""
|
|
50
|
+
parser = argparse.ArgumentParser(
|
|
51
|
+
description="Get PDB data using the RCSB Data API (GraphQL)"
|
|
52
|
+
)
|
|
53
|
+
parser.add_argument(
|
|
54
|
+
"--query",
|
|
55
|
+
type=str,
|
|
56
|
+
required=True,
|
|
57
|
+
help="GraphQL query string",
|
|
58
|
+
)
|
|
59
|
+
parser.add_argument(
|
|
60
|
+
"--output",
|
|
61
|
+
type=str,
|
|
62
|
+
required=True,
|
|
63
|
+
help="File to write the output to",
|
|
64
|
+
)
|
|
65
|
+
return parser.parse_args()
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
if __name__ == "__main__":
|
|
69
|
+
main_args = parse_args()
|
|
70
|
+
get_pdb_metadata(main_args)
|