Skip to content

Commit bd2affe

Browse files
authored
Merge pull request #38 from ShawHahnLab/release-0.0.10
Release 0.0.10
2 parents 9fab52a + 6891f88 commit bd2affe

20 files changed

+239
-23
lines changed

CHANGELOG.md

+19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Changelog
22

3+
## 0.0.10 - 2022-10-11
4+
5+
### Added
6+
7+
* FASTQ support ([#37])
8+
9+
### Changed
10+
11+
* Repository now at <https://github.com/ShawHahnLab/vquest> ([#36])
12+
13+
### Fixed
14+
15+
* Usage example now matches packaged structure ([#36])
16+
* Requests to the IMGT server now use HTTPS ([#34])
17+
18+
[#37]: https://github.com/ShawHahnLab/vquest/pull/37
19+
[#36]: https://github.com/ShawHahnLab/vquest/pull/36
20+
[#34]: https://github.com/ressy/vquest/pull/34
21+
322
## 0.0.9 - 2021-07-20
423

524
### Added

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Automate IMGT V-QUEST usage on imgt.org
22

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

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

2424
Example Python usage:
2525

26-
>>> from vquest import *
26+
>>> from vquest.vq import *
2727
>>> config = layer_configs(DEFAULTS, {"species": "rhesus-monkey", "receptorOrLocusType": "IG", "fileSequences": "seqs.fasta"})
2828
>>> result = vquest(config)
2929
>>> result.keys()

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
description="Automate IMGT V-QUEST usage on imgt.org",
1313
long_description=long_description,
1414
long_description_content_type="text/markdown",
15-
url="https://github.com/ressy/vquest",
15+
url="https://github.com/shawhahnlab/vquest",
1616
packages=setuptools.find_packages(),
1717
package_data={"vquest": ["data/*"]},
1818
entry_points={"console_scripts": [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
species: rhesus-monkey
2+
receptorOrLocusType: IG
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
species: rhesus-monkey
2+
receptorOrLocusType: IG
3+
resultType: excel
4+
xv_outputtype: 3
5+
sequences: |
6+
>IGKV2-ACR*02
7+
GACATTGTGATGACCCAGACTCCACTCTCCCTGCCCGTCACCCCTGGAGAGCCAGCCTCCATCTCCTGCAGGTCTAGTCA
8+
GAGCCTCTTGGATAGTGACGGGTACACCTGTTTGGACTGGTACCTGCAGAAGCCAGGCCAGTCTCCACAGCTCCTGATCT
9+
ATGAGGTTTCCAACCGGGTCTCTGGAGTCCCTGACAGGTTCAGTGGCAGTGGGTCAGNCACTGATTTCACACTGAAAATC
10+
AGCCGGGTGGAAGCTGAGGATGTTGGGGTGTATTACTGTATGCAAAGTATAGAGTTTCCTCC
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Date Tue Dec 01 22:08:11 CET 2020
2+
IMGT/V-QUEST program version 3.5.21
3+
IMGT/V-QUEST reference directory release 202049-2
4+
Species Macaca mulatta
5+
Receptor type or locus IG
6+
IMGT/V-QUEST reference directory set F+ORF+ in-frame P
7+
Search for insertions and deletions no
8+
Nb of nucleotides to add (or exclude) in 3' of the V-REGION for the evaluation of the alignment score 0
9+
Nb of nucleotides to exclude in 5' of the V-REGION for the evaluation of the nb of mutations 0
10+
Analysis of scFv no
11+
Number of submitted sequences 1
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
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
2+
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.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
>IGKV2-ACR*02
2+
GACATTGTGATGACCCAGACTCCACTCTCCCTGCCCGTCACCCCTGGAGAGCCAGCCTCCATCTCCTGCAGGTCTAGTCA
3+
GAGCCTCTTGGATAGTGACGGGTACACCTGTTTGGACTGGTACCTGCAGAAGCCAGGCCAGTCTCCACAGCTCCTGATCT
4+
ATGAGGTTTCCAACCGGGTCTCTGGAGTCCCTGACAGGTTCAGTGGCAGTGGGTCAGNCACTGATTTCACACTGAAAATC
5+
AGCCGGGTGGAAGCTGAGGATGTTGGGGTGTATTACTGTATGCAAAGTATAGAGTTTCCTCC
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
species: rhesus-monkey
2+
receptorOrLocusType: IG
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
species: rhesus-monkey
2+
receptorOrLocusType: IG
3+
resultType: excel
4+
xv_outputtype: 3
5+
sequences: |
6+
>IGKV2-ACR*02
7+
GACATTGTGATGACCCAGACTCCACTCTCCCTGCCCGTCACCCCTGGAGAGCCAGCCTCCATCTCCTGCAGGTCTAGTCA
8+
GAGCCTCTTGGATAGTGACGGGTACACCTGTTTGGACTGGTACCTGCAGAAGCCAGGCCAGTCTCCACAGCTCCTGATCT
9+
ATGAGGTTTCCAACCGGGTCTCTGGAGTCCCTGACAGGTTCAGTGGCAGTGGGTCAGNCACTGATTTCACACTGAAAATC
10+
AGCCGGGTGGAAGCTGAGGATGTTGGGGTGTATTACTGTATGCAAAGTATAGAGTTTCCTCC
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Date Tue Dec 01 22:08:11 CET 2020
2+
IMGT/V-QUEST program version 3.5.21
3+
IMGT/V-QUEST reference directory release 202049-2
4+
Species Macaca mulatta
5+
Receptor type or locus IG
6+
IMGT/V-QUEST reference directory set F+ORF+ in-frame P
7+
Search for insertions and deletions no
8+
Nb of nucleotides to add (or exclude) in 3' of the V-REGION for the evaluation of the alignment score 0
9+
Nb of nucleotides to exclude in 5' of the V-REGION for the evaluation of the nb of mutations 0
10+
Analysis of scFv no
11+
Number of submitted sequences 1
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
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
2+
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.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@IGKV2-ACR*02
2+
GACATTGTGATGACCCAGACTCCACTCTCCCTGCCCGTCACCCCTGGAGAGCCAGCCTCCATCTCCTGCAGGTCTAGTCAGAGCCTCTTGGATAGTGACGGGTACACCTGTTTGGACTGGTACCTGCAGAAGCCAGGCCAGTCTCCACAGCTCCTGATCTATGAGGTTTCCAACCGGGTCTCTGGAGTCCCTGACAGGTTCAGTGGCAGTGGGTCAGNCACTGATTTCACACTGAAAATCAGCCGGGTGGAAGCTGAGGATGTTGGGGTGTATTACTGTATGCAAAGTATAGAGTTTCCTCC
3+
+
4+
JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ

test_vquest/test_vquest.py

+110-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_vquest(self):
111111
self.assertEqual(self.post.call_count, 1)
112112
self.assertEqual(
113113
self.post.call_args.args,
114-
('http://www.imgt.org/IMGT_vquest/analysis', ))
114+
('https://www.imgt.org/IMGT_vquest/analysis', ))
115115
config_used = self.config.copy()
116116
# Whatever input type was given the actual type submitted to the form
117117
# will be "inline" to allow chunking of sequences if needed. The
@@ -236,6 +236,114 @@ def test_vquest_main_alignment(self):
236236
self.check_missing_defaults_main(lambda: main(["--align"]))
237237

238238

239+
class TestVquestFasta(TestVquestBase):
240+
"""File-based input with FASTA."""
241+
242+
def setUp(self):
243+
super().setUp()
244+
self.input_path = self.path/"seqs.fasta"
245+
del self.config["sequences"]
246+
self.config["fileSequences"] = self.input_path
247+
248+
def test_vquest(self):
249+
"""Test that a basic request gives the expected response."""
250+
result = vquest(self.config)
251+
# requests.post should have been called once, with this input.
252+
self.assertEqual(self.post.call_count, 1)
253+
self.assertEqual(
254+
self.post.call_args.args,
255+
('https://www.imgt.org/IMGT_vquest/analysis', ))
256+
config_used = self.config.copy()
257+
# Whatever input type was given the actual type submitted to the form
258+
# will be "inline" to allow chunking of sequences if needed. The
259+
# sequences are also reformatted via Biopython when chunked.
260+
config_used["inputType"] = "inline"
261+
config_used["sequences"] = """>IGKV2-ACR*02
262+
GACATTGTGATGACCCAGACTCCACTCTCCCTGCCCGTCACCCCTGGAGAGCCAGCCTCC
263+
ATCTCCTGCAGGTCTAGTCAGAGCCTCTTGGATAGTGACGGGTACACCTGTTTGGACTGG
264+
TACCTGCAGAAGCCAGGCCAGTCTCCACAGCTCCTGATCTATGAGGTTTCCAACCGGGTC
265+
TCTGGAGTCCCTGACAGGTTCAGTGGCAGTGGGTCAGNCACTGATTTCACACTGAAAATC
266+
AGCCGGGTGGAAGCTGAGGATGTTGGGGTGTATTACTGTATGCAAAGTATAGAGTTTCCT
267+
CC
268+
"""
269+
self.assertEqual(
270+
self.post.call_args.kwargs,
271+
{"data": config_used})
272+
self.assertEqual(
273+
list(result.keys()),
274+
["Parameters.txt", "vquest_airr.tsv"])
275+
with open(self.path / "expected/Parameters.txt") as f_in:
276+
parameters = f_in.read()
277+
with open(self.path / "expected/vquest_airr.tsv") as f_in:
278+
vquest_airr = f_in.read()
279+
self.assertEqual(parameters, result["Parameters.txt"])
280+
self.assertEqual(vquest_airr, result["vquest_airr.tsv"])
281+
282+
def test_vquest_no_collapse(self):
283+
"""test_vquest but with vquest(..., collapse=False)."""
284+
# Also try with collapse=False, for raw output
285+
result = vquest(self.config, collapse=False)
286+
self.assertEqual(self.post.call_count, 1)
287+
self.assertEqual(len(result), 1)
288+
self.assertEqual(
289+
list(result[0].keys()),
290+
["Parameters.txt", "vquest_airr.tsv"])
291+
292+
def test_vquest_main(self):
293+
"""Test that the command-line interface gives the expected response."""
294+
with tempfile.TemporaryDirectory() as tempdir:
295+
os.chdir(tempdir)
296+
with open(self.path / "config.yml") as f_in, open("config.yml", "wt") as f_out:
297+
f_out.write(f_in.read())
298+
f_out.write(f"fileSequences: {self.input_path}\n")
299+
main(["config.yml"])
300+
self.assertTrue(Path("vquest_airr.tsv").exists())
301+
self.assertTrue(Path("Parameters.txt").exists())
302+
303+
def test_vquest_main_no_collapse(self):
304+
"""Test command-line interface with --no-collapse."""
305+
with tempfile.TemporaryDirectory() as tempdir:
306+
os.chdir(tempdir)
307+
with open(self.path / "config.yml") as f_in, open("config.yml", "wt") as f_out:
308+
f_out.write(f_in.read())
309+
f_out.write(f"fileSequences: {self.input_path}\n")
310+
main(["--no-collapse", "config.yml"])
311+
self.assertTrue(Path("001/vquest_airr.tsv").exists())
312+
self.assertTrue(Path("001/Parameters.txt").exists())
313+
314+
def test_vquest_main_alignment(self):
315+
"""Try using the --align feature.
316+
317+
In this case the regular output files should not be created and instead
318+
FASTA text should be written to stdout.
319+
"""
320+
expected = """>IGKV2-ACR*02
321+
gacattgtgatgacccagactccactctccctgcccgtcacccctggagagccagcctccatctcctgcaggtctagtcagagcctcttggatagt...gacgggtacacctgtttggactggtacctgcagaagccaggccagtctccacagctcctgatctatgaggtt.....................tccaaccgggtctctggagtccct...gacaggttcagtggcagtggg......tcagncactgatttcacactgaaaatcagccgggtggaagctgaggatgttggggtgtattactgtatgcaaagtatagagtttcctcc
322+
"""
323+
out = StringIO()
324+
err = StringIO()
325+
with redirect_stdout(out), redirect_stderr(err):
326+
with tempfile.TemporaryDirectory() as tempdir:
327+
os.chdir(tempdir)
328+
with open(self.path / "config.yml") as f_in, open("config.yml", "wt") as f_out:
329+
f_out.write(f_in.read())
330+
f_out.write(f"fileSequences: {self.input_path}\n")
331+
main(["config.yml", "--align"])
332+
self.assertFalse(Path("vquest_airr.tsv").exists())
333+
self.assertFalse(Path("Parameters.txt").exists())
334+
self.assertEqual(out.getvalue(), expected)
335+
self.assertEqual(err.getvalue(), "")
336+
337+
338+
class TestVquestFastq(TestVquestFasta):
339+
"""File-based input with FASTQ."""
340+
341+
def setUp(self):
342+
super().setUp()
343+
self.input_path = self.path/"seqs.fastq"
344+
self.config["fileSequences"] = self.input_path
345+
346+
239347
class TestVquestCustom(TestVquestSimple):
240348
"""Try changing one of the configuration options.
241349
@@ -274,7 +382,7 @@ def test_vquest(self):
274382
self.assertEqual(self.post.call_count, 1)
275383
self.assertEqual(
276384
self.post.call_args.args,
277-
('http://www.imgt.org/IMGT_vquest/analysis', ))
385+
('https://www.imgt.org/IMGT_vquest/analysis', ))
278386

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

0 commit comments

Comments
 (0)