User Tools

Site Tools


jvs:fscan:manual:chapter2:table

fScan Reference Manual, Chapter 2 (CmdLineOptions): table

Table -- Manipulate data tables

usage:

The TABLE command is used for loading, querying, and displaying tables. Tables are multi-column data sets where each column can contain either text strings or number values. Tables can be loaded from text files, or by extracting information from different internal data lists (e.g. data set names, window names, reference time course condition names, glossary names). When loading tables, the type of data source can be identified explicitly using the first argument (e.g. file, reference, glossary, dataset, window) or implicitly using the FILENAME/REFNAME/GLOSSARYNAME argument (if the argument is unrecognized, “file” is assumed).

Loading table from file

With FILENAME and no “show” modifier, this loads table data from file FILENAME to table TABLENAME.

Loading table from a directory

FLAG (combine by adding):

  • 1 - include regular files (text and data)
  • 2 - include directory names
  • 4 - include filetype
  • 8 - sort the table
  • 16 - append new data to existing table

DIRNAME: starting path for directory search (default= current dir)
MATCHSTRING: template string for file name matching Glob-like (* and ?) substitutions (default= *)
TBL2NAME: if present, assumes first column is list of directories; each is appended to DIRNAME and then used as the starting point for a dir search of MATCHSTRING

Loading table from internal data lists

Data set names

The table will contain a list of data sets currently available.

Window names

The table will contain a list of windows currently open.

Reference

The table will contain a list of condition labels for the specified reference time course.

Glossary

The table will contain a list of ROI labels for the specified glossary.

Displaying table data

The “show” modifier is used to display table data.
Show is the default if FILENAME is missing.
Show with no TABLENAME prints a list of all tables in memory.
Show with TABLENAME prints the specified table.
If FILENAME is specified, Show prints the table to file FILENAME.
The FLAG argument can specify some printing options.

Show FLAG (combine by adding):

  • 1 - show column names
  • 2 - show column types
  • 4 - show row numbers
  • 010 - show table title
  • 020 - comma separated columns
  • 040 - tab separated columns
  • 0100 - only show up to 10 rows of data
  • 0200 - replace missing values with '0'
  • 0400 - show no data, only header
  • 01000 - show row sorting index if available

Configuring a table

The CONFIGURE option can be used to re-configure an existing table (or create a new empty table). It is intended for adding column names, adding whole columns, moving existing columns, or removing columns. Columns to be modified are specified as triplets of “name type colnum” (of these only the name is required). Multiple column specifications can be combined in a single command.

If column NAME exists it is modified to TYPE and moved, if necessary, to column COLNUM. Otherwise, column NAME of type TYPE is added as COLNUM (COLNUM=0 or omitted, means last column). TYPE can be int, float, or text (default is text).

Printf -- formatted display of table data

The PRINTF option allows you to specify a format string to print out each table row. The format string uses format conversion codes starting with a '%' and ending with a '#', as in:
%W.PcN#
W (width) and P (precision) are optional number values, indicating the width (in character spaces) and precision (values after the decimal point for numbers) to use in the display. If W is omitted there is no text padding.
The 'cN' specification indicates which table column value to insert in this location, where N is the column number (1-ncolumns). The format conversion string %W.PcN# will be converted to a C-style string, either “%W.Ps” or “%W.Pf”, depending on whether the specified column contains text or numerical data.

There are 5 other special case conversion strings:
%W# - this will be replaced by the current row number (as %Wd)
% % - this will print out as a single '%' character
\t - replaced with <Tab> character
\n - replaced with <Newline> character
\r - replaced with <Return> character

All other text characters in the format string will be copied directly to each line of output.

Performing a table query

Usage: -table query TBLNAME FLAG NEWNAME COL [VALUE1] [VALUE2]

NEWNAME is where to store the results if FLAG & 3, or if NEWNAME is not a column name in TBLNAME.

COL can be a column index number (1-NCols) or a column name. (To find column index from column name, use FLAG 16.)

VALUE1 is the value to search for in COL, or if FLAG&4 VALUE1 is the index number (1-NRows) of the row to return. Note: you can also find the value for a single table cell using the syntax “$tblname(col,row)” where COL and ROW indices, 1-NCols and 1-NRows, respectively.
If VALUE1 is omitted and !FLAG&24, all of COL is returned.

VALUE2: if FLAG&64, VALUE2 is a binary mask value ANDed with COL values before comparison to VALUE1; otherwise VALUE2 is the column number whose value(s) should be returned when COL matches VALUE1. If VALUE2 is omitted and !FLAG&24, whole matching rows are returned.

FLAG: Option flags (combine by adding):
* 1 - store into uservarb NEWNAME
* 2 - store into table NEWNAME
* 4 - VALUE1 is a row number
* 8 - only return row number(s)
* 16 - only return column number
* 32 - only find first instance
* 64 - VALUE2 is a binary mask to use for COL value
* 128 - inverse query; search for COL values that don't match; this is automatic if VALUE1 is preceded by '!'
* 256 - don't display error message on query failure
* 512 - find COL with missing value (assumed if VALUE1 = 'NULL')
* 1024 - do not convert 'NULL' in VALUE1 to missing value

Deleting a table or table entries

Usage: -table delete TBLNAME FLAG COL [VALUE1] [VALUE2]

If TBLNAME is the only argument, the entire table will be deleted.

With other arguments this will perform a QUERY as described above and only delete those rows that satisfy the query.

FLAG: Option flags (combine by adding):
* 4 - VALUE1 is a row number
* 32 - only delete first instance
* 64 - VALUE2 is a binary mask to use for COL value
* 128 - inverse query; search for COL values that don't match; this is automatic if VALUE1 is preceded by '!'
* 256 - don't display error message on query failure
* 512 - find COL with missing value (assumed if VALUE1 = 'NULL')
* 1024 - do not convert 'NULL' in VALUE1 to missing value

Sorting a table

Sort FLAG:
* 1 - Numerical sort
* 2 - Descending order

Special case tables

* InVivo - Manipulating tables of file names for InVivo DynaSuite

See Also:
Browse

fScan Home, fScan Manual, CmdLineOptions, Manual Help

jvs/fscan/manual/chapter2/table.txt · Last modified: 2023/02/23 18:43 (external edit)