White space parsing issue in manifest

I noticed that if there is whitespace at the end of a manifest file, it will raise errors like this

qiime tools import   --type 'SampleData[PairedEndSequencesWithQuality]'   --input-path cancer10-manifest   --output-path paired-end-demux.qza   --source-format PairedEndFastqManifestPhred64
/Users/tengfei/miniconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/q2_types/per_sample_sequences/_transformer.py:344: UserWarning: Importing of PHRED 64 data is slow as it is converted internally to PHRED 33. Working with the imported data will not be slower than working with PHRED 33 data.
  warnings.warn(_phred64_warning)
Traceback (most recent call last):
  File "/Users/tengfei/miniconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/q2cli/tools.py", line 116, in import_data
    view_type=source_format)
  File "/Users/tengfei/miniconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/qiime2/sdk/result.py", line 214, in import_data
    return cls._from_view(type_, view, view_type, provenance_capture)
  File "/Users/tengfei/miniconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/qiime2/sdk/result.py", line 239, in _from_view
    result = transformation(view)
  File "/Users/tengfei/miniconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/qiime2/core/transform.py", line 59, in transformation
    new_view = transformer(view)
  File "/Users/tengfei/miniconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/q2_types/per_sample_sequences/_transformer.py", line 346, in _9
    single_end=False)
  File "/Users/tengfei/miniconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/q2_types/per_sample_sequences/_transformer.py", line 268, in _fastq_manifest_helper
    absolute=True)
  File "/Users/tengfei/miniconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/q2_types/per_sample_sequences/_transformer.py", line 158, in _parse_and_validate_manifest
    _validate_paired_end_fastq_manifest_directions(manifest)
  File "/Users/tengfei/miniconda3/envs/qiime2-2018.2/lib/python3.5/site-packages/q2_types/per_sample_sequences/_transformer.py", line 211, in _validate_paired_end_fastq_manifest_directions
    '"reverse", but observed: %s' % direction)
ValueError: Directions can only be "forward" or "reverse", but observed: forward    

An unexpected error has occurred:

  Directions can only be "forward" or "reverse", but observed: forward    

See above for debug info.

Once the whitespace is removed, the error goes away. It took me a while to figure this out, and may be worthwhile to patch in a future release of qiime2.

Hi @tengfey!

Would you mind posting this as an issue on GitHub, so that QIIME2 developers are aware of this problem?

thanks for catching this!

Tomasz

Hey there @tengfey - thanks for reporting - I have opened up an issue already, so don't worry about filing any additional reports. Thanks so much for taking the time to suggest this, and sorry it caused some strife on your end!

:t_rex: