Skip to content

Routine Processing

Routine Processing #5

name: Process Flu SRA (self-hosted)
run-name: ${{ github.event.inputs.reason || 'Scheduled Run' }}
on:
schedule:
- cron: '0 1 * * *'
workflow_dispatch:
inputs:
reason:
description: 'Reason for running the workflow'
required: true
default: 'Routine Processing'
testing:
type: boolean
description: 'Run in testing mode'
concurrency:
group: ${{ github.repository }}
env:
NXF_VER: "24.10.3"
NXF_WORK: ${{ github.workspace }}/work
NXF_OUTPUT: ${{ github.workspace }}/outputs
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FLUSRA_VERSION: 'main'
BIOPROJECTS: "PRJNA1102327,PRJNA1122849,PRJNA1134696"
TOWER_ACCESS_TOKEN: ${{ secrets.TOWER_ACCESS_TOKEN }}
defaults:
run:
shell: bash -el {0}
jobs:
process_sra:
container:
image: ubuntu:24.10
options: --cpus 40 --memory 400GB
runs-on: self-hosted
permissions:
contents: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: ./.github/actions/install-dependencies
- name: Run nextflow
run: nextflow run https://github.com/gp201/flusra.git -r ${{ env.FLUSRA_VERSION }} -c ${{ github.workspace }}/config/nextflow.config -profile mamba --bioproject ${{ env.BIOPROJECTS }} --outdir ${{ env.NXF_OUTPUT }} -name GitHub_$(date +%Y-%m-%d)-${{ github.run_number }} -with-tower -latest
- name: Push outputs
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
mv ${{ env.NXF_OUTPUT }}/metadata/SraRunTable_automated_updated.csv ${{ github.workspace }}/metadata/SraRunTable_automated.csv
mv ${{ env.NXF_OUTPUT }}/fasta/*.fa ${{ github.workspace }}/fasta/
mv ${{ env.NXF_OUTPUT }}/depth/*.tsv ${{ github.workspace }}/depth/
mv ${{ env.NXF_OUTPUT }}/variants/*.tsv ${{ github.workspace }}/variants/
if [ -d ${{ env.NXF_OUTPUT }}/demixed/ ]; then
mv ${{ env.NXF_OUTPUT }}/demixed/* ${{ github.workspace }}/demixed/
git add ${{ github.workspace }}/demixed/
fi
git add ${{ github.workspace }}/metadata/SraRunTable_automated.csv
git add ${{ github.workspace }}/fasta/*.fa
git add ${{ github.workspace }}/depth/*.tsv
git add ${{ github.workspace }}/variants/*.tsv
git commit -m "Add consensus sequences, depth, variant files, demixed files and updated metadata"
- name: Push to GitHub
if: ${{ !github.event.inputs.testing || github.event_name == 'schedule' }}
run: git push
- name: Generate Run Summary
run: |
echo "# Job Summary $(date)" >> $GITHUB_STEP_SUMMARY
echo "## Job Information" >> $GITHUB_STEP_SUMMARY
echo "Processed $(wc -l ${{ env.NXF_OUTPUT }}/metadata/*_new.txt | tail -n 1 | awk '{print $1}') samples" >> $GITHUB_STEP_SUMMARY
echo "<details><summary>Processed SRAs</summary>" >> $GITHUB_STEP_SUMMARY
cat ${{ env.NXF_OUTPUT }}/metadata/*_new.txt >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
echo "Processed $(wc -l ${{ env.NXF_OUTPUT }}/metadata/*_milk_samples.txt | tail -n 1 | awk '{print $1}') milk samples" >> $GITHUB_STEP_SUMMARY
echo "<details><summary>Processed Milk Samples</summary>" >> $GITHUB_STEP_SUMMARY
cat ${{ env.NXF_OUTPUT }}/metadata/*_milk_samples.txt >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
echo "## Workflow diagram" >> $GITHUB_STEP_SUMMARY
echo "```mermaid" >> $GITHUB_STEP_SUMMARY
# add ${{ env.NXF_OUTPUT }}/pipeline_info/*.mmd
cat "${{ env.NXF_OUTPUT }}/pipeline_info/*.mmd" >> $GITHUB_STEP_SUMMARY
echo "```" >> $GITHUB_STEP_SUMMARY
- name: Upload Nextflow log
if: failure()
uses: actions/upload-artifact@v4
with:
name: failed-run-log
include-hidden-files: true
path: |
${{ github.workspace }}/.nextflow.log