from immuno.ensembl import transcript_variant


def test_dbnsfp_validation_set():

    validation_set = pd.read_csv("dbnsfp_validation_set.csv")
    for idx, row in validation_set.iterrows():
        yield (validate_transcript_mutation, row)


def validate_transcript_mutation(row):
    transcript_id = row["ensembl_transcript"]
    print row
    peptide, start, stop, annot = transcript_variant.peptide_from_transcript_variant(
        transcript_id, row["position"], ref=row["ref"], alt=row["alt"], padding=None, max_length=None
    )
    assert peptide is not None
    aa_index = row["aapos"] - 1
    assert peptide[row["aapos"] - 1] == row["aaalt"], "Expected %s at amino acid pos %d but found %s" % (
        row["aaalt"],
        aa_index,
        peptide[aa_index],
    )


if __name__ == "__main__":
    from dsltools import testing_helpers

    testing_helpers.run_local_tests()
Beispiel #2
0
# Copyright (c) 2014. Mount Sinai School of Medicine
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from immuno import vcf

def test_vcf_to_dataframe():
    vcf_file = 'data/example.vcf'
    df = vcf.load_vcf(vcf_file)
    assert df is not None
    assert(len(df) == 3)
    assert(len(df.columns) == 8)

if __name__ == '__main__':
  from dsltools import testing_helpers
  testing_helpers.run_local_tests()