FeatureDistanceModel instance;
try
{
- instance = this.getClass().newInstance();
+ instance = this.getClass().getDeclaredConstructor().newInstance();
instance.configureFromAlignmentView(view);
return instance;
} catch (InstantiationException | IllegalAccessException e)
System.err.println("Error in " + getClass().getName()
+ ".getInstance(): " + e.getMessage());
return null;
+ } catch (ReflectiveOperationException roe)
+ {
+ return null;
}
}
/*
* first record feature types in this column for each sequence
*/
- Map<SeqCigar, Set<String>> sfap = findFeatureTypesAtColumn(
- seqs, cpos);
+ Map<SeqCigar, Set<String>> sfap = findFeatureTypesAtColumn(seqs,
+ cpos);
/*
* count feature types on either i'th or j'th sequence but not both
/**
* 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<SeqCigar, Set<String>> findFeatureTypesAtColumn(
SeqCigar[] seqs, int columnPosition)
{
- Map<SeqCigar, Set<String>> sfap = new HashMap<SeqCigar, Set<String>>();
+ Map<SeqCigar, Set<String>> sfap = new HashMap<>();
for (SeqCigar seq : seqs)
{
int spos = seq.findPosition(columnPosition);
if (spos != -1)
{
- Set<String> types = new HashSet<String>();
- List<SequenceFeature> sfs = fr.findFeaturesAtRes(seq.getRefSeq(),
- spos);
+ /*
+ * position is not a gap
+ */
+ Set<String> types = new HashSet<>();
+ List<SequenceFeature> sfs = fr.findFeaturesAtResidue(
+ seq.getRefSeq(), spos, spos);
for (SequenceFeature sf : sfs)
{
types.add(sf.getType());