@Max_IT and @user3479780 Thanks for bringing this issue to our attention. It has been fixed in EDirect 19.5, which is now available on our public ftp site (See installation instructions here). Please update your installation and try again.
The problem was that using capitalized -db "SRA"
bypassed normalization of the record. This was easily solved within EDirect by lower-casing the -db
argument value to make it case-insensitive.
Normalization unescapes the XML-encoded ExpXml and Runs field contents to integrate them as regular XML within the docsum in situ, before passing them to the user. Thus:
efetch -db SRA -format docsum -id SRA030738,SRA030736 |
xtract -pattern DocumentSummary -element Run@acc
will now work properly, without the need for chaining two xtract
commands together.
When creating structured records, NCBI internal software enforces conformation to the ASN.1 specification or XML document type definition. This is normally beneficial, blocking syntactically invalid records (and preventing new software bugs from silently corrupting production pipelines), but it limits the ability to add experimental structured data that is not (yet) in the spec.
Since xtract
does not use a spec or DTD, it can find any element within the newly-unescaped contents by object name. (It still checks for properly-balanced opening and closing tags.)
Note also that you can skip the esearch
step if you know the identifiers, and can instead pass them directly to efetch
in an -id
argument. For larger sets of identifiers, you can now pipe them from a file, one ID per line, without the need for an epost
step.
EDirect has logic to split large lists into smaller chunks, sized appropriately for each database, and will internally loop through the fetch requests until all of the IDs have been processed, automatically retrying in the event of transient network or server failure.
SRA
is an unusual prefix for an accession within SRA; I'm used toSRR
(for runs),SRX
(for experiements),SRS
(for samples), andSRP
(for projects). Can you please provide a link to the paper, or an alternative example? $\endgroup$