Giter VIP home page Giter VIP logo

barcoder's Introduction

rOpenSci

Project Status: Abandoned

This repository has been archived. The former README is now in README-NOT.md.

barcoder's People

Contributors

colauttilab avatar maelle avatar nine2k avatar rwalke avatar thokall avatar yihanwu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

barcoder's Issues

Incorrect Alignment and Truncation

I'm having some issues with the label alignment, in that after entering the label specifications exactly (actually some minor adjustments to better fit), the labels almost fit but the printing seems to migrate down and to the right. Is there a way to enter the vertical and horizontal pitch? The truncation does not seem to quite work to stay within the labels, but maybe that would be fixed if there is a way to enter the pitch specifications.

Label specifications are:
image

I had to make some minor adjustments to the label specifications to make it fit better, but while it helps I still have the same issue with alignment and truncation.

Here are the R scripts that I used most recently:

custom_create_PDF(user=FALSE, Labels = small_labels[,1], name = 'smallLabels_ParentMarch',
type = 'matrix', ErrCorr = 'Q', Fsz = 4.5, Across = TRUE, ERows = 0,
ECols = 0, trunc = TRUE, numrow = 17, numcol = 7, page_width = 8.5,
page_height = 11, width_margin = 0.54, height_margin = 0.15,
label_width = 0.94, label_height = 0.5, x_space = 0.1, y_space = 0.65)

And here are the Sample Ids that I am using

EAQ-2021-03-25
Rustlers-2021-03-25
Bradley-2021-03-25
Rock-2021-03-25
Copper-2021-03-25
EBC-2021-03-25
Copper-2021-03-30
EBC-2021-03-30
Copper-2021-04-07
EBC-2021-04-07
Rock-2021-04-07
Rustlers-2021-04-07
Bradley-2021-04-07
EAQ-2021-04-07

Crashes when generating a single-digit label as a PDF

Hey – I'm working on the integration with PyTrackDat. One feature I think would be useful and beneficial for integration between the two projects is exporting label PDFs directly from the web interface (vs. exporting compatible CSVs and running them through the baRcodeR pipeline).

To do this, I wrote a small auxiliary R script which I execute with python:

chooseCRANmirror(ind=1)

if (!require(baRcodeR)) {
    install.packages("baRcodeR")
    library(baRcodeR)
}

id_vector <- commandArgs(trailingOnly=TRUE)
file_name <- paste("labels-", gsub("[ :]+", "-", Sys.time()), sep="")
create_PDF(Labels=id_vector, name=file.path(getwd(), file_name))
cat(file_name)

Where labels are passed as arguments and the PDF is then returned as an HTTP response with python.

If I pass over 200 arguments to the script, I get the following error message, on both my Linux Dockerized version and on my mac:

Loading required package: baRcodeR
Loading required package: qrcode
Error in if (targetDataPoly[1] > 0) { : 
  missing value where TRUE/FALSE needed
Calls: create_PDF ... <Anonymous> -> <Anonymous> -> qrInterleave -> ECgenerator
Error in grDevices::dev.off() : 
  cannot shut down device 1 (the null device)
Calls: create_PDF -> custom_create_PDF -> <Anonymous>
Execution halted

replication label vector:

BC-Fish101186 BC-Fish101185 BC-Fish101184 BC-Fish101074 BC-Fish101073 BC-FiFish101070 BC-Fish101069 BC-Fish101068 BC-Fish101067 BC-Fish101066 BC-Fish101065 BC-Fish101064 BC-Fish101063 BC-Fish101062 BC-Fish101061 BC-Fish101060 BC-Fish101059 BC-Fish101058 BC-Fish101057 BC-Fish101056 BC-Fish101055 BC-Fish101054 BC-Fish101053 BC-Fish101051 BC-Fish101046 BC-Fish101035 BC-Fish101018 BC-Fish101017 BC-Fish101002 B9 B8 B73 B72 B71 B70 B7 B69 B68 B67 B66 B65 B64 B63 B62 B61 B60 B6 B59 B58 B57 B56 B55 B54 B53 B52 B51 B50 B5 B49 B48 B47 B46 B45 B44 B43 B42 B41 B40 B4 B39 B38 B37 B36 B35 B34 B33 B32 B31 B30 B3 B29 B28 B27 B26 B25 B24 B23 B22 B21 B20 B2 B19 B18 B17 B16 B15 B14 B13 B12 B11 B10 B1 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 935 934 933 932 931 930 929 928 927 926 925 924 923 922 921 920 919 918 917 916 915 914 913 912 911 910 909 908 907 906 905 904 903 902 901 900 90 9 899 898 897 896 895 894 893 892 891 889 888 887 886 885 884 883 882 881

The threshold appears to be exactly at 200 labels. Not sure if you have any ideas, or if I'm just missing a parameter or something!

thanks and apologies.

Feature Request: Please add support for actual 1D barcodes

This is a very useful idea but it could have even broader applications if It would have the option to use 1D barcodes.
I'm currently forced to use reticulate, python-barcode and manual editing of the knited document, for generating labels with 1D barcodes.

Problems with certain linear barcodes

Generating linear barcodes seem to have issues with certain strings, whereas most strings are working as expected.

This code block works

library(baRcodeR)
custom_create_PDF(Labels = "SEP0164581", type = "linear")

but this does not generate a valid linear barcode

library(baRcodeR)
custom_create_PDF(Labels = "SEP0164580", type = "linear")

Both examples will generate valid qr-codes if changing the type to matrix, but since I am using external tools that can only read linear barcodes I need to find a tool for generating these.

I have generated around 10000 codes of the same type and by testing a subset there seem to be between 5-10% of the generated barcodes that are not valid.

I have tested on both a linux and a mac os x machine with the same results. Below is my R session information for the linux machine.

sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.1 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=sv_SE.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=sv_SE.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=sv_SE.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=sv_SE.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] baRcodeR_0.1.2 qrcode_0.1.1  

loaded via a namespace (and not attached):
 [1] compiler_3.5.1    magrittr_1.5      tools_3.5.1       yaml_2.2.0        stringi_1.2.4    
 [6] R.methodsS3_1.7.1 grid_3.5.1        stringr_1.3.1     R.utils_2.8.0     R.oo_1.22.0

Is it possible to install without the UI dependencie?

For PyTrackDat, I'd like to use the PDF export functionality without having to include shiny, etc. as it makes the build time very long in PyTrackDat Docker images. Is there some way I can install baRcodeR without the RStudio-implicated dependencies?

Adding extra label information

Hello,
When using the interactive custom_create_PDF() function, is it possible to include more information for the user which is not encoded in the barcode? for instance, when identifying plants, the barcode info is the plant-id and the genotype is label info shown to the user

custom_create_PDF(user = FALSE, Labels = plant-id, user_label=genotype name = "LabelsOut",
type = "matrix", ErrCorr = "H", Fsz = 5, Across = TRUE,
ERows = 0, ECols = 0, trunc = TRUE, numrow = 20, numcol = 4,
page_width = 8.5, page_height = 11, width_margin = 0.25,
height_margin = 0.5, x_space = 0, y_space = 0.5)

Thanks,
Margaret

Encoded information is different from input

Hello,
My input variable has underscores eg. TDr14020774_1030_3_Bag36
On using custom_create_PDF(), the barcode is generated. On scanning it, it has dashes i.e TDr14020774-1030-3-Bag36
Thanks

Unable to generate ASCII special character GS (group separator)

Hello,

I ve try de generate some barcode which include a group separator (it s a reproduction of existing barcode).
I am using the linear format.

A reproductible example :
The first one works perfectly
The second one Crash with :
grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
largeur de police inconnue pour le caractère 0x1d
in english : unknown font width for character 0x1d

`library(baRcodeR)

#Work great
custom_create_PDF(
Labels = "Working\137Ascii",
type = "linear",
name = "/tmp/happy",
)

custom_create_PDF(
Labels = "NotWorking\035Ascii",
type = "linear",
name = "/tmp/happy",
)`

My session info :

`sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
[1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8 LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8
[7] LC_PAPER=fr_FR.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] gtools_3.9.2 baRcodeR_0.1.5 qrcode_0.1.3

loaded via a namespace (and not attached):
[1] compiler_4.1.1 magrittr_2.0.1 tools_4.1.1 rstudioapi_0.13 stringi_1.5.3 R.methodsS3_1.8.1 grid_4.1.1 stringr_1.4.0 R.utils_2.10.1
[10] R.oo_1.24.0 `

Have a nice day

Add link to Cheatsheet

I was inspired by RStudio's Help-> Cheatsheets -> ... menu items, which just point to web links of downloadable pdf cheatsheets.

The same can be done as another option in the BARCODER Addins menu item:

BARCODER

baRcodeR GUI
baRcodeR Cheatsheet

Here is the direct link to the pdf on Figshare:
https://ndownloader.figshare.com/files/14087612

Crashes when generating over 200 labels as a PDF

Hey – I'm working on the integration with PyTrackDat. One feature I think would be useful and beneficial for integration between the two projects is exporting label PDFs directly from the web interface (vs. exporting compatible CSVs and running them through the baRcodeR pipeline).

To do this, I wrote a small auxiliary R script which I execute with python:

chooseCRANmirror(ind=1)

if (!require(baRcodeR)) {
    install.packages("baRcodeR")
    library(baRcodeR)
}

id_vector <- commandArgs(trailingOnly=TRUE)
file_name <- paste("labels-", gsub("[ :]+", "-", Sys.time()), sep="")
create_PDF(Labels=id_vector, name=file.path(getwd(), file_name))
cat(file_name)

Where labels are passed as arguments and the PDF is then returned as an HTTP response with python.

If I pass over 200 arguments to the script, I get the following error message, on both my Linux Dockerized version and on my mac:

Loading required package: baRcodeR
Loading required package: qrcode
Error in if (targetDataPoly[1] > 0) { : 
  missing value where TRUE/FALSE needed
Calls: create_PDF ... <Anonymous> -> <Anonymous> -> qrInterleave -> ECgenerator
Error in grDevices::dev.off() : 
  cannot shut down device 1 (the null device)
Calls: create_PDF -> custom_create_PDF -> <Anonymous>
Execution halted

replication label vector:

BC-Fish101186 BC-Fish101185 BC-Fish101184 BC-Fish101074 BC-Fish101073 BC-FiFish101070 BC-Fish101069 BC-Fish101068 BC-Fish101067 BC-Fish101066 BC-Fish101065 BC-Fish101064 BC-Fish101063 BC-Fish101062 BC-Fish101061 BC-Fish101060 BC-Fish101059 BC-Fish101058 BC-Fish101057 BC-Fish101056 BC-Fish101055 BC-Fish101054 BC-Fish101053 BC-Fish101051 BC-Fish101046 BC-Fish101035 BC-Fish101018 BC-Fish101017 BC-Fish101002 B9 B8 B73 B72 B71 B70 B7 B69 B68 B67 B66 B65 B64 B63 B62 B61 B60 B6 B59 B58 B57 B56 B55 B54 B53 B52 B51 B50 B5 B49 B48 B47 B46 B45 B44 B43 B42 B41 B40 B4 B39 B38 B37 B36 B35 B34 B33 B32 B31 B30 B3 B29 B28 B27 B26 B25 B24 B23 B22 B21 B20 B2 B19 B18 B17 B16 B15 B14 B13 B12 B11 B10 B1 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 935 934 933 932 931 930 929 928 927 926 925 924 923 922 921 920 919 918 917 916 915 914 913 912 911 910 909 908 907 906 905 904 903 902 901 900 90 9 899 898 897 896 895 894 893 892 891 889 888 887 886 885 884 883 882 881

The threshold appears to be exactly at 200 labels. Not sure if you have any ideas, or if I'm just missing a parameter or something!

thanks and apologies.

[Feature request] fitting the labels to Tough Spots

Dear Authors,
I am once again underlining the importance of your valuable work, by using it exensively in our Lab for biosamples.
Thank you for the package it really is the only one that is currently useful for this purpose.

I have however a bit of a problem, because we would like to use a different format for our labels that is ot currently supported by the package.

Would it be possible to implement a couple of additional features to utilize the following paper for the label printing?
https://www.divbio.com/category/laser-tough-spots
Im mostly interested in the SPOT-5000 format.

This requires that we would move the label underneath the QR code and center the label.
I currently do not know how to change the code to implement this feature and would be greatful for your help.
I think this would also increase the usefulness of the package for the general public.

qrcode no value in alphanumeric table for underscore

An underscore in the label text will lead to an error of Error in dataStringValue[x] * 45 :
non-numeric argument to binary operator.

Suggested fix: Check all labels during barcode_make when creating Xtxt by gsub. Replace all underscores with dashes

simple question: saving the Preview-generated data to a regular data frame in the R environment?

This pkg is truly great
and useful.
Using it with Rstudio in Linux.

Q:
I don't need to always save the Preview-generated data
to a CSV file.

Sometimes, using the addin,
I simply need to save
the data visible in the pgk addin "Preview" area
(on the right-side),
to a regular data frame in the R environment?.

Would be very useful for a regular data frame
to contain all the data as shown in the addin "Preview" area,
for either
the unique_ID_maker or the unique_hier_maker functions.

How to do that in baRcodeR via the addin?
thanks!
SFd99
San Francisco

Generate barcode in a shiny app

Hi,
How would I generate and download barcodes in a shiny app?
I have included create_pdf inside a download handler and it doesn't seem to work

output$downloadlabels <- downloadHandler(

content = function(file) {
  create_PDF(user=FALSE, Labels=yamdata$PlantName, name ="mylabels",
               type="matrix", ErrCorr = "H", Fsz=5)
}

)

Thanks,
Margaret

Adding input checks for escape characters and tab formatting on labels

For labels coded directly into r, \n will create a new line in the text label.
\t will not work and has to be replaced by a number of \x20. See this post
Something like

Row:1   Column:1
Row:2   Column:2

desired on a label will have to be encoded as
"Row:1\x20\x20\x20\x20Column:1\nRow:2\x20\x20\x20\x20Column:2"
with 4 spaces in place of a tab character.

For labels being read in from a csv (such as the add-in), R automatically escapes the inline escape character. Input checks to manually replace the \n and the \t have to be created.

Mention this in documentation as well.

underscores in 2D barcodes become hyphens

Hello! Thanks for the great package. I've noticed when I generate 2D barcodes with text containing underscores, when I scan the barcodes, it is read as a hyphen upon scanning. Is it possible to include underscores in 2D barcode-encoded text? I've included an example; the underscore in the 4th position is read as a hyphen.

Screenshot 2024-01-03 at 8 46 11 AM

[Feature request] Human readable sample number in TOP VIEW

Hi!
Thanks for this great package!

My question is if we could ask for a human-readable, short, reference number so that the person searching for samples in a cryo box would also be able to quickly visually see the contents of the QR code (which optimally would jus be part of the total barcode and put JUST UNDER the QRCODE.

This would allow us to put QR codes on top of the 1ml Epis.

The use case that I have for it is that the QR-code with the shorter sample name goes on the top lid and the whole label (the one that is already supported) storing also the project name and additional info could be placed on the side of the epi. this does not have to be machine-readable.

In the picture below I would like to have (just the last sample number e.g. 41) visible under the QR code.

IMG_20200122_154240

The problem with the current use case is that without scanning each sample in a big cryo box we cant actually visually confirm if we are taking the proper sample. So to decrease the time needed for verification I would suggest also adding this functionality.

Thanks again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.