Skip to content

Commit

Permalink
Remove trailing spaces
Browse files Browse the repository at this point in the history
* Remove trailing spaces at end of line.
* Remove empty lines at end of file.
  • Loading branch information
DimitriPapadopoulos committed Sep 14, 2021
1 parent 415dd9b commit 1c0cede
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 51 deletions.
1 change: 0 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ module.exports = {
}
}
}

Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
participant_id age sex
sub-01 34 F

Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
"Units": "s"
},
"plasma_radioactivity": {
"Description": "Radioactivity in plasma samples",
"Description": "Radioactivity in plasma samples",
"Units": "Bq/ml"
},
"metabolite_parent_fraction": {
"Description": "Parent fraction of the radiotracer. The metabolite and unmetabolized parent compound were collected in separate vials, and radioactivity was quantified using a Bioscan g-detector after correction for background radioactivity.",
"Units": "unitless"
}
}

18 changes: 9 additions & 9 deletions bids-validator/validators/json/schemas/pet.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@
"TracerName": { "type": "string", "minLength": 1 },
"TracerRadionuclide": { "type": "string", "minLength": 1 },
"InstitutionName": { "type": "string", "minLength": 1 },
"InstitutionAddress": { "type": "string", "minLength": 1 },
"InstitutionAddress": { "type": "string", "minLength": 1 },
"InstitutionalDepartmentName": { "$ref": "common_definitions.json#/definitions/InstitutionalDepartmentName" },
"BodyPart": { "type": "string", "minLength": 1 },
"TracerRadLex": { "type": "string", "minLength": 1 },
"TracerSNOMED": { "type": "string", "minLength": 1 },
"TracerMolecularWeight": { "type": "number" },
"TracerMolecularWeightUnits": { "type": "string", "minLength": 1 },
"PharmaceuticalName": { "type": "string", "minLength": 1 },
"PharmaceuticalDoseAmount": {
"PharmaceuticalDoseAmount": {
"anyOf": [
{ "type": "number", "minimum": 0 },
{ "type": "array", "items": { "type": "number" } }
]
},
"PharmaceuticalDoseUnits": { "type": "string", "minLength": 1 },
"PharmaceuticalDoseRegimen": { "type": "string", "minLength": 1 },
"PharmaceuticalDoseTime": {
"PharmaceuticalDoseTime": {
"anyOf": [
{ "type": "number" },
{ "type": "array", "items": { "type": "number" } }
]
},
"Anaesthesia": { "type": "string", "minLength": 1 },

"ModeOfAdministration": { "type": "string", "minLength": 1 },
"InjectedRadioactivity": { "type": "number" },
"InjectedRadioactivityUnits": { "type": "string", "minLength": 1 },
Expand All @@ -54,8 +54,8 @@
"pattern": "^(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$"
},
"InfusionRadioactivity": { "type": "number" },
"InfusionStart": { "type": "number" },
"InfusionSpeed": { "type": "number" },
"InfusionStart": { "type": "number" },
"InfusionSpeed": { "type": "number" },
"InfusionSpeedUnits": { "type": "string", "minLength": 1 },
"InjectedVolume": { "type": "number" },
"Purity": { "type": "number" },
Expand All @@ -81,18 +81,18 @@
"ReconMethodParameterLabels": { "type": "array", "items": { "type": "string" } },
"ReconMethodParameterUnits": { "type": "array", "items": { "type": "string" } },
"ReconMethodParameterValues": { "type": "array", "items": { "type": "number" } },
"ReconFilterType": {
"ReconFilterType": {
"anyOf": [
{ "type": "string" },
{ "type": "array", "items": { "type": "string" } }
]
},
"ReconFilterSize": {
"ReconFilterSize": {
"anyOf": [
{ "type": "number", "minimum": 0 },
{"type": "array", "items": { "type": "number" } }
]
},
},
"ReconMethodImplementationVersion": { "type": "string", "minLength": 1 },
"AttenuationCorrection": { "type": "string", "minLength": 1 },
"AttenuationCorrectionMethodReference": { "type": "string", "minLength": 1 },
Expand Down
2 changes: 1 addition & 1 deletion bids-validator/validators/tsv/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ export default {
validate: validate,
checkAge89: checkAge89,
checkAcqTimeFormat: checkAcqTimeFormat,
validateContRec: validateContRec
validateContRec: validateContRec
}
8 changes: 4 additions & 4 deletions bids-validator/validators/tsv/tsv.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const TSV = (file, contents, fileList, callback) => {
) {
const participantIdColumn = headers.indexOf('participant_id')

// if the participant_id column is missing, an error
// if the participant_id column is missing, an error
// will be raised
if (participantIdColumn === -1) {
issues.push(
Expand All @@ -206,7 +206,7 @@ const TSV = (file, contents, fileList, callback) => {
}),
)
} else {
// otherwise, the participants should comprise of
// otherwise, the participants should comprise of
// sub-<subject_id> and one subject per row
participants = []
for (let l = 1; l < rows.length; l++) {
Expand All @@ -229,7 +229,7 @@ const TSV = (file, contents, fileList, callback) => {
}),
)
}

// obtain a list of the subject IDs in the participants.tsv file
const participant = row[participantIdColumn].replace('sub-', '')
if (participant == 'emptyroom') {
Expand Down Expand Up @@ -307,7 +307,7 @@ const TSV = (file, contents, fileList, callback) => {
}

// check for valid SI units
/*
/*
* Commenting out call to validation until it is inline with spec:
* https://github.com/bids-standard/bids-specification/pull/411
if (headers.includes('units')) {
Expand Down
66 changes: 33 additions & 33 deletions bids-validator/validators/tsv/validateTsvColumns.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ const commaSeparatedStringOf = items => items.map(item => `"${item}"`).join(', '
/**
* Loads relevant JSON schema for given tsv modalities.
* Currently only required for pet_blood.
* @param {*} tsvs
* @returns
* @param {*} tsvs
* @returns
*/
const loadSchemas = tsvs => {
const schemas = {}
Expand Down Expand Up @@ -128,11 +128,11 @@ const validateTsvColumns = function(tsvs, jsonContentsDict, headers) {
}

/**
* Validates that tsv columns required by
* @param {*} tsv
* @param {*} mergedDict
* @param {*} schema
* @returns
* Validates that tsv columns required by
* @param {*} tsv
* @param {*} mergedDict
* @param {*} schema
* @returns
*/
export const validatePetBloodHeaders = (tsv, mergedDict, schema) => {
const tsvIssues = []
Expand Down Expand Up @@ -176,7 +176,7 @@ const validateASL = (tsvs, jsonContentsDict, headers) => {
const file = header[0]
return file.relativePath.includes('_asl')
})

aslHeaders.forEach(aslHeader => {
// extract the fourth element of 'dim' field of header - this is the
// number of volumes that were obtained during scan (numVols)
Expand All @@ -189,24 +189,24 @@ const validateASL = (tsvs, jsonContentsDict, headers) => {
var potentialSidecars = utils.files.potentialLocations(
file.relativePath.replace('.gz', '').replace('.nii', '.json'),
)

// get the _asl_context.tsv associated with this asl scan
const potentialAslContext = utils.files.potentialLocations(
file.relativePath.replace('.gz', '').replace('asl.nii', 'aslcontext.tsv'),
)
const associatedAslContext = potentialAslContext.indexOf(tsv.file.relativePath)


if (associatedAslContext > -1)
{
const rows = tsv.contents
.replace(/[\r]+/g,'')
.split('\n')
.filter(row => !(!row || /^\s*$/.test(row)))

const m0scan_filters = ['m0scan'];
const filtered_m0scan_rows = rows.filter(row => m0scan_filters.includes(row))

const control_filters = ['control'];
const filtered_control_rows = rows.filter(row => control_filters.includes(row))

Expand All @@ -229,7 +229,7 @@ const validateASL = (tsvs, jsonContentsDict, headers) => {
file: file,
})
)
}
}

// Get merged data dictionary for this file
potentialSidecars = utils.files.potentialLocations(
Expand All @@ -251,7 +251,7 @@ const validateASL = (tsvs, jsonContentsDict, headers) => {
file: file,
code: 154,
reason:
"''M0Type' is set to 'Included' however the tsv file does not contain any m0scan volume."
"''M0Type' is set to 'Included' however the tsv file does not contain any m0scan volume."
}),
)
}
Expand All @@ -266,16 +266,16 @@ const validateASL = (tsvs, jsonContentsDict, headers) => {
file: file,
code: 199,
reason:
"''M0Type' is set to 'Absent' however the tsv file contains an m0scan volume. This should be avoided."
"''M0Type' is set to 'Absent' however the tsv file contains an m0scan volume. This should be avoided."
}),
)
}

// check Flip Angle requirements with LookLocker acquisitions
if (
mergedDict.hasOwnProperty('FlipAngle') &&
mergedDict['FlipAngle'].constructor === Array
)
)
{
let FlipAngle = mergedDict['FlipAngle']
const FlipAngleLength = FlipAngle.length
Expand All @@ -285,19 +285,19 @@ const validateASL = (tsvs, jsonContentsDict, headers) => {
file: file,
code: 172,
reason:
"''FlipAngle' for this file does not match the TSV length. Please make sure that the size of the FlipAngle array in the json corresponds to the number of volume listed in the tsv file."
"''FlipAngle' for this file does not match the TSV length. Please make sure that the size of the FlipAngle array in the json corresponds to the number of volume listed in the tsv file."
}),
)
}
}
// check Labelling Duration matching with TSV lenght only for PCASL or CASL
if
if
(
mergedDict.hasOwnProperty('LabelingDuration') &&
mergedDict['LabelingDuration'].constructor === Array &&
mergedDict.hasOwnProperty('ArterialSpinLabelingType') &&
(mergedDict['ArterialSpinLabelingType'] == 'CASL' || mergedDict['ArterialSpinLabelingType'] == 'PCASL')
)
)
{
let LabelingDuration = mergedDict['LabelingDuration']
const LabelingDurationLength = LabelingDuration.length
Expand All @@ -307,18 +307,18 @@ const validateASL = (tsvs, jsonContentsDict, headers) => {
file: file,
code: 175,
reason:
"''LabelingDuration' for this file does not match the TSV lenght. Please be sure that the size of the LabelingDuration array in the json corresponds to the number of volume listed in the tsv file."
"''LabelingDuration' for this file does not match the TSV lenght. Please be sure that the size of the LabelingDuration array in the json corresponds to the number of volume listed in the tsv file."
}),
)
}
}

// check VolumeTiming with TSV lenght
if
if
(
mergedDict.hasOwnProperty('RepetitionTimePreparation') &&
mergedDict['RepetitionTimePreparation'].constructor === Array
)
mergedDict['RepetitionTimePreparation'].constructor === Array
)
{
let RepetitionTimePreparation = mergedDict['RepetitionTimePreparation']
const RepetitionTimePreparationLength = RepetitionTimePreparation.length
Expand All @@ -328,7 +328,7 @@ const validateASL = (tsvs, jsonContentsDict, headers) => {
file: file,
code: 177,
reason:
"''RepetitionTimePreparation' for this file do not match the TSV lenght. Please be sure that the size of the RepetitionTimePreparation array in the json corresponds to the number of volume listed in the tsv file."
"''RepetitionTimePreparation' for this file do not match the TSV lenght. Please be sure that the size of the RepetitionTimePreparation array in the json corresponds to the number of volume listed in the tsv file."
}),
)
}
Expand All @@ -338,7 +338,7 @@ const validateASL = (tsvs, jsonContentsDict, headers) => {
if (
mergedDict.hasOwnProperty('PostLabelingDelay') &&
mergedDict['PostLabelingDelay'].constructor === Array
)
)
{
let PostLabelingDelay = mergedDict['PostLabelingDelay']
const PostLabelingDelayLength = PostLabelingDelay.length
Expand All @@ -348,7 +348,7 @@ const validateASL = (tsvs, jsonContentsDict, headers) => {
file: file,
code: 174,
reason:
"''PostLabelingDelay' for this file do not match the TSV lenght. Please be sure that the size of the PostLabelingDelay array in the json corresponds to the number of volume listed in the tsv file."
"''PostLabelingDelay' for this file do not match the TSV lenght. Please be sure that the size of the PostLabelingDelay array in the json corresponds to the number of volume listed in the tsv file."
}),
)
}
Expand All @@ -363,15 +363,15 @@ const validateASL = (tsvs, jsonContentsDict, headers) => {
file: file,
code: 181,
reason:
"''TotalAcquiredVolumes' for this file do not match the TSV lenght. Please be sure that the size of the TotalAcquiredVolumes array in the json corresponds to the number of volume listed in the tsv file."
"''TotalAcquiredVolumes' for this file do not match the TSV lenght. Please be sure that the size of the TotalAcquiredVolumes array in the json corresponds to the number of volume listed in the tsv file."
}),
)
}
}

if (
mergedDict.hasOwnProperty('EchoTime') &&
mergedDict['EchoTime'].constructor === Array
if (
mergedDict.hasOwnProperty('EchoTime') &&
mergedDict['EchoTime'].constructor === Array
) {
let EchoTime = mergedDict['EchoTime']
const EchoTimeLength = EchoTime.length
Expand All @@ -381,7 +381,7 @@ const validateASL = (tsvs, jsonContentsDict, headers) => {
file: file,
code: 196,
reason:
"''EchoTime' for this file do not match the TSV lenght. Please be sure that the size of the EchoTime array in the json corresponds to the number of volume listed in the tsv file."
"''EchoTime' for this file do not match the TSV lenght. Please be sure that the size of the EchoTime array in the json corresponds to the number of volume listed in the tsv file."
}),
)
}
Expand Down

0 comments on commit 1c0cede

Please sign in to comment.