<commit_before>#!/bin/bash

# Copyright (c) 2016 <NAME> <<EMAIL>>
# Distributed under terms of the MIT license.

#Usage statement
usage(){
cat <<EOF

usage: WG_binCov.sh [-h] [-b BINSIZE] [-m MODE] 
                    [-L CONTIGS] [-x BLACKLIST] [-v OVERLAP] 
                    BAM ID OUTDIR

Wrapper for serialized execution of binCov.py across multiple chromosomes

Positional arguments:
  BAM     Input bam
  ID      Sample ID
  OUTDIR  Output directory

Optional arguments:
  -h  HELP         Show this help message and exit
  -b  BINSIZE      Bin size in bp (default: 1000)
  -m  MODE         Evaluate physical or nucleotide coverage (default: nucleotide)
  -L  CONTIGS      List of contigs to evaluate (default: all contigs in bam header)
  -x  BLACKLIST    BED file of regions to ignore
  -v  OVERLAP      Maximum tolerated blacklist overlap before excluding bin

EOF
}


#Parse arguments
binsize=1000
mode=nucleotide
contigs=DEFAULT
blist=NONE
v=0.05
while getopts ":b:m:L:x:v:h" opt; do
	case "$opt" in
		b)
			binsize=${OPTARG}
			;;
		m)
			mode=${OPTARG}
			;;
		L)
			contigs=${OPTARG}
			;;
		x)
			blist=${OPTARG}
			;;
		v)
			v=${OPTARG}
			;;
		h)
			usage
			exit 0
			;;
	esac
done
shift $(( ${OPTIND} - 1))
bam=$1
ID=$2
OUTDIR=$3

#Check positional arguments
if [ -z ${bam} ] || [ -z ${ID} ] || [ -z ${OUTDIR} ]; then
	usage
	exit 0
fi




<commit_msg>Test run self-location in WG_binCov.sh<commit_after>#!/bin/bash

# Copyright (c) 2016 <NAME> <<EMAIL>>
# Distributed under terms of the MIT license.

#Usage statement
usage(){
cat <<EOF

usage: WG_binCov.sh [-h] [-b BINSIZE] [-m MODE] 
                    [-L CONTIGS] [-x BLACKLIST] [-v OVERLAP] 
                    BAM ID OUTDIR

Wrapper for serialized execution of binCov.py across multiple chromosomes

Positional arguments:
  BAM     Input bam
  ID      Sample ID
  OUTDIR  Output directory

Optional arguments:
  -h  HELP         Show this help message and exit
  -b  BINSIZE      Bin size in bp (default: 1000)
  -m  MODE         Evaluate physical or nucleotide coverage (default: nucleotide)
  -L  CONTIGS      List of contigs to evaluate (default: all contigs in bam header)
  -x  BLACKLIST    BED file of regions to ignore
  -v  OVERLAP      Maximum tolerated blacklist overlap before excluding bin

EOF
}

#Parse arguments
binsize=1000
mode=nucleotide
contigs=DEFAULT
blist=NONE
v=0.05
while getopts ":b:m:L:x:v:h" opt; do
	case "$opt" in
		b)
			binsize=${OPTARG}
			;;
		m)
			mode=${OPTARG}
			;;
		L)
			contigs=${OPTARG}
			;;
		x)
			blist=${OPTARG}
			;;
		v)
			v=${OPTARG}
			;;
		h)
			usage
			exit 0
			;;
	esac
done
shift $(( ${OPTIND} - 1))
bam=$1
ID=$2
OUTDIR=$3

#Check positional arguments
if [ -z ${bam} ] || [ -z ${ID} ] || [ -z ${OUTDIR} ]; then
	usage
	exit 0
fi

#Determine list of contigs to use (note: requires samtools)
if [ ${contigs} == "DEFAULT" ]; then
	contigs_list=mktemp
	samtools view -H ${bam} | fgrep -w "@SQ" | awk '{ print $2 }' | cut -d\: -f2 > ${contigs_list}
else
	contigs_list=${contigs}
fi

#Run binCov.py on all contigs
spath=$( readlink -f $0 )
echo ${spath}
#while read contig; do




{'fraction_non_alphanumeric': 0.1206288097529676, 'fraction_numerical': 0.014436958614051972, 'mean_word_length': 2.7074910820451845, 'pattern_counts': {'":': 2, '<': 13, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4062964', 'n_tokens_mistral': 1280, 'n_tokens_neox': 1112, 'n_words': 378}