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: <mjd...@us...> - 2009-06-23 19:47:15
|
Revision: 86 http://treebase.svn.sourceforge.net/treebase/?rev=86&view=rev Author: mjdominus Date: 2009-06-23 19:46:27 +0000 (Tue, 23 Jun 2009) Log Message: ----------- add --where and --nrecs options Modified Paths: -------------- trunk/treebase-core/src/main/perl/dump/sqldump Modified: trunk/treebase-core/src/main/perl/dump/sqldump =================================================================== --- trunk/treebase-core/src/main/perl/dump/sqldump 2009-06-23 11:14:09 UTC (rev 85) +++ trunk/treebase-core/src/main/perl/dump/sqldump 2009-06-23 19:46:27 UTC (rev 86) @@ -15,7 +15,8 @@ my $schema = 'TBASE2'; # name of schema to analyze my $zip = 0; # zip output my $test = 0; # test run: delete produced files - +my $nrecs; # max number of recs per table +my $where = ""; # WHERE clause to select dumped records # get command line options, see Getopt::Long GetOptions( 'name-after-table' => \$name_file_after_table, @@ -28,6 +29,8 @@ 'table=s' => \@tables, 'zip' => \$zip, 'test' => \$test, + 'nrecs=i' => \$nrecs, + 'where=s' => \$where, 'all' => sub { @tables = get_all_tables() }, 'help|?' => sub { pod2usage( '-verbose' => 0 ) }, # see Pod::Usage 'man' => sub { pod2usage( '-verbose' => 1 ) }, # see Pod::Usage @@ -58,6 +61,10 @@ '-msg' => 'Need at least one operation to write out (--inserts and/or --creates), aborting' ) unless $with_creates or $with_inserts; +# prepend $where clause with WHERE unless it has that already, +# or there was none. +$where = "WHERE $where" unless $where =~ /^\s*$/ || $where =~ /^\s*where\b/i; + { # create database handle my $dbh = get_handle(); @@ -149,6 +156,7 @@ # get all rows from $table my $q = qq{select * from $table}; + $q .= " " . $where if $where; my $sth = $dbh->prepare($q); $sth->execute(); @@ -168,6 +176,7 @@ else { while ( $row = $sth->fetchrow_arrayref ) { $dumper->rec(@$row); + last if defined($nrecs) && (--$nrecs == 0); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SourceForge.net <no...@so...> - 2009-06-23 14:29:05
|
Bugs item #2798604, was opened at 2009-05-29 17:21 Message generated for change (Settings changed) made by sfrgpiel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=2798604&group_id=248804 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: data Group: None Status: Open >Priority: 8 Private: No Submitted By: Blaise Li (blaiseli) Assigned to: Mark Dominus (mjdominus) Summary: no block of taxa could be created from a MrBayes .con tree Initial Comment: The upoad of the attached file fails: it says it cannot generate a block of taxa. This is either a bug or a strong limitation: the file contains a nexus tree obtained from MrBayes; it should not be so special. ---------------------------------------------------------------------- >Comment By: William Piel (sfrgpiel) Date: 2009-06-23 10:29 Message: This looks like a difficult bug to fix because the problem stems from Mesquite. I'm puzzled why Mesquite cannot create a default taxon block from a tree block that does not use a translation table. I've tried opening trees like this in Mesquite v. 2 with no success... ---------------------------------------------------------------------- Comment By: William Piel (sfrgpiel) Date: 2009-06-23 10:29 Message: Thanks for reporting this bug. We'll look into it as soon as possible. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=2798604&group_id=248804 |
From: <rv...@us...> - 2009-06-23 14:21:02
|
Revision: 82 http://treebase.svn.sourceforge.net/treebase/?rev=82&view=rev Author: rvos Date: 2009-06-23 11:10:17 +0000 (Tue, 23 Jun 2009) Log Message: ----------- Refactored to take advantage of AbstractDownloadController superclass. Commented out (but kept in place) all now superfluous code. Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadAMatrixController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadANexusFileController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadANexusRCTFileController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadATreeBlockController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadATreeController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadAnAnalysisStepController.java Added Paths: ----------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadAStudyController.java Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadAMatrixController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadAMatrixController.java 2009-06-23 11:08:34 UTC (rev 81) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadAMatrixController.java 2009-06-23 11:10:17 UTC (rev 82) @@ -20,25 +20,26 @@ package org.cipres.treebase.web.controllers; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; +//import java.io.File; +//import java.io.FileWriter; +//import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.log4j.Logger; +//import org.apache.log4j.Logger; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.Controller; import org.cipres.treebase.TreebaseUtil; import org.cipres.treebase.domain.matrix.Matrix; import org.cipres.treebase.domain.matrix.MatrixService; +import org.cipres.treebase.domain.nexus.NexusDataSet; import org.cipres.treebase.domain.study.Study; import org.cipres.treebase.domain.study.StudyService; import org.cipres.treebase.domain.taxon.TaxonLabelSet; import org.cipres.treebase.web.util.ControllerUtil; -import org.cipres.treebase.web.util.WebUtil; +//import org.cipres.treebase.web.util.WebUtil; /** * DownloadAMatrixController.java @@ -52,8 +53,8 @@ * */ -public class DownloadAMatrixController implements Controller { - private static final Logger LOGGER = Logger.getLogger(DownloadAMatrixController.class); +public class DownloadAMatrixController extends AbstractDownloadController implements Controller { + //private static final Logger LOGGER = Logger.getLogger(DownloadAMatrixController.class); private MatrixService mMatrixService; private StudyService mStudyService; @@ -103,7 +104,6 @@ // + request.getSession().getServletContext().getRealPath("/NexusFileDownload")); // System.out.println("PATH INFO: " + request.getPathInfo()); // - // TODO: if (request.getParameter("matrixid") == null) { return null; @@ -113,40 +113,29 @@ //Study s = getStudyService().findByID(studyId); long matrixId = Long.parseLong(request.getParameter("matrixid")); - String fileName = getFileName(matrixId); +// String fileName = getFileName(matrixId,request); - String downloadDir = request.getSession().getServletContext().getRealPath( - TreebaseUtil.FILESEP + "NexusFileDownload") - + TreebaseUtil.FILESEP + request.getRemoteUser(); +// String downloadDir = request.getSession().getServletContext().getRealPath( +// TreebaseUtil.FILESEP + "NexusFileDownload") +// + TreebaseUtil.FILESEP + request.getRemoteUser(); +// String downloadDir = getDownloadDir(request); - long start = System.currentTimeMillis(); +// long start = System.currentTimeMillis(); - generateAFileDynamically(request, matrixId, downloadDir); - WebUtil.downloadFile(response, downloadDir, fileName); + generateAFileDynamically(request, response, matrixId); +// WebUtil.downloadFile(response, downloadDir, fileName); - long end = System.currentTimeMillis(); +// long end = System.currentTimeMillis(); +// +// if (LOGGER.isDebugEnabled()) { +// LOGGER.debug("TIME DIFFERENCE FOR A SINGAL FILE IN DOWNLOAD A MATRIX CONTROLLER: " +// + (end - start)); +// } - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("TIME DIFFERENCE FOR A SINGAL FILE IN DOWNLOAD A MATRIX CONTROLLER: " - + (end - start)); - } - return null; // new ModelAndView("treeList", Constants.TREE_LIST, phyloTrees); } /** - * This method adds "M" as Prefix to the matrix ID and ".nex" as Suffix. - * - * @param id (Matrix id) - * @return returns the file name to be used for down loading - */ - - private String getFileName(long id) { - - return "M" + id + ".nex"; - } - - /** * This method is responsible for generating a Matrix file in a particular down load directory. * But first It should get All the Taxa associated with a Matrix id and get the max length of * the Taxon Labels and put Taxa and remaining matrix information in a separate ArrayLists @@ -155,7 +144,7 @@ * @param pMatrixId It is Matrix id. * @param downloadDirName down load directory where files will be created */ - + /* private void generateAFileDynamically(HttpServletRequest request, long pMatrixId, String downloadDirName) { Study pStudy = ControllerUtil.findStudy(request, mStudyService); @@ -183,7 +172,7 @@ matrix.generateNexusBlock(matrixContent); // matrixContent.append("END;\n"); // Not Needed - String tmp = getFileName(pMatrixId); + String tmp = getFileName(pMatrixId,request); try { @@ -203,5 +192,36 @@ } } + */ + @Override + protected String getFileNamePrefix() { + return "M"; + } + + @Override + protected String getFileContent(long objectId, HttpServletRequest request) { + Study pStudy = ControllerUtil.findStudy(request, getStudyService()); + Matrix matrix = getMatrixService().findByID(objectId); + TaxonLabelSet taxa = matrix.getTaxa(); + + if ( getFormat(request) == FORMAT_NEXML ) { + NexusDataSet pNexusDataSet = new NexusDataSet(); + pNexusDataSet.getTaxonLabelSets().add(taxa); + pNexusDataSet.getMatrices().add(matrix); + return getNexmlService().serialize(pNexusDataSet); + } + else { // FORMAT_NEXUS or none + StringBuilder matrixContent = new StringBuilder(); + matrixContent.append("#NEXUS\n"); + TreebaseUtil.attachStudyHeader(pStudy, matrixContent); + if (taxa != null) { + //one taxon per line, no line number: + taxa.buildNexusBlockTaxa(matrixContent, true, false); + } + matrix.generateNexusBlock(matrixContent); + return matrixContent.toString(); + } + } + } Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadANexusFileController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadANexusFileController.java 2009-06-23 11:08:34 UTC (rev 81) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadANexusFileController.java 2009-06-23 11:10:17 UTC (rev 82) @@ -22,17 +22,17 @@ package org.cipres.treebase.web.controllers; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; +//import java.io.File; +//import java.io.FileWriter; +//import java.io.IOException; import java.sql.Clob; -import java.sql.SQLException; +//import java.sql.SQLException; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.log4j.Logger; +//import org.apache.log4j.Logger; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.Controller; @@ -42,7 +42,7 @@ import org.cipres.treebase.domain.study.StudyService; import org.cipres.treebase.domain.tree.PhyloTreeService; import org.cipres.treebase.web.util.ControllerUtil; -import org.cipres.treebase.web.util.WebUtil; +//import org.cipres.treebase.web.util.WebUtil; /** * @@ -54,9 +54,9 @@ * @author madhu * */ -public class DownloadANexusFileController implements Controller { +public class DownloadANexusFileController extends AbstractDownloadController implements Controller { - private static final Logger LOGGER = Logger.getLogger(DownloadANexusFileController.class); +// private static final Logger LOGGER = Logger.getLogger(DownloadANexusFileController.class); private PhyloTreeService mPhyloTreeService; private StudyService mStudyService; @@ -109,39 +109,40 @@ public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { - // TODO Auto-generated method stub - String sep = System.getProperty("file.separator"); - String downloadDir = request.getSession().getServletContext().getRealPath( - "/NexusFileDownload") - + sep + request.getRemoteUser(); +// String sep = System.getProperty("file.separator"); +// String downloadDir = request.getSession().getServletContext().getRealPath( +// "/NexusFileDownload") +// + sep + request.getRemoteUser(); +// String downloadDir = getDownloadDir(request); +// +// String treeId = request.getParameter("treeid"); +// String matrixId = request.getParameter("matrixid"); +// String nexusFile = request.getParameter("nexusfile"); +// +// if (treeId == null && matrixId == null && nexusFile == null) { +// return null; +// } +// long clickedParameterId = 0L; +// String nexusFileName = null; +// +// if (treeId != null) { +// clickedParameterId = Long.parseLong(treeId); +// nexusFileName = getPhyloTreeService().findByID(clickedParameterId).getNexusFileName(); +// } else if (matrixId != null) { +// clickedParameterId = Long.parseLong(matrixId); +// nexusFileName = getMatrixService().findByID(clickedParameterId).getNexusFileName(); +// } else if (nexusFile != null) { +// nexusFileName = (nexusFile).replaceAll("%20", "_"); +// } +// +// if (nexusFileName == null) { +// return null; +// } + + generateAFileDynamically(request,response,0L); +// generateAFileDynamically(request, downloadDir, nexusFileName); +// WebUtil.downloadFile(response, downloadDir, nexusFileName + org); - String treeId = request.getParameter("treeid"); - String matrixId = request.getParameter("matrixid"); - String nexusFile = request.getParameter("nexusfile"); - - if (treeId == null && matrixId == null && nexusFile == null) { - return null; - } - long clickedParameterId = 0L; - String nexusFileName = null; - - if (treeId != null) { - clickedParameterId = Long.parseLong(treeId); - nexusFileName = getPhyloTreeService().findByID(clickedParameterId).getNexusFileName(); - } else if (matrixId != null) { - clickedParameterId = Long.parseLong(matrixId); - nexusFileName = getMatrixService().findByID(clickedParameterId).getNexusFileName(); - } else if (nexusFile != null) { - nexusFileName = (nexusFile).replaceAll("%20", "_"); - } - - if (nexusFileName == null) { - return null; - } - - generateAFileDynamically(request, downloadDir, nexusFileName); - WebUtil.downloadFile(response, downloadDir, nexusFileName + org); - return null; } @@ -149,7 +150,8 @@ * @param req HttpServletRequest * @param downloadDirName String Name of the directory where file(s) will be downloaded * @param fileName String name of the download file - */ + */ + /* private void generateAFileDynamically( HttpServletRequest req, String downloadDirName, @@ -199,6 +201,72 @@ sqle.printStackTrace(); } + } + */ + + @Override + protected String getFileName(long objectId,HttpServletRequest req) { + String treeId = req.getParameter("treeid"); + String matrixId = req.getParameter("matrixid"); + String nexusFile = req.getParameter("nexusfile"); + + if (treeId == null && matrixId == null && nexusFile == null) { + return null; + } + long clickedParameterId = 0L; + String nexusFileName = null; + if (treeId != null) { + clickedParameterId = Long.parseLong(treeId); + nexusFileName = getPhyloTreeService().findByID(clickedParameterId).getNexusFileName(); + } else if (matrixId != null) { + clickedParameterId = Long.parseLong(matrixId); + nexusFileName = getMatrixService().findByID(clickedParameterId).getNexusFileName(); + } else if (nexusFile != null) { + nexusFileName = (nexusFile).replaceAll("%20", "_"); + } + return ( nexusFileName + org ).replaceAll(TreebaseUtil.ANEMPTYSPACE, "_"); + } + + @Override + protected String getFileNamePrefix() { + // Not necessary because we override getFileName + return null; + } + + @Override + protected String getFileContent(long objectId, HttpServletRequest req) { + String nexusFileName = null; + String treeId = req.getParameter("treeid"); + String matrixId = req.getParameter("matrixid"); + String nexusFile = req.getParameter("nexusfile"); + long clickedParameterId = 0L; + if (treeId != null) { + clickedParameterId = Long.parseLong(treeId); + nexusFileName = getPhyloTreeService().findByID(clickedParameterId).getNexusFileName(); + } else if (matrixId != null) { + clickedParameterId = Long.parseLong(matrixId); + nexusFileName = getMatrixService().findByID(clickedParameterId).getNexusFileName(); + } else if (nexusFile != null) { + nexusFileName = (nexusFile).replaceAll("%20", "_"); + } + if (nexusFileName == null) { + return null; + } + Study study = ControllerUtil.findStudy(req, mStudyService); + Map<String, Clob> nexusMap = study.getNexusFiles(); + Clob clob = nexusMap.get(nexusFileName); + String clobStr = "File Not Found. File Name is: " + nexusFileName; + if (clob != null) { + try { + int clobLength = (int) clob.length(); + char[] clobchars = new char[clobLength]; + clob.getCharacterStream().read(clobchars); + clobStr = new String(clobchars); + } catch ( Exception e ) { + e.printStackTrace(); + } + } + return clobStr; } } Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadANexusRCTFileController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadANexusRCTFileController.java 2009-06-23 11:08:34 UTC (rev 81) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadANexusRCTFileController.java 2009-06-23 11:10:17 UTC (rev 82) @@ -21,8 +21,8 @@ */ package org.cipres.treebase.web.controllers; -import java.io.File; -import java.io.FileWriter; +//import java.io.File; +//import java.io.FileWriter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -36,7 +36,7 @@ import org.cipres.treebase.domain.study.StudyService; import org.cipres.treebase.domain.study.Submission; import org.cipres.treebase.web.util.ControllerUtil; -import org.cipres.treebase.web.util.WebUtil; +//import org.cipres.treebase.web.util.WebUtil; /** * @author madhu @@ -46,7 +46,7 @@ * Modified on April 28, 2008 * */ -public class DownloadANexusRCTFileController implements Controller { +public class DownloadANexusRCTFileController extends AbstractDownloadController implements Controller { Logger LOGGER = Logger.getLogger(DownloadANexusRCTFileController.class); @@ -78,52 +78,91 @@ Long study_id = ControllerUtil.getStudyId(pRequest); Study study = mStudyService.findByID(study_id); Submission submission = study.getSubmission(); + generateAFileDynamically(pRequest, pResponse, submission.getId()); + return null; - String fileName = pRequest.getParameter("nexusfile"); +// String fileName = pRequest.getParameter("nexusfile"); +// if (fileName == null) { +// return null; +// } +// +// String nexFileName = (fileName + "rct").replaceAll(TreebaseUtil.ANEMPTYSPACE, "_"); +// +// if (LOGGER.isInfoEnabled()) { +// LOGGER.info("Submission id: " + submission.getId() + ", FileName: " + nexFileName); +// } + +// String downloadDir = pRequest.getSession().getServletContext().getRealPath( +// TreebaseUtil.FILESEP + "NexusFileDownload") +// + TreebaseUtil.FILESEP + pRequest.getRemoteUser(); +// String downloadDir = getDownloadDir(pRequest); +// +// long start = System.currentTimeMillis(); +// +// File dirPath = new File(downloadDir); +// if (!dirPath.exists()) { +// dirPath.mkdirs(); +// } +// +// String pathName = downloadDir + TreebaseUtil.FILESEP + nexFileName; +// File file = new File(pathName); +// +// if (LOGGER.isDebugEnabled()) { +// LOGGER.debug("path=" + pathName); +// } +// +// FileWriter fwriter = new FileWriter(file); +// StringBuilder bldr = new StringBuilder("#NEXUS"); +// bldr.append(TreebaseUtil.getLineSeparators(2)); +// bldr +// .append(getStudyService().generateReconstructedNexusFile(submission.getId(), fileName)); +// +// fwriter.write(bldr.toString()); +// fwriter.close(); +// WebUtil.downloadFile(pResponse, downloadDir, nexFileName); +// +// if (LOGGER.isDebugEnabled()) { +// long end = System.currentTimeMillis(); +// LOGGER.debug(" file download time=" + (end-start)); +// } +// +// return null; + } + + @Override + protected String getFileName(long objectId,HttpServletRequest req) { + String fileName = req.getParameter("nexusfile"); if (fileName == null) { return null; } + return (fileName + "rct").replaceAll(TreebaseUtil.ANEMPTYSPACE, "_"); + } - String nexFileName = (fileName + "rct").replaceAll(TreebaseUtil.ANEMPTYSPACE, "_"); + @Override + protected String getFileNamePrefix() { + // Not necessary because we override getFileName + return null; + } - if (LOGGER.isInfoEnabled()) { - LOGGER.info("Submission id: " + submission.getId() + ", FileName: " + nexFileName); + @Override + protected String getFileContent(long submisionId, HttpServletRequest request) { + if ( getFormat(request) == FORMAT_NEXML ) { + Long study_id = ControllerUtil.getStudyId(request); + Study study = mStudyService.findByID(study_id); + return getNexmlService().serialize(study); } - - String downloadDir = pRequest.getSession().getServletContext().getRealPath( - TreebaseUtil.FILESEP + "NexusFileDownload") - + TreebaseUtil.FILESEP + pRequest.getRemoteUser(); - - long start = System.currentTimeMillis(); - - File dirPath = new File(downloadDir); - if (!dirPath.exists()) { - dirPath.mkdirs(); + else { + String fileName = request.getParameter("nexusfile"); + if (fileName == null) { + return null; + } + StringBuilder bldr = new StringBuilder("#NEXUS"); + bldr + .append(TreebaseUtil.getLineSeparators(2)) + .append(getStudyService() + .generateReconstructedNexusFile(submisionId, fileName)); + return bldr.toString(); } - - String pathName = downloadDir + TreebaseUtil.FILESEP + nexFileName; - File file = new File(pathName); - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("path=" + pathName); - } - - FileWriter fwriter = new FileWriter(file); - StringBuilder bldr = new StringBuilder("#NEXUS"); - bldr.append(TreebaseUtil.getLineSeparators(2)); - bldr - .append(getStudyService().generateReconstructedNexusFile(submission.getId(), fileName)); - - fwriter.write(bldr.toString()); - fwriter.close(); - WebUtil.downloadFile(pResponse, downloadDir, nexFileName); - - if (LOGGER.isDebugEnabled()) { - long end = System.currentTimeMillis(); - LOGGER.debug(" file download time=" + (end-start)); - } - - return null; } } Added: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadAStudyController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadAStudyController.java (rev 0) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadAStudyController.java 2009-06-23 11:10:17 UTC (rev 82) @@ -0,0 +1,92 @@ +/** + * + */ +package org.cipres.treebase.web.controllers; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.cipres.treebase.TreebaseIDString; +import org.cipres.treebase.TreebaseUtil; +import org.cipres.treebase.domain.matrix.Matrix; +import org.cipres.treebase.domain.study.Study; +import org.cipres.treebase.domain.study.StudyService; +import org.cipres.treebase.domain.taxon.TaxonLabelSet; +import org.cipres.treebase.domain.tree.TreeBlock; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.mvc.Controller; + +/** + * @author rvosa + * + */ +public class DownloadAStudyController extends AbstractDownloadController + implements Controller { + private StudyService mStudyService; + + public StudyService getStudyService() { + return mStudyService; + } + + public void setStudyService(StudyService studyService) { + mStudyService = studyService; + } + + /* (non-Javadoc) + * @see org.cipres.treebase.web.controllers.AbstractDownloadController#getFileContent(long, javax.servlet.http.HttpServletRequest) + */ + @Override + protected String getFileContent(long pStudyID, HttpServletRequest request) { + Study study = getStudyService().findByID(pStudyID); + if ( getFormat(request) == FORMAT_NEXML ) { + return getNexmlService().serialize(study); + } + else { + StringBuilder builder = new StringBuilder(); + builder.append("#NEXUS\n\n"); + + // header: + TreebaseUtil.attachStudyHeader(study, builder); + + // taxa: + for ( TaxonLabelSet tls : study.getTaxonLabelSets() ) { + // one taxon label per line, no line number. + tls.buildNexusBlockTaxa(builder, true, false); + } + + // matrices:: + for ( Matrix m : study.getMatrices() ) { + m.generateNexusBlock(builder); + } + + //tree blocks: + for ( TreeBlock tb : study.getTreeBlocks() ) { + tb.generateAFileDynamically(builder); + } + + return builder.toString(); + } + } + + /* (non-Javadoc) + * @see org.cipres.treebase.web.controllers.AbstractDownloadController#getFileNamePrefix() + */ + @Override + protected String getFileNamePrefix() { + return TreebaseIDString.getPrefixForClass(Study.class); + } + + /* (non-Javadoc) + * @see org.springframework.web.servlet.mvc.Controller#handleRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) + */ + public ModelAndView handleRequest(HttpServletRequest request, + HttpServletResponse response) throws Exception { + if (request.getParameter("id") == null) { + return null; + } + long pStudyId = Long.parseLong(request.getParameter("id")); + generateAFileDynamically(request, response, pStudyId); + return null; + } + +} Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadATreeBlockController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadATreeBlockController.java 2009-06-23 11:08:34 UTC (rev 81) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadATreeBlockController.java 2009-06-23 11:10:17 UTC (rev 82) @@ -20,19 +20,21 @@ package org.cipres.treebase.web.controllers; -import java.io.File; -import java.io.FileWriter; +//import java.io.File; +//import java.io.FileWriter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.log4j.Logger; +//import org.apache.log4j.Logger; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.Controller; +//import org.cipres.treebase.TreebaseUtil; +import org.cipres.treebase.domain.nexus.NexusDataSet; import org.cipres.treebase.domain.tree.PhyloTreeHome; import org.cipres.treebase.domain.tree.TreeBlock; -import org.cipres.treebase.web.util.WebUtil; +//import org.cipres.treebase.web.util.WebUtil; /** * @@ -40,8 +42,8 @@ * */ -public class DownloadATreeBlockController implements Controller { - private static final Logger LOGGER = Logger.getLogger(DownloadATreeBlockController.class); +public class DownloadATreeBlockController extends AbstractDownloadController implements Controller { +// private static final Logger LOGGER = Logger.getLogger(DownloadATreeBlockController.class); private PhyloTreeHome mPhyloTreeHome; @@ -67,53 +69,66 @@ public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { - // TODO: - String sep = System.getProperty("file.separator"); +// String sep = System.getProperty("file.separator"); if (request.getParameter("treeblockid") == null) { return null; } long blockid = Long.parseLong(request.getParameter("treeblockid")); - String fileName = getFileName(blockid); + generateAFileDynamically(request, response, blockid); + return null; + //String fileName = getFileName(blockid,request); - String downloadDir = request.getSession().getServletContext().getRealPath( - "/NexusFileDownload") - + sep + request.getRemoteUser(); +// String downloadDir = request.getSession().getServletContext().getRealPath( +// "/NexusFileDownload") +// + sep + request.getRemoteUser(); +// String downloadDir = getDownloadDir(request); +// +// long start = System.currentTimeMillis(); +// +// TreeBlock treeBlock = getPhyloTreeHome().findTreeBlockById(blockid); +// +// File dirPath = new File(downloadDir); +// if (!dirPath.exists()) { +// dirPath.mkdirs(); +// } +// File file = new File(downloadDir + System.getProperty("file.separator") +// + getFileName(blockid,request)); +// FileWriter fwriter = new FileWriter(file); +// StringBuilder bldr = new StringBuilder("#NEXUS\n\n"); +// treeBlock.generateAFileDynamically(bldr); +// fwriter.write(bldr.toString()); +// fwriter.close(); +// generateAFileDynamically(request, blockid); +// WebUtil.downloadFile(response, downloadDir, getFileName(blockid,request)); +// +// long end = System.currentTimeMillis(); +// +// if (LOGGER.isDebugEnabled()) { +// LOGGER.debug("TIME DIFFERENCE FOR A SINGAL FILE: " + (end - start)); +// } +// +// return null; + } - long start = System.currentTimeMillis(); + @Override + protected String getFileNamePrefix() { + return "TB"; + } - TreeBlock element = getPhyloTreeHome().findTreeBlockById(blockid); - - File dirPath = new File(downloadDir); - if (!dirPath.exists()) { - dirPath.mkdirs(); + @Override + protected String getFileContent(long blockid, HttpServletRequest request) { + TreeBlock treeBlock = getPhyloTreeHome().findTreeBlockById(blockid); + if ( getFormat(request) == FORMAT_NEXML ) { + NexusDataSet nexusDataSet = new NexusDataSet(); + nexusDataSet.getTaxonLabelSets().add(treeBlock.getTaxonLabelSet()); + nexusDataSet.getTreeBlocks().add(treeBlock); + return getNexmlService().serialize(nexusDataSet); } - File file = new File(downloadDir + System.getProperty("file.separator") - + getFileName(blockid)); - FileWriter fwriter = new FileWriter(file); - StringBuilder bldr = new StringBuilder("#NEXUS\n\n"); - element.generateAFileDynamically(bldr); - fwriter.write(bldr.toString()); - fwriter.close(); - WebUtil.downloadFile(response, downloadDir, fileName); - - long end = System.currentTimeMillis(); - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("TIME DIFFERENCE FOR A SINGAL FILE: " + (end - start)); + else { + StringBuilder bldr = new StringBuilder("#NEXUS\n\n"); + treeBlock.generateAFileDynamically(bldr); + return bldr.toString(); } - - return null; } - /** - * This method adds "TB" as Prefix to the tree block ID and ".tre" as Suffix. - * - * @param id (TreeBlock id) - * @return returns the file name to be used for down loading - */ - private String getFileName(long id) { - - return "TB" + id + ".tre"; - } - } Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadATreeController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadATreeController.java 2009-06-23 11:08:34 UTC (rev 81) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadATreeController.java 2009-06-23 11:10:17 UTC (rev 82) @@ -20,24 +20,26 @@ package org.cipres.treebase.web.controllers; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; +//import java.io.File; +//import java.io.FileWriter; +//import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.log4j.Logger; +//import org.apache.log4j.Logger; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.Controller; import org.cipres.treebase.TreebaseUtil; +import org.cipres.treebase.domain.nexus.NexusDataSet; import org.cipres.treebase.domain.study.Study; import org.cipres.treebase.domain.study.StudyService; import org.cipres.treebase.domain.tree.PhyloTree; import org.cipres.treebase.domain.tree.PhyloTreeService; +import org.cipres.treebase.domain.tree.TreeBlock; import org.cipres.treebase.web.util.ControllerUtil; -import org.cipres.treebase.web.util.WebUtil; +//import org.cipres.treebase.web.util.WebUtil; import org.cipres.treebase.domain.taxon.TaxonLabelSet; @@ -53,8 +55,8 @@ * */ -public class DownloadATreeController implements Controller { - private static final Logger LOGGER = Logger.getLogger(DownloadATreeController.class); +public class DownloadATreeController extends AbstractDownloadController implements Controller { +// private static final Logger LOGGER = Logger.getLogger(DownloadATreeController.class); private PhyloTreeService mPhyloTreeService; private StudyService mStudyService; @@ -94,50 +96,42 @@ public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { - // TODO: - String sep = System.getProperty("file.separator"); +// String sep = System.getProperty("file.separator"); if (request.getParameter("treeid") == null) { return null; } long treeid = Long.parseLong(request.getParameter("treeid")); - String fileName = getFileName(treeid); - - String downloadDir = request.getSession().getServletContext().getRealPath( - "/NexusFileDownload") - + sep + request.getRemoteUser(); - - long start = System.currentTimeMillis(); - - generateAFileDynamically(request, treeid, downloadDir); - WebUtil.downloadFile(response, downloadDir, fileName); - - long end = System.currentTimeMillis(); - - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("TIME DIFFERENCE FOR A SINGAL FILE: " + (end - start)); - } - - return null; // new ModelAndView("treeList", Constants.TREE_LIST, phyloTrees); + generateAFileDynamically(request, response, treeid); + return null; +// String fileName = getFileName(treeid,request); +// +// String downloadDir = request.getSession().getServletContext().getRealPath( +// "/NexusFileDownload") +// + sep + request.getRemoteUser(); +// String downloadDir = getDownloadDir(request); +// +// long start = System.currentTimeMillis(); +// +// generateAFileDynamically(request, treeid, downloadDir); +// WebUtil.downloadFile(response, downloadDir, fileName); +// +// long end = System.currentTimeMillis(); +// +// if (LOGGER.isDebugEnabled()) { +// LOGGER.debug("TIME DIFFERENCE FOR A SINGAL FILE: " + (end - start)); +// } +// +// return null; // new ModelAndView("treeList", Constants.TREE_LIST, phyloTrees); } /** - * This method adds "T" as Prefix to the tree ID and ".tre" as Suffix. * - * @param id (Tree id) - * @return returns the file name to be used for downloading - */ - private String getFileName(long id) { - - return "T" + id + ".tre"; - } - - /** - * * @param request * @param pTreeId It is tree id. * @param downloadDirName download directory where files will be created */ + /* private void generateAFileDynamically( HttpServletRequest request, long pTreeId, @@ -145,15 +139,15 @@ Study study = ControllerUtil.findStudy(request, mStudyService); - File dirPath = new File(downloadDirName); - if (!dirPath.exists()) { - dirPath.mkdirs(); - } +// File dirPath = new File(downloadDirName); +// if (!dirPath.exists()) { +// dirPath.mkdirs(); +// } PhyloTree tree = getPhyloTreeService().findByID(pTreeId); TaxonLabelSet tbnlblSet = tree.getTreeBlock().getTaxonLabelSet(); - String tmp = getFileName(pTreeId); +// String tmp = getFileName(pTreeId,request); StringBuilder builder = new StringBuilder(); @@ -168,19 +162,60 @@ //tree block: tree.buildNexusBlock(builder); + + generateAFileDynamically(request, pTreeId); - try { +// try { +// +// File file = new File(downloadDirName + TreebaseUtil.FILESEP + tmp); +// FileWriter out = new FileWriter(file); +// +// out.write(builder.toString()); +// +// out.close(); +// +// } catch (IOException e) { +// e.printStackTrace(); +// } + } +*/ + @Override + protected String getFileNamePrefix() { + return "T"; + } - File file = new File(downloadDirName + TreebaseUtil.FILESEP + tmp); - FileWriter out = new FileWriter(file); - - out.write(builder.toString()); - - out.close(); - - } catch (IOException e) { - e.printStackTrace(); + @Override + protected String getFileContent(long pTreeId, HttpServletRequest request) { + Study study = ControllerUtil.findStudy(request, mStudyService); + PhyloTree tree = getPhyloTreeService().findByID(pTreeId); + tree = getPhyloTreeService().resurrect(tree); + TreeBlock enclosingTreeBlock = getPhyloTreeService().resurrect(tree.getTreeBlock()); + TaxonLabelSet tls = getPhyloTreeService().resurrect(enclosingTreeBlock.getTaxonLabelSet()); + if ( getFormat(request) == FORMAT_NEXML ) { + NexusDataSet nds = new NexusDataSet(); + nds.getTaxonLabelSets().add(tls); + TreeBlock treeBlock = new TreeBlock(); + treeBlock.setTaxonLabelSet(tls); + treeBlock.addPhyloTree(tree); + nds.getTreeBlocks().add(treeBlock); + return getNexmlService().serialize(nds); } + else { + StringBuilder builder = new StringBuilder(); + builder.append("#NEXUS\n\n"); + + // header: + TreebaseUtil.attachStudyHeader(study, builder); + + // taxa: + // one taxon label per line, no line number. + tls.buildNexusBlockTaxa(builder, true, false); + + //tree block: + tree.buildNexusBlock(builder); + + return builder.toString(); + } } } Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadAnAnalysisStepController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadAnAnalysisStepController.java 2009-06-23 11:08:34 UTC (rev 81) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/DownloadAnAnalysisStepController.java 2009-06-23 11:10:17 UTC (rev 82) @@ -20,9 +20,9 @@ package org.cipres.treebase.web.controllers; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; +//import java.io.File; +//import java.io.FileWriter; +//import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -39,7 +39,7 @@ import org.cipres.treebase.domain.taxon.TaxonLabelSet; import org.cipres.treebase.domain.tree.PhyloTree; import org.cipres.treebase.domain.tree.PhyloTreeService; -import org.cipres.treebase.web.util.WebUtil; +//import org.cipres.treebase.web.util.WebUtil; /** * @@ -49,7 +49,7 @@ * @author rvosa * */ -public class DownloadAnAnalysisStepController implements Controller { +public class DownloadAnAnalysisStepController extends AbstractDownloadController implements Controller { private MatrixService mMatrixService; private PhyloTreeService mPhyloTreeService; private AnalysisStepService mAnalysisStepService; @@ -117,14 +117,15 @@ } long analysisId = Long.parseLong(request.getParameter("analysisid")); - String fileName = getFileName(analysisId); +// String fileName = getFileName(analysisId,request); - String downloadDir = request.getSession().getServletContext().getRealPath( - TreebaseUtil.FILESEP + "NexusFileDownload") - + TreebaseUtil.FILESEP + request.getRemoteUser(); +// String downloadDir = request.getSession().getServletContext().getRealPath( +// TreebaseUtil.FILESEP + "NexusFileDownload") +// + TreebaseUtil.FILESEP + request.getRemoteUser(); +// String downloadDir = getDownloadDir(request); - generateAFileDynamically(request, analysisId, downloadDir); - WebUtil.downloadFile(response, downloadDir, fileName); + generateAFileDynamically(request, response, analysisId); +// WebUtil.downloadFile(response, downloadDir, fileName); return null; } @@ -136,6 +137,7 @@ * @param analysisId * @param downloadDirName */ + /* private void generateAFileDynamically(HttpServletRequest request, long analysisId, String downloadDirName) { AnalysisStep step = getAnalysisStepService().findByID(analysisId); @@ -187,7 +189,7 @@ } } - String tmp = getFileName(analysisId); + String tmp = getFileName(analysisId,request); try { File file = new File(downloadDirName + TreebaseUtil.FILESEP + tmp); FileWriter out = new FileWriter(file); @@ -198,9 +200,57 @@ } } - - private String getFileName(long id) { - return "AnalysisStep" + id + ".nex"; + */ + + @Override + protected String getFileNamePrefix() { + return "AnalysisStep"; } + @Override + protected String getFileContent(long analysisId, HttpServletRequest request) { + AnalysisStep step = getAnalysisStepService().findByID(analysisId); + StringBuilder stepContent = new StringBuilder(); + stepContent.append("#NEXUS\n"); + + //header: + TreebaseUtil.attachStudyHeader(step.getAnalysis().getStudy(), stepContent); + stepContent.append("[ The following blocks are input data for analysis step " + analysisId + " ]\n"); + TaxonLabelSet inputLabelSet = step.getInputTaxonLabelSet(); + inputLabelSet.buildNexusBlockTaxa(stepContent, true, false); + for ( AnalyzedData data : step.getDataSetReadOnly() ) { + if ( data.isInputData() ) { + PhyloTree tree = data.getTreeData(); + Matrix matrix = data.getMatrixData(); + if ( tree != null ) { + tree.getTreeBlock().setTaxonLabelSet(inputLabelSet); + tree.buildNexusBlock(stepContent); + } + if ( matrix != null ) { + matrix.setTaxa(inputLabelSet); + matrix.generateNexusBlock(stepContent); + } + } + } + + stepContent.append("[ The following blocks are output data for analysis step " + analysisId + " ]\n"); + TaxonLabelSet outputLabelSet = step.getOutputTaxonLabelSet(); + outputLabelSet.buildNexusBlockTaxa(stepContent, true, false); + for ( AnalyzedData data : step.getDataSetReadOnly() ) { + if ( ! data.isInputData() ) { + PhyloTree tree = data.getTreeData(); + Matrix matrix = data.getMatrixData(); + if ( tree != null ) { + tree.getTreeBlock().setTaxonLabelSet(outputLabelSet); + tree.buildNexusBlock(stepContent); + } + if ( matrix != null ) { + matrix.setTaxa(outputLabelSet); + matrix.generateNexusBlock(stepContent); + } + } + } + return stepContent.toString(); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2009-06-23 13:04:11
|
Revision: 83 http://treebase.svn.sourceforge.net/treebase/?rev=83&view=rev Author: rvos Date: 2009-06-23 11:10:53 +0000 (Tue, 23 Jun 2009) Log Message: ----------- Added download URL forwarding. Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSController.java Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSController.java 2009-06-23 11:10:17 UTC (rev 82) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/PhyloWSController.java 2009-06-23 11:10:53 UTC (rev 83) @@ -73,8 +73,13 @@ } String prefix = pathComponents[1]; String fullyQualifiedId = pathComponents[2]; - String id = fullyQualifiedId.replaceAll(".*:[a-zA-Z]*",""); - url = createUrl(prefix,id); + String id = fullyQualifiedId.replaceAll(".*:[a-zA-Z]*",""); + if ( TreebaseUtil.isEmpty(req.getParameter("format")) ) { + url = createUrl(prefix,id); + } + else { + url = createDownloadUrl(prefix,id,req.getParameter("format")); + } } catch ( NumberFormatException e ) { res.sendError(HttpServletResponse.SC_BAD_REQUEST, "Bad ID string: " + e.getMessage()); } catch ( ObjectNotFoundException e ) { @@ -89,6 +94,60 @@ return null; } + private String createDownloadUrl(String prefix, String objectId, String format) throws Exception { + String url = ""; + StringBuffer base = new StringBuffer("/treebase-web/search"); + if ( prefix.equalsIgnoreCase("study") ) { + Long studyId = Long.parseLong(objectId); + Study study = getStudyService().findByID(studyId); + if ( study == null ) { + throw new ObjectNotFoundException("Can't find study " + studyId); + } + //return base + "/summary.html?id=" + objectId; + return base + .append("/downloadAStudy.html?id=") + .append(objectId) + .append("&format=") + .append(format) + .toString(); + } + else if ( prefix.equalsIgnoreCase("matrix") ) { + Long matrixId = Long.parseLong(objectId); + Matrix matrix = getMatrixService().findByID(matrixId); + if ( matrix == null ) { + throw new ObjectNotFoundException("Can't find matrix " + matrixId); + } + Study study = matrix.getStudy(); + //http://localhost:8080/treebase-web/search/downloadAMatrix.html?id=830&matrixid=263 + return base + .append("/downloadAMatrix.html?id=") + .append(study.getId()) + .append("&matrixid=") + .append(objectId) + .append("&format=") + .append(format) + .toString(); + } + else if ( prefix.equalsIgnoreCase("tree") ) { + Long treeId = Long.parseLong(objectId); + PhyloTree phyloTree = getPhyloTreeService().findByID(treeId); + if ( phyloTree == null ) { + throw new ObjectNotFoundException("Can't find tree " + treeId); + } + Study study = phyloTree.getStudy(); + //http://localhost:8080/treebase-web/search/downloadATree.html?id=830&treeid=3983 + return base + .append("/downloadATree.html?id=") + .append(study.getId()) + .append("&treeid=") + .append(objectId) + .append("&format=") + .append(format) + .toString(); + } + return url; + } + public MatrixService getMatrixService() { return mMatrixService; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2009-06-23 12:49:16
|
Revision: 76 http://treebase.svn.sourceforge.net/treebase/?rev=76&view=rev Author: rvos Date: 2009-06-23 10:57:15 +0000 (Tue, 23 Jun 2009) Log Message: ----------- Fix: now no longer returns PhyloTreenull as a default title. Instead, if getId() returns a value, return a TreebaseIDString, otherwise return null. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/PhyloTree.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/PhyloTree.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/PhyloTree.java 2009-06-23 10:56:13 UTC (rev 75) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/PhyloTree.java 2009-06-23 10:57:15 UTC (rev 76) @@ -46,6 +46,7 @@ import mesquite.lib.MesquiteDouble; import mesquite.lib.StringUtil; +import org.cipres.treebase.TreebaseIDString; import org.cipres.treebase.TreebaseUtil; import org.cipres.treebase.domain.AbstractPersistedObject; import org.cipres.treebase.domain.TBPersistable; @@ -224,8 +225,11 @@ if ( ! TreebaseUtil.isEmpty(mTitle) ) { return mTitle; } + else if ( null != getId() ){ + return TreebaseIDString.getIDString(this); + } else { - return "PhyloTree" + getId(); + return null; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2009-06-23 12:04:38
|
Revision: 80 http://treebase.svn.sourceforge.net/treebase/?rev=80&view=rev Author: rvos Date: 2009-06-23 11:06:31 +0000 (Tue, 23 Jun 2009) Log Message: ----------- Changed configuration for nexmlService: doesn't need persistence (for now) so have removed domainHome bean field Modified Paths: -------------- trunk/treebase-core/src/main/resources/applicationContext-service.xml Modified: trunk/treebase-core/src/main/resources/applicationContext-service.xml =================================================================== --- trunk/treebase-core/src/main/resources/applicationContext-service.xml 2009-06-23 11:05:11 UTC (rev 79) +++ trunk/treebase-core/src/main/resources/applicationContext-service.xml 2009-06-23 11:06:31 UTC (rev 80) @@ -146,7 +146,7 @@ </bean> <bean id="nexmlService" class = "org.cipres.treebase.service.nexus.NexusServiceNexml"> - <property name="domainHome" ref="domainHome"/> + <!-- property name="domainHome" ref="domainHome"/ --> <property name="taxonLabelHome" ref="taxonLabelHome"/> </bean> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2009-06-23 12:04:14
|
Revision: 85 http://treebase.svn.sourceforge.net/treebase/?rev=85&view=rev Author: rvos Date: 2009-06-23 11:14:09 +0000 (Tue, 23 Jun 2009) Log Message: ----------- Changed configuration for download controllers, which need a nexmlService so they can serialize to nexml in addition to nexus. Modified Paths: -------------- trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml Modified: trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml =================================================================== --- trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2009-06-23 11:12:31 UTC (rev 84) +++ trunk/treebase-web/src/main/webapp/WEB-INF/treebase-servlet.xml 2009-06-23 11:14:09 UTC (rev 85) @@ -101,29 +101,39 @@ <property name="formView"><value>readyState</value></property> <property name="submissionService"><ref bean="submissionService"></ref></property> <property name="studyService"><ref bean="studyService"></ref></property> - </bean> + </bean> + + <!-- Download A Study --> + <bean id="downloadAStudyController" class="org.cipres.treebase.web.controllers.DownloadAStudyController"> + <property name="studyService"><ref bean="studyService"></ref></property> + <property name="nexmlService"><ref bean="nexmlService"></ref></property> + </bean> <!-- Download A Tree --> <bean id="downloadATreeController" class="org.cipres.treebase.web.controllers.DownloadATreeController"> <property name="studyService"><ref bean="studyService"></ref></property> - <property name="phyloTreeService"><ref bean="phyloTreeService"></ref></property> + <property name="phyloTreeService"><ref bean="phyloTreeService"></ref></property> + <property name="nexmlService"><ref bean="nexmlService"></ref></property> </bean> <bean id="downloadATreeBlockController" class="org.cipres.treebase.web.controllers.DownloadATreeBlockController"> - <property name="phyloTreeHome"><ref bean="phyloTreeHome"></ref></property> + <property name="phyloTreeHome"><ref bean="phyloTreeHome"></ref></property> + <property name="nexmlService"><ref bean="nexmlService"></ref></property> </bean> <!-- Download A Matrix --> <bean id="downloadAMatrixController" class="org.cipres.treebase.web.controllers.DownloadAMatrixController"> <property name="matrixService"><ref bean="matrixService"></ref></property> - <property name="studyService"><ref bean="studyService"></ref></property> + <property name="studyService"><ref bean="studyService"></ref></property> + <property name="nexmlService"><ref bean="nexmlService"></ref></property> </bean> <!-- Download A NexusFile --> <bean id="downloadANexusFileController" class="org.cipres.treebase.web.controllers.DownloadANexusFileController"> <property name="phyloTreeService"><ref bean="phyloTreeService"></ref></property> <property name="studyService"><ref bean="studyService"></ref></property> - <property name="matrixService"><ref bean="matrixService"></ref></property> + <property name="matrixService"><ref bean="matrixService"></ref></property> + <property name="nexmlService"><ref bean="nexmlService"></ref></property> </bean> <!-- Download An AnalysisStep's input and output as a NexusFile --> @@ -131,11 +141,13 @@ <property name="phyloTreeService"><ref bean="phyloTreeService"></ref></property> <property name="matrixService"><ref bean="matrixService"></ref></property> <property name="analysisStepService"><ref bean="analysisStepService"></ref></property> + <property name="nexmlService"><ref bean="nexmlService"></ref></property> </bean> <!-- Download A NexusFile --> <bean id="downloadANexusRCTFileController" class="org.cipres.treebase.web.controllers.DownloadANexusRCTFileController"> - <property name="studyService"><ref bean="studyService"></ref></property> + <property name="studyService"><ref bean="studyService"></ref></property> + <property name="nexmlService"><ref bean="nexmlService"></ref></property> </bean> <!-- View Taxa --> @@ -910,6 +922,7 @@ <prop key="/search/study/rowSegments.html">searchSummaryController</prop> <prop key="/search/matrixRowList.html">listMatrixRowController</prop> <prop key="/search/taxonList.html">listTaxaSearchController</prop> + <prop key="/search/downloadAStudy.html">downloadAStudyController</prop> <prop key="/search/downloadATree.html">downloadATreeController</prop> <prop key="/search/downloadATreeBlock.html">downloadATreeBlockController</prop> <prop key="/search/downloadAMatrix.html">downloadAMatrixController</prop> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2009-06-23 11:51:38
|
Revision: 74 http://treebase.svn.sourceforge.net/treebase/?rev=74&view=rev Author: rvos Date: 2009-06-23 10:54:08 +0000 (Tue, 23 Jun 2009) Log Message: ----------- Added constant DISPLAY_STRING_LENGTH for displaying short character state sequence previews (default: 30 characters). Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/MatrixRow.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/MatrixRow.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/MatrixRow.java 2009-06-23 10:52:08 UTC (rev 73) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/MatrixRow.java 2009-06-23 10:54:08 UTC (rev 74) @@ -68,6 +68,8 @@ private static final long serialVersionUID = 1L; + private static final int DISPLAY_STRING_LENGTH = 30; + private String mSymbolString; private TaxonLabel mTaxonLabel; @@ -373,7 +375,6 @@ public String getElementStringForDisplay() { String syms = getSymbolString(); if (syms == null) { return "(no data)"; } - int max = 30; // XXX Totally arbitrary 30 here - return syms.length() >= 30 ? syms.substring(0, 30) : syms; + return syms.length() >= DISPLAY_STRING_LENGTH ? syms.substring(0, DISPLAY_STRING_LENGTH) : syms; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2009-06-23 11:51:17
|
Revision: 71 http://treebase.svn.sourceforge.net/treebase/?rev=71&view=rev Author: rvos Date: 2009-06-23 10:50:05 +0000 (Tue, 23 Jun 2009) Log Message: ----------- New nexml.jar Modified Paths: -------------- trunk/treebase-core/lib/nexml.jar Modified: trunk/treebase-core/lib/nexml.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2009-06-23 11:51:02
|
Revision: 79 http://treebase.svn.sourceforge.net/treebase/?rev=79&view=rev Author: rvos Date: 2009-06-23 11:05:11 +0000 (Tue, 23 Jun 2009) Log Message: ----------- Adding many new types for prefix mappings, adding usage of NamespacedGUID 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 2009-06-23 11:03:39 UTC (rev 78) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/TreebaseIDString.java 2009-06-23 11:05:11 UTC (rev 79) @@ -4,41 +4,56 @@ import java.util.Map; import org.cipres.treebase.domain.TBPersistable; +import org.cipres.treebase.domain.matrix.DiscreteCharState; +import org.cipres.treebase.domain.matrix.DiscreteMatrixElement; import org.cipres.treebase.domain.matrix.Matrix; +import org.cipres.treebase.domain.matrix.PhyloChar; import org.cipres.treebase.domain.study.Analysis; import org.cipres.treebase.domain.study.AnalysisStep; import org.cipres.treebase.domain.study.AnalyzedData; import org.cipres.treebase.domain.study.Study; import org.cipres.treebase.domain.taxon.Taxon; import org.cipres.treebase.domain.taxon.TaxonLabel; +import org.cipres.treebase.domain.taxon.TaxonLabelSet; import org.cipres.treebase.domain.taxon.TaxonVariant; import org.cipres.treebase.domain.tree.PhyloTree; import org.cipres.treebase.domain.tree.PhyloTreeNode; +import org.cipres.treebase.domain.tree.TreeBlock; +import org.nexml.model.Annotatable; public class TreebaseIDString { public class MalformedTreebaseIDString extends Exception { + private static final long serialVersionUID = 1L; public MalformedTreebaseIDString() { super(); } - public MalformedTreebaseIDString(String message) { super(message); } } - private static final Map<Class,String> prefixFor = initializePrefixForMap(); - private static final Map<String,Class> classFor = initializeClassForMap(); + + private static final Map<Class<?>,String> prefixFor = initializePrefixForMap(); + private static final Map<String,Class<?>> classFor = initializeClassForMap(); + private String mTypePrefix; + private Long mId; + // These are the canonical prefixes - private static Map<Class, String> initializePrefixForMap() { - Map<Class, String> val = new HashMap<Class, String> (); + private static Map<Class<?>, String> initializePrefixForMap() { + Map<Class<?>, String> val = new HashMap<Class<?>, String> (); val.put(Study.class, "S"); val.put(Matrix.class, "M"); + val.put(PhyloChar.class, "C"); + val.put(DiscreteCharState.class, "Dcs"); + val.put(DiscreteMatrixElement.class, "Dme"); val.put(PhyloTree.class, "Tr"); val.put(PhyloTreeNode.class, "Tn"); + val.put(TreeBlock.class, "Tb"); val.put(Taxon.class, "Tx"); val.put(TaxonLabel.class, "Tl"); + val.put(TaxonLabelSet.class, "Tls"); val.put(TaxonVariant.class, "Tv"); val.put(Analysis.class, "A"); val.put(AnalysisStep.class, "As"); @@ -50,31 +65,28 @@ // and also some aliases. // For example, the application will always use "Tr1000" as the ID string for PhyloTree 1000 // but it will accept "T1000" as an alias. - private static Map<String, Class> initializeClassForMap() { - Map<String, Class> val = new HashMap<String, Class> (); - for (Map.Entry<Class, String> e : prefixFor.entrySet()) { + private static Map<String, Class<?>> initializeClassForMap() { + Map<String, Class<?>> val = new HashMap<String, Class<?>> (); + for (Map.Entry<Class<?>, String> e : prefixFor.entrySet()) { val.put(e.getValue(), e.getKey()); } val.put("T", PhyloTree.class); return val; } - String typePrefix; - Long id; - public TreebaseIDString(String typePrefix, Long id) { - this.typePrefix = typePrefix; - this.id = id; + mTypePrefix = typePrefix; + mId = id; } - public TreebaseIDString(Class typeClass, Long id) { - this.typePrefix = getPrefixForClass(typeClass); - this.id = id; + public TreebaseIDString(Class<?> typeClass, Long id) { + mTypePrefix = getPrefixForClass(typeClass); + mId = id; } public TreebaseIDString(TBPersistable tbObj) { - this.typePrefix = getPrefixForClass(tbObj.getClass()); - this.id = tbObj.getId(); + mTypePrefix = getPrefixForClass(tbObj.getClass()); + mId = tbObj.getId(); } /** @@ -97,43 +109,44 @@ * @param mustMatch - if set, an exception is thrown if the type prefix in ids does not match the defaultClass * @throws MalformedTreebaseIDString */ - public TreebaseIDString(String ids, Class defaultClass, boolean mustMatch) throws MalformedTreebaseIDString { + public TreebaseIDString(String ids, Class<?> defaultClass, boolean mustMatch) throws MalformedTreebaseIDString { try { - this.parseWithoutSemanticChecks(ids); + parseWithoutSemanticChecks(ids); } catch (NumberFormatException e) { throw new MalformedTreebaseIDString(ids); } - if (this.getId() == null) throw new MalformedTreebaseIDString(ids); + if (getId() == null) throw new MalformedTreebaseIDString(ids); // If there was no prefix, try to infer one - if (this.getTypePrefix() == null || this.getTypePrefix().equals("")) { - this.typePrefix = getPrefixForClass(defaultClass); - if (this.getTypePrefix() == null) + if (getTypePrefix() == null || getTypePrefix().equals("")) { + mTypePrefix = getPrefixForClass(defaultClass); + if (getTypePrefix() == null) throw new MalformedTreebaseIDString(ids); } else { // also validate as usual - this.validateTypePrefix(); + validateTypePrefix(); // If requested, make sure the prefix matches the requested class - if (mustMatch) - if (getClassForPrefix(this.getTypePrefix()) != defaultClass) + if ( mustMatch ) { + if (getClassForPrefix(getTypePrefix()) != defaultClass) { throw new MalformedTreebaseIDString(ids + " has wrong prefix; should be " + getPrefixForClass(defaultClass)); + } + } } } - public TreebaseIDString(String string, Class class1) throws MalformedTreebaseIDString { + public TreebaseIDString(String string, Class<?> class1) throws MalformedTreebaseIDString { this(string, class1, false); } public TreebaseIDString(String ids) throws MalformedTreebaseIDString { try { - this.parseWithoutSemanticChecks(ids); + parseWithoutSemanticChecks(ids); } catch (NumberFormatException e) { throw new MalformedTreebaseIDString(ids); - } - - this.validateTypePrefix(); + } + validateTypePrefix(); } @@ -177,8 +190,8 @@ if (i < ids.length()) throw new MalformedTreebaseIDString("..." + ids.substring(i)); - this.id = Long.parseLong(digits.toString()); - this.typePrefix = prefix.toString(); + mId = Long.parseLong(digits.toString()); + mTypePrefix = prefix.toString(); } String getIDString() { @@ -217,7 +230,7 @@ * @param prefix * @return */ - public static Class getClassForPrefix(String prefix) { + public static Class<?> getClassForPrefix(String prefix) { return classFor.get(prefix); } @@ -230,7 +243,7 @@ * @param cl - the class * @return */ - public static String getPrefixForClass(Class cl) { + public static String getPrefixForClass(Class<?> cl) { return prefixFor.get(cl); } @@ -279,19 +292,41 @@ * @param idString * @return */ - public static Class getClassForIDString(String idString) { + public static Class<?> getClassForIDString(String idString) { return getClassForPrefix(getPrefixOf(idString)); } public String getTypePrefix() { - return typePrefix; + return mTypePrefix; } public Long getId() { - return id; + return mId; } - public Class getTBClass() { + public Class<?> getTBClass() { return getClassForPrefix(getTypePrefix()); } + + /** + * This creates a GUID of the form TB2:${mTypePrefix}${mId}, which is the + * minimal recommendation for, for example, dc:identifier annotations. + * Additional blogging by Rod Page and others about this suggests there + * should be a delimiter between mTypePrefix and mId so that we'd end up + * with id's that look like TB2:Tr:2131, which could then be mapped onto + * purls. But doing that would break our backward compatibility with older + * records, files, etc. + * + * @return + */ + public NamespacedGUID getNamespacedGUID() { + StringBuilder sb = new StringBuilder(); + sb + .append(NamespacedGUID.getDefaultGUIDPrefix()) + .append(getTypePrefix()) + .append(getId()); + return new NamespacedGUID(sb.toString()); + } + + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2009-06-23 11:12:52
|
Revision: 84 http://treebase.svn.sourceforge.net/treebase/?rev=84&view=rev Author: rvos Date: 2009-06-23 11:12:31 +0000 (Tue, 23 Jun 2009) Log Message: ----------- Added facility to specify which content type the produced file is (default: "application/x-unknown") Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/WebUtil.java Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/WebUtil.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/WebUtil.java 2009-06-23 11:10:53 UTC (rev 83) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/util/WebUtil.java 2009-06-23 11:12:31 UTC (rev 84) @@ -257,31 +257,43 @@ public static String downloadFile(HttpServletResponse response, String dirPath, String filename) throws Exception { + return downloadFile(response,dirPath,filename,null); + } + + public static String downloadFile(HttpServletResponse response, String dirPath, String filename, String contentType) + throws Exception { // to download the file outside of the webapp, we need to call a servlet // that opens and read the file and display the output to the response object - + /** * allow a popup dialog to downlaod the result file */ byte[] bytes = WebUtil.getBytesFromFile(dirPath, filename); - + response.reset(); - // response.setContentType("application/octet-stream"); // this forces to be downloaded as a - // binary file - response.setContentType("application/x-unknown"); // this forces to be downloaded as type - // of the extension (e.g NEX file for - // *.nex) - response.setHeader("Content-Disposition", "inline;filename=" + "\"" + filename + "\""); - response.setContentType("text/plain"); // offer users option to view or save the file - response.setHeader("Content-Disposition", "attachment; filename=" + filename); + + if ( null == contentType ) { + // response.setContentType("application/octet-stream"); // this forces to be downloaded as a + // binary file + response.setContentType("application/x-unknown"); // this forces to be downloaded as type + // of the extension (e.g NEX file for + // *.nex) + response.setHeader("Content-Disposition", "inline;filename=" + "\"" + filename + "\""); + response.setContentType("text/plain"); // offer users option to view or save the file + response.setHeader("Content-Disposition", "attachment; filename=" + filename); + } + else { + response.setContentType(contentType); + } + response.setContentLength(bytes.length); - + OutputStream outputStream = response.getOutputStream(); outputStream.write(bytes, 0, bytes.length); outputStream.flush(); outputStream.close(); - + return null; - } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2009-06-23 11:09:07
|
Revision: 81 http://treebase.svn.sourceforge.net/treebase/?rev=81&view=rev Author: rvos Date: 2009-06-23 11:08:34 +0000 (Tue, 23 Jun 2009) Log Message: ----------- Adding AbstractDownloadController, a superclass for MVC controllers that generate downloadable files (nexus,nexml) Added Paths: ----------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AbstractDownloadController.java Added: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AbstractDownloadController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AbstractDownloadController.java (rev 0) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/AbstractDownloadController.java 2009-06-23 11:08:34 UTC (rev 81) @@ -0,0 +1,119 @@ +package org.cipres.treebase.web.controllers; + +import java.io.File; +import java.io.FileWriter; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.cipres.treebase.TreebaseUtil; +import org.cipres.treebase.domain.nexus.NexusService; +import org.cipres.treebase.web.util.WebUtil; +import org.springframework.web.servlet.mvc.Controller; + +public abstract class AbstractDownloadController implements Controller { + protected String mFormatParameter = "format"; + protected static final int FORMAT_NEXUS = 1; + protected static final int FORMAT_NEXML = 2; + private NexusService mNexmlService; + private static String mNexmlContentType = "application/xml"; + + /** + * + * @param request + * @return + */ + protected int getFormat (HttpServletRequest request) { + String requestedFormat = request.getParameter(mFormatParameter); + if ( null != requestedFormat ) { + if ( requestedFormat.equalsIgnoreCase("nexml") ) { + return FORMAT_NEXML; + } + else { + return FORMAT_NEXUS; // default + } + } + else { + return FORMAT_NEXUS; // default + } + } + + /** + * + * @param objectId + * @param request + * @return + */ + protected String getFileName(long id,HttpServletRequest request) { + if ( getFormat(request) == FORMAT_NEXML ) { + return getFileNamePrefix() + id + ".xml"; + } + return getFileNamePrefix() + id + ".nex"; + } + + /** + * + * @return a context-dependent prefix (e.g. "M" for a matrix) + */ + protected abstract String getFileNamePrefix(); + + /** + * + * @return a context-dependent serialization (e.g. a nexus string) + */ + protected abstract String getFileContent(long objectId,HttpServletRequest request); + + protected String getDownloadDir (HttpServletRequest request) { + String downloadDir = request.getSession().getServletContext().getRealPath( + TreebaseUtil.FILESEP + "NexusFileDownload") + + TreebaseUtil.FILESEP + request.getRemoteUser(); + return downloadDir; + } + + /** + * + * @param request + * @param pFileContent + * @param objectId + * @param downloadDirName + */ + protected void generateAFileDynamically(HttpServletRequest request, HttpServletResponse response, long objectId) { + String downloadDirName = getDownloadDir(request); + File dirPath = new File(downloadDirName); + if (!dirPath.exists()) { + dirPath.mkdirs(); + } + String fileName = getFileName(objectId,request); + try { + File file = new File(downloadDirName + TreebaseUtil.FILESEP + fileName); + FileWriter out = new FileWriter(file); + out.write(getFileContent(objectId,request)); + out.close(); + if ( getFormat(request) == FORMAT_NEXML ) { + WebUtil.downloadFile(response, downloadDirName, fileName, mNexmlContentType); + } + else { + WebUtil.downloadFile(response, downloadDirName, fileName); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * + * @return + */ + public NexusService getNexmlService() { + return mNexmlService; + } + + /** + * + * @param nexmlService + */ + public void setNexmlService(NexusService nexmlService) { + mNexmlService = nexmlService; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2009-06-23 11:04:15
|
Revision: 78 http://treebase.svn.sourceforge.net/treebase/?rev=78&view=rev Author: rvos Date: 2009-06-23 11:03:39 +0000 (Tue, 23 Jun 2009) Log Message: ----------- Adding helper class for RDFa compliant "GUIDs" Added Paths: ----------- trunk/treebase-core/src/main/java/org/cipres/treebase/NamespacedGUID.java Added: trunk/treebase-core/src/main/java/org/cipres/treebase/NamespacedGUID.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/NamespacedGUID.java (rev 0) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/NamespacedGUID.java 2009-06-23 11:03:39 UTC (rev 78) @@ -0,0 +1,52 @@ +package org.cipres.treebase; + +import org.cipres.treebase.TreebaseIDString.MalformedTreebaseIDString; + +/** + * Helper class for TreebaseIDString + * + * @author rvosa + * + */ +public class NamespacedGUID { + private String mMamespacedIDString; + public static final String NAMING_AUTHORITY_PREFIX_TB1 = "TB1"; + public static final String NAMING_AUTHORITY_PREFIX_TB2 = "TB2"; + public static final String GUID_DELIMITER = ":"; + + /** + * @param a fully qualified treebase ID, e.g. TB2:Tr2312 + */ + public NamespacedGUID(String namespacedIDString) { + mMamespacedIDString = namespacedIDString; + } + + /** + * @return a fully qualified treebase ID, e.g. TB2:Tr2312 + */ + public String toString() { + return mMamespacedIDString; + } + + /** + * + * @return A local TreebaseIDString, e.g. Tr2312 + * @throws MalformedTreebaseIDString + */ + public TreebaseIDString getTreebaseIDString () throws MalformedTreebaseIDString { + StringBuilder sb = new StringBuilder(); + sb + .append(NAMING_AUTHORITY_PREFIX_TB2) + .append(GUID_DELIMITER); + TreebaseIDString treebaseIDString = new TreebaseIDString(mMamespacedIDString.substring(sb.length())); + return treebaseIDString; + } + + /** + * @return Returns whatever is normally used to make treebase id's globally unique + */ + public static String getDefaultGUIDPrefix () { + return NAMING_AUTHORITY_PREFIX_TB2 + GUID_DELIMITER; + } + +} \ 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...> - 2009-06-23 10:59:29
|
Revision: 77 http://treebase.svn.sourceforge.net/treebase/?rev=77&view=rev Author: rvos Date: 2009-06-23 10:59:03 +0000 (Tue, 23 Jun 2009) Log Message: ----------- Commenting out DomainHome fields: we don't need persistence, but the interface wants us to have the methods. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/service/nexus/NexusServiceNexml.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/service/nexus/NexusServiceNexml.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/service/nexus/NexusServiceNexml.java 2009-06-23 10:57:15 UTC (rev 76) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/service/nexus/NexusServiceNexml.java 2009-06-23 10:59:03 UTC (rev 77) @@ -20,22 +20,24 @@ public class NexusServiceNexml extends AbstractServiceImpl implements NexusService { private static final Logger LOGGER = Logger.getLogger(NexusServiceNexml.class); - private DomainHome mDomainHome; +// private DomainHome mDomainHome; private TaxonLabelHome mTaxonLabelHome; @Override - public Class defaultResultClass() { + public Class<?> defaultResultClass() { return null; } @Override protected DomainHome getDomainHome() { - return mDomainHome; + return null; // do not need persistence service. } + /* public void setDomainHome(DomainHome domainHome) { mDomainHome = domainHome; } + */ public NexusDataSet parseNexus(Study study, Collection<File> nexusFiles, ProgressionListener listener) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2009-06-23 10:56:33
|
Revision: 75 http://treebase.svn.sourceforge.net/treebase/?rev=75&view=rev Author: rvos Date: 2009-06-23 10:56:13 +0000 (Tue, 23 Jun 2009) Log Message: ----------- Fix: now no longer returns TreeBlocknull as a default title. Instead, if getId() returns a value, return a TreebaseIDString, otherwise return null. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/TreeBlock.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/TreeBlock.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/TreeBlock.java 2009-06-23 10:54:08 UTC (rev 74) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/tree/TreeBlock.java 2009-06-23 10:56:13 UTC (rev 75) @@ -39,6 +39,7 @@ import mesquite.lib.StringUtil; +import org.cipres.treebase.TreebaseIDString; import org.cipres.treebase.TreebaseUtil; import org.cipres.treebase.domain.AbstractPersistedObject; import org.cipres.treebase.domain.TBPersistable; @@ -88,8 +89,11 @@ if ( ! TreebaseUtil.isEmpty(mTitle) ) { return mTitle; } + else if ( null != getId() ){ + return TreebaseIDString.getIDString(this); + } else { - return "TreeBlock" + getId(); + return null; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2009-06-23 10:52:29
|
Revision: 73 http://treebase.svn.sourceforge.net/treebase/?rev=73&view=rev Author: rvos Date: 2009-06-23 10:52:08 +0000 (Tue, 23 Jun 2009) Log Message: ----------- Now emit valid nexml. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlDocumentConverter.java trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixConverter.java trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlOTUConverter.java trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlObjectConverter.java trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlTreeBlockConverter.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlDocumentConverter.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlDocumentConverter.java 2009-06-23 10:50:48 UTC (rev 72) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlDocumentConverter.java 2009-06-23 10:52:08 UTC (rev 73) @@ -1,6 +1,7 @@ package org.cipres.treebase.domain.nexus.nexml; import org.cipres.treebase.domain.admin.Person; +import org.cipres.treebase.domain.matrix.CharacterMatrix; import org.cipres.treebase.domain.nexus.NexusDataSet; import org.cipres.treebase.domain.study.ArticleCitation; import org.cipres.treebase.domain.study.Citation; @@ -69,7 +70,9 @@ NexmlMatrixConverter nmc = new NexmlMatrixConverter(getStudy(),getTaxonLabelHome(),getDocument()); for (org.cipres.treebase.domain.matrix.Matrix matrix : pNexusDataSet.getMatrices() ) { - nmc.fromTreeBaseToXml(matrix); + if ( matrix instanceof CharacterMatrix ) { + nmc.fromTreeBaseToXml((CharacterMatrix)matrix); + } } NexmlTreeBlockConverter ntc = new NexmlTreeBlockConverter(getStudy(),getTaxonLabelHome(),getDocument()); @@ -87,22 +90,40 @@ * @param document */ private void copyCitationMetadata(Citation citation,Document document) { - attachAnnotation("prism:publicationDate",citation.getPublishYear().toString(),mPrismURI,document); - attachAnnotation("prism:doi",citation.getDoi(),mPrismURI,document); - String[] pages = citation.getPages().split("-"); - if ( pages.length > 2 ) { - attachAnnotation("prism:startingPage",pages[0],mPrismURI,document); - attachAnnotation("prism:endingPage",pages[1],mPrismURI,document); - attachAnnotation("prism:pageRange",citation.getPages(),mPrismURI,document); + if ( null != citation.getTitle() ) { + attachAnnotation("dc:title",citation.getTitle(),mPrismURI,document); } - String[] keywords = citation.getKeywords().split(", "); - for ( int i = 0; i < keywords.length; i++ ) { - attachAnnotation("prism:keyword",keywords[i],mPrismURI,document); - } + if ( null != citation.getPublishYear() ) { + attachAnnotation("prism:publicationDate",citation.getPublishYear().toString(),mPrismURI,document); + } + if ( null != citation.getDoi() ) { + attachAnnotation("prism:doi",citation.getDoi(),mPrismURI,document); + } + if ( null != citation.getPages() ) { + String[] pages = citation.getPages().split("\\-"); + if ( pages.length == 2 ) { + attachAnnotation("prism:startingPage",pages[0],mPrismURI,document); + attachAnnotation("prism:endingPage",pages[1],mPrismURI,document); + attachAnnotation("prism:pageRange",citation.getPages(),mPrismURI,document); + } + } + if ( null != citation.getKeywords() ) { + String[] keywords = citation.getKeywords().split(", "); + for ( int i = 0; i < keywords.length; i++ ) { + attachAnnotation("prism:keyword",keywords[i],mPrismURI,document); + } + } if ( citation instanceof ArticleCitation ) { - attachAnnotation("prism:publicationName",((ArticleCitation)citation).getJournal(),mPrismURI,document); - attachAnnotation("prism:volume",((ArticleCitation)citation).getVolume(),mPrismURI,document); - attachAnnotation("prism:number",((ArticleCitation)citation).getIssue(),mPrismURI,document); + ArticleCitation ac = (ArticleCitation)citation; + if ( null != ac.getJournal() ) { + attachAnnotation("prism:publicationName",ac.getJournal(),mPrismURI,document); + } + if ( null != ac.getVolume() ) { + attachAnnotation("prism:volume",ac.getVolume(),mPrismURI,document); + } + if ( null != ac.getIssue() ) { + attachAnnotation("prism:number",ac.getIssue(),mPrismURI,document); + } } } @@ -112,22 +133,7 @@ * @return */ public Document fromTreeBaseToXml(Study pStudy) { - attachTreeBaseID(getDocument(), pStudy); - attachAnnotation("dc:title", pStudy.getName(), mDCURI, getDocument()); - attachAnnotation("dc:abstract",pStudy.getCitation().getAbstract(), mDCURI,getDocument()); - attachAnnotation( - "dc:creator", - pStudy.getSubmission().getSubmitter().getPerson().getFullNameCitationStyle(), - mDCURI, - getDocument() - ); - for ( Person person : pStudy.getAuthors() ) { - String personName = person.getFullNameCitationStyle(); - attachAnnotation("dc:contributor",personName,mDCURI,getDocument()); - } - attachAnnotation("prism:creationDate",pStudy.getSubmission().getCreateDate().toString(),mPrismURI,getDocument()); - attachAnnotation("prism:embargoDate",pStudy.getReleaseDate().toString(),mPrismURI,getDocument()); - copyCitationMetadata(pStudy.getCitation(),getDocument()); + copyMetadata(pStudy); NexmlOTUConverter noc = new NexmlOTUConverter(getStudy(),getTaxonLabelHome(),getDocument()); for ( TaxonLabelSet taxonLabelSet : pStudy.getTaxonLabelSets() ) { @@ -136,14 +142,48 @@ NexmlMatrixConverter nmc = new NexmlMatrixConverter(getStudy(),getTaxonLabelHome(),getDocument()); for (org.cipres.treebase.domain.matrix.Matrix matrix : pStudy.getMatrices() ) { - nmc.fromTreeBaseToXml(matrix); + if ( matrix instanceof CharacterMatrix ) { + nmc.fromTreeBaseToXml((CharacterMatrix)matrix); + } } NexmlTreeBlockConverter ntc = new NexmlTreeBlockConverter(getStudy(),getTaxonLabelHome(),getDocument()); for ( org.cipres.treebase.domain.tree.TreeBlock treeBlock : pStudy.getTreeBlocks() ) { ntc.fromTreeBaseToXML(treeBlock); } + return getDocument(); } + private void copyMetadata(Study pStudy) { + attachTreeBaseID(getDocument(), pStudy,Study.class); + if ( null != pStudy.getName() ) { + attachAnnotation("dc:title", pStudy.getName(), mDCURI, getDocument()); + } + for ( Person person : pStudy.getAuthors() ) { + String personName = person.getFullNameCitationStyle(); + attachAnnotation("dc:contributor",personName,mDCURI,getDocument()); + } + if ( null != pStudy.getReleaseDate() ) { + attachAnnotation("prism:embargoDate",pStudy.getReleaseDate().toString(),mPrismURI,getDocument()); + } + if ( null != pStudy.getSubmission() ) { + if ( null != pStudy.getSubmission().getSubmitter() ) { + attachAnnotation( + "dc:creator", + pStudy.getSubmission().getSubmitter().getPerson().getFullNameCitationStyle(), + mDCURI, + getDocument() + ); + } + if ( null != pStudy.getSubmission().getCreateDate() ) { + attachAnnotation("prism:creationDate",pStudy.getSubmission().getCreateDate().toString(),mPrismURI,getDocument()); + } + } + if ( null != pStudy.getCitation() ) { + //attachAnnotation("dc:abstract",forXML(pStudy.getCitation().getAbstract()), mDCURI,getDocument()); + copyCitationMetadata(pStudy.getCitation(),getDocument()); + } + } + } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixConverter.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixConverter.java 2009-06-23 10:50:48 UTC (rev 72) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlMatrixConverter.java 2009-06-23 10:52:08 UTC (rev 73) @@ -2,29 +2,45 @@ import java.util.ArrayList; import java.util.List; + import org.cipres.treebase.dao.jdbc.ContinuousMatrixElementJDBC; import org.cipres.treebase.dao.jdbc.ContinuousMatrixJDBC; import org.cipres.treebase.dao.jdbc.DiscreteMatrixElementJDBC; import org.cipres.treebase.dao.jdbc.DiscreteMatrixJDBC; import org.cipres.treebase.dao.jdbc.MatrixColumnJDBC; +import org.cipres.treebase.domain.matrix.CharacterMatrix; import org.cipres.treebase.domain.matrix.ContinuousChar; +import org.cipres.treebase.domain.matrix.ContinuousMatrix; +import org.cipres.treebase.domain.matrix.ContinuousMatrixElement; import org.cipres.treebase.domain.matrix.DiscreteChar; +import org.cipres.treebase.domain.matrix.DiscreteCharState; import org.cipres.treebase.domain.matrix.DiscreteMatrix; +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.MatrixDataType; +import org.cipres.treebase.domain.matrix.MatrixElement; +import org.cipres.treebase.domain.matrix.MatrixRow; +import org.cipres.treebase.domain.matrix.PhyloChar; +import org.cipres.treebase.domain.matrix.StandardMatrix; import org.cipres.treebase.domain.study.Study; import org.cipres.treebase.domain.taxon.TaxonLabelHome; import org.cipres.treebase.domain.taxon.TaxonLabelSet; import org.nexml.model.Annotatable; import org.nexml.model.CategoricalMatrix; import org.nexml.model.CharacterState; -import org.nexml.model.ContinuousMatrix; +import org.nexml.model.CharacterStateSet; import org.nexml.model.Document; import org.nexml.model.MatrixCell; +import org.nexml.model.MolecularMatrix; import org.nexml.model.OTUs; import org.nexml.model.OTU; public class NexmlMatrixConverter extends NexmlObjectConverter { + private static final int MAX_GRANULAR_NCHAR = 1000; + private static final int MAX_GRANULAR_NTAX = 30; + /** * * @param study @@ -56,6 +72,7 @@ columnJDBCs.add(aColumnJDBC); int rowIndex = 0; for ( OTU xmlOTU : xmlMatrix.getOTUs().getAllOTUs() ) { + @SuppressWarnings("unused") MatrixCell<CharacterState> xmlCell = xmlMatrix.getCell(xmlOTU, xmlCharacter); DiscreteMatrixElementJDBC element = new DiscreteMatrixElementJDBC(); //element.setValue(xmlCell.getValue()); // XXX nested stateset lookup song & dance here @@ -76,9 +93,8 @@ * @param xmlMatrix * @return */ - public Matrix fromXmlToTreeBase(ContinuousMatrix xmlMatrix) { - org.cipres.treebase.domain.matrix.ContinuousMatrix tbMatrix = - new org.cipres.treebase.domain.matrix.ContinuousMatrix(); + public Matrix fromXmlToTreeBase(org.nexml.model.ContinuousMatrix xmlMatrix) { + ContinuousMatrix tbMatrix = new ContinuousMatrix(); ContinuousMatrixJDBC matrixJDBC = new ContinuousMatrixJDBC(tbMatrix, xmlMatrix, this); List<MatrixColumnJDBC> columnJDBCs = new ArrayList<MatrixColumnJDBC>(); long[] colIds = matrixJDBC.getColIDs(); @@ -119,7 +135,7 @@ OTUs xmlOTUs = xmlMatrix.getOTUs(); Matrix tbMatrix = null; TaxonLabelSet tbTaxa = null; - Long tbTaxonLabelSetID = readTreeBaseID((Annotatable) xmlOTUs,TaxonLabelSet.class); + Long tbTaxonLabelSetID = readTreeBaseID((Annotatable) xmlOTUs); if ( null != tbTaxonLabelSetID ) { tbTaxa = getTaxonLabelHome() .findPersistedObjectByID(TaxonLabelSet.class, tbTaxonLabelSetID); @@ -127,11 +143,11 @@ if ( xmlMatrix instanceof CategoricalMatrix ) { tbMatrix = fromXmlToTreeBase((CategoricalMatrix) xmlMatrix); } - else if ( xmlMatrix instanceof ContinuousMatrix ) { - tbMatrix = fromXmlToTreeBase((ContinuousMatrix) xmlMatrix); + else if ( xmlMatrix instanceof org.nexml.model.ContinuousMatrix ) { + tbMatrix = fromXmlToTreeBase((org.nexml.model.ContinuousMatrix) xmlMatrix); } if ( null != tbMatrix ) { - attachTreeBaseID((Annotatable) xmlMatrix, tbMatrix); + attachTreeBaseID((Annotatable) xmlMatrix, tbMatrix,Matrix.class); if ( null != tbTaxa ) { tbMatrix.setTaxa(tbTaxa); } @@ -142,21 +158,192 @@ return tbMatrix; } - public org.nexml.model.Matrix<?> fromTreeBaseToXml(Matrix tbMatrix) { - TaxonLabelSet taxonLabelSet = tbMatrix.getTaxa(); - Long taxonLabelSetId = taxonLabelSet.getId(); - OTUs xmlOTUs = null; - for ( OTUs otus : getDocument().getOTUsList() ) { - Long annotatedID = readTreeBaseID(otus, TaxonLabelSet.class); - if ( taxonLabelSetId == annotatedID ) { - xmlOTUs = otus; - break; + /** + * Creates and populates characters (i.e. columns) with their annotations, + * and state sets, with their annotations + * + * @param tbMatrix + * @return an xml matrix with empty rows + */ + public CategoricalMatrix fromTreeBaseToXml(StandardMatrix tbMatrix) { + OTUs xmlOTUs = getOTUsById(tbMatrix.getTaxa().getId()); + CategoricalMatrix xmlMatrix = getDocument().createCategoricalMatrix(xmlOTUs); + List<List<DiscreteCharState>> tbStateLabels = tbMatrix.getStateLabels(); + List<MatrixColumn> tbColumns = tbMatrix.getColumnsReadOnly(); + for ( int i = 0; i < tbColumns.size(); i++ ) { + CharacterStateSet xmlStateSet = xmlMatrix.createCharacterStateSet(); + for ( DiscreteCharState tbState : tbStateLabels.get(i) ) { + CharacterState xmlState = xmlStateSet.createCharacterState(tbState.getSymbol().toString()); + if ( null != tbState.getDescription() ) { + xmlState.setLabel(tbState.getDescription()); + } + if ( null != tbState.getNotes() ) { + ((Annotatable)xmlState).addAnnotationValue("dc:description", mDCURI, tbState.getNotes()); + } + attachTreeBaseID((Annotatable)xmlState,tbState,DiscreteCharState.class); + } + org.nexml.model.Character xmlCharacter = xmlMatrix.createCharacter(xmlStateSet); + PhyloChar tbCharacter = tbColumns.get(i).getCharacter(); + if ( null != tbCharacter.getDescription() ) { + xmlCharacter.setLabel(tbCharacter.getDescription()); + } + attachTreeBaseID((Annotatable)xmlCharacter,tbCharacter,PhyloChar.class); + } + return xmlMatrix; + } + + /** + * Creates and populates characters (i.e. columns) with their annotations, + * and state sets, with their annotations + * + * @param tbMatrix + * @return an xml matrix with empty rows + */ + public MolecularMatrix fromTreeBaseToXml(DiscreteMatrix tbMatrix) { + OTUs xmlOTUs = getOTUsById(tbMatrix.getTaxa().getId()); + String tbDataType = tbMatrix.getDataType().getDescription(); + MolecularMatrix xmlMatrix = null; + CharacterStateSet xmlStateSet = null; + if ( tbDataType.equals(MatrixDataType.MATRIX_DATATYPE_DNA) ) { + xmlMatrix = getDocument().createMolecularMatrix(xmlOTUs, MolecularMatrix.DNA); + xmlStateSet = ((MolecularMatrix)xmlMatrix).getDNACharacterStateSet(); + } + else if ( tbDataType.equals(MatrixDataType.MATRIX_DATATYPE_RNA) ) { + xmlMatrix = getDocument().createMolecularMatrix(xmlOTUs, MolecularMatrix.RNA); + xmlStateSet = ((MolecularMatrix)xmlMatrix).getRNACharacterStateSet(); + } + else if ( tbDataType.equals(MatrixDataType.MATRIX_DATATYPE_PROTEIN) ) { + xmlMatrix = getDocument().createMolecularMatrix(xmlOTUs, MolecularMatrix.Protein); + xmlStateSet = ((MolecularMatrix)xmlMatrix).getProteinCharacterStateSet(); + } + for ( MatrixColumn tbColumn : tbMatrix.getColumnsReadOnly() ) { + org.nexml.model.Character xmlCharacter = xmlMatrix.createCharacter(xmlStateSet); + PhyloChar tbCharacter = tbColumn.getCharacter(); + if ( null != tbCharacter.getDescription() && ! tbCharacter.getDescription().equals(tbDataType) ) { + ((Annotatable)xmlCharacter).addAnnotationValue("dc:description", mDCURI, tbCharacter.getDescription()); + } + if ( null != tbCharacter.getId() && tbCharacter.getId() != 2 ) { // XXX is PhyloChar.id 2 some sort of magic number? + attachTreeBaseID((Annotatable)xmlCharacter,tbCharacter,PhyloChar.class); } } - org.nexml.model.Matrix<?> xmlMatrix = getDocument().createCategoricalMatrix(xmlOTUs); + return xmlMatrix; + } + + /** + * Creates and populates characters (i.e. columns) with their annotations, + * and state sets, with their annotations + * + * @param tbMatrix + * @return an xml matrix with empty rows + */ + public org.nexml.model.ContinuousMatrix fromTreeBaseToXml(ContinuousMatrix tbMatrix) { + OTUs xmlOTUs = getOTUsById(tbMatrix.getTaxa().getId()); + org.nexml.model.ContinuousMatrix xmlMatrix = getDocument().createContinuousMatrix(xmlOTUs); + for ( MatrixColumn tbColumn : tbMatrix.getColumnsReadOnly() ) { + org.nexml.model.Character xmlCharacter = xmlMatrix.createCharacter(); + PhyloChar tbCharacter = tbColumn.getCharacter(); + if ( null != tbCharacter.getDescription() ) { + ((Annotatable)xmlCharacter).addAnnotationValue("dc:description", mDCURI, tbCharacter.getDescription()); + } + attachTreeBaseID((Annotatable)xmlCharacter,tbCharacter,PhyloChar.class); + } + 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) { + org.nexml.model.Matrix<?> xmlMatrix = null; + if ( tbMatrix instanceof DiscreteMatrix ) { + if ( tbMatrix.getDataType().getDescription().equals(MatrixDataType.MATRIX_DATATYPE_STANDARD) ) { + xmlMatrix = fromTreeBaseToXml((StandardMatrix) tbMatrix); + } + else { + xmlMatrix = fromTreeBaseToXml((DiscreteMatrix) tbMatrix); + } + populateXmlMatrix((org.nexml.model.Matrix<CharacterState>)xmlMatrix,(DiscreteMatrix)tbMatrix); + } + else if ( tbMatrix instanceof ContinuousMatrix ) { + xmlMatrix = fromTreeBaseToXml((ContinuousMatrix) tbMatrix); + populateXmlMatrix((org.nexml.model.ContinuousMatrix)xmlMatrix,(ContinuousMatrix)tbMatrix); + } xmlMatrix.setLabel(tbMatrix.getTitle()); - attachTreeBaseID((Annotatable)xmlMatrix, tbMatrix); + attachTreeBaseID((Annotatable)xmlMatrix, tbMatrix,Matrix.class); return xmlMatrix; } + /** + * + * @param xmlMatrix + * @param tbMatrix + * @param xmlOTUs + * @param stateSet + */ + private void populateXmlMatrix( + org.nexml.model.Matrix<CharacterState> xmlMatrix, + DiscreteMatrix tbMatrix) { + OTUs xmlOTUs = xmlMatrix.getOTUs(); + List<org.nexml.model.Character> characterList = xmlMatrix.getCharacters(); + for ( MatrixRow row : tbMatrix.getRowsReadOnly() ) { + OTU xmlOTU = getOTUById(xmlOTUs, row.getTaxonLabel().getId()); + int charIndex = 0; + if ( characterList.size() <= MAX_GRANULAR_NCHAR && xmlOTUs.getAllOTUs().size() <= MAX_GRANULAR_NTAX ) { + for ( MatrixElement tbCell : row.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); + charIndex++; + } + } + else { + String seq = row.buildElementAsString(); + if ( tbMatrix.getDataType().getDescription().equals(MatrixDataType.MATRIX_DATATYPE_STANDARD) ) { + StringBuilder sb = new StringBuilder(); + for ( int i = 0; i < seq.length(); i++ ) { + sb.append(seq.charAt(i)); + if ( i < seq.length() - 1 ) { + sb.append(' '); + } + } + } + xmlMatrix.setSeq(seq,xmlOTU); + } + } + } + + /** + * + * @param xmlMatrix + * @param tbMatrix + */ + private void populateXmlMatrix(org.nexml.model.ContinuousMatrix xmlMatrix, + ContinuousMatrix tbMatrix) { + List<org.nexml.model.Character> characterList = xmlMatrix.getCharacters(); + OTUs xmlOTUs = xmlMatrix.getOTUs(); + for ( MatrixRow row : tbMatrix.getRowsReadOnly() ) { + List<MatrixElement> elements = row.getElements(); + OTU xmlOTU = getOTUById(xmlOTUs, row.getTaxonLabel().getId()); + if ( characterList.size() <= MAX_GRANULAR_NCHAR && xmlOTUs.getAllOTUs().size() <= MAX_GRANULAR_NTAX ) { + for ( int elementIndex = 0; elementIndex < tbMatrix.getnChar(); elementIndex++ ) { + ContinuousMatrixElement tbCell = (ContinuousMatrixElement)elements.get(elementIndex); + MatrixCell<Double> xmlCell = xmlMatrix.getCell(xmlOTU, characterList.get(elementIndex)); + xmlCell.setValue(tbCell.getValue()); + attachTreeBaseID((Annotatable)xmlCell,tbCell,DiscreteMatrixElement.class); + } + } + else { + String seq = row.buildElementAsString(); + xmlMatrix.setSeq(seq,xmlOTU); + } + } + } + } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlOTUConverter.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlOTUConverter.java 2009-06-23 10:50:48 UTC (rev 72) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlOTUConverter.java 2009-06-23 10:52:08 UTC (rev 73) @@ -27,9 +27,11 @@ */ public TaxonLabelSet fromXmlToTreeBase (OTUs xmlOTUs) { TaxonLabelSet labelSet = new TaxonLabelSet(); - attachTreeBaseID(xmlOTUs,labelSet); + attachTreeBaseID(xmlOTUs,labelSet,TaxonLabelSet.class); labelSet.setStudy(getStudy()); - labelSet.setTitle(xmlOTUs.getLabel()); + if ( null != xmlOTUs.getLabel() ) { + labelSet.setTitle(xmlOTUs.getLabel()); + } labelSet.setTaxa(true); for ( OTU xmlOTU : xmlOTUs.getAllOTUs() ) { TaxonLabel taxonLabel = fromXmlToTreeBase(xmlOTU); @@ -46,7 +48,7 @@ public OTUs fromTreeBaseToXml(TaxonLabelSet taxonLabelSet) { OTUs xmlOTUs = getDocument().createOTUs(); xmlOTUs.setLabel(taxonLabelSet.getTitle()); - attachTreeBaseID(xmlOTUs,taxonLabelSet); + attachTreeBaseID(xmlOTUs,taxonLabelSet,TaxonLabelSet.class); for ( TaxonLabel taxonLabel : taxonLabelSet.getTaxonLabelsReadOnly() ) { fromTreeBaseToXml(taxonLabel,xmlOTUs); } @@ -61,7 +63,7 @@ public TaxonLabel fromXmlToTreeBase(OTU xmlOTU) { TaxonLabel taxonLabel = getTaxonLabelHome().getByDescriptionAndStudy(xmlOTU.getLabel(), getStudy()); taxonLabel.setStudy(getStudy()); - attachTreeBaseID(xmlOTU,taxonLabel); + attachTreeBaseID(xmlOTU,taxonLabel,TaxonLabel.class); return taxonLabel; } @@ -73,8 +75,10 @@ */ public OTU fromTreeBaseToXml(TaxonLabel taxonLabel,OTUs xmlOTUs) { OTU xmlOTU = xmlOTUs.createOTU(); - xmlOTU.setLabel(taxonLabel.getTaxonLabel()); - attachTreeBaseID(xmlOTU,taxonLabel); + if ( null != taxonLabel.getTaxonLabel() ) { + xmlOTU.setLabel(taxonLabel.getTaxonLabel()); + } + attachTreeBaseID(xmlOTU,taxonLabel,TaxonLabel.class); if ( null != taxonLabel.getNcbiTaxID() ) { attachAnnotation("dc:identifier", "NCBI:" + taxonLabel.getNcbiTaxID(), mDCURI, xmlOTU); } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlObjectConverter.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlObjectConverter.java 2009-06-23 10:50:48 UTC (rev 72) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlObjectConverter.java 2009-06-23 10:52:08 UTC (rev 73) @@ -2,16 +2,22 @@ import java.net.URI; import java.net.URISyntaxException; +import java.text.CharacterIterator; +import java.text.StringCharacterIterator; import java.util.Iterator; import java.util.Set; import org.cipres.treebase.TreebaseIDString; +import org.cipres.treebase.NamespacedGUID; +import org.cipres.treebase.TreebaseIDString.MalformedTreebaseIDString; import org.cipres.treebase.domain.TBPersistable; import org.cipres.treebase.domain.nexus.AbstractNexusConverter; import org.cipres.treebase.domain.study.Study; import org.cipres.treebase.domain.taxon.TaxonLabelHome; import org.nexml.model.Annotatable; import org.nexml.model.Document; +import org.nexml.model.OTU; +import org.nexml.model.OTUs; public class NexmlObjectConverter extends AbstractNexusConverter { protected static URI mDCURI; @@ -44,14 +50,9 @@ * @param tbPersistable * @return */ - public String makeNamespacedID (TBPersistable tbPersistable) { - StringBuilder sb = new StringBuilder(); - sb - .append(TreeBASE2Prefix) - .append(':') - .append(TreebaseIDString.getPrefixForClass(tbPersistable.getClass())) - .append(tbPersistable.getId()); - return sb.toString(); + private String makeNamespacedID (TBPersistable tbPersistable,Class<?> persistableClass) { + TreebaseIDString tbIDString = new TreebaseIDString(persistableClass,tbPersistable.getId()); + return tbIDString.getNamespacedGUID().toString(); } /** @@ -59,8 +60,10 @@ * @param annotatable * @param tbPersistable */ - protected void attachTreeBaseID(Annotatable annotatable,TBPersistable tbPersistable) { - attachAnnotation(mDCIdentifier,makeNamespacedID(tbPersistable),mDCURI,annotatable); + protected void attachTreeBaseID(Annotatable annotatable,TBPersistable tbPersistable,Class<?> persistableClass) { + if ( null != tbPersistable.getId() ) { + attachAnnotation(mDCIdentifier,makeNamespacedID(tbPersistable,persistableClass),mDCURI,annotatable); + } } /** @@ -71,7 +74,7 @@ * @param annotatable */ protected void attachAnnotation(String key,String value,URI namespace,Annotatable annotatable) { - annotatable.addAnnotationValue(key, namespace, value); + annotatable.addAnnotationValue(key, namespace, value); // FIXME! Attaches meta element as last child } /** @@ -80,22 +83,49 @@ * @param persistableClass * @return */ - protected Long readTreeBaseID(Annotatable annotatable, Class<? extends TBPersistable> persistableClass) { - Set<Object> values = annotatable.getAnnotationValues(mDCIdentifier); - Iterator<Object> objectIterator = values.iterator(); + protected Long readTreeBaseID(Annotatable annotatable) { + + // this will return the value object associated with a + // dc:identifier predicate in a nexml meta annotation, + // e.g. <meta property="dc:identifier" content="TB2:Tr231"/> + // this will return something that stringifies to TB2:Tr231 + Set<Object> dublinCoreIdentifierObjects = annotatable.getAnnotationValues(mDCIdentifier); + Iterator<Object> objectIterator = dublinCoreIdentifierObjects.iterator(); while ( objectIterator.hasNext() ) { - String namespacedId = objectIterator.next().toString(); - StringBuffer prefix = new StringBuffer(); - prefix - .append(TreeBASE2Prefix) - .append(':') - .append(TreebaseIDString.getPrefixForClass(persistableClass)); - if ( namespacedId.startsWith(prefix.toString()) ) { - return Long.parseLong(namespacedId.substring(prefix.length())); + TreebaseIDString treebaseIDString = null; + NamespacedGUID namespacedGUID = null; + try { + namespacedGUID = new NamespacedGUID(objectIterator.next().toString()); + treebaseIDString = namespacedGUID.getTreebaseIDString(); + return treebaseIDString.getId(); + } catch ( MalformedTreebaseIDString e ) { + // XXX do nothing, it's OK, it means we're + // parsing an id from a different naming + // authority, e.g. uBio or NCBI } } return null; } + + protected OTUs getOTUsById(Long taxonLabelSetId) { + for ( OTUs otus : getDocument().getOTUsList() ) { + Long annotatedID = readTreeBaseID(otus); + if ( taxonLabelSetId.equals(annotatedID) ) { + return otus; + } + } + return null; + } + + protected OTU getOTUById(OTUs otus,Long taxonLabelId) { + for ( OTU otu : otus.getAllOTUs() ) { + Long annotatedID = readTreeBaseID(otu); + if ( taxonLabelId.equals(annotatedID) ) { + return otu; + } + } + return null; + } public Document getDocument() { return mDocument; @@ -104,4 +134,29 @@ public void setDocument(Document document) { mDocument = document; } + + public static String forXML(String aText){ + final StringBuilder result = new StringBuilder(); + final StringCharacterIterator iterator = new StringCharacterIterator(aText); + char character = iterator.current(); + while (character != CharacterIterator.DONE) { + if (character == '<') { + result.append("<"); + } else if (character == '>') { + result.append(">"); + } else if (character == '\"') { + result.append("""); + } else if (character == '\'') { + result.append("'"); + } else if (character == '&') { + result.append("&"); + } else { + //the char is not a special one + //add it to the result as is + result.append(character); + } + character = iterator.next(); + } + return result.toString(); + } } Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlTreeBlockConverter.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlTreeBlockConverter.java 2009-06-23 10:50:48 UTC (rev 72) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/nexus/nexml/NexmlTreeBlockConverter.java 2009-06-23 10:52:08 UTC (rev 73) @@ -17,6 +17,7 @@ import org.nexml.model.IntEdge; import org.nexml.model.Network; import org.nexml.model.Node; +import org.nexml.model.OTU; import org.nexml.model.OTUs; import org.nexml.model.Tree; @@ -38,7 +39,7 @@ */ public TreeBlock fromXmlToTreeBase(org.nexml.model.TreeBlock xmlTreeBlock) { OTUs xmlOTUs = xmlTreeBlock.getOTUs(); - Long tbTaxonLabelSetId = readTreeBaseID(xmlOTUs,TaxonLabelSet.class); + Long tbTaxonLabelSetId = readTreeBaseID(xmlOTUs); TreeBlock tbTreeBlock = new TreeBlock(); tbTreeBlock.setTitle(xmlTreeBlock.getLabel()); if ( null != tbTaxonLabelSetId ) { @@ -80,8 +81,10 @@ */ public Tree<?> fromTreeBaseToXml(PhyloTree phyloTree,org.nexml.model.TreeBlock xmlTreeBlock) { Tree<FloatEdge> xmlTree = xmlTreeBlock.createFloatTree(); - xmlTree.setLabel(phyloTree.getLabel()); - attachTreeBaseID(xmlTree, phyloTree); + if ( null != phyloTree.getLabel() ) { + xmlTree.setLabel(phyloTree.getLabel()); + } + attachTreeBaseID(xmlTree, phyloTree,PhyloTree.class); copyTreeBaseTree(phyloTree, xmlTree); return xmlTree; } @@ -93,18 +96,12 @@ */ public org.nexml.model.TreeBlock fromTreeBaseToXML(TreeBlock treeBlock) { TaxonLabelSet taxonLabelSet = treeBlock.getTaxonLabelSet(); - OTUs xmlOTUs = null; - Long taxonLabelSetId = taxonLabelSet.getId(); - for ( OTUs otus : getDocument().getOTUsList() ) { - Long otusId = readTreeBaseID(otus, TaxonLabelSet.class); - if ( taxonLabelSetId == otusId ) { - xmlOTUs = otus; - break; - } - } + OTUs xmlOTUs = getOTUsById(taxonLabelSet.getId()); org.nexml.model.TreeBlock xmlTreeBlock = getDocument().createTreeBlock(xmlOTUs); - xmlTreeBlock.setLabel(treeBlock.getTitle()); - attachTreeBaseID((Annotatable)xmlTreeBlock,treeBlock); + if ( null != treeBlock.getTitle() ) { + xmlTreeBlock.setLabel(treeBlock.getTitle()); + } + attachTreeBaseID((Annotatable)xmlTreeBlock,treeBlock,TreeBlock.class); for ( PhyloTree phyloTree : treeBlock.getTreeList() ) { fromTreeBaseToXml(phyloTree,xmlTreeBlock); } @@ -128,25 +125,27 @@ * @param xmlTree */ private void traverseTreeBaseTree(PhyloTree tbTree,PhyloTreeNode tbNode,Node xmlNode,Tree<FloatEdge> xmlTree) { - xmlNode.setLabel(tbNode.getName()); - attachTreeBaseID(xmlNode, tbNode); + if ( null != tbNode.getName() ) { + xmlNode.setLabel(tbNode.getName()); + } + attachTreeBaseID(xmlNode, tbNode,PhyloTreeNode.class); TaxonLabel taxonLabel = tbNode.getTaxonLabel(); if ( null != taxonLabel ) { Long taxonId = taxonLabel.getId(); for ( OTUs xmlOTUs : getDocument().getOTUsList() ) { - for ( org.nexml.model.OTU xmlOTU : xmlOTUs.getAllOTUs() ) { - Long currentTaxonId = readTreeBaseID(xmlOTU, TaxonLabel.class); - if ( taxonId == currentTaxonId ) { - xmlNode.setOTU(xmlOTU); - break; - } + OTU xmlOTU = getOTUById(xmlOTUs, taxonId); + if ( null != xmlOTU ) { + xmlNode.setOTU(xmlOTU); + break; } } } for ( PhyloTreeNode tbChildNode : tbNode.getChildNodes() ) { Node xmlChildNode = xmlTree.createNode(); FloatEdge xmlEdge = xmlTree.createEdge(xmlNode, xmlChildNode); - xmlEdge.setLength(tbChildNode.getBranchLength()); + if ( null != tbChildNode.getBranchLength() ) { + xmlEdge.setLength(tbChildNode.getBranchLength()); + } traverseTreeBaseTree(tbTree, tbChildNode, xmlChildNode, xmlTree); } } @@ -176,7 +175,7 @@ private void traverseXmlTree(Tree<?> xmlTree, StringBuilder sb, Node xmlNode, PhyloTreeNode tbNode, PhyloTree tbTree) { tbTree.addTreeNode(tbNode); if ( null != xmlNode.getOTU() ) { - Long tbTaxonLabelId = readTreeBaseID(xmlNode.getOTU(),TaxonLabel.class); + Long tbTaxonLabelId = readTreeBaseID(xmlNode.getOTU()); if ( null != tbTaxonLabelId ) { TaxonLabel tbTaxonLabel = getTaxonLabelHome() .findPersistedObjectByID(TaxonLabel.class, tbTaxonLabelId); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rv...@us...> - 2009-06-23 10:51:08
|
Revision: 72 http://treebase.svn.sourceforge.net/treebase/?rev=72&view=rev Author: rvos Date: 2009-06-23 10:50:48 +0000 (Tue, 23 Jun 2009) Log Message: ----------- Javadoc typo fix Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/DiscreteMatrix.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/DiscreteMatrix.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/DiscreteMatrix.java 2009-06-23 10:50:05 UTC (rev 71) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/matrix/DiscreteMatrix.java 2009-06-23 10:50:48 UTC (rev 72) @@ -103,7 +103,7 @@ * Store the statelabels. First outer list corresponding to columns. Inner list corresponding to * discreteStates. * - * The "STATELABELS" are used for generating neux file. It is a transient property to make sure + * The "STATELABELS" are used for generating nexus file. It is a transient property to make sure * the same statelabels list is used for the entire matrix. * * Return the StateLabels field. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: SourceForge.net <no...@so...> - 2009-06-23 10:32:22
|
Feature Requests item #2810819, was opened at 2009-06-23 12:32 Message generated for change (Tracker Item Submitted) made by blaiseli You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126677&aid=2810819&group_id=248804 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Priority: 5 Private: No Submitted By: Blaise Li (blaiseli) Assigned to: Nobody/Anonymous (nobody) Summary: Clearly distinguish refined tree search and new tree search Initial Comment: I'm not sure this is a bug or a feature request: When I search trees here: http://8ball.sdsc.edu:6666/treebase-web/search/treeSearch.html I have to discard all results before doing a new research, otherwise it seems that the research is done among the trees found by the previous research. This default behaviour is a bit surprising. For example, I searched the trees with 6 taxa, then the trees with 7 taxa, and the second research yielded no result. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126677&aid=2810819&group_id=248804 |
From: SourceForge.net <no...@so...> - 2009-06-23 08:17:41
|
Bugs item #2810770, was opened at 2009-06-23 10:16 Message generated for change (Tracker Item Submitted) made by blaiseli You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=2810770&group_id=248804 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: data Group: None Status: Open Priority: 5 Private: No Submitted By: Blaise Li (blaiseli) Assigned to: Mark Dominus (mjdominus) Summary: Uncaught Exception for a tree Initial Comment: I get an uncaught exception when I try to see this: http://8ball.sdsc.edu:6666/treebase-web/search/downloadATree.html?id=2345&treeid=1652 (This link was given by a research on trees having 4 taxa. Tree title is Perralderia) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=2810770&group_id=248804 |
From: SourceForge.net <no...@so...> - 2009-06-22 23:39:42
|
Bugs item #2810620, was opened at 2009-06-22 23:39 Message generated for change (Tracker Item Submitted) made by rvos You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=2810620&group_id=248804 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: ui Group: None Status: Open Priority: 9 Private: No Submitted By: Rutger Vos (rvos) Assigned to: Nobody/Anonymous (nobody) Summary: NPE when validating taxon labels Initial Comment: Dear Madam / Sir, I am trying to link my taxon labels to the names in uBio using the above-mentioned page in the new version of the TreeBASE submission tool. However, for many of the names I encounter the attached error page when I enter the NameBankID manually after looking it up on the uBio web site. Also, many of my taxon names (e.g. Blastacervulus eucalypti) I can find back easily in uBio but they do not automatically appear as options in TreeBASE when I click on "Taxon Label Editor" pencil button. I am using a Macbook Pro running and up-to-date version of OS 10.5 with Firefox 3.0.3 as browser. Please let me know if I need to supply more information. Kind regards, Ewald J.Z. (Ewald) Groenewald, PhD Researcher: Evolutionary Phytopathology Group CBS-KNAW Fungal Biodiversity Centre An Institute of the Royal Netherlands Academy of Arts and Sciences (KNAW) Visiting address: Uppsalalaan 8, Room C1.51 3584 CT Utrecht, The Netherlands Postal address: P.O. Box 85167 3508 AD Utrecht, The Netherlands work tel: +31 (0)30 212 2600 (reception) +31 (0)30 212 2686 (direct) work fax: +31 (0)30 251 2097 mobile: +31 (0)65 497 4428 e-mail: e.g...@cb... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=2810620&group_id=248804 |
From: SourceForge.net <no...@so...> - 2009-06-19 17:19:13
|
Bugs item #2809158, was opened at 2009-06-19 13:19 Message generated for change (Tracker Item Submitted) made by sfrgpiel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=2809158&group_id=248804 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: ui Group: None Status: Open Priority: 9 Private: No Submitted By: William Piel (sfrgpiel) Assigned to: Nobody/Anonymous (nobody) Summary: Taxon Label validation too restrictive Initial Comment: Two problems: if a submission fails to validate all taxon labels, it cannot be toggled to "ready" state. This is too restrictive because some taxon labels can never be validated. Instead, when the user tries to toggle to "ready" he should be given a warning: "We notice that x of your y taxon labels have failed to be validated against an external taxonomy. Unless it is impossible to validate these labels, TreeBASE may refuse or delay the acceptance of your data." The other problem is that the user gets a very confusing message, saying on the one hand that the submission cannot be toggled to "Ready" (and the submit button is unavailable), while on the other hand including verbiage as though the "Submit" button is available: You cannot change the Status of the study because Taxon Labels for analyzed data in Analysis Step cannot be validated. Are you sure that you want to change the status of this particular study to 'Ready State'? It means, you are ready for the review process. If yes, then press the Submit button, else, choose the Cancel button. Please note, pressing the Submit button will disallow you to make any further changes to this study. However, it will be available in 'READ ONLY' mode. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=2809158&group_id=248804 |
From: SourceForge.net <no...@so...> - 2009-06-19 17:13:40
|
Bugs item #2809157, was opened at 2009-06-19 13:13 Message generated for change (Tracker Item Submitted) made by sfrgpiel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=2809157&group_id=248804 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: ui Group: None Status: Open Priority: 3 Private: No Submitted By: William Piel (sfrgpiel) Assigned to: Nobody/Anonymous (nobody) Summary: PhyloTreenull is default tree title Initial Comment: Newly uploaded trees are given the title "PhyloTreenull" by default, which looks a little klugish. Perhaps better to give a blank or NULL default tree title. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=2809157&group_id=248804 |
From: SourceForge.net <no...@so...> - 2009-06-19 17:11:30
|
Bugs item #2809153, was opened at 2009-06-19 13:11 Message generated for change (Tracker Item Submitted) made by sfrgpiel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=2809153&group_id=248804 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: ui Group: None Status: Open Priority: 5 Private: No Submitted By: William Piel (sfrgpiel) Assigned to: Nobody/Anonymous (nobody) Summary: Taxa tab does not behave like other tabs Initial Comment: For example, under the Studies tab, typing in "Coddington" and then clicking "Author" returns all Coddington studies. Then enter "Hormiga" and click "Author" and you see only two studies: ones with both Coddington and Hormiga. So each new criteria acts to further narrow the search against the last set of records. By contrast, the Taxa tab does not do this. First search taxon_variants for "Homo sapiens", then search taxon_variants for "Pan" and it behaves like a new search -- i.e. it does not use the second search term to narrow the result of the first. For consistency sake, all our tabs should behave the same way, which means narrowing based on a previous record set. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=2809153&group_id=248804 |
From: SourceForge.net <no...@so...> - 2009-06-19 16:59:41
|
Bugs item #2809146, was opened at 2009-06-19 12:59 Message generated for change (Tracker Item Submitted) made by sfrgpiel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=2809146&group_id=248804 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: data Group: None Status: Open Priority: 7 Private: No Submitted By: William Piel (sfrgpiel) Assigned to: Mark Dominus (mjdominus) Summary: Taxon validation fails with trinomials plus suffix Initial Comment: In submission S2440, you will notice that all binomial taxon labels with suffix codes (e.g. "Arianta schmidtii EG71B") validate automatically, but trinomial taxon labels with suffix codes (e.g. "Arianta arbustorum styriaca EG468") fail to validate (except where I have entered uBio IDs manually, such as with "Arianta arbustorum styriaca AT EG454"). I'm not sure where the problem lies (and, in fact, most if not all of these trinomials are already in TreeBASE, so the problem happens "in house" prior to using uBio's web services), but I would suggest that the solution is run a series of regular expressions on each taxon label. e.g. (1) first make sure that there is a space between species or subspecies names and suffix codes, assuming that a lower case followed by an upper case or a number probably indicates the presence of a suffix code stuck to the end of a species or subspecies name -- i.e. s/([a-z]{3,})([A-Z\d+]+)/\1 \2/ Then (2), test to see if there is a trinomial followed by a possible suffix, realizing that hyphens are allowed in species and subspecies names: m/^([A-Z][a-z]+) ([a-z\-]+) ([a-z\-]+)(.*)$/ -- if you get a hit, search the taxon_variants table for "$1 $2 $3" and if nothing there, throw "$1 $2 $3" against uBio's web services. If no hit, then (3) test to see if there is a binomial followed by a possible suffix: m/^([A-Z][a-z]+) ([a-z\-]+)(.*)$/ and if you get a hit, search the taxon_variants table for "$1 $2" and if nothing there, throw "$1 $2" at uBio's web services. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=1126676&aid=2809146&group_id=248804 |
From: <rv...@us...> - 2009-06-19 02:33:11
|
Revision: 70 http://treebase.svn.sourceforge.net/treebase/?rev=70&view=rev Author: rvos Date: 2009-06-19 02:33:09 +0000 (Fri, 19 Jun 2009) Log Message: ----------- Adding nexml.jar Added Paths: ----------- trunk/treebase-core/lib/nexml.jar Added: trunk/treebase-core/lib/nexml.jar =================================================================== (Binary files differ) Property changes on: trunk/treebase-core/lib/nexml.jar ___________________________________________________________________ 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. |