<commit_before>#!/bin/bash
# Available variables: $PROJECT, $RUNTYPE, $MIGA, $CORES, $DATASET
set -e
SCRIPT="ssu"
# shellcheck source=scripts/miga.bash
. "$MIGA/scripts/miga.bash" || exit 1
DIR="$PROJECT/data/07.annotation/01.function/02.ssu"
[[ -d "$DIR" ]] || mkdir -p "$DIR"
cd "$DIR"

# Initialize
miga date > "$DATASET.start"

fa="../../../05.assembly/$DATASET.LargeContigs.fna"
if [[ -s $fa ]] ; then
  # Run barrnap
  barrnap --quiet --threads "$CORES" "$fa" | grep "^##gff\\|;product=16S " \
    > "$DATASET.ssu.gff"
  # Extract
  bedtools getfasta -s "-fi" "$fa" -bed "$DATASET.ssu.gff" \
    -fo "$DATASET.ssu.all.fa"
  FastA.length.pl "$DATASET.ssu.all.fa" | sort -nr -k 2 | head -n 1 \
    | cut -f 1 > "$DATASET.ssu.fa.id"
  FastA.filter.pl "$DATASET.ssu.fa.id" "$DATASET.ssu.all.fa" > "$DATASET.ssu.fa"
  rm "$DATASET.ssu.fa.id"
  [[ -e "$fa.fai" ]] && rm "$fa.fai"
  # Gzip
  gzip -9 -f "$DATASET.ssu.gff"
  gzip -9 -f "$DATASET.ssu.all.fa"
fi

# Finalize
miga date > "$DATASET.done"
miga add_result -P "$PROJECT" -D "$DATASET" -r "$SCRIPT" -f<commit_msg>add command to run RDPClassifier on ssu.bash<commit_after>#!/bin/bash
# Available variables: $PROJECT, $RUNTYPE, $MIGA, $CORES, $DATASET
set -e
SCRIPT="ssu"
# shellcheck source=scripts/miga.bash
. "$MIGA/scripts/miga.bash" || exit 1
DIR="$PROJECT/data/07.annotation/01.function/02.ssu"
[[ -d "$DIR" ]] || mkdir -p "$DIR"
cd "$DIR"

# Initialize
miga date > "$DATASET.start"

fa="../../../05.assembly/$DATASET.LargeContigs.fna"
if [[ -s $fa ]] ; then
  # Run barrnap
  barrnap --quiet --threads "$CORES" "$fa" | grep "^##gff\\|;product=16S " \
    > "$DATASET.ssu.gff"
  # Extract
  bedtools getfasta -s "-fi" "$fa" -bed "$DATASET.ssu.gff" \
    -fo "$DATASET.ssu.all.fa"
  FastA.length.pl "$DATASET.ssu.all.fa" | sort -nr -k 2 | head -n 1 \
    | cut -f 1 > "$DATASET.ssu.fa.id"
  FastA.filter.pl "$DATASET.ssu.fa.id" "$DATASET.ssu.all.fa" > "$DATASET.ssu.fa"
  rm "$DATASET.ssu.fa.id"
  [[ -e "$fa.fai" ]] && rm "$fa.fai"
  # Gzip
  gzip -9 -f "$DATASET.ssu.gff"
  gzip -9 -f "$DATASET.ssu.all.fa"
fi

#RDP classifier
file_path="$DATASET.ssu.all.fa"
if [[ -s $DATASET.ssu.all.fa ]] ; then
  java -jar $classifier_path classify -c 0.8 -f fixrank -g 16srrna -o class_table.txt $file_path
fi

# Finalize
miga date > "$DATASET.done"
miga add_result -P "$PROJECT" -D "$DATASET" -r "$SCRIPT" -f
{'fraction_non_alphanumeric': 0.2178889359898262, 'fraction_numerical': 0.01526070368800339, 'mean_word_length': 3.1330998248686517, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5064376', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1075, 'n_words': 224}