Skip to content

Commit

Permalink
updated error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinesands committed Mar 26, 2024
1 parent bb2c5ec commit c316177
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nPYc/objects/_msDataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1294,8 +1294,8 @@ def _getSampleMetadataFromRawData(self, rawDataPath, filetype="Waters .raw"):
# Print warning that samples are missing info, raw files should be located or samples should be excluded from dataset
missingSampleInfo = ~self.sampleMetadata['Sample File Name'].isin(instrumentParams['Sample File Name'])
if sum(missingSampleInfo) > 0:
# CAZ TODO raise error if samples missing from raw data folder
print('Raw data for the following samples should be added to the raw data folder, or samples should be excluded from dataset else nPYc-Toolbox functionality may be compromised:\n')
# Warn users if samples missing from raw data folder
print('\x1b[31;1mRaw data for the following samples should be added to the raw data folder, or samples should be excluded from dataset else nPYc-Toolbox functionality may be compromised:\n\033[0;0m')
print(*self.sampleMetadata.loc[missingSampleInfo, 'Sample File Name'].values, sep='\n')

def _getSampleMetadataFromFilename(self, filenameSpec):
Expand Down Expand Up @@ -1466,7 +1466,7 @@ def _inferBatches(self, gapLength=24):
# Check `Acquired Time` or `Run Order` information available for all samples
if numpy.any(sampleMetadata[usefield].isnull()):
missingData = sampleMetadata.loc[sampleMetadata[usefield].isnull(),['Sample File Name', usefield]]
raise npycToolboxError("Unable to run batch and run order correction without `sampleMetadata[`" + usefield + "`]` info for ALL samples, info missing for:",
raise npycToolboxError("Unable to infer batches without `sampleMetadata[`" + usefield + "`]` info for ALL samples, info missing for:",
table=missingData)

# Generate sampleMetadata sorted by run order
Expand Down

0 comments on commit c316177

Please sign in to comment.