FowlerLab/Enrich2

value error: unexpected barcode map file

mgantz opened this issue · 3 comments

Hi!

After trying to get started with enrich2 it seems I have a problem with my barcodemap file. I have generated a tab-separated .txt file (screenshot of the first lines opened using the terminal:
Sreenshot_file
) with my barcodes and the variant and tried to feed it into enrich2 but it seems, enrich2 does not recognise its format and gives the following error:

ValueError: Unexpected barcode map line format [barcodemap_VIF_barcodemap.txt]

I have tried the same with the example barcodemap file provided and did not get any error. I've also tried to convert the file and generated it from scratch using several different sources (python csv.writer, with \t as delimiter, microsoft excel and numbers).

Is this a common problem and is there any way to fix this?

Many thanks in advance!

Thanks for this report. I haven't seen this before.

The relevant code snippet from barcodemap.py is:

            try:
                barcode, value = line.strip().split()
            except ValueError:
                raise ValueError(
                    "Unexpected barcode map line format " "[{}]".format(self.name)
                )

It sounds to me like the file you are describing should work fine. My best guess is that there is a single line somewhere in the file that doesn't have a barcode or variant specified. You could try running a modified version of the above code locally on the file and see if you can spot the issue:

handle = open(mapfile, "rU")

for i, line in enumerate(handle):
    # skip comments and whitespace-only lines
    if len(line.strip()) == 0 or line[0] == "#":
        continue

    try:
        barcode, value = line.strip().split()
    except ValueError:
        print("found a bad line (no. {})".format(i + 1)

handle.close()

(Please forgive any syntax/formatting errors in the above).

Thank you so much, that worked! There actually where a couple of barcodes with no variant linked.

Glad this helped!