Closed jfy133 closed 5 months ago
Very good point 🤣. It came from the auto issue generation... Does the issue moving thing work?
Apparently yes @jfy133
My current idea:
master
and the PRProblems: diff doesn't work when other formatting changes have occured (or people fix upstream mistakes)
New approach, request bot to filter for the table and the new project ID e.g. @spaam-bot please autofill ancientsinglegenome-hostassociated majander2024
Then can use that info to filter the table to prepare the autofill
command
e.g.: grep 'Nishimura2024' ancientmetagenome-hostassociated/samples/ancientmetagenome-hostassociated_samples.tsv | rev | cut -f 1 | rev
to get the new accessions
X-ref for bot: https://stackoverflow.com/a/70244956
Basic bash script:
#!/usr/bin/env bash
##
## AMDirT autofill wrapper for github actions
##
## Given a specified table and a project name, this script will
##
## 0. Check the specified table is valid name
## 1. filter the specified sample table for the given project name.
## 2. collect collect the sample accession IDs of that project
## 3. give error if there is no output (i.e., 0 accessions)
## 4. run AMDirT autofill with the collected accessions and the specified table name
##
## Copyright 2024 James Fellows Yates on behalf of the SPAAM community under MIT license
verbose=false
while getopts t:p:v flag; do
case "${flag}" in
v) verbose=true ;;
t) table_name=${OPTARG} ;;
p) project_name=${OPTARG} ;;
esac
done
## TODO: check valid table name
if [ $verbose ]; then
echo RUNNING: grep $project_name $table_name/samples/"$table_name"_samples.tsv "| rev | cut -f 1 | rev | tr '\n' ' '"
echo ""
fi
hits=$(grep "$project_name" "$table_name"/samples/"$table_name"_samples.tsv | rev | cut -f 1 | rev | tr '\n' ' ')
if [ $verbose ]; then
echo RUNNING: "${#hits} -eq 0"
echo ""
fi
if [ ${#hits} -eq 0 ]; then
echo 'Project name or sample accessions were not found in table. Please check project name input (-p).'
exit 1
fi
if [ $verbose ]; then
echo RUNNING: AMDirT autofill -n $table_name $hits -l TEMPLATE_$project_name_"$table_name"_libraries.tsv
echo ""
fi
AMDirT autofill -n $table_name $hits -l TEMPLATE_$project_name_"$table_name"_libraries.tsv
Better version, see: https://github.com/SPAAM-community/AncientMetagenomeDir/pull/1145
TODO: Parse the comment to extract the table name and project name
Done in a variety of commits on master, the final being: https://github.com/SPAAM-community/AncientMetagenomeDir/commit/7d564e914c3c98c482c323490cb09052c7ea5755
@jfy133 This issue would be better in AncientMetagenomeDir :)