Skip to content

Instantly share code, notes, and snippets.

@sminot
Created May 25, 2018 22:16
Show Gist options
  • Select an option

  • Save sminot/3d37f0dd5d78e2a3ab0c3c8273c6777c to your computer and use it in GitHub Desktop.

Select an option

Save sminot/3d37f0dd5d78e2a3ab0c3c8273c6777c to your computer and use it in GitHub Desktop.
Read FASTA from S3 with boto3
def read_fasta_from_s3(bucket_name, key_name, sep="\t"):
s3 = boto3.client('s3')
retr = s3.get_object(Bucket=bucket_name, Key=key_name)
for header, seq in SimpleFastaParser(io.StringIO(retr['Body'].read().decode('utf-8'))):
yield header, seq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment