xfetch
Local-archive fetch helper built on xcommon.sh plus rchive. It takes UIDs from -id, -input, stdin, or an ENTREZ_DIRECT message, then fetches matching records from a configured local archive/postings installation rather than from the live NCBI service.
Quick Start
- Command:
xfetch -db <database> -id <uid> - Local executable:
/home/vimalinx/miniforge3/envs/bio/bin/xfetch - Critical environment:
EDIRECT_LOCAL_ARCHIVE
When To Use This Tool
- Fetching records from a prepared local PubMed/PMC/etc. archive instead of the live E-utilities endpoint
- Streaming or turbo-fetching locally archived XML by UID
- Consuming UIDs from stdin or an upstream
ENTREZ_DIRECTmessage and retrieving the matching local records - Working inside a local/offline EDirect archive workflow
Common Patterns
# Fetch one UID from a local archive
export EDIRECT_LOCAL_ARCHIVE=/path/to/local/archive
xfetch -db pubmed -id 2539356
# Read UIDs from stdin
printf '2539356\n' | xfetch -db pubmed
# Use stream mode against the local archive
export EDIRECT_LOCAL_ARCHIVE=/path/to/local/archive
xfetch -db pubmed -stream -input ids.txt
Recommended Workflow
- Point
EDIRECT_LOCAL_ARCHIVEat a valid local archive root. - Supply
-dbplus a UID source (-id,-input, or stdin). - Use plain fetch mode for wrapped XML output or
-streamwhen you want streamed archive content. - If the command prints wrapper XML but no records, debug the local archive/postings configuration before blaming UID parsing.
Guardrails
xfetchis a local-cache tool, not a remoteefetchsynonym.-h/--helpare safe and show usage;-versionworks and prints24.0, but--versionis unrecognized.- In local testing without a configured archive,
xfetch -db pubmed -id 2539356still printed the PubMed XML wrapper prologue/epilogue and then failed withInsufficient command-line arguments supplied to rchive. - The script sources
xcommon.sh, loads database-specific wrappers fromxfetch.ini, and then delegates torchive -fetchorrchive -stream. - If
EDIRECT_LOCAL_ARCHIVEis missing, the shared helper prints the missing-path error first.