Skip to content

Commit

Permalink
Merge pull request #227 from jonasscheid/fix-bug-if-no-transcript-ava…
Browse files Browse the repository at this point in the history
…ilable

Prevent crash if no transcript is found (in splitted vcf)
  • Loading branch information
jonasscheid authored Feb 6, 2024
2 parents a0e248d + 6177dc3 commit a728456
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 9 additions & 7 deletions bin/epaa.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(";")]

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit a728456

Please sign in to comment.