Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
iskandr committed Feb 13, 2024
1 parent eeca711 commit ead38ca
Show file tree
Hide file tree
Showing 14 changed files with 120 additions and 17 deletions.
2 changes: 1 addition & 1 deletion tests/test_allele_reads.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from isovar.read_collector import ReadCollector
from varcode import Variant

from mock_objects import MockAlignmentFile, make_pysam_read
from .mock_objects import MockAlignmentFile, make_pysam_read
from .testing_helpers import assert_equal_fields
from .common import eq_

Expand Down
12 changes: 12 additions & 0 deletions tests/test_assembly.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# 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 time import time

from isovar.read_collector import ReadCollector
Expand Down
4 changes: 2 additions & 2 deletions tests/test_gather_variant_reads_wgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
from pyensembl import ensembl_grch38

from varcode import Variant
from .common import eq_

from .testing_helpers import load_bam

from isovar import ReadCollector

from .common import eq_
from .testing_helpers import load_bam

def test_partition_variant_reads_snv():
alignment_file = load_bam("data/cancer-wgs-primary.chr12.bam")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_isovar_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from isovar import run_isovar
from isovar import ProteinSequence
from varcode import Variant
from .testing_helpers import data_path

from .testing_helpers import data_path
from .common import eq_


Expand Down
4 changes: 2 additions & 2 deletions tests/test_locus_reads.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
# limitations under the License.

from varcode import Variant

from isovar.locus_read import LocusRead
from isovar.dataframe_helpers import locus_reads_dataframe
from isovar.read_collector import ReadCollector

from mock_objects import MockAlignmentFile, make_pysam_read
from .mock_objects import MockAlignmentFile, make_pysam_read
from .testing_helpers import assert_equal_fields, load_bam, data_path

from .common import eq_

def test_locus_reads_snv():
Expand Down
4 changes: 2 additions & 2 deletions tests/test_protein_sequences.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from mock_objects import make_dummy_protein_sequence

from varcode import VariantCollection

from isovar.read_collector import ReadCollector
Expand All @@ -23,8 +21,10 @@
from isovar.main import ProteinSequenceCreator
from isovar.protein_sequence import ProteinSequence
from isovar.protein_sequence_helpers import sort_protein_sequences

from .common import eq_
from .testing_helpers import load_bam, load_vcf, data_path
from .mock_objects import make_dummy_protein_sequence


def test_protein_sequence_substitution():
Expand Down
12 changes: 11 additions & 1 deletion tests/test_somatic_variant_with_0_supporting_rna_reads.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
from __future__ import print_function, division, absolute_import
# 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 varcode import Variant

Expand Down
14 changes: 12 additions & 2 deletions tests/test_somatic_variant_with_2_supporting_rna_reads.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
from __future__ import print_function, division, absolute_import
# 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 varcode import Variant


from isovar.read_collector import ReadCollector

from .genomes_for_testing import grch38
from .testing_helpers import load_bam
from .common import eq_
Expand Down
13 changes: 12 additions & 1 deletion tests/test_translation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@

# 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 isovar import ProteinSequenceCreator, ReadCollector

from .common import eq_
from .testing_helpers import load_bam, load_vcf

Expand Down
13 changes: 13 additions & 0 deletions tests/test_value_object.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# 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 isovar.value_object import ValueObject
from .common import eq_

Expand Down
14 changes: 13 additions & 1 deletion tests/test_variant_helpers.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
# 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 isovar.variant_helpers import (
trim_variant_fields,
trim_variant,
base0_interval_for_variant,
interbase_range_affected_by_variant_on_transcript
)
from .common import eq_

from varcode import Variant

from .genomes_for_testing import grch38
from .common import eq_

def test_trim_variant_substitution():
loc, ref, alt = trim_variant(Variant("chr1", 10, "C", "G", grch38))
Expand Down
15 changes: 14 additions & 1 deletion tests/test_variant_orf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
from .common import eq_
# 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 varcode import Variant

from isovar.variant_orf import (
Expand All @@ -12,6 +23,8 @@
from isovar.allele_read import AlleleRead
from isovar.dna import reverse_complement_dna

from .common import eq_

def test_compute_offset_to_first_complete_codon_no_trimming():
# if nothing gets trimmed from the reference sequence, then
# the offset to the first codon shouldn't change
Expand Down
13 changes: 12 additions & 1 deletion tests/test_variant_reads_with_dummy_samfile.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# 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 .common import eq_
from varcode import Variant

from isovar.allele_read import AlleleRead
from isovar.read_collector import ReadCollector

from mock_objects import MockAlignmentFile, make_pysam_read
from .mock_objects import MockAlignmentFile, make_pysam_read
from .genomes_for_testing import grch38


Expand Down
15 changes: 13 additions & 2 deletions tests/test_variant_sequences.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
from .common import eq_
# 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 varcode import Variant

Expand All @@ -11,7 +22,7 @@

from .testing_helpers import load_bam
from .genomes_for_testing import grch38

from .common import eq_

def test_sequence_counts_snv():
samfile = load_bam("data/cancer-wgs-primary.chr12.bam")
Expand Down

0 comments on commit ead38ca

Please sign in to comment.