pycogent/pycogent — pull request #15 by ctSkennerton (2013-02-06 02:39:23+00:00)
Title: Fixed an ApplicationError when using a different working directory with cd_hit app controller

When using the CD-HIT application controller there would be an
ApplicationError thrown from the CommandLineAppResult constructor
if the WorkingDir property was set.

For example the following code would throw the error:
```python
>>> from cogent.app.cd_hit import CD_HIT_EST
>>> cdhit = CD_HIT_EST(WorkingDir='pipeline/16Smock1_EBPRPhage_IMBMiSeqDec2012/root/Bacteria/Actinobacteria/Actinobacteria/Actinomycetales/Brevibacteriaceae/Brevibacterium/aureum')
>>> cdhit.Parameters['-i'].on('reads.fa')
>>> cdhit.Parameters['-o'].on('cdhitout.fa')
>>> ret = cdhit()
Traceback (most recent call last):
File "", line 1, in
File "/sw/PyCogent/connors-dev/lib/python2.7/site-packages/cogent/app/util.py", line 274, in __call__
out,err,exit_status,self._get_result_paths(data))
File "/sw/PyCogent/connors-dev/lib/python2.7/site-packages/cogent/app/util.py", line 291, in _handle_app_result_build_failure
raise ApplicationError, "Error constructing CommandLineAppResult."
cogent.app.util.ApplicationError: Error constructing CommandLineAppResult.
```
however by cd'ing into the working directory first and then running the same thing you get the desired result
```python
$ cd pipeline/16Smock1_EBPRPhage_IMBMiSeqDec2012/root/Bacteria/Actinobacteria/Actinobacteria/Actinomycetales/Brevibacteriaceae/Brevibacterium/aureum
python

>>> from cogent.app.cd_hit import CD_HIT_EST
>>> cdhit = CD_HIT_EST()
>>> cdhit.Parameters['-i'].on('reads.fa')
>>> cdhit.Parameters['-o'].on('cdhitout.fa')
>>> ret = cdhit()
>>> ret
{'FASTA': , 'CLSTR': , 'ExitStatus': 0, 'StdErr': , 'StdOut': }
```

The issue was resolved by joining the WorkingDir and the ouput file in `_get_seqs_outfile` and `_get_clstr_outfile`.