2020-12-28

"unregonized arguments: Go" using the columns of a tab-delimited txt to automate a terminal command w/ multiple arguments

I'm trying to simplify running a large number of varying operations on some sets of data, where there are 3 variables that might vary each time I run the command: 1) an output name, 2) a list of treatment samples and 3) a list of controls to match those treatments to. Sometimes the treatments for one comparison are the controls for another, so there is no way to solve this with a clever naming scheme that simplifies each comparison to a single variable.

Output Name Column Treatment Names Column Control Sample Column
name1 sample1,sample2 control1
... ... ...

What I've been trying:

while IFS=$'\t' read -r Output_Name Treatment Control
do
    command -argument1 $Treatment -argument2 $Control -argument3 $Output_Name
done < ../Testing_Table.txt

But I get an error: "unrecognized argument: Go"

When I simplify this to just echo back all of the variables, I can see that there is a "Go" after the $Treatment variable that I cannot account for.

For instance

while IFS=$'\t' read -r Output_Name Treatment Control
do
    echo "Treatment:" $Treatment \n "Control:" $Control \n "Name:=" $Output_Name
done < ../Testing_Table.txt

Might output something automate a command w/ multiple argumentlike this for the first row of the testing table file. I can't account for where "Go" is coming from as it's not anywhere directly within my code or in my tab-delimited file.

Treatment: sample1,sample2 Go
Control: control1
Name: name1


from Recent Questions - Stack Overflow https://ift.tt/37Qg3KQ
https://ift.tt/eA8V8J

No comments:

Post a Comment