while read line; do echo -n "$line" | wc -c; done< f1
'''This code tried to do things the hard way to solve: http://www.biostars.org/p/92205/ by | |
first, the function split_fasta() splits the original fasta file into files containing individual sequence records; | |
second, blast_seq_the_hard_way() iterates over these individual files and feeds their filenames to BLAST. | |
Please note that BLAST can handle multiple sequences in -query and -subject at the same time, so there is no need | |
to split the files. This code is just for demonstration purposes. | |
''' | |
import os | |
import re | |
from Bio.Blast.Applications import NcbiblastpCommandline |
#!/bin/sh | |
oldext=".md" | |
newext=".markdown" | |
for file in $(git ls-files | grep ${oldext}\$); do | |
echo processing $file... | |
filename="${file%.*}" | |
git mv $file ${filename}$newext | |
done |
# Say I have such classes A, B, C, ..., Y, and Z that do different things, | |
# and classes AComment, BComment, CComment, ..., YComment and ZComment | |
# that record comments on instances of class A, B, ..., Y and Z respectively. | |
# All XComment classes share the same attributes except one property | |
# that is is dependent on the class the comment is for. | |
# e.g. AComment has a property 'a' and BComment has a property 'b'. | |
class A(): | |
def __init__(self): | |
print 'init an instance of class A' |
The segfault problem with posix_spawn is indeed caused by Lion's compiler being LLVM and not GCC by default. However, when I installed RVM, the notes suggested that on Lion you need to add export CC=/usr/bin/gcc-4.2
to your shell startup file (.bashrc
or .zshrc
as appropriate). I did that, but it seems that's what caused problems: while ruby 1.9.2 needs you to use GCC to install it, using the same compiler for the gems apparently causes breakage.
First, you need to install XCode 4.x, which is now a free (though hefty!) download from the Mac App Store. Without that, you have no gcc, so you won't get anywhere ;-)
Next, what you need to do is clear out your rvm ruby and the associated gems (make sure you are cd'd into your octopress repository then do:
rvm remove ruby-1.9.2 --gems --archive
which will clear everything out so that you can start from scratch. Obviously, if you have other stuff you've installed for other purposes using RVM, be careful with this. If you previously had the export CC li
import re | |
txt = 'abc-def, -g!8hij' | |
words = re.compile('[^A-z^a-z]+').split(txt) | |
# Or | |
words = re.split('[^A-z^a-z]+',txt) | |
# References: | |
# http://docs.python.org/library/re.html#re.split |
#!/usr/bin/python | |
import sys | |
def fac(n): | |
'''n!''' | |
if n==0 or n==1: | |
return 1 | |
else: | |
return n*fac(n-1) |
def sieveEratosthenes(limit): | |
'''Return all primes below the limit''' | |
numbers = range(3,limit,2) | |
primes = [2] | |
while True: | |
prime = numbers.pop(0) | |
primes.append(prime) | |
for n in range(prime**2, limit, 2*prime): | |
try: | |
numbers.remove(n) |
import collections | |
def dfs(G, s, path=[]): | |
global explored | |
explored.add(s) | |
path.append(s) | |
for v in G[s]: | |
if v not in path: | |
path = dfs(G, v, path) | |
return path |
;; Requisites: Emacs >= 24 | |
;; INSTALL PACKAGES | |
;; -------------------------------------- | |
(prefer-coding-system 'utf-8) | |
(require 'package) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.org/packages/") t) | |
(package-initialize) |