Coverage for rest_api/data_entry/sequence_job.py: 43%

7 statements  

« prev     ^ index     » next       coverage.py v7.15.4, created at 2026-08-10 03:22 +0000

1from rest_api.models import Sequence 

2from sonar_backend.settings import DEBUG 

3 

4 

5def clean_unused_sequences(): 

6 # Check the occurrences of each sequence (seqhash) in the table. 

7 # Delete the sequence if it is not associated with any samples. 

8 # Otherwise, leave it unchanged. 

9 

10 seqhash_result = Sequence.objects.filter(samples__id__isnull=True) 

11 deleted_seqhash = seqhash_result.delete() 

12 

13 if DEBUG: 

14 print("Deleted seqhash:", deleted_seqhash)