Commit 6d8436ce authored by TomKellyGenetics's avatar TomKellyGenetics
Browse files

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

parents 1ea56838 cfc0faac
Loading
Loading
Loading
Loading
+87 −3
Original line number Original line 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'
  -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.
  -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
  -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
  -p,  --pass                   Skips the FASTQ file conversion if converted files already exist
  -h,  --help                   Display this help and exit
  -h,  --help                   Display this help and exit
  -v,  --version                Output version information and exit
  -v,  --version                Output version information and exit
@@ -107,6 +113,8 @@ reference=""
ncells=""
ncells=""
chemistry=""
chemistry=""
jobmode=""
jobmode=""
ncores=""
mem=""


next=false
next=false
for op in "$@"; do
for op in "$@"; do
@@ -263,6 +271,39 @@ for op in "$@"; do
                exit 1
                exit 1
            fi
            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)
        -p|--pass)
            convert=false
            convert=false
            next=false
            next=false
@@ -517,6 +558,23 @@ elif ! [[ $ncells =~ $int ]] && [[ $setup == "false" ]]; then
    echo "Error: option --force-cells must be an integer"
    echo "Error: option --force-cells must be an integer"
    exit 1
    exit 1
fi
fi
#check if ncores is an integer
ncores='^[0-9]+$'
if [[ -z "$ncells" ]]; 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
    ncells=""
elif ! [[ $ncells =~ $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
#check if chemistry matches expected input
if [[ -z "$chemistry" ]]; then
if [[ -z "$chemistry" ]]; then
@@ -925,9 +983,31 @@ if [[ -n $ncells ]]; then
    n="--force-cells=$ncells"
    n="--force-cells=$ncells"
fi
fi
j=""
j=""
l=""
m=""
if [[ -n $jobmode ]]; then
if [[ -n $jobmode ]]; then
    j="--jobmode=$jobmode"
    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
    fi
else
    if [[ -n $ncores ]]; then
        l="--localcores=$ncores"
    fi
    if [[ -n $mem ]]; then
        m="--localmem=$mem"
     fi
fi

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


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