Skip to content

Commit

Permalink
Library type backpopulate update (#992)
Browse files Browse the repository at this point in the history
* Update vcgs fastq filename regex pattern

* Add TWIST library type for some cases

* Lint
  • Loading branch information
EddieLF authored Nov 21, 2024
1 parent ab02bd2 commit 5d8acf7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions scripts/back_populate_library_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
# VCGS fastq
# This is the current name format
vcgs_fastq_regex = (
r'(?P<run_date>\d{6})_(?P<g2>[A-Z\d]+)_(?P<g3>\d{4})_'
r'(?P<g4>[A-Z]{2}\d+)_(?P<sample_id>[\w\d-]+)_(?P<library_id>[A-Z\d-]+)_'
r'(?P<run_date>\d{6,8})_(?P<g2>[A-Z\d]+)_(?P<g3>\d{4})_'
r'(?P<g4>[A-Z]{2}\d+)_(?P<sample_id>[\w\d-]+)_(?P<library_id>[A-Z\d-]+\D?)_'
r'(?P<library_type>[\w\d]+)_(?P<lane>L\d+)_(?P<read>R[12])\.fastq\.gz'
)
# Pre mid 2018 the library id was not included:
Expand Down Expand Up @@ -115,6 +115,12 @@ def check_assay_meta_fields(assays: list[dict], update_sequencing_groups: bool):
'design_description'
)

# Some fastq files are not named in the standard format, but contain the word 'TWIST'
# which we can use to label then with the generic 'TWIST' library type from VCGS
elif 'TWIST' in fastq_filename:
assay_meta_fields_to_update['facility'] = 'vcgs'
assay_meta_fields_to_update['library_type'] = 'TWIST'

else:
logging.warning(
f'No file name match found for assay {assay_id}. Skipping {fastq_filename}.'
Expand Down

0 comments on commit 5d8acf7

Please sign in to comment.