Skip to content

Commit

Permalink
version 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisgKent committed Nov 10, 2023
1 parent d64b252 commit 80d4f32
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 17 deletions.
Empty file added .Rhistory
Empty file.
34 changes: 26 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,24 @@ This command-line interface (CLI) generates IDT input files from a 7-column prim

The IDT Input File Generator CLI allows you to convert a primer bed file into IDT input files. IDT (Integrated DNA Technologies) is a company that provides custom DNA synthesis services. This tool automates the process of generating input files for ordering primers from IDT.

## Installation

#### From pip

```pip instal bed2idt```

#### From Poetry / source

```git clone https://github.com/ChrisgKent/bed2idt```

```poetry install && poetry build```

## Usage

To use the CLI, run the following command:

python bed2idt/main.py [options] [command] [command-options]
bed2idt [options] [command] [command-options]


## Options

Expand All @@ -19,25 +32,30 @@ The CLI supports the following options:
- `-b, --bedfile`: Path to the primer bed file (required).
- `-o, --output`: The output location for the generated IDT input file(s) (default: `output.xlsx`).
- `plate` command:
- `-s, --splitby`: Specifies whether the primers should be split across more than one plate. Valid options are `pool`, `ref`, or `none` (default: `pool`).
- `-s, --splitby`: Specifies whether the primers should be split across more than one plate. Valid options are `pool`, `ref`, `none`, ~~`next`~~ (default: `pool`).
- `-f, --fillby`: Specifies how the plates should be filled. Valid options are `rows` or `cols` (default: `rows`).
- `tube` command:
- `-s, --scale`: The concentration of the primers. Valid options are `25nm`, `100nm`, `250nm`, `1um`, `2um`, `5um`, `10um`, `4nmU`, `20nmU`, `PU`, or `25nmS` (default: `25nm`).
- `-p, --purification`: The purification method for the primers. Valid options are `STD`, `PAGE`, `HPLC`, `IEHPLC`, `RNASE`, `DUALHPLC`, or `PAGEHPLC` (default: `STD`).
- `--force`: Overrides the output directory if it already exists.

## Examples

1. Generate 96-well plate IDT input files for a primer bed file named `primers.bed` and save/overide the output as `output.xlsx`, split by pools:
1. Generate 96-well plate IDT input files for a primer bed file named `primer.bed` and save/overide the output as `output.xlsx`, split by pools:

```bed2idt -b primer.bed --force plate --splitby pools```

2. Generate tube IDT input files for a primer bed file named `primer.bed`, save the output as `custom_output.xlsx`, and specify a purification method:

```python bed2idt/main.py -b primers.bed --force plate --splitby pools```
```bed2idt -b primer.bed -o custom_output.xlsx tube --purification PAGE```

2. Generate tube IDT input files for a primer bed file named `primers.bed`, save the output as `custom_output.xlsx`, and specify a purification method:
3. Generate IDT input files for a primer bed file named `primer.bed` without splitting the primers across multiple plates:

```python bed2idt/main.py -b primers.bed -o custom_output.xlsx tube --purification PAGE```
```bed2idt -b primer.bed plate --splitby none```

3. Generate IDT input files for a primer bed file named `primers.bed` without splitting the primers across multiple plates:
4. Generate IDT input files `primer.xlsx` for a primer.bed file named `primer.bed`, splitting the plate by pool, and filling plates by col:

```python bed2idt/main.py -b primers.bed plate --splitby none```
```bed2idt -b primer.bed -o primer.xlsx plate --splitby pools --filllby cols```

Note: Make sure to replace `python` with the appropriate command for running Python on your system.

Expand Down
1 change: 1 addition & 0 deletions bed2idt/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "1.0.0"
Binary file added bed2idt/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file added bed2idt/__pycache__/cli.cpython-310.pyc
Binary file not shown.
Binary file added bed2idt/__pycache__/main.cpython-310.pyc
Binary file not shown.
9 changes: 9 additions & 0 deletions bed2idt/cli.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import argparse
import pathlib
from bed2idt.__init__ import __version__


def cli():
description = "Generates IDT input files from the 7 col primer.bed"
parser = argparse.ArgumentParser(description=description)
parser.add_argument("--version", version=__version__, action="version")
parser.add_argument(
"-b",
"--bedfile",
Expand All @@ -30,6 +32,13 @@ def cli():
default="pool",
help="Should the primers be split across more than one plate",
)
plate_parser.add_argument(
"-f",
"--fillby",
choices=["rows", "cols"],
default="rows",
help="How should the plate be filled",
)
# Add the tube arguments
tube_parser = subparsers.add_parser("tube")
tube_parser.add_argument(
Expand Down
18 changes: 15 additions & 3 deletions bed2idt/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import sys
import xlsxwriter

from bed2idt.__init__ import __version__

"""
These are the correct values on the IDT website as of time of writing
Please check https://eu.idtdna.com/site/order/oligoentry to confirm
Expand All @@ -15,12 +17,17 @@ def chunks(lst, n):
yield lst[i : i + n]


def create_plate(primer_list: list[list], workbook, sheet_name: str):
def create_plate(primer_list: list[list], workbook, sheet_name: str, by_rows: bool):
for index, primer_sublist in enumerate(primer_list):
# Create all the indexes in a generator
letters = ["A", "B", "C", "D", "E", "F", "G", "H"]
numb = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
indexes = ((letter, str(number)) for letter in letters for number in numb)

# Ensure the plate is filled up correctly
if by_rows:
indexes = ((letter, str(number)) for letter in letters for number in numb)
else:
indexes = ((letter, str(number)) for number in numb for letter in letters)

# Create the sheet
worksheet = workbook.add_worksheet(f"{sheet_name}.{index}")
Expand Down Expand Up @@ -93,7 +100,12 @@ def plate(primer_list, workbook, args):

for index, plate in enumerate(plates):
if plate: # Plates can be empty so only write non-empty plates
create_plate(plate, workbook, sheet_name=f"plate_{index +1}")
create_plate(
plate,
workbook,
sheet_name=f"plate_{index +1}",
by_rows=args.fillby == "rows",
)

workbook.close()

Expand Down
Binary file added dist/bed2idt-0.1.0-py3-none-any.whl
Binary file not shown.
Binary file added dist/bed2idt-0.1.0.tar.gz
Binary file not shown.
Binary file added dist/bed2idt-1.0.0-py3-none-any.whl
Binary file not shown.
Binary file added dist/bed2idt-1.0.0.tar.gz
Binary file not shown.
Binary file added nibcs_v2.0.1.xlsx
Binary file not shown.
9 changes: 4 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "bed2idt"
version = "0.1.0"
version = "1.0.0"
description = "Converts primer.bed files to IDT ordering templates"
authors = ["ChrisKent <[email protected]>"]
license = "CC-BY-SA-4.0"
Expand Down
Empty file added tests/__init_.py
Empty file.
Empty file added tests/test_plates.py
Empty file.

0 comments on commit 80d4f32

Please sign in to comment.