@@ -147,21 +147,31 @@ def create(
147147 description : str
148148 Description of the analysis
149149 from_default : bool, optional
150- If True, use the default analysis to populate selected samples.
150+ If True, use the default analysis to populate selected samples;
151+ when True, we will create a `build_analysis_files` job.
151152 Default False.
152153 merge_duplicated_sample_ids : bool, optional
153154 If the duplicated sample ids in the selected studies should be
154155 merged or prepended with the artifact ids. False (default) prepends
155156 the artifact id
156157 categories : list of str, optional
157158 If not None, use _only_ these categories for the metaanalysis
158- reservation : str
159+ reservation : str, optional
159160 The slurm reservation to asign to the analysis
160161
161162 Returns
162163 -------
163164 qdb.analysis.Analysis
164165 The newly created analysis
166+
167+ Notes
168+ -----
169+ Before 12.09.25 this method was fully tangled with `build_analysis_files`, which
170+ meant that we couldn't create a stand alone analysis; additionally, this method
171+ had the intrinsic assumption that we can create an analysis not from default but not
172+ pass any sample/artifact information - which will create an empty analysis but still submit
173+ a build_analysis_files file. Thus, we are using this assumption to define if we should
174+ create the `build_analysis_files` job
165175 """
166176 with qdb .sql_connection .TRN :
167177 portal_id = qdb .util .convert_to_id (
@@ -199,6 +209,7 @@ def create(
199209 if reservation is not None :
200210 instance .slurm_reservation = reservation
201211
212+ if from_default :
202213 # Once the analysis is created, we can create the mapping file and
203214 # the initial set of artifacts
204215 plugin = qdb .software .Software .from_name_and_version ("Qiita" , "alpha" )
@@ -218,8 +229,8 @@ def create(
218229 qdb .sql_connection .TRN .add (sql , [a_id , job .id ])
219230 qdb .sql_connection .TRN .execute ()
220231
221- # Doing the submission outside of the transaction
222- job . submit ()
232+ job . submit ()
233+
223234 return instance
224235
225236 @classmethod
0 commit comments