コード例 #1
0
 def test_minimal_variants_html(self):
     w = pileup.Variants(json="{}",
                         build='hg19',
                         contig='chr1',
                         start=1,
                         stop=20)
     output = StringIO()
     state = dependency_state(w, drop_defaults=True)
     embed_minimal_html(output, views=w, drop_defaults=True, state=state)
     content = output.getvalue()
     print("CONTENT!!!!!!!!!!!!!!!!!!")
     print(content)
     assert content.splitlines()[0] == '<!DOCTYPE html>'
コード例 #2
0
    def test_embed_variants(self):
        w = pileup.Variants(json="{}",
                            build='hg19',
                            contig='chr1',
                            start=1,
                            stop=20)
        state = dependency_state(w, drop_defaults=True)
        data = embed_data(views=w, drop_defaults=True, state=state)

        state = data['manager_state']['state']
        views = data['view_specs']

        assert len(views) == 1

        model_names = [s['model_name'] for s in state.values()]
        assert 'VariantModel' in model_names
コード例 #3
0
ファイル: rdd.py プロジェクト: madelyn-petersohn/mango
    def ViewVariants(self, variantRDD, contig, start, end, showPlot=True):
        contig_trimmed = contig.lstrip(self.chrPrefix)

        # Filter RDD
        filtered = variantRDD.transform(lambda r: r.filter(
            ((r.contigName == contig) | (r.contigName == contig_trimmed))
            & (r.start < end) & (r.end > start)))

        # convert to GA4GH JSON to be consumed by mango-viz module
        json = self.ac._jvm.org.bdgenomics.mango.converters.GA4GHutil.variantRDDtoJSON(
            filtered._jvmRdd)

        # visualize
        if (showPlot):
            return pileup.Variants(json=json,
                                   build=self.build,
                                   contig=contig,
                                   start=start,
                                   stop=end)
コード例 #4
0
    def test_embed_data_two_widgets(self):
        w1 = pileup.Variants(json="{}",
                             build='hg19',
                             contig='chr1',
                             start=1,
                             stop=20)
        w2 = pileup.Features(json="{}",
                             build='hg19',
                             contig='chr1',
                             start=1,
                             stop=20)

        jslink((w1, 'start'), (w2, 'start'))
        state = dependency_state([w1, w2], drop_defaults=True)
        data = embed_data(views=[w1, w2], drop_defaults=True, state=state)

        state = data['manager_state']['state']
        views = data['view_specs']

        assert len(views) == 2

        model_names = [s['model_name'] for s in state.values()]
        assert 'VariantModel' in model_names
        assert 'FeatureModel' in model_names