hqyone/BCR_Evaluator

TypeError: cannot use a string pattern on a bytes-like object

Closed this issue · 2 comments

Hello, Thank you for developing this program. I am interested in using it, but when I run python BCReval.py -n 8 -i SRR11858960.fastq -o SRR11858960_bcr.stat with wgbs data as the input, I am getting the following error:

  File "/home/programs/BCR_Evaluator/BCReval.py", line 341, in <module>
    main(sys.argv[1:])
  File "/home/programs/BCR_Evaluator/BCReval.py", line 326, in main
    rep = getTeloRepCount(min_rep_number, f)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/programs/BCR_Evaluator/BCReval.py", line 153, in getTeloRepCount
    [type, bs] = findBestTelomereMatch(line)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/programs/BCR_Evaluator/BCReval.py", line 86, in findBestTelomereMatch
    bs1= findLongestTelomereMatch(seq, p0)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/programs/BCR_Evaluator/BCReval.py", line 77, in findLongestTelomereMatch
    matchs = re.findall(pattern, seq)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/miniconda3/envs/bcr/lib/python3.12/re/__init__.py", line 217, in findall
    return _compile(pattern, flags).findall(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: cannot use a string pattern on a bytes-like object```

Could you suggest why this error might be arising and any adjustments I could make to resolve the issue? Thank you for your assistance.

Update: The issue was related to using a newer version of Python. I saw that you mentioned testing BCReval with Python 2.7 and I was able to get your program to work by pinning 2.7 as the Python version in my Conda environment with the command mamba create -n bcr python=2.7 conda-forge::gzip.

Thanks again for developing this program.