コード例 #1
0
ファイル: popgenstat.py プロジェクト: Zsailer/DendroPy
def wattersons_theta(char_matrix, ignore_uncertain=True):
    deprecate.dendropy_deprecation_warning(
            preamble="The 'dendropy.popgenstat' module has moved to 'dendropy.calculate.popgenstat'.",
            old_construct="from dendropy import popgenstat\npopgenstat.watterson_theta(...)",
            new_construct="from dendropy.calculate import popgenstat\npopgenstat.watterson_theta(...)",
            )
    return popgenstat.wattersons_theta(char_matrix=char_matrix, ignore_uncertain=ignore_uncertain)
コード例 #2
0
def wattersons_theta(char_matrix, ignore_uncertain=True):
    deprecate.dendropy_deprecation_warning(
        preamble=
        "The 'dendropy.popgenstat' module has moved to 'dendropy.calculate.popgenstat'.",
        old_construct=
        "from dendropy import popgenstat\npopgenstat.watterson_theta(...)",
        new_construct=
        "from dendropy.calculate import popgenstat\npopgenstat.watterson_theta(...)",
    )
    return popgenstat.wattersons_theta(char_matrix=char_matrix,
                                       ignore_uncertain=ignore_uncertain)
コード例 #3
0
ファイル: test_popgenstat.py プロジェクト: Zsailer/DendroPy
 def test_wattersons_theta(self):
     self.assertAlmostEqual(popgenstat.wattersons_theta(self.data, ignore_uncertain=True), 49.00528, 4)
コード例 #4
0
 def test_wattersons_theta(self):
     self.assertAlmostEqual(
         popgenstat.wattersons_theta(self.data, ignore_uncertain=True),
         49.00528, 4)
コード例 #5
0
# -*- coding: utf-8 -*-

"run as python estimate_SFS_stats.py $inputfile"
"Appends to the given output file"

import dendropy
from dendropy.calculate import popgenstat
import os
import sys

seqs = dendropy.DnaCharacterMatrix.get(path=sys.argv[1], schema="fasta")

out = open("popgen_stats.txt", "a")

pop = sys.argv[1].split("/")[1].split("_")[2].split(".")[0]
gene = sys.argv[1].split("/")[1].split("_")[0]
fbtr = sys.argv[1].split("/")[1].split("_")[1]
td = popgenstat.tajimas_d(seqs)
tw = popgenstat.wattersons_theta(seqs)
tp = popgenstat.average_number_of_pairwise_differences(seqs)
ss = popgenstat.num_segregating_sites(seqs)

out.write("\t".join(
    [str(pop),
     str(gene),
     str(fbtr),
     str(td),
     str(tw),
     str(tp),
     str(ss)]) + "\n")