fastq2bcl package

Submodules

fastq2bcl.cli module

CLI for fastq2bcl app

[options.entry_points] section in setup.cfg:

console_scripts =
    fastq2bcl = fastq2bcl.cli:run

Then run pip install . (or pip install -e . for editable mode) which will install the command fastq2bcl inside your current environment.

References

fastq2bcl.cli.fastq2bcl(outdir, r1, r2=None, i1=None, i2=None, mask_string=None, exclude_umi=False, exclude_index=False, threads=1)[source]

fastq2bcl function call

Parameters:
  • outdir – output directory to create run flowcell fake dir

  • r1 – R1 fastq.gz

  • r2 – R2 fastq.gz

  • i1 – I1 fastq.gz

  • i2 – I2 fastq.gz

Content of returned tuple:

rundir: final absolute path od created rundir run_id: generated mock run_id seq_fields: fields parsed and validated from first R1 record mask_string: mask used to generate RunInfo.xml

Return type:

tuple

fastq2bcl.cli.main(args)[source]

Wrapper allowing fastq2bcl() to be called with string arguments in a CLI fashion

Instead of returning the value from fastq2bcl(), it prints the result to the stdout in a nicely formatted message.

Parameters:

args (List[str]) – command line parameters as list of strings (for example ["--verbose", "42"]).

fastq2bcl.cli.mock_run_id(fields)[source]

Mock the run directory id and Path

fastq2bcl.cli.parse_args(args)[source]

Parse command line parameters

Parameters:

args (List[str]) – command line parameters as list of strings (for example ["--help"]).

Returns:

command line parameters namespace

Return type:

argparse.Namespace

fastq2bcl.cli.run()[source]

Calls main() passing the CLI arguments extracted from sys.argv

This function can be used as entry point to create console scripts with setuptools.

fastq2bcl.cli.set_mask(mask_string)[source]
fastq2bcl.cli.setup_logging(loglevel)[source]

Setup basic logging

Parameters:

loglevel (int) – minimum loglevel for emitting messages

fastq2bcl.parser module

fastq2bcl.parser.parse_seqdesc_fields(txt)[source]

Parse the SeqIO description field using named groups.

fastq2bcl.parser.validate_fields(fields)[source]

Validate the fields extracted from SeqIO description

fastq2bcl.reader module

fastq2bcl.reader.get_file_handlers(r1, r2, i1, i2)[source]

Return list of FH

fastq2bcl.reader.get_mask_from_files(r1, r2, i1, i2, exclude_umi, exclude_index)[source]

Build a mask string using seq length. In case of index and/or UMI in R1 sequence description, write this length to the Index mask

fastq2bcl.reader.read_fastq_files(r1, r2, i1, i2, exclude_umi, exclude_index)[source]

Read fastq files R1-R2 with I1 and I2 and return only the data we need

fastq2bcl.reader.read_first_record(fastq_file)[source]

Validate fastq.gz r1 file and extract first read

fastq2bcl.writer module

fastq2bcl.writer.append_data_to_bcl(base, quality, filename)[source]
fastq2bcl.writer.encode_cluster_byte(base, qual)[source]

Encode cluster byte. Bits 0-1 are the bases, respectively [A, C, G, T] for [0, 1, 2, 3]: bits 2-7 are shifted by two bits and contain the quality score. All bits 0 in a byte is reserved for no-call.

fastq2bcl.writer.encode_loc_bytes(x_pos, y_pos)[source]

Encode x and y positon. FIXME this is not the correct formul according to the bcl2fastq source code.

fastq2bcl.writer.generate_run_info_xml(run_id, run_number, flowcell_id, instrument, mask)[source]

Generate a valid Runinfo xml file.

fastq2bcl.writer.get_cycle_dir(outdir, cycle, lane='L001')[source]
fastq2bcl.writer.init_bcl_and_write_cluster_counts(cycledir, cluster_count, filename='s_1_1101.bcl')[source]

Create bcl file and write cluster count

fastq2bcl.writer.write_bcl_and_stats(cycle, cluster_count, outdir, sequences)[source]

Single process mode to write bcls

fastq2bcl.writer.write_control(rundir, cluster_count)[source]

Write control file

fastq2bcl.writer.write_cycle(context, progress, task_id)[source]

Write a cycle file with a thread. with progress, task_id and exit event context: tuple with (cycle, cluster_count, outdir, data) data: tuple (base, quality) for a cluster

fastq2bcl.writer.write_filter(rundir, cluster_count)[source]

Write filter

fastq2bcl.writer.write_locs(outdir, positions)[source]

Write locations.

Parameters:

Positions (List(tuple)) – is a List of tuple with x and y values

fastq2bcl.writer.write_run_info_xml(rundir, run_id, run_number, flowcell_id, instrument, mask)[source]

Write RunInfo.xml

fastq2bcl.writer.write_stat_file(filename)[source]

Module contents