Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Release 1.0.1

See merge request tron/addannot!224
  • Loading branch information
Pablo Riesgo Ferreiro committed Oct 27, 2022
2 parents 5ea760c + e12ca3e commit a8d656a
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 29 deletions.
17 changes: 9 additions & 8 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Sphinx==4.2.0
m2r2==0.3.1
nbsphinx==0.8.7
pandoc==1.1.0
ipython==8.0.1
ipykernel==5.3.4
Sphinx==5.3.0
m2r2==0.3.3
nbsphinx==0.8.9
pandoc==2.2
ipython==7.27.0
ipykernel==6.4.1
#sphinx_rtd_theme==0.5.0
#insipid_sphinx_theme==0.2.1
pydata-sphinx-theme==0.7.1
Jinja2==3.0.3
pydata-sphinx-theme==0.11.0
Jinja2==3.1.2
markupsafe==2.1.1
2 changes: 1 addition & 1 deletion neofox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.#


VERSION = "1.0.0"
VERSION = "1.0.1"


REFERENCE_FOLDER_ENV = "NEOFOX_REFERENCE_FOLDER"
Expand Down
41 changes: 22 additions & 19 deletions neofox/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,23 +406,26 @@ def _write_results_epitopes(neoepitopes: List[PredictedEpitope], output_folder,
mhci_neoepitopes = [n for n in neoepitopes if ModelValidator.is_mhci_epitope(n)]
mhcii_neoepitopes = [n for n in neoepitopes if ModelValidator.is_mhcii_epitope(n)]

ModelConverter.annotated_neoepitopes2epitopes_table(mhci_neoepitopes, mhc=neofox.MHC_I).to_csv(
os.path.join(
output_folder,
"{}_mhcI_epitope_candidates_annotated.tsv".format(output_prefix),
),
sep="\t",
index=False,
)
ModelConverter.annotated_neoepitopes2epitopes_table(mhcii_neoepitopes, mhc=neofox.MHC_II).to_csv(
os.path.join(
output_folder,
"{}_mhcII_epitope_candidates_annotated.tsv".format(output_prefix),
),
sep="\t",
index=False,
)
if mhci_neoepitopes:
ModelConverter.annotated_neoepitopes2epitopes_table(mhci_neoepitopes, mhc=neofox.MHC_I).to_csv(
os.path.join(
output_folder,
"{}_mhcI_epitope_candidates_annotated.tsv".format(output_prefix),
),
sep="\t",
index=False,
)
if mhcii_neoepitopes:
ModelConverter.annotated_neoepitopes2epitopes_table(mhcii_neoepitopes, mhc=neofox.MHC_II).to_csv(
os.path.join(
output_folder,
"{}_mhcII_epitope_candidates_annotated.tsv".format(output_prefix),
),
sep="\t",
index=False,
)

output_features = os.path.join(output_folder, "{}_neoepitope_candidates_annotated.json".format(output_prefix))
with open(output_features, "wb") as f:
f.write(json.dumps(ModelConverter.objects2json(neoepitopes)))
if neoepitopes:
output_features = os.path.join(output_folder, "{}_neoepitope_candidates_annotated.json".format(output_prefix))
with open(output_features, "wb") as f:
f.write(json.dumps(ModelConverter.objects2json(neoepitopes)))
61 changes: 60 additions & 1 deletion neofox/tests/integration_tests/test_neofox_epitope.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.#
import os
import unittest
import pkg_resources
import neofox.tests
from neofox.command_line import _write_results_epitopes
Expand Down Expand Up @@ -145,6 +144,66 @@ def test_neofox_epitope_writing_output_table(self):
self.assertTrue(os.path.exists(pkg_resources.resource_filename(
neofox.tests.__name__, "resources/test_neoepitopes_mhcII_epitope_candidates_annotated.tsv")))

def test_neofox_epitope_writing_output_table_only_mhci(self):

neoepitopes = [
PredictedEpitope(
mutated_peptide="DEVLGEPSQDILVTDQTR",
wild_type_peptide="DEVLGEPSQDILVIDQTR",
isoform_mhc_i_i=self._get_test_mhcii_isoform("HLA-DRB1*01:01")
),
PredictedEpitope(
mutated_peptide="DEVLGEPSQTILVTDQTR",
wild_type_peptide="DEVLGEPSQDILVIDQTR",
isoform_mhc_i_i=self._get_test_mhcii_isoform("HLA-DRB1*01:01")
),
]

annotated_neoepitopes = NeoFoxEpitope(
neoepitopes=neoepitopes,
num_cpus=4,
).get_annotations()

_write_results_epitopes(
annotated_neoepitopes,
output_folder=pkg_resources.resource_filename(neofox.tests.__name__, "resources"),
output_prefix="test_neoepitopes_only_mhcii")

self.assertFalse(os.path.exists(pkg_resources.resource_filename(
neofox.tests.__name__, "resources/test_neoepitopes_only_mhcii_mhcI_epitope_candidates_annotated.tsv")))
self.assertTrue(os.path.exists(pkg_resources.resource_filename(
neofox.tests.__name__, "resources/test_neoepitopes_only_mhcii_mhcII_epitope_candidates_annotated.tsv")))

def test_neofox_epitope_writing_output_table_only_mhcii(self):

neoepitopes = [
PredictedEpitope(
mutated_peptide="DILVTDQTR",
wild_type_peptide="DILVIDQTR",
allele_mhc_i=self._get_test_mhci_allele('HLA-A*01:01'),
),
PredictedEpitope(
mutated_peptide="DILVPDQTR",
wild_type_peptide="DILVIDQTR",
allele_mhc_i=self._get_test_mhci_allele('HLA-A*01:01'),
),
]

annotated_neoepitopes = NeoFoxEpitope(
neoepitopes=neoepitopes,
num_cpus=4,
).get_annotations()

_write_results_epitopes(
annotated_neoepitopes,
output_folder=pkg_resources.resource_filename(neofox.tests.__name__, "resources"),
output_prefix="test_neoepitopes_only_mhci")

self.assertTrue(os.path.exists(pkg_resources.resource_filename(
neofox.tests.__name__, "resources/test_neoepitopes_only_mhci_mhcI_epitope_candidates_annotated.tsv")))
self.assertFalse(os.path.exists(pkg_resources.resource_filename(
neofox.tests.__name__, "resources/test_neoepitopes_only_mhci_mhcII_epitope_candidates_annotated.tsv")))

def test_neofox_epitope_writing_output_table_with_patients(self):

neoepitopes = [
Expand Down

0 comments on commit a8d656a

Please sign in to comment.