Commit dd79ebe2 authored by TomKellyGenetics's avatar TomKellyGenetics
Browse files

remove and replace UMI with mock (read-only counts) for any technology

parent 414f6634
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -3215,6 +3215,37 @@ else
        fi
    fi
    
    #replace UMI with mock UMI to count reads (for technologies not already containing mock UMI)
    if [[ $technology != "icell8" ]] && [[ $technology != "ramda-seq" ]] && [[ $technology != "quartz-seq" ]] && [[ $technology != "smartseq" ]] && [[ $technology != "smartseq2" ]] && [[ $technology != "strt-seq" ]]; then
        if [[ $nonUMI ]]; then
             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
                    n
                    n
                    s/^(.{11})(.{14})(.*)/\1\3/g
                    }' $convFile > ${crIN}/.temp
                mv ${crIN}/.temp $convFile

                # 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
                umilength=$umi_default
                umiadjust=0
                if [[ $chemistry == "SC3Pv3"]; then
                    chemistry="SC3Pv2"
                fi
                
                #returns a combined R1 file with barcode and mock UMI
                ## barcode, 10 bp UMI, followed by TSO (if applicable)
                mv $crIN/mock_UMI.fastq ${convR1}
            fi
        fi
    fi
    
    #UMI
    echo " adjusting UMIs of R1 files"
    # check if original UMI is shorter than default