From cfcd397b19f70fb39d6d21437db8eb6ffcac3914 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 21 Apr 2020 17:39:33 +0100 Subject: [PATCH] JAL-3407 add and document ComputePeptideVariants.groovy --- examples/groovy/ComputePeptideVariants.groovy | 32 +++++++++++++++++++++++++ help/help/html/features/importvcf.html | 18 ++++++++++++++ help/help/html/releases.html | 5 ++++ help/help/html/whatsNew.html | 8 ++++++- 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 examples/groovy/ComputePeptideVariants.groovy diff --git a/examples/groovy/ComputePeptideVariants.groovy b/examples/groovy/ComputePeptideVariants.groovy new file mode 100644 index 0000000..6caa69c --- /dev/null +++ b/examples/groovy/ComputePeptideVariants.groovy @@ -0,0 +1,32 @@ +import jalview.datamodel.SequenceFeature +import jalview.gui.Desktop +def af = jalview.bin.Jalview.currentAlignFrame +def av = af.viewport +def fr = Desktop.getAlignFrameFor(av.codingComplement).getFeatureRenderer() +def counts = 0 +def countm = 0 +for (seq in av.alignment.sequences) +{ + ds = seq.datasetSequence + for (res = ds.start ; res <= ds.end; res++) + { + mf = fr.findComplementFeaturesAtResidue(seq, res) + if (mf != null) + { + for (feature in mf.features) + { + variant = mf.findProteinVariants(feature) + if (!"".equals(variant)) + { + type = variant.contains("=") ? "synonymous_variant" : "missense_variant" + if (type.equals("synonymous_variant")) counts++ else countm++; + sf = new SequenceFeature(type, variant, res, res, null) + seq.addSequenceFeature(sf) + } + } + } + } +} +af.getFeatureRenderer().featuresAdded() +af.alignPanel.paintAlignment(true, true) +println "Added " + countm + " missense and " + counts + " synonymous variants" \ No newline at end of file diff --git a/help/help/html/features/importvcf.html b/help/help/html/features/importvcf.html index 511ff2e..7b699eb 100755 --- a/help/help/html/features/importvcf.html +++ b/help/help/html/features/importvcf.html @@ -72,6 +72,24 @@ for more information.

+ Working with variants without CSQ fields +

+

+ Jalview 2.11.1's new virtual + features mean that peptide sequences are no longer annotated + directly with protein missense variants. This makes it harder to + filter variants when they do not already include the CSQ field. You + can rescue the pre-2.11.1 functionality by: +

+
    +
  1. Download the script at + https://www.jalview.org/examples/groovy/ComputePeptideVariants.groovy
  2. +
  3. Executing the script via the Groovy + Console on a linked CDS/Protein view to create missense and + synonymous peptide variant features. +
  4. +
+

Working with variants from organisms other than H.sapiens.

diff --git a/help/help/html/releases.html b/help/help/html/releases.html index d3f2420..60e3179 100755 --- a/help/help/html/releases.html +++ b/help/help/html/releases.html @@ -139,6 +139,11 @@ li:before { to stdout containing the consensus sequence for each alignment in a Jalview session +
  • + ComputePeptideVariants.groovy to translate + genomic sequence_variant annotation from CDS as + missense_variant or synonymous_variant on protein products. +
  • diff --git a/help/help/html/whatsNew.html b/help/help/html/whatsNew.html index 00f9466..0f0c7f1 100755 --- a/help/help/html/whatsNew.html +++ b/help/help/html/whatsNew.html @@ -43,7 +43,13 @@ Sequence Features dialog. This allows more analyses of nucleotide and peptide sequence features on alignments in a more flexible and - memory efficient way than in earlier versions. + memory efficient way than in earlier versions.
    + Note: Virtual features work best when variants are + annotated with CSQ fields. Please see this + Groovy script workaround if you are working with VCF files + without CSQ fields. +
  • Improved VCF data import
    Standard attributes for filtering variants (e.g. position, QUAL field etc) are now -- 1.7.10.2