Skip to main content

Merge MGI fastq files

Project description

MergeGI

Tests PyPI - Python Version Coverage Status PyPI version

MergeGI provides a single command line to merge and select barcoded raw data from MGI sequencing runs into a set of FastQ files ready for subsequent bioinformatics analysis.

Installation

We provide MergeGI as a Python library available on Pypi. The standalone application is called mergegi and can be installed in an environment with Python>3.7 as follows:

pip install mergegi

There is no dependencies except for click package so that installation should be straightforward.

For developers:

git clone git@github.com:sequana/MergeGI.git
cd MergeGI
poetry install
poetry shell

We also provide a pipeline for demultiplexing MGI data in Snakemake, which can be installed as an extra package:

pip install mergegi[sequana]

It installs snakemake and sequana_pipetools and you have access to sequana_mergegi command.

For developers:

git clone git@github.com:sequana/MergeGI.git
cd MergeGI
poetry install --all-extras
poetry shell

Apptainers

MergeGI is available as an apptainer image within the https://damona.readthedocs.io project. For example, the version 0.1.0 is available here: https://sandbox.zenodo.org/record/1134857/files/mergegi_0.0.1.img (60Mb).

Overview

The main goal of MergeGI is to select and merge the FastQ files generated by a MGI sequencer into a list of FastQ files directly usable for subsequent bioinformatics analysis. Why do we need to do this preprocessing ?

First, MGI generates one FastQ file per barcode. You may not need all those barcodes yet the demultiplexing performs a systematic search of all barcodes. Consequently, you will end up with FastQ files corresponding to your barcode and a bunch of FastQ files that should be ignored. Given the information from your wetlab colleagues you should have the list of samples and their relevant barcodes.

Second, MGI technologies imposes that barcodes being processed in a specific manner meaning that a given sample may be split into several barcodse (files). Therefore we need a tool to merge such files. Again, the wetlab should provide the barcodes corresponding to a given sample. See image below for more explanation

Third, a MGI flowcell has several lanes. You may want to merge the lanes or not.

Those 3 steps should be managed seemlessly by our tool given a sample sheet and the output directory of the MGI runs.

General Usage and Examples

The data structure expected by MergeGI is the expected output directoy of MGI runs:

OutputFq/Flowcell/L01
OutputFq/Flowcell/L02

Where L01/L02 stands for lane 1 and 2.

The software needs a sample sheet that describe the sample name, the associated barcode identifier, the project name (it will be used to create the new output directory), and the lane where is the sample/barcode pair. Here is an example:

samplename,barcode,project,lane
A,         1,      projectA, 1
B,         20,     projectA, 1
A,         1,      projectA, 2
C,         20,     projectB, 2
C,         30,     projectB, 1
B,         30,     projectA, 2

If you have pooled a sample on the four lanes, meaning it is the same barcode on each lane, you can use the * character to simplify the sample sheet:

samplename,barcode,project,lane
A,         1,     ,projectA, *
B,         20,    ,projectA, *

IMPORTANT NOTE: The header must be present. The header names are not important but columns must be sorted with the expected order: sample name, barcode, project name, lane.

Given the sample sheet, and the input directory (top level of the MGI runs), this command should create a new clean directory with the relevant FastQ files (here in merge_data directory):

mergegi --samplesheet samplesheet.csv --input-directory mgi_raw_data --output-directory merge_data 

If the data is paired, add --paired argument

mergegi --samplesheet samplesheet.csv --input-directory mgi_raw_data --output-directory merge_data --paired

By default, lanes are merged. If this is not what you want you may disable this option:

mergegi --samplesheet samplesheet.csv --input-directory mgi_raw_data --output-directory merge_data --paired --no-merge

Changelog

Version Description
0.2.1 use poetry and add sequana_mergegi as extra dependencies
0.1.0 simplify CI and use pyproject
0.0.0 firs release

Barcode distribution example

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

mergegi-0.2.1.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

mergegi-0.2.1-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file mergegi-0.2.1.tar.gz.

File metadata

  • Download URL: mergegi-0.2.1.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.8.10 Linux/5.15.0-1023-azure

File hashes

Hashes for mergegi-0.2.1.tar.gz
Algorithm Hash digest
SHA256 2487722b9978c783e986eed8e03f713c2c18df73ce2009f2ccf0fd7ba2643ad3
MD5 d6d856306c748b9fa86aeb5af631131c
BLAKE2b-256 82d3f048ffb1da521a2cbab0cbb21f8d6edeec1cbbc7a18e2f7a99948c0b8d36

See more details on using hashes here.

File details

Details for the file mergegi-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: mergegi-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.8.10 Linux/5.15.0-1023-azure

File hashes

Hashes for mergegi-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f8718733ab5a40cd264a3e83a55861b6596e559454efc08b6005577985d01df0
MD5 bb08a383d6b401f9f4939031ecd5b15e
BLAKE2b-256 7ed975c0259fa8081e17b47fbd8834000f8722156fbf159cad724de4650ea1d4

See more details on using hashes here.

Supported by

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