:78 Function create_function() is deprecated [8192]

some important changes: detect absolute path (so makes possible to be sourced using relative paths); add a 7th argument to process arbitrary organism by indicating the 'defns' file specific to such an organism

Marcelo Ponce [2019-06-30 18:22:32]
some important changes: detect absolute path (so makes possible to be sourced using relative paths); add a 7th argument to process arbitrary organism by indicating the 'defns' file specific to such an organism
Filename
core/countReads.sh
diff --git a/core/countReads.sh b/core/countReads.sh
index 95d6b48..ddb25d0 100755
--- a/core/countReads.sh
+++ b/core/countReads.sh
@@ -36,7 +36,10 @@ if [[ $0 == '-bash' ]]; then
 fi

 # setting preamble, detecting scripts location
-scriptsDIR=`dirname $0`
+scriptDIR=`dirname $0`
+# get the absolute path of RACS...
+scriptsDIR=$( cd "${scriptDIR}" && pwd )
+echo "RACS location... ${scriptsDIR}"

 # load auxiliary fns for integrity checks and message/error handling
 if [[ -f $scriptsDIR/auxs/auxFns.sh ]]; then
@@ -119,6 +122,13 @@ myDIR=$(pwd)
 resultsDIR=$myDIR/ORF_RACS_results-`date '+%Y%m%d-%H%M%S'`	#`date +%D-%T`
 scriptsDIR=`dirname $0`

+## -.-.-.-
+ORGANISM=${7:-"${scriptsDIR}/defns/TT_gene.id"}
+echo "###>>> '${ORGANISM}' to process..."
+checkFile $ORGANISM
+ORGfile=`basename $ORGANISM`
+## -.-.-.-
+

 # use RAMDISK
 #RAMdisk=/dev/shm/$USER/
@@ -132,6 +142,7 @@ cp  -prv $1 $WORKINGdir/$inputFILE1
 cp  -prv $2 $WORKINGdir/$inputFILE2
 cp  -prv $3 $WORKINGdir/$FASTAfile
 cp  -prv $4 $WORKINGdir/$REFfile
+cp  -prv $ORGANISM $WORKINGdir/$ORGfile
 # move to WORKINGdir
 cd $WORKINGdir

@@ -210,8 +221,9 @@ touch $tableINPUTs  #tableReadsINPUT
 # read scaffolds from table generated by the "table" script and loop over the sorted BAM files
 # NEEDS the file "table" generated by the script 'table.sh' // if it doesn't exist, launch its creation in parallel
 ### [ ! -e $resultsDIR/$table ] || $scriptsDIR/table.sh $REFfile && cp -v $resultsDIR/$table .
-$scriptsDIR/table.sh $REFfile
-[ $? -ne 0 ] && errMsg "' $scriptsDIR/table.sh $REFfile' FAILED...! exitcode $?"
+cmdTable="$scriptsDIR/table.sh $REFfile $ORGfile"
+${cmdTable}
+[ $? -ne 0 ] && errMsg "' ${cmdTable} ' FAILED...! exitcode $?"

 for i in `awk '{print $1}' < $table `; do
     #echo $i;
ViewGit