Created
May 25, 2018 22:16
-
-
Save sminot/3d37f0dd5d78e2a3ab0c3c8273c6777c to your computer and use it in GitHub Desktop.
Read FASTA from S3 with boto3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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