cgat-developers / cgat-flow

cgat-flow repository
MIT License
13 stars 9 forks source link

rnaseqqc - Error setting xlim in plotStrandednessSalmon #146

Open IanSudbery opened 2 years ago

IanSudbery commented 2 years ago

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

https://github.com/cgat-developers/cgat-flow/blob/bc423e431cee5b76f2e8cdc6b8d8a44935b85a75/cgatpipelines/tools/pipeline_rnaseqqc.py#L1575-L1577

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 commented 2 years ago

My guess is that a.get_xlim() is not a precise x coordinate, and something may have changed in matplotlib? Get_xlim is supposed to create a convenient frame for plotting so it looks good but it is not the maximal value of the table, which is what it seems to be standing in for here? https://www.geeksforgeeks.org/matplotlib-axes-axes-get_xlim-in-python/

I might be completely wrong though!

Jakub

From: Ian Sudbery @.> Reply to: cgat-developers/cgat-flow @.> Date: Thursday, 2 September 2021 at 11:15 To: cgat-developers/cgat-flow @.> Cc: Subscribed @.> Subject: [cgat-developers/cgat-flow] rnaseqqc - Error setting xlim in plotStrandednessSalmon (#146)

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

https://github.com/cgat-developers/cgat-flow/blob/bc423e431cee5b76f2e8cdc6b8d8a44935b85a75/cgatpipelines/tools/pipeline_rnaseqqc.py#L1575-L1577

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 @KatyBrownhttps://github.com/KatyBrown wrote it?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/cgat-developers/cgat-flow/issues/146, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC4Y5MX73KGBEQBHVQ3WVWTT75FBBANCNFSM5DIXL6BA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

IanSudbery commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

https://github.com/cgat-developers/cgat-flow/blob/b7036f90e5fcddb63c7479a0e5f2e4c4a136a5f6/cgatpipelines/tools/pipeline_rnaseqqc.py#L1586-L1593

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

KatyBrown commented 2 years ago

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

jscaber commented 2 years ago

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 commented 2 years ago

Screen Shot 2021-11-23 at 19 49 45