Debian Codegraph @

help/xtract-help.txt

raw
1 Overview
2
3 Xtract uses command-line arguments to convert XML data into a tab-delimited table.
4
5 -pattern places the data from individual records into separate rows.
6
7 -element extracts values from specified fields into separate columns.
8
9 -group, -block, and -subset limit element exploration to selected XML subregions.
10
11 Processing Flags
12
13 -strict Remove HTML and MathML tags
14 -mixed Allow mixed content XML
15
16 -self Allow detection of empty self-closing tags
17
18 -accent Excise Unicode accents and diacritical marks
19 -ascii Unicode to numeric HTML character entities
20 -compress Compress runs of spaces
21
22 -stops Retain stop words in selected phrases
23
24 Data Source
25
26 -input Read XML from file instead of stdin
27 -transform File of substitutions for -translate
28 -aliases Mappings file for -classify operation
29
30 Exploration Argument Hierarchy
31
32 -pattern Name of record within set
33 -group Use of different argument
34 -block names allows command-line
35 -subset control of nested looping
36
37 Path Navigation
38
39 -path Explore by list of adjacent object names
40
41 Exploration Constructs
42
43 Object DateRevised
44 Parent/Child Book/AuthorList
45 Path MedlineCitation/Article/Journal/JournalIssue/PubDate
46 Heterogeneous "PubmedArticleSet/*"
47 Exhaustive "History/**"
48 Nested "*/Taxon"
49 Recursive "**/Gene-commentary"
50 Current "*"
51
52 Conditional Execution
53
54 -if Element [@attribute] required
55 -unless Skip if element matches
56 -and All tests must pass
57 -or Any passing test suffices
58 -else Execute if conditional test failed
59 -position [first|last|outer|inner|even|odd|all]
60
61 String Constraints
62
63 -equals String must match exactly
64 -contains Substring must be present
65 -mimics Containment test after converting punctuation to space
66 -excludes Substring must be absent
67 -includes Substring must match at word boundaries
68 -is-within String must be present
69 -starts-with Substring must be at beginning
70 -ends-with Substring must be at end
71 -is-not String must not match
72 -is-before First string < second string
73 -is-after First string > second string
74 -consists-of String must only contain specified characters
75 -matches Matches without commas, semicolons, or accents
76 -resembles Requires all words, but in any order
77
78 Object Constraints
79
80 -is-equal-to Object values must match
81 -differs-from Object values must differ
82
83 Numeric Constraints
84
85 -gt Greater than
86 -ge Greater than or equal to
87 -lt Less than
88 -le Less than or equal to
89 -eq Equal to
90 -ne Not equal to
91
92 Format Customization
93
94 -ret Override line break between patterns
95 -tab Replace tab character between fields
96 -sep Separator between group members
97 -pfx Prefix to print before group
98 -sfx Suffix to print after group
99 -rst Reset -sep through -elg
100 -clr Clear queued tab separator
101 -pfc Preface combines -clr and -pfx
102 -deq Delete and replace queued tab separator
103 -def Default placeholder for missing fields
104 -lbl Insert arbitrary text
105
106 XML Generation
107
108 -set XML tag for entire set
109 -rec XML tag for each record
110
111 -wrp Wrap elements in XML object
112
113 -enc Encase instance in XML object
114 -plg Prologue to print before instance
115 -elg Epilogue to print after instance
116
117 -pkg Package subset in XML object
118 -fwd Foreword to print before subset
119 -awd Afterword to print after subset
120
121 Tag and Attribute Construction
122
123 -tag Start with "<" + object name
124 -att Attribute key and literal string
125 -atr Attribute key and element name
126 -cls Close with ">"
127 -slf Self-close with " />"
128 -end End contents with "</" + object name + ">"
129
130 FASTA Parsable Fields
131
132 -bkt Wrap elements in bracketed fields
133
134 Element Selection
135
136 -element Print all items that match tag name
137 -first Only print value of first item
138 -last Only print value of last item
139 -even Only print value of even items
140 -odd Only print value of odd items
141 -backward Print values in reverse order
142
143 Variable Recording
144
145 -NAME Record value in named variable
146 --STATS Accumulate values into variable
147
148 -element Constructs
149
150 Tag Caption
151 Group Initials,LastName
152 Parent/Child MedlineCitation/PMID
153 Unrestricted "PubDate/*"
154 Attribute DescriptorName@MajorTopicYN
155 Range MedlineDate[1:4]
156 Substring "Title[phospholipase | rattlesnake]"
157 Alternative "Construct[can contain ^ vertical bar]"
158 Object Count "#Author"
159 Item Length "%Title"
160 Element Depth "^PMID"
161 Variable "&NAME"
162
163 Special -element Operations
164
165 Parent Index "+"
166 Object Name "?"
167 Object Value "~"
168 XML Subtree "*"
169 Children "$"
170 Attributes "@"
171 ASN.1 Record "."
172 JSON Record "%"
173
174 Numeric (Integer) Processing
175
176 -num Count
177 -len Length
178 -sum Sum
179 -acc Accumulator
180 -min Minimum
181 -max Maximum
182 -inc Increment
183 -dec Decrement
184 -sub Difference
185 -avg Arithmetic Mean
186 -dev Deviation
187 -med Median
188 -mul Product
189 -div Quotient
190 -mod Remainder
191 -geo Geometric Mean
192 -hrm Harmonic Mean
193 -rms Root Mean Square
194 -sqt Square Root
195 -lge Natural Logarithm
196 -lg2 Logarithm Base 2
197 -log Logarithm Base 10
198 -bin Binary
199 -oct Octal
200 -hex Hexadecimal
201 -bit Number of Bits Set
202
203 Leading Zero Padding
204
205 -pad 0-Pad to 8 digits
206
207 Character Processing
208
209 -encode XML-encode <, >, &, ", and ' characters
210 -decode Base64-decode object embedded in XML
211 -upper Convert text to upper-case
212 -lower Convert text to lower-case
213 -chain Change_spaces_to_underscores
214 -title Capitalize initial letters of words
215 -mirror Reverse order of letters
216 -alpha Non-alphabetic characters to space
217 -alnum Non-alphanumeric characters to space
218
219 String Processing
220
221 -basic Convert superscripts and subscripts
222 -plain Remove embedded mixed-content markup tags
223 -simple Normalize accented letters, spell Greek letters
224 -author Multi-step author cleanup
225 -journal Journal capitalization and punctuation cleanup
226 -prose Text conversion to ASCII
227
228 Text Processing
229
230 -terms Partition text at spaces
231 -words Split at punctuation marks
232 -pairs Adjacent informative words
233 -split Split using -with for delimiter
234 -order Rearrange words in sorted order
235 -reverse Reverse words in string
236 -letters Separate individual letters
237 -clauses Break at phrase separators
238 -pentamers Sliding window of pentamers
239
240 Citation Functions
241
242 -year Extract first 4-digit year from string
243 -month Match first month name, return as integer
244 -date YYYY/MM/DD from -unit "PubDate" -date "*"
245 -page Get digits (and letters) of first page number
246 -auth Changed GenBank authors to Medline form
247 -initials Parse initials from forename or given name
248
249 Miscellaneous Functions
250
251 -trim Remove extra spaces and leading zeros
252 -wct Count number of -words in a string
253 -doi Add https://doi.org/ prefix, URL encode
254 -accession Allow indexing of full accession.version
255 -numeric Only accept items that are entirely digits
256
257 Value Transformation
258
259 -translate Substitute values with -transform table
260 -classify Substring word or phrase matches to -aliases table
261
262 Regular Expression
263
264 -replace Substitute text using regular expressions
265
266 -reg Target expression
267 -exp Replacement pattern
268
269 Sequence Processing
270
271 -fasta Split sequence into blocks of 70 uppercase letters
272
273 Nucleotide Processing
274
275 -revcomp Reverse complement nucleotide sequence
276 -nucleic Subrange determines forward or revcomp
277 -ncbi2na Expand ncbi2na to iupac
278 -ncbi4na Expand ncbi4na to iupac
279 (May need to truncate result to actual sequence length)
280 -cds2prot Translate coding region using -gcode and (1-based) -frame
281
282 Protein Processing
283
284 -molwt Calculate molecular weight of peptide
285 -molwt-m Molecular weight retaining initial methionine
286 -molwt-f Keep initial M residue as formyl-methionine
287
288 -pept Split amino acid runs at *, -, x, or X
289
290 Sequence Coordinates
291
292 -0-based Zero-Based
293 -1-based One-Based
294 -ucsc-based Half-Open
295
296 Command Generator
297
298 -insd Generate INSDSeq extraction commands
299 -insdx Process -insd output table into XML
300
301 -insd Argument Order
302
303 Descriptors INSDSeq_sequence INSDSeq_definition INSDSeq_division
304 Flags [complete|partial]
305 Feature(s) CDS,mRNA
306 Qualifiers INSDFeature_key "#INSDInterval" gene product feat_location sub_sequence
307
308 Variation Processing
309
310 -hgvs Convert sequence variation format to XML
311
312 Frequency Table
313
314 -histogram Collects data for sort-uniq-count on entire set of records
315
316 Entrez Indexing
317
318 -indexer Positional index using -wrp for field name
319
320 Output Organization
321
322 -head Print before everything else
323 -tail Print after everything else
324 -hd Print before each record
325 -tl Print after each record
326
327 Record Selection
328
329 -select Select record subset by conditions
330 -in File of identifiers to use for selection
331
332 Record Rearrangement
333
334 -sort Element to use as sort key
335 -sort-fwd Alias of original -sort
336 -sort-rev Sort records in reverse order
337
338 Reformatting
339
340 -format [copy|compact|flush|indent|expand]
341
342 Validation
343
344 -verify Report XML data integrity problems
345
346 -test Check field for visible combining accent and invisible Unicode
347
348 Summary
349
350 -outline Display outline of XML structure
351 -synopsis Display individual XML paths
352 -contour Display XML paths to leaf nodes
353 [delimiter]
354
355 Full Exploration Command Precedence
356
357 -pattern
358 -path
359 -division
360 -group
361 -branch
362 -block
363 -section
364 -subset
365 -unit
366 -element
367
368 Documentation
369
370 -help Print this document
371 -examples Examples of EDirect and xtract usage
372 -unix Common Unix command arguments
373 -version Print version number
374
375 Notes
376
377 String constraints use case-insensitive comparisons.
378
379 Numeric constraints and selection arguments use integer values.
380
381 -num and -len selections are synonyms for Object Count (#) and Item Length (%).
382
383 -words, -pairs, -reverse, and -indexer convert to lower case.
384
385 See transmute -help for data conversion and modification functions.
386
387 Xtract Examples
388
389 -pattern DocumentSummary -element Id -first Name Title
390
391 -pattern "PubmedArticleSet/*" -block Author -sep " " -element Initials,LastName
392
393 -pattern PubmedArticle -block MeshHeading -if "@MajorTopicYN" -equals Y -sep " / " -element DescriptorName,QualifierName
394
395 -pattern GenomicInfoType -element ChrAccVer ChrStart ChrStop
396
397 -pattern Taxon -block "*/Taxon" -unless Rank -equals "no rank" -tab "\n" -element Rank,ScientificName
398
399 -pattern Entrezgene -block "**/Gene-commentary"
400
401 -block INSDReference -position 2
402
403 -subset INSDInterval -position last -POS INSDInterval_to -element "&SEQ[&POS+1:]"
404
405 -if Author -and Title
406
407 -if "#Author" -lt 6 -and "%Title" -le 70
408
409 -if DateRevised/Year -gt 2005
410
411 -if ChrStop -lt ChrStart
412
413 -if CommonName -contains mouse
414
415 -if "&ABST" -starts-with "Transposable elements"
416
417 -if MapLocation -element MapLocation -else -lbl "\-"
418
419 -if inserted_sequence -differs-from deleted_sequence
420
421 -min ChrStart,ChrStop
422
423 -max ExonCount
424
425 -inc position -element inserted_sequence
426
427 -1-based ChrStart
428
429 -tag Item -att type journal -cls -encode Source -end Item
430
431 -tag Item -att type journal -atr name Source -slf
432
433 -insd CDS gene product protein_id translation
434
435 -insd complete mat_peptide "%peptide" product peptide
436
437 -insd CDS INSDInterval_iscomp@value INSDInterval_from INSDInterval_to
438
439 -insd source organism taxid -insd CDS gene product feat_intervals sub_sequence
440
441 -pattern PubmedArticle -select PubDate/Year -eq 2015
442
443 -pattern PubmedArticle -select MedlineCitation/PMID -in file_of_pmids.txt
444
445 -wrp PubmedArticleSet -pattern PubmedArticle -sort MedlineCitation/PMID
446
447 -set PubmedArticleSet -pattern PubmedArticle -split 1000 -prefix "subset" -suffix "xml"
448
449 -set PubmedArticleSet -pattern PubmedArticle -allot 500000 -prefix "subset" -suffix "xml"
450
451 -pattern PubmedBookArticle -path BookDocument.Book.AuthorList.Author -element LastName
452
453 -pattern PubmedArticle -group MedlineCitation/Article/Journal/JournalIssue/PubDate -year "PubDate/*"
454
455 -mixed -verify -find MedlineCitation/PMID -html -max 50
456
457 Transmute Examples
458
459 transmute -j2x -set - -rec GeneRec
460
461 transmute -t2x -set Set -rec Rec -skip 1 Code Name
462
463 transmute -filter ExpXml decode content
464
465 transmute -filter LocationHist remove object
466
467 transmute -normalize pubmed
468
469 transmute -head "<PubmedArticleSet>" -tail "</PubmedArticleSet>" -pattern "PubmedArticleSet/*" -format