Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incomplete matches of variable name #218

Closed
fruce-ki opened this issue Dec 20, 2023 · 1 comment · Fixed by #223
Closed

incomplete matches of variable name #218

fruce-ki opened this issue Dec 20, 2023 · 1 comment · Fixed by #223
Labels
bug Something isn't working

Comments

@fruce-ki
Copy link

Description of the bug

I encountered an error that seems to be caused by the way variable names are matched between the contrasts and the samplesheet. The full error message is quoted in the next section as terminal output.

I have traced the issue to this awk call in NFCORE_DIFFERENTIALABUNDANCE:DIFFERENTIALABUNDANCE:CUSTOM_TABULARTOGSEACLS : awk -F'\t' '{print $'$column_number'}. At this point, $column_number has two values in it, since grep -En "^time" only matches the start of the variable name, resulting in both an exact match (time) and a partial match (timerat).

The error is fully resolved if I rename the variables, such that one is not a prefix of the other.

Command used and terminal output

-[nf-core/differentialabundance] Pipeline completed with errors-
ERROR ~ Error executing process > 'NFCORE_DIFFERENTIALABUNDANCE:DIFFERENTIALABUNDANCE:CUSTOM_TABULARTOGSEACLS (time_W6_vs_W3.by_condition)'

Caused by:
  Process `NFCORE_DIFFERENTIALABUNDANCE:DIFFERENTIALABUNDANCE:CUSTOM_TABULARTOGSEACLS (time_W6_vs_W3.by_condition)` terminated with an error exit status (2)

Command executed:

  cls_file=time_W6_vs_W3.by_condition.cls
  
  column_number=$(cat samplesheet_linz.differentialabundance.sample_metadata.tsv | head -n 1 | tr '\t' "\n" | grep -En "^time" | awk -F':' '{print $1}')
  classes=$(tail -n +2 samplesheet_linz.differentialabundance.sample_metadata.tsv | awk -F'\t' '{print $'$column_number'}')
  unique_classes=$(echo -e "$classes" | awk '!x[$0]++')
  
  echo -e "$(echo -e "$classes" | wc -l) $(echo -e "$unique_classes" | wc -l) 1" > $cls_file
  echo -e "#$(echo -e "$unique_classes" | tr '\n' ' ')" | sed "s/ $//" >> $cls_file
  echo -e "$classes" | tr '\n' ' ' | sed "s/ $//" >> $cls_file
  echo -e "\n" >> $cls_file
  
  cat <<-END_VERSIONS > versions.yml
  "NFCORE_DIFFERENTIALABUNDANCE:DIFFERENTIALABUNDANCE:CUSTOM_TABULARTOGSEACLS":
      bash: $(echo $(bash --version | grep -Eo 'version [[:alnum:].]+' | sed 's/version //'))
  END_VERSIONS

Command exit status:
  2

Command output:
  (empty)

Command error:
  awk: line 2: missing } near end of file

Relevant files

No response

System information

local execution on workstation with

Ubuntu 22.04

singularity 4.0.1-focal

nextflow 23.10

differentialabundance 1.4.0

@fruce-ki fruce-ki added the bug Something isn't working label Dec 20, 2023
@pinin4fjords
Copy link
Member

Good spot! I've PR'd the module fix at nf-core/modules#4683 - feel free to make similar fixes yourself in future :-)

@pinin4fjords pinin4fjords mentioned this issue Jan 10, 2024
10 tasks
@pinin4fjords pinin4fjords linked a pull request Jan 10, 2024 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants