@@ -118,10 +118,46 @@ else if (SequenceAnalysisSchema.TABLE_BARCODES.equalsIgnoreCase(name))
118118
119119 return ret ;
120120 }
121+ else if (SequenceAnalysisSchema .TABLE_ANALYSES .equalsIgnoreCase (name ))
122+ {
123+ return createAnalysesTable (sourceTable , cf );
124+ }
121125 else
122126 return super .createWrappedTable (name , sourceTable , cf );
123127 }
124128
129+ private TableInfo createAnalysesTable (TableInfo sourceTable , ContainerFilter cf )
130+ {
131+ SimpleTable <?> ret = new SimpleTable <>(this , sourceTable , cf ).init ();
132+
133+ if (ret .getColumn ("outputFileTypes" ) == null )
134+ {
135+ String chr = sourceTable .getSqlDialect ().isPostgreSQL () ? "chr" : "char" ;
136+ SQLFragment sql = new SQLFragment ("(SELECT " ).
137+ append (sourceTable .getSqlDialect ().getGroupConcat (new SQLFragment ("rd.category" ), true , true , chr + "(10)" )).
138+ append (" as expr FROM " + SequenceAnalysisSchema .SCHEMA_NAME + "." + SequenceAnalysisSchema .TABLE_OUTPUTFILES + " rd WHERE rd.analysis_id = " + ExprColumn .STR_TABLE_ALIAS + ".rowid)" );
139+ ExprColumn newCol = new ExprColumn (ret , "outputFileTypes" , sql , JdbcType .VARCHAR , sourceTable .getColumn ("rowid" ));
140+ newCol .setLabel ("Output File Types" );
141+ newCol .setWidth ("250" );
142+ newCol .setURL (DetailsURL .fromString ("/query/executeQuery.view?schemaName=sequenceanalysis&query.queryName=outputfiles&query.analysis_id~eq=${rowid}" , ret .getContainer ().isWorkbook () ? ret .getContainer ().getParent () : ret .getContainer ()));
143+ newCol .setUserEditable (false );
144+ newCol .setCalculated (true );
145+ ret .addColumn (newCol );
146+ }
147+
148+ if (ret .getColumn ("totalOutputs" ) == null )
149+ {
150+ SQLFragment sql = new SQLFragment ("(SELECT COUNT(rd.rowid) FROM " + SequenceAnalysisSchema .SCHEMA_NAME + "." + SequenceAnalysisSchema .TABLE_OUTPUTFILES + " rd WHERE rd.analysis_id = " + ExprColumn .STR_TABLE_ALIAS + ".rowid)" );
151+ ExprColumn newCol = new ExprColumn (ret , "totalOutputs" , sql , JdbcType .INTEGER , sourceTable .getColumn ("rowid" ));
152+ newCol .setLabel ("Output Files From This Analysis" );
153+ newCol .setURL (DetailsURL .fromString ("/query/executeQuery.view?schemaName=sequenceanalysis&query.queryName=outputfiles&query.analysis_id~eq=${rowid}" , ret .getContainer ().isWorkbook () ? ret .getContainer ().getParent () : ret .getContainer ()));
154+ newCol .setUserEditable (false );
155+ newCol .setCalculated (true );
156+ ret .addColumn (newCol );
157+ }
158+
159+ return ret ;
160+ }
125161 private TableInfo createOutputFiles (TableInfo sourceTable , ContainerFilter cf )
126162 {
127163 SimpleTable <?> ret = new SimpleTable <>(this , sourceTable , cf ).init ();
0 commit comments