Comments (5)
30! It shouldn't ever use more than 1. Can you post an example where this happens?
from pybigwig.
30! It shouldn't ever use more than 1. Can you post an example where this happens?
Without posting a bunch of code I think I can describe my simple script:
First I load in a bed file of ~20,000 annotated genes. I then open up a single bigwig file:
bw=pyBigWig.open(args.bigwig)
Then I loop through each line of the bed file. For each entry in the bed, I evaluate the coverage of my bigwig. These are all of the functions I use in total:
tss_covs=bw.values(chrom, tss_pos-n, tss_pos+n, numpy=True)
pA_covs=bw.values(chrom, pA_pos+1-n, pA_pos+n+2, numpy=True)
mid_covs=bw.values(chrom, tss_pos+n, pA_pos+1-n, numpy=True)[indexes.astype(int)]
covs=np.concatenate((tss_covs,mid_covs,pA_covs))
all_covs=np.vstack((all_covs,covs))
I am also using the modules numpy and argparse. Maybe numpy is causing the issue?
from pybigwig.
Ah I have just looked into numpy a bit more. I think the issue is there and I can solve it this way:
export MKL_NUM_THREADS=1
export NUMEXPR_NUM_THREADS=1
export OMP_NUM_THREADS=1
I am sorry for blaming your wonderful project! Thank you for such a quick response.
from pybigwig.
It's quite likely that numpy is causing this, particularly if you've installed it via conda. At the beginning of your script, try adding the following:
import os
# This should force numpy to run single threaded. See issue #697
# This module MUST be imported before numpy
# Note that these environment variables are internal to deepTools (they won't exist on the shell after the command completes)
if 'MKL_NUM_THREADS' not in os.environ:
os.environ['MKL_NUM_THREADS'] = 'sequential'
if 'NUMEXPR_NUM_THREADS' not in os.environ:
os.environ['NUMEXPR_NUM_THREADS'] = '1'
if 'OMP_NUM_THREADS' not in os.environ:
os.environ['OMP_NUM_THREADS'] = '1'
if 'VECLIB_MAXIMUM_THREADS' not in os.environ:
os.environ['VECLIB_MAXIMUM_THREADS'] = '1
I've placed that code at the very beginning of all the deepTools executables to prevent similar issues with numpy.
from pybigwig.
Thanks that's even better! Woo!
from pybigwig.
Related Issues (20)
- RuntimeError: Invalid interval bounds
- Document performance considerations? HOT 4
- Cannot add entries of value type int, but only float HOT 2
- support for osx-arm64 HOT 2
- numpy support broken in 0.3.18? HOT 1
- Create a BedGraph file using addEntries() throws segmentation fault HOT 2
- library import error HOT 4
- pyBigWig fails to find numpy installation when installing from PyPI HOT 5
- Writing a nan value should leave a gap HOT 7
- Can't enforce numpy features when pyBigWig is used as a dependency in downstream package HOT 5
- pip installation broken HOT 4
- Installing through pip not working HOT 9
- addHeader does not support multiple calls HOT 1
- Support for python >=3.11 HOT 1
- Issue Downloading pyBigWig HOT 1
- Simple patch to resolve conflict with roundup() macro
- Stats Sum Not Working as Expected
- 'zsh: segmentation fault ' HOT 1
- Out of memory listing entries on one human chromosome on a machine with 300 GB ram and 165 GB BigBed file HOT 1
- pyBigWig.entries() should return empty array, not None when no entries are found
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pybigwig.