Example #1
0
 def get_errors(self):
     # This creates a deeply nested dict.
     # Keys are present only if there is actually an error to report.
     errors = {}
     tsv_errors = get_tsv_errors(self.path, schema_name='sample')
     if tsv_errors:
         errors['Sample TSV Errors'] = tsv_errors
     return errors
 def __get_ref_errors(self, ref_type, path, assay_type):
     if ref_type == 'data':
         return get_data_dir_errors(
             assay_type, path, dataset_ignore_globs=self.dataset_ignore_globs)
     else:
         return get_tsv_errors(
             schema_name=ref_type, tsv_path=path,
             offline=self.offline, encoding=self.encoding)
def main():
    args = parser.parse_args()
    try:
        schema_name = (args.schema if args.schema != 'metadata' else
                       get_schema_version(args.path, 'ascii').schema_name)
    except PreflightError as e:
        errors = {'Preflight': str(e)}
    else:
        errors = get_tsv_errors(args.path, schema_name=schema_name)
        errors = {f'{schema_name} TSV errors': errors} if errors else {}
    report = ErrorReport(errors)
    print(getattr(report, args.output)())
    return exit_codes.INVALID if errors else exit_codes.VALID
Example #4
0
 def _get_assay_internal_errors(self, assay_type, path):
     return get_tsv_errors(
         type=assay_type, tsv_path=path,
         offline=self.offline, encoding=self.encoding,
         optional_fields=self.optional_fields)
Example #5
0
 def _get_antibodies_errors(self, antibodies_path):
     return get_tsv_errors(
         type='antibodies', tsv_path=antibodies_path,
         offline=self.offline, encoding=self.encoding)
Example #6
0
 def _get_contributors_errors(self, contributors_path):
     return get_tsv_errors(
         type='contributors', tsv_path=contributors_path,
         offline=self.offline, encoding=self.encoding)