Code Monkey home page Code Monkey logo

acacia-stream's Introduction

acacia-stream

Rob Edwards, 20/09/23

These are examples for streaming data from Acacia and consuming that data in Python.

There are a couple of simple files that test your setup and make sure you have access to Acacia, and I suggest you start with those.

  • print_buckets.py just lists the buckets you have access to. Note that AWS S3 has two data abstractions, using either resources or clients, and I provide examples of both here. The currently preferred abstraction is using clients.

  • list_objects.py lists all the objects in one bucket. The format is [object name, modification date, size], separated by tabs.

  • list_an_object.py provides more details about one specific object.

  • stream_s3_file.py shows how to stream a file and write it either as a binary or text file, or how to print the contents to standard output

  • simple_streaming.py is a simple application that streams a (text) file and counts the words in the file. This is designed to demonstrate how you would consume a stream in Python directly.

  • stream_from_acacia_as_file.py is a slightly more complex streaming scenario, where you want to stream from a file, but then consume the contents in another application that only accepts a filename as input and doesn't accept the data. (Yes, that was my use case.) We use named pipes to create file-like objects that we can use elsewhere. In this example, I just have two threads that use the data. In the next example, I pass the named pipe to C code.

  • human_mappy.py if you have a human genome and a fastq file, this will use minimap2 to map the reads from the fastq file to the human genome and print the output in PAF format. If you don't understand that last sentence, this was my use case.

Good luck!

Prerequisites

You will need the boto3 for the streaming examples. You should be able to install that with pip install -r requirements.txt. The mappy library is used for the human genome mapping.

Using the code

You should be able to run all the code with a simple python call, e.g.

python print_buckets.py

acacia-stream's People

Contributors

linsalrob avatar

Stargazers

Danny Price avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.