|
Pollyanna posted:Thanks, guys. Yeah, I think I might just go the object route instead. Regex is a loving nightmare and I'll take any alternative to it. It's been a while since I've taken a biology course, but can you have multiple start codons between the initial start codon and the stop codon when translating a sequence?
|
# ? Oct 7, 2013 13:52 |
|
|
# ? Jun 11, 2024 15:57 |
|
You can have as many ATGs are you want between a start codon and as top codon, if they are not the start of translation they are the same as any other non-stop codon. However to detect open reading frames correctly you want to start an overlapping sequence at every ATG. Using objects for this problem seems like crazy overkill. If you aren't worried about worst-case quadratic time solutions and super-efficiency then all you have to do is iterate through the string (and the reverse complement if you care about that) and check whether s[i:i+3]=='ATG' and when you hit one enter another loop that that iterates through the rest of the string in 3s until you hit a stop codon. Something like that that uses a generator would work without being a giant mess of list comprehenions. This may or may not work, I haven't tested it. It also doesn't automatically check the reverse complement. Python code:
I have similar feelings about regex, and I expressed them at an informal meeting of a bunch of bioinformatics people and they all thought I was crazy and didn't understand how I could do bioinfo without regex, but jokes on them I already have plenty of papers. If I really cared about efficiency I might do something like a linear time string matching to find all of the start codons and all of the stop codons and place them into six buckets based on which reading frame they are in and then simply match all start codon indices with the next largest stop codon and extract the sequence from there. Anyone think of a more efficient way to do it than that? OnceIWasAnOstrich fucked around with this message at 15:22 on Oct 7, 2013 |
# ? Oct 7, 2013 15:20 |
|
I've got a slightly strange problem here. It would probably require an extremely over-engineered solution, but maybe someone knows of a way I can do this without too much effort. I'm writing a module for the willie irc bot that will basically make a pun out of certain things people say. For example: quote:<sharktamer> I'm doing well today. but a lot less PC. It's a dumb idea, I'm just having fun with making the bot do stuff. At the moment I'm doing it using regex on the "[^aeiou ]ell" in the case above. However, English is weird and words that are spelled the same don't always rhyme and vice-a-verse-a. Maybe someone has ideas for how I can make this more powerful?
|
# ? Oct 7, 2013 21:05 |
|
SurgicalOntologist posted:Are there any free, preferably open-source libraries similar to the proprietary Vizard? It's a virtual reality library, where you can (e.g.) create objects from 3D models, then link a camera object to an external input (e.g., motion tracker) to let the user explore a virtual space. It's very simple to use, but also very expensive (I'd be looking at $4k for a single-use academic license). Asking again... anyone? Even something that accomplishes part of this would be helpful (at least in terms of getting a sense of feasibility).
|
# ? Oct 7, 2013 21:10 |
|
sharktamer posted:I've got a slightly strange problem here. It would probably require an extremely over-engineered solution, but maybe someone knows of a way I can do this without too much effort. Use a phonetic dictionary to compare how poo poo is actually pronounced. Here's one: http://www.speech.cs.cmu.edu/cgi-bin/cmudict
|
# ? Oct 7, 2013 21:18 |
|
OnceIWasAnOstrich posted:If you aren't worried about worst-case quadratic time solutions and super-efficiency Isn't that going to come back to bite you when your data starts to get big? (and I assume the data will, given y'all got sequences)
|
# ? Oct 8, 2013 01:42 |
|
Apparently PyCharm now has a (free) community version out for 3.0. Lacks a bunch of features, but still might be useful. Here's a comparison table. I still have my open-source license for 2.7, so I'll probably keep using that for a while, and it looks like there still is an open-source license deal for professional.
|
# ? Oct 8, 2013 17:02 |
|
Red Mike posted:I still have my open-source license for 2.7, so I'll probably keep using that for a while, and it looks like there still is an open-source license deal for professional. Most things that JetBrains makes (not IntelliJ) have licenses that "expire" instead of being locked to a major product version. I use the term "expire" loosely -- software that you're using will never stop working but you can't use new versions that are released after your license's "entitled to free upgrades/updates" cutoff. If you view your license details in PyCharm (Help -> About) and your upgrade entitlement includes 3.0's release date of 2013-09-24, you can use your 2.7 license for 3.0 also.
|
# ? Oct 8, 2013 17:16 |
|
Lysidas posted:Most things that JetBrains makes (not IntelliJ) have licenses that "expire" instead of being locked to a major product version. I use the term "expire" loosely -- software that you're using will never stop working but you can't use new versions that are released after your license's "entitled to free upgrades/updates" cutoff. Their promo last year where you could get PyCharm professional for $25 because the Mayan end of the world was coming was a great plan on their part. I'll get 3.0, but my license expires in December, and there's no way I'll go back to not using PyCharm, so I'll have to be stuck on a version thats slowly getting older or pony up for another license at full price. Unless someone else predicts the end of the world soon.
|
# ? Oct 8, 2013 17:20 |
|
Let's say I have a series of objects that are labeled point1, point2, point 3, etc... I want to do something like: Python code:
|
# ? Oct 8, 2013 18:42 |
|
the posted:I'm trying to refer to each point1, point2, point3 while I cycle through the for loop. Anyone? Please avoid wanting to do that.
|
# ? Oct 8, 2013 18:56 |
|
the posted:But I can't do that, since that refers to the ith part in point. I'm trying to refer to each point1, point2, point3 while I cycle through the for loop. Anyone? This is a sign that you should be storing your data differently. Consider storing the points inside an array called "points" so that points[i] is the point you want.
|
# ? Oct 8, 2013 19:07 |
|
must resist evil urge to tell him how to do it
|
# ? Oct 8, 2013 19:09 |
|
Even having the urge to say it makes you a bad person. Again, the, keep your points in a list.
|
# ? Oct 8, 2013 19:33 |
|
Thermopyle posted:Their promo last year where you could get PyCharm professional for $25 because the Mayan end of the world was coming was a great plan on their part. I'm still having trouble getting motivated to try PyCharm simply because there aren't any open source projects that I'm particularly interested in contributing to. Anyone have any good suggestions?
|
# ? Oct 8, 2013 19:59 |
|
the posted:Let's say I have a series of objects that are labeled point1, point2, point 3, etc... QuarkJets posted:I'm still having trouble getting motivated to try PyCharm simply because there aren't any open source projects that I'm particularly interested in contributing to. Anyone have any good suggestions? Dominoes fucked around with this message at 20:53 on Oct 8, 2013 |
# ? Oct 8, 2013 20:47 |
|
To answer everyone, the overall problem has me tracking 16 molecules in a large grid. Currently, each molecule has it's own array that spans 2 columns (x and y coordinates) and each row being it's position at a certain time. I want to write a script that "creates" all 16 molecules evenly spaced in a large grid. I already have the coordinates created, but currently I have something gross: Python code:
Later, I run a loop over the entire time, and I should end up with an array for point1 that has 2 columns, it's coordinates, and rows for the entire time ran for. the fucked around with this message at 23:35 on Oct 8, 2013 |
# ? Oct 8, 2013 23:30 |
|
So what's wrong withPython code:
Your point1 is now points[0] and so on. (maybe stealth) EDIT: the possessive form is "its", not "it's" goddamnit
|
# ? Oct 9, 2013 00:06 |
|
Lysidas posted:So what's wrong with So is that basically making a "3-D" array? I was thinking of trying to do something like that, but I can't really wrap my head around it. But, yeah. Optimally I guess I'd want to do the largest array being the collection of all points, the second level being each point, and for each point I'd have a 400x2 or whatever array of the coordinate point as it changes over time. edit: So if I do this, how do I refer to specific array positions within each one? points[1] gives me the second point, but how do I refer to the second time position within that point? the fucked around with this message at 00:18 on Oct 9, 2013 |
# ? Oct 9, 2013 00:11 |
|
I'm refactoring a python script I wrote earlier this year for work. In a nutshell, it's a bunch of functions that install stuff that are called at the bottom using try/catch. I discovered today that when an error is thrown it will be passed to catch but for some reason it tries to loop back through try again. Anyone know what's going on? I'm executing commands using subprocess.check_call and when it throws an exception the script exits as expected. It's other things like a access denied error when trying to write a file or an invalid url being used with urlib2 that cause it to loop back through try. Ashex fucked around with this message at 02:17 on Oct 9, 2013 |
# ? Oct 9, 2013 02:04 |
|
Ashex posted:I'm refactoring a python script I wrote earlier this year for work. In a nutshell, it's a bunch of functions that install stuff that are called at the bottom using try/catch.
|
# ? Oct 9, 2013 02:11 |
|
Alright, here's an example with just one function being used. In this case it's when creating the directory, didn't add anything to check if it exists so an error is thrown if it's there as expected.code:
Ashex fucked around with this message at 04:01 on Oct 9, 2013 |
# ? Oct 9, 2013 02:22 |
|
Regarding GUIs: It's really sad that GTK3 isn't more portable because I quite like working with PyGObject under Linux. I haven't done too much with QT, but it seemed a bit more complicated to get a simple GUI running. What do you guys like about QT (portability and native look are very nice of course) and how do you usually design your GUIs (code vs. designer)? I don't really like Glade, I can never get things arranged quite right and I like using custom (derived) widgets... Also: gently caress TkInter!
|
# ? Oct 9, 2013 11:21 |
|
Just getting into learning, right now going through the Learn Python the Hard Way course. My question right now is for the first language beginners, what was your first project in Python? Did you have a goal in mind for something you wanted to accomplish?
|
# ? Oct 9, 2013 11:54 |
|
Dominoes posted:What does blah blah blah do, and what do the points look like? That sounds less like a Python project and more like a configuration management nightmare with some Python development on the side
|
# ? Oct 9, 2013 12:08 |
|
Goonicus posted:Just getting into learning, right now going through the Learn Python the Hard Way course. When i started learning python 2 years ago, ive wrote pretty big gui application for company i work for. That was a huge mistake. Wayyy too complicated for first project. Im refactoring it now Your best bet is to try to fix an itch of yours. Automate some mundane task, create a blog. Something reasonably complex, but not too much. Go nuts and learn.
|
# ? Oct 9, 2013 14:15 |
|
loose-fish posted:I haven't done too much with QT, but it seemed a bit more complicated to get a simple GUI running. Designer vs code... it's technique. Try both and figure out what you like about each. I use designer for laying out complex windows, and code simple ones. Designer makes experimenting with layouts quick and easy, and keeps your GUI code separate. There are many things you can't do (or can't do without configuring) in Designer, so your GUI will often be split between the file Designer made and your own code that interacts with it. I love QT, after getting comfortable with it. It's easy and fast to make GUI with. Designer's great. It has useful tools outside the GUI, like its own threading system, and timers. I don't like how packaging binaries with it requires large libraries, causing simple programs to take up 30mb+. Has anyone found a use for the Signal/Slot editor in Designer? Goonicus posted:Just getting into learning, right now going through the Learn Python the Hard Way course. Dominoes fucked around with this message at 14:46 on Oct 9, 2013 |
# ? Oct 9, 2013 14:34 |
|
loose-fish posted:Regarding GUIs: Yeah, it's quite unfortunate. Due to the way our toolchain works, it's really hard to actually build GTK+ on Windows with introspection support. loose-fish posted:I don't really like Glade, I can never get things arranged quite right and I like using custom (derived) widgets... I don't know anybody who likes glade. That said, the GTK+ APIs are hard to make it easy to integrate custom widgets into an editor like that. Part of what we landed this cycle to help them out is composite widget templates, which is a super easy way to say "this widget is a combination of these other widgets". There's also now a small, dedicated team on Glade, and they're fixing it up quite nicely.
|
# ? Oct 9, 2013 15:41 |
|
Goonicus posted:Just getting into learning, right now going through the Learn Python the Hard Way course. I was in a third year university course, on a large project, working with someone who hadn't been majoring in computer science. So instead of Java, I picked python. My first project was a machine translation algorithm from german to english.
|
# ? Oct 9, 2013 16:56 |
|
I'm trying to make a series of loops that assigns something like this: 0 - 0,0 1 - 0,1 2 - 0,2 3 - 0,3 4 - 1,0 5 - 1,1 6 - 1,2 7 - 1,3 8 - 2,0 9 - 2,1 10 - 2,2 11 - 2,3 12 - 3,0 13 - 3,1 14 - 3,2 15 - 3,3 Where I loop through an array 16, and I have two size 4 arrays that I need to assign the values from them as above. I had something like: code:
|
# ? Oct 9, 2013 17:44 |
|
Might not be useful for you in the general case, but I'll just point out that for the example values you've given, j == i // 4, and k == i % 4.
|
# ? Oct 9, 2013 17:49 |
|
Moddington posted:Might not be useful for you in the general case, but I'll just point out that for the example values you've given, j == i // 4, and k == i % 4. Is this a "mod" thing? Someone has tried to explain that to me before, but I have difficulty understanding it.
|
# ? Oct 9, 2013 17:50 |
|
Try using these itertools.permutations() and "for x, y in enumerate(???):". Just play around in a console with those and you'll figure out how to do what you want.
|
# ? Oct 9, 2013 18:00 |
|
Update: This works:Python code:
|
# ? Oct 9, 2013 18:13 |
|
Suspicious Dish posted:I don't know anybody who likes glade. That said, the GTK+ APIs are hard to make it easy to integrate custom widgets into an editor like that. Part of what we landed this cycle to help them out is composite widget templates, which is a super easy way to say "this widget is a combination of these other widgets". That sounds neat, I'm gonna try that the next time I futz around with GUI stuff.
|
# ? Oct 9, 2013 18:27 |
|
Moddington posted:Might not be useful for you in the general case, but I'll just point out that for the example values you've given, j == i // 4, and k == i % 4. Cool I didn't know about the // operator, what's it called?
|
# ? Oct 9, 2013 19:47 |
|
SurgicalOntologist posted:Cool I didn't know about the // operator, what's it called?
|
# ? Oct 9, 2013 19:49 |
|
SurgicalOntologist posted:Cool I didn't know about the // operator, what's it called? Floor Division
|
# ? Oct 9, 2013 19:50 |
|
the posted:Is this a "mod" thing? Someone has tried to explain that to me before, but I have difficulty understanding it. The % operator? Yeah, it's called the 'modulus' or 'mod' operator, and it's one of the two operators for integer division: floor division gives you the quotient, and modulus gives you the remainder. Telarra fucked around with this message at 21:27 on Oct 9, 2013 |
# ? Oct 9, 2013 21:25 |
|
|
# ? Jun 11, 2024 15:57 |
|
evilentity posted:Automate some mundane task, create a blog. Something reasonably complex, but not too much. Go nuts and learn. Yep, this is what I was thinking. Maybe something Active Directory or Exchange based? I'm not even sure how powerful Python is to be honest.
|
# ? Oct 9, 2013 22:19 |