Correction of go_rps12 for not passing anymore the sequence as a variable

Former-commit-id: 0f9bb9472a53aa16a91a9cab5106ee66ee781c34
Former-commit-id: 016607c59e62105850d1d25f29bfe214943abc5c
This commit is contained in:
2023-05-16 13:39:01 +02:00
parent 785e0a6226
commit bf27de1528
2 changed files with 33 additions and 3 deletions

View File

@ -118,10 +118,9 @@ blastx \
| $AwkCmd -f $LIB_DIR/rps12_filter_2.awk \ | $AwkCmd -f $LIB_DIR/rps12_filter_2.awk \
| $AwkCmd -v delta="$DELTA" \ | $AwkCmd -v delta="$DELTA" \
-v seqlen="$SEQLEN" \ -v seqlen="$SEQLEN" \
-v chloro="$SEQUENCE" \ -v chloro="${QUERY}" \
-f $LIB_DIR/rps12_filter_3.awk -f $LIB_DIR/rps12_filter_3.awk
nrps12=$(ls -1 rps12_fragments_*.fasta | wc -l) nrps12=$(ls -1 rps12_fragments_*.fasta | wc -l)
if (( nrps12 > 1 )) ; then if (( nrps12 > 1 )) ; then

View File

@ -6,7 +6,7 @@ function min(a,b) {return (a <= b) ? a:b }
x=x substr(s,i,1) x=x substr(s,i,1)
return x return x
} }
function swapchar(s,a,b) { function swapchar(s,a,b) {
gsub(a,"@",s) gsub(a,"@",s)
gsub(b,a,s) gsub(b,a,s)
@ -31,6 +31,37 @@ function revcomp(s) {
s = swapchar(s,"d","h") s = swapchar(s,"d","h")
return rev(s) return rev(s)
} }
function extractFirstSequence(file) {
# Variables
sequence = ""
inSequence = 0
# Lecture du fichier
while ((getline line < file) > 0) {
# Ignorer les lignes commençant par ">"
if (substr(line, 1, 1) == ">") {
if (inSequence == 1)
break; # Sortir si nous avons déjà extrait la première séquence
else
inSequence = 1; # Commencer à extraire la séquence
} else if (inSequence == 1) {
# Supprimer les espaces et retours chariot de la séquence
gsub(/[[:space:]]/, "", line);
sequence = sequence line;
}
}
# Fermer le fichier
close(file);
# Retourner la première séquence
return sequence;
}
BEGIN {
chloro = extractFirstSequence(chloro)
}
{ from = max(1,$1 - delta) { from = max(1,$1 - delta)
to = min($2 + delta,seqlen) to = min($2 + delta,seqlen)
sequence = substr(chloro,from,to-from+1) sequence = substr(chloro,from,to-from+1)