Commit 746c46bd authored by TomKellyGenetics's avatar TomKellyGenetics
Browse files

replace UMI with work (removes hardcoded barcode length)

parent dd79ebe2
Loading
Loading
Loading
Loading
+29 −22
Original line number Diff line number Diff line
@@ -3221,15 +3221,23 @@ else
             echo "WARNING: removing true UMI and replacing with Mock UMI"
             echo "NOTICE: results will result read counts not UMI"
             echo "## this behaviour is not recommended unless integrating with non-UMI data ##"
             
             #remove inflated umi (to replace with mock and count as reads)
                sed -E '
                    /^(.{11})(.{14})(.*)/ {
                    s/^(.{11})(.{14})(.*)/\1\3/g
             cmd=$(echo 'sed -E "
                             /^(.{'$barcodelength'})(.{'${umilength}'})(.*)/ {
                            s/^(.{'$barcodelength'})(.{'${umilength}'})(.*)/\1\3/g
                            n
                            n
                    s/^(.{11})(.{14})(.*)/\1\3/g
                    }' $convFile > ${crIN}/.temp
                mv ${crIN}/.temp $convFile
                            s/^(.{'$barcodelength'})(.{'${umilength}'})(.*)/\1\3/g
                            }" $convFile > ${crIN}/.temp
                         mv ${crIN}/.temp $convFile')
            if [[ $verbose ]]; then
                 echo technology $technology
                 echo barcode: $barcodelength
                 echo umi: $umilength
                 echo $cmd
             fi
             eval $cmd

             # add mock UMI (count reads instead of UMI) barcodelength=16, umi_default=10
             perl sub/AddMockUMI.pl --fastq=${convR1} --out_dir $crIN --head_length=$barcodelength --umi_length=$umi_default
@@ -3244,7 +3252,6 @@ else
             mv $crIN/mock_UMI.fastq ${convR1}
        fi
    fi
    fi
    
    #UMI
    echo " adjusting UMIs of R1 files"