Пример #1
0
    def test_wl2qlc(self):
        stamp = 'test-stamp'
        out = self.tmp_path('test')

        wl2qlc(self.wordlist.header,
               self.wordlist._data,
               filename=out.as_posix(),
               stamp=stamp)
        out = self.tmp_path('test.qlc')

        with out.open(encoding='utf8') as fp:
            self.assertTrue(fp.read().endswith(stamp))

        # load a worldist with alignments and otuput it as string with msapairs
        tmp = Alignments(test_data('good_file.tsv'), ref='cogid')
        tmp.align(ref="cogid")

        wl2qlc(tmp.header,
               tmp._data,
               meta=tmp._meta,
               filename=out.as_posix(),
               stamp='stampo',
               ignore=[])
        tmp.get_consensus(ref="cogid")

        wl2qlc([
            h.upper() for h in sorted(tmp.header, key=lambda x: tmp.header[x])
        ],
               tmp._data,
               meta=tmp._meta,
               filename=out.as_posix(),
               stamp='stampo',
               ignore=[],
               formatter="doculect,concept")
        wl2qlc([
            h.upper() for h in sorted(tmp.header, key=lambda x: tmp.header[x])
        ],
               tmp._data,
               meta=tmp._meta,
               filename=out.as_posix(),
               stamp='stampo',
               ignore=[],
               formatter="doculect")
Пример #2
0
def test_wl2qlc(tmppath, test_data, wordlist):
    stamp = 'test-stamp'
    out = tmppath / 'test'

    wl2qlc(wordlist.header, wordlist._data, filename=str(out), stamp=stamp)
    out = tmppath / 'test.qlc'
    assert out.read_text(encoding='utf8').endswith(stamp)

    # load a worldist with alignments and otuput it as string with msapairs
    tmp = Alignments(str(test_data / 'good_file.tsv'), ref='cogid')
    tmp.align(ref="cogid")

    wl2qlc(tmp.header,
           tmp._data,
           meta=tmp._meta,
           filename=str(out),
           stamp='stampo',
           ignore=[])
    tmp.get_consensus(ref="cogid")

    wl2qlc(
        [h.upper() for h in sorted(tmp.header, key=lambda x: tmp.header[x])],
        tmp._data,
        meta=tmp._meta,
        filename=out.as_posix(),
        stamp='stampo',
        ignore=[],
        formatter="doculect,concept")
    wl2qlc(
        [h.upper() for h in sorted(tmp.header, key=lambda x: tmp.header[x])],
        tmp._data,
        meta=tmp._meta,
        filename=out.as_posix(),
        stamp='stampo',
        ignore=[],
        formatter="doculect")
Пример #3
0
 def setUp(self):
     WithTempDir.setUp(self)
     self.alm = Alignments(test_data('KSL2.qlc'),
                           loans=False,
                           _interactive=False)
     self.alm.align()
Пример #4
0
def alm(test_data):
    a = Alignments(str(test_data / 'KSL2.qlc'), loans=False,_interactive=False)
    a.align()
    return a