Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
mfiers committed May 25, 2012
2 parents 6030823 + be6a3ed commit e4acab4
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 43 deletions.
40 changes: 20 additions & 20 deletions bin/fastaInfo
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,17 @@ if options.stats:
for x in args:
dd[x] = []

funcs = ['length', 'fracn', 'id', 'scaf10', 'scaf100', 'gcfrac']
funcs = ['length', 'fracn', 'id', 'scaf10', 'scaf100', 'gcfrac', 'ncount']

def f_id(name, seq):
return name.split()[0]

def f_length(name,seq):
return len(seq)

def f_ncount(name,seq):
return seq.count('n')

def f_loglength(name,seq):
return math.log10(len(seq))

Expand Down Expand Up @@ -202,27 +205,24 @@ data = dict([(x, []) for x in stats])

def statAdd(d,w,v,what,store):
store[what][w] = v
try:
if abs(v) < 1e-8:
d[w].append("0 ")
elif math.log10(abs(v)) > 6:
if options.rawNumbers:
d[w].append("%s" % v)
else:
if options.rawNumbers:
d[w].append("%s" % v)
else:
try:
if abs(v) < 1e-8:
d[w].append("0 ")
elif math.log10(abs(v)) > 6:
d[w].append("%.2e" % v)
elif v == int(v):
d[w].append("%d " % v)
elif math.log10(abs(v)) < -3:
if options.rawNumbers:
d[w].append("%s" % v)
else:
elif v == int(v):
d[w].append("%d " % v)
elif math.log10(abs(v)) < -3:
d[w].append("%.2e" % v)
else:
d[w].append("%.4f " % v)
except ValueError:
l.error("ERROR")
l.error("probably with a math.log10 of something close to 0")
l.error("%s %s %s" % (d,w,v))
else:
d[w].append("%.4f " % v)
except ValueError:
l.error("ERROR")
l.error("probably with a math.log10 of something close to 0")
l.error("%s %s %s" % (d,w,v))

def getNX(d, N):
cutoff = np.sum(d) * N
Expand Down
6 changes: 4 additions & 2 deletions bin/moar
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import subprocess as sp

base = os.path.abspath(os.getcwd())

cl = sys.argv[1:]
cl = " ".join(sys.argv[1:])
print 'executing:'
print cl
for path, dirs, files in os.walk(base):
toRemove = [x for x in dirs if x[0] in ['.', '_']]
[dirs.remove(x) for x in toRemove]
print "Running in %s" % path
print 'executing in %s' % path
P = sp.Popen(cl, cwd=path, shell=True)
P.wait()
2 changes: 1 addition & 1 deletion etc/config
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ mancommand: "nroff -c -mandoc 2>/dev/null | less -is"
pandocbin: pandoc
use_ansi: True
default_command: status
default_shell: '/bin/bash -ev'
default_shell: '/bin/bash -e'
plugin_settings:
moaGit:
warnings: False
Expand Down
4 changes: 2 additions & 2 deletions lib/python/moa/plugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def initialize(self):
l.debug("Successfully Loaded module %s" % pyModule)
except ImportError, e:
sys.stderr.write("ERROR - Plugin %s is not (properly) installed\n" % plugin)
#if '-v' in sys.argv or '-vv' in sys.argv:
# raise
if '-v' in sys.argv or '-vv' in sys.argv:
raise
sys.exit(-1)


Expand Down
30 changes: 16 additions & 14 deletions lib/python/moa/plugin/system/moaGit.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
import optparse
import subprocess

import git
#import smmap
#import git

from moa.sysConf import sysConf

import moa.args
import moa.logger as l
import moa.plugin.newjob
import moa.plugin.system.newjob


# def hook_defineCommands():
Expand All @@ -40,16 +42,16 @@
# }


def _getRepo(job):
"""
Return the git repository object
"""
wd = job.wd
try:
repo = git.Repo(wd)
return repo
except git.InvalidGitRepositoryError:
return None
# def _getRepo(job):
# """
# Return the git repository object
# """
# wd = job.wd
# try:
# repo = git.Repo(wd)
# return repo
# except git.InvalidGitRepositoryError:
# return None


def _checkInRepo(job):
Expand Down Expand Up @@ -155,9 +157,9 @@ def _commit(job, message):
#repo.git.commit(os.path.join(job.wd, '.moa', 'template.d'))

@moa.args.command
def gitadd(job):
def gitadd(job, args):
"""
Add a job to the git repository
add this job to a git repository
"""
l.debug("adding to git %s" % job.wd)
_commit(job, "add/refresh of %s" % job.wd)
Expand Down
7 changes: 7 additions & 0 deletions lib/python/moa/plugin/system/openLavaActor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ def hook_defineCommandOptions(job, parser):
parser.add_argument( '--olq', default='normal', dest='openlavaQueue',
help='The Openlava queue to submit this job to' )

parser.add_argument( '--oln', default=1, type=int, dest='openlavaSlots',
help='The number of cores the jobs requires')

def openlavaRunner(wd, cl, conf={}, **kwargs):
"""
Run the job using OPENLAVA
Expand Down Expand Up @@ -70,6 +73,10 @@ def s(*cl):
s("#BSUB -e", errfile)
s("#BSUB -q", sysConf.args.openlavaQueue)


slots = sysConf.job.conf.get('threads', sysConf.args.openlavaSlots)
s("#BSUB -n", slots)

lastJids = []

#if len(sysConf.job.data.openlava.get('jidlist', [])) > 1:
Expand Down
11 changes: 7 additions & 4 deletions template2/sync.run.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def errex(message):
if ignore:
print "ignoring", ignore

if source:
print "source directory is not defined"
if not source:
print "source directory is not defined - just syncing"
SOURCE=False
elif os.path.isdir(source):
SOURCE=True
Expand Down Expand Up @@ -86,10 +86,12 @@ def errex(message):

if SOURCE:
print "start parsing the source directory"
sourcelist = [x for x in os.listdir(source) if os.path.isdir(x)]
sourcelist = [x for x in os.listdir(source)
if ( not x[0] == '.'
and os.path.isdir(os.path.join(source, x)))
]
if os.path.exists('_ref'):
sourcelist.append('_ref')

#make sure we're not copying the file to itself
sourcelist.remove(original)

Expand All @@ -98,6 +100,7 @@ def errex(message):
sourcelist = [x for x in os.listdir('.') if os.path.isdir(x)]

print "Syncing %s to %d target(s)" % (original, len(sourcelist))

for indir in sourcelist:
sourceDir = os.path.join(source, indir)

Expand Down

0 comments on commit e4acab4

Please sign in to comment.