You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
(1) |
Apr
(14) |
May
(36) |
Jun
(148) |
Jul
(33) |
Aug
(2) |
Sep
(17) |
Oct
(42) |
Nov
(137) |
Dec
(88) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(89) |
Feb
(80) |
Mar
(217) |
Apr
(76) |
May
(5) |
Jun
(39) |
Jul
(35) |
Aug
(4) |
Sep
(7) |
Oct
(14) |
Nov
(12) |
Dec
(9) |
2011 |
Jan
(6) |
Feb
(4) |
Mar
(11) |
Apr
(55) |
May
(90) |
Jun
(39) |
Jul
(15) |
Aug
(15) |
Sep
(23) |
Oct
(12) |
Nov
(17) |
Dec
(20) |
2012 |
Jan
(22) |
Feb
(63) |
Mar
|
Apr
(1) |
May
(6) |
Jun
(3) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
(3) |
Feb
(6) |
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <rv...@us...> - 2012-02-20 19:35:20
|
Revision: 1075 http://treebase.svn.sourceforge.net/treebase/?rev=1075&view=rev Author: rvos Date: 2012-02-20 19:35:10 +0000 (Mon, 20 Feb 2012) Log Message: ----------- Adding javascript source file for SHA1 password encryption. Added Paths: ----------- trunk/treebase-web/src/main/webapp/scripts/sha1.js Added: trunk/treebase-web/src/main/webapp/scripts/sha1.js =================================================================== --- trunk/treebase-web/src/main/webapp/scripts/sha1.js (rev 0) +++ trunk/treebase-web/src/main/webapp/scripts/sha1.js 2012-02-20 19:35:10 UTC (rev 1075) @@ -0,0 +1,119 @@ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* SHA-1 implementation in JavaScript | (c) Chris Veness 2002-2010 | www.movable-type.co.uk */ +/* - see http://csrc.nist.gov/groups/ST/toolkit/secure_hashing.html */ +/* http://csrc.nist.gov/groups/ST/toolkit/examples.html */ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +var Sha1 = {}; // Sha1 namespace + +/** + * Generates SHA-1 hash of string + * + * @param {String} msg String to be hashed + * @param {Boolean} [utf8encode=true] Encode msg as UTF-8 before generating hash + * @returns {String} Hash of msg as hex character string + */ +Sha1.hash = function(msg, utf8encode) { + utf8encode = (typeof utf8encode == 'undefined') ? true : utf8encode; + + // convert string to UTF-8, as SHA only deals with byte-streams + if (utf8encode) msg = Utf8.encode(msg); + + // constants [§4.2.1] + var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6]; + + // PREPROCESSING + + msg += String.fromCharCode(0x80); // add trailing '1' bit (+ 0's padding) to string [§5.1.1] + + // convert string msg into 512-bit/16-integer blocks arrays of ints [§5.2.1] + var l = msg.length/4 + 2; // length (in 32-bit integers) of msg + ‘1’ + appended length + var N = Math.ceil(l/16); // number of 16-integer-blocks required to hold 'l' ints + var M = new Array(N); + + for (var i=0; i<N; i++) { + M[i] = new Array(16); + for (var j=0; j<16; j++) { // encode 4 chars per integer, big-endian encoding + M[i][j] = (msg.charCodeAt(i*64+j*4)<<24) | (msg.charCodeAt(i*64+j*4+1)<<16) | + (msg.charCodeAt(i*64+j*4+2)<<8) | (msg.charCodeAt(i*64+j*4+3)); + } // note running off the end of msg is ok 'cos bitwise ops on NaN return 0 + } + // add length (in bits) into final pair of 32-bit integers (big-endian) [§5.1.1] + // note: most significant word would be (len-1)*8 >>> 32, but since JS converts + // bitwise-op args to 32 bits, we need to simulate this by arithmetic operators + M[N-1][14] = ((msg.length-1)*8) / Math.pow(2, 32); M[N-1][14] = Math.floor(M[N-1][14]) + M[N-1][15] = ((msg.length-1)*8) & 0xffffffff; + + // set initial hash value [§5.3.1] + var H0 = 0x67452301; + var H1 = 0xefcdab89; + var H2 = 0x98badcfe; + var H3 = 0x10325476; + var H4 = 0xc3d2e1f0; + + // HASH COMPUTATION [§6.1.2] + + var W = new Array(80); var a, b, c, d, e; + for (var i=0; i<N; i++) { + + // 1 - prepare message schedule 'W' + for (var t=0; t<16; t++) W[t] = M[i][t]; + for (var t=16; t<80; t++) W[t] = Sha1.ROTL(W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16], 1); + + // 2 - initialise five working variables a, b, c, d, e with previous hash value + a = H0; b = H1; c = H2; d = H3; e = H4; + + // 3 - main loop + for (var t=0; t<80; t++) { + var s = Math.floor(t/20); // seq for blocks of 'f' functions and 'K' constants + var T = (Sha1.ROTL(a,5) + Sha1.f(s,b,c,d) + e + K[s] + W[t]) & 0xffffffff; + e = d; + d = c; + c = Sha1.ROTL(b, 30); + b = a; + a = T; + } + + // 4 - compute the new intermediate hash value + H0 = (H0+a) & 0xffffffff; // note 'addition modulo 2^32' + H1 = (H1+b) & 0xffffffff; + H2 = (H2+c) & 0xffffffff; + H3 = (H3+d) & 0xffffffff; + H4 = (H4+e) & 0xffffffff; + } + + return Sha1.toHexStr(H0) + Sha1.toHexStr(H1) + + Sha1.toHexStr(H2) + Sha1.toHexStr(H3) + Sha1.toHexStr(H4); +} + +// +// function 'f' [§4.1.1] +// +Sha1.f = function(s, x, y, z) { + switch (s) { + case 0: return (x & y) ^ (~x & z); // Ch() + case 1: return x ^ y ^ z; // Parity() + case 2: return (x & y) ^ (x & z) ^ (y & z); // Maj() + case 3: return x ^ y ^ z; // Parity() + } +} + +// +// rotate left (circular left shift) value x by n positions [§3.2.5] +// +Sha1.ROTL = function(x, n) { + return (x<<n) | (x>>>(32-n)); +} + +// +// hexadecimal representation of a number +// (note toString(16) is implementation-dependant, and +// in IE returns signed numbers when used on full words) +// +Sha1.toHexStr = function(n) { + var s="", v; + for (var i=7; i>=0; i--) { v = (n>>>(i*4)) & 0xf; s += v.toString(16); } + return s; +} + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-20 19:34:37
|
Revision: 1074 http://treebase.svn.sourceforge.net/treebase/?rev=1074&view=rev Author: rvos Date: 2012-02-20 19:34:27 +0000 (Mon, 20 Feb 2012) Log Message: ----------- Adding javascript code for simplified search UI Modified Paths: -------------- trunk/treebase-web/src/main/webapp/scripts/common.js Modified: trunk/treebase-web/src/main/webapp/scripts/common.js =================================================================== --- trunk/treebase-web/src/main/webapp/scripts/common.js 2012-02-17 18:18:14 UTC (rev 1073) +++ trunk/treebase-web/src/main/webapp/scripts/common.js 2012-02-20 19:34:27 UTC (rev 1074) @@ -222,3 +222,52 @@ link.title='expand'; } } +//expands what a user types in the text box into a PhyloWS query +TreeBASE.expandQuery = function () { + var query = $('query').value; + var split = TreeBASE.splitWords(query); + var terms = new Array(); + for ( var i = 0; i < split.length; i++ ) { + var type = TreeBASE.inferType(split[i]); + var index = predicates[type]; + for ( var j = 0; j < index.length; j++ ) { + terms.push( index[j] + '=' + split[i] ); + } + } + var joiner = ' or '; + if ( $('all').checked ) { + joiner = ' and '; + } + $('expanded').value = terms.join(joiner); + return false; +}; + +// splits a string on words (including curies) and quoted phrases +TreeBASE.splitWords = function(query){ + return query.match(/[A-Za-z0-9:]+|"[^"]+"|'[^']+'/g); +}; + +// infers whether a search word is an identifier or a string +TreeBASE.inferType = function(word) { + if ( word.match(/^([A-Z][a-z]*)\d+$/) ) { + return 'id'; + } + else if ( word.match(/^\d+$/) ) { + return 'integer'; + } + else if ( word.match(/^doi:.+$/) ) { + return 'doi'; + } + else if ( word.match(/^pmid:.+$/) ) { + return 'pubmed'; + } + else { + return 'word'; + } +}; + +// redirects to the phylows api +TreeBASE.redirect = function(newLocation){ + window.location = newLocation; + return false; +}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-17 18:18:21
|
Revision: 1073 http://treebase.svn.sourceforge.net/treebase/?rev=1073&view=rev Author: rvos Date: 2012-02-17 18:18:14 +0000 (Fri, 17 Feb 2012) Log Message: ----------- The search controller can now return results for a DOI, for which the PhyloWS predicate is prism.doi Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudySearchController.java Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudySearchController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudySearchController.java 2012-02-17 18:17:16 UTC (rev 1072) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/StudySearchController.java 2012-02-17 18:18:14 UTC (rev 1073) @@ -92,7 +92,8 @@ byCreationDate, byPublicationDate, byReleaseDate, - byLastModifiedDate + byLastModifiedDate, + byDOI } protected ModelAndView onSubmit( @@ -141,7 +142,10 @@ searchType = SearchType.inCitation; } else if (buttonName.equals("abstractKeyword")) { searchType = SearchType.inAbstract; - } else { + } else if (buttonName.equals("doiKeyword")) { + searchType = SearchType.byDOI; + } + else { throw new Error("Unknown search button name '" + buttonName + "'"); } // XXX we now never do an exact match with terms provided through the web app. We can change @@ -222,7 +226,10 @@ results.addAll(doSearch(request,response, SearchType.byPublicationDate, errors, term.getTerm(),exactMatch,relation)); } else if ( index.startsWith("prism.modificationDate") ) { results.addAll(doSearch(request,response, SearchType.byLastModifiedDate, errors, term.getTerm(),exactMatch,relation)); - } else { + } else if ( index.startsWith("prism.doi") ) { + results.addAll(doSearch(request,response,SearchType.byDOI, errors, term.getTerm(), exactMatch,relation)); + } + else { // issue warnings addMessage(request, "Unsupported index: " + index); } @@ -241,7 +248,7 @@ boolean exactMatch, CQLRelation relation) throws InstantiationException, ParseException { String keywordSearchTerm = "%" + searchTerm + "%"; - Collection<Study> matches; + Collection<Study> matches = new HashSet<Study>(); StudyService studyService = getSearchService().getStudyService(); SubmissionService submissionService = getSearchService().getSubmissionService(); @@ -290,6 +297,14 @@ case byCreationDate: matches = findByCreationDate(searchTerm, relation, submissionService); break; + case byDOI: + { + Study result = studyService.findByDOI(searchTerm); + if ( null != result ) { + matches.add(result); + } + break; + } case byJournal: { if ( exactMatch ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-17 18:17:23
|
Revision: 1072 http://treebase.svn.sourceforge.net/treebase/?rev=1072&view=rev Author: rvos Date: 2012-02-17 18:17:16 +0000 (Fri, 17 Feb 2012) Log Message: ----------- We want to be able to find studies by their DOIs. To make this possible, the interfaces for CitationService and StudyService have been expanded with a findByDoi(String doi) method, the idea being that the StudyService will delegate the query to the CitationService, then get the associated study from the returned citation. This is how it has been implemented in the *Impl classes, and the AuxDataTest needed to be expanded with another method stub to satisfy the interface for the inner class that is used there. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/CitationService.java trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/StudyService.java trunk/treebase-core/src/main/java/org/cipres/treebase/service/study/CitationServiceImpl.java trunk/treebase-core/src/main/java/org/cipres/treebase/service/study/StudyServiceImpl.java trunk/treebase-core/src/test/java/org/cipres/treebase/auxdata/AuxDataTest.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/CitationService.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/CitationService.java 2012-02-17 18:13:28 UTC (rev 1071) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/CitationService.java 2012-02-17 18:17:16 UTC (rev 1072) @@ -44,5 +44,12 @@ * @param pCitation */ void replaceCitation(Study pStudy, Citation pCitation); + + /** + * Find the citation with the provided doi + * @param doi + * @return + */ + Citation findByDOI(String doi); } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/StudyService.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/StudyService.java 2012-02-17 18:13:28 UTC (rev 1071) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/study/StudyService.java 2012-02-17 18:17:16 UTC (rev 1072) @@ -204,4 +204,11 @@ * @author mjd 20080813 */ Collection<Study> findByTaxonLabelName(String taxonLabel); + + /** + * Return the study for publication with provided DOI + * @param doi + * @return + */ + Study findByDOI(String doi); } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/service/study/CitationServiceImpl.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/service/study/CitationServiceImpl.java 2012-02-17 18:13:28 UTC (rev 1071) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/service/study/CitationServiceImpl.java 2012-02-17 18:17:16 UTC (rev 1072) @@ -2,6 +2,7 @@ package org.cipres.treebase.service.study; import java.util.Calendar; +import java.util.Collection; import org.cipres.treebase.domain.DomainHome; import org.cipres.treebase.domain.study.Citation; @@ -161,4 +162,18 @@ return Citation.class; } + /* + * (non-Javadoc) + * @see org.cipres.treebase.domain.study.CitationService#findByDOI(java.lang.String) + */ + public Citation findByDOI(String doi) { + Collection<Citation> results = findSomethingByString(Citation.class, "doi", doi); + if ( null != results && ! results.isEmpty() ) { + return results.iterator().next(); + } + else { + return null; + } + } + } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/service/study/StudyServiceImpl.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/service/study/StudyServiceImpl.java 2012-02-17 18:13:28 UTC (rev 1071) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/service/study/StudyServiceImpl.java 2012-02-17 18:17:16 UTC (rev 1072) @@ -19,6 +19,7 @@ import org.cipres.treebase.domain.matrix.Matrix; import org.cipres.treebase.domain.matrix.MatrixHome; import org.cipres.treebase.domain.study.AnalysisService; +import org.cipres.treebase.domain.study.Citation; import org.cipres.treebase.domain.study.CitationService; import org.cipres.treebase.domain.study.Study; import org.cipres.treebase.domain.study.StudyCriteria; @@ -533,4 +534,14 @@ public Collection<Study> findByPublicationDateRange(Date from, Date until) { return getStudyHome().findByPublicationDateRange(from, until); } + + public Study findByDOI(String doi) { + Citation citation = getCitationService().findByDOI(doi); + if ( null != citation ) { + return citation.getStudy(); + } + else { + return null; + } + } } Modified: trunk/treebase-core/src/test/java/org/cipres/treebase/auxdata/AuxDataTest.java =================================================================== --- trunk/treebase-core/src/test/java/org/cipres/treebase/auxdata/AuxDataTest.java 2012-02-17 18:13:28 UTC (rev 1071) +++ trunk/treebase-core/src/test/java/org/cipres/treebase/auxdata/AuxDataTest.java 2012-02-17 18:17:16 UTC (rev 1072) @@ -368,6 +368,11 @@ // TODO Auto-generated method stub return null; } + + public Study findByDOI(String doi) { + // TODO Auto-generated method stub + return null; + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-17 18:13:34
|
Revision: 1071 http://treebase.svn.sourceforge.net/treebase/?rev=1071&view=rev Author: rvos Date: 2012-02-17 18:13:28 +0000 (Fri, 17 Feb 2012) Log Message: ----------- Adding DOI as option in study search pull down menu. Modified Paths: -------------- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyKeywordSearchForm.jsp Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyKeywordSearchForm.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyKeywordSearchForm.jsp 2012-02-16 17:58:08 UTC (rev 1070) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyKeywordSearchForm.jsp 2012-02-17 18:13:28 UTC (rev 1071) @@ -8,6 +8,7 @@ searchOptions.put("abstractKeyword", "Abstract"); searchOptions.put("citationKeyword", "Entire citation"); searchOptions.put("textKeyword", "All text"); + searchOptions.put("doiKeyword", "DOI"); pageContext.setAttribute("searchOptions", searchOptions); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-16 17:58:19
|
Revision: 1070 http://treebase.svn.sourceforge.net/treebase/?rev=1070&view=rev Author: rvos Date: 2012-02-16 17:58:08 +0000 (Thu, 16 Feb 2012) Log Message: ----------- findSomethingByItsDescription expects a bean-like property "treeQuality" (not "quality") to map onto getTreeQuality().getDescription() Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeSearchController.java Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeSearchController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeSearchController.java 2012-02-15 00:53:29 UTC (rev 1069) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeSearchController.java 2012-02-16 17:58:08 UTC (rev 1070) @@ -203,7 +203,7 @@ case byQuality: matches = phyloTreeService - .findSomethingByItsDescription(PhyloTree.class, "quality", searchTerm, true); + .findSomethingByItsDescription(PhyloTree.class, "treeQuality", searchTerm, true); break; case byTitle: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-15 00:53:35
|
Revision: 1069 http://treebase.svn.sourceforge.net/treebase/?rev=1069&view=rev Author: rvos Date: 2012-02-15 00:53:29 +0000 (Wed, 15 Feb 2012) Log Message: ----------- More space around buttons Modified Paths: -------------- trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp Modified: trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp 2012-02-14 22:09:28 UTC (rev 1068) +++ trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp 2012-02-15 00:53:29 UTC (rev 1069) @@ -21,14 +21,11 @@ <li><a href="<c:url value="/contact.html"/>"><fmt:message key="nav.contact"/></a></li> </ul> </div> - <br /> + <br /><br /> <center> - <a href="http://www.mendeley.com/groups/734351/treebase/" title="All publications in TreeBASE on Mendeley"> - <img src="<c:url value="images/mendeley-logo.png"/>" alt="All publications in TreeBASE on Mendeley" /> - </a><br /> - <a href="http://twitter.com/treebase" title="Follow @TreeBASE on Twitter"> - <img src="<c:url value="images/twitter-logo.png"/>" alt="Follow @TreeBASE on twitter" /> - </a> + <a href="http://www.mendeley.com/groups/734351/treebase/" title="All publications in TreeBASE on Mendeley"><img src="<c:url value="images/mendeley-logo.png"/>" alt="All publications in TreeBASE on Mendeley" /></a> + <br /><br /> + <a href="http://twitter.com/treebase" title="Follow @TreeBASE on Twitter"><img src="<c:url value="images/twitter-logo.png"/>" alt="Follow @TreeBASE on twitter" /></a> </center> </div> <img src="<c:url value="images/footer_bg.gif"/>" style="width:100%" alt="" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-14 22:09:34
|
Revision: 1068 http://treebase.svn.sourceforge.net/treebase/?rev=1068&view=rev Author: rvos Date: 2012-02-14 22:09:28 +0000 (Tue, 14 Feb 2012) Log Message: ----------- Made buttons smaller, added line break before them Modified Paths: -------------- trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp trunk/treebase-web/src/main/webapp/images/mendeley-logo.png trunk/treebase-web/src/main/webapp/images/twitter-logo.png Modified: trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp 2012-02-14 21:57:32 UTC (rev 1067) +++ trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp 2012-02-14 22:09:28 UTC (rev 1068) @@ -20,7 +20,8 @@ <li><a href="<c:url value="/journal.html"/>"><fmt:message key="nav.journals"/></a></li> <li><a href="<c:url value="/contact.html"/>"><fmt:message key="nav.contact"/></a></li> </ul> - </div> + </div> + <br /> <center> <a href="http://www.mendeley.com/groups/734351/treebase/" title="All publications in TreeBASE on Mendeley"> <img src="<c:url value="images/mendeley-logo.png"/>" alt="All publications in TreeBASE on Mendeley" /> Modified: trunk/treebase-web/src/main/webapp/images/mendeley-logo.png =================================================================== (Binary files differ) Modified: trunk/treebase-web/src/main/webapp/images/twitter-logo.png =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-14 21:57:38
|
Revision: 1067 http://treebase.svn.sourceforge.net/treebase/?rev=1067&view=rev Author: rvos Date: 2012-02-14 21:57:32 +0000 (Tue, 14 Feb 2012) Log Message: ----------- The mendeley button should probably go before the twitter button. Modified Paths: -------------- trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp Modified: trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp 2012-02-14 21:53:32 UTC (rev 1066) +++ trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp 2012-02-14 21:57:32 UTC (rev 1067) @@ -22,12 +22,12 @@ </ul> </div> <center> + <a href="http://www.mendeley.com/groups/734351/treebase/" title="All publications in TreeBASE on Mendeley"> + <img src="<c:url value="images/mendeley-logo.png"/>" alt="All publications in TreeBASE on Mendeley" /> + </a><br /> <a href="http://twitter.com/treebase" title="Follow @TreeBASE on Twitter"> <img src="<c:url value="images/twitter-logo.png"/>" alt="Follow @TreeBASE on twitter" /> - </a><br /> - <a href="http://www.mendeley.com/groups/734351/treebase/" title="All publications in TreeBASE on Mendeley"> - <img src="<c:url value="images/mendeley-logo.png"/>" alt="All publications in TreeBASE on Mendeley" /> - </a> + </a> </center> </div> <img src="<c:url value="images/footer_bg.gif"/>" style="width:100%" alt="" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-14 21:53:38
|
Revision: 1066 http://treebase.svn.sourceforge.net/treebase/?rev=1066&view=rev Author: rvos Date: 2012-02-14 21:53:32 +0000 (Tue, 14 Feb 2012) Log Message: ----------- This should be more aesthetic... Modified Paths: -------------- trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp Modified: trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp 2012-02-14 21:45:32 UTC (rev 1065) +++ trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp 2012-02-14 21:53:32 UTC (rev 1066) @@ -20,15 +20,15 @@ <li><a href="<c:url value="/journal.html"/>"><fmt:message key="nav.journals"/></a></li> <li><a href="<c:url value="/contact.html"/>"><fmt:message key="nav.contact"/></a></li> </ul> - <center> - <a href="http://twitter.com/treebase" title="Follow @TreeBASE on Twitter"> - <img src="<c:url value="images/twitter-logo.png"/>" alt="Follow @TreeBASE on twitter" /> - </a><br /> - <a href="http://www.mendeley.com/groups/734351/treebase/" title="All publications in TreeBASE on Mendeley"> - <img src="<c:url value="images/mendeley-logo.png"/>" alt="All publications in TreeBASE on Mendeley" /> - </a> - </center> - </div> + </div> + <center> + <a href="http://twitter.com/treebase" title="Follow @TreeBASE on Twitter"> + <img src="<c:url value="images/twitter-logo.png"/>" alt="Follow @TreeBASE on twitter" /> + </a><br /> + <a href="http://www.mendeley.com/groups/734351/treebase/" title="All publications in TreeBASE on Mendeley"> + <img src="<c:url value="images/mendeley-logo.png"/>" alt="All publications in TreeBASE on Mendeley" /> + </a> + </center> </div> <img src="<c:url value="images/footer_bg.gif"/>" style="width:100%" alt="" /> </div> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-14 21:45:39
|
Revision: 1065 http://treebase.svn.sourceforge.net/treebase/?rev=1065&view=rev Author: rvos Date: 2012-02-14 21:45:32 +0000 (Tue, 14 Feb 2012) Log Message: ----------- Sorry, unterminated c:url tag. Fixed now. Modified Paths: -------------- trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp Modified: trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp 2012-02-14 21:31:34 UTC (rev 1064) +++ trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp 2012-02-14 21:45:32 UTC (rev 1065) @@ -22,10 +22,10 @@ </ul> <center> <a href="http://twitter.com/treebase" title="Follow @TreeBASE on Twitter"> - <img src="<c:url value="images/twitter-logo.png" alt="Follow @TreeBASE on twitter"/> + <img src="<c:url value="images/twitter-logo.png"/>" alt="Follow @TreeBASE on twitter" /> </a><br /> <a href="http://www.mendeley.com/groups/734351/treebase/" title="All publications in TreeBASE on Mendeley"> - <img src="<c:url value="images/mendeley-logo.png" alt="All publications in TreeBASE on Mendeley"> + <img src="<c:url value="images/mendeley-logo.png"/>" alt="All publications in TreeBASE on Mendeley" /> </a> </center> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-14 21:31:40
|
Revision: 1064 http://treebase.svn.sourceforge.net/treebase/?rev=1064&view=rev Author: rvos Date: 2012-02-14 21:31:34 +0000 (Tue, 14 Feb 2012) Log Message: ----------- Removed redundant column. Modified Paths: -------------- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/taxonList.jsp Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/taxonList.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/taxonList.jsp 2012-02-14 21:30:07 UTC (rev 1063) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/taxonList.jsp 2012-02-14 21:31:34 UTC (rev 1064) @@ -25,13 +25,6 @@ </display:column> - <display:column property="name" title="Taxon Label" - sortable="true"/> - - - <%-- display:column property="title" title="uBIO Full Name" - sortable="true" style="text-align:center; width:10%"/ --%> - <display:column property="name" title="Taxon Name" sortable="true"/> @@ -59,7 +52,7 @@ <display:footer> <tr> <!-- this id is important, because we might add additional buttons here --> - <td colspan="5" align="center" id="buttonContainer"> + <td colspan="4" align="center" id="buttonContainer"> <!-- insert additional controls here --> </td> </tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-14 21:30:13
|
Revision: 1063 http://treebase.svn.sourceforge.net/treebase/?rev=1063&view=rev Author: rvos Date: 2012-02-14 21:30:07 +0000 (Tue, 14 Feb 2012) Log Message: ----------- Adding line break. Trivial commit. Modified Paths: -------------- trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp Modified: trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp 2012-02-14 21:23:50 UTC (rev 1062) +++ trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp 2012-02-14 21:30:07 UTC (rev 1063) @@ -23,7 +23,7 @@ <center> <a href="http://twitter.com/treebase" title="Follow @TreeBASE on Twitter"> <img src="<c:url value="images/twitter-logo.png" alt="Follow @TreeBASE on twitter"/> - </a> + </a><br /> <a href="http://www.mendeley.com/groups/734351/treebase/" title="All publications in TreeBASE on Mendeley"> <img src="<c:url value="images/mendeley-logo.png" alt="All publications in TreeBASE on Mendeley"> </a> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-14 21:23:56
|
Revision: 1062 http://treebase.svn.sourceforge.net/treebase/?rev=1062&view=rev Author: rvos Date: 2012-02-14 21:23:50 +0000 (Tue, 14 Feb 2012) Log Message: ----------- Adding links to @TreeBASE and @rdmpage's Mendeley group. Modified Paths: -------------- trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp Added Paths: ----------- trunk/treebase-web/src/main/webapp/images/mendeley-logo.png trunk/treebase-web/src/main/webapp/images/twitter-logo.png Modified: trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp 2012-02-14 20:40:34 UTC (rev 1061) +++ trunk/treebase-web/src/main/webapp/common/sidebarLeft.jsp 2012-02-14 21:23:50 UTC (rev 1062) @@ -20,6 +20,14 @@ <li><a href="<c:url value="/journal.html"/>"><fmt:message key="nav.journals"/></a></li> <li><a href="<c:url value="/contact.html"/>"><fmt:message key="nav.contact"/></a></li> </ul> + <center> + <a href="http://twitter.com/treebase" title="Follow @TreeBASE on Twitter"> + <img src="<c:url value="images/twitter-logo.png" alt="Follow @TreeBASE on twitter"/> + </a> + <a href="http://www.mendeley.com/groups/734351/treebase/" title="All publications in TreeBASE on Mendeley"> + <img src="<c:url value="images/mendeley-logo.png" alt="All publications in TreeBASE on Mendeley"> + </a> + </center> </div> </div> <img src="<c:url value="images/footer_bg.gif"/>" style="width:100%" alt="" /> Added: trunk/treebase-web/src/main/webapp/images/mendeley-logo.png =================================================================== (Binary files differ) Property changes on: trunk/treebase-web/src/main/webapp/images/mendeley-logo.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/treebase-web/src/main/webapp/images/twitter-logo.png =================================================================== (Binary files differ) Property changes on: trunk/treebase-web/src/main/webapp/images/twitter-logo.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-14 20:40:41
|
Revision: 1061 http://treebase.svn.sourceforge.net/treebase/?rev=1061&view=rev Author: rvos Date: 2012-02-14 20:40:34 +0000 (Tue, 14 Feb 2012) Log Message: ----------- The colspan number should match the number of preceding display:column elements, otherwise an unsightly misalignment between the "check all/uncheck/invert" buttons and the rest of the table occurs. Modified Paths: -------------- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyList.jsp Modified: trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyList.jsp =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyList.jsp 2012-02-06 21:54:45 UTC (rev 1060) +++ trunk/treebase-web/src/main/webapp/WEB-INF/pages/search/studyList.jsp 2012-02-14 20:40:34 UTC (rev 1061) @@ -101,7 +101,8 @@ <display:footer> <tr> <!-- this id is important, because we might add additional buttons here --> - <td colspan="7" align="center" id="buttonContainer"> + <!-- also, the colspan number should match the number of preceding display:column elements --> + <td colspan="9" align="center" id="buttonContainer"> <!-- insert additional controls here --> </td> </tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-06 21:54:51
|
Revision: 1060 http://treebase.svn.sourceforge.net/treebase/?rev=1060&view=rev Author: rvos Date: 2012-02-06 21:54:45 +0000 (Mon, 06 Feb 2012) Log Message: ----------- Adding skos:changeNote to specify when output was generated, now setting @about to '#' + TreebaseIDString.toString() Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlDocumentWriter.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlDocumentWriter.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlDocumentWriter.java 2012-02-06 19:59:50 UTC (rev 1059) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlDocumentWriter.java 2012-02-06 21:54:45 UTC (rev 1060) @@ -1,5 +1,6 @@ package org.cipres.treebase.domain.nexus.nexml; +import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -77,7 +78,10 @@ */ public Document fromTreeBaseToXml(Study pStudy) { attachTreeBaseID(getDocument(), pStudy,Study.class); + Date d = new Date(); getDocument().addAnnotationValue("skos:historyNote", Constants.SKOSURI, "Mapped from TreeBASE schema using "+this.toString()+" $Rev$"); + getDocument().addAnnotationValue("skos:changeNote", Constants.SKOSURI, "Generated on "+d.toString()); + getDocument().setAbout("#" + pStudy.getTreebaseIDString().toString()); NexmlOTUWriter noc = new NexmlOTUWriter(getStudy(),getTaxonLabelHome(),getDocument()); for ( TaxonLabelSet taxonLabelSet : pStudy.getTaxonLabelSets() ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-06 20:00:00
|
Revision: 1059 http://treebase.svn.sourceforge.net/treebase/?rev=1059&view=rev Author: rvos Date: 2012-02-06 19:59:50 +0000 (Mon, 06 Feb 2012) Log Message: ----------- Removed unused getToken() method from private static class Token. This to suppress a warning. Trivial commit. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/RangeExpression.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/RangeExpression.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/RangeExpression.java 2012-02-06 19:56:11 UTC (rev 1058) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/RangeExpression.java 2012-02-06 19:59:50 UTC (rev 1059) @@ -203,10 +203,6 @@ type = t; } - public String getToken() { - return token; - } - public Integer getInteger() { return type == tokenType.Num ? new Integer(token) : null; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-06 19:56:22
|
Revision: 1058 http://treebase.svn.sourceforge.net/treebase/?rev=1058&view=rev Author: rvos Date: 2012-02-06 19:56:11 +0000 (Mon, 06 Feb 2012) Log Message: ----------- Added <?> parameterization to generics, removed unused imports. This to suppress some warnings. Trivial commit. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/TreebaseUtil.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/TreebaseUtil.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/TreebaseUtil.java 2012-02-06 19:48:09 UTC (rev 1057) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/TreebaseUtil.java 2012-02-06 19:56:11 UTC (rev 1058) @@ -3,14 +3,8 @@ import java.io.BufferedReader; import java.io.File; -import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CodingErrorAction; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Arrays; @@ -18,7 +12,6 @@ import java.util.Collection; import java.util.Date; import java.util.Iterator; -import java.util.Properties; import java.util.TimeZone; import javax.naming.InitialContext; @@ -244,14 +237,14 @@ * @param pAllElement * @return */ - public static String printElement(Collection pCollection, boolean pAllElement) { + public static String printElement(Collection<?> pCollection, boolean pAllElement) { int size = pCollection.size(); if (!pAllElement && size > 10) { size = 10; } StringBuffer buf = new StringBuffer(); - Iterator iter = pCollection.iterator(); + Iterator<?> iter = pCollection.iterator(); for (int i = 0; i < size; i++) { buf.append(i).append("= ").append(iter.next()).append(ANEMPTYSPACE); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-06 19:48:18
|
Revision: 1057 http://treebase.svn.sourceforge.net/treebase/?rev=1057&view=rev Author: rvos Date: 2012-02-06 19:48:09 +0000 (Mon, 06 Feb 2012) Log Message: ----------- Adding ID prefix ("Row") for MatrixRows Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/TreebaseIDString.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/TreebaseIDString.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/TreebaseIDString.java 2012-02-05 19:24:29 UTC (rev 1056) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/TreebaseIDString.java 2012-02-06 19:48:09 UTC (rev 1057) @@ -8,6 +8,7 @@ import org.cipres.treebase.domain.matrix.DiscreteMatrixElement; import org.cipres.treebase.domain.matrix.Matrix; import org.cipres.treebase.domain.matrix.MatrixColumn; +import org.cipres.treebase.domain.matrix.MatrixRow; import org.cipres.treebase.domain.matrix.PhyloChar; import org.cipres.treebase.domain.study.Algorithm; import org.cipres.treebase.domain.study.Analysis; @@ -49,6 +50,7 @@ val.put(Matrix.class, "M"); val.put(PhyloChar.class, "C"); val.put(MatrixColumn.class, "Col"); + val.put(MatrixRow.class, "Row"); val.put(DiscreteCharState.class, "Dcs"); val.put(DiscreteMatrixElement.class, "Dme"); val.put(PhyloTree.class, "Tr"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-05 19:24:35
|
Revision: 1056 http://treebase.svn.sourceforge.net/treebase/?rev=1056&view=rev Author: rvos Date: 2012-02-05 19:24:29 +0000 (Sun, 05 Feb 2012) Log Message: ----------- Now attaches MatrixRow IDs to <row> elements Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-02-05 15:23:09 UTC (rev 1055) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-02-05 19:24:29 UTC (rev 1056) @@ -353,10 +353,11 @@ } } xmlMatrix.setSeq(seq,xmlOTU); + org.nexml.model.MatrixRow<CharacterState> xmlRow = xmlMatrix.getRowObject(xmlOTU); + attachTreeBaseID(xmlRow, tbRow, MatrixRow.class); // this often only happens once, when the row has only 1 segment - for ( RowSegment tbSegment : tbSegments ) { - org.nexml.model.MatrixRow<CharacterState> xmlRow = xmlMatrix.getRowObject(xmlOTU); + for ( RowSegment tbSegment : tbSegments ) { Annotation xmlSegment = xmlRow.addAnnotationValue("tb:rowSegment", Constants.TBTermsURI, new String()); xmlSegment.addAnnotationValue("tb:startIndex", Constants.TBTermsURI, tbSegment.getStartIndex()); xmlSegment.addAnnotationValue("tb:endIndex", Constants.TBTermsURI, tbSegment.getEndIndex()); @@ -427,8 +428,9 @@ xmlMatrix.setSeq(seq,xmlOTU); } Set<RowSegment> tbSegments = tbRow.getSegmentsReadOnly(); - for ( RowSegment tbSegment : tbSegments ) { - org.nexml.model.MatrixRow<Double> xmlRow = xmlMatrix.getRowObject(xmlOTU); + org.nexml.model.MatrixRow<Double> xmlRow = xmlMatrix.getRowObject(xmlOTU); + attachTreeBaseID(xmlRow, tbRow, MatrixRow.class); + for ( RowSegment tbSegment : tbSegments ) { Annotation xmlSegment = xmlRow.addAnnotationValue("tb:rowSegment", Constants.TBTermsURI, new String()); xmlSegment.addAnnotationValue("tb:startIndex", Constants.TBTermsURI, tbSegment.getStartIndex()); xmlSegment.addAnnotationValue("tb:endIndex", Constants.TBTermsURI, tbSegment.getEndIndex()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-05 15:23:16
|
Revision: 1055 http://treebase.svn.sourceforge.net/treebase/?rev=1055&view=rev Author: rvos Date: 2012-02-05 15:23:09 +0000 (Sun, 05 Feb 2012) Log Message: ----------- Now uses org.nexml.model.MatrixRow objects to attach Darwin Core annotations Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-02-04 09:26:30 UTC (rev 1054) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-02-05 15:23:09 UTC (rev 1055) @@ -30,6 +30,7 @@ import org.cipres.treebase.domain.taxon.SpecimenLabel; import org.cipres.treebase.domain.taxon.TaxonLabelHome; import org.nexml.model.Annotatable; +import org.nexml.model.Annotation; import org.nexml.model.CategoricalMatrix; import org.nexml.model.CharacterState; import org.nexml.model.CharacterStateSet; @@ -340,6 +341,8 @@ } else { String seq = tbRow.getNormalizedSymbolString(); + + // In NeXML, 'standard' data needs to be space-separated if ( tbMatrix.getDataType().getDescription().equals(MatrixDataType.MATRIX_DATATYPE_STANDARD) ) { StringBuilder sb = new StringBuilder(); for ( int i = 0; i < seq.length(); i++ ) { @@ -348,19 +351,23 @@ sb.append(' '); } } - } + } xmlMatrix.setSeq(seq,xmlOTU); // this often only happens once, when the row has only 1 segment for ( RowSegment tbSegment : tbSegments ) { - copyDarwinCoreAnnotations(tbSegment, xmlOTU); + org.nexml.model.MatrixRow<CharacterState> xmlRow = xmlMatrix.getRowObject(xmlOTU); + Annotation xmlSegment = xmlRow.addAnnotationValue("tb:rowSegment", Constants.TBTermsURI, new String()); + xmlSegment.addAnnotationValue("tb:startIndex", Constants.TBTermsURI, tbSegment.getStartIndex()); + xmlSegment.addAnnotationValue("tb:endIndex", Constants.TBTermsURI, tbSegment.getEndIndex()); + copyDarwinCoreAnnotations(tbSegment, xmlSegment); } } } } /** - * + * XXX this never executes, we always make compact matrices - RAV 5/2/2012 * @param xmlMatrix * @param tbMatrix * @param xmlCharacterList @@ -421,7 +428,11 @@ } Set<RowSegment> tbSegments = tbRow.getSegmentsReadOnly(); for ( RowSegment tbSegment : tbSegments ) { - copyDarwinCoreAnnotations(tbSegment,xmlOTU); + org.nexml.model.MatrixRow<Double> xmlRow = xmlMatrix.getRowObject(xmlOTU); + Annotation xmlSegment = xmlRow.addAnnotationValue("tb:rowSegment", Constants.TBTermsURI, new String()); + xmlSegment.addAnnotationValue("tb:startIndex", Constants.TBTermsURI, tbSegment.getStartIndex()); + xmlSegment.addAnnotationValue("tb:endIndex", Constants.TBTermsURI, tbSegment.getEndIndex()); + copyDarwinCoreAnnotations(tbSegment,xmlSegment); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-04 09:26:36
|
Revision: 1054 http://treebase.svn.sourceforge.net/treebase/?rev=1054&view=rev Author: rvos Date: 2012-02-04 09:26:30 +0000 (Sat, 04 Feb 2012) Log Message: ----------- Setting matrix to always compact Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-02-04 00:23:33 UTC (rev 1053) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-02-04 09:26:30 UTC (rev 1054) @@ -43,8 +43,8 @@ public class NexmlMatrixWriter extends NexmlObjectConverter { - private static final int MAX_GRANULAR_NCHAR = 1000; - private static final int MAX_GRANULAR_NTAX = 30; + private static final int MAX_GRANULAR_NCHAR = 0; + private static final int MAX_GRANULAR_NTAX = 0; /** * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-04 00:23:39
|
Revision: 1053 http://treebase.svn.sourceforge.net/treebase/?rev=1053&view=rev Author: rvos Date: 2012-02-04 00:23:33 +0000 (Sat, 04 Feb 2012) Log Message: ----------- now uses same purl as in owl file for treebase terms Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/Constants.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/Constants.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/Constants.java 2012-02-04 00:10:14 UTC (rev 1052) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/Constants.java 2012-02-04 00:23:33 UTC (rev 1053) @@ -6,7 +6,7 @@ public class Constants { public static final int MIN_INTERESTING_PHYLOCHAR_ID = 7; public static final URI DwCURI = URI.create("http://rs.tdwg.org/dwc/terms/"); - public static final URI TBTermsURI = URI.create("http://treebase.org/terms#"); + public static final URI TBTermsURI = URI.create("http://purl.org/phylo/treebase/2.0/terms#"); public static final URI DCTermsURI = URI.create("http://purl.org/dc/terms/"); public static final URI DCURI = URI.create("http://purl.org/dc/elements/1.1/"); public static final URI PrismURI = URI.create("http://prismstandard.org/namespaces/1.2/basic/"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-04 00:10:20
|
Revision: 1052 http://treebase.svn.sourceforge.net/treebase/?rev=1052&view=rev Author: rvos Date: 2012-02-04 00:10:14 +0000 (Sat, 04 Feb 2012) Log Message: ----------- Now checks whether Darwin Core semantic annotation values are empty strings (which, it appears, they might be). Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-02-03 23:47:25 UTC (rev 1051) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-02-04 00:10:14 UTC (rev 1052) @@ -8,6 +8,7 @@ import java.util.Set; import org.cipres.treebase.Constants; +import org.cipres.treebase.TreebaseUtil; import org.cipres.treebase.domain.matrix.CharSet; import org.cipres.treebase.domain.matrix.CharacterMatrix; import org.cipres.treebase.domain.matrix.ColumnRange; @@ -451,7 +452,7 @@ for ( String predicate : predicateToObjectMap.keySet() ) { String objectString = predicateToObjectMap.get(predicate); - if ( null != objectString ) { + if ( ! TreebaseUtil.isEmpty(objectString) ) { xmlAnnotatable.addAnnotationValue(predicate, Constants.DwCURI, objectString); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2012-02-03 23:47:32
|
Revision: 1051 http://treebase.svn.sourceforge.net/treebase/?rev=1051&view=rev Author: rvos Date: 2012-02-03 23:47:25 +0000 (Fri, 03 Feb 2012) Log Message: ----------- *** This commit is supposed to make matrix generation more efficient. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-02-03 23:10:39 UTC (rev 1050) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixWriter.java 2012-02-03 23:47:25 UTC (rev 1051) @@ -26,6 +26,7 @@ import org.cipres.treebase.domain.matrix.StandardMatrix; import org.cipres.treebase.domain.matrix.StateSet; import org.cipres.treebase.domain.study.Study; +import org.cipres.treebase.domain.taxon.SpecimenLabel; import org.cipres.treebase.domain.taxon.TaxonLabelHome; import org.nexml.model.Annotatable; import org.nexml.model.CategoricalMatrix; @@ -51,22 +52,85 @@ */ public NexmlMatrixWriter(Study study,TaxonLabelHome taxonLabelHome,Document document) { super(study,taxonLabelHome,document); + } + + /** + * This is the method that is called by the NexmlDocumentWriter when turning + * a study or data set into a NeXML document + * @param tbMatrix + * @param xmlOTUs + * @return + * XXX doesn't handle the following data types: + * public static final String MATRIX_DATATYPE_NUCLEOTIDE = "Nucleotide"; + * public static final String MATRIX_DATATYPE_DISTANCE = "Distance"; + * public static final String MATRIX_DATATYPE_MIXED = "Mixed"; + */ + public org.nexml.model.Matrix<?> fromTreeBaseToXml(CharacterMatrix tbMatrix,OTUs xmlOTUs) { + + // here we decide what subtype of character matrix to instantiate + org.nexml.model.Matrix<?> xmlMatrix = createMatrix(tbMatrix, xmlOTUs); + + // here we create column/character sets + createCharacterSets(tbMatrix, xmlMatrix); + + return xmlMatrix; + } + + + + /** + * + * @param tbMatrix + * @param xmlOTUs + * @return + */ + private org.nexml.model.Matrix<?> createMatrix(CharacterMatrix tbMatrix, OTUs xmlOTUs) { + + // here we decide what (super-)type to instantiate: discrete or continuous + if ( tbMatrix instanceof DiscreteMatrix ) { + org.nexml.model.Matrix<CharacterState> xmlDiscreteMatrix = null; + + // 'standard' data is treated separately because we don't have an alphabet for it + if ( tbMatrix.getDataType().getDescription().equals(MatrixDataType.MATRIX_DATATYPE_STANDARD) ) { + + // standard categorical + xmlDiscreteMatrix = createStandardNexmlMatrix((StandardMatrix) tbMatrix,xmlOTUs); + } + else { + + // molecular + xmlDiscreteMatrix = createMolecularNexmlMatrix((DiscreteMatrix) tbMatrix,xmlOTUs); + } + populateDiscreteNexmlMatrix(xmlDiscreteMatrix,(DiscreteMatrix)tbMatrix); + return xmlDiscreteMatrix; + } + else if ( tbMatrix instanceof ContinuousMatrix ) { + + // continuous + org.nexml.model.ContinuousMatrix xmlContinuousMatrix = createContinuousNexmlMatrix((ContinuousMatrix) tbMatrix,xmlOTUs); + populateContinuousNexmlMatrix(xmlContinuousMatrix,(ContinuousMatrix)tbMatrix); + return xmlContinuousMatrix; + } + return null; } /** * Creates and populates characters (i.e. columns) with their annotations, - * and state sets, with their annotations + * and state sets, with their annotations. For standard data (including + * those matrices that are actually mostly molecular) we flatten the + * (fictional, but modeled) stateset mapping of all state symbols, plus + * missing ('?') and gap ('-'). * * @param tbMatrix * @return an xml matrix with empty rows */ - private CategoricalMatrix fromTreeBaseToXml(StandardMatrix tbMatrix,OTUs xmlOTUs) { + private CategoricalMatrix createStandardNexmlMatrix(StandardMatrix tbMatrix,OTUs xmlOTUs) { if ( null == xmlOTUs ) { xmlOTUs = getOTUsById(tbMatrix.getTaxa().getId()); } CategoricalMatrix xmlMatrix = getDocument().createCategoricalMatrix(xmlOTUs); - setMatrixAttributes(xmlMatrix,tbMatrix); + copyMatrixAttributes(tbMatrix,xmlMatrix); // first flatten the two-dimensional list into a map, we will always only create a single state set List<List<DiscreteCharState>> tbStateLabels = tbMatrix.getStateLabels(); @@ -94,6 +158,7 @@ } } + // the missing symbol ("?") includes all others, including gap ("-") UncertainCharacterState gap = xmlStateSet.createUncertainCharacterState("-", new HashSet<CharacterState>()); gap.setLabel("-"); xmlMissingStates.add(gap); @@ -105,32 +170,13 @@ for ( int i = 0; i < tbColumns.size(); i++ ) { MatrixColumn tbColumn = tbColumns.get(i); org.nexml.model.Character xmlCharacter = xmlMatrix.createCharacter(xmlStateSet); - setCharacterAttributes(tbColumn, xmlCharacter); + copyCharacterAttributes(tbColumn, xmlCharacter); } return xmlMatrix; } - - private void setCharacterAttributes(MatrixColumn tbColumn,org.nexml.model.Character xmlCharacter) { - PhyloChar tbCharacter = tbColumn.getCharacter(); - if ( null != tbCharacter.getDescription() ) { - xmlCharacter.setLabel(tbCharacter.getLabel()); - } - attachTreeBaseID((Annotatable)xmlCharacter,tbColumn,MatrixColumn.class); - } - - private void setMatrixAttributes(org.nexml.model.Matrix<?> xmlMatrix,CharacterMatrix tbMatrix) { - // attach matrix identifiers - attachTreeBaseID((Annotatable)xmlMatrix, tbMatrix,Matrix.class); - String tb1MatrixID = tbMatrix.getTB1MatrixID(); - if ( null != tb1MatrixID ) { - ((Annotatable)xmlMatrix).addAnnotationValue("tb:identifier.matrix.tb1", Constants.TBTermsURI, tb1MatrixID); - } - - xmlMatrix.addAnnotationValue("skos:historyNote", Constants.SKOSURI, "Mapped from TreeBASE schema using "+this.toString()+" $Rev$"); - xmlMatrix.setBaseURI(mMatrixBaseURI); - xmlMatrix.setLabel(tbMatrix.getLabel()); - } + + /** * Creates and populates characters (i.e. columns) with their annotations, * and state sets, with their annotations @@ -138,7 +184,7 @@ * @param tbMatrix * @return an xml matrix with empty rows */ - private MolecularMatrix fromTreeBaseToXml(DiscreteMatrix tbMatrix,OTUs xmlOTUs) { + private MolecularMatrix createMolecularNexmlMatrix(DiscreteMatrix tbMatrix,OTUs xmlOTUs) { if ( null == xmlOTUs ) { xmlOTUs = getOTUsById(tbMatrix.getTaxa().getId()); } @@ -146,7 +192,7 @@ MolecularMatrix xmlMatrix = null; CharacterStateSet xmlStateSet = null; - // create the matrix and constant state set + // create the matrix and constant (IUPAC) state set if ( tbDataType.equals(MatrixDataType.MATRIX_DATATYPE_DNA) ) { xmlMatrix = getDocument().createMolecularMatrix(xmlOTUs, MolecularMatrix.DNA); xmlStateSet = ((MolecularMatrix)xmlMatrix).getDNACharacterStateSet(); @@ -159,7 +205,7 @@ xmlMatrix = getDocument().createMolecularMatrix(xmlOTUs, MolecularMatrix.Protein); xmlStateSet = ((MolecularMatrix)xmlMatrix).getProteinCharacterStateSet(); } - setMatrixAttributes(xmlMatrix,tbMatrix); + copyMatrixAttributes(tbMatrix,xmlMatrix); // lookup the equivalent state in tb and attach identifiers for(StateSet tbStateSet : tbMatrix.getStateSets() ) { @@ -176,7 +222,7 @@ // create columns and attach identifiers for ( MatrixColumn tbColumn : tbMatrix.getColumnsReadOnly() ) { org.nexml.model.Character xmlCharacter = xmlMatrix.createCharacter(xmlStateSet); - setCharacterAttributes(tbColumn, xmlCharacter); + copyCharacterAttributes(tbColumn, xmlCharacter); } return xmlMatrix; } @@ -188,16 +234,16 @@ * @param tbMatrix * @return an xml matrix with empty rows */ - private org.nexml.model.ContinuousMatrix fromTreeBaseToXml(ContinuousMatrix tbMatrix,OTUs xmlOTUs) { + private org.nexml.model.ContinuousMatrix createContinuousNexmlMatrix(ContinuousMatrix tbMatrix,OTUs xmlOTUs) { if ( null == xmlOTUs ) { xmlOTUs = getOTUsById(tbMatrix.getTaxa().getId()); } org.nexml.model.ContinuousMatrix xmlMatrix = getDocument().createContinuousMatrix(xmlOTUs); - setMatrixAttributes(xmlMatrix,tbMatrix); + copyMatrixAttributes(tbMatrix,xmlMatrix); for ( MatrixColumn tbColumn : tbMatrix.getColumnsReadOnly() ) { org.nexml.model.Character xmlCharacter = xmlMatrix.createCharacter(); - setCharacterAttributes(tbColumn, xmlCharacter); + copyCharacterAttributes(tbColumn, xmlCharacter); //coerce the tbMatrix into a character matrix to get its character sets CharacterMatrix tbCharacterMatrix = (CharacterMatrix)tbMatrix; @@ -225,35 +271,18 @@ nexSubset.addThing(nexCharacters.get(i)); } } - } - + } } return xmlMatrix; } - -// XXX doesn't handle the following data types: -// public static final String MATRIX_DATATYPE_NUCLEOTIDE = "Nucleotide"; -// public static final String MATRIX_DATATYPE_DISTANCE = "Distance"; -// public static final String MATRIX_DATATYPE_MIXED = "Mixed"; - @SuppressWarnings("unchecked") - public org.nexml.model.Matrix<?> fromTreeBaseToXml(CharacterMatrix tbMatrix,OTUs xmlOTUs) { - org.nexml.model.Matrix<?> xmlMatrix = null; - if ( tbMatrix instanceof DiscreteMatrix ) { - if ( tbMatrix.getDataType().getDescription().equals(MatrixDataType.MATRIX_DATATYPE_STANDARD) ) { - xmlMatrix = fromTreeBaseToXml((StandardMatrix) tbMatrix,xmlOTUs); - } - else { - xmlMatrix = fromTreeBaseToXml((DiscreteMatrix) tbMatrix,xmlOTUs); - } - populateXmlMatrix((org.nexml.model.Matrix<CharacterState>)xmlMatrix,(DiscreteMatrix)tbMatrix); - } - else if ( tbMatrix instanceof ContinuousMatrix ) { - xmlMatrix = fromTreeBaseToXml((ContinuousMatrix) tbMatrix,xmlOTUs); - populateXmlMatrix((org.nexml.model.ContinuousMatrix)xmlMatrix,(ContinuousMatrix)tbMatrix); - } - + /** + * + * @param tbMatrix + * @param xmlMatrix + */ + private void createCharacterSets(CharacterMatrix tbMatrix, org.nexml.model.Matrix<?> xmlMatrix) { // here we copy the character sets for all matrix types Set<CharSet> tbCharSets = tbMatrix.getCharSets(); for ( CharSet tbCharSet : tbCharSets ) { @@ -270,25 +299,24 @@ int tbInc = 1; // need to do this to prevent nullpointerexceptions - if ( null != tbColumnRange.getRepeatInterval()) { - tbInc = tbColumnRange.getRepeatInterval(); + Integer tbRepeatInterval = tbColumnRange.getRepeatInterval(); + if ( null != tbRepeatInterval ) { + tbInc = tbRepeatInterval; } // create the equivalent nexml character set - Subset nexSubset = xmlMatrix.createSubset(tbCharSet.getLabel()); + Subset xmlSubset = xmlMatrix.createSubset(tbCharSet.getLabel()); // assign character objects to the subset. Here we get the full list - List<org.nexml.model.Character> nexCharacters = xmlMatrix.getCharacters(); + List<org.nexml.model.Character> xmlCharacters = xmlMatrix.getCharacters(); // now we iterate over the coordinates and assign the nexml characters to the set for ( int i = tbStart; i <= tbStop; i += tbInc ) { - nexSubset.addThing(nexCharacters.get(i)); + xmlSubset.addThing(xmlCharacters.get(i)); } } } - - return xmlMatrix; - } + } /** * @@ -297,135 +325,17 @@ * @param xmlOTUs * @param stateSet */ - private void populateXmlMatrix( - org.nexml.model.Matrix<CharacterState> xmlMatrix, - DiscreteMatrix tbMatrix) { + private void populateDiscreteNexmlMatrix(org.nexml.model.Matrix<CharacterState> xmlMatrix, DiscreteMatrix tbMatrix) { + OTUs xmlOTUs = xmlMatrix.getOTUs(); - List<org.nexml.model.Character> characterList = xmlMatrix.getCharacters(); + List<org.nexml.model.Character> xmlCharacters = xmlMatrix.getCharacters(); + + // iterates over all matrix rows, i.e. ntax times for ( MatrixRow tbRow : tbMatrix.getRowsReadOnly() ) { Set<RowSegment> tbSegments = tbRow.getSegmentsReadOnly(); OTU xmlOTU = getOTUById(xmlOTUs, tbRow.getTaxonLabel().getId()); - int charIndex = 0; - if ( characterList.size() <= MAX_GRANULAR_NCHAR && xmlOTUs.getAllOTUs().size() <= MAX_GRANULAR_NTAX ) { - for ( MatrixColumn tbColumn : ((CharacterMatrix)tbMatrix).getColumns() ) { - String seq = tbRow.getNormalizedSymbolString(); - xmlMatrix.setSeq(seq, xmlOTU); - org.nexml.model.Character xmlCharacter = characterList.get(charIndex); - MatrixCell<CharacterState> xmlCell = xmlMatrix.getCell(xmlOTU, xmlCharacter); - - attachTreeBaseID ((Annotatable) xmlCell, tbColumn , DiscreteMatrixElement.class); - - //The following is commented out as tbRow.getElements() does not work directly and crashes the loop. - //The above for loop fixes this issue. - /* - for ( MatrixElement tbCell : tbRow.getElements() ) { - org.nexml.model.Character xmlCharacter = characterList.get(charIndex); - MatrixCell<CharacterState> xmlCell = xmlMatrix.getCell(xmlOTU, xmlCharacter); - DiscreteCharState tbState = ((DiscreteMatrixElement)tbCell).getCharState(); - String tbSymbolString = ( null == tbState ) ? "?" : tbState.getSymbol().toString(); - CharacterState xmlState = xmlCharacter.getCharacterStateSet().lookupCharacterStateBySymbol(tbSymbolString); - xmlCell.setValue(xmlState); - attachTreeBaseID((Annotatable)xmlCell,tbCell,DiscreteMatrixElement.class); - */ - - for ( RowSegment tbSegment : tbSegments ) { - if ( tbSegment.getStartIndex() <= charIndex && charIndex <= tbSegment.getEndIndex() ) { - //declare variables for row-segment annotations - String title = tbSegment.getTitle(); - String institutionCode = tbSegment.getSpecimenLabel().getInstAcronym(); - String collectionCode = tbSegment.getSpecimenLabel().getCollectionCode(); - String catalogNumber = tbSegment.getSpecimenLabel().getCatalogNumber(); - String accessionNumber = tbSegment.getSpecimenLabel().getGenBankAccession(); - String otherAccessionNumber = tbSegment.getSpecimenLabel().getOtherAccession(); - String dateSampled = tbSegment.getSpecimenLabel().getSampleDateString(); - String scientificName = tbSegment.getSpecimenTaxonLabelAsString(); - String collector = tbSegment.getSpecimenLabel().getCollector(); - Double latitude = tbSegment.getSpecimenLabel().getLatitude(); - Double longitude = tbSegment.getSpecimenLabel().getLongitude(); - Double elevation = tbSegment.getSpecimenLabel().getElevation(); - String country = tbSegment.getSpecimenLabel().getCountry(); - String state = tbSegment.getSpecimenLabel().getState(); - String locality = tbSegment.getSpecimenLabel().getLocality(); - String notes = tbSegment.getSpecimenLabel().getNotes(); - - //if the value is not null, output the xmlOTU annotation. - //DwC refers to the Darwin Core term vocabulary for the associated annotation - if (null != title){ - //output name identifying the data set from which the record was derived - ((Annotatable)xmlCell).addAnnotationValue("DwC:datasetName", Constants.DwCURI, title); - } - if ( null != institutionCode ) { - //output name or acronym of institution that has custody of information referred to in record - ((Annotatable)xmlCell).addAnnotationValue("DwC:institutionCode", Constants.DwCURI, institutionCode); - } - if ( null != collectionCode ) { - //output name or code that identifies collection or data set from which record was derived - ((Annotatable)xmlCell).addAnnotationValue ("DwC:collectionCode", Constants.DwCURI, collectionCode); - } - if ( null != catalogNumber ){ - //output unique (usually) identifier for the record within data set or collection - ((Annotatable)xmlCell).addAnnotationValue("DwC:catalogNumber", Constants.DwCURI, catalogNumber); - } - if ( null != accessionNumber) { - //output a list of genetic sequence information associated with occurrence - ((Annotatable)xmlCell).addAnnotationValue("DwC:associatedSequences", Constants.DwCURI, accessionNumber); - } - if ( null != otherAccessionNumber ) { - //list of previous or alternate fully catalog numbers (i.e. Genbank) or human-used identifiers - ((Annotatable)xmlCell).addAnnotationValue("DwC:otherCatalogNumbers", Constants.DwCURI, otherAccessionNumber); - } - if ( null != dateSampled ) { - //output date sampled in ISO 8601 format - ((Annotatable)xmlCell).addAnnotationValue("DwC:eventDate", Constants.DwCURI, dateSampled); - } - if ( null != scientificName ) { - //output full scientific name - ((Annotatable)xmlCell).addAnnotationValue("DwC:scientificName", Constants.DwCURI, scientificName); - } - if ( null != collector ) { - //output names of people associated with recording of original occurrence - ((Annotatable)xmlCell).addAnnotationValue("DwC:recordedBy", Constants.DwCURI, collector); - } - if ( null != latitude ) { - //output geographic latitude in decimal degrees using geodeticDatum spatial reference system - ((Annotatable)xmlCell).addAnnotationValue("DwC:decimalLatitude", Constants.DwCURI, latitude); - } - if ( null != longitude ) { - //output geographic longitude in decimal degrees using geodeticDatum spatial reference system - ((Annotatable)xmlCell).addAnnotationValue("DwC:decimalLongitude", Constants.DwCURI, longitude); - } - if ( null != elevation ) { - //there are two different Darwin Core terms for elevation depending on elevation value - //outputs geographic elevation of sample - if ( elevation >= 0) { - //above local surface in meters - ((Annotatable)xmlCell).addAnnotationValue("DwC:verbatimElevation", Constants.DwCURI, elevation); - } - else { - //below local surface in meters - ((Annotatable)xmlCell).addAnnotationValue("DwC:verbatimDepth", Constants.DwCURI, elevation); - } - } - if ( null != country ) { - //output country in which location occurs - ((Annotatable)xmlCell).addAnnotationValue("DwC:country", Constants.DwCURI, country); - } - if ( null != state ) { - //output name of next smaller administrative region than country (i.e. state, province, region) - ((Annotatable)xmlCell).addAnnotationValue ("DwC:stateProvince", Constants.DwCURI, state); - } - if ( null != locality) { - //output brief description of sample location - ((Annotatable)xmlCell).addAnnotationValue("DwC:locality", Constants.DwCURI, locality); - } - if ( null != notes ) { - //output any additional information about specimen - ((Annotatable)xmlCell).addAnnotationValue("DwC:occurenceRemarks", Constants.DwCURI, notes); - } - } - } - charIndex++; - } + if ( xmlCharacters.size() <= MAX_GRANULAR_NCHAR && xmlOTUs.getAllOTUs().size() <= MAX_GRANULAR_NTAX ) { + populateDiscreteVerboseNexmlMatrix(xmlMatrix,tbMatrix,xmlCharacters,tbRow,tbSegments,xmlOTU); } else { String seq = tbRow.getNormalizedSymbolString(); @@ -439,102 +349,49 @@ } } xmlMatrix.setSeq(seq,xmlOTU); + + // this often only happens once, when the row has only 1 segment + for ( RowSegment tbSegment : tbSegments ) { + copyDarwinCoreAnnotations(tbSegment, xmlOTU); + } } - for ( RowSegment tbSegment : tbSegments ) { - //declare variables for row-segment annotations - String title = tbSegment.getTitle(); - String institutionCode = tbSegment.getSpecimenLabel().getInstAcronym(); - String collectionCode = tbSegment.getSpecimenLabel().getCollectionCode(); - String catalogNumber = tbSegment.getSpecimenLabel().getCatalogNumber(); - String accessionNumber = tbSegment.getSpecimenLabel().getGenBankAccession(); - String otherAccessionNumber = tbSegment.getSpecimenLabel().getOtherAccession(); - String dateSampled = tbSegment.getSpecimenLabel().getSampleDateString(); - String scientificName = tbSegment.getSpecimenTaxonLabelAsString(); - String collector = tbSegment.getSpecimenLabel().getCollector(); - Double latitude = tbSegment.getSpecimenLabel().getLatitude(); - Double longitude = tbSegment.getSpecimenLabel().getLongitude(); - Double elevation = tbSegment.getSpecimenLabel().getElevation(); - String country = tbSegment.getSpecimenLabel().getCountry(); - String state = tbSegment.getSpecimenLabel().getState(); - String locality = tbSegment.getSpecimenLabel().getLocality(); - String notes = tbSegment.getSpecimenLabel().getNotes(); + } + } + + /** + * + * @param xmlMatrix + * @param tbMatrix + * @param xmlCharacterList + * @param tbRow + * @param tbSegments + * @param xmlOTU + */ + private void populateDiscreteVerboseNexmlMatrix( + org.nexml.model.Matrix<CharacterState> xmlMatrix, + DiscreteMatrix tbMatrix, + List<org.nexml.model.Character> xmlCharacterList,MatrixRow tbRow, + Set<RowSegment> tbSegments, OTU xmlOTU) { - //if the value is not null, output the xmlOTU annotation. - //DwC refers to the Darwin Core term vocabulary for the associated annotation - if (null != title){ - //output name identifying the data set from which the record was derived - xmlOTU.addAnnotationValue("DwC:datasetName", Constants.DwCURI, title); + // iterates over all characters, i.e. nchar times + int charIndex = 0; + String seq = tbRow.getSymbolString(); + for ( MatrixColumn tbColumn : ((CharacterMatrix)tbMatrix).getColumns() ) { + + org.nexml.model.Character xmlCharacter = xmlCharacterList.get(charIndex); + MatrixCell<CharacterState> xmlCell = xmlMatrix.getCell(xmlOTU, xmlCharacter); + String value = "" + seq.charAt(charIndex); + CharacterState xmlState = xmlMatrix.parseSymbol(value); + xmlCell.setValue(xmlState); + attachTreeBaseID ((Annotatable) xmlCell, tbColumn , DiscreteMatrixElement.class); + + for ( RowSegment tbSegment : tbSegments ) { + if ( tbSegment.getStartIndex() <= charIndex && charIndex <= tbSegment.getEndIndex() ) { + copyDarwinCoreAnnotations(tbSegment, (Annotatable)xmlCell); } - if ( null != institutionCode ) { - //output name or acronym of institution that has custody of information referred to in record - xmlOTU.addAnnotationValue("DwC:institutionCode", Constants.DwCURI, institutionCode); - } - if ( null != collectionCode ) { - //output name or code that identifies collection or data set from which record was derived - xmlOTU.addAnnotationValue ("DwC:collectionCode", Constants.DwCURI, collectionCode); - } - if ( null != catalogNumber ){ - //output unique (usually) identifier for the record within data set or collection - xmlOTU.addAnnotationValue("DwC:catalogNumber", Constants.DwCURI, catalogNumber); - } - if ( null != accessionNumber) { - //output a list of genetic sequence information associated with occurrence - xmlOTU.addAnnotationValue("DwC:associatedSequences", Constants.DwCURI, accessionNumber); - } - if ( null != otherAccessionNumber ) { - //list of previous or alternate fully catalog numbers (i.e. Genbank) or human-used identifiers - xmlOTU.addAnnotationValue("DwC:otherCatalogNumbers", Constants.DwCURI, otherAccessionNumber); - } - if ( null != dateSampled ) { - //output date sampled in ISO 8601 format - xmlOTU.addAnnotationValue("DwC:eventDate", Constants.DwCURI, dateSampled); - } - if ( null != scientificName ) { - //output full scientific name - xmlOTU.addAnnotationValue("DwC:scientificName", Constants.DwCURI, scientificName); - } - if ( null != collector ) { - //output names of people associated with recording of original occurrence - xmlOTU.addAnnotationValue("DwC:recordedBy", Constants.DwCURI, collector); - } - if ( null != latitude ) { - //output geographic latitude in decimal degrees using geodeticDatum spatial reference system - xmlOTU.addAnnotationValue("DwC:decimalLatitude", Constants.DwCURI, latitude); - } - if ( null != longitude ) { - //output geographic longitude in decimal degrees using geodeticDatum spatial reference system - xmlOTU.addAnnotationValue("DwC:decimalLongitude", Constants.DwCURI, longitude); - } - if ( null != elevation ) { - //there are two different Darwin Core terms for elevation depending on elevation value - //outputs geographic elevation of sample - if ( elevation >= 0) { - //above local surface in meters - xmlOTU.addAnnotationValue("DwC:verbatimElevation", Constants.DwCURI, elevation); - } - else { - //below local surface in meters - xmlOTU.addAnnotationValue("DwC:verbatimDepth", Constants.DwCURI, elevation); - } - } - if ( null != country ) { - //output country in which location occurs - xmlOTU.addAnnotationValue("DwC:country", Constants.DwCURI, country); - } - if ( null != state ) { - //output name of next smaller administrative region than country (i.e. state, province, region) - xmlOTU.addAnnotationValue ("DwC:stateProvince", Constants.DwCURI, state); - } - if ( null != locality) { - //output brief description of sample location - xmlOTU.addAnnotationValue("DwC:locality", Constants.DwCURI, locality); - } - if ( null != notes ) { - //output any additional information about specimen - xmlOTU.addAnnotationValue("DwC:occurenceRemarks", Constants.DwCURI, notes); - } } - } + charIndex++; + } } /** @@ -542,7 +399,7 @@ * @param xmlMatrix * @param tbMatrix */ - private void populateXmlMatrix(org.nexml.model.ContinuousMatrix xmlMatrix, + private void populateContinuousNexmlMatrix(org.nexml.model.ContinuousMatrix xmlMatrix, ContinuousMatrix tbMatrix) { List<org.nexml.model.Character> characterList = xmlMatrix.getCharacters(); OTUs xmlOTUs = xmlMatrix.getOTUs(); @@ -563,100 +420,100 @@ } Set<RowSegment> tbSegments = tbRow.getSegmentsReadOnly(); for ( RowSegment tbSegment : tbSegments ) { - //declare variables for row-segment annotations - String title = tbSegment.getTitle(); - String institutionCode = tbSegment.getSpecimenLabel().getInstAcronym(); - String collectionCode = tbSegment.getSpecimenLabel().getCollectionCode(); - String catalogNumber = tbSegment.getSpecimenLabel().getCatalogNumber(); - String accessionNumber = tbSegment.getSpecimenLabel().getGenBankAccession(); - String otherAccessionNumber = tbSegment.getSpecimenLabel().getOtherAccession(); - String dateSampled = tbSegment.getSpecimenLabel().getSampleDateString(); - String scientificName = tbSegment.getSpecimenTaxonLabelAsString(); - String collector = tbSegment.getSpecimenLabel().getCollector(); - Double latitude = tbSegment.getSpecimenLabel().getLatitude(); - Double longitude = tbSegment.getSpecimenLabel().getLongitude(); - Double elevation = tbSegment.getSpecimenLabel().getElevation(); - String country = tbSegment.getSpecimenLabel().getCountry(); - String state = tbSegment.getSpecimenLabel().getState(); - String locality = tbSegment.getSpecimenLabel().getLocality(); - String notes = tbSegment.getSpecimenLabel().getNotes(); - - //if the value is not null, output the xmlOTU annotation. - //DwC refers to the Darwin Core term vocabulary for the associated annotation - if (null != title){ - //output name identifying the data set from which the record was derived - xmlOTU.addAnnotationValue("DwC:datasetName", Constants.DwCURI, title); - } - if ( null != institutionCode ) { - //output name or acronym of institution that has custody of information referred to in record - xmlOTU.addAnnotationValue("DwC:institutionCode", Constants.DwCURI, institutionCode); - } - if ( null != collectionCode ) { - //output name or code that identifies collection or data set from which record was derived - xmlOTU.addAnnotationValue ("DwC:collectionCode", Constants.DwCURI, collectionCode); - } - if ( null != catalogNumber ){ - //output unique (usually) identifier for the record within data set or collection - xmlOTU.addAnnotationValue("DwC:catalogNumber", Constants.DwCURI, catalogNumber); - } - if ( null != accessionNumber) { - //output a list of genetic sequence information associated with occurrence - xmlOTU.addAnnotationValue("DwC:associatedSequences", Constants.DwCURI, accessionNumber); - } - if ( null != otherAccessionNumber ) { - //list of previous or alternate fully catalog numbers (i.e. Genbank) or human-used identifiers - xmlOTU.addAnnotationValue("DwC:otherCatalogNumbers", Constants.DwCURI, otherAccessionNumber); - } - if ( null != dateSampled ) { - //output date sampled in ISO 8601 format - xmlOTU.addAnnotationValue("DwC:eventDate", Constants.DwCURI, dateSampled); - } - if ( null != scientificName ) { - //output full scientific name - xmlOTU.addAnnotationValue("DwC:scientificName", Constants.DwCURI, scientificName); - } - if ( null != collector ) { - //output names of people associated with recording of original occurrence - xmlOTU.addAnnotationValue("DwC:recordedBy", Constants.DwCURI, collector); - } - if ( null != latitude ) { - //output geographic latitude in decimal degrees using geodeticDatum spatial reference system - xmlOTU.addAnnotationValue("DwC:decimalLatitude", Constants.DwCURI, latitude); - } - if ( null != longitude ) { - //output geographic longitude in decimal degrees using geodeticDatum spatial reference system - xmlOTU.addAnnotationValue("DwC:decimalLongitude", Constants.DwCURI, longitude); - } - if ( null != elevation ) { - //there are two different Darwin Core terms for elevation depending on elevation value - //outputs geographic elevation of sample - if ( elevation >= 0) { - //above local surface in meters - xmlOTU.addAnnotationValue("DwC:verbatimElevation", Constants.DwCURI, elevation); - } - else { - //below local surface in meters - xmlOTU.addAnnotationValue("DwC:verbatimDepth", Constants.DwCURI, elevation); - } - } - if ( null != country ) { - //output country in which location occurs - xmlOTU.addAnnotationValue("DwC:country", Constants.DwCURI, country); - } - if ( null != state ) { - //output name of next smaller administrative region than country (i.e. state, province, region) - xmlOTU.addAnnotationValue ("DwC:stateProvince", Constants.DwCURI, state); - } - if ( null != locality) { - //output brief description of sample location - xmlOTU.addAnnotationValue("DwC:locality", Constants.DwCURI, locality); - } - if ( null != notes ) { - //output any additional information about specimen - xmlOTU.addAnnotationValue("DwC:occurenceRemarks", Constants.DwCURI, notes); - } + copyDarwinCoreAnnotations(tbSegment,xmlOTU); } } + } + + /** + * + * @param tbSegment + * @param xmlAnnotatable + */ + private void copyDarwinCoreAnnotations(RowSegment tbSegment, Annotatable xmlAnnotatable) { + + SpecimenLabel tbSpec = tbSegment.getSpecimenLabel(); + Map<String,String> predicateToObjectMap = new HashMap<String,String>(); + + predicateToObjectMap.put("DwC:institutionCode", tbSpec.getInstAcronym()); + predicateToObjectMap.put("DwC:collectionCode", tbSpec.getCollectionCode()); + predicateToObjectMap.put("DwC:catalogNumber", tbSpec.getCatalogNumber()); + predicateToObjectMap.put("DwC:associatedSequences", tbSpec.getGenBankAccession()); + predicateToObjectMap.put("DwC:otherCatalogNumbers", tbSpec.getOtherAccession()); + predicateToObjectMap.put("DwC:eventDate", tbSpec.getSampleDateString()); + predicateToObjectMap.put("DwC:scientificName", tbSegment.getSpecimenTaxonLabelAsString()); + predicateToObjectMap.put("DwC:recordedBy", tbSpec.getCollector()); + predicateToObjectMap.put("DwC:country", tbSpec.getCountry()); + predicateToObjectMap.put("DwC:locality", tbSpec.getLocality()); + predicateToObjectMap.put("DwC:stateProvince", tbSpec.getState()); + predicateToObjectMap.put("DwC:datasetName", tbSegment.getTitle()); + predicateToObjectMap.put("DwC:occurenceRemarks", tbSpec.getNotes()); + + for ( String predicate : predicateToObjectMap.keySet() ) { + String objectString = predicateToObjectMap.get(predicate); + if ( null != objectString ) { + xmlAnnotatable.addAnnotationValue(predicate, Constants.DwCURI, objectString); + } + } + + //output geographic latitude in decimal degrees using geodeticDatum spatial reference system + Double latitude = tbSpec.getLatitude(); + if ( null != latitude ) { + xmlAnnotatable.addAnnotationValue("DwC:decimalLatitude", Constants.DwCURI, latitude); + } + + //output geographic longitude in decimal degrees using geodeticDatum spatial reference system + Double longitude = tbSpec.getLongitude(); + if ( null != longitude ) { + xmlAnnotatable.addAnnotationValue("DwC:decimalLongitude", Constants.DwCURI, longitude); + } + + //there are two different Darwin Core terms for elevation depending on elevation value + //outputs geographic elevation of sample + Double elevation = tbSpec.getElevation(); + if ( null != elevation ) { + if ( elevation >= 0) { + //above local surface in meters + xmlAnnotatable.addAnnotationValue("DwC:verbatimElevation", Constants.DwCURI, elevation); + } + else { + //below local surface in meters + xmlAnnotatable.addAnnotationValue("DwC:verbatimDepth", Constants.DwCURI, elevation); + } + } } + + /** + * + * @param tbColumn + * @param xmlCharacter + */ + private void copyCharacterAttributes(MatrixColumn tbColumn,org.nexml.model.Character xmlCharacter) { + PhyloChar tbCharacter = tbColumn.getCharacter(); + if ( null != tbCharacter.getDescription() ) { + xmlCharacter.setLabel(tbCharacter.getLabel()); + } + attachTreeBaseID((Annotatable)xmlCharacter,tbColumn,MatrixColumn.class); + } + + /** + * + * @param tbMatrix + * @param xmlMatrix + */ + private void copyMatrixAttributes(CharacterMatrix tbMatrix,org.nexml.model.Matrix<?> xmlMatrix) { + // attach matrix identifiers + attachTreeBaseID((Annotatable)xmlMatrix, tbMatrix,Matrix.class); + String tb1MatrixID = tbMatrix.getTB1MatrixID(); + if ( null != tb1MatrixID ) { + ((Annotatable)xmlMatrix).addAnnotationValue("tb:identifier.matrix.tb1", Constants.TBTermsURI, tb1MatrixID); + } + + xmlMatrix.addAnnotationValue("skos:historyNote", Constants.SKOSURI, "Mapped from TreeBASE schema using "+this.toString()+" $Rev$"); + xmlMatrix.setBaseURI(mMatrixBaseURI); + xmlMatrix.setLabel(tbMatrix.getLabel()); + } + + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |