Entering edit mode
5.4 years ago
spiral01
▴
110
Hi, I am using bioawk to extract entries in a fasta file based on partial matches on IDs. Now normally I can use a bash variable in awk by assigning it using -v
. However, when using bioawk, the variable does not seem to be stored as gene, and as such I get no matches. I have tested this using the actual ID name instead of the variable and it works, so it must be an issue with assigning the variable. What am I doing wrong?
for i in ${IDs[@]}; do cat humanGeneOrthologs.fa | bioawk -v gene="$i" -c fastx '$name ~ /gene/ \
{ print ">"$name"\n"$seq"\n"; }'; done
Perfect. This works. Sorry but could explain why this change works? Thanks.
Hi spiral01,
When you use
/gene/
, (bio)awk understands it as a literal "gene", not the variable.