diff --git a/CHANGELOG.md b/CHANGELOG.md index 01c58a5..871fc32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#228](https://github.com/nf-core/epitopeprediction/pull/228) - Update to nf-core template `2.12` - [#228](https://github.com/nf-core/epitopeprediction/pull/228) - Update to nf-core template `2.11` +- [#227](https://github.com/nf-core/epitopeprediction/pull/227) Prevent crash if no transcript is found (in splitted vcf) - [#220](https://github.com/nf-core/epitopeprediction/pull/220) - Switch to nf-validation to parse samplesheet - [#213](https://github.com/nf-core/epitopeprediction/pull/203) - Update to nf-core template `2.10` - [#206](https://github.com/nf-core/epitopeprediction/issues/206) - Update the row checker class. diff --git a/bin/epaa.py b/bin/epaa.py index 8445fa8..65a3151 100755 --- a/bin/epaa.py +++ b/bin/epaa.py @@ -280,7 +280,6 @@ def read_vcf(filename, pass_only=True): split_coding_c[0] if split_coding_c[0] else split_annotation[vep_fields["feature"]] ) transcript_id = transcript_id.split(".")[0] - tpos = int(cds_pos.split("/")[0].split("-")[0]) - 1 if split_annotation[vep_fields["protein_position"]]: ppos = ( @@ -712,7 +711,6 @@ def make_predictions_from_variants( # list to hold dataframes for all predictions pred_dataframes = [] - prots = [ p for p in generator.generate_proteins_from_transcripts( @@ -1054,14 +1052,10 @@ def __main__(): logger.info("Running epaa for variants...") if args.somatic_mutations.endswith(".vcf"): variant_list, transcripts, metadata = read_vcf(args.somatic_mutations) + transcripts = list(set(transcripts)) else: raise ValueError("File is not in VCF format. Please provide a VCF file.") - transcripts = list(set(transcripts)) - - # use function provided by epytope to retrieve protein IDs (different systems) for transcript IDs - transcriptProteinTable = ma.get_protein_ids_from_transcripts(transcripts, type=ID_SYSTEM_USED) - # get the alleles alleles = [Allele(a) for a in args.alleles.split(";")] @@ -1123,7 +1117,15 @@ def __main__(): pred_dataframes, statistics = make_predictions_from_peptides( peptides, methods, thresholds, args.use_affinity_thresholds, alleles, up_db, args.identifier, metadata ) + elif len(transcripts) == 0: + logger.warning(f"No transcripts found for variants in {args.somatic_mutations}") + pred_dataframes = [] + statistics = {} + all_peptides_filtered = [] + proteins = [] else: + # use function provided by epytope to retrieve protein IDs (different systems) for transcript IDs + transcriptProteinTable = ma.get_protein_ids_from_transcripts(transcripts, type=EIdentifierTypes.ENSEMBL) pred_dataframes, statistics, all_peptides_filtered, proteins = make_predictions_from_variants( variant_list, methods,