Changing STAR Parameters in CellRanger
TL;DR
Cell Ranger is a tool that anyone familiar with single cell RNA-seq will know. I had never used it before, but decided to give it a try. However, it internally uses STAR for mapping, and there is a problem (that nobody else seems to mind) where you cannot pass STAR parameters as arguments.
The official answer is essentially: build it yourself, but we take no responsibility for it.
Dockerfile
Let me start by showing the finished product. Here is how I built it. Since we want to modify the source code, I cloned the source code from the official GitHub in advance and placed it in the same directory.
Dependencies
- python2.7.14
- rust 1.28.8
- go 1.11
- clang 6.0
- martian 3.2.5 ?
- Other required binaries (download from the official site)
I wish they would unify the languages. I had never seen martian before, so I was not sure what it was. The Dockerfile ended up being quite large.
Dependency Packages
- numpy
- docopt
These are not mentioned in the README, but you will get errors without them. Also, during make, it complains about missing required files in /usr/include/numpy, so a symbolic link is created.
Environment Variables
You just need to source /cellranger/sourceme.bash and /cellranger/ranger-3.0.2/sourceme.bash. Using ENTRYPOINT would be easier, but I avoided it because I plan to convert it to a Singularity image (does Singularity even interpret ENTRYPOINT?).
Modifying the Source Code
The STAR class is defined at line 439 of cellranger/lib/python/cellranger/reference.py. Cell Ranger uses the align method of this STAR class:
You can add your desired parameters to this args list to successfully change the STAR parameters.