當前位置: 首頁>>代碼示例>>Python>>正文


Python GenePop.parse方法代碼示例

本文整理匯總了Python中Bio.PopGen.GenePop.parse方法的典型用法代碼示例。如果您正苦於以下問題:Python GenePop.parse方法的具體用法?Python GenePop.parse怎麽用?Python GenePop.parse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Bio.PopGen.GenePop的用法示例。


在下文中一共展示了GenePop.parse方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_convert

# 需要導入模塊: from Bio.PopGen import GenePop [as 別名]
# 或者: from Bio.PopGen.GenePop import parse [as 別名]
 def test_convert(self):
     """Basic conversion test.
     """
     for i in range(len(self.handles)):
         gp_rec = GenePop.parse(self.handles[i])
         fd_rec = convert_genepop_to_fdist(gp_rec)
         assert(fd_rec.num_loci == 3)
         assert(fd_rec.num_pops == 3)
開發者ID:andyoberlin,項目名稱:biopython,代碼行數:10,代碼來源:test_PopGen_FDist_nodepend.py

示例2: test_wrong_file_parser

# 需要導入模塊: from Bio.PopGen import GenePop [as 別名]
# 或者: from Bio.PopGen.GenePop import parse [as 別名]
 def test_wrong_file_parser(self):
     """Testing the ability to deal with wrongly formatted files
     """
     f = open(os.path.join("PopGen", "fdist1"))
     try:
         rec = GenePop.parse(f)
         raise Error("Should have raised exception")
     except ValueError:
         pass
     f.close()
開發者ID:apierleoni,項目名稱:biopython,代碼行數:12,代碼來源:test_PopGen_GenePop_nodepend.py

示例3: test_record_parser

# 需要導入模塊: from Bio.PopGen import GenePop [as 別名]
# 或者: from Bio.PopGen.GenePop import parse [as 別名]
 def test_record_parser(self):
     """Basic operation of the Record Parser.
     """
     for index in range(len(self.handles)):
         handle = self.handles[index]
         rec = GenePop.parse(handle)
         assert isinstance(rec, GenePop.Record)
         assert len(rec.loci_list) == self.num_loci[index]
         assert rec.marker_len == self.marker_len[index]
         assert len(rec.populations) == self.pops_indivs[index][0]
         for i in range(self.pops_indivs[index][0]):
             assert len(rec.populations[i]) == \
                        self.pops_indivs[index][1][i]
開發者ID:andyoberlin,項目名稱:biopython,代碼行數:15,代碼來源:test_PopGen_GenePop.py

示例4: getRefs

# 需要導入模塊: from Bio.PopGen import GenePop [as 別名]
# 或者: from Bio.PopGen.GenePop import parse [as 別名]
def getRefs(expr, gen, numReps):
    refs = []
    for rep in range(numReps):
        fname = eval(expr)
        fi = open(fname)
        rec = GenePop.parse(fi)
        fi.close()
        csld = GenePop.Record()
        csld.loci_list = deepcopy(rec.loci_list)
        csld.populations=[[]]
        for pop in rec.populations:
            csld.populations[0].extend(pop)
        refs.append(csld)
    return refs
開發者ID:tiagoantao,項目名稱:mosquitoNe,代碼行數:16,代碼來源:calcTemporal.py

示例5: test_utils

# 需要導入模塊: from Bio.PopGen import GenePop [as 別名]
# 或者: from Bio.PopGen.GenePop import parse [as 別名]
 def test_utils(self):
     """Basic operation of GenePop Utils.
     """
     for index in range(len(self.handles)):
         handle = self.handles[index]
         rec = GenePop.parse(handle)
     initial_pops = len(rec.populations)
     initial_loci = len(rec.loci_list)
     first_loci = rec.loci_list[0]
     rec.remove_population(0)
     assert len(rec.populations) == initial_pops - 1
     rec.remove_locus_by_name(first_loci)
     assert len(rec.loci_list) == initial_loci - 1
     assert rec.loci_list[0] != first_loci
     rec.remove_locus_by_position(0)
     assert len(rec.loci_list) == initial_loci - 2
開發者ID:apierleoni,項目名稱:biopython,代碼行數:18,代碼來源:test_PopGen_GenePop_nodepend.py

示例6: calcFs

# 需要導入模塊: from Bio.PopGen import GenePop [as 別名]
# 或者: from Bio.PopGen.GenePop import parse [as 別名]
def calcFs(expr, numReps, gpRefs, gen, refGen):
    for rep in range(numReps):
        fname = eval(expr)
        gpRef = gpRefs[rep]
        fi = open(fname)
        rec = GenePop.parse(fi)
        fi.close()
        Nes = []
        NesP = []
        for pop in rec.populations:
            F = calcF(gpRef.populations[0], pop, len(gpRef.loci_list))
            Mes = calcNe(F, gen-refGen, len(gpRef.populations[0]), len(pop))
            Ne = Mes[0]
            NeP = Mes[1:]
            #print Ne
            #print "F", F, 100.0*F/129.0, 100*F/74.0
            #Ne = (1.0*(gen-refGen))/ (2*F)
            NesP.append(str(min(NeP))+"#"+str(max(NeP)))
            Nes.append(Ne)
        print gen, rep, "NeF", " ".join(map(lambda x: str(x), Nes))
        print gen, rep, "NeFPow", " ".join(map(lambda x: str(x), NesP))
開發者ID:tiagoantao,項目名稱:mosquitoNe,代碼行數:23,代碼來源:calcTemporal.py

示例7: get_basic_info

# 需要導入模塊: from Bio.PopGen import GenePop [as 別名]
# 或者: from Bio.PopGen.GenePop import parse [as 別名]
 def get_basic_info(self):
     f = open(self._fname)
     rec = GenePop.parse(f)
     f.close()
     return rec.pop_list, rec.loci_list
開發者ID:jamescasbon,項目名稱:biopython,代碼行數:7,代碼來源:EasyController.py


注:本文中的Bio.PopGen.GenePop.parse方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。