Ejemplo n.º 1
0
"""
import sys, os, math
#bit_number = math.log(sys.maxint)/math.log(2)
#if bit_number>40:       #64bit
sys.path.insert(0, os.path.expanduser('~/lib/python'))
sys.path.insert(0, os.path.join(os.path.expanduser('~/script')))

import getopt, csv, math, random
import Numeric, cPickle
from pymodule import PassingData, importNumericArray, SNPData, read_data
from sets import Set
from pymodule.DrawMatrix import drawMatrix, drawLegend, drawContinousLegend, get_font, combineTwoImages, Value2Color
from Scientific import MPI
from pymodule.MPIwrapper import MPIwrapper

num = importNumericArray()


class MpiLD(MPIwrapper):
    __doc__ = __doc__
    option_default_dict = {('input_fname',1, ): [None, 'i', 1, 'a file containing StrainXSNP matrix.'],\
          ("output_fname", 1, ): [None, 'o', 1, 'Filename to store data matrix'],\
          ('block_size', 1, int):[1000, 's', 1, 'square of it is the number (or half of that) of LDs each computing node handles. Imagine a SNPXSNP LD matrix. block_size is the dimension of the block each node handles.'],\
          ("min_LD_to_output", 1, float): [0.3, 'm', 1, "output LD data whose |D'| is above this cutoff"],\
          ('min_MAF', 1, float): [0.10, 'n', 1, 'minimum Minor Allele Frequency for both SNPs.'],\
          ('discard_perc', 1, float): [0.999, 'p', 1, 'percentage of SNP Pairs to be randomly discarded. this filter is applied before min_LD_to_output and min_MAF'],\
          ('debug', 0, int):[0, 'b', 0, 'toggle debug mode'],\
          ('report', 0, int):[0, 'r', 0, 'toggle report, more verbose stdout/stderr.']}

    def __init__(self, **keywords):
        """
Ejemplo n.º 2
0
	Within each country, strains are in the order of longitude, latitude.
"""
import sys, os, math
#bit_number = math.log(sys.maxint)/math.log(2)
#if bit_number>40:       #64bit
sys.path.insert(0, os.path.expanduser('~/lib/python'))
sys.path.insert(0, os.path.join(os.path.expanduser('~/script')))

import getopt, csv, math
import Numeric, cPickle
from pymodule import PassingData, importNumericArray, write_data_matrix, SNPData
import StockDB
from sets import Set
from pymodule.DrawMatrix import drawMatrix, drawLegend, drawContinousLegend, get_font, combineTwoImages, Value2Color

num = importNumericArray()

class Output149CrossMatch(object):
	__doc__ = __doc__
	option_default_dict = {('drivername', 1,):['mysql', 'v', 1, 'which type of database? mysql or postgres', ],\
							('hostname', 1, ): ['papaya.usc.edu', 'z', 1, 'hostname of the db server', ],\
							('dbname', 1, ): ['stock', 'd', 1, 'database name', ],\
							('schema', 0, ): [None, 'k', 1, 'database schema name', ],\
							('db_user', 1, ): [None, 'u', 1, 'database username', ],\
							('db_passwd', 1, ): [None, 'p', 1, 'database password', ],\
							('QC_method_id', 1, int): [None, 'm', 1, 'id in table QC_method'],\
							("input_fname", 0, ): [None, 'i', 1, 'get the mismatch rate from this file, rather than the db'],\
							("max_mismatch_rate", 0, float): [1, 'a', 1, 'to filter out any data above the maximum mismatch rate'],\
							('min_no_of_non_NAs', 0, int):[20, 'n', 1, 'to filter out data below the minimum no_of_non_NA_pairs'],\
							('font_path', 1, ):['/usr/share/fonts/truetype/freefont/FreeSerif.ttf', 'e', 1, 'path of the font used to draw labels'],\
							('font_size', 1, int):[20, 's', 1, 'size of font, which determines the size of the whole figure.'],\