diff --git a/qiita_db/artifact.py b/qiita_db/artifact.py
index e4ac92a34..13d72052a 100644
--- a/qiita_db/artifact.py
+++ b/qiita_db/artifact.py
@@ -1574,7 +1574,15 @@ def being_deleted_by(self):
@property
def has_human(self):
has_human = False
- if self.artifact_type == 'per_sample_FASTQ':
+ # we are going to check the metadata if:
+ # - the prep data_type is _not_ target gene
+ # - the prep is not current_human_filtering
+ # - if the artifact_type is 'per_sample_FASTQ'
+ pts = self.prep_templates
+ tgs = qdb.metadata_template.constants.TARGET_GENE_DATA_TYPES
+ ntg = any([pt.data_type() not in tgs for pt in pts])
+ chf = any([not pt.current_human_filtering for pt in pts])
+ if ntg and chf and self.artifact_type == 'per_sample_FASTQ':
st = self.study.sample_template
if 'env_package' in st.categories:
sql = f"""SELECT DISTINCT sample_values->>'env_package'
diff --git a/qiita_db/metadata_template/prep_template.py b/qiita_db/metadata_template/prep_template.py
index 4a4cc98fa..77884db17 100644
--- a/qiita_db/metadata_template/prep_template.py
+++ b/qiita_db/metadata_template/prep_template.py
@@ -1082,3 +1082,28 @@ def creation_job_id(self, creation_job_id):
WHERE prep_template_id = %s"""
qdb.sql_connection.TRN.add(sql, [creation_job_id, self.id])
qdb.sql_connection.TRN.execute()
+
+ @property
+ def current_human_filtering(self):
+ """If the preparation is current with human filtering
+
+ Returns
+ -------
+ bool
+ The current_human_filtering of the prep information
+ """
+ with qdb.sql_connection.TRN:
+ sql = """SELECT current_human_filtering
+ FROM qiita.prep_template
+ WHERE prep_template_id = %s"""
+ qdb.sql_connection.TRN.add(sql, [self.id])
+ return qdb.sql_connection.TRN.execute_fetchlast()
+
+ @current_human_filtering.setter
+ def current_human_filtering(self, current_human_filtering):
+ with qdb.sql_connection.TRN:
+ sql = """UPDATE qiita.prep_template
+ SET current_human_filtering = %s
+ WHERE prep_template_id = %s"""
+ qdb.sql_connection.TRN.add(sql, [current_human_filtering, self.id])
+ qdb.sql_connection.TRN.execute()
diff --git a/qiita_db/metadata_template/test/test_prep_template.py b/qiita_db/metadata_template/test/test_prep_template.py
index 81769082d..bfc72ad62 100644
--- a/qiita_db/metadata_template/test/test_prep_template.py
+++ b/qiita_db/metadata_template/test/test_prep_template.py
@@ -1905,6 +1905,15 @@ def test_name_setter(self):
pt.name = 'Prep information 1'
self.assertEqual(pt.name, 'Prep information 1')
+ def test_current_human_filtering(self):
+ pt = qdb.metadata_template.prep_template.PrepTemplate(1)
+ # by default it should be false
+ self.assertFalse(pt.current_human_filtering)
+ pt.current_human_filtering = True
+ self.assertTrue(pt.current_human_filtering)
+ pt.current_human_filtering = False
+ self.assertFalse(pt.current_human_filtering)
+
EXP_PREP_TEMPLATE = (
'sample_name\tbarcode\tcenter_name\tcenter_project_name\t'
diff --git a/qiita_db/support_files/patches/92.sql b/qiita_db/support_files/patches/92.sql
index a4904adb4..0c2ad5034 100644
--- a/qiita_db/support_files/patches/92.sql
+++ b/qiita_db/support_files/patches/92.sql
@@ -18,3 +18,7 @@ ALTER TABLE qiita.slurm_resource_allocations
ADD CONSTRAINT fk_slurm_resource_allocations
FOREIGN KEY ( processing_job_id )
REFERENCES qiita.processing_job ( processing_job_id );
+
+-- Apr 21, 2024
+-- Adding a new column: current_human_filtering to qiita.prep_template
+ALTER TABLE qiita.prep_template ADD current_human_filtering boolean DEFAULT False;
diff --git a/qiita_db/support_files/qiita-db.dbs b/qiita_db/support_files/qiita-db.dbs
index c156f4749..7e9a970ca 100644
--- a/qiita_db/support_files/qiita-db.dbs
+++ b/qiita_db/support_files/qiita-db.dbs
@@ -1001,6 +1001,9 @@
+
+
+
@@ -2148,10 +2151,10 @@ $function$
-
\ No newline at end of file
+
diff --git a/qiita_db/support_files/qiita-db.html b/qiita_db/support_files/qiita-db.html
index 252d8e05c..942c14ae8 100644
--- a/qiita_db/support_files/qiita-db.html
+++ b/qiita_db/support_files/qiita-db.html
@@ -65,9 +65,9 @@
+