Skip to content

Commit

Permalink
Merge pull request #38 from ShawHahnLab/release-0.0.10
Browse files Browse the repository at this point in the history
Release 0.0.10
  • Loading branch information
ressy authored Oct 11, 2022
2 parents 9fab52a + 6891f88 commit bd2affe
Show file tree
Hide file tree
Showing 20 changed files with 239 additions and 23 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 0.0.10 - 2022-10-11

### Added

* FASTQ support ([#37])

### Changed

* Repository now at <https://github.com/ShawHahnLab/vquest> ([#36])

### Fixed

* Usage example now matches packaged structure ([#36])
* Requests to the IMGT server now use HTTPS ([#34])

[#37]: https://github.com/ShawHahnLab/vquest/pull/37
[#36]: https://github.com/ShawHahnLab/vquest/pull/36
[#34]: https://github.com/ressy/vquest/pull/34

## 0.0.9 - 2021-07-20

### Added
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Automate IMGT V-QUEST usage on imgt.org

[![vquest](https://circleci.com/gh/ressy/vquest.svg?style=shield)](https://circleci.com/gh/ressy/vquest)
[![vquest](https://circleci.com/gh/ShawHahnLab/vquest.svg?style=shield)](https://circleci.com/gh/ShawHahnLab/vquest)

[IMGT](http://imgt.org)'s [V-QUEST](http://www.imgt.org/IMGT_vquest/analysis)
is only available via a web interface. This Python package automates V-QUEST
Expand All @@ -23,7 +23,7 @@ Here the aligned FASTA text is printed directly to standard output.

Example Python usage:

>>> from vquest import *
>>> from vquest.vq import *
>>> config = layer_configs(DEFAULTS, {"species": "rhesus-monkey", "receptorOrLocusType": "IG", "fileSequences": "seqs.fasta"})
>>> result = vquest(config)
>>> result.keys()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
description="Automate IMGT V-QUEST usage on imgt.org",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/ressy/vquest",
url="https://github.com/shawhahnlab/vquest",
packages=setuptools.find_packages(),
package_data={"vquest": ["data/*"]},
entry_points={"console_scripts": [
Expand Down
2 changes: 2 additions & 0 deletions test_vquest/data/test_vquest/TestVquestFasta/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
species: rhesus-monkey
receptorOrLocusType: IG
10 changes: 10 additions & 0 deletions test_vquest/data/test_vquest/TestVquestFasta/config_inline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
species: rhesus-monkey
receptorOrLocusType: IG
resultType: excel
xv_outputtype: 3
sequences: |
>IGKV2-ACR*02
GACATTGTGATGACCCAGACTCCACTCTCCCTGCCCGTCACCCCTGGAGAGCCAGCCTCCATCTCCTGCAGGTCTAGTCA
GAGCCTCTTGGATAGTGACGGGTACACCTGTTTGGACTGGTACCTGCAGAAGCCAGGCCAGTCTCCACAGCTCCTGATCT
ATGAGGTTTCCAACCGGGTCTCTGGAGTCCCTGACAGGTTCAGTGGCAGTGGGTCAGNCACTGATTTCACACTGAAAATC
AGCCGGGTGGAAGCTGAGGATGTTGGGGTGTATTACTGTATGCAAAGTATAGAGTTTCCTCC
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Date Tue Dec 01 22:08:11 CET 2020
IMGT/V-QUEST program version 3.5.21
IMGT/V-QUEST reference directory release 202049-2
Species Macaca mulatta
Receptor type or locus IG
IMGT/V-QUEST reference directory set F+ORF+ in-frame P
Search for insertions and deletions no
Nb of nucleotides to add (or exclude) in 3' of the V-REGION for the evaluation of the alignment score 0
Nb of nucleotides to exclude in 5' of the V-REGION for the evaluation of the nb of mutations 0
Analysis of scFv no
Number of submitted sequences 1

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sequence_id sequence sequence_aa rev_comp productive complete_vdj vj_in_frame stop_codon locus v_call d_call j_call c_call sequence_alignment sequence_alignment_aa germline_alignment germline_alignment_aa junction junction_aa np1 np1_aa np2 np2_aa cdr1 cdr1_aa cdr2 cdr2_aa cdr3 cdr3_aa fwr1 fwr1_aa fwr2 fwr2_aa fwr3 fwr3_aa fwr4 fwr4_aa v_score v_identity v_support v_cigar d_score d_identity d_support d_cigar j_score j_identity j_support j_cigar c_score c_identity c_support c_cigar v_sequence_start v_sequence_end v_germline_start v_germline_end v_alignment_start v_alignment_end d_sequence_start d_sequence_end d_germline_start d_germline_end d_alignment_start d_alignment_end j_sequence_start j_sequence_end j_germline_start j_germline_end j_alignment_start j_alignment_end cdr1_start cdr1_end cdr2_start cdr2_end cdr3_start cdr3_end fwr1_start fwr1_end fwr2_start fwr2_end fwr3_start fwr3_end fwr4_start fwr4_end v_sequence_alignment v_sequence_alignment_aa d_sequence_alignment d_sequence_alignment_aa j_sequence_alignment j_sequence_alignment_aa c_sequence_alignment c_sequence_alignment_aa v_germline_alignment v_germline_alignment_aa d_germline_alignment d_germline_alignment_aa j_germline_alignment j_germline_alignment_aa c_germline_alignment c_germline_alignment_aa junction_length junction_aa_length np1_length np2_length n1_length n2_length p3v_length p5d_length p3d_length p5j_length consensus_count duplicate_count cell_id clone_id rearrangement_id repertoire_id rearrangement_set_id sequence_analysis_category d_number 5prime_trimmed_n_nb 3prime_trimmed_n_nb insertions deletions junction_decryption
IGKV2-ACR*02 gacattgtgatgacccagactccactctccctgcccgtcacccctggagagccagcctccatctcctgcaggtctagtcagagcctcttggatagtgacgggtacacctgtttggactggtacctgcagaagccaggccagtctccacagctcctgatctatgaggtttccaaccgggtctctggagtccctgacaggttcagtggcagtgggtcagncactgatttcacactgaaaatcagccgggtggaagctgaggatgttggggtgtattactgtatgcaaagtatagagtttcctcc F F IGK Macmul IGKV2S20*01 F gacattgtgatgacccagactccactctccctgcccgtcacccctggagagccagcctccatctcctgcaggtctagtcagagcctcttggatagt...gacgggtacacctgtttggactggtacctgcagaagccaggccagtctccacagctcctgatctatgaggtt.....................tccaaccgggtctctggagtccct...gacaggttcagtggcagtggg......tcagncactgatttcacactgaaaatcagccgggtggaagctgaggatgttggggtgtattactgtatgcaaagtatagagtttcctcc DIVMTQTPLSLPVTPGEPASISCRSSQSLLDS.DGYTCLDWYLQKPGQSPQLLIYEV.......SNRVSGVP.DRFSGSG..SXTDFTLKISRVEAEDVGVYYCMQSIEFP gatattgtgatgacccagactccactctccctgccagtcacccctggagagccggcctccatctcctgcaggtctagtcagagcctcttggatagtgaggatggaaacacctatttggaatggtacctgcagaagccaggccagtctccacagcccttgatttatgaggtt.....................tccaaccgggcctctggagtccca...gacaggttcagtggcagtggg......tcagacactgatttcacactgaaaatcagcagagtggaggctgaggatgttggggtttattactgcatgcaaggtatagagtatcctcc DIVMTQTPLSLPVTPGEPASISCRSSQSLLDSEDGNTYLEWYLQKPGQSPQPLIYEV.......SNRASGVP.DRFSGSG..SDTDFTLKISRVEAEDVGVYYCMQGIEYP cagagcctcttggatagtgacgggtacacctgt QSLLDSDGYTC gaggtttcc EVS atgcaaagtatagagtttcctcc MQSIEFP gacattgtgatgacccagactccactctccctgcccgtcacccctggagagccagcctccatctcctgcaggtctagt DIVMTQTPLSLPVTPGEPASISCRSS ttggactggtacctgcagaagccaggccagtctccacagctcctgatctat LDWYLQKPGQSPQLLIY aaccgggtctctggagtccctgacaggttcagtggcagtgggtcagncactgatttcacactgaaaatcagccgggtggaagctgaggatgttggggtgtattactgt NRVSGVPDRFSGSGSXTDFTLKISRVEAEDVGVYYC 1294 93.20 2=1X32=1X17=1X42=3D2=1X2=2X6=1X6=1X34=1X1=1X4=1X19=1X12=1X25=1M25=1X1=1X5=1X17=1X8=1X6=1X9=1X6= 1 302 1 335 1 335 79 111 163 171 280 302 1 78 112 162 172 279 gacattgtgatgacccagactccactctccctgcccgtcacccctggagagccagcctccatctcctgcaggtctagtcagagcctcttggatagt...gacgggtacacctgtttggactggtacctgcagaagccaggccagtctccacagctcctgatctatgaggtt.....................tccaaccgggtctctggagtccct...gacaggttcagtggcagtggg......tcagncactgatttcacactgaaaatcagccgggtggaagctgaggatgttggggtgtattactgtatgcaaagtatagagtttcctcc DIVMTQTPLSLPVTPGEPASISCRSSQSLLDS.DGYTCLDWYLQKPGQSPQLLIYEV.......SNRVSGVP.DRFSGSG..SXTDFTLKISRVEAEDVGVYYCMQSIEFP gatattgtgatgacccagactccactctccctgccagtcacccctggagagccggcctccatctcctgcaggtctagtcagagcctcttggatagtgaggatggaaacacctatttggaatggtacctgcagaagccaggccagtctccacagcccttgatttatgaggtt.....................tccaaccgggcctctggagtccca...gacaggttcagtggcagtggg......tcagacactgatttcacactgaaaatcagcagagtggaggctgaggatgttggggtttattactgcatgcaaggtatagagtatcctcc DIVMTQTPLSLPVTPGEPASISCRSSQSLLDSEDGNTYLEWYLQKPGQSPQPLIYEV.......SNRASGVP.DRFSGSG..SDTDFTLKISRVEAEDVGVYYCMQGIEYP 0 0 0 0 0 0 1 (noindelsearch) 0 0 0
Binary file not shown.
5 changes: 5 additions & 0 deletions test_vquest/data/test_vquest/TestVquestFasta/seqs.fasta
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
>IGKV2-ACR*02
GACATTGTGATGACCCAGACTCCACTCTCCCTGCCCGTCACCCCTGGAGAGCCAGCCTCCATCTCCTGCAGGTCTAGTCA
GAGCCTCTTGGATAGTGACGGGTACACCTGTTTGGACTGGTACCTGCAGAAGCCAGGCCAGTCTCCACAGCTCCTGATCT
ATGAGGTTTCCAACCGGGTCTCTGGAGTCCCTGACAGGTTCAGTGGCAGTGGGTCAGNCACTGATTTCACACTGAAAATC
AGCCGGGTGGAAGCTGAGGATGTTGGGGTGTATTACTGTATGCAAAGTATAGAGTTTCCTCC
2 changes: 2 additions & 0 deletions test_vquest/data/test_vquest/TestVquestFastq/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
species: rhesus-monkey
receptorOrLocusType: IG
10 changes: 10 additions & 0 deletions test_vquest/data/test_vquest/TestVquestFastq/config_inline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
species: rhesus-monkey
receptorOrLocusType: IG
resultType: excel
xv_outputtype: 3
sequences: |
>IGKV2-ACR*02
GACATTGTGATGACCCAGACTCCACTCTCCCTGCCCGTCACCCCTGGAGAGCCAGCCTCCATCTCCTGCAGGTCTAGTCA
GAGCCTCTTGGATAGTGACGGGTACACCTGTTTGGACTGGTACCTGCAGAAGCCAGGCCAGTCTCCACAGCTCCTGATCT
ATGAGGTTTCCAACCGGGTCTCTGGAGTCCCTGACAGGTTCAGTGGCAGTGGGTCAGNCACTGATTTCACACTGAAAATC
AGCCGGGTGGAAGCTGAGGATGTTGGGGTGTATTACTGTATGCAAAGTATAGAGTTTCCTCC
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Date Tue Dec 01 22:08:11 CET 2020
IMGT/V-QUEST program version 3.5.21
IMGT/V-QUEST reference directory release 202049-2
Species Macaca mulatta
Receptor type or locus IG
IMGT/V-QUEST reference directory set F+ORF+ in-frame P
Search for insertions and deletions no
Nb of nucleotides to add (or exclude) in 3' of the V-REGION for the evaluation of the alignment score 0
Nb of nucleotides to exclude in 5' of the V-REGION for the evaluation of the nb of mutations 0
Analysis of scFv no
Number of submitted sequences 1

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sequence_id sequence sequence_aa rev_comp productive complete_vdj vj_in_frame stop_codon locus v_call d_call j_call c_call sequence_alignment sequence_alignment_aa germline_alignment germline_alignment_aa junction junction_aa np1 np1_aa np2 np2_aa cdr1 cdr1_aa cdr2 cdr2_aa cdr3 cdr3_aa fwr1 fwr1_aa fwr2 fwr2_aa fwr3 fwr3_aa fwr4 fwr4_aa v_score v_identity v_support v_cigar d_score d_identity d_support d_cigar j_score j_identity j_support j_cigar c_score c_identity c_support c_cigar v_sequence_start v_sequence_end v_germline_start v_germline_end v_alignment_start v_alignment_end d_sequence_start d_sequence_end d_germline_start d_germline_end d_alignment_start d_alignment_end j_sequence_start j_sequence_end j_germline_start j_germline_end j_alignment_start j_alignment_end cdr1_start cdr1_end cdr2_start cdr2_end cdr3_start cdr3_end fwr1_start fwr1_end fwr2_start fwr2_end fwr3_start fwr3_end fwr4_start fwr4_end v_sequence_alignment v_sequence_alignment_aa d_sequence_alignment d_sequence_alignment_aa j_sequence_alignment j_sequence_alignment_aa c_sequence_alignment c_sequence_alignment_aa v_germline_alignment v_germline_alignment_aa d_germline_alignment d_germline_alignment_aa j_germline_alignment j_germline_alignment_aa c_germline_alignment c_germline_alignment_aa junction_length junction_aa_length np1_length np2_length n1_length n2_length p3v_length p5d_length p3d_length p5j_length consensus_count duplicate_count cell_id clone_id rearrangement_id repertoire_id rearrangement_set_id sequence_analysis_category d_number 5prime_trimmed_n_nb 3prime_trimmed_n_nb insertions deletions junction_decryption
IGKV2-ACR*02 gacattgtgatgacccagactccactctccctgcccgtcacccctggagagccagcctccatctcctgcaggtctagtcagagcctcttggatagtgacgggtacacctgtttggactggtacctgcagaagccaggccagtctccacagctcctgatctatgaggtttccaaccgggtctctggagtccctgacaggttcagtggcagtgggtcagncactgatttcacactgaaaatcagccgggtggaagctgaggatgttggggtgtattactgtatgcaaagtatagagtttcctcc F F IGK Macmul IGKV2S20*01 F gacattgtgatgacccagactccactctccctgcccgtcacccctggagagccagcctccatctcctgcaggtctagtcagagcctcttggatagt...gacgggtacacctgtttggactggtacctgcagaagccaggccagtctccacagctcctgatctatgaggtt.....................tccaaccgggtctctggagtccct...gacaggttcagtggcagtggg......tcagncactgatttcacactgaaaatcagccgggtggaagctgaggatgttggggtgtattactgtatgcaaagtatagagtttcctcc DIVMTQTPLSLPVTPGEPASISCRSSQSLLDS.DGYTCLDWYLQKPGQSPQLLIYEV.......SNRVSGVP.DRFSGSG..SXTDFTLKISRVEAEDVGVYYCMQSIEFP gatattgtgatgacccagactccactctccctgccagtcacccctggagagccggcctccatctcctgcaggtctagtcagagcctcttggatagtgaggatggaaacacctatttggaatggtacctgcagaagccaggccagtctccacagcccttgatttatgaggtt.....................tccaaccgggcctctggagtccca...gacaggttcagtggcagtggg......tcagacactgatttcacactgaaaatcagcagagtggaggctgaggatgttggggtttattactgcatgcaaggtatagagtatcctcc DIVMTQTPLSLPVTPGEPASISCRSSQSLLDSEDGNTYLEWYLQKPGQSPQPLIYEV.......SNRASGVP.DRFSGSG..SDTDFTLKISRVEAEDVGVYYCMQGIEYP cagagcctcttggatagtgacgggtacacctgt QSLLDSDGYTC gaggtttcc EVS atgcaaagtatagagtttcctcc MQSIEFP gacattgtgatgacccagactccactctccctgcccgtcacccctggagagccagcctccatctcctgcaggtctagt DIVMTQTPLSLPVTPGEPASISCRSS ttggactggtacctgcagaagccaggccagtctccacagctcctgatctat LDWYLQKPGQSPQLLIY aaccgggtctctggagtccctgacaggttcagtggcagtgggtcagncactgatttcacactgaaaatcagccgggtggaagctgaggatgttggggtgtattactgt NRVSGVPDRFSGSGSXTDFTLKISRVEAEDVGVYYC 1294 93.20 2=1X32=1X17=1X42=3D2=1X2=2X6=1X6=1X34=1X1=1X4=1X19=1X12=1X25=1M25=1X1=1X5=1X17=1X8=1X6=1X9=1X6= 1 302 1 335 1 335 79 111 163 171 280 302 1 78 112 162 172 279 gacattgtgatgacccagactccactctccctgcccgtcacccctggagagccagcctccatctcctgcaggtctagtcagagcctcttggatagt...gacgggtacacctgtttggactggtacctgcagaagccaggccagtctccacagctcctgatctatgaggtt.....................tccaaccgggtctctggagtccct...gacaggttcagtggcagtggg......tcagncactgatttcacactgaaaatcagccgggtggaagctgaggatgttggggtgtattactgtatgcaaagtatagagtttcctcc DIVMTQTPLSLPVTPGEPASISCRSSQSLLDS.DGYTCLDWYLQKPGQSPQLLIYEV.......SNRVSGVP.DRFSGSG..SXTDFTLKISRVEAEDVGVYYCMQSIEFP gatattgtgatgacccagactccactctccctgccagtcacccctggagagccggcctccatctcctgcaggtctagtcagagcctcttggatagtgaggatggaaacacctatttggaatggtacctgcagaagccaggccagtctccacagcccttgatttatgaggtt.....................tccaaccgggcctctggagtccca...gacaggttcagtggcagtggg......tcagacactgatttcacactgaaaatcagcagagtggaggctgaggatgttggggtttattactgcatgcaaggtatagagtatcctcc DIVMTQTPLSLPVTPGEPASISCRSSQSLLDSEDGNTYLEWYLQKPGQSPQPLIYEV.......SNRASGVP.DRFSGSG..SDTDFTLKISRVEAEDVGVYYCMQGIEYP 0 0 0 0 0 0 1 (noindelsearch) 0 0 0
Binary file not shown.
4 changes: 4 additions & 0 deletions test_vquest/data/test_vquest/TestVquestFastq/seqs.fastq
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@IGKV2-ACR*02
GACATTGTGATGACCCAGACTCCACTCTCCCTGCCCGTCACCCCTGGAGAGCCAGCCTCCATCTCCTGCAGGTCTAGTCAGAGCCTCTTGGATAGTGACGGGTACACCTGTTTGGACTGGTACCTGCAGAAGCCAGGCCAGTCTCCACAGCTCCTGATCTATGAGGTTTCCAACCGGGTCTCTGGAGTCCCTGACAGGTTCAGTGGCAGTGGGTCAGNCACTGATTTCACACTGAAAATCAGCCGGGTGGAAGCTGAGGATGTTGGGGTGTATTACTGTATGCAAAGTATAGAGTTTCCTCC
+
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ
112 changes: 110 additions & 2 deletions test_vquest/test_vquest.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_vquest(self):
self.assertEqual(self.post.call_count, 1)
self.assertEqual(
self.post.call_args.args,
('http://www.imgt.org/IMGT_vquest/analysis', ))
('https://www.imgt.org/IMGT_vquest/analysis', ))
config_used = self.config.copy()
# Whatever input type was given the actual type submitted to the form
# will be "inline" to allow chunking of sequences if needed. The
Expand Down Expand Up @@ -236,6 +236,114 @@ def test_vquest_main_alignment(self):
self.check_missing_defaults_main(lambda: main(["--align"]))


class TestVquestFasta(TestVquestBase):
"""File-based input with FASTA."""

def setUp(self):
super().setUp()
self.input_path = self.path/"seqs.fasta"
del self.config["sequences"]
self.config["fileSequences"] = self.input_path

def test_vquest(self):
"""Test that a basic request gives the expected response."""
result = vquest(self.config)
# requests.post should have been called once, with this input.
self.assertEqual(self.post.call_count, 1)
self.assertEqual(
self.post.call_args.args,
('https://www.imgt.org/IMGT_vquest/analysis', ))
config_used = self.config.copy()
# Whatever input type was given the actual type submitted to the form
# will be "inline" to allow chunking of sequences if needed. The
# sequences are also reformatted via Biopython when chunked.
config_used["inputType"] = "inline"
config_used["sequences"] = """>IGKV2-ACR*02
GACATTGTGATGACCCAGACTCCACTCTCCCTGCCCGTCACCCCTGGAGAGCCAGCCTCC
ATCTCCTGCAGGTCTAGTCAGAGCCTCTTGGATAGTGACGGGTACACCTGTTTGGACTGG
TACCTGCAGAAGCCAGGCCAGTCTCCACAGCTCCTGATCTATGAGGTTTCCAACCGGGTC
TCTGGAGTCCCTGACAGGTTCAGTGGCAGTGGGTCAGNCACTGATTTCACACTGAAAATC
AGCCGGGTGGAAGCTGAGGATGTTGGGGTGTATTACTGTATGCAAAGTATAGAGTTTCCT
CC
"""
self.assertEqual(
self.post.call_args.kwargs,
{"data": config_used})
self.assertEqual(
list(result.keys()),
["Parameters.txt", "vquest_airr.tsv"])
with open(self.path / "expected/Parameters.txt") as f_in:
parameters = f_in.read()
with open(self.path / "expected/vquest_airr.tsv") as f_in:
vquest_airr = f_in.read()
self.assertEqual(parameters, result["Parameters.txt"])
self.assertEqual(vquest_airr, result["vquest_airr.tsv"])

def test_vquest_no_collapse(self):
"""test_vquest but with vquest(..., collapse=False)."""
# Also try with collapse=False, for raw output
result = vquest(self.config, collapse=False)
self.assertEqual(self.post.call_count, 1)
self.assertEqual(len(result), 1)
self.assertEqual(
list(result[0].keys()),
["Parameters.txt", "vquest_airr.tsv"])

def test_vquest_main(self):
"""Test that the command-line interface gives the expected response."""
with tempfile.TemporaryDirectory() as tempdir:
os.chdir(tempdir)
with open(self.path / "config.yml") as f_in, open("config.yml", "wt") as f_out:
f_out.write(f_in.read())
f_out.write(f"fileSequences: {self.input_path}\n")
main(["config.yml"])
self.assertTrue(Path("vquest_airr.tsv").exists())
self.assertTrue(Path("Parameters.txt").exists())

def test_vquest_main_no_collapse(self):
"""Test command-line interface with --no-collapse."""
with tempfile.TemporaryDirectory() as tempdir:
os.chdir(tempdir)
with open(self.path / "config.yml") as f_in, open("config.yml", "wt") as f_out:
f_out.write(f_in.read())
f_out.write(f"fileSequences: {self.input_path}\n")
main(["--no-collapse", "config.yml"])
self.assertTrue(Path("001/vquest_airr.tsv").exists())
self.assertTrue(Path("001/Parameters.txt").exists())

def test_vquest_main_alignment(self):
"""Try using the --align feature.
In this case the regular output files should not be created and instead
FASTA text should be written to stdout.
"""
expected = """>IGKV2-ACR*02
gacattgtgatgacccagactccactctccctgcccgtcacccctggagagccagcctccatctcctgcaggtctagtcagagcctcttggatagt...gacgggtacacctgtttggactggtacctgcagaagccaggccagtctccacagctcctgatctatgaggtt.....................tccaaccgggtctctggagtccct...gacaggttcagtggcagtggg......tcagncactgatttcacactgaaaatcagccgggtggaagctgaggatgttggggtgtattactgtatgcaaagtatagagtttcctcc
"""
out = StringIO()
err = StringIO()
with redirect_stdout(out), redirect_stderr(err):
with tempfile.TemporaryDirectory() as tempdir:
os.chdir(tempdir)
with open(self.path / "config.yml") as f_in, open("config.yml", "wt") as f_out:
f_out.write(f_in.read())
f_out.write(f"fileSequences: {self.input_path}\n")
main(["config.yml", "--align"])
self.assertFalse(Path("vquest_airr.tsv").exists())
self.assertFalse(Path("Parameters.txt").exists())
self.assertEqual(out.getvalue(), expected)
self.assertEqual(err.getvalue(), "")


class TestVquestFastq(TestVquestFasta):
"""File-based input with FASTQ."""

def setUp(self):
super().setUp()
self.input_path = self.path/"seqs.fastq"
self.config["fileSequences"] = self.input_path


class TestVquestCustom(TestVquestSimple):
"""Try changing one of the configuration options.
Expand Down Expand Up @@ -274,7 +382,7 @@ def test_vquest(self):
self.assertEqual(self.post.call_count, 1)
self.assertEqual(
self.post.call_args.args,
('http://www.imgt.org/IMGT_vquest/analysis', ))
('https://www.imgt.org/IMGT_vquest/analysis', ))

def test_vquest_main(self):
"""Test that an html file with an error message is parsed correctly for cmd-line usage."""
Expand Down
Loading

0 comments on commit bd2affe

Please sign in to comment.