Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rnaseqqc - Error setting xlim in plotStrandednessSalmon #146

Open
IanSudbery opened this issue Sep 2, 2021 · 9 comments
Open

rnaseqqc - Error setting xlim in plotStrandednessSalmon #146

IanSudbery opened this issue Sep 2, 2021 · 9 comments

Comments

@IanSudbery
Copy link
Contributor

Does anyone know what is going on with these lines here in plotStrandednessSalmon from RNAseqqc.

a.set_xticks(np.arange(0 + len(tab) / 2, a.get_xlim()[1],
len(tab)))
a.set_xticklabels(counttab.columns)

I can't work it out at all, at least in part I guess because I don't know what the intended output is supposed to look like. HOwever, it raises this error:

  File "/shared/sudlab1/General/apps/conda/cgat-flow-devel/cgatpipelines/tools/pipeline_rnaseqqc.py", line 1577, in plotStrandednessSalmon 
     a.set_xticklabels(counttab.columns) 
  File "/shared/sudlab1/utrons/utrons_env/lib/python3.8/site-packages/matplotlib/axes/_base.py", line 73, in wrapper 
    return get_method(self)(*args, **kwargs) 
  File "/shared/sudlab1/utrons/utrons_env/lib/python3.8/site-packages/matplotlib/_api/deprecation.py", line 471, in wrapper 
    return func(*args, **kwargs) 
  File "/shared/sudlab1/utrons/utrons_env/lib/python3.8/site-packages/matplotlib/axis.py", line 1795, in _set_ticklabels 
     return self.set_ticklabels(labels, minor=minor, **kwargs) 
  File "/shared/sudlab1/utrons/utrons_env/lib/python3.8/site-packages/matplotlib/axis.py", line 1716, in set_ticklabels 
       raise ValueError( 
ValueError: The number of FixedLocator locations (13), usually from a call to set_ticks, does not match the number of ticklabels (12). 

Apparently @KatyBrown wrote it?

@jscaber
Copy link
Contributor

jscaber commented Sep 2, 2021 via email

@IanSudbery
Copy link
Contributor Author

I thought that at first, but if tab has (say), 12 columns, then arange(6, 12, 12) would be a very odd thing to want to do?

@KatyBrown
Copy link
Contributor

Hi Ian, sorry, it probably was me and I have no memory of what I was trying to do - it seems mad.

It's just putting ticks on the x axis, so I think it would be OK to switch that line just for:

a.set_xticks(np.arange(0, len(counttab.columns))
a.set_xticklabels(counttab.columns)

If that doesn't work please let me know!

@IanSudbery
Copy link
Contributor Author

Me thinks this is why it is not that way:
image

I think I'm starting to get my head around what is happening.

@KatyBrown
Copy link
Contributor

Hi @IanSudbery, I just wanted to check if this worked in the end - I can have a look if not. Sorry for the slow and not helpful response - I was off work for ages and now I'm playing catch-up!

@IanSudbery
Copy link
Contributor Author

It was a bit more complex than that. Here is what I settled on:

# There is one bar for each library type for each sample, if we divide
# the xaxis up into library types, with as many bars as samples in each
# division, then we want the first tick half way through the first
# divsion and then the space between ticks is the number of samples.
a.set_xticks(np.arange(len(tab)/2,
len(tab)*len(counttab.columns),
len(tab)))
a.set_xticklabels(counttab.columns)

Its in PR #148 , I think it should work.

@KatyBrown
Copy link
Contributor

Brilliant - thanks for fixing it and documenting it properly this time!

@jscaber
Copy link
Contributor

jscaber commented Nov 23, 2021

I think this now generates a table of appropriate width, but still does not populate it, sorry forgot to mention this during the PR merge.

@jscaber
Copy link
Contributor

jscaber commented Nov 23, 2021

Screen Shot 2021-11-23 at 19 49 45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants