Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Small bug in the compare utility, which led to wrong results in `pick`.
  • Loading branch information
lucventurini authored Apr 3, 2020
1 parent 2769530 commit 796c0e3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
11 changes: 5 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: python
sudo: required
dist: xenial
os: "linux"
python:
# - "3.4"
# - "3.5"
Expand All @@ -21,12 +20,12 @@ install:
- conda env create -n env_name --file environment.yml
- source activate env_name
- conda install -y -c conda-forge -- pytest-cov codecov;
- conda install -c bioconda -c conda-forge -y stringtie scallop gmap star hisat2 prodigal blast diamond transdecoder gnuplot kallisto samtools gffread
- python setup.py develop;
script:
- python setup.py test --addopts "-m slow Mikado/tests/test_system_calls.py::SerialiseChecker::test_subprocess_multi_empty_orfs"
- python setup.py test --addopts " --cov Mikado --cov-config=.coveragerc -m '(slow or not slow) and not triage'";
- cd sample_data; snakemake --use-conda --jobs 5 --cores 5
- rm -rf .snakemake/conda/; # This causes weird bugs
- pytest -m slow Mikado/tests/test_system_calls.py::SerialiseChecker::test_subprocess_multi_empty_orfs
- pytest --cov Mikado --cov-config=.coveragerc -m '(slow or not slow) and not triage';
- cd sample_data; snakemake --jobs 5 --cores 5
- cd ..;
- python -c "import Mikado; Mikado.test(label='fast')";
# Check that the seed is set properly
Expand Down
6 changes: 5 additions & 1 deletion Mikado/scales/contrast.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,16 @@ cdef str __assign_monoexonic_ccode(prediction, reference, long nucl_overlap, dou
ccode = "g"
else:
ccode = "e"
elif nucl_precision == 1:
ccode = "c"
elif nucl_overlap > 0:
ccode = "g"
elif (nucl_recall == 0 and r_start < p_start < r_end):
ccode = "i" # Monoexonic fragment inside an intron
elif p_exon_num > 1 and r_exon_num == 1:
if nucl_overlap > 0:
if nucl_recall == 1.0: # The multiexonic is a complete extension of the monoexonic reference
ccode = "n"
elif nucl_overlap > 0:
ccode = "G" # Reverse generic overlap
elif c_overlap(p_start, p_end, r_start, r_end, 0, 1) > 0:
ccode = "ri"
Expand Down
17 changes: 17 additions & 0 deletions Mikado/tests/assigner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,23 @@ def test_false_fusion(self):
args.reference.close()
args.prediction.close()

def test_monoexonic_contained(self):
t1 = loci.Transcript()
t1.chrom, t1.start, t1.end, t1.strand, t1.id = "Chr1", 9192977, 9193471, "+", "t1"
t1.add_exons([(t1.start, t1.end)])
t1.add_exons([(t1.start, t1.end)], features=["CDS"])
t1.finalize()
t2 = loci.Transcript()
t2.chrom, t2.start, t2.end, t2.strand, t2.id = "Chr1", 9182621, 9194526, "+", "t2"
t2.add_exons([(9192977, 9193480)], features=["CDS"])
t2.add_exons([(9186643, 9186780), (9182621, 9182770), (9192959, 9194526)])
t2.finalize()
mono_ref = scales.Assigner.compare(reference=t1, prediction=t2)[0]
mono_pred = scales.Assigner.compare(reference=t2, prediction=t1)[0]
self.assertEqual(mono_ref.n_recall, mono_pred.n_prec)
self.assertEqual(mono_pred.ccode[0], "c")
self.assertEqual(mono_ref.ccode[0], "n")

def test_h_case(self):

"""
Expand Down

0 comments on commit 796c0e3

Please sign in to comment.