X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2Fvcf%2FVCFLoader.java;h=e381b264ffde9cecb38055a211d572160e601fdd;hb=353109c11d706b29ae5bc9606f0e12223aa45a98;hp=a3e7e5a672d34c01d550fab1c6d6e1c7d958bc57;hpb=9245b43569781ac47b6f58872c77a3bf21bcc362;p=jalview.git diff --git a/src/jalview/io/vcf/VCFLoader.java b/src/jalview/io/vcf/VCFLoader.java index a3e7e5a..e381b26 100644 --- a/src/jalview/io/vcf/VCFLoader.java +++ b/src/jalview/io/vcf/VCFLoader.java @@ -287,7 +287,7 @@ public class VCFLoader /** * Transfers VCF features to sequences to which this sequence has a mapping. - * If the mapping is 1:3, computes peptide variants from nucleotide variants. + * If the mapping is 3:1, computes peptide variants from nucleotide variants. * * @param seq */ @@ -351,6 +351,9 @@ public class VCFLoader GeneLociI seqCoords = seq.getGeneLoci(); if (seqCoords == null) { + System.out.println(String.format( + "Can't query VCF for %s as chromosome coordinates not known", + seq.getName())); return 0; } @@ -429,27 +432,21 @@ public class VCFLoader */ VariantContext variant = variants.next(); - /* - * we can only process SNP variants (which can be reported - * as part of a MIXED variant record - */ - if (!variant.isSNP() && !variant.isMixed()) - { - // continue; - } - int start = variant.getStart() - offset; int end = variant.getEnd() - offset; /* * convert chromosomal location to sequence coordinates + * - may be reverse strand (convert to forward for sequence feature) * - null if a partially overlapping feature */ int[] seqLocation = mapping.locateInFrom(start, end); if (seqLocation != null) { - count += addAlleleFeatures(seq, variant, seqLocation[0], - seqLocation[1], forwardStrand); + int featureStart = Math.min(seqLocation[0], seqLocation[1]); + int featureEnd = Math.max(seqLocation[0], seqLocation[1]); + count += addAlleleFeatures(seq, variant, featureStart, featureEnd, + forwardStrand); } } @@ -561,13 +558,6 @@ public class VCFLoader String reference = variant.getReference().getBaseString(); Allele alt = variant.getAlternateAllele(altAlleleIndex); String allele = alt.getBaseString(); - if (allele.length() != 1) - { - /* - * not a SNP variant - */ - // return 0; - } /* * build the ref,alt allele description e.g. "G,A", using the base @@ -865,7 +855,8 @@ public class VCFLoader * call (e.g.) http://rest.ensembl.org/map/human/GRCh38/17:45051610..45109016:1/GRCh37 */ EnsemblMap mapper = new EnsemblMap(); - int[] mapping = mapper.getMapping(species, chromosome, fromRef, toRef, + int[] mapping = mapper.getAssemblyMapping(species, chromosome, fromRef, + toRef, queryRange); if (mapping == null)