firasmidani / amiga

Analysis of Microbial Growth Assays

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Length mismatch

ofleitas opened this issue · comments

Hello

I am trying to do an analysis with AMIGA but I get the following error.

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 346, in summarize
Command(args).summarize()
File "C:\Users\ofm83\Documents\Projects_python\amiga-master\libs\commands.py", line 71, in init
save=args.save_mapping_tables,verbose=args.verbose)
File "C:\Users\ofm83\Documents\Projects_python\amiga-master\libs\detail.py", line 108, in assembleMappings
df_mapping = initKeyFromMeta(meta_info,well_ids)
File "C:\Users\ofm83\Documents\Projects_python\amiga-master\libs\detail.py", line 323, in initKeyFromMeta
df_meta.index = well_ids
File "C:\Users\ofm83\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\generic.py", line 5192, in setattr
return object.setattr(self, name, value)
File "pandas/_libs/properties.pyx", line 67, in pandas._libs.properties.AxisProperty.set
File "C:\Users\ofm83\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\generic.py", line 690, in _set_axis
self._data.set_axis(axis, labels)
File "C:\Users\ofm83\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\internals\managers.py", line 183, in set_axis
"values have {new} elements".format(old=old_len, new=new_len)
ValueError: Length mismatch: Expected axis has 25 elements, new values have 5 elements

There may be something wrong with your meta.txt file. In the meta.txt file, you should have only one row for each unique Plate_ID. Is that the case? If not, please share here or via e-mail and I can help troubleshoot.

To fix this, you simply need to create a separate mapping file for each plate. I see that you have five plates. So, you should have five mapping files in the mapping folder, for example, with the following names:
mapping/Plate_1.txt
mapping/Plate_2.txt
mapping/Plate_3.txt
mapping/Plate_4.txt
mapping/Plate_5.txt

Each mapping file should only describe wells for its corresponding plate. Make sure that the mapping files have the same name as the data files. So, the above names would work if your data folder has the following files:
data/Plate_1.txt
data/Plate_2.txt
data/Plate_3.txt
data/Plate_4.txt
data/Plate_5.txt

A meta.txt file would not work for your case. Revisit the section "How to use a meta.txt file?" in Metadata Doc for more information. I will have to revise the docs to make this point a bit clearer. However, I may keep this issue open, because it would be nice if a user can define mapping for multiples plates in the same file as you have done here. I will add this to the list of improvements to make AMiGA.

Please try the above fix and let me know if it works.

It worked. However, when I executed the fit command, I get the following error:

Temporary directory is C:\Users\ofm83\AppData\Local\Temp\tmpmdawzyx6

Fitting Plate_1
Fitting Plate_1 B2
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 214, in fit
Command(args).fit()
File "C:\Users\ofm83\Documents\Projects_python\amiga-master\libs\commands.py", line 114, in fit
runGrowthFitting(data,mappings,self.directory,args,verbose=args.verbose)
File "C:\Users\ofm83\Documents\Projects_python\amiga-master\libs\analyze.py", line 167, in runGrowthFitting
sub_plate.model(nthin=args.time_step_size,store=store,verbose=verbose)
File "C:\Users\ofm83\Documents\Projects_python\amiga-master\libs\growth.py", line 709, in model
ARD=False,heteroscedastic=False,nthin=nthin,logged=self.mods.logged)
File "C:\Users\ofm83\Documents\Projects_python\amiga-master\libs\model.py", line 106, in init
new_df = pd.concat(new_df,axis=0)
File "C:\Users\ofm83\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\reshape\concat.py", line 255, in concat
sort=sort,
File "C:\Users\ofm83\AppData\Local\Programs\Python\Python36\lib\site-packages\pandas\core\reshape\concat.py", line 304, in init
raise ValueError("No objects to concatenate")
ValueError: No objects to concatenate
PS C:\Users\ofm83\Documents\Projects_python\amiga-master>

I can't tell what's happening just from the error. I would like to reproduce the error on my side. Can you share at least one of the data and mapping file combinations?

I was able to run both amiga summarize and fit commands successfully on the data that you shared.

So, what was the actual command that you used which give you an error? Please paste the full command with all arguments in your reply.

Also, can you also try to attach your data as a file, instead of pasting into the comment? There's likely something wrong with the format of the data file or with the command that you used?

Hello

I am using these two command

PS C:\Users\ofm83\Documents\Projects_python\amiga-master> python amiga.py fit --input C:\Users\ofm83\Documents\Projects_python\Kp_amiga
Plate_1.txt
--merge-summary -o "Fit_single" --plot --plot-derivative --save-mapping-tables --save-gp-data --sample-posterior --verbose

PS C:\Users\ofm83\Documents\Projects_python\amiga-master> python amiga.py fit --input C:\Users\ofm83\Documents\Projects_python\Kp_amiga --merge-summary -o "Fit_pool" --pool-by "Isolate" --plot --plot-derivative --save-mapping-tables --save-gp-data --sample-posterior --verbose

I can also run these commands too without any problems on Plate_1.txt.

Can you provide the following:

  • Mapping file (attached not pasted)
  • The log by AMiGA, so everything that it prints to the terminal. Please paste into a text file and attach here.

Hello, follow the log file. The map files I can't attach. It says that is a no supported file.
log.txt

Ok, can you provide more detail.

  • In an earlier message, you shared two commands, one for fitting wells individually and another for fitting after pooling by "Isolate". Did both of those commands fail or just the latter? The log.txt that you shared only gives information on the latter?

  • In the log file, there is a warning about missing data points (WARNING: AMiGA detected missing data. Values are missing for some replicates at the following time-points:). In the Plate_1.txt file that you shared, I see that you have an interval of 0.5 and timepoints range from 0 to 24. Is this the same for all your files in the data folder? Do the files actually have the time listed in the first row? Did you change any of the default values in the libs/config.py file including interval in line 27 or units in lines 22 and 23?

Given what you shared so far, I still cannot reproduce your error on my side. If the above tips can't help you resolve your issue, I can still try to reproduce the error, but to do so I need all of your data and mapping files. So, I would recommend that you simply zip your work folder: "C:\Users\ofm83\Documents\Projects_python\Kp_amiga" and email it to me. My address is here.

Follow the log.txt of the first command.
The interval of 0.5 and timepoints range from 0 to 24 are the same all the files in data folder.
I changed the units to:

acceptable values are 'seconds', 'minutes', or 'hours'

config['time_input_unit'] = 'hours'
config['time_output_unit'] = 'hours'

And I also change the interval

default time interval between OD measurments is set to 600 seconds

config['interval'] = 0.5 # units ared based on 'time_input_unit' above

log.1.txt

I looked at your mapping files. In the Plate_ID columns, make sure that the values of that column match the name of the file. All of your mapping files have only the "Plate_1" value. Fix your mapping files and re-try to run the amiga fit commnads.