From 644f1540505d653ceec4d7cbdd9989c8f89ad802 Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Mon, 25 Apr 2016 11:15:14 +0200 Subject: [PATCH] Add a fasta1line function reformating the sequence with a line for the header and a single line for the sequence Former-commit-id: 619dc4f5515b0080e5696806f9325f90b983d22e Former-commit-id: c244fdbb5c84bebf9ae17d6e15c0fd4b00914d32 --- scripts/bash_init.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/bash_init.sh b/scripts/bash_init.sh index 72d4a81..81ca779 100644 --- a/scripts/bash_init.sh +++ b/scripts/bash_init.sh @@ -117,10 +117,17 @@ function cutseq { # - $1 : The fasta file containing the sequences to join function joinfasta { $AwkCmd '(NR==1 && /^>/) {print $0} \ - ! /^>/ {print $0}' $1 | \ + ! /^>/ {print $0}' "${1}" | \ formatfasta } +function fasta1line { + $AwkCmd '(/^>/ && seq !="") {print seq} \ + /^>/ {print $0;seq=""} \ + !/^>/ {seq=seq $0} \ + END {print seq}' "${1}" +} + function formatfasta { $AwkCmd 'function printfasta(seq) { \ seqlen=length(seq); \ @@ -129,7 +136,7 @@ function formatfasta { } \ /^>/ { print $0 } \ ! /^>/ { seq=seq $0 } \ - END { printfasta(seq)}' $1 + END { printfasta(seq)}' "${1}" } @@ -169,7 +176,7 @@ IR_DATA_DIR="${DATA_DIR}/ir" # Directory containing data related to TRNA_DATA_DIR="${DATA_DIR}/trna" # Directory containing data related to # tRNAs detection -CDS_DATA_DIR="${DATA_DIR}/trna" # Directory containing data related to +CDS_DATA_DIR="${DATA_DIR}/cds" # Directory containing data related to # CDSs detection RRNA_DATA_DIR="${DATA_DIR}/rrna" # Directory containing data related to