This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
downsample_fastq() { | |
local input_fastq=$1 #$ FASTQ in .gz compression (ID_1.fastq.gz) | |
local downsample_factor=$2 | |
local base_name=$(basename "$input_fastq" .fastq.gz) | |
local prefix="${base_name%%_*}" | |
local suffix="${base_name#*_}" | |
local output_fastq="${prefix}s_${suffix}.fastq.gz" # Add an "s" to the ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
list_samples() { | |
local dir="$1" | |
local mode="${2:-line}" | |
local samples=$(ls -1 "$dir" | awk -F'_' '{print $1}' | sort -uV) | |
case "$mode" in | |
line) | |
echo "$samples" | paste -sd ' ' - |