Skip to content

Commit

Permalink
Merge pull request #418 from SetCodesToFire/issue-275
Browse files Browse the repository at this point in the history
Issue 275
  • Loading branch information
chrisgorgo authored Feb 28, 2018
2 parents d2bc984 + 3ab6d74 commit d5b0383
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/tsv.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,29 @@ describe('TSV', function(){
});
});

// _scans checks -----------------------------------------------------------------

var scansFile = {
name: 'sub-08_ses-test_task-linebisection_scans.tsv',
relativePath: '/sub-08/ses-test/func/sub-08_ses-test_task-linebisection_scans.tsv'
};

it("should not allow _scans.tsv files without filename column", function () {
var tsv = 'header-one\theader-two\theader-three\n' +
'value-one\tvalue-two\tvalue-three';
validate.TSV.TSV(scansFile, tsv, [], function (issues) {
assert(issues.length === 1 && issues[0].code === 68);
});
});

it("should allow _scans.tsv files with filename column", function () {
var tsv = 'header-one\tfilename\theader-three\n' +
'value-one\tvalue-two\tvalue-three';
validate.TSV.TSV(scansFile, tsv, [], function (issues) {
assert.deepEqual(issues, []);
});
});

it("should check participants listed in phenotype/*tsv and sub-ids ", function () {
var phenotypeParticipants= [{
list:
Expand Down
5 changes: 5 additions & 0 deletions utils/issues/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,5 +341,10 @@ module.exports = {
key: 'NO_VALID_DATA_FOUND_FOR_SUBJECT',
severity: 'error',
reason: 'No BIDS compatible data found for at least one subject.'
},
68: {
key: 'FILENAME_COLUMN',
severity: 'error',
reason: "_scans.tsv files must have a 'filename' column."
}
};
13 changes: 13 additions & 0 deletions validators/tsv.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,19 @@ var TSV = function TSV (file, contents, fileList, callback) {
checkage89_plus(rows, file, issues);
}

// check _scans.tsv for column filename

if(file.name.endsWith('_scans.tsv')){
if(!(headers.indexOf('filename') > -1)){
issues.push(new Issue({
line: 1,
file: file,
evidence: headers.join('\t'),
code: 68
}));
}
}

callback(issues, participants);
};
var checkphenotype = function (phenotypeParticipants, summary, issues) {
Expand Down

0 comments on commit d5b0383

Please sign in to comment.