X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2Fscoremodels%2FFeatureDistanceModel.java;h=9c2f6d1bb0a39ba149f5045ed5265623f784c897;hb=57738a1f3c19b1c3a00bd3ac5108f8cd0af32f99;hp=c20d4f1a76353ee54adcb41221ce5175c607057a;hpb=3d0101179759ef157b088ea135423cd909512d9f;p=jalview.git diff --git a/src/jalview/analysis/scoremodels/FeatureDistanceModel.java b/src/jalview/analysis/scoremodels/FeatureDistanceModel.java index c20d4f1..9c2f6d1 100644 --- a/src/jalview/analysis/scoremodels/FeatureDistanceModel.java +++ b/src/jalview/analysis/scoremodels/FeatureDistanceModel.java @@ -58,7 +58,7 @@ public class FeatureDistanceModel extends DistanceScoreModel FeatureDistanceModel instance; try { - instance = this.getClass().newInstance(); + instance = this.getClass().getDeclaredConstructor().newInstance(); instance.configureFromAlignmentView(view); return instance; } catch (InstantiationException | IllegalAccessException e) @@ -66,6 +66,9 @@ public class FeatureDistanceModel extends DistanceScoreModel System.err.println("Error in " + getClass().getName() + ".getInstance(): " + e.getMessage()); return null; + } catch (ReflectiveOperationException roe) + { + return null; } } @@ -177,24 +180,29 @@ public class FeatureDistanceModel extends DistanceScoreModel /** * Builds and returns a map containing a (possibly empty) list (one per * SeqCigar) of visible feature types at the given column position. The map - * has no entry for sequences which are gapped at the column position. + * does not include entries for features which straddle a gapped column + * positions. * * @param seqs * @param columnPosition + * (0..) * @return */ protected Map> findFeatureTypesAtColumn( SeqCigar[] seqs, int columnPosition) { - Map> sfap = new HashMap>(); + Map> sfap = new HashMap<>(); for (SeqCigar seq : seqs) { int spos = seq.findPosition(columnPosition); if (spos != -1) { - Set types = new HashSet(); - List sfs = fr.findFeaturesAtRes(seq.getRefSeq(), - spos); + /* + * position is not a gap + */ + Set types = new HashSet<>(); + List sfs = fr + .findFeaturesAtResidue(seq.getRefSeq(), spos, spos); for (SequenceFeature sf : sfs) { types.add(sf.getType());