Commit db780449 authored by Dillenn Terumalai's avatar Dillenn Terumalai
Browse files

Allowed additional formats

See #6
parent 0ef7e348
Pipeline #1797 passed with stage
in 4 minutes and 31 seconds
......@@ -233,8 +233,17 @@ autoMode() {
for DIRECTORY in ./*; do
if [ -d "$DIRECTORY" ] && [ "$DIRECTORY" != $OUTBOX ] && [ "$DIRECTORY" != $SENT ] && [ "$DIRECTORY" != $LOGS ]; then
for FILE in "$DIRECTORY"/*;do
if [[ -f $FILE && $FILE != *.@(fasta|fa|fasta.gz|fa.gz|fasta.xz|fa.xz|fastq|fastq.gz|cram|bam|csv|tsv|csv.gz|tsv.gz|vcf|xls|xlsx) ]]; then
((ERRORS=ERRORS+1))
((STEP_ERRORS=STEP_ERRORS+1))
echo "[$(date +"%T")] local.ERROR: Unsupported format ($FILE)" >> "../$LOGFILE"
echo "[$(date +"%F %T")] local.ERROR: Unsupported format ($FILE)" >> "../$ERRORLOGFILE"
fi
done
if ls "$DIRECTORY"/*.fast* 1> /dev/null 2>&1 && ls "$DIRECTORY"/*.xlsx 1> /dev/null 2>&1; then
if ls "$DIRECTORY"/*.fa* 1> /dev/null 2>&1 || ls "$DIRECTORY"/*.*am 1> /dev/null 2>&1 || ls "$DIRECTORY"/*.*sv* 1> /dev/null 2>&1 || ls "$DIRECTORY"/*.vcf 1> /dev/null 2>&1 && ls "$DIRECTORY"/*.xls* 1> /dev/null 2>&1; then
if [[ "$*" == *--fake* ]] || [[ "$*" == *-F* ]]; then
compressFolder "$DIRECTORY"
......@@ -273,8 +282,8 @@ autoMode() {
else
((ERRORS=ERRORS+1))
((STEP_ERRORS=STEP_ERRORS+1))
echo "[$(date +"%T")] local.ERROR: Missing files (*.fasta/.fastq/.fastq.gz and/or *.xlsx) inside $DIRECTORY of $VIRUSES DIRECTORY" >> "../$LOGFILE"
echo "[$(date +"%F %T")] local.ERROR: Missing files (*.fasta/.fastq/.fastq.gz and/or *.xlsx) inside $DIRECTORY of $VIRUSES DIRECTORY" >> "../$ERRORLOGFILE"
echo "[$(date +"%T")] local.ERROR: Missing required files inside $DIRECTORY of $VIRUSES DIRECTORY" >> "../$LOGFILE"
echo "[$(date +"%F %T")] local.ERROR: Missing required files inside $DIRECTORY of $VIRUSES DIRECTORY" >> "../$ERRORLOGFILE"
fi
fi
......@@ -288,7 +297,16 @@ autoMode() {
if [ -d "$DIRECTORY" ] && [ "$DIRECTORY" != $OUTBOX ] && [ "$DIRECTORY" != $SENT ] && [ "$DIRECTORY" != $LOGS ]; then
if ls "$DIRECTORY"/*.fast* 1> /dev/null 2>&1 && ls "$DIRECTORY"/*.xlsx 1> /dev/null 2>&1; then
for FILE in "$DIRECTORY"/*;do
if [[ -f $FILE && $FILE != *.@(fasta|fa|fasta.gz|fa.gz|fasta.xz|fa.xz|fastq|fastq.gz|cram|bam|csv|tsv|csv.gz|tsv.gz|vcf|xls|xlsx) ]]; then
((ERRORS=ERRORS+1))
((STEP_ERRORS=STEP_ERRORS+1))
echo "[$(date +"%T")] local.ERROR: Unsupported format ($FILE)" >> "../$LOGFILE"
echo "[$(date +"%F %T")] local.ERROR: Unsupported format ($FILE)" >> "../$ERRORLOGFILE"
fi
done
if ls "$DIRECTORY"/*.fa* 1> /dev/null 2>&1 || ls "$DIRECTORY"/*.*am 1> /dev/null 2>&1 || ls "$DIRECTORY"/*.*sv* 1> /dev/null 2>&1 || ls "$DIRECTORY"/*.vcf 1> /dev/null 2>&1 && ls "$DIRECTORY"/*.xls* 1> /dev/null 2>&1; then
if [[ "$*" == *--fake* ]] || [[ "$*" == *-F* ]]; then
compressFolder "$DIRECTORY"
......@@ -327,8 +345,8 @@ autoMode() {
else
((ERRORS=ERRORS+1))
((STEP_ERRORS=STEP_ERRORS+1))
echo "[$(date +"%T")] local.ERROR: Missing files (*.fasta/.fastq/.fastq.gz and/or *.xlsx) inside $DIRECTORY of $BACTERIA DIRECTORY" >> "../$LOGFILE"
echo "[$(date +"%F %T")] local.ERROR: Missing files (*.fasta/.fastq/.fastq.gz and/or *.xlsx) inside $DIRECTORY of $BACTERIA DIRECTORY" >> "../$ERRORLOGFILE"
echo "[$(date +"%T")] local.ERROR: Missing required files inside $DIRECTORY of $BACTERIA DIRECTORY" >> "../$LOGFILE"
echo "[$(date +"%F %T")] local.ERROR: Missing required files inside $DIRECTORY of $BACTERIA DIRECTORY" >> "../$ERRORLOGFILE"
fi
fi
done
......@@ -472,7 +490,7 @@ autoMode() {
if [[ $ERRORS > 0 ]]; then
printf "${BACK_RED} ERROR ${COL_RESET} ${COL_RED}Completed with $ERRORS error(s)${COL_RESET} ${COL_GREY} ${TIME} ${COL_RESET}\n"
printf "${BACK_RED} error ${COL_RESET} Missing files: Error detected please check ./$ERRORLOGFILE\n"
printf "${BACK_RED} error ${COL_RESET} Error detected: Please check ./$ERRORLOGFILE\n"
exit 1
fi
......@@ -494,15 +512,40 @@ generateFakeFiles() {
rm -rf ./$VIRUSES/fake-viruses/*
truncate -s 5M ./$VIRUSES/fake-viruses/fake-viruses.xlsx
for i in {1..3}; do
truncate -s 1G ./$VIRUSES/fake-viruses/fake-virus${i}.fastq.gz
done
for i in {1..3}; do
truncate -s 1G ./$VIRUSES/fake-viruses/fake-virus${i}.fastq
done
for i in {1..3}; do
truncate -s 1G ./$VIRUSES/fake-viruses/fake-virus${i}.fasta
done
truncate -s 5M ./$VIRUSES/fake-viruses/fake-viruses.xls
truncate -s 100M ./$VIRUSES/fake-viruses/fake-viruses.fasta
truncate -s 100M ./$VIRUSES/fake-viruses/fake-viruses.fa
truncate -s 100M ./$VIRUSES/fake-viruses/fake-viruses.fasta.gz
truncate -s 100M ./$VIRUSES/fake-viruses/fake-viruses.fa.gz
truncate -s 100M ./$VIRUSES/fake-viruses/fake-viruses.fasta.xz
truncate -s 100M ./$VIRUSES/fake-viruses/fake-viruses.fa.xz
truncate -s 100M ./$VIRUSES/fake-viruses/fake-viruses.fastq
truncate -s 100M ./$VIRUSES/fake-viruses/fake-viruses.fastq
truncate -s 100M ./$VIRUSES/fake-viruses/fake-viruses.fastq.gz
truncate -s 100M ./$VIRUSES/fake-viruses/fake-viruses.cram
truncate -s 100M ./$VIRUSES/fake-viruses/fake-viruses.bam
truncate -s 100M ./$VIRUSES/fake-viruses/fake-viruses.csv
truncate -s 100M ./$VIRUSES/fake-viruses/fake-viruses.tsv
truncate -s 100M ./$VIRUSES/fake-viruses/fake-viruses.csv.gz
truncate -s 100M ./$VIRUSES/fake-viruses/fake-viruses.tsv.gz
truncate -s 100M ./$VIRUSES/fake-viruses/fake-viruses.vcf
if [ ! -d "$BACTERIA/fake-bacteria" ]; then
mkdir -p $BACTERIA/fake-bacteria
......@@ -510,19 +553,46 @@ generateFakeFiles() {
rm -rf ./$BACTERIA/fake-bacteria/*
truncate -s 5M ./$BACTERIA/fake-bacteria/bacteria.xlsx
for i in {1..3}; do
truncate -s 1G ./$BACTERIA/fake-bacteria/bacteria${i}.fastq.gz
done
for i in {1..3}; do
truncate -s 1G ./$BACTERIA/fake-bacteria/bacteria${i}.fastq
done
for i in {1..3}; do
truncate -s 1G ./$BACTERIA/fake-bacteria/bacteria${i}.fasta
done
truncate -s 5M ./$BACTERIA/fake-bacteria/fake-bacteria.xlsx
truncate -s 5M ./$BACTERIA/fake-bacteria/fake-bacteria.xls
truncate -s 100M ./$BACTERIA/fake-bacteria/fake-bacteria.fasta
truncate -s 100M ./$BACTERIA/fake-bacteria/fake-bacteria.fa
truncate -s 100M ./$BACTERIA/fake-bacteria/fake-bacteria.fasta.gz
truncate -s 100M ./$BACTERIA/fake-bacteria/fake-bacteria.fa.gz
truncate -s 100M ./$BACTERIA/fake-bacteria/fake-bacteria.fasta.xz
truncate -s 100M ./$BACTERIA/fake-bacteria/fake-bacteria.fa.xz
truncate -s 100M ./$BACTERIA/fake-bacteria/fake-bacteria.fastq
truncate -s 100M ./$BACTERIA/fake-bacteria/fake-bacteria.fastq
truncate -s 100M ./$BACTERIA/fake-bacteria/fake-bacteria.fastq.gz
truncate -s 100M ./$BACTERIA/fake-bacteria/fake-bacteria.cram
truncate -s 100M ./$BACTERIA/fake-bacteria/fake-bacteria.bam
truncate -s 100M ./$BACTERIA/fake-bacteria/fake-bacteria.csv
truncate -s 100M ./$BACTERIA/fake-bacteria/fake-bacteria.tsv
truncate -s 100M ./$BACTERIA/fake-bacteria/fake-bacteria.csv.gz
truncate -s 100M ./$BACTERIA/fake-bacteria/fake-bacteria.tsv.gz
truncate -s 100M ./$BACTERIA/fake-bacteria/fake-bacteria.vcf
autoMode --fake --no-archive
printf "\n${BACK_GREEN} DONE ${COL_RESET} Test completed. Everything went smoothly.\n\n"
exit 0
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment