Skip to main content

A Python wrapper for fastdoop library with Spark

Project description

pyFastdoop

A Python wrapper for the Fastdoop library, allowing easy integration of Fastdoop's Hadoop InputFormat with PySpark to process FASTA files.


Installation

You can install the pyfastdoop using:

pip install pyfastdoop
python -m pyfastdoop.install

or compile source code:

git clone https://github.com/riccardoc95/pyfastdoop
cd pyfastdoop
python setup.py install
python -m pyfastdoop.install

Test

cd test
spark-submit test_module.py

Dependencies

  • PySpark: This package requires PySpark (>= 3.0.0, < 4.0.0) to function, as it integrates with Spark for distributed processing.

Usage

1. pyFastdoop

To use this wrapper, create an instance of the pyFastdoop class. You can either provide a SparkContext (if you already have one) or specify the path to the Fastdoop JAR file to create a new SparkContext.

from pyfastdoop import pyFastdoop

# Example when you need to provide a JAR path
fastdoop = pyFastdoop()

# Example with an existing SparkContext
from pyspark import SparkContext
sc = SparkContext()  # Create an existing SparkContext
fastdoop = pyFastdoop(sc=sc)

2. Reading FASTA files

You can read FASTA files (or any file supported by Fastdoop) using the read_fasta() method.

# Read FASTA file and get the RDD
rdd = fastdoop.read_fasta("input_file.fasta", type="short") # type = short, long, fastq

# Print the contents of the RDD
fastdoop.print_rdd(rdd)

3. Stop the SparkContext

Once you're done processing, you can stop the SparkContext to release resources:

wrapper.stop()

Example

from pyfastdoop import pyFastdoop

# Initialize FastdoopWrapper with JAR path
fastdoop = pyFastdoop()

# Read FASTA file
rdd = fastdoop.read_fasta("input_file.fasta")

# Print the contents of the RDD
fastdoop.print_rdd(rdd)

# Stop SparkContext
fastdoop.stop()

Contributing

Feel free to contribute! Open a pull request or create an issue on the GitHub repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyfastdoop-1.0.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyfastdoop-1.0.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file pyfastdoop-1.0.1.tar.gz.

File metadata

  • Download URL: pyfastdoop-1.0.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for pyfastdoop-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5739da7fda8b6e442f5167fffadd77c3be302394dd0b92f72b2ed39bd025d26a
MD5 d50372caec1b2eac3602f84f4b464d69
BLAKE2b-256 035907a38db47cc14c4031ccef927139fd6e415db1b8b81561004daa87600b03

See more details on using hashes here.

File details

Details for the file pyfastdoop-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyfastdoop-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for pyfastdoop-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cc6efe794ca821218fadd83d86cee05f5b52addcb9cf031f8d073bf8137e55d9
MD5 f91e1094b61c47aaa5cb3af7ccc757c9
BLAKE2b-256 f0197c07969e73814f3064496464fc35beaea8aa04c930a19cd763662213f5f9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page