15,185 Topics
| |
I have made a program that reads a file and its main function does some geographic computations to the contents inside. It works now, but instead I want the program to write it instead to a file instead of printing it. I don't understand how to write it because this … | |
basically, what I want to do is add a function name to an outside reference in a safe sys.modules reference without copying the name... best idea I got is to call a 3rd party function: def myfunc(args): x = None return x addname() # add 'myfunc' to sys.modules['/safe_ref/'] anyone got … | |
I'm currently creating the game checkers(draughts) and have problem moving the pieces on the board. So far I have all the pieces on one side of the board ready where each piece is it's own function. For the pieces to move i've created a function called mousePressEvent. It takes the … | |
The question is: Is it simple to build a GUI that can be accessible remotely? We worked a lot on this and we built a GUI library, portable, lightweight, Python! Hosted on github https://github.com/dddomodossola/gui Here is an example (suggestions are gratefully accepted :-) ): import gui from gui import * … | |
i need to write a loop program converting celsius to farenheit using the formula F=9*C/5+32 and terminating at -999 | |
Hey guys, I am making a few gui programs and I was wondering on this code .. class PaintChart(wx.Panel): def __init__(self, parent, data): self.data = data.split() wx.Panel.__init__(self, parent) self.SetBackgroundColour('BLACK') self.Bind(wx.EVT_PAINT, self.drawChart) def drawChart(self, e): dc = wx.PaintDC(self) dc.SetDeviceOrigin(30, 240) dc.SetAxisOrientation(True, True) dc.SetPen(wx.Pen('RED')) dc.DrawRectangle(1, 1, 300, 200) Here I set the … | |
#!/usr/bin/python import Evaluar from pylab import * from numpy import * def biseccion(a, b, TOL, N): Evaluar.dicc_seguro['x']=a fa = eval(Evaluar.funcion, {"__builtins__":None}, Evaluar.dicc_seguro) vectorx = zeros(N, Float64) vectory = zeros(N, Float64) i = 1 while i<=N : p = (a+b)/2.0 vectorx[i-1] = p Evaluar.dicc_seguro['x']=p fp = eval(Evaluar.funcion, {"__builtins__":None}, Evaluar.dicc_seguro) vectory[i-1]=fp if … | |
apparently this seems to be pretty unheard of because of the over-glorified NumPy extension, which yes is faster than using python alone, but most likely not as fast as defining the raw complex methods such as matrix inversion in plain C. with NumPy you need to make an array object … | |
| I have a 'User' model holding some information like username password etc. After installing swingtime I was hoping to correlate its 'Event' model with my 'User' model so I can add events for every individual user. The thing is that in order to do that I need to have a … |
import evaluar from pylab import * from numpy import * def puntofijo(po,TOL, N): vectorx = zeros (N, Float64) vectory = zeros (N, Float64) i = 1 while i<=N : vectorx[i-1] = po Evaluar.dicc_seguro['x']=po fp = eval(Evaluar.funcion, {"__builtins__":None}, Evaluar.dicc_seguro) vectory[i-1]=fp if fabs(po-fp): print "La raiz buscada es: ",po, "con", i-1, "iteraciones" … | |
my project consists of 6 files with .py. The first is the main project file, which I called Metodos.py and whose code is: #!/usr/bin/python # coding: latin-1 #import os, sys import Menu from numpy import * Menu.elmenu() Let's see the code Menu.py file: #!/usr/bin/python # coding: latin-1 from math import … | |
Hi all, I need some help with my code, because I have a bit of trouble with using the `cur.execute` in the loops. When I try this: for pos_X, pos_Y, prog_id, prog_width in zip(positions_X, positions_Y, programs_id, program_width): cur.execute('SELECT button_ids, button_width FROM buttons where button_ids=?', [prog_id)) if int(pos_X) == 375: if … | |
In a python script I gave a call in this way: do.call([cfg.tool_cmd("cuffdiff"), "-p", str(cfg.project["analysis"]["threads"]), "-b", str(cfg.project["genome"]["fasta"]), "-u", cfg.project["experiment"]["merged"], "-L", "%s,%s" % (str(cfg.project["phenotype"][0])[2:8],str(cfg.project["phenotype"][1])[2:7]), "-o", output_folder] + [cfg.project["samples"][0]["files"]["bam"] + ' ' + cfg.project["samples"][1]["files"]["bam"]], cfg.project["analysis"]["log_file"]) This gives the command: Command '['/usr/local/bin/cuffdiff', '-p', '5', '-b', '/scratchsan/venkatesh/TuxedoProject/data/genome/ce10.fa', '-u', 'pipeline/merging/merged.gtf', '-L', 'embryo,larva', '-o', 'pipeline/degenes', 'pipeline/SAMN00990702-1/mappings/accepted_hits.bam pipeline/SAMN00990702-2/mappings/accepted_hits.bam']' … | |
I have this code which open a frame, count 5 seconds and then open another frame. Here i have some buttons that should open different frames but they all open same second frame that is already opened by counter. I don t get it why is this happen. Any idea … | |
write a function named makeWordList() that takes two paramaters: 1. readFileName is a string that is the name of a file containing text 2. writeFileName is a string that is the name of a file that makesWordList() writes it outputs to. it should contain of of the words in the … | |
SOMEONE HELP ME line 23, in <module> class Yakudi(ch.RoomManager): AttributeError: 'module' object has no attribute 'RoomManager' | |
I gave a call in this way: print("-L", str(cfg.project["phenotype"][0]), str(cfg.project["phenotype"][1])) This will read the below one phenotype: - embryo: [SAMN00990702-1] - larva: [SAMN00990702-2] And it should give: -L embryo,larva But it is giving like: -L {'embryo': ['SAMN00990702-1']} {'larva': ['SAMN00990702-2']} Can anyone help me in solving this problem. Thank you !! | |
I run a command on command line like : cuffdiff -o diff_out4 -b ../genome/ce10.fa -p 2 -L larval,early -u merged_asm/merged.gtf ../tophat/em/SRR493359_60_61_thout/accepted_hits.bam ../tophat/em/SRR493363_64_65_thout/accepted_hits.bam Both bam files are separated with "space". Now the same command I gave a call in python script: do.call([cfg.tool_cmd("cuffdiff"), "-b", str(cfg.project["genome"]["fasta"]), "-u", cfg.project["experiment"]["merged"], "-o", output_folder] + [cfg.project["samples"][0]["files"]["bam"] cfg.project["samples"][1]["files"]["bam"]], … | |
#!/usr/bin/env python3 tm = open('./timemachine.txt', 'r') Dict = {} for line in tm: line = line.strip() line = line.translate('!"#$%&'()*+-./:;<=>?@[\\]^_`{|}~') line = line.lower() List = line.split(' ') for word in List: if word in Dict: count = Dict[word] count += 1 Dict[word] = count else: Dict[word] = 1 for word, count … | |
This is an R script which I used for plotting. Can anyone please give me a python code for this. Thanks in Advance !! setwd("/pipeline/deff") source('http://www.bioconductor.org/biocLite.R') biocLite('cummeRbund') library(cummeRbund) cuff_data <- readCufflinks('deff') pdf("allplots.pdf") #"distbtn of expression levels for each dataset" plot(csDensity(genes(cuff_data))) #"compare the exp of each gene in all the conditions … | |
A few hundred years ago the glorious leader of a big country wanted to reward the creator of the chess game. The creator of the game simply wanted one grain of rice put on the first square of the chessboard, two grains on the second, then doubling it for every … | |
I'm stuck dealing with strings which is a pain when porting code... I'm doing stuff such as porting this: enum { VAL_NULL = 0, VAL_INT, VAL_FLOAT, VAL_STR, VAL_ANY, VAL_CODE, VAL_MACRO, VAL_IDENT }; to this: for i,v in enumerate([ 'VAL_NULL','VAL_INT','VAL_FLOAT','VAL_STR','VAL_ANY','VAL_CODE','VAL_MACRO','VAL_IDENT' ]): globals()[v]=i anyone know of a method I could use to … | |
Need to have balls moved when touched using getmouse() also need an if then statement when ball is clicked to have it moved | |
I am trying to do some text processing tasks against a collection of files stored in a directory. The data set is just standard 20-newsgroup data. However, running the following code segement gives error message such as `UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 240: invalid start byte` … | |
Have a good evening! **The Aim:** to obtain a Sieve of Erastothenes **The Means:** to build a function of a number n that the prime numbers up to n. **The code** supposed to make this from math import sqrt def holeofStrainer(): """The purpose is to build a sieve of Erasthotenes. … | |
what I'm basically trying to do is: x = struct( size=4, order='var0', # <<< struct.__call__( size, order, **vars ) var0 = bu32 # { 'var0': bu32, } ) data = x() # read data from imported file print data.var0 # should return a bu32 int if data.__class__ == x: pass … | |
Hi, I'm new to Python - and new on here.... I've read lots of tutorials on Python and am currently in an intro to programming class using python, but I can't figure this out. I've searched stack overflow, dani web, java2s, github and many others but can't understand what I'm … | |
So im extremely new to python. Im teaching it to myself for a school project and i heard that calculators are a good place to start so that's exactly what im doing. I have only been using it for about a day now so like i said im pretty newb. … | |
hi , I am trying to first ask the user how many numbers he has ( I have not coded this part yet but assumed number 5 ), then enter the first number , hit enter , enter another number in the same entery widget up until the numbers are … | |
I needed a random color selector. I found one [here](http://peepspower.com/python-script-to-generate-random-css-colors). I rewrote it to make it more general purpose. "f_GenRandomColor" is the picker. The output is in list form, which should make it suitable for most general applications. "f_HTMLRandomColorChart" is just a way to create an HTML table to test … |
The End.