Commit 93dbe42e authored by kai.b's avatar kai.b
Browse files

Merge branch 'master' of dgt-gitlab.gsc.riken.jp:tom/cellranger_convert into dgt/kai

parents 660e5ef5 94409414
Loading
Loading
Loading
Loading

CHANGELOG

0 → 100644
+40 −0
Original line number Diff line number Diff line

### 0.2.2

allow passing custom barcode whitelists

### 0.2.1

locate script directory

implement lock file to prevent multi technologies running

track last technology ran

### 0.2.0

add support for SGE mode

correct passing description arguments to cellranger

separate whitelist setup for Nadia and iCELL8

configure cellranger version 3 whitelists

add defaults

detect lane and file names

create directory for converted R1sq

### 0.1.0

pass arguments to script

add set up call to configure whitelist when needed

includes a manual and version call

detects input file

converts files if technology other than 10x
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
### UniverSC version 0.2.0
### UniverSC version 0.2.2

Conversion script to run Nadia and iCELL8 libraries with cellranger (10x Genomics analysis tool)

+95 −6
Original line number Diff line number Diff line
@@ -62,6 +62,12 @@ Mandatory arguments to long options are mandatory for short options too.
  -c,  --chemistry CHEM         Assay configuration, autodetection is not possible for converted files: 'SC3Pv2' (default), 'SC5P-PE', or 'SC5P-R2'
  -n,  --force-cells NUM        Force pipeline to use this number of cells, bypassing the cell detection algorithm.
  -j,  --jobmode MODE           Job manager to use. Valid options: 'local' (default), 'sge', 'lsf', or a .template file
       --localcores=NUM         Set max cores the pipeline may request at one time.
                                    Only applies when --jobmode=local.
       --localmem=NUM           Set max GB the pipeline may request at one time.
                                    Only applies when --jobmode=local.
       --mempercore=NUM         Set max GB each job may use at one time.
                                    Only applies in cluster jobmodes.
  -p,  --pass                   Skips the FASTQ file conversion if converted files already exist
  -h,  --help                   Display this help and exit
  -v,  --version                Output version information and exit
@@ -107,6 +113,8 @@ reference=""
ncells=""
chemistry=""
jobmode=""
ncores=""
mem=""

next=false
for op in "$@"; do
@@ -263,6 +271,39 @@ for op in "$@"; do
                exit 1
            fi
            ;;
           --localcores)
             shift
             if [[ "$1" != "" ]]; then
                 ncores="${1/%\//}"
                 next=true
                 shift
             else
                 echo "Error: value missing for --localcores"
                 exit 1
             fi
             ;;
           --localmem)
             shift
             if [[ "$1" != "" ]]; then
                 mem="${1/%\//}"
                 next=true
                 shift
             else
                 echo "Error: value missing for --localmem"
                 exit 1
             fi
             ;;
            --mempercore)
             shift
             if [[ "$1" != "" ]]; then
                 mem="${1/%\//}"
                 next=true
                 shift
             else
                 echo "Error: value missing for --mempercore"
                 exit 1
             fi
             ;;
        -p|--pass)
            convert=false
            next=false
@@ -517,6 +558,23 @@ elif ! [[ $ncells =~ $int ]] && [[ $setup == "false" ]]; then
    echo "Error: option --force-cells must be an integer"
    exit 1
fi
#check if ncores is an integer
int='^[0-9]+$'
if [[ -z "$ncores" ]]; then
    ncores=""
elif ! [[ $ncores =~ $int ]] && [[ $setup == "false" ]]; then
    echo "Error: option --localcores must be an integer"
    exit 1
fi
#check if mem is a number
int='^[0-9]+([.][0-9]+)?$'
if [[ -z "$mem" ]]; then
    mem=""
elif ! [[ $mem =~ $int ]] && [[ $setup == "false" ]]; then
    echo "Error: option --localmem or --mempercore must be a number (of GB)"
    exit 1
fi


#check if chemistry matches expected input
if [[ -z "$chemistry" ]]; then
@@ -572,10 +630,12 @@ else
    echo "checking .lock file"
    lock=`cat $lockfile`
    
    if [[ $lock -eq 0 ]]; then
    if [[ $lock -le 0 ]]; then
        echo " call accepted: no other cellranger jobs running"
        lock=1
        if [[ $setup == false ]]; then 
             echo $lock > $lockfile
        fi
    else
        if [[ -f $lastcallfile ]]; then
            echo " total of $lock cellranger ${VERSION} jobs already running in ${DIR} with technology $lastcall"
@@ -590,7 +650,9 @@ else
                echo " call accepted: no conflict detected with other jobs currently running"
                #add current job to lock
                lock=$(($lock+1))
                if [[ $setup == false ]]; then 
                    echo $lock > $lockfile
                fi
                setup=false
            else
                echo "Error: conflict between technology selected for the new job ($technology) and other jobs currently running ($lastcall)"
@@ -819,6 +881,7 @@ if [[ $setup == "true" ]]; then
        echo $technology > $lastcallfile
    fi
    cd -
    exit 0
    echo "setup complete"
fi

@@ -925,9 +988,31 @@ if [[ -n $ncells ]]; then
    n="--force-cells=$ncells"
fi
j=""
l=""
m=""
if [[ -n $jobmode ]]; then
    j="--jobmode=$jobmode"
    if [[ $jobmode == "local" ]]; then
        if [[ -n $ncores ]]; then
            l="--localcores=$ncores"
        fi
        if [[ -n $mem ]]; then
           m="--localmem=$mem"
        fi
    else
         if [[ -n $mem ]]; then
             m="--mempercore=$mem"
         fi
    fi
else
    if [[ -n $ncores ]]; then
        l="--localcores=$ncores"
    fi
    if [[ -n $mem ]]; then
        m="--localmem=$mem"
     fi
fi

start=`date +%s`
echo "cellranger count --id=$id \
        --fastqs=$crIN \
@@ -938,7 +1023,9 @@ echo "cellranger count --id=$id \
        --sample=$SAMPLE \
        $d \
        $n \
        $j
        $j \
        $l \
        $m
"

cellranger count --id=$id \
@@ -950,7 +1037,9 @@ cellranger count --id=$id \
        --sample=$SAMPLE \
        $d \
        $n \
        $j
        $j \
        $l \
        $m
#        --noexit
#        --nopreflight
end=`date +%s`