Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/hotfix'
Browse files Browse the repository at this point in the history
  • Loading branch information
susannasiebert committed Sep 13, 2022
2 parents 65e9ca7 + 42b9576 commit 6be7d60
Show file tree
Hide file tree
Showing 14 changed files with 99 additions and 34 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
# The short X.Y version.
version = '3.0'
# The full version, including alpha/beta/rc tags.
release = '3.0.3'
release = '3.0.4'


# The language for content autogenerated by Sphinx. Refer to documentation
Expand Down
20 changes: 6 additions & 14 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,12 @@ New in Release |release|

This is a bugfix release. It fixes the following problem(s):

- When using the ``--additional-report-columns`` parameter in
pVACview/pVACfuse, no contents were previously written to the additional columns.
- MHCflurry may return no value for the percentile binding score. This would
previously result in an error which has been fixed in this release.
- Variants in a VCF may contain an empty AF field, which was previsouly not
being handled correctly in all cases, resulting in an error.

This release also includes some minor improvements:

- When running the pVACseq pipeline there would be a lot of warning messages
about missing position column parameters. These would mostly be noise
because the underlying consequence type wasn't supported by pVACseq to begin
with. This release removes these warning messages for mutations with
consequences that are not supported by pVACseq.
- This fixes an issue introduced in the previous release where VCF entries with no
VAF value would result in an error.
- This release adds a new constraint to the vaf cutoff command line arguments
to ensure that they are a fraction between 0 and 1.
- This release also fixes an issue where the wrong binding filter class was
being used when running pVACfuse with allele-specific binding cutoffs.


New in Version |version|
Expand Down
12 changes: 12 additions & 0 deletions docs/releases/3_0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,15 @@ This release also includes some minor improvements:
because the underlying consequence type wasn't supported by pVACseq to begin
with. This release removes these warning messages for mutations with
consequences that are not supported by pVACseq.

Version 3.0.4
-------------

This is a bugfix release. It fixes the following problem(s):

- This fixes an issue introduced in the previous release where VCF entries with no
VAF value would result in an error.
- This release adds a new constraint to the vaf cutoff command line arguments
to ensure that they are a fraction between 0 and 1.
- This release also fixes an issue where the wrong binding filter class was
being used when running pVACfuse with allele-specific binding cutoffs.
2 changes: 1 addition & 1 deletion pvactools/lib/allele_specific_binding_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def execute(self):
writer.writeheader()

for entry in reader:
if self.file_type == 'pVACbind':
if self.file_type == 'pVACbind' or self.file_type == 'pVACfuse':
if self.top_score_metric == 'median':
score = float(entry['Median Score'])
percentile_column = 'Median Percentile'
Expand Down
11 changes: 7 additions & 4 deletions pvactools/lib/input_file_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,16 @@ def get_vaf_from_vcf_genotype(self, genotype, alts, alt, af_tag, ad_tag, dp_tag)
allele_frequencies = genotype.data[af_tag]
if isinstance(allele_frequencies, list):
if len(allele_frequencies) == 0:
vaf = 'NA'
return 'NA'
else:
vaf = allele_frequencies[alts.index(alt)]
else:
vaf = allele_frequencies
if vaf is None or vaf == "":
return 'NA'
if vaf > 1:
print("Warning: VAF is expected to be a fraction, but is larger than 1. If VAFs are encoded as percentages, please adjust the coverage cutoffs accordingly.")
return vaf
else:
if ad_tag in genotype.data and dp_tag in genotype.data:
allele_depths = genotype.data[ad_tag]
Expand All @@ -196,10 +199,10 @@ def get_vaf_from_vcf_genotype(self, genotype, alts, alt, af_tag, ad_tag, dp_tag)
depth = genotype.data[dp_tag]
if depth is None or depth == "":
return 'NA'
vaf = self.calculate_vaf(int(var_count), int(depth))
else:
return self.calculate_vaf(int(var_count), int(depth))
else:
vaf = 'NA'
return vaf
return 'NA'

def calculate_coverage_for_entry(self, entry, reference, alt, genotype):
coverage_for_entry = {}
Expand Down
13 changes: 7 additions & 6 deletions pvactools/lib/run_argument_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from pvactools.lib.prediction_class import PredictionClass
import pvactools.lib.net_chop
from pvactools.lib.run_utils import *

class RunArgumentParser(metaclass=ABCMeta):
def __init__(self, tool_name, input_file_help):
Expand Down Expand Up @@ -213,18 +214,18 @@ def __init__(self):
default=10
)
self.parser.add_argument(
'--normal-vaf', type=float,
help="Normal VAF Cutoff. Only sites BELOW this cutoff in normal will be considered.",
'--normal-vaf', type=float_range(0.0,1.0),
help="Normal VAF Cutoff in decimal format. Only sites BELOW this cutoff in normal will be considered.",
default=0.02
)
self.parser.add_argument(
'--tdna-vaf', type=float,
help="Tumor DNA VAF Cutoff. Only sites above this cutoff will be considered.",
'--tdna-vaf', type=float_range(0.0,1.0),
help="Tumor DNA VAF Cutoff in decimal format. Only sites above this cutoff will be considered.",
default=0.25
)
self.parser.add_argument(
'--trna-vaf', type=float,
help="Tumor RNA VAF Cutoff. Only sites above this cutoff will be considered.",
'--trna-vaf', type=float_range(0.0,1.0),
help="Tumor RNA VAF Cutoff in decimal format. Only sites above this cutoff will be considered.",
default=0.25
)
self.parser.add_argument(
Expand Down
23 changes: 23 additions & 0 deletions pvactools/lib/run_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from itertools import islice

from pvactools.lib.prediction_class import *
import argparse

def split_algorithms(prediction_algorithms):
if 'all' in prediction_algorithms:
Expand Down Expand Up @@ -89,3 +90,25 @@ def split_file(reader, lines):

def construct_index(count, gene, transcript, variant_type, position):
return '{}.{}.{}.{}.{}'.format(count, gene, transcript, variant_type, position)

def float_range(minimum, maximum):
"""Return function handle of an argument type function for
ArgumentParser checking a float range: minimum <= arg <= maximum
minimum - minimum acceptable argument
maximum - maximum acceptable argument"""

# Define the function with default arguments
def float_range_checker(arg):
"""New Type function for argparse - a float within predefined range."""

try:
f = float(arg)
except ValueError:
raise argparse.ArgumentTypeError("must be a floating point number")
if f < minimum or f > maximum:
raise argparse.ArgumentTypeError("must be in range [" + str(minimum) + " .. " + str(maximum)+"]")
return f

# Return function handle to checking function
return float_range_checker

13 changes: 7 additions & 6 deletions pvactools/tools/pvacseq/coverage_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import csv

from pvactools.lib.filter import Filter
from pvactools.lib.run_utils import *

def define_parser():
parser = argparse.ArgumentParser(
Expand Down Expand Up @@ -36,18 +37,18 @@ def define_parser():
default=10
)
parser.add_argument(
'--normal-vaf', type=float,
help="Normal VAF Cutoff. Sites BELOW this cutoff in normal will be considered.",
'--normal-vaf', type=float_range(0.0,1.0),
help="Normal VAF Cutoff in decimal format. Sites BELOW this cutoff in normal will be considered.",
default=0.02
)
parser.add_argument(
'--tdna-vaf', type=float,
help="Tumor DNA VAF Cutoff. Sites above this cutoff will be considered.",
'--tdna-vaf', type=float_range(0.0,1.0),
help="Tumor DNA VAF Cutoff in decimal format. Sites above this cutoff will be considered.",
default=0.25
)
parser.add_argument(
'--trna-vaf', type=float,
help="Tumor RNA VAF Cutoff. Sites above this cutoff will be considered.",
'--trna-vaf', type=float_range(0.0,1.0),
help="Tumor RNA VAF Cutoff in decimal format. Sites above this cutoff will be considered.",
default=0.25
)
parser.add_argument(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

setup(
name="pvactools",
version="3.0.3",
version="3.0.4",
packages=[
"pvactools.tools",
"pvactools.tools.pvacbind",
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions tests/test_data/input_file_converter/output_empty_vaf.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
chromosome_name start stop reference variant gene_name transcript_name transcript_support_level amino_acid_change codon_change ensembl_gene_id hgvsc hgvsp wildtype_amino_acid_sequence frameshift_amino_acid_sequence fusion_amino_acid_sequence variant_type protein_position transcript_expression gene_expression normal_depth normal_vaf tdna_depth tdna_vaf trna_depth trna_vaf index protein_length_change
chr5 109378379 109378382 TCC AAA PJA2 ENST00000361189.7 1 G/F GGA/TTT ENSG00000198961 ENST00000361189.7:c.1105_1107delinsTTT ENSP00000354775.2:p.Gly369Phe MSQYTEKEPAAMDQESGKAVWPKPAGGYQTITGRRYGRRHAYVSFKPCMTRHERSLGRAGDDYEVLELDDVPKENSSGSSPLDQVDSSLPSEPIFEKSETEIPTCGSALNQTTESSQSFVAVHHSEEGRDTLGSSTNLHNHSEGEYIPGACSASSVQNGIALVHTDSYDPDGKHGEDNDHLQLSAEVVEGSRYQESLGNTVFELENREAEAYTGLSPPVPSFNCEVRDEFEELDSVPLVKSSAGDTEFVHQNSQEIQRSSQDEMVSTKQQNNTSQERQTEHSPEDAACGPGHICSEQNTNDREKNHGSSPEQVVRPKVRKLISSSQVDQETGFNRHEAKQRSVQRWREALEVEESGSDDLLIKCEEYDGEHDCMFLDPPYSRVITQRETENNQMTSESGATAGRQEVDNTFWNGCGDYYQLYDKDEDSSECSDGEWSASLPHRFSGTEKDQSSSDESWETLPGKDENEPELQSDSSGPEEENQELSLQEGEQTSLEEGEIPWLQYNEVNESSSDEGNEPANEFAQPAFMLDGNNNLEDDSSVSEDLDVDWSLFDGFADGLGVAEAISYVDPQFLTYMALEERLAQAMETALAHLESLAVDVEVANPPASKESIDGLPETLVLEDHTAIGQEQCCPICCSEYIKDDIATELPCHHFFHKPCVSIWLQKSGTCPVCRRHFPPAVIEASAAPSSEPDPDAPPSNDSIAEAP missense 369 NA 36.746376 NA NA 225 0.283 NA NA 1.PJA2.ENST00000361189.7.missense.369G/F
31 changes: 31 additions & 0 deletions tests/test_input_file_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,37 @@ def test_input_vcf_generates_expected_tsv(self):
expected_output_file = os.path.join(self.test_data_dir, 'output.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))

def test_input_vcf_with_empty_vaf_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_empty_vaf_list.vcf.gz')
convert_vcf_output_file = tempfile.NamedTemporaryFile()

convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
'sample_name' : 'TUMOR',
'normal_sample_name': 'NORMAL',
}
converter = VcfConverter(**convert_vcf_params)

self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_empty_vaf.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))

convert_vcf_input_file = os.path.join(self.test_data_dir, 'input_empty_vaf_single.vcf.gz')
convert_vcf_output_file = tempfile.NamedTemporaryFile()

convert_vcf_params = {
'input_file' : convert_vcf_input_file,
'output_file' : convert_vcf_output_file.name,
'sample_name' : 'TUMOR',
'normal_sample_name': 'NORMAL',
}
converter = VcfConverter(**convert_vcf_params)

self.assertFalse(converter.execute())
expected_output_file = os.path.join(self.test_data_dir, 'output_empty_vaf.tsv')
self.assertTrue(cmp(convert_vcf_output_file.name, expected_output_file))

def test_input_vcf_with_tx_annotation_generates_expected_tsv(self):
convert_vcf_input_file = os.path.join(self.test_data_dir, 'input.tx.vcf')
convert_vcf_output_file = tempfile.NamedTemporaryFile()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pvacseq.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def test_pvacseq_pipeline(self):
'--keep-tmp-files',
'--net-chop-method', 'cterm',
'--netmhc-stab',
'--tdna-vaf', '20',
'--tdna-vaf', '0.2',
'-d', 'full',
'--pass-only',
'--run-reference-proteome-similarity',
Expand Down

0 comments on commit 6be7d60

Please sign in to comment.