This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to fix "ValueError: not enough values to unpack (expected 3, got 1)" when excuting batch analysis?
CNVkit 0.9.7
Detected file format: bed
Splitting large targets
Wrote results/120430_HG19_ExomeV3_UTR_EZ_HX1_primary_annotated.target.bed with 407920 regions
Detected file format: bed
Traceback (most recent call last):
  File "/home/lab/miniconda3/envs/CNVKIT/lib/python3.7/site-packages/skgenome/tabio/util.py", line 9, in wrapper
    return line_parser(line)
  File "/home/lab/miniconda3/envs/CNVKIT/lib/python3.7/site-packages/skgenome/tabio/bedio.py", line 25, in _parse_line
    chrom, start, end = fields[:3]
ValueError: not enough values to unpack (expected 3, got 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/lab/miniconda3/envs/CNVKIT/lib/python3.7/site-packages/skgenome/tabio/__init__.py", line 74, in read
    dframe = reader(infile, **kwargs)
  File "/home/lab/miniconda3/envs/CNVKIT/lib/python3.7/site-packages/skgenome/tabio/bedio.py", line 51, in read_bed
    "end", "gene", "strand"])
  File "/home/lab/miniconda3/envs/CNVKIT/lib/python3.7/site-packages/pandas/core/frame.py", line 1759, in from_records
    values += data
  File "/home/lab/miniconda3/envs/CNVKIT/lib/python3.7/site-packages/skgenome/tabio/util.py", line 11, in wrapper
    raise ValueError("Bad line: %r" % line)
ValueError: Bad line: '\n'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/lab/miniconda3/envs/CNVKIT/bin/cnvkit.py", line 9, in <module>
    args.func(args)
  File "/home/lab/miniconda3/envs/CNVKIT/lib/python3.7/site-packages/cnvlib/commands.py", line 115, in _cmd_batch
    args.count_reads, args.seq_method, args.cluster)
  File "/home/lab/miniconda3/envs/CNVKIT/lib/python3.7/site-packages/cnvlib/batch.py", line 103, in batch_make_reference
    anti_kwargs['access'] = tabio.read_auto(access_bed)
  File "/home/lab/miniconda3/envs/CNVKIT/lib/python3.7/site-packages/skgenome/tabio/__init__.py", line 110, in read_auto
    return read(infile, fmt or 'tab')
  File "/home/lab/miniconda3/envs/CNVKIT/lib/python3.7/site-packages/skgenome/tabio/__init__.py", line 75, in read
    except pd.io.common.EmptyDataError:
AttributeError: module 'pandas.io.common' has no attribute 'EmptyDataError'
batch germline cnv

I'm guessing an empty line in a bed (?) file. Try actually explaining what was the input and the error.

After dissecting the process, the errors are related to the "antitarget" command.

2 answers

Answer:

The first two errors are due to an extra empty line at the end of the access-5kb-mappable.hg19.bed. Remove it and no errors anymore.

The third errors are due to scripts, please look for the right one in GitHub. Original: File "/home/lab/miniconda3/envs/CNVKIT/lib/python3.7/site-packages/skgenome/tabio/__init__.py", line 75, in read except pd.io.common.EmptyDataError:

should have been pd.errors.EmptyDataError:

The error message is fairly self-explanatory. Your program expects python split() to yield 3 elements, but in your case, it is only yielding 1 element. This could be because the data is not in the format you expect, a rogue malformed line, or maybe an empty line - there's no way to know.

To see what line is causing the issue, you could add some debug statements like this:

if len(line.split()) != 3:
    print line

Log in to answer this question.