mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Consolidate parser args
This commit is contained in:
@@ -143,6 +143,9 @@ var TabularDatasetChunkedView = Backbone.View.extend({
|
||||
this.loading_chunk = false;
|
||||
// Configure delimiter for parsing data
|
||||
this.delimiter = this.model?.attributes?.file_ext === "csv" ? "," : "\t";
|
||||
this.parseArgs = {
|
||||
delimiter: this.delimiter,
|
||||
};
|
||||
// load trackster button
|
||||
new TabularButtonTracksterView({
|
||||
model: options.model,
|
||||
@@ -316,9 +319,7 @@ var TabularDatasetChunkedView = Backbone.View.extend({
|
||||
var data_table = this.$el.find("table");
|
||||
let parsedChunk = [];
|
||||
try {
|
||||
parsedChunk = parse(chunk.ck_data, {
|
||||
delimiter: this.delimiter,
|
||||
});
|
||||
parsedChunk = parse(chunk.ck_data, this.parseArgs);
|
||||
} catch (error) {
|
||||
// If this blows up it's likely data in a comment or header line
|
||||
// (e.g. VCF files) so just split it by newline first then parse
|
||||
@@ -326,9 +327,7 @@ var TabularDatasetChunkedView = Backbone.View.extend({
|
||||
parsedChunk = chunk.ck_data.trim().split("\n");
|
||||
parsedChunk = parsedChunk.map((line) => {
|
||||
try {
|
||||
return parse(line, {
|
||||
delimiter: this.delimiter,
|
||||
})[0];
|
||||
return parse(line, this.parseArgs)[0];
|
||||
} catch (error) {
|
||||
// Failing lines get passed through intact for row-level
|
||||
// rendering/parsing.
|
||||
|
||||
Reference in New Issue
Block a user