Giter Site home page Giter Site logo

assocplots's Issues

Index Error

My data looks a little different than the one from the tutorial. I converted it from a pandas DataFrame to a NumPy array using this line of code:
# convert dataframe to numpy array for assocplots manhattan_plot_data = manhattan_plot_df.values

My data looks like such when it is a np array:
[['Y' 15016019.0 'ENSG00000000419' 0.11661291909180488] ['Y' 15016019.0 'ENSG00000000457' 0.3375253528924895] ['Y' 15016019.0 'ENSG00000000938' 0.7934988001982753] ... ['Y' 15016019.0 'ENSG00000107929' 0.0015774481443468435] ['Y' 15016019.0 'ENSG00000184743' 0.024884285526804023] ['Y' 15016019.0 'ENSG00000169895' 0.0021853699533324845]]

When I run this line of code:
manhattan_plot_data['f3'], manhattan_plot_data['f1'], manhattan_plot_data['f0'].astype(str)

I get the following error:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-136-1ae52f7f6bbe> in <module>()
      1 ## create plot
----> 2 manhattan (manhattan_plot_data['f3'], manhattan_plot_data['f1'], manhattan_plot_data['f0'].astype(str), '70 Individuals',
      3                type='single',
      4                chrs_plot=[str(i) for i in range(1,23)],
      5                chrs_names=chrs_names,

IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

Could you please tell me what I am doing wrong?

matplotlib.deprecation,

Hi,
/opt/conda/lib/python3.7/site-packages/matplotlib/figure.py:98: MatplotlibDeprecationWarning:
Adding an axes using the same arguments as a previous axes currently reuses the earlier instance. In a future version, a new instance will always be created and returned. Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
"Adding an axes using the same arguments as a previous axes "

I think it may lead to excess memory consumption as well.

Using Manhattan plot on Drosophila?

Hi,

I would like to know if the script can handle other organisms than humans.
I tried to use it with result from Drosophila (less chr and different position numbers) and I get the following error:

What I input:

manhattan(     dfnew[3], dfnew[2],dfnew[1].astype(str), 'SSP index',
               plot_type='single',
               chrs_plot=[str(i) for i in range(1,10)],
               chrs_names=chrs_names,
               cut = 0,
               title='lnwing SSP index',
               xlabel='chromosome',
               ylabel='-log10(p-value)',
               lines= [],
               colors = colors,
               scaling = '-log10')

Error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-129-109ad6b8698c> in <module>
      9                lines= [],
     10                colors = colors,
---> 11                scaling = '-log10')

/opt/anaconda3/lib/python3.7/site-packages/assocplots/manhattan.py in manhattan(p1, pos1, chr1, label1, p2, pos2, chr2, label2, plot_type, chrs_plot, chrs_names, cut, colors, title, xlabel, ylabel, top1, top2, lines, lines_colors, zoom, scaling)
    120             plt.subplot(1,1,1)
    121         plt.plot([shift[-1], shift[-1]], [0, 1000], '-k', lw=0.5, color='lightgray')
--> 122         plt.xlim([0, shift[-1]])
    123 
    124         if plot_type != 'single':

/opt/anaconda3/lib/python3.7/site-packages/matplotlib/pyplot.py in xlim(*args, **kwargs)
   1432     if not args and not kwargs:
   1433         return ax.get_xlim()
-> 1434     ret = ax.set_xlim(*args, **kwargs)
   1435     return ret
   1436 

/opt/anaconda3/lib/python3.7/site-packages/matplotlib/axes/_base.py in set_xlim(self, left, right, emit, auto, xmin, xmax)
   3240         self._process_unit_info(xdata=(left, right))
   3241         left = self._validate_converted_limits(left, self.convert_xunits)
-> 3242         right = self._validate_converted_limits(right, self.convert_xunits)
   3243 
   3244         old_left, old_right = self.get_xlim()

/opt/anaconda3/lib/python3.7/site-packages/matplotlib/axes/_base.py in _validate_converted_limits(self, limit, convert)
   3156             if (isinstance(converted_limit, Real)
   3157                     and not np.isfinite(converted_limit)):
-> 3158                 raise ValueError("Axis limits cannot be NaN or Inf")
   3159             return converted_limit
   3160 

ValueError: Axis limits cannot be NaN or Inf

I formatted the dataframe exactly like your example dataset.

Thanks!

Add highlighting functionality

Hi,
Would it be possible to add an option to show some specific variant sites with a different colors.
For example the function accept an array of (chr,pos,p-value,color) and display this list of variant on top the Manhattan plot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.