def validate(path, level):
import qiime2.sdk
try:
artifact = qiime2.sdk.Artifact.load(path)
except Exception as e:
header = 'There was a problem loading %s as a QIIME 2 Artifact:' % path
q2cli.util.exit_with_error(e, header=header)
try:
artifact.validate(level)
except qiime2.plugin.ValidationError as e:
header = 'Artifact %s does not appear to be valid at level=%s:' % (
path, level)
with open(os.devnull, 'w') as dev_null:
q2cli.util.exit_with_error(e, header=header, file=dev_null,
suppress_footer=True)
except Exception as e:
header = ('An unexpected error has occurred while attempting to '
'validate artifact %s:' % path)
q2cli.util.exit_with_error(e, header=header)
else:
click.secho('Artifact %s appears to be valid at level=%s.'
% (path, level), fg="green")
评论列表
文章目录