Commit 284cb332 authored by nchernia's avatar nchernia
Browse files

CPU additions for justexact option, no fragment maps by default, changes to...

CPU additions for justexact option, no fragment maps by default, changes to countligations to be consistent across scripts and support multiple enzymes
parent 957de090
Loading
Loading
Loading
Loading
+3 −3
Changes for CPU/common/countligations.sh: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -27,10 +27,10 @@
# Juicer version 1.5
if [ "$usegzip" -eq 1 ]
then 
    num1=$(paste <(zcat $name1$ext) <(zcat $name2$ext) | grep -c $ligation)
    num2=$(zcat ${name1}${ext} | wc -l | awk '{print $1}')
    num1=$(paste <(gunzip -c $name1$ext) <(gunzip -c $name2$ext) | grep -cE $ligation)
    num2=$(gunzip -c ${name1}${ext} | wc -l | awk '{print $1}')
else
    num1=$(paste $name1$ext $name2$ext | grep -c $ligation)
    num1=$(paste $name1$ext $name2$ext | grep -cE $ligation)
    num2=$(wc -l ${name1}${ext} | awk '{print $1}')
fi
echo -ne "$num1 " > ${name}${ext}_norm.txt.res.txt
+6 −0
Changes for CPU/common/dups.awk: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -50,8 +50,14 @@ function optcheck(tile1,tile2,x1,x2,y1,y2) {
# Executed once, before beginning the file read
BEGIN {
	i=0;
	if (length(nowobble) == 0) {
	  wobble1=4;
	  wobble2=4;
	}
	else {
	  wobble1=0;
	  wobble2=0;
	}
	# names of output files
	# the variable "name" can be set via the -v flag
	dupname=name"dups.txt";
+17 −6
Changes for CPU/juicer.sh: 17 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@
shopt -s extglob
export LC_ALL=C

juicer_version="1.5.6" 
juicer_version="1.5.7" 
### LOAD BWA AND SAMTOOLS


@@ -86,10 +86,13 @@ genomeID="hg19"
shortreadend=0
# description, default empty
about=""
nofrag=0
# do not include fragment delimited maps by default
nofrag=1
# use wobble for dedupping by default (not just exact matches)
justexact=0

## Read arguments                                                     
usageHelp="Usage: ${0##*/} [-g genomeID] [-d topDir] [-s site] [-a about] [-R end]\n                 [-S stage] [-p chrom.sizes path] [-y restriction site file]\n                 [-z reference genome file] [-D Juicer scripts directory]\n                 [-b ligation] [-t threads] [-r] [-h] [-x]"
usageHelp="Usage: ${0##*/} [-g genomeID] [-d topDir] [-s site] [-a about] [-R end]\n                 [-S stage] [-p chrom.sizes path] [-y restriction site file]\n                 [-z reference genome file] [-D Juicer scripts directory]\n                 [-b ligation] [-t threads] [-r] [-h] [-f] [-j]"
genomeHelp="* [genomeID] must be defined in the script, e.g. \"hg19\" or \"mm10\" (default \n  \"$genomeID\"); alternatively, it can be defined using the -z command"
dirHelp="* [topDir] is the top level directory (default\n  \"$topDir\")\n     [topDir]/fastq must contain the fastq files\n     [topDir]/splits will be created to contain the temporary split files\n     [topDir]/aligned will be created for the final alignment"
siteHelp="* [site] must be defined in the script, e.g.  \"HindIII\" or \"MboI\" \n  (default \"$site\")"
@@ -103,7 +106,8 @@ scriptDirHelp="* [Juicer scripts directory]: set the Juicer directory,\n which
refSeqHelp="* [reference genome file]: enter path for reference sequence file, BWA index\n  files must be in same directory"
ligationHelp="* [ligation junction]: use this string when counting ligation junctions"
threadsHelp="* [threads]: number of threads when running BWA alignment"
excludeHelp="* -x: exclude fragment-delimited maps from hic file creation"
excludeHelp="* -f: include fragment-delimited maps in hic file creation"
justHelp="* -j: just exact duplicates excluded at dedupping step"
helpHelp="* -h: print this help and exit"

printHelpAndExit() {
@@ -126,7 +130,7 @@ printHelpAndExit() {
    exit "$1"
}

while getopts "d:g:R:a:hrs:p:y:z:S:D:xt:b:" opt; do
while getopts "d:g:R:a:hrs:p:y:z:S:D:fjt:b:" opt; do
    case $opt in
	g) genomeID=$OPTARG ;;
	h) printHelpAndExit 0;;
@@ -140,9 +144,10 @@ while getopts "d:g:R:a:hrs:p:y:z:S:D:xt:b:" opt; do
	z) refSeq=$OPTARG ;;
	S) stage=$OPTARG ;;
	D) juiceDir=$OPTARG ;;
	x) nofrag=1 ;; #no fragment maps
	f) nofrag=0 ;; #use fragment maps
	b) ligation=$OPTARG ;;
        t) threads=$OPTARG ;;
	j) justexact=1 ;;
	[?]) printHelpAndExit 1;;
    esac
done
@@ -503,7 +508,13 @@ then
    touch ${outputdir}/dups.txt
    touch ${outputdir}/optdups.txt
    touch ${outputdir}/merged_nodups.txt
    
    if [ "$justexact" -eq 1 ]
    then
	awk -f ${juiceDir}/scripts/common/dups.awk -v name=${outputdir}/ -v nowobble=1 ${outputdir}/merged_sort.txt
    else
	awk -f ${juiceDir}/scripts/common/dups.awk -v name=${outputdir}/ ${outputdir}/merged_sort.txt
    fi
    # for consistency with cluster naming in split_rmdups
    mv ${outputdir}/optdups.txt ${outputdir}/opt_dups.txt 
fi