the util functions

mkpath[source]

mkpath(directory)

Have to use system mkdir here because python2.7's mkpath is currently faulty!

class Environment[source]

Environment()

class StdoutCapturer[source]

StdoutCapturer(iterable=()) :: list

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

stdoutRedirect[source]

stdoutRedirect(to='/dev/null')

import os

with stdoutRedirect(to=filename): print("from Python") os.system("echo non-Python applications are also supported")

class cd[source]

cd(newPath)

Context manager for changing the current working directory

runCommand[source]

runCommand(cmd, instream=None, msg='', upon_succ=None, show_stderr=False, return_zero=True)

class CMDWorker[source]

CMDWorker(queue) :: Process

Process objects represent activity that is run in a separate process

The class is analogous to threading.Thread

runCommands[source]

runCommands(cmds, ncpu)

parmap[source]

parmap(f, X, nprocs=32)

downloadURL[source]

downloadURL(URL, dest_dir, quiet=True, mode=None, force=False)

calculateFileMD5[source]

calculateFileMD5(filename)

zipdir[source]

zipdir(path, zipfile, arcroot='/')

removeFiles[source]

removeFiles(dest, exclude=[], hidden=False)

removeEmptyDir[source]

removeEmptyDir(directory)

copyFiles[source]

copyFiles(pattern, dist, ignore_hidden=True)

downloadResources[source]

downloadResources(fromto)

getColumn[source]

getColumn(fn, num, delim=None, exclude=None)

wordCount[source]

wordCount(filename)

Returns a word/count dict for this filename.

fileLinesCount[source]

fileLinesCount(fname)

connected_components[source]

connected_components(lists)

listit[source]

listit(t)

parseVCFline[source]

parseVCFline(line, exclude=[])

indexVCF[source]

indexVCF(vcf, verbose=True)

extractSamplenames[source]

extractSamplenames(vcf)

checkVCFBundle[source]

checkVCFBundle(vcf)

VCF bundle should have a .gz file and a tabix file

rewriteFamfile[source]

rewriteFamfile(tfam, samples, keys)

checkSamples[source]

checkSamples(samp1, samp2)

check if two sample lists agree

  1. samples in FAM but not in VCF --> ERROR
  2. samples in VCF but not in FAM --> give a message

class NoCache[source]

NoCache()

class Cache[source]

Cache(cache_dir, cache_name, params)

class PseudoAutoRegion[source]

PseudoAutoRegion(chrom, build)

class TFAMParser[source]

TFAMParser(tfam=None)

isnotebook[source]

isnotebook()