ipython

Python-script, which should translate 1000 DNA-Sequences to proteins by 1152 different codontables, don't work

怎甘沉沦 提交于 2019-12-11 04:33:05
问题 Now I'm working on bioinformatics project for my diploma work. I have written Python-script, which should translate the list of strings of 1000 DNA-Sequences to proteins by 1152 different codontables (genetics codes). This codontables are contained in a list of dictionaries, which were received by shuffling of keys and values (codons and amino acids). I want, what this script translates 1000 Sequences in 1152 ways in one go mileage in IPython console or just in Python-3.6 IDLE. This script

IPython representation of classes

你离开我真会死。 提交于 2019-12-11 04:32:39
问题 I was trying IPython with a module I created and it does not show the actual representation of class objects. Instead it shows something like TheClass.__module__ + '.' + TheClass.__name__ I heavily use metaclasses in this module and I have really meaningful class representations that should be shown to the user. Is there an IPython specific method I can change to make the right representation available instead of this namespace thingy that is quite useless in this application? Or, if that's

Timeout when invoking IPython embed()

白昼怎懂夜的黑 提交于 2019-12-11 04:22:51
问题 Is there a way to have a timeout when calling IPython.embed() in a python script? Say I have a script that stops for a IPython.embed() at various places, how can I let the script go on with its business when the user doesn't respond in time? 回答1: This is not quite an answer to the question, but it is adequate for what I wanted. I used some cross-platform keypress timeout code from https://stackoverflow.com/a/23098294/1490584, and https://stackoverflow.com/a/5047058/1490584 to let the user

jupyter custom.css removal

て烟熏妆下的殇ゞ 提交于 2019-12-11 04:06:36
问题 By mistake, I updated this file to customize css. D:\Continuum\Anaconda2\Lib\site-packages\notebook\static\custom\custom.css To rollback the above change, 1) I put back the original file that I saved before. still the new css shows up in jupyter. 2) I removed all .ipython and .jupyter dir and it didn't work either. 3) I even uninstalled anaconda and still that css shows up. I'm really stuck here. Does anyone know how to go back to the default css of jupyter ? 回答1: Reposting as an answer: When

widget layout when using interact

橙三吉。 提交于 2019-12-11 03:51:19
问题 How can I use a container widget to control the layout while using interact? For instance, I'd like those 2 Select to be in a HBox. from IPython.html import widgets from IPython.display import display def f(dl, ft): print dl, ft dlW = widgets.Select(options={str(k):k for k in range(4)}) ftW = widgets.Select(options={str(k):k for k in 'ABCD'}) hbox=widgets.HBox([dlW, ftW]) i = widgets.interact(f, dl = dlW, ft = ftW ) # display( hbox ) # <-- commenting in makes the widget display twice 回答1:

Initialize interpreter with variables

房东的猫 提交于 2019-12-11 03:48:58
问题 How do I initialize the python interpreter such that it already has variables in its memory? For example, how could I initialize a[n i]Python interpreter, and type as my first input: In [1]: today Out[1]: '2015-05-05 17:49:32.726496' without first binding the name str(today = datetime.datetime.today()) ? 回答1: If you are using ipython, you can configure it to load scripts automatically for you. Run $ ipython profile create which will create default profile in your home directory. Create a file

nbconvert multiindex dataframes to latex

半世苍凉 提交于 2019-12-11 03:43:29
问题 I'm trying to export a multi-index Pandas DataFrame to latex using ipython's nbconvert but the multi-index rows come out all wrong. I'm using the following code at the beginning of the code to convert to latex properly (I found it somewhere on SO but can't remember where): from sympy import latex from IPython.display import HTML, Latex, display, Math pd.set_option('display.notebook_repr_html', True) def _repr_latex_(self): return "\\begin{center} %s \end{center}" % self.to_latex() pd

Prevent Python kernal from crashing when running an application in QT

浪尽此生 提交于 2019-12-11 02:57:23
问题 I am attempting to write a program using PysideQT using Spyder. While the application runs fine from command line, the program causes the Python's Kernel to crash when running from Spyder's interpretive Python kernel. I cannot figure out what is causing the issue. I am running Ubuntu LTS 14.04 on a 64bit system. Once again, this issue does not occur when I run the program from terminal. I have written the following program that causes the Kernel to crash: import sys import PySide.QtGui as qg

Wrap R function in python

随声附和 提交于 2019-12-11 02:54:17
问题 I would like to wrap a R function contained in a package princurve. With ipython I do it successfully with an ipython cell R magic: %%R -i X -o s,lambda fit1<-principal.curve(X) s <- fit1$s l <- fit1$lambda but I want a function that I can import from a module like: from mymodule import principal_curve s, l = principal_curve(X) I guess I have to use rpy directly, I am not sure how... 回答1: I don't use R but using this example in the docs you can define a function and import it into a python

Shortcut for insert a cell below for Ipython in Pycharm?

孤街浪徒 提交于 2019-12-11 02:35:33
问题 I just started using Ipython in Pycharm. What's the shortcut for insert a cell for Ipython in Pycharm? To insert a cell between the 2nd and 3rd cell. To insert a cell at the end of code According to Pycharm documentation, way to add cell as follows. But it doesn't work for me. Anyone find the same issue? Since the new cell is added below the current one, click the cell with import statement - its frame becomes green. Then on the toolbar click add (or press Alt+Insert). 回答1: Not sure that is