This is a test version of Biostars. For the public version, visit https://www.biostars.org.
ValueError: invalid literal for int() with base 10: 'start' computeMatrix of deeptools

When running the command with deeptools:

DIR=~/TESTING/day2_fos20_intersection
computeMatrix scale-regions -S path/HDF_day20.bw \
path/HUVEC_day2.bw \
-R $DIR/day2_fos20.bed $DIR/day2.bed $DIR/fos20.bed -b 4000 -a 4000 --regionBodyLength 5000 --missingDataAsZero -bs 50 -out HDFd20vsHUVd2_matrixscale.gz

I get the error:

ValueError: invalid literal for int() with base 10: 'start'

What am I doing wrong?

chip-seq deeptools

No header. I have some Chr17_gl00205_random though...don't know if that is a problem

Please post the first 10 or so lines of your BED files.

I have to ask you sorry. you were so right!

3 answers

Does your bed files have a header? If yes, try removing and run it again.

They don't have headers, I checked ;)

Are you sure? By header I meant chr start end. I added this header to my bed file and used the command you mentioned. It is exactly giving the same error

ValueError: invalid literal for int() with base 10: 'start'

Without header it works completely fine.

In my case I had NA`s in the bed file

Computers store numbers in a variety of different ways. Python has two main ones. Integers, which store whole numbers (ℤ), and floating point numbers, which store real numbers (ℝ). You need to use the right one based on what you require. This error message invalid literal for int() with base 10 would seem to indicate that you are passing a string that's not an integer to the int() function . In other words it's either empty, or has a character in it other than a digit.

You can solve this error by using Python isdigit() method to check whether the value is number or not. The returns True if all the characters are digits, otherwise False .

val = "10.10"
if val.isdigit():
  print(int(val))

The other way to overcome this issue is to wrap your code inside a Python try...except block to handle this error.

Or if you are trying to convert a float string (eg. "10.10") to an integer, simply calling float first then converting that to an int will work:

output = int(float(input))

Log in to answer this question.