Skip to content

Commit

Permalink
miniconda update
Browse files Browse the repository at this point in the history
  • Loading branch information
cziegenhain committed Feb 19, 2020
1 parent b7e9878 commit 22ecf3a
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
zUMIs-env/
zUMIs-miniconda.tar.bz2
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Welcome to zUMIs :wrench: :red_car::dash: :wrench:

## Quickstart
Nobody likes reading long README files so here is how you get going:
Fetch zUMIs by cloning the repository:
```
git clone https://github.com/sdparekh/zUMIs.git`
```
Start anaylysing your data:
```
zUMIs/zUMIs-master.sh -c -y my_config.yaml
```
zUMIs now comes with its own [miniconda](https://docs.conda.io/en/latest/miniconda.html) environment, so you do not need to deal with dependencies or installations (use the -c flag to use conda).
If you wish to use your own dependencies, head to the [zUMIs wiki](https://github.com/sdparekh/zUMIs/wiki/Installation#dependencies) to see what is required.


## Intro
zUMIs is a fast and flexible pipeline to process RNA-seq data with (or without) UMIs.

The input to this pipeline is simply fastq files. In the most common cases, you will have a read containing the cDNA sequence and other read(s) containing UMI and Cell Barcode information. Furthermore, you will need a STAR index for your genome and GTF annotation file.
Expand All @@ -11,9 +26,11 @@ You can read more about zUMIs in our [paper](https://doi.org/10.1093/gigascience
## Loom output
The loom format is increasing in popularity and compatible with downstream analysis using python out of the box.
We provide a script to convert zUMIs output into loom file automatically based on the [loomR package from the Satija lab](https://satijalab.org/loomR/loomR_tutorial.html). Please make sure you have loomR installed.
To convert zUMIs output to loom, simply run `Rscript rds2loom.R myRun.yaml`.
zUMIs will try to automatically do this, otherwise convert zUMIs output to loom by simply running `Rscript rds2loom.R myRun.yaml`.

## Changelog
19 Feb 2020: [zUMIs2.7.0 released](https://github.com/sdparekh/zUMIs/releases/tag/2.7.0): Simplify installation greatly by a cond-pack of miniconda with all dependencies. The conda environment is used with `zUMIs-master.sh -c`, with the old behavior staying as the default.

13 Feb 2020: zUMIs2.6.3: Faster demultiplexing using python/pysam. Made forking of UMI collapse worker threads more robust.

06 Feb 2020: zUMIs2.6.2: Changes to the hamming distance UMI collapse to avoid overcollapsing of highly expressed genes.
Expand Down
2 changes: 1 addition & 1 deletion UMIstuffFUN.R
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ demultiplex_bam <- function(opt, bamfile, nBCs){
dir.create( paste0(opt$out_dir,"/zUMIs_output/demultiplexed/") )
}

installed_py <- system("pip3 freeze", intern = TRUE)
installed_py <- system("pip freeze", intern = TRUE)

if(any(grepl("pysam==",installed_py))){
print("Using python implementation to demultiplex.")
Expand Down
6 changes: 3 additions & 3 deletions misc/rds2loom.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ rds_to_loom <- function(zUMIsRDS){
for(type in names(rds)){
for(quant in names(rds[[type]])){
outfile <- paste0(opt$out_dir,"/zUMIs_output/expression/",opt$project,".",type,".",quant,".all.loom")
loomR::create(filename = outfile, data = as.matrix(rds[[type]][[quant]][["all"]]), transpose = TRUE,overwrite = TRUE)
loomR::create(filename = outfile, data = as.matrix(rds[[type]][[quant]][["all"]]), do.transpose = TRUE,overwrite = TRUE)

for(d in names(rds[[type]][[quant]][["downsampling"]])){
outfile <- paste0(opt$out_dir,"/zUMIs_output/expression/",opt$project,".",type,".",quant,".",d,".loom")
loomR::create(filename = outfile, data = as.matrix(rds[[type]][[quant]][["downsampling"]][[d]]), transpose = TRUE,overwrite = TRUE)
loomR::create(filename = outfile, data = as.matrix(rds[[type]][[quant]][["downsampling"]][[d]]), do.transpose = TRUE,overwrite = TRUE)

}
}
Expand All @@ -46,4 +46,4 @@ checkLoomR() #check for loomR package
rds_loc <- paste0(opt$out_dir,"/zUMIs_output/expression/",opt$project,".dgecounts.rds")
rds_to_loom(rds_loc)

q()
q()
53 changes: 51 additions & 2 deletions zUMIs-master.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Pipeline to run UMI-seq analysis from fastq to read count tables.
# Authors: Swati Parekh, Christoph Ziegenhain, Beate Vieth & Ines Hellmann
# Contact: [email protected] or [email protected]
vers=2.6.3b
vers=2.7.0
currentv=`curl -s https://raw.githubusercontent.com/sdparekh/zUMIs/master/zUMIs-master.sh | grep '^vers=' | cut -f2 -d "="`
if [ "$currentv" != "$vers" ]; then echo -e "------------- \n\n Good news! A newer version of zUMIs is available at https://github.com/sdparekh/zUMIs \n\n-------------"; fi

Expand Down Expand Up @@ -38,6 +38,10 @@ function usage () {
## Program path ##
-d <zUMIs-dir> : Directory containing zUMIs scripts. Default: path to this script.
## Miniconda environment
-c : Use zUMIs dependencies in the preinstalled conda enviroment.
zUMIs version $vers
EOF
Expand All @@ -46,10 +50,12 @@ EOF
# Define the default variables #
zumisdir=$(dirname `readlink -f $0`)

while getopts ":y:d:h" options; do #Putting <:> between keys implies that they can not be called without an argument.

while getopts ":y:d:ch" options; do #Putting <:> between keys implies that they can not be called without an argument.
case $options in
y ) yaml=$OPTARG;;
d ) zumisdir=$OPTARG;;
c ) conda=true;;
h ) usage
exit 1;;
\? ) echo -e "\n This key is not available! Please check the usage again: -$OPTARG"
Expand Down Expand Up @@ -109,6 +115,43 @@ if grep -q 'Rscript_exec:' $yaml
echo "Rscript_exec: $Rexc" >> $yaml
fi

#check for conda usage!
if [[ $conda = true ]]; then
echo "Using miniconda environment for zUMIs!"
samtoolsexc=samtools
if grep -q 'samtools_exec:' $yaml; then
sed -i '/samtools_exec:/d' $yaml
fi
echo "samtools_exec: $samtoolsexc" >> $yaml
pigzexc=pigz
if grep -q 'pigz_exec:' $yaml; then
sed -i '/pigz_exec:/d' $yaml
fi
echo "pigz_exec: $pigzexc" >> $yaml
starexc=STAR
if grep -q 'STAR_exec:' $yaml; then
sed -i '/STAR_exec:/d' $yaml
fi
echo "STAR_exec: $starexc" >> $yaml
Rexc=Rscript
if grep -q 'Rscript_exec:' $yaml; then
sed -i '/Rscript_exec:/d' $yaml
fi
echo "Rscript_exec: $Rexc" >> $yaml

zumisenv=$zumisdir/zUMIs-env
miniconda=$zumisdir/zUMIs-miniconda.tar.bz2
#check if zUMIs environment has been unpacked from tar
if [[ ! -d $zumisenv ]] || [[ $zumisdir/zUMIs-miniconda.partaa -nt $zumisenv ]] ; then
[ -d $zumisenv ] || mkdir -p $zumisenv
cat $zumisdir/zUMIs-miniconda.parta* > $miniconda
tar -xj --overwrite -f $miniconda -C $zumisenv
fi
#activate zUMIs environment!
source $zumisenv/bin/activate
conda-unpack
fi

if grep -q 'zUMIs_directory:' $yaml
then
sed -i "s|zUMIs_directory:.*|zUMIs_directory: $zumisdir|" $yaml
Expand Down Expand Up @@ -261,3 +304,9 @@ then
fi
date
fi


#close conda enviroment if necessary
if [ $conda = true ]; then
source $zumisenv/bin/deactivate
fi

0 comments on commit 22ecf3a

Please sign in to comment.