caporaso-lab / sourcetracker2

SourceTracker2
BSD 3-Clause "New" or "Revised" License
65 stars 46 forks source link

AttributeError: 'Series' object has no attribute 'applymap' #115

Closed aalexiev closed 5 years ago

aalexiev commented 5 years ago

I'm having some issues getting SourceTracker2 to work, which is odd because it worked just fine a few weeks ago. The only difference is that I reinstalled it so I could use the --per_sink_feature_assignments as suggested in a previous issue on this github (#101), since ST2 was saying it didn't know what that flag was. I get two errors that are concerning to me:

When I run:

sourcetracker2 gibbs -i lifeenv_OTU.biom -m lifeenv_map.txt -o SourceTracker_results --burnin 100 --per_sink_feature_assignments

I get the error:

ValueError: You requested rarefaction of source samples at 1000, but there are 3 collapsed source samples that have less sequences than that. The shallowest of these is 848 sequences.

This is despite the fact that the OTU table I'm providing has a minimum of 1030 sequences (I have double checked this to make sure as well). There is nothing as far as I can tell that has 848 sequences. It is also already rarefied, to 1030 sequences, so perhaps that's not kosher for SourceTracker? I attached my OTU table and map that are the inputs for this code. OTU table is in text here because github didn't like biom format, but I converted it to biom before running ST2.

Well, out of curiosity to see if that was the only issue, I then ran:

sourcetracker2 gibbs -i lifeenv_OTU.biom -m lifeenv_map.txt -o SourceTracker_results --burnin 100 --per_sink_feature_assignments --source_rarefaction_depth 842

This got past the rarefying issue it was having, but now gives the error (with traceback):

Traceback (most recent call last):

File "/Users/alal3493/miniconda3/envs/st2/bin/sourcetracker2", line 11, in

sys.exit(cli())

File "/Users/alal3493/miniconda3/envs/st2/lib/python3.5/site-packages/click/core.py", line 722, in call

return self.main(*args, **kwargs)

File "/Users/alal3493/miniconda3/envs/st2/lib/python3.5/site-packages/click/core.py", line 697, in main

rv = self.invoke(ctx)

File "/Users/alal3493/miniconda3/envs/st2/lib/python3.5/site-packages/click/core.py", line 1066, in invoke

return _process_result(sub_ctx.command.invoke(sub_ctx))

File "/Users/alal3493/miniconda3/envs/st2/lib/python3.5/site-packages/click/core.py", line 895, in invoke

return ctx.invoke(self.callback, **ctx.params)

File "/Users/alal3493/miniconda3/envs/st2/lib/python3.5/site-packages/click/core.py", line 535, in invoke

return callback(*args, **kwargs)

File "/Users/alal3493/miniconda3/envs/st2/lib/python3.5/site-packages/sourcetracker/_cli/gibbs.py", line 234, in gibbs_cli

create_feature_tables=per_sink_feature_assignments)

File "/Users/alal3493/miniconda3/envs/st2/lib/python3.5/site-packages/sourcetracker/_sourcetracker.py", line 757, in gibbs

sources, sinks = validate_gibbs_input(sources, sinks)

File "/Users/alal3493/miniconda3/envs/st2/lib/python3.5/site-packages/sourcetracker/_sourcetracker.py", line 60, in validate_gibbs_input

if not df.applymap(np.isreal).values.all():

File "/Users/alal3493/miniconda3/envs/st2/lib/python3.5/site-packages/pandas/core/generic.py", line 4376, in getattr

return object.__getattribute__(self, name)

AttributeError: 'Series' object has no attribute 'applymap'

I did see the old issue report that had this same error and it said it was fixed, so I'm not sure where to go from here. Any help would be useful!

lifeenv_map.txt lifeenv_OTU.txt

lkursell commented 5 years ago

@aalexiev - we just merged into master a fix, please reinstall.

I'll close this issue for now, but we can reopen if your problem persists.