+ * Builds and returns a set containing sequences (SeqCigar) which have
+ * no secondary structures defined
+ *
+ * @param seqs
+ * (0..)
+ * @return
+ */
+ private static final String[] SS_ANNOTATION_LABELS = {
+ SS_ANNOTATION_LABEL,
+ SS_ANNOTATION_FROM_JPRED_LABEL
+ };
+
+ protected Set<SeqCigar> findSeqsWithUndefinedSS(SeqCigar[] seqs, Map<String, HashSet<String>> calcIdMapInAlignmentAnnotation) {
+ Set<SeqCigar> seqsWithUndefinedSS = new HashSet<>();
+ for (SeqCigar seq : seqs) {
+ if (isSSUndefinedOrNotAdded(seq, calcIdMapInAlignmentAnnotation)) {
+ seqsWithUndefinedSS.add(seq);
+ }
+ }
+ return seqsWithUndefinedSS;
+ }
+
+ private boolean isSSUndefinedOrNotAdded(SeqCigar seq, Map<String, HashSet<String>> calcIdMapInAlignmentAnnotation) {
+ for (String label : SS_ANNOTATION_LABELS) {
+ AlignmentAnnotation[] annotations = seq.getRefSeq().getAnnotation(label);
+ if (annotations != null) {
+ for (AlignmentAnnotation annotation : annotations) {
+ HashSet<String> descriptionList = calcIdMapInAlignmentAnnotation.get(annotation.getCalcId());
+ if (descriptionList.contains(annotation.description)) {
+ // Secondary structure annotation is present and added to the track, no need to add seq
+ return false;
+ }
+ }
+ }
+ }
+ // Either annotations are undefined or not added to the track
+ return true;
+ }
+
+
+ /**