コード例 #1
0
def main():
    input = ComLine(sys.argv[1:])

    executable = "BA3-SNPS"

    if cmd_exists(executable) is False:
        if cmd_exists("ba3-snps") is True:
            executable = "ba3-snps"
        else:
            print("BA3-SNPS is not installed.")
            print("Please install BA3-SNPS before proceeding.")
            raise SystemExit

    ba = Bayesass(executable, input.args.immanc, input.args.loci,
                  input.args.out, input.args.generations, input.args.burnin,
                  input.args.seed)
    for i in range(1, input.args.reps + 1, 1):
        print("Running repetition", i, "of", input.args.reps)
        command = ba.create_command()
        stdout = ba.run_program(command, i)
        tune = Autotune(stdout, ba.m, ba.a, ba.f)
        tune.read_stdout()
        ba.m, ba.a, ba.f, mbool, abool, fbool = tune.determine_params(
            ba.testedM, ba.testedA, ba.testedF, ba.m, ba.a, ba.f)
        if all((mbool, abool, fbool)):
            earlyMessage = "Tuning completed early after " + str(
                i) + " rounds."
            ba.write_final_params(earlyMessage)
            raise SystemExit
    lateMessage = "Tuning not completed after " + str(
        input.args.reps) + " rounds."
    ba.write_final_params(lateMessage)
コード例 #2
0
def main():
    input = ComLine(sys.argv[1:])
    cvFile = CV(input.args.cv)
    cvFile.readText()
    #cvFile.printText()

    so = CVStats(cvFile.d, input.args.out)
    so.calcStats()
    so.printStats()

    plot = Graphics(cvFile.d, input.args.cv)
    plot.printFigure()
コード例 #3
0
ファイル: worqer.py プロジェクト: gurgeh/webQ
    def __init__(self, server, pw, name=None):
        self.the_type = self.__class__.__name__
        if name is None:
            name = socket.gethostname()
        self.name = name
        self.server = server
        self.pw = pw

        self.logs = []
        self.thrownlog = 0
        self.last_sc_upload = time.time()

        self.the_logger = logging.getLogger(self.name)
        self.the_logger.setLevel(logging.INFO)

        self.queues = []
        self.overlord = self.make_lord('commands_%s_%s' % (self.the_type, self.name))

        self.config = {}
        config = self.get_config()
        self.config_update(config)
        self.config = config
        
        self.stats = self.get_stats()
        self.stats['started'] = time.mktime(time.gmtime())

        logconf = self.config.get('logging', {})
        logconf['filename'] = './%s_%s.log' % (self.the_type, self.name)
        logging.basicConfig(**logconf)
        self.the_logger = logging.getLogger(self.name)
        self.the_logger.setLevel(self.config.get('loglevel', logging.INFO))
        self.log('info', 'I live to serve!')
        
        self.sched = Scheduler()
        self.sched.start()

        self.sched.add_interval_job(self.upload, seconds=self.config.get('check_interval', 60))

        ComLine.__init__(self)
コード例 #4
0
def main():
    input = ComLine(sys.argv[1:])

    #handle bayescan output
    bs = BayeScan(input.args.bayescan, input.args.fdr)
    bsCommand = bs.build_command()
    bs.run_program(bsCommand)
    print(input.args.bayescan)

    #handle lositan output
    los = Lositan(input.args.lositan, 0.025)
    los.readLositan()
    los.printSignificant()

    #compare outputs
    com = Compare("bayescan.outliers.txt", "lositan.positive_selection.txt")
    com.readInput()
    com.printResults(input.args.vcf)
コード例 #5
0
def main():
	input = ComLine(sys.argv[1:])
	vcf_file = VCF(input.args.vcf, input.args.thin, input.args.maf, input.args.indcov, input.args.snpcov, input.args.bi)
	#if input.args.filter == True:
	#	vcf_file.convert_filter()
	#else:

	#convert to Plink
	vcf_file.convert()

	populations = Popmap(input.args.popmap)
	vcf_file.plink()
	vcf_file.print_populations(populations)
	admix_run = Admixture(vcf_file.prefix, input.args.np, input.args.minK, input.args.maxK, input.args.rep, input.args.cv)
	admix_run.admix()
	admix_run.create_zip()
	admix_run.loglik()
	admix_run.print_cv()
コード例 #6
0
def main():
    input = ComLine(sys.argv[1:])

    vcf_file = VCF(input.args.vcf, input.args.thin, input.args.maf,
                   input.args.mac, input.args.indcov, input.args.snpcov,
                   input.args.bi, input.args.remove)

    #convert to Plink
    populations = Popmap(input.args.popmap)
    vcf_file.compIndLists(populations)
    vcf_file.convert()
    vcf_file.plink()
    vcf_file.print_populations(populations)
    vcf_file.print_individuals(populations)

    admix_run = Admixture(vcf_file.prefix, input.args.np, input.args.minK,
                          input.args.maxK, input.args.rep, input.args.cv)
    admix_run.admix()
    admix_run.create_zip()
    admix_run.loglik()
    admix_run.print_cv()
コード例 #7
0
def main():
    input = ComLine(sys.argv[1:])
    verts = FindVertices(input.args.points, input.args.streams,
                         input.args.code)
    print verts.vertices
    print verts.splits
    lines = FindLines(verts.vertices, verts.splits, input.args.code)
    exNodes = ExportTable(verts.vertices, "nodes.txt")
    exNodes.export(input.args.code)
    exBranches = ExportTable(verts.splits, "branches.txt")
    exBranches.export(input.args.code)

    #project the files into UTM Zone 12N - files must be in projected coordinate system for calculating stream length
    #need to add a command line option for changing the projection
    projection = "NAD 1983 UTM Zone 12N"
    prStreams = ProjectFile(verts.splits, projection)
    proj_streams = prStreams.define_projection()
    prSites = ProjectFile(input.args.points, projection)
    proj_sites = prSites.define_projection()

    #calculate stream distance
    dist_streams = CalculateDistance(proj_streams)
    dist_streams.calcdist()
コード例 #8
0
ファイル: phy2vcf.py プロジェクト: tw7649116/phy2vcf
def main():
    input = ComLine(sys.argv[1:])
    phy = Phylip(input.args.phy)
    pops = Popmap(input.args.popmap)
    VCF(phy, pops, input.args.out)
コード例 #9
0
def main():
    input = ComLine(sys.argv[1:])
    pops = Popmap(input.args.popmap)
    vcf = VCF(input.args.vcf, pops)
    vcf.printFile(input.args.out)
    vcf.printPrivate(input.args.out)