This function creates a track from WIG / BigWig / BedGraph / tab-delimited
file. Zipped files are supported (file name must have '.gz' or '.zip' suffix).
Tab-delimited files must start with a header line with the following column
names (tab-separated): 'chrom', 'start', 'end', and exactly one value column
name (e.g. 'value'). Each subsequent line provides a single interval:
- chrom: chromosome name (e.g. 'chr1')
- start: 0-based start coordinate (inclusive)
- end: 0-based end coordinate (exclusive)
- value: numeric value (floating point allowed); exactly one value column is supported
Columns must be separated by tabs. Coordinates must refer to chromosomes
existing in the current genome. Missing values can be specified as 'NaN'.
Chromosome names are matched against the genome database through the
chromosome alias chain (chr1 <-> 1, M <-> MT,
and <groot>/chrom_aliases.tsv if present). If the file names
chromosomes and none of them can be matched, 'gtrack.import' fails instead of
creating an empty track; a file with no chromosome records at all is not an
error and still imports as an empty track. If only some of the names can be
matched, the rest of the file is imported and the unmatched names are
reported: a message for contigs the database does not have (unplaced
scaffolds, patches), a warning when the unmatched name looks like a primary
chromosome, since that suggests a naming mismatch.
BED files (.bed/.bed.gz/.bed.zip) are also supported. If the BED 'score'
column (5th column) exists and is numeric, it is used as the interval value;
otherwise a constant value of 1 is used. For BED inputs, 'binsize' controls
the output type: if 'binsize' is 0 the track is 'Sparse'; otherwise the track
is 'Dense' with bin-averaged values based on overlaps with BED intervals (and
'defval' for regions not covered).
If 'binsize' is 0 the resulted track is created in 'Sparse' format.
Otherwise the 'Dense' format is chosen with a bin size equal to 'binsize'.
The values that were not defined in input file file are substituted by
'defval' value.
'description' is added as a track attribute.
When multiple databases are connected via gsetroot, the track
is created in the current working directory (.misha$GWD), which defaults to the
last connected database. Use gdir.cd with an absolute path to
change where new tracks are created.