Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bamCoverage: TypeError: slice indices must be integers or None or have an __index__ method #491

Closed
chrarnold opened this issue Mar 10, 2017 · 7 comments

Comments

@chrarnold
Copy link

chrarnold commented Mar 10, 2017

Since a recent update of all packages and deepTools, I receive the following error when running bamCoverage using BOTH the --extendReads and --centerReads parameter, either one of these 2 parameters works fine, but not the combination. The exact same command worked before (see below), the BAM file is also fine.

bamCoverage --bam test2.merged.final.bam --binSize 10 --centerReads --extendReads --outFileName test2.merged.final.bigwig --outFileFormat bigwig --region chr21
region: chr21:10
verbose: False
center_read: True
bamFilesList: ['test2.merged.final.bam']
ignoreDuplicates: False
samFlag_include: None
numberOfProcessors: 4
bedFile: None
out_file_for_raw_data: None
save_data: False
numberOfSamples: None
blackListFileName: None
chrsToSkip: []
stepSize: 10
defaultFragmentLength: 56
smoothLength: None
zerosToNans: False
maxPairedFragmentLength: 224
minFragmentLength: 0
minMappingQuality: None
maxFragmentLength: 0
binLength: 10
samFlag_exclude: None

multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File ".../miniconda3/lib/python3.5/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File ".../miniconda3/lib/python3.5/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File ".../miniconda3/lib/python3.5/site-packages/deeptools/writeBedGraph.py", line 28, in writeBedGraph_wrapper
    return WriteBedGraph.writeBedGraph_worker(*args)
  File ".../miniconda3/lib/python3.5/site-packages/deeptools/writeBedGraph.py", line 227, in writeBedGraph_worker
    coverage, _ = self.count_reads_in_region(chrom, start, end)
  File ".../miniconda3/lib/python3.5/site-packages/deeptools/countReadsPerBin.py", line 446, in count_reads_in_region
    tcov = self.get_coverage_of_region(bam, chrom, trans)
  File ".../miniconda3/lib/python3.5/site-packages/deeptools/countReadsPerBin.py", line 628, in get_coverage_of_region
    coverages[sIdx:eIdx] += 1
TypeError: slice indices must be integers or None or have an __index__ method
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File ".../miniconda3/bin/bamCoverage", line 11, in <module>
    main(args)
  File ".../miniconda3/lib/python3.5/site-packages/deeptools/bamCoverage.py", line 255, in main
    format=args.outFileFormat, smoothLength=args.smoothLength)
  File ".../miniconda3/lib/python3.5/site-packages/deeptools/writeBedGraph.py", line 141, in run
    numberOfProcessors=self.numberOfProcessors)
  File ".../miniconda3/lib/python3.5/site-packages/deeptools/mapReduce.py", line 142, in mapReduce
    res = pool.map_async(func, TASKS).get(9999999)
  File ".../miniconda3/lib/python3.5/multiprocessing/pool.py", line 608, in get
    raise self._value
TypeError: slice indices must be integers or None or have an __index__ method

I believe this error is related to the following warning that I received earlier, that however did not result in an error and produced the correct output file:

.../miniconda3/lib/python3.5/site-packages/deeptools/countReadsPerBin.py:628: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future

Any suggestions how to fix it? Sounds like an implementation issue. All my conda packages are up to date, and I even installed deepTools only in an isolated conda environment to make sure there is no possible interference with other tools. I am using deepTools 2.4.2

@dpryan79
Copy link
Collaborator

That's very strange. Can you post your BAM file somewhere (you can create an account on deeptools.ie-freiburg.mpg.de and ftp the file there if needed)?

@chrarnold
Copy link
Author

Hi, strange indeed. This is from ATAC-Seq data. I can provide a Dropbox link, but I'd rather do this non-publicly, can I send you an email or something with the link? Thanks for the quick help!

@dpryan79
Copy link
Collaborator

Certainly, you can use my institute email address: ryan@ie-freiburg.mpg.de

@dpryan79
Copy link
Collaborator

This is now available in pypi and will be available in conda whenever TravisCI is finished.

@SheilaTeves
Copy link

Hello, I recently got this same error when doing --MNase option combined with --minFragmentLength and --maxFragmentLength.

bamFilesList: ['ATAC2_rep1_sorted.bam']
binLength: 10
numberOfSamples: None
blackListFileName: None
defaultFragmentLength: read length
numberOfProcessors: 6
verbose: False
region: None
bedFile: None
minMappingQuality: None
ignoreDuplicates: True
chrsToSkip: []
stepSize: 10
center_read: False
samFlag_include: None
samFlag_exclude: None
minFragmentLength: 150
maxFragmentLength: 250
zerosToNans: False
smoothLength: None
save_data: False
out_file_for_raw_data: None
maxPairedFragmentLength: 250
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/Users/lab2/anaconda/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/Users/lab2/anaconda/lib/python3.6/multiprocessing/pool.py", line 44, in mapstar
return list(map(*args))
File "/Users/lab2/anaconda/lib/python3.6/site-packages/deeptools/writeBedGraph.py", line 28, in writeBedGraph_wrapper
return WriteBedGraph.writeBedGraph_worker(*args)
File "/Users/lab2/anaconda/lib/python3.6/site-packages/deeptools/writeBedGraph.py", line 227, in writeBedGraph_worker
coverage, _ = self.count_reads_in_region(chrom, start, end)
File "/Users/lab2/anaconda/lib/python3.6/site-packages/deeptools/countReadsPerBin.py", line 446, in count_reads_in_region
tcov = self.get_coverage_of_region(bam, chrom, trans)
File "/Users/lab2/anaconda/lib/python3.6/site-packages/deeptools/countReadsPerBin.py", line 629, in get_coverage_of_region
coverages[sIdx:eIdx] += 1
TypeError: slice indices must be integers or None or have an index method
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/lab2/anaconda/bin/bamCoverage", line 11, in
main(args)
File "/Users/lab2/anaconda/lib/python3.6/site-packages/deeptools/bamCoverage.py", line 238, in main
format=args.outFileFormat, smoothLength=args.smoothLength)
File "/Users/lab2/anaconda/lib/python3.6/site-packages/deeptools/writeBedGraph.py", line 141, in run
numberOfProcessors=self.numberOfProcessors)
File "/Users/lab2/anaconda/lib/python3.6/site-packages/deeptools/mapReduce.py", line 142, in mapReduce
res = pool.map_async(func, TASKS).get(9999999)
File "/Users/lab2/anaconda/lib/python3.6/multiprocessing/pool.py", line 608, in get
raise self._value
TypeError: slice indices must be integers or None or have an index method

Any thoughts?

Thanks!

Sheila

@dpryan79
Copy link
Collaborator

dpryan79 commented Apr 2, 2018

@SheilaTeves What version are you using?

@SheilaTeves
Copy link

Oh, I still have 2.5.1. I will upgrade and check if it's still an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants