| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | usagescip-shell shell bbmap 39.20+dfsg-3 usage().(){ |
| 4 | echoscip-shell system . . echo. " |
| 5 | Written by Brian Bushnell |
| 6 | Last modified September 15, 2015 |
| 7 | |
| 8 | Description: Counts the number of lines shared between sets of files. |
| 9 | One output file will be printed for each input file. For example, |
| 10 | an output file for a file in the 'in1' set will contain one line per |
| 11 | file in the 'in2' set, indicating how many lines are shared. |
| 12 | |
| 13 | Usage: countsharedlines.sh in1=<file,file...> in2=<file,file...> |
| 14 | |
| 15 | Parameters: |
| 16 | include=f Set to 'true' to include the filtered names rather than excluding them. |
| 17 | prefix=f Allow matching of only the line's prefix (all characters up to first whitespace). |
| 18 | case=t (casesensitive) Match case also. |
| 19 | ow=t (overwrite) Overwrites files that already exist. |
| 20 | app=f (append) Append to files that already exist. |
| 21 | zl=4 (ziplevel) Set compression level, 1 (low) to 9 (max). |
| 22 | |
| 23 | Java Parameters: |
| 24 | -Xmx This will set Java's memory usage, overriding autodetection. |
| 25 | -Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs. |
| 26 | The max is typically 85% of physical memory. |
| 27 | -eoom This flag will cause the process to exit if an out-of-memory |
| 28 | exception occurs. Requires Java 8u92+. |
| 29 | -da Disable assertions. |
| 30 | |
| 31 | Please contact Brian Bushnell at [email protected] if you encounter any problems. |
| 32 | " |
| 33 | } |
| 34 | |
| 35 | #This block allows symlinked shellscripts to correctly set classpath. |
| 36 | pushd . > /dev/nullscip-shell filesystem . . `/dev/null`. |
| 37 | DIR="${BASH_SOURCE[0]}" |
| 38 | while [scip-shell system . . `[`. -h "$DIR" ]; do |
| 39 | cd "$(dirnamescip-shell system . . dirname. "$DIR")" |
| 40 | DIR="$(readlinkscip-shell system . . readlink. "$(basenamescip-shell system . . basename. "$DIR")")" |
| 41 | done |
| 42 | cd "$(dirnamescip-shell system . . dirname. "$DIR")" |
| 43 | DIR="$(pwdscip-shell system . . pwd.)/" |
| 44 | popd > /dev/nullscip-shell filesystem . . `/dev/null`. |
| 45 | |
| 46 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 47 | CP="$DIR""current/" |
| 48 | |
| 49 | z="-Xmx800m" |
| 50 | set=0 |
| 51 | |
| 52 | if [scip-shell system . . `[`. -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 53 | usagescip-shell shell bbmap 39.20+dfsg-3 usage(). |
| 54 | exit |
| 55 | fi |
| 56 | |
| 57 | calcXmxscip-shell shell bbmap 39.20+dfsg-3 calcXmx(). () { |
| 58 | source "$DIR""/calcmem.sh" |
| 59 | setEnvironment |
| 60 | parseXmx "$@" |
| 61 | if [[ $set == 1 ]]; then |
| 62 | return |
| 63 | fi |
| 64 | freeRam 800m 84 |
| 65 | z="-Xmx${RAM}m" |
| 66 | z2="-Xms${RAM}m" |
| 67 | } |
| 68 | calcXmxscip-shell shell bbmap 39.20+dfsg-3 calcXmx(). "$@" |
| 69 | |
| 70 | function countsharedlinesscip-shell shell bbmap 39.20+dfsg-3 countsharedlines().() { |
| 71 | local CMD="java $EA $EOOM $z -cp $CP driver.CountSharedLines $@" |
| 72 | echoscip-shell system . . echo. $CMD >&2 |
| 73 | eval $CMD |
| 74 | } |
| 75 | |
| 76 | countsharedlinesscip-shell shell bbmap 39.20+dfsg-3 countsharedlines(). "$@" |