firasmidani / amiga

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

Length mismatch #20

Closed ofleitas closed 9 months ago

ofleitas commented 9 months ago

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

firasmidani commented 9 months ago

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.

ofleitas commented 9 months ago

Hello

I am attaching the meta.txt file. Thank very much for your help.

On Thu, Dec 7, 2023 at 9:57 AM Firas Midani @.***> wrote:

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 case? If not, please share here or via e-mail and I can try to help troubleshoot.

— Reply to this email directly, view it on GitHub https://github.com/firasmidani/amiga/issues/20#issuecomment-1845603407, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM624NATNXSAXWUTCZ2DDJDYIHRO7AVCNFSM6AAAAABADWJ3Y2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNBVGYYDGNBQG4 . You are receiving this because you authored the thread.Message ID: @.***>

Plate_ID    Isolate Comments    Group   Control

B2 Plate_1 U3 Resistant 1 0 B3 Plate_1 U4 Resistant 1 0 B4 Plate_1 U5 Resistant 1 0 B5 Plate_1 U6 Parental 1 1 B6 Plate_1 U7 Sensitive 1 0 C2 Plate_2 U3 Resistant 1 0 C3 Plate_2 U4 Resistant 1 0 C4 Plate_2 U5 Resistant 1 0 C5 Plate_2 U6 Parental 1 1 C6 Plate_2 U7 Sensitive 1 0 D2 Plate_3 U3 Resistant 1 0 D3 Plate_3 U4 Resistant 1 0 D4 Plate_3 U5 Resistant 1 0 D5 Plate_3 U6 Parental 1 1 D6 Plate_3 U7 Sensitive 1 0 E2 Plate_4 U3 Resistant 1 0 E3 Plate_4 U4 Resistant 1 0 E4 Plate_4 U5 Resistant 1 0 E5 Plate_4 U6 Parental 1 1 E6 Plate_4 U7 Sensitive 1 0 F2 Plate_5 U3 Resistant 1 0 F3 Plate_5 U4 Resistant 1 0 F4 Plate_5 U5 Resistant 1 0 F5 Plate_5 U6 Parental 1 1 F6 Plate_5 U7 Sensitive 1 0

firasmidani commented 9 months ago

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.

ofleitas commented 9 months ago

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>

firasmidani commented 9 months ago

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?

ofleitas commented 9 months ago

Follow the files

On Mon, Dec 11, 2023 at 1:03 PM Firas Midani @.***> wrote:

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?

— Reply to this email directly, view it on GitHub https://github.com/firasmidani/amiga/issues/20#issuecomment-1850704950, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM624NBBHSXCAII573BCIUTYI5KGJAVCNFSM6AAAAABADWJ3Y2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJQG4YDIOJVGA . You are receiving this because you authored the thread.Message ID: @.***>

0   0.5 1   1.5 2   2.5 3   3.5 4   4.5 5   5.5 6   6.5 7   7.5 8   8.5 9   9.5 10  10.5    11  11.5    12  12.5    13  13.5    14  14.5    15  15.5    16  16.5    17  17.5    18  18.5    19  19.5    20  20.5    21  21.5    22  22.5    23  23.5    24

B2 0.000333333 0.002333333 0.005 0.003666667 0.012 0.022666667 0.034333333 0.055333333 0.064 0.076666667 0.09 0.104333333 0.115 0.123333333 0.133 0.142666667 0.160333333 0.163 0.17 0.181 0.172 0.186333333 0.185333333 0.187666667 0.189333333 0.193666667 0.196666667 0.195333333 0.197666667 0.197666667 0.197333333 0.197 0.191333333 0.187333333 0.184666667 0.181666667 0.177666667 0.172666667 0.169 0.165666667 0.161 0.154 0.151333333 0.144666667 0.130666667 0.125333333 0.122333333 0.106 0.097666667 B3 0.002666667 0.004333333 0.007333333 0.005 0.01 0.016333333 0.021666667 0.038333333 0.05 0.057333333 0.07 0.083 0.095666667 0.105 0.115333333 0.124666667 0.139666667 0.146 0.157333333 0.164333333 0.176666667 0.176333333 0.197 0.231333333 0.25 0.268666667 0.277 0.29 0.296333333 0.298 0.303 0.326 0.341 0.374333333 0.398 0.398666667 0.435666667 0.467333333 0.462333333 0.414666667 0.438666667 0.421 0.417 0.449333333 0.419 0.428 0.453333333 0.428 0.421333333 B4 0.002666667 0.004333333 0.006333333 0.002666667 0.007333333 0.012 0.02 0.038333333 0.048333333 0.057666667 0.072666667 0.084 0.102 0.115666667 0.130666667 0.141333333 0.148 0.164 0.166666667 0.176666667 0.195666667 0.201666667 0.229 0.274333333 0.3 0.335666667 0.370333333 0.363333333 0.378 0.388666667 0.391 0.406 0.431333333 0.436333333 0.454333333 0.41 0.340333333 0.310333333 0.235666667 0.237333333 0.237333333 0.234666667 0.237 0.239333333 0.239333333 0.240666667 0.243 0.244333333 0.244666667 B5 0.001 0.004 0.008 0.006333333 0.016666667 0.033 0.050333333 0.068666667 0.073666667 0.097666667 0.109333333 0.126666667 0.148333333 0.160666667 0.171666667 0.182333333 0.190333333 0.197666667 0.203666667 0.210333333 0.216 0.222666667 0.224333333 0.228 0.232666667 0.232333333 0.229333333 0.224 0.224 0.216666667 0.216333333 0.210333333 0.201666667 0.197 0.193333333 0.189 0.177666667 0.178333333 0.169333333 0.161666667 0.168666667 0.151333333 0.145666667 0.141666667 0.125333333 0.126333333 0.104333333 0.095333333 0.086 B6 0.003333333 0.006666667 0.013333333 0.013 0.020333333 0.037 0.059666667 0.083666667 0.100333333 0.121333333 0.136666667 0.169666667 0.196 0.248333333 0.285666667 0.305666667 0.338 0.373 0.404333333 0.455333333 0.477333333 0.535666667 0.536666667 0.592666667 0.61 0.665 0.683333333 0.719333333 0.738666667 0.748333333 0.774666667 0.793333333 0.768333333 0.758333333 0.752 0.747 0.690666667 0.738 0.694666667 0.694 0.651666667 0.663666667 0.689333333 0.732333333 0.711333333 0.707666667 0.642666667 0.631333333 0.581

firasmidani commented 9 months ago

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?

ofleitas commented 9 months ago

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

firasmidani commented 9 months ago

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

Can you provide the following:

ofleitas commented 9 months ago

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

firasmidani commented 9 months ago

Ok, can you provide more detail.

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.

ofleitas commented 9 months ago

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

firasmidani commented 9 months ago

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.

ofleitas commented 9 months ago

It worked fine. Thank you very much for the help!!!

On Wed, Dec 13, 2023 at 9:49 AM Firas Midani @.***> wrote:

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 it and confirm that it works.

— Reply to this email directly, view it on GitHub https://github.com/firasmidani/amiga/issues/20#issuecomment-1854183276, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM624NG2VA4RUTEDBE7XW7TYJHFAPAVCNFSM6AAAAABADWJ3Y2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJUGE4DGMRXGY . You are receiving this because you authored the thread.Message ID: @.***>