Skip to content

Instantly share code, notes, and snippets.

@clintval
Created December 26, 2019 16:55
Show Gist options
  • Select an option

  • Save clintval/036caa888c910d1976acc520cb2b4290 to your computer and use it in GitHub Desktop.

Select an option

Save clintval/036caa888c910d1976acc520cb2b4290 to your computer and use it in GitHub Desktop.
Validate the S3 URIs in some delimited sample sheets actually exist
# After a `pip install sample-sheet pendant`
from sample_sheet import SampleSheet
from pendant.aws.s3 import S3Uri
def s3_validate_sample_sheet(path):
for sample in SampleSheet(path):
left = S3Uri(sample.PathToFastq1)
right = S3Uri(sample.PathToFastq2)
assert left.object_exists()
assert right.object_exists()
def s3_validate_sample_merging_config(path):
with open(path) as handle:
next(handle) # Consume the header
for line in handle:
sample, library, prefix = line.strip().split(',')
assert S3Uri(f'{prefix}/{sample}.{library}/{sample}.{library}.raw.mapped.bam').object_exists()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment