Mercurial > repos > richard-burhans > ncbi_egapx
view get-bams.bash @ 31:1429b9638055 draft
planemo upload for repository https://github.com/richard-burhans/galaxytools/tree/main/tools/ncbi_egapx commit 7fab8f3658c9289e1d229bcde0beff80a0814c4c
author | richard-burhans |
---|---|
date | Wed, 26 Mar 2025 20:17:43 +0000 |
parents | |
children |
line wrap: on
line source
#!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail ## ## Collect output bam files from STAR ## bam_temp_dir=$(mktemp --directory ./egapx_out/bam.XXXXXXXXXX) || { echo "ERROR: failed making temporary directory" exit 1 } bam_files_file="$bam_temp_dir/bam-files.txt" touch "$bam_files_file" || { echo "ERROR: failed creating temporary file" exit 1 } trap 'rm -f -- "$bam_files_file"' EXIT find . -type f -name \*Aligned.out.Sorted.bam -print > "$bam_files_file" || { echo "ERROR: failed finding bam files" exit 1 } idx=0 while IFS="" read pathname; do filename=$(basename "$pathname" ".bam") dest_path_prefix="$bam_temp_dir/$filename" if [ -e "${dest_path_prefix}.bam" ]; then dest_path_prefix="${dest_path_prefix}.${idx}" idx=$((idx + 1)) fi dest_pathname="${dest_path_prefix}.bam" cp "$pathname" "$dest_pathname" || { echo "ERROR: failed: cp \"$pathname\" \"$dest_pathname\"" exit 1 } done < "$bam_files_file" exit 0