示例#1
0
文件: igv.py 项目: rreusser/dash-docs
def return_igv(genome):
    return (html.Div(
        [dashbio.Igv(
            id='default-igv',
            genome=genome,
            minimumBases=100,
        )]))
示例#2
0
 def return_igv(genome, bases):
     return (html.Div([
         dash_bio.Igv(
             id=_COMPONENT_ID,
             genome=genome,
             reference=None,
             minimumBases=bases,
         )
     ]))
示例#3
0
def test_dbigv002_ASM985889v3_tracks(dash_duo):
    app = dash.Dash(__name__)

    try:
        requests.get('https://www.google.com/').status_code
        data_path = 'https://s3.amazonaws.com/igv.org.genomes/'
    except requests.exceptions.ConnectionError:
        print("Running test with local datasets")
        data_path = app.get_asset_url('')

    app.layout = html.Div(
        simple_app_layout(
            dash_bio.Igv(
                id=_COMPONENT_ID,
                reference={
                    "id":
                    "ASM985889v3",
                    "name":
                    "Sars-CoV-2 (ASM985889v3)",
                    "fastaURL":
                    data_path +
                    "covid_ASM985889v3/GCF_009858895.2_ASM985889v3_genomic.fna",
                    "indexURL":
                    data_path +
                    "covid_ASM985889v3/GCF_009858895.2_ASM985889v3_genomic.fna.fai",
                    "order":
                    1000000,
                    "tracks": [{
                        "name": "Annotations",
                        "url": data_path +
                        "covid_ASM985889v3/GCF_009858895.2_ASM985889v3_genomic.gff.gz",
                        "displayMode": "EXPANDED",
                        "nameField": "gene",
                        "height": 150
                    }]
                },
                tracks=
                [{  # normally, tracks listed here would not duplicate those already present above
                    "name": "Genes",
                    "type": "annotation",
                    "url": data_path +
                    "covid_ASM985889v3/GCF_009858895.2_ASM985889v3_genomic.gff.gz",
                    "displayMode": "EXPANDED"
                }],
                minimumBases=100,
                style=igvStyle), ))

    dash_duo.start_server(app)

    # Check that the genome loaded
    dash_duo.wait_for_text_to_equal('.igv-current-genome', 'ASM985889v3')

    # Check that track(s) loaded
    tracks = dash_duo.find_elements('.igv-track-label')
    assert tracks[0].text == 'Annotations'
    assert tracks[1].text == 'Genes'
示例#4
0
def test_ASM985889v3_tracks(dash_duo):
    app = dash.Dash(__name__)

    app.layout = html.Div(simple_app_layout(
        dash_bio.Igv(
            id=_COMPONENT_ID,
            reference={
                "id": "ASM985889v3",
                "name": "Sars-CoV-2 (ASM985889v3)",
                "fastaURL": "https://s3.amazonaws.com/igv.org.genomes/covid_ASM985889v3/GCF_009858895.2_ASM985889v3_genomic.fna",
                "indexURL": "https://s3.amazonaws.com/igv.org.genomes/covid_ASM985889v3/GCF_009858895.2_ASM985889v3_genomic.fna.fai",
                "order": 1000000,
                "tracks": [
                    {
                        "name": "Annotations",
                        "url": "https://s3.amazonaws.com/igv.org.genomes/covid_ASM985889v3/GCF_009858895.2_ASM985889v3_genomic.gff.gz",
                        "displayMode": "EXPANDED",
                        "nameField": "gene",
                        "height": 150
                    }
                ]

            },
            tracks=[{  # normally, tracks listed here would not duplicate those already present above

                "name": "Genes",
                "type": "annotation",
                "url": "https://s3.amazonaws.com/igv.org.genomes/covid_ASM985889v3/GCF_009858895.2_ASM985889v3_genomic.gff.gz",
                "displayMode": "EXPANDED"

            }],
            minimumBases=100,
            style=igvStyle
        ),
    ))

    dash_duo.start_server(app)

    # Check that the genome loaded
    dash_duo.wait_for_text_to_equal('#igv-current_genome', 'ASM985889v3')

    # Check that track(s) loaded
    tracks = dash_duo.find_elements('.igv-track-label')
    assert tracks[0].text == 'Annotations'
    assert tracks[1].text == 'Genes'
示例#5
0
def test_dbigv003_sacCer3(dash_duo):
    app = dash.Dash(__name__)

    try:
        requests.get('https://www.google.com/').status_code
        data_path = 'https://s3.dualstack.us-east-1.amazonaws.com/igv.org.genomes/'
    except requests.exceptions.ConnectionError:
        print("Running test with local datasets")
        data_path = app.get_asset_url('')

    app.layout = html.Div(
        simple_app_layout(
            dash_bio.Igv(id=_COMPONENT_ID,
                         reference={
                             "id":
                             "sacCer3",
                             "name":
                             "S. cerevisiae (sacCer3)",
                             "fastaURL":
                             data_path + "sacCer3/sacCer3.fa",
                             "indexURL":
                             data_path + "sacCer3/sacCer3.fa.fai",
                             "tracks": [{
                                 "name": "Ensembl Genes",
                                 "type": "annotation",
                                 "format": "ensgene",
                                 "displayMode": "EXPANDED",
                                 "url": data_path + "sacCer3/ensGene.txt.gz",
                                 "indexed": False,
                                 "supportsWholeGenome": False
                             }]
                         },
                         minimumBases=100,
                         style=igvStyle), ))

    dash_duo.start_server(app)

    # Check that the genome loaded
    dash_duo.wait_for_text_to_equal('.igv-current-genome', 'sacCer3')

    # Check that track(s) loaded
    tracks = dash_duo.find_elements('.igv-track-label')
    assert len(tracks) == 1
    assert tracks[0].text == 'Ensembl Genes'
示例#6
0
def test_sacCer3(dash_duo):
    app = dash.Dash(__name__)

    app.layout = html.Div(simple_app_layout(
        dash_bio.Igv(
            id=_COMPONENT_ID,
            reference={
                "id": "sacCer3",
                "name": "S. cerevisiae (sacCer3)",
                "fastaURL": "https://s3.dualstack.us-east-1.amazonaws.com/igv.org.genomes/sacCer3/sacCer3.fa",
                "indexURL": "https://s3.dualstack.us-east-1.amazonaws.com/igv.org.genomes/sacCer3/sacCer3.fa.fai",
                "tracks": [
                    {
                        "name": "Ensembl Genes",
                        "type": "annotation",
                        "format": "ensgene",
                        "displayMode": "EXPANDED",
                        "url": "https://s3.dualstack.us-east-1.amazonaws.com/igv.org.genomes/sacCer3/ensGene.txt.gz",
                        "indexed": False,
                        "supportsWholeGenome": False
                    }
                ]
            },
            minimumBases=100,
            style=igvStyle
        ),
    ))

    dash_duo.start_server(app)

    # Check that the genome loaded
    dash_duo.wait_for_text_to_equal('#igv-current_genome', 'sacCer3')

    # Check that track(s) loaded
    tracks = dash_duo.find_elements('.igv-track-label')
    assert len(tracks) == 1
    assert tracks[0].text == 'Ensembl Genes'