From: Jim Procter Date: Wed, 16 Nov 2016 17:12:43 +0000 (+0000) Subject: Merge branch 'features/JAL-1723_sequenceReport' into develop X-Git-Tag: Release_2_10_1~11^2^2~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d0d8e3e2f528581af454e5b2a51372a9f4677114;p=jalview.git Merge branch 'features/JAL-1723_sequenceReport' into develop Conflicts: resources/lang/Messages.properties resources/lang/Messages_es.properties src/jalview/io/SequenceAnnotationReport.java reconciled refactored report/ellipsis code with refactored URLLink code for generating dynamic links with ACCESSION_ID tokens --- d0d8e3e2f528581af454e5b2a51372a9f4677114 diff --cc resources/lang/Messages.properties index 49a0456,1c52b63..01ba0ff --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@@ -1268,7 -1268,4 +1268,8 @@@ status.exporting_alignment_as_x_file = label.column = Column label.cant_map_cds = Unable to map CDS to protein\nCDS missing or incomplete label.operation_failed = Operation failed +label.SEQUENCE_ID_no_longer_used = $SEQUENCE_ID$ is no longer used for DB accessions +label.SEQUENCE_ID_for_DB_ACCESSION1 = Please review your URL links in the 'Connections' tab of the Preferences window: +label.SEQUENCE_ID_for_DB_ACCESSION2 = URL links using '$SEQUENCE_ID$' for DB accessions now use '$DB_ACCESSION$'. +label.do_not_display_again = Do not display this message again + label.output_seq_details = Output Sequence Details to list all database references diff --cc resources/lang/Messages_es.properties index 96c8ef2,8009ae9..9c2436c --- a/resources/lang/Messages_es.properties +++ b/resources/lang/Messages_es.properties @@@ -1269,7 -1269,4 +1269,8 @@@ status.exporting_alignment_as_x_file = label.column = Columna label.cant_map_cds = No se pudo mapear CDS a proteína\nDatos CDS faltantes o incompletos label.operation_failed = Operación fallada +label.SEQUENCE_ID_no_longer_used = $SEQUENCE_ID$ no se utiliza más para accesiones DB +label.SEQUENCE_ID_for_DB_ACCESSION1 = Por favor, revise sus URLs en la pestaña 'Conexiones' de la ventana de Preferencias: +label.SEQUENCE_ID_for_DB_ACCESSION2 = URL enlaza usando '$SEQUENCE_ID$' para accesiones DB ahora usar '$DB_ACCESSION$'. - label.do_not_display_again = No mostrar este mensaje de nuevo ++label.do_not_display_again = No mostrar este mensaje de nuevo + label.output_seq_details = Seleccionar Detalles de la secuencia para ver todas diff --cc src/jalview/io/SequenceAnnotationReport.java index 89f1068,59daa87..850b1dc --- a/src/jalview/io/SequenceAnnotationReport.java +++ b/src/jalview/io/SequenceAnnotationReport.java @@@ -24,11 -25,13 +25,13 @@@ import jalview.datamodel.DBRefSource import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.io.gff.GffConstants; -import jalview.util.DBRefUtils; + import jalview.util.MessageManager; import jalview.util.UrlLink; --import java.util.ArrayList; + import java.util.Arrays; +import java.util.Collection; + import java.util.Comparator; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@@ -248,13 -307,115 +307,13 @@@ public class SequenceAnnotationRepor System.err.println(urlLink.getInvalidMessage()); return null; } - final String target = urlLink.getTarget(); // link.substring(0, - // link.indexOf("|")); - final String label = urlLink.getLabel(); - if (seq != null && urlLink.isDynamic()) - { - urlSets.addAll(createDynamicLinks(seq, urlLink, uniques)); - } - else - { - String unq = label + "|" + urlLink.getUrl_prefix(); - if (!uniques.contains(unq)) - { - uniques.add(unq); - urlSets.add(new String[] { target, label, null, - urlLink.getUrl_prefix() }); - } - } - - return urlSets.toArray(new String[][] {}); - } - /** - * Formats and returns a list of dynamic href links - * - * @param seq - * @param urlLink - * @param uniques - */ - List createDynamicLinks(SequenceI seq, UrlLink urlLink, - List uniques) - { - List result = new ArrayList(); - final String target = urlLink.getTarget(); - final String label = urlLink.getLabel(); + urlLink.createLinksFromSeq(seq, urlSets); - // collect matching db-refs - DBRefEntry[] dbr = DBRefUtils.selectRefs(seq.getDBRefs(), - new String[] { target }); - // collect id string too - String id = seq.getName(); - String descr = seq.getDescription(); - if (descr != null && descr.length() < 1) - { - descr = null; - } - if (dbr != null) - { - for (int r = 0; r < dbr.length; r++) - { - if (id != null && dbr[r].getAccessionId().equals(id)) - { - // suppress duplicate link creation for the bare sequence ID - // string with this link - id = null; - } - // create Bare ID link for this URL - String[] urls = urlLink.makeUrls(dbr[r].getAccessionId(), true); - if (urls != null) - { - for (int u = 0; u < urls.length; u += 2) - { - String unq = urls[u] + "|" + urls[u + 1]; - if (!uniques.contains(unq)) - { - result.add(new String[] { target, label, urls[u], urls[u + 1] }); - uniques.add(unq); - } - } - } - } - } - if (id != null) - { - // create Bare ID link for this URL - String[] urls = urlLink.makeUrls(id, true); - if (urls != null) - { - for (int u = 0; u < urls.length; u += 2) - { - String unq = urls[u] + "|" + urls[u + 1]; - if (!uniques.contains(unq)) - { - result.add(new String[] { target, label, urls[u], urls[u + 1] }); - uniques.add(unq); - } - } - } - } - if (descr != null && urlLink.getRegexReplace() != null) - { - // create link for this URL from description only if regex matches - String[] urls = urlLink.makeUrls(descr, true); - if (urls != null) - { - for (int u = 0; u < urls.length; u += 2) - { - String unq = urls[u] + "|" + urls[u + 1]; - if (!uniques.contains(unq)) - { - result.add(new String[] { target, label, urls[u], urls[u + 1] }); - uniques.add(unq); - } - } - } - } - return result; + return urlSets.values(); } - public void createSequenceAnnotationReport(final StringBuffer tip, + public void createSequenceAnnotationReport(final StringBuilder tip, SequenceI sequence, boolean showDbRefs, boolean showNpFeats, Map minmax) {