firasmidani / amiga

Analysis of Microbial Growth Assays
https://firasmidani.github.io/amiga/
GNU General Public License v3.0
12 stars 3 forks source link

【question】is it possible to test hypothesis based on three replicates? #16

Closed Ravenclawer closed 1 year ago

Ravenclawer commented 1 year ago

in the current tutorial for testing hypothesis, we should point data to a specific plate and specific substrate to narrow it to two curves to compare。 the only way I see to consolidate replicates is through pooling I want to know if it's possible to test the hypothesis based on three replicates and make multiple comparisons since I have a gradient concentration of a substrate and I want to know which concentration is improving or hindering the growth of the microorganism compared to the medium without the substrate

Ravenclawer commented 1 year ago

chlorella001_PM1-1.txt chlorella001_PM1-2.txt chlorella001_PM1-3.txt meta.txt

Ravenclawer commented 1 year ago

the above files are data and metadata that I composed for analysis but failed all the steps after the pool replicates in the tutorial. could you help me to get it through, I have limited knowledge of coding and have been stuck on the step for two days image

firasmidani commented 1 year ago

Yes, you can do the comparisons between conditions with three replicates per condition. Thanks for sharing your files because it made debugging easy.

The main problem is that you are not correctly giving AMiGA the metadata. Please revisit the documentation for Prep Metadata. In your case, you need to provide a separate mapping file for each file, and the mapping file need to have the same name as the corresponding data file. See attached.

chlorella001-1.txt chlorella001-2.txt chlorella001-3.txt

The secondary problem is that you are naming the files incorrectly. In the Prep Data documentation, I point out that you can use the following naming style {isolate name}_PM{integer}-{integer} ONLY IF you are analyzing Biolog Phenotype Microarray (PM) plates. Because you are not using Biolog plates, I simply renamed your files to chlorella001-1.txt, chlorella001-2.txt, and chlorella001-3.txt. You can even just name them a.txt, b.txt, and c.txt and as long as you update the Plate_ID column in your metadata files to match those names, your code will work just fine.

In your case, I simply renamed your data files as earlier mentioned, separated the meta.txt file that you shared into the three files that I am sharing here, where I also changed the values in the Plate_ID columns to match the filenames. I then ran the following command and it worked fine:

amiga test -i . -s 'substrate:0mgSodiumSelenite,10mgSodiumSelenite' --interval 24 -y 'H0:Time;H1:Time+substrate' --verbose

Give it a shot and let me know if it works or if you have any more questions.

Ravenclawer commented 1 year ago

sorry for the delayed reply, I spent a lot of time on the software. It keeps giving me error messages as follows: exampleproject.zip

C:\Users\Administrator>cd C:\Users\Administrator\Desktop\amiga-master

C:\Users\Administrator\Desktop\amiga-master>python amiga test -i C:\Users\Administrator\Desktop\amiga-master\exampleproject -s 'substrate:0mgSodiumSelenite,10mgSodiumSelenite' --interval 24 -y 'H0:Time;H1:Time+substrate' --verbose
python: can't open file 'amiga': [Errno 2] No such file or directory

C:\Users\Administrator\Desktop\amiga-master>python amiga.py test -i C:\Users\Administrator\Desktop\amiga-master\exampleproject -s 'substrate:0mgSodiumSelenite,10mgSodiumSelenite' --interval 24 -y 'H0:Time;H1:Time+substrate' --verbose

#-----------------------------------------------------#
# User provided the following command-line arguments: #
#-----------------------------------------------------#

input.........................C:\Users\Administrator\Desktop\amiga-master\exampleproject
output........................None
flag..........................None
subset........................'substrate:0mgSodiumSelenite,10mgSodiumSelenite'
interval......................24
hypothesis....................'H0:Time;H1:Time+substrate'
skip_first_n..................0
time_step_size................1
number_permutations...........0
false_discovery_rate..........10
confidence....................0.95
subtract_blanks...............False
subtract_control..............False
verbose.......................True
fix_noise.....................False
include_gaussian_noise........False
sample_posterior..............False
dont_plot.....................False
dont_plot_delta_od............True
save_cleaned_data.............False
save_mapping_tables...........False
save_gp_data..................False
merge_summary.................False
do_not_log_transform..........True
log_transform.................False

#-----------------------------------------------#
# AMiGA is peeking inside the working directory #
#-----------------------------------------------#

Input directory..........C:\Users\Administrator\Desktop\amiga-master\exampleproject
Data directory...........C:\Users\Administrator\Desktop\amiga-master\exampleproject\data
WARNING: C:\Users\Administrator\Desktop\amiga-master\exampleproject\derived did not exist but was created.
Mapping directory........C:\Users\Administrator\Desktop\amiga-master\exampleproject\mapping
WARNING: C:\Users\Administrator\Desktop\amiga-master\exampleproject\summary did not exist but was created.
WARNING: C:\Users\Administrator\Desktop\amiga-master\exampleproject\figures did not exist but was created.
WARNING: C:\Users\Administrator\Desktop\amiga-master\exampleproject\models did not exist but was created.

Data directory C:\Users\Administrator\Desktop\amiga-master\exampleproject\data has 3 files:

    chlorella001-1.txt
    chlorella001-2.txt
    chlorella001-3.txt

#-------------------------------------------------------------#
# AMiGA is parsing command-line arguments and parameter files #
#-------------------------------------------------------------#

interval.......24.0
subset.........{"'substrate": ['0mgSodiumSelenite', "10mgSodiumSelenite'"]}
flag...........{}
hypothesis.....{"'H0": ['Time'], 'H1': ['Time', "substrate'"]}

WARNING: Because user has requested subsetting of data, results will be merged into single summary and/or data file.

#------------------------------------------#
# AMiGA is parsing and cleaning data files #
#------------------------------------------#

Reading C:\Users\Administrator\Desktop\amiga-master\exampleproject\data\chlorella001-1.txt
Reading C:\Users\Administrator\Desktop\amiga-master\exampleproject\data\chlorella001-2.txt
Reading C:\Users\Administrator\Desktop\amiga-master\exampleproject\data\chlorella001-3.txt

#--------------------------------------------#
# AMiGA is parsing and reading mapping files #
#--------------------------------------------#

No meta.txt file found

chlorella001-1................ Reading C:\Users\Administrator\Desktop\amiga-master\exampleproject\mapping\chlorella001-1.txt.
chlorella001-2................ Reading C:\Users\Administrator\Desktop\amiga-master\exampleproject\mapping\chlorella001-2.txt.
chlorella001-3................ Reading C:\Users\Administrator\Desktop\amiga-master\exampleproject\mapping\chlorella001-3.txt.

#-------------------------------------------#
# AMiGA is testing data based on user input #
#-------------------------------------------#

Traceback (most recent call last):
  File "amiga.py", line 400, in <module>
    AMiGA()
  File "amiga.py", line 90, in __init__
    getattr(self, args.command)()
  File "amiga.py", line 395, in test
    Command(args).test()
  File "C:\Users\Administrator\Desktop\amiga-master\libs\commands.py", line 97, in test
    HypothesisTest(self.mappings,self.data,self.params,self.args,self.directory)
  File "C:\Users\Administrator\Desktop\amiga-master\libs\test.py", line 61, in __init__
    if self.checkHypothesis(): return None
  File "C:\Users\Administrator\Desktop\amiga-master\libs\test.py", line 129, in checkHypothesis
    target = list(set(hypothesis['H1'])^(set(hypothesis['H0'])))
KeyError: 'H0'
firasmidani commented 1 year ago

Please try using double quotes (") instead of single quotes (") in the main command, as follows:

amiga test -i . -s "substrate:0mgSodiumSelenite,10mgSodiumSelenite" --interval 24 -y "H0:Time;H1:Time+substrate" --verbose

Does the command work now?

Ravenclawer commented 1 year ago

Yes, it works now, thank you so much.

firasmidani commented 1 year ago

Great! Which operating system do you use? Windows? Do you use your computer's default terminal?

Certain operating systems and terminals may prefer double over single quote. It would be helpful to know your case so that I can add a special note in the documentation.

Edit: Never mind, I just saw issue #19. You are using Windows. I will close this issue.

Ravenclawer commented 11 months ago

Thank you again, for your timely and patient reply.