Commit d576f87d authored by TomKellyGenetics's avatar TomKellyGenetics
Browse files

Merge branch 'dev' of github.com:kbattenb/universc into dev

parents 9d2c7607 ebc55103
Loading
Loading
Loading
Loading
+69 −58
Original line number Original line Diff line number Diff line
@@ -1066,13 +1066,14 @@ if [[ $setup == "false" ]]; then
fi
fi


if [[ $verbose ]]; then
if [[ $verbose ]]; then
    echo "  ${#read1[@]} read1s: ${read1[@]}"
    echo " Input files prost-curation 1"
    echo "  ${#read2[@]} read2s: ${read2[@]}"
    echo "  ${#read1[@]}files - read1s: ${read1[@]}"
    echo "  ${#read2[@]}files - read2s: ${read2[@]}"
    if [[ ${#index1[@]} -gt 0 ]]; then
    if [[ ${#index1[@]} -gt 0 ]]; then
        echo "  ${#index1[@]} I1s: ${index1[@]}"
        echo "  ${#index1[@]}files - I1s: ${index1[@]}"
    fi
    fi
    if [[ ${#index2[@]} -gt 0 ]]; then
    if [[ ${#index2[@]} -gt 0 ]]; then
        echo "  ${#index2[@]} I2s: ${index2[@]}"
        echo "  ${#index2[@]}files - I2s: ${index2[@]}"
    fi
    fi
    echo "  number of these files are as expected"
    echo "  number of these files are as expected"
fi
fi
@@ -1172,13 +1173,14 @@ for key in ${keys[@]}; do
done
done


if [[ $verbose ]]; then
if [[ $verbose ]]; then
    echo "  ${#read1[@]} read1s: ${read1[@]}"
    echo " Input files post-curation 2"
    echo "  ${#read2[@]} read2s: ${read2[@]}"
    echo "  ${#read1[@]}files - read1s: ${read1[@]}"
    echo "  ${#read2[@]}files - read2s: ${read2[@]}"
    if [[ ${#index1[@]} -gt 0 ]]; then
    if [[ ${#index1[@]} -gt 0 ]]; then
        echo "  ${#index1[@]} I1s: ${index1[@]}"
        echo "  ${#index1[@]}files - I1s: ${index1[@]}"
    fi
    fi
    if [[ ${#index2[@]} -gt 0 ]]; then
    if [[ ${#index2[@]} -gt 0 ]]; then
        echo "  ${#index2[@]} I2s: ${index2[@]}"
        echo "  ${#index2[@]}files -  I2s: ${index2[@]}"
    fi
    fi
    echo "  files exist, with extentions compatible with launch_universc.sh"
    echo "  files exist, with extentions compatible with launch_universc.sh"
fi
fi
@@ -1359,13 +1361,14 @@ for key in ${keys[@]}; do
done
done


if [[ $verbose ]]; then
if [[ $verbose ]]; then
    echo "  ${#read1[@]} read1s: ${read1[@]}"
    echo " Input files post-curation 3"
    echo "  ${#read2[@]} read2s: ${read2[@]}"
    echo "  ${#read1[@]}files - read1s: ${read1[@]}"
    echo "  ${#read2[@]}files - read2s: ${read2[@]}"
    if [[ ${#index1[@]} -gt 0 ]]; then
    if [[ ${#index1[@]} -gt 0 ]]; then
        echo "  ${#index1[@]} I1s: ${index1[@]}"
        echo "  ${#index1[@]}files - I1s: ${index1[@]}"
    fi
    fi
    if [[ ${#index2[@]} -gt 0 ]]; then
    if [[ ${#index2[@]} -gt 0 ]]; then
        echo "  ${#index2[@]} I2s: ${index2[@]}"
        echo "  ${#index2[@]}files - I2s: ${index2[@]}"
    fi
    fi
    echo "  names of these files are compatible with launch_universc.sh"
    echo "  names of these files are compatible with launch_universc.sh"
fi
fi
@@ -1536,13 +1539,14 @@ if [[ "$technology" == "indrop-v2" ]] || [[ "$technology" == "indrop-v3" ]] || [
fi
fi


if [[ $verbose ]]; then
if [[ $verbose ]]; then
    echo "  ${#read1[@]} read1s: ${read1[@]}"
    echo " Input files post-curation 4"
    echo "  ${#read2[@]} read2s: ${read2[@]}"
    echo "  ${#read1[@]}files - read1s: ${read1[@]}"
    echo "  ${#read2[@]}files - read2s: ${read2[@]}"
    if [[ ${#index1[@]} -gt 0 ]]; then
    if [[ ${#index1[@]} -gt 0 ]]; then
        echo "  ${#index1[@]} I1s: ${index1[@]}"
        echo "  ${#index1[@]}files - I1s: ${index1[@]}"
    fi
    fi
    if [[ ${#index2[@]} -gt 0 ]]; then
    if [[ ${#index2[@]} -gt 0 ]]; then
        echo "  ${#index2[@]} I2s: ${index2[@]}"
        echo "  ${#index2[@]}files -  I2s: ${index2[@]}"
    fi
    fi
    echo "  input files adjusted for technology-specific conditions"
    echo "  input files adjusted for technology-specific conditions"
fi
fi
@@ -1560,12 +1564,12 @@ elif [[ ${#index1[@]} -gt 0 ]]; then
fi
fi


if [[ $verbose ]]; then
if [[ $verbose ]]; then
    echo "reads:" ${read12[@]}
    echo "files to be curated:" ${read12[@]}
fi
fi


for fq in "${read12[@]}"; do
for fq in "${read12[@]}"; do
    if [[ $verbose ]]; then
    if [[ $verbose ]]; then
        echo "read: $fq"
        echo " read file: $fq"
    fi
    fi
    name=`basename $fq`
    name=`basename $fq`
    name=${name%.*}
    name=${name%.*}
@@ -1590,13 +1594,16 @@ for fq in "${read12[@]}"; do
        exit 1
        exit 1
    fi
    fi
    
    
    if [[ $verbose == true ]]; then
    if [[ $verbose ]]; then
       echo "SAMPLE: $SAMPLE"
        echo "  $sn(extracted from file) <- $fq"
       echo "sample (field): $sn"
        echo "  SAMPLE NAME: $SAMPLE"
    fi
    fi


    if [[ ${sn} != $SAMPLE ]]; then
    if [[ ${sn} != $SAMPLE ]]; then
        if [[ -z $SAMPLE ]]; then
        if [[ -z $SAMPLE ]]; then
            if [[ $verbose ]]; then
                echo "  setting SAMPLE NAME to ${sn}"
            fi
            SAMPLE=${sn}
            SAMPLE=${sn}
        else
        else
            echo "Error: some samples are labeled $SAMPLE while others are labeled $sn. cellranger can only handle files from one sample at a time."
            echo "Error: some samples are labeled $SAMPLE while others are labeled $sn. cellranger can only handle files from one sample at a time."
@@ -1832,7 +1839,7 @@ fi






#####check if reference is present#####
####check if reference is present#####
if [[ -z $reference ]]; then
if [[ -z $reference ]]; then
    if [[ $setup == "false" ]] || [[ ${#read1[@]} -ne 0 ]] || [[ ${#read2[@]} -ne 0 ]]; then
    if [[ $setup == "false" ]] || [[ ${#read1[@]} -ne 0 ]] || [[ ${#read2[@]} -ne 0 ]]; then
        echo "Error: option --reference is required";
        echo "Error: option --reference is required";
@@ -1935,6 +1942,7 @@ crIN=${crIN}_${id}
##########
##########





#####checking if crIN exists#####
#####checking if crIN exists#####
if [[ ! -d $crIN ]]; then
if [[ ! -d $crIN ]]; then
    convert=true
    convert=true
@@ -2107,6 +2115,7 @@ if [[ $lock -eq 0 ]]; then
            sed -i "s/assert np.array_equal(in_mc.get_barcodes(), barcodes)/#assert np.array_equal(in_mc.get_barcodes(), barcodes)/g" ${cellrangerpath}-cs/${cellrangerversion}/lib/python/cellranger/molecule_counter.py
            sed -i "s/assert np.array_equal(in_mc.get_barcodes(), barcodes)/#assert np.array_equal(in_mc.get_barcodes(), barcodes)/g" ${cellrangerpath}-cs/${cellrangerversion}/lib/python/cellranger/molecule_counter.py
        fi
        fi
    fi
    fi
    
    #backup 10x navbar
    #backup 10x navbar
    if [[ ! -f ${cellrangerpath}-cs/${cellrangerversion}/lib/python/cellranger/webshim/template/navbar.backup.html ]];then
    if [[ ! -f ${cellrangerpath}-cs/${cellrangerversion}/lib/python/cellranger/webshim/template/navbar.backup.html ]];then
        cp ${cellrangerpath}-cs/${cellrangerversion}/lib/python/cellranger/webshim/template/navbar.html ${cellrangerpath}-cs/${cellrangerversion}/lib/python/cellranger/webshim/template/navbar.backup.html
        cp ${cellrangerpath}-cs/${cellrangerversion}/lib/python/cellranger/webshim/template/navbar.html ${cellrangerpath}-cs/${cellrangerversion}/lib/python/cellranger/webshim/template/navbar.backup.html
@@ -2120,6 +2129,7 @@ if [[ $lock -eq 0 ]]; then
        if [[ -f ${cellrangerpath}-cs/${cellrangerversion}/lib/python/cellranger/webshim/template/navbar.backup.html ]];then
        if [[ -f ${cellrangerpath}-cs/${cellrangerversion}/lib/python/cellranger/webshim/template/navbar.backup.html ]];then
            cp ${cellrangerpath}-cs/${cellrangerversion}/lib/python/cellranger/webshim/template/navbar.backup.html ${cellrangerpath}-cs/${cellrangerversion}/lib/python/cellranger/webshim/template/navbar.html
            cp ${cellrangerpath}-cs/${cellrangerversion}/lib/python/cellranger/webshim/template/navbar.backup.html ${cellrangerpath}-cs/${cellrangerversion}/lib/python/cellranger/webshim/template/navbar.html
        fi
        fi
        
        #restore cloupe generation
        #restore cloupe generation
        if [[ $verbose ]]; then
        if [[ $verbose ]]; then
            echo "restore cloupe" 
            echo "restore cloupe" 
@@ -2134,6 +2144,7 @@ if [[ $lock -eq 0 ]]; then
            echo "sed -i '/out cloupe *cloupe/ {s/^#*#//g}' ${cellrangerpath}-cs/${cellrangerversion}/mro/*mro"
            echo "sed -i '/out cloupe *cloupe/ {s/^#*#//g}' ${cellrangerpath}-cs/${cellrangerversion}/mro/*mro"
        fi
        fi
        sed -i '/out cloupe *cloupe/ {s/^#*#//g}' ${cellrangerpath}-cs/${cellrangerversion}/mro/*mro
        sed -i '/out cloupe *cloupe/ {s/^#*#//g}' ${cellrangerpath}-cs/${cellrangerversion}/mro/*mro
        
        #restore 11 lines for cloupe preprocess call (all following steps are needed to be called together or the call will break)
        #restore 11 lines for cloupe preprocess call (all following steps are needed to be called together or the call will break)
        ##restore defining CLOUPE_PREPROCESS
        ##restore defining CLOUPE_PREPROCESS
        if [[ $verbose ]]; then
        if [[ $verbose ]]; then
@@ -2144,8 +2155,7 @@ if [[ $lock -eq 0 ]]; then
        sed -i '/output_for_cloupe/s/^#*#//g' ${cellrangerpath}-cs/${cellrangerversion}/mro/*mro 
        sed -i '/output_for_cloupe/s/^#*#//g' ${cellrangerpath}-cs/${cellrangerversion}/mro/*mro 
        ##remove calling CLOUPE_PREPROCESS
        ##remove calling CLOUPE_PREPROCESS
        ### iterate over all files calling CLOUPE_PREPROCESS
        ### iterate over all files calling CLOUPE_PREPROCESS
        for file in $(grep -l  "call CLOUPE_PREPROCESS"  ${cellrangerpath}-cs/${cellrangerversion}/mro/*.mro )
        for file in $(grep -l  "call CLOUPE_PREPROCESS"  ${cellrangerpath}-cs/${cellrangerversion}/mro/*.mro ); do
        do
            #find  start of CLOUPE_PREPROCESS call
            #find  start of CLOUPE_PREPROCESS call
            num=$(grep -n "call CLOUPE_PREPROCESS" $file |  head -n 1 | cut -d":" -f1)
            num=$(grep -n "call CLOUPE_PREPROCESS" $file |  head -n 1 | cut -d":" -f1)
            #find end of CLOUPE_PREPROCESS call
            #find end of CLOUPE_PREPROCESS call
@@ -2161,6 +2171,7 @@ if [[ $lock -eq 0 ]]; then
            #line of HTML in header is removed
            #line of HTML in header is removed
            sed '/class="logo"/d' ${cellrangerpath}-cs/${cellrangerversion}/lib/python/cellranger/webshim/template/navbar.backup.html > ${cellrangerpath}-cs/${cellrangerversion}/lib/python/cellranger/webshim/template/navbar.html
            sed '/class="logo"/d' ${cellrangerpath}-cs/${cellrangerversion}/lib/python/cellranger/webshim/template/navbar.backup.html > ${cellrangerpath}-cs/${cellrangerversion}/lib/python/cellranger/webshim/template/navbar.html
        fi
        fi
        
        #disable cloupe generation
        #disable cloupe generation
        if [[ $verbose ]]; then
        if [[ $verbose ]]; then
            echo "disable cloupe"
            echo "disable cloupe"