changeset 10:12f377f170c2 draft

Uploaded
author bitlab
date Wed, 18 Nov 2020 08:23:04 +0000
parents aec70bb1ae27
children cf4c0c822ca9
files gecko/bin/workflow.sh gecko/src/Makefile
diffstat 2 files changed, 88 insertions(+), 71 deletions(-) [+]
line wrap: on
line diff
--- a/gecko/bin/workflow.sh	Wed Nov 18 08:08:25 2020 +0000
+++ b/gecko/bin/workflow.sh	Wed Nov 18 08:23:04 2020 +0000
@@ -2,28 +2,38 @@
 
 FL=1000   # frequency limit
 
-if [ $# != 6 ]; then
+if [ $# != 8 ]; then
    echo " ==== ERROR ... you called this script inappropriately."
    echo ""
-   echo "   usage:  $0 seqXName seqYName lenght similarity WL fixedL"
+   echo "   usage:  $0 seqXName seqYName lenght similarity WL fixedL output.frags output.csv"
    echo ""
    exit -1
 fi
 
+
 {
 
-dirNameX=$(readlink -f $1 | xargs dirname)
-seqXName=$(basename "$1")
-extensionX="${seqXName##*.}"
-seqXName="${seqXName%.*}"
+
+MYRAND=$((( RANDOM % 10000000) +1))
+MGDIR=${PWD}/${MYRAND}
+echo "MGDIR $MGDIR"
+mkdir -p ${MGDIR}
+
+genoXname=$(basename "$1")
+genoYname=$(basename "$2")
+genoXname="${genoXname%.*}"
+genoYname="${genoYname%.*}"
 
-dirNameY=$(readlink -f $2 | xargs dirname)
-seqYName=$(basename "$2")
-extensionY="${seqYName##*.}"
-seqYName="${seqYName%.*}"
 
-#seqXName=`basename $1 .fasta`
-#seqYName=`basename $2 .fasta`
+cp $1 $MGDIR/${genoXname}.fasta
+cp $2 $MGDIR/${genoYname}.fasta
+mkdir -p ${MGDIR}/dictionaries
+mkdir -p ${MGDIR}/fragments
+
+genoXExt="fasta"
+genoYExt="fasta"
+
+
 
 BINDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 
@@ -31,40 +41,42 @@
 similarity=${4}
 WL=${5} # wordSize
 fixedL=${6}
-strand=${7}
+output=${7}
+csv=${8}
 
-mkdir intermediateFiles
+mkdir ${MGDIR}/intermediateFiles
 
-mkdir intermediateFiles/${seqXName}-${seqYName}
-mkdir results
-mkdir intermediateFiles/dictionaries
-mkdir intermediateFiles/hits
+mkdir ${MGDIR}/intermediateFiles/${genoXname}-${genoYname}
+mkdir ${MGDIR}/results
+mkdir ${MGDIR}/intermediateFiles/dictionaries
+mkdir ${MGDIR}/intermediateFiles/hits
 
 # Copiamos los fastas
-ln -s ${dirNameX}/${seqXName}.${extensionX} intermediateFiles/${seqXName}-${seqYName}
-ln -s ${dirNameY}/${seqYName}.${extensionY} intermediateFiles/${seqXName}-${seqYName}
+ln -s ${MGDIR}/${genoXname}.${genoXname} ${MGDIR}/intermediateFiles/${genoXname}-${genoYname}
+ln -s ${MGDIR}/${genoYname}.${genoYname} ${MGDIR}/intermediateFiles/${genoYname}-${genoXname}
 
-cd intermediateFiles/${seqXName}-${seqYName}
+cd ${MGDIR}/intermediateFiles/${genoXname}-${genoYname}
 
 ###############
 
 
-echo "${BINDIR}/reverseComplement ${seqYName}.${extensionX} ${seqYName}-revercomp.${extensionY}"
-${BINDIR}/reverseComplement ${seqYName}.${extensionX} ${seqYName}-revercomp.${extensionY}
+
+echo "${BINDIR}/reverseComplement ${MGDIR}/${genoYname}.${genoXExt} ${genoYname}-revercomp.${genoYExt}"
+${BINDIR}/reverseComplement ${MGDIR}/${genoYname}.${genoYExt} ${MGDIR}/${genoYname}-revercomp.${genoYExt}
 
-if [[ ! -f ../dictionaries/${seqXName}.d2hP ]];	then
-	echo "${BINDIR}/dictionary.sh ${seqXName}.${extensionX} &"
-	${BINDIR}/dictionary.sh ${seqXName}.${extensionX} &		
+if [[ ! -f ../dictionaries/${genoXname}.d2hP ]];	then
+	echo "${BINDIR}/dictionary.sh ${MGDIR}/${genoXname}.${genoXExt} &"
+	${BINDIR}/dictionary.sh ${MGDIR}/${genoXname}.${genoXExt} &		
+fi
+
+if [[ ! -f ../dictionaries/${seqYName}.d2hP ]];	then
+	echo "${BINDIR}/dictionary.sh ${MGDIR}/${genoYname}.${genoYExt} &"
+	${BINDIR}/dictionary.sh ${MGDIR}/${genoYname}.${genoYExt} &
 fi
 		
-if [[ ! -f ../dictionaries/${seqYName}.d2hP ]];	then
-	echo "${BINDIR}/dictionary.sh ${seqYName}.${extensionY} &"
-	${BINDIR}/dictionary.sh ${seqYName}.${extensionY} &
-fi
-		
-if [[ ! -f ../dictionaries/${seqYName}-revercomp.d2hP ]];	then
-	echo "${BINDIR}/dictionary.sh ${seqYName}-revercomp.${extensionY} &"
-	${BINDIR}/dictionary.sh ${seqYName}-revercomp.${extensionY} &
+if [[ ! -f ../dictionaries/${genoYname}-revercomp.d2hP ]];	then
+	echo "${BINDIR}/dictionary.sh ${MGDIR}/${genoYname}-revercomp.${genoYExt} &"
+	${BINDIR}/dictionary.sh ${MGDIR}/${genoYname}-revercomp.${genoYExt} &
 fi		
 
 echo "Waiting for the calculation of the dictionaries"
@@ -76,28 +88,31 @@
 done
 
 
-mv ${seqXName}.d2hP ../dictionaries/
-mv ${seqXName}.d2hW ../dictionaries/
-mv ${seqYName}.d2hP ../dictionaries/
-mv ${seqYName}.d2hW ../dictionaries/
-mv ${seqYName}-revercomp.d2hP ../dictionaries/
-mv ${seqYName}-revercomp.d2hW ../dictionaries/
+
+mv ${genoXname}.d2hP ../dictionaries/
+mv ${genoXname}.d2hW ../dictionaries/
+mv ${genoYname}.d2hP ../dictionaries/
+mv ${genoYname}.d2hW ../dictionaries/
+mv ${genoYname}-revercomp.d2hP ../dictionaries/
+mv ${genoYname}-revercomp.d2hW ../dictionaries/
+
+
 		
 # Hacemos enlace simbolico
-ln -s ../dictionaries/${seqXName}.d2hP .
-ln -s ../dictionaries/${seqXName}.d2hW .
+ln -s ../dictionaries/${genoXname}.d2hP .
+ln -s ../dictionaries/${genoXname}.d2hW .
 
-ln -s ../dictionaries/${seqYName}.d2hP .
-ln -s ../dictionaries/${seqYName}.d2hW .
+ln -s ../dictionaries/${genoYname}.d2hP .
+ln -s ../dictionaries/${genoYname}.d2hW .
 
-ln -s ../dictionaries/${seqYName}-revercomp.d2hP .
-ln -s ../dictionaries/${seqYName}-revercomp.d2hW .
+ln -s ../dictionaries/${genoYname}-revercomp.d2hP .
+ln -s ../dictionaries/${genoYname}-revercomp.d2hW .
 
-echo "${BINDIR}/comparison.sh ${seqXName}.${extensionX} ${seqYName}.${extensionY} ${length} ${similarity} ${WL} ${fixedL} f &"
-${BINDIR}/comparison.sh ${seqXName}.${extensionX} ${seqYName}.${extensionY} ${length} ${similarity} ${WL} ${fixedL} f &
+echo "${BINDIR}/comparison.sh ${MGDIR}/${genoXname}.${genoXExt} ${MGDIR}/${genoYname}.${genoYExt} ${length} ${similarity} ${WL} ${fixedL} f &"
+${BINDIR}/comparison.sh ${MGDIR}/${genoXname}.${genoXExt} ${MGDIR}/${genoYname}.${genoYExt} ${length} ${similarity} ${WL} ${fixedL} f &
 
-echo "${BINDIR}/comparison.sh ${seqXName}.${extensionX} ${seqYName}-revercomp.${extensionY} ${length} ${similarity} ${WL} ${fixedL} r &"
-${BINDIR}/comparison.sh ${seqXName}.${extensionX} ${seqYName}-revercomp.${extensionY} ${length} ${similarity} ${WL} ${fixedL} r &
+echo "${BINDIR}/comparison.sh ${MGDIR}/${genoXname}.${genoXExt} ${MGDIR}/${genoYname}-revercomp.${genoYExt} ${length} ${similarity} ${WL} ${fixedL} r &"
+${BINDIR}/comparison.sh ${MGDIR}/${genoXname}.${genoXExt} ${MGDIR}/${genoYname}-revercomp.${genoYExt} ${length} ${similarity} ${WL} ${fixedL} r &
 
 echo "Waiting for the comparisons"
 
@@ -107,45 +122,47 @@
     wait $job
 done
 
+
 #echo "rm ${seqYName}-revercomp.${extensionY}"
 #rm ${seqYName}-revercomp.${extensionY}
 
-echo "${BINDIR}/combineFrags ${seqXName}-${seqYName}-sf.frags ${seqXName}-${seqYName}-revercomp-sr.frags ${seqXName}-${seqYName}.frags"
-${BINDIR}/combineFrags ${seqXName}-${seqYName}-sf.frags ${seqXName}-${seqYName}-revercomp-sr.frags ${seqXName}-${seqYName}.frags
 
-#echo "${BINDIR}/newFragToBalazsVersion ${seqXName}-${seqYName}.frags ${seqXName}-${seqYName}.old.frags"
-#${BINDIR}/newFragToBalazsVersion ${seqXName}-${seqYName}.frags ${seqXName}-${seqYName}.old.frags
-
-#echo "${BINDIR}/af2pngrev ${seqXName}-${seqYName}.frags ${seqXName}-${seqYName}.png ${seqXName} ${seqYName}"
-#${BINDIR}/af2pngrev ${seqXName}-${seqYName}.frags ${seqXName}-${seqYName}.png ${seqXName} ${seqYName}
+echo "${BINDIR}/combineFrags ${genoXname}-${genoYname}-sf.frags ${genoXname}-${genoYname}-revercomp-sr.frags ${genoXname}-${genoYname}.frags"
+${BINDIR}/combineFrags ${genoXname}-${genoYname}-sf.frags ${genoXname}-${genoYname}-revercomp-sr.frags ${genoXname}-${genoYname}.frags
 
 #Borramos todo menos los frags y los diccionarios
 
 # Get Info from frags 
-echo "${BINDIR}/getInfo ${seqXName}-${seqYName}.frags > ${seqXName}-${seqYName}.csv"
-${BINDIR}/getInfo ${seqXName}-${seqYName}.frags > ${seqXName}-${seqYName}.csv.tmp
-cat ${seqXName}-${seqYName}.frags.INF ${seqXName}-${seqYName}.csv.tmp > ${seqXName}-${seqYName}.csv
-rm -rf ${seqXName}-${seqYName}.csv.tmp
+echo "${BINDIR}/getInfo ${genoXname}-${genoYname}.frags > ${genoXname}-${genoYname}.csv"
+${BINDIR}/getInfo ${genoXname}-${genoYname}.frags > ${genoXname}-${genoYname}.csv.tmp
+cat ${genoXname}-${genoYname}.frags.INF ${genoXname}-${genoYname}.csv.tmp > ${genoXname}-${genoYname}.csv
+rm -rf ${genoXname}-${genoYname}.csv.tmp
 	
-if [[ -L "../../${seqXName}.fasta" ]]
+if [[ -L "../../${genoXname}.fasta" ]]
 then
-	rm ../../${seqXName}.fasta
+	rm ../../${genoYname}.fasta
 fi
 
-if [[ -L "../../${seqYName}.fasta" ]]
+if [[ -L "../../${genoXname}.fasta" ]]
 then
-	rm ../../${seqYName}.fasta
+	rm ../../${genoYname}.fasta
 fi
 
 #Movemos los frags y los info
-mv ${seqXName}-${seqYName}.frags ../../results
-mv ${seqXName}-${seqYName}.frags.INF ../../results
-mv ${seqXName}-${seqYName}.frags.MAT ../../results
-#mv ${seqXName}-${seqYName}.old.frags ../../results
-mv ${seqXName}-${seqYName}.csv ../../results
+mv ${genoXname}-${genoYname}.frags $output
+mv ${genoXname}-${genoYname}.csv $csv
+
+
 
 #echo "Borrando ${seqXName}-${seqYName}"
 cd ..
+
 #rm -rf ${seqXName}-${seqYName}
 
+cd ..
+
+
+rm -r ${MGDIR}
+
 } &> /dev/null
+
--- a/gecko/src/Makefile	Wed Nov 18 08:08:25 2020 +0000
+++ b/gecko/src/Makefile	Wed Nov 18 08:23:04 2020 +0000
@@ -1,6 +1,6 @@
 CC=gcc
 CXX=g++
-CFLAGS=-O3 -D_FILE_OFFSET_BITS=64 -Wall
+CFLAGS=-O3 -D_FILE_OFFSET_BITS=64
 BIN=../bin
 
 all: reverseComplement words sortWords w2hd wordsStat hits sortHits filterHits FragHits combineFrags hitsStat hdStat fragStat getInfoCSB filterFrags indexmaker frags2text csvFrags2text csvExtractBorders