Skip to content

Commit

Permalink
Merge pull request #569 from olgn/empty-sub-room
Browse files Browse the repository at this point in the history
Sub-emptyroom excluded from dataset summary
  • Loading branch information
olgn authored Sep 18, 2018
2 parents 5feacfa + 4bb5c9f commit dbcf30d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
1 change: 0 additions & 1 deletion tests/bids.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ var missing_session_files = [
'ds109',
'ds113b',
'ds000117',
'ds000246',
'ds000247',
]

Expand Down
7 changes: 5 additions & 2 deletions validators/bids.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,16 +490,19 @@ BIDS = {
)
) {
var pathValues = utils.type.getPathValues(file.relativePath)
const isEmptyRoom = pathValues.sub && pathValues.sub == 'emptyroom'

if (
pathValues.sub &&
summary.subjects.indexOf(pathValues.sub) === -1
summary.subjects.indexOf(pathValues.sub) === -1 &&
!isEmptyRoom
) {
summary.subjects.push(pathValues.sub)
}
if (
pathValues.ses &&
summary.sessions.indexOf(pathValues.ses) === -1
summary.sessions.indexOf(pathValues.ses) === -1 &&
!isEmptyRoom
) {
summary.sessions.push(pathValues.ses)
}
Expand Down
4 changes: 2 additions & 2 deletions validators/checkAnyDataPresent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var utils = require('../utils')
var Issue = utils.issues.Issue

function addIfNotPresent(folderSubjects, subject) {
if (folderSubjects.indexOf(subject) == -1) {
if (folderSubjects.indexOf(subject) == -1 && subject !== 'emptyroom') {
folderSubjects.push(subject)
}
}
Expand All @@ -13,6 +13,7 @@ function getFolderSubjects(fileList) {
var file = fileList[key]
var match = file.relativePath.match(/sub-(.*?)(?=\/)/)
if (match) {
// console.log('match:', match)
addIfNotPresent(folderSubjects, match[1])
}
}
Expand All @@ -30,7 +31,6 @@ var checkAnyDataPresent = function checkAnyDataPresent(
) {
var issues = []
var folderSubjects = getFolderSubjects(fileList)

var subjectsWithoutAnyValidData = folderSubjects.filter(function(i) {
return summarySubjects.indexOf(i) < 0
})
Expand Down
7 changes: 7 additions & 0 deletions validators/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ var session = function missingSessionFiles(fileList) {
} else {
subject = match[0]
}

// suppress inconsistent subject warnings for sub-emptyroom scans
// in MEG data
if (subject == 'sub-emptyroom') {
continue
}

// initialize an empty array if we haven't seen this subject before
if (typeof subjects[subject] === 'undefined') {
subjects[subject] = []
Expand Down
6 changes: 5 additions & 1 deletion validators/tsv.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ var TSV = function TSV(file, contents, fileList, callback) {
if (!row || /^\s*$/.test(row)) {
continue
}
participants.push(row[participantIdColumn].replace('sub-', ''))
const participant = row[participantIdColumn].replace('sub-', '')
if (participant == 'emptyroom') {
continue
}
participants.push(participant)
}
}
}
Expand Down

0 comments on commit dbcf30d

Please sign in to comment.