firasmidani / amiga

Analysis of Microbial Growth Assays

Home Page:https://firasmidani.github.io/amiga/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IndexError: list index out of range

ofleitas opened this issue · comments

Hello
I am trying to normalize my pooled data by division, but I got an error message.

C:\Users\ofm83\Documents\Projects_python\amiga-master>python amiga.py normalize --input C:\Users\ofm83\Documents\A.baumannii_amiga\summary\Fit_pool_summary.txt --group-by "Isolate" --normalize-method "division" --normalize-by "Control" --ve
rbose

#-----------------------------------------------------#

User provided the following command-line arguments:

#-----------------------------------------------------#

input...............C:\Users\ofm83\Documents\A.baumannii_amiga\summary\Fit_pool_summary.txt
over_write..........False
verbose.............True
group_by............Isolate
normalize_by........Control
normalize_method....division

#-------------------------------#

AMiGA is parsing your file(s)

#-------------------------------#

Traceback (most recent call last):
File "amiga.py", line 400, in
AMiGA()
File "amiga.py", line 90, in init
getattr(self, args.command)()
File "amiga.py", line 304, in normalize
normalize(args)
File "C:\Users\ofm83\Documents\Projects_python\amiga-master\libs\normalize.py", line 56, in main
df = normalizeParameters(args,df)
File "C:\Users\ofm83\Documents\Projects_python\amiga-master\libs\normalize.py", line 115, in normalizeParameters
controlby = checkParameterCommand(args.normalize_by)
File "C:\Users\ofm83\Documents\Projects_python\amiga-master\libs\interface.py", line 132, in checkParameterCommand
lines_values = [[jj.strip() for jj in re.split(sep,ii.split(':')[1])] for ii in lines]
File "C:\Users\ofm83\Documents\Projects_python\amiga-master\libs\interface.py", line 132, in
lines_values = [[jj.strip() for jj in re.split(sep,ii.split(':')[1])] for ii in lines]
IndexError: list index out of range

C:\Users\ofm83\Documents\Projects_python\amiga-master>

Thank you for sharing the command and error trace, it's quite helpful.

Based on your command, it seems that Fit_pool_summary.tx should have a column called Control and you are trying to normalize your data based on this column.

If you use the normalize function and do not call the --normalize-by argument, then, AMiGA will use the Control column by default. If you would still like to be explicit and call the --normalize-by argument, you will need to tell AMiGA which column in your summary file distinguish treatments and control (e.g. Control column) but you also need to tell AMiGA which value in the Control column corresponds to your control wells/conditions (e.g. Control:1). So, you can do either of the following commands:

option 1

Here, I specify which value in the Control column corresponds to control wells by including ":1" in the normalize-by value

C:\Users\ofm83\Documents\Projects_python\amiga-master>python amiga.py normalize --input C:\Users\ofm83\Documents\A.baumannii_amiga\summary\Fit_pool_summary.txt --group-by "Isolate" --normalize-method "division" --normalize-by "Control:1" --verbose

option 2

Here, we assume that your control rows/wells have values of 1 in the Control column (this is the default behavior by AMiGA), so we do not use the --normalize-by argument at all.

C:\Users\ofm83\Documents\Projects_python\amiga-master>python amiga.py normalize --input C:\Users\ofm83\Documents\A.baumannii_amiga\summary\Fit_pool_summary.txt --group-by "Isolate" --normalize-method "division"  --verbose

Try these out and let me know if you are still having this issue.

It is possible there is an issue in your mapping file. Are you able to share your mapping file and/or summary data (output of amiga fit? I might find a clue by glancing at the files.

It is a bit hard to look at these files (I think attaching the files using a browser instead of email would have worked better). Still, I think I see the issue. I think the issue here may be simply a misunderstanding of how the Group and Control columns can be used.

It seems that you have five groups (1,2,3,4,5) and your parental strains are in group 5 and you are considering parental strain to be the control. However, each group needs a control. Here, groups 1, 2, 3, and 4 do not have any controls, so, AMiGA cannot normalize them to anything. The key idea here is that AMiGA can normalize summary stats within each group. In practice, it should look inside group 1, find the treatment samples (where Control=0) and normalize to the control samples (where Control=1). Then, it does the same for group 2, 3, ..., etc.

If this is still not a clear, please re-visit the Meta-Data Documentation and specifically look at the third table for an example. In this example, I want to look at how the growth by wild-type strains (Group 1) on trehalose normalized to background growth on minimal media (i.e. negative control) and I want to compare this to the growth of the knock-out strain (Group 2) on trehalose normalized to background growth.

I don't know your experimental design but I am guessing that you are simply trying to compare all of the strains to the parental strain under the same condition. If so, then, they should all be in the same group. What do you think? Do you think this would work in your case?

First, did you look at the directory where you ran the command? AMiGA compare saves output in the folder where it is run, so, in your case, that would be amiga-master.

Second, when you ran the command that generated Fit_pool_summary.txt file, did you use the --sample-posterior argument as shown at the end of the first command in the Compare Parameters documentation?

Your command looks fine. I would suggest that you look at your mapping file and make sure that you only have one Group, and that you look at the Fit_pool_summary.txt and make sure that there is nothing wrong with it (check the Group and Control columns there too).

If you share both your mapping file and summary file, I can take a second look.

Ok, I see that there is a minor bug with AMiGA, which I will have to fix. Here, there is an issue because you are using the Control column to tell AMiGA what to normalize by. There is a simple workaround that you can implement immediately while I continue to fix the problem. For your case, instead of the following:

--normalize-by "Control:1"

please do the following

--normalize-by "Isolate:A. baumannii Ab0"

Let me know if this workaround makes normalization work and hypothesis testing work.

Hello

It did not work.
Fit_pool_summary_normalized.txt

Ok, hmm, it worked for me. I downloaded the "Fit_pool_summary.txt" that you shared two hours ago, and ran the following command:

python amiga.py normalize -i Fit_pool_summary.txt --group-by "Group" --normalize-method "division" --normalize-by "Isolate:A. baumannii Ab0" --verbose

I got the following:
Fit_pool_summary_normalized.txt

So, I just want to double check that we ran the same command. In your case, it would:

C:\Users\ofm83\Documents\Projects_python\amiga-master> python amiga.py
normalize --input
C:\Users\ofm83\Documents\A.baumannii_amiga\summary\Fit_pool_summary.txt
--group-by "Group" --normalize-method "division" --normalize-by "Isolate:A. baumannii Ab0"
--verbose

Can you please confirm that you used the above command?

It worked. I saw my error, I had --group-by "Isolate". The hypothesis testing worked too.
Thank you very much for your help!!!

Glad to hear it. Thanks for pointing out this issue. I will keep this issue open until I address the related bug in AMiGA.

At the moment, for the --normalize-by option , you will have to use a value that is a string/text such as "A. baumanii Ab0" (not a number such as "1"). I will close this issue once I solve this problem.