15,190 Topics
![]() | |
ok, so this is a bit complex, I'm writing a bit-field function using a template, which can consist of: field( Template, Value ) field( [1,7,15] ,255 ) #int representation... field( ['1','3','4'] ,255 ) #bit representation... #>>> [1,7,15] field( [1,7,15] ,[1,7,15] ) field( ['1','3','4'] ,[1,7,15] ) #>>> 255 so what I'm … | |
In my quest to learn more regarding programming in Python, I "dissect" a lot of other people's code. While doing this, or writing my own code, I end up with 10's of debug print lines. Things like this: if v_Debug == 1: print("DEBUG - ".format()) # DEBUG If I decide … | |
I, and many others, desired a "switch" keyword in Python. For me it was to a desire to make some of my code more compact and readable, as I often have many user selected options for the code to weed through. So I set off on a journey to figure … | |
Hello, people. A newbie here... sorry. A hired programmer (who doesn't use Windows) is writing a Python thing for me, On my Windows 7 PC, I installed Python v 3.4.3, and he says that I need to install certain non-standard modules... lxml, requests and xlwt from http://lxml.de/ http://docs.python-requests.org/en/latest/ https://pypi.python.org/pypi/xlwt Trying … | |
Hello all, I haven't joined a forum in probably 10 years. I am joining this one, actually because I had issues with the sister site, programmingforums.org Apparently my account is in limbo there (activated, but not approved by a moderator). Originally, when attempting to join the other site, it was … | |
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. … |
The End.