cgat-developers / cgat-apps

cgat-apps repository
Other
33 stars 14 forks source link

bam_vs_bed error if bashrc outputs anything #29

Open IanSudbery opened 5 years ago

IanSudbery commented 5 years ago

bam_vs_bed starts a subshell, excutes a command and grabs the standard output. It assumes that the output in the stdout is only the output from the bedtools intersect command it runs, but it your ~/.bashrc outputs anything to stdout (which might not be under your control on a shared system), then this screws up the output parsing and causes bam_Vs_bed to out the following cryptic message:

Traceback (most recent call last): \
    File "/shared/sudlab1/General/apps/conda/conda-install/envs/cgat-f/bin/cgat", line 11, in <module> \
       load_entry_point('cgat', 'console_scripts', 'cgat')() \
    File "/shared/sudlab1/General/apps/conda/cgat-apps/cgat/cgat.py", line 132, in main \
         module.main(sys.argv) \
    File "/shared/sudlab1/General/apps/conda/cgat-apps/cgat/tools/bam_vs_bed.py", line 256, in main \
          iterate(iotools.force_str(proc.stdout)), key=sort_key): \
    File "/shared/sudlab1/General/apps/conda/cgat-apps/cgat/tools/bam_vs_bed.py", line 253, in iterate \
          yield data._make(line[:-1].split()[:take_columns]) \
    File "<string>", line 21, in _make \
 TypeError: Expected 17 arguments, got 3 \

It there a way to avoid this althogether (change the way the enviornment is passed to the subshell? Use a named pipe rather than stdout, or use a temporary file?). If not, is there a way to at least give a better error message?