Skip to content

Commit

Permalink
2022-02-23: 0.4.1 (GUI). Fixed bug in upload_tcr_details
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Heather committed Feb 24, 2022
1 parent 06f168a commit cd33f83
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ Note that the third example there uses the preferred allele option and specifies
* `-jt` - length of J gene substring that has to be matched to avoid throwing a warning (decrease to get fewer notices about short J matches), default = 3

# GUI-stitchr
### 0.4.0
### 0.4.1

A graphical interface has been developed for users that are less comfortable at the command line, or who prefer a more immediately interactive session. It can be launched from inside the Scripts directory like so:

Expand Down
12 changes: 7 additions & 5 deletions Scripts/gui-stitchr.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import collections as coll
import warnings

__version__ = '0.4.0'
__version__ = '0.4.1'
__author__ = 'Jamie Heather'
__email__ = 'jheather@mgh.harvard.edu'

Expand Down Expand Up @@ -98,12 +98,13 @@ def change_receptors(receptor_str):
return new_receptor


def upload_tcr_details(path_to_file, receptor_type):
def upload_tcr_details(path_to_file, receptor_type, stated_species):
"""
Read suitably formatted TCRs in template format to the GUI
:param path_to_file: str detailing the full path to the input file
:param receptor_type: str detailing the receptor in use, i.e. either 'TRA/TRB' or 'TRG/TRD'
:return: str of receptor type again, in case it switches during the course of reading the TCR file in
:param stated_species: str of the species on record before the upload, to remain if one not inferred
:return: strs of receptor type and species again, in case they switch during the course of reading the TCR file in
"""

# This section uses the Thimble format input file to populate the GUI fields
Expand All @@ -119,6 +120,7 @@ def upload_tcr_details(path_to_file, receptor_type):
inferred_species = species_inference
window['species_choice'].update(inferred_species)
else:
inferred_species = stated_species
sg.Popup("Cannot infer species name from file name:\nplease set manually.")

with open(path_to_file, 'r') as in_file:
Expand Down Expand Up @@ -361,7 +363,7 @@ def upload_tcr_details(path_to_file, receptor_type):
'using the first alphabetically.')
example_matches.sort()

receptor, species = upload_tcr_details(examples_path + example_matches[0], receptor)
receptor, species = upload_tcr_details(examples_path + example_matches[0], receptor, species)

elif event == 'change_receptor':

Expand Down Expand Up @@ -391,7 +393,7 @@ def upload_tcr_details(path_to_file, receptor_type):

elif event == 'Upload TCR details':

receptor = upload_tcr_details(values['uploaded_tcr'], receptor)
receptor, species = upload_tcr_details(values['uploaded_tcr'], receptor, species)

elif event == 'find_preferred_alleles':

Expand Down
2 changes: 1 addition & 1 deletion Templates/GUI-Examples/human_TRG-TRD.tsv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
TCR_name TRGV TRGJ TRG_CDR3 TRDV TRDJ TRD_CDR3 TRGC TRDC TRG_leader TRD_leader Linker Link_order TRG_5_prime_seq TRG_3_prime_seq TRD_5_prime_seq TRD_3_prime_seq
Y00482/X14547 TRGV5*01 TRGJ1*02 CATWAPNYYKKLF TRDV2*03 TRDJ1*01 CACDTLRTGGRLYTDKLIF TRGC1*01 TRDC*01 TRGV5*01 TRDV2*03 P2A GD
Y00482/X14547 TRGV5*01 TRGJ1*02 CATWAPNYYKKLF TRDV2*03 TRDJ1*01 CACDTLRTGGRLYTDKLIF TRGC1*01 TRDC*01 TRGV5*01 TRDV2*03 P2A GD

0 comments on commit cd33f83

Please sign in to comment.