Skip to main content

Tools to manage qrcoded labels and images during Natural Variaiton experiments

Project description

QR Magic

Some magical semi-automated tools to better handle sample tracking during fieldwork.

To install:

python3 -m pip install qrmagic

Or, to get the development version:

python3 -m pip install -e git+https://github.com/kdm9/NVTK.git

QR Code Label Printing

Make a PDF of labels for each sample ID. There are a few hard-coded "Avery" label types commonly used in the Weigel group, and it's super easy to add others (please create a github issue if you need help doing so, or want me to build a new label type into the code).

$ python3 -m qrmagic.labelmaker --help
usage: labelmaker.py [-h] [--demo DIR] [--list-label-types] [--label-type TYPE] [--copies N]
                     [--output FILE] [--id-file FILE] [--id-format FORMAT] [--id-start N] [--id-end N]

optional arguments:
  -h, --help            show this help message and exit
  --demo DIR            Write a demo (10 labels, four reps per label) for each label type to DIR.
  --list-label-types    Write a list of label types.
  --label-type TYPE     Label type.
  --copies N            Create N copies of each label.
  --output FILE         Output PDF file.
  --id-file FILE        File of IDs, one per line.
  --id-format FORMAT    Python-style format string governing ID format e.g. WGL{:04d} gives WGL0001..WGL9999
  --id-start N          First ID number (default 1)
  --id-end N            Last ID number (default 100)

To see what label types are available, do:

$ python3 -m qrmagic.labelmaker --list-label-types
L7636:  Mid-sized rounded rectangular labels (45x22mm) in sheets of 4x12
L3667:  Mid-sized rectangular labels (48x17mm) in sheets of 4x16
L7658:  Small labels (25x10mm) in sheets of 7x27
CryoLabel:  Cryo Labels for screw-cap eppies. White on left half, clear on right.

One can also create a demonstration PDF for each label type with the command:

$ python3 -m qrmagic.labelmaker --demo output_dir/

QR Code-based Image organisation

So, we took all these photos in the field, now what do we do with them? The first step is to organise them by sample. To do so manually is cumbersome, so here are some tools to help.

Step 1: scan images on your machine

This CLI tool will scan your images, doing its best to decode all the QRcodes they contain. For each image it also reports the location and time the image was taken, and various other bits of metadata.

NB: for silly javascript reasons, you need to have all images be in a single directory. If you have your images organised in directories (e.g. by date, or by camera), please run this process once per directory, or move or symlink all images into a single directory.

qrmagic-detect -o my-images.json my-images/*.JPG

Step 2: curation

Now, go to https://qrmagic.kdmurray.id.au/imagesort.html. Here, you should upload the JSON file created above, and up will pop a table of images. You can then try automatically filling missing barcodes based on the adjacent codes (always do a bit of manual curation here), or manually type in QR codes that are not detectable. When you are finished, you can download a Bash script which contains commands to rename all your files by sample ID (or whatever your barcodes denote).

Step 3: rename images

Once downloaded, the renamer script should be run in the same directory your images are all in:

cd /path/to/my-images
bash -x ~/Downloads/rename.sh

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

qrmagic-0.1.2.tar.gz (84.6 kB view details)

Uploaded Source

Built Distribution

qrmagic-0.1.2-py2.py3-none-any.whl (18.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file qrmagic-0.1.2.tar.gz.

File metadata

  • Download URL: qrmagic-0.1.2.tar.gz
  • Upload date:
  • Size: 84.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for qrmagic-0.1.2.tar.gz
Algorithm Hash digest
SHA256 af1740fb18990a2fd113cf666bf6543eab5e79a6b2d4e809ff710cb13840bb62
MD5 1cd99629ef9d790e5a3540fcff12bce7
BLAKE2b-256 968691871fa9dfb7cc3a0fb55454ce570a0acd08b3732acd2feb7d0e7f5e132a

See more details on using hashes here.

File details

Details for the file qrmagic-0.1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: qrmagic-0.1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for qrmagic-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 baa06c80752f10cbc17d0c3d5365c9253e29a2a004a560cd1b0f03d407a5779f
MD5 286614a24e1fa57371685e90954aa039
BLAKE2b-256 270430b0d4ed381314f59695a1349b5b6bb8e6c2594eb1d11f7930e7cb3cdf30

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