From a3aeac8b969d88e6e67829381ca6576a0026c49d Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Thu, 3 Aug 2023 17:48:11 +0200 Subject: [PATCH 1/2] During reference proteome similarity step, handle cases where a variant's full peptide sequence is not in the fasta file --- pvactools/lib/calculate_reference_proteome_similarity.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pvactools/lib/calculate_reference_proteome_similarity.py b/pvactools/lib/calculate_reference_proteome_similarity.py index d6bee8550..fa40f9692 100644 --- a/pvactools/lib/calculate_reference_proteome_similarity.py +++ b/pvactools/lib/calculate_reference_proteome_similarity.py @@ -279,7 +279,8 @@ def _get_full_peptide(self, line, mt_records_dict, wt_records_dict): (parsed_aa_change, pos, wt_aa, mt_aa) = index_to_aggregate_report_aa_change(aa_change, variant_type) if line['Best Transcript'] == transcript and line['AA Change'] == parsed_aa_change: return (mt_records_dict[record_id], wt_records_dict[record_id], variant_type, mt_aa, wt_aa) - raise Exception("Unable to find full_peptide for variant {}".format(line['ID'])) + print("Unable to find full_peptide for variant {}".format(line['ID'])) + return (None, None, variant_type, mt_aa, wt_aa) def _get_peptide(self, line, mt_records_dict, wt_records_dict): ## Get epitope, peptide and full_peptide @@ -293,6 +294,8 @@ def _get_peptide(self, line, mt_records_dict, wt_records_dict): if self._input_tsv_type(line) == 'aggregated': epitope = line['Best Peptide'] (full_peptide, wt_peptide, variant_type, mt_amino_acids, wt_amino_acids) = self._get_full_peptide(line, mt_records_dict, wt_records_dict) + if full_peptide is None: + return None, None if variant_type != 'FS': if line['Pos'] == 'NA': mt_pos = None From e91c29c3419d4cf18efc43ad5e24e57aef695847 Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Fri, 4 Aug 2023 14:03:49 +0200 Subject: [PATCH 2/2] Use the same number of flanking_bases when creating the proximal tsv between master and epitope-length-specific fastas --- pvactools/tools/pvacseq/generate_protein_fasta.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvactools/tools/pvacseq/generate_protein_fasta.py b/pvactools/tools/pvacseq/generate_protein_fasta.py index d0b463073..d436c6be5 100644 --- a/pvactools/tools/pvacseq/generate_protein_fasta.py +++ b/pvactools/tools/pvacseq/generate_protein_fasta.py @@ -90,7 +90,7 @@ def convert_vcf(input_vcf, temp_dir, sample_name, phased_proximal_variants_vcf, convert_params['proximal_variants_vcf'] = phased_proximal_variants_vcf proximal_variants_tsv = os.path.join(temp_dir, 'proximal_variants.tsv') convert_params['proximal_variants_tsv'] = proximal_variants_tsv - convert_params['flanking_bases'] = flanking_sequence_length * 4 + convert_params['flanking_bases'] = (flanking_sequence_length + 1)* 4 else: proximal_variants_tsv = None if pass_only: