{"id":18246140,"url":"https://github.com/mfcovington/auto_barcode","last_synced_at":"2025-07-06T12:08:19.476Z","repository":{"id":4795132,"uuid":"5947959","full_name":"mfcovington/auto_barcode","owner":"mfcovington","description":"Extracts fastq reads for specified barcode(s) from one or multiple FASTQ files","archived":false,"fork":false,"pushed_at":"2016-01-31T11:56:53.000Z","size":1484,"stargazers_count":13,"open_issues_count":0,"forks_count":16,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T14:38:08.468Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mfcovington.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-25T09:52:22.000Z","updated_at":"2024-03-21T14:59:41.000Z","dependencies_parsed_at":"2022-09-10T16:50:38.367Z","dependency_job_id":null,"html_url":"https://github.com/mfcovington/auto_barcode","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/mfcovington/auto_barcode","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfcovington%2Fauto_barcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfcovington%2Fauto_barcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfcovington%2Fauto_barcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfcovington%2Fauto_barcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mfcovington","download_url":"https://codeload.github.com/mfcovington/auto_barcode/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfcovington%2Fauto_barcode/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263898013,"owners_count":23526835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T09:24:42.060Z","updated_at":"2025-07-06T12:08:19.458Z","avatar_url":"https://github.com/mfcovington.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Barcode Splitter, Trimmer, and Stat Generator\n\nContents of README:\n\n- [Usage Summary][usage_summary]\n- [Detailed Usage Example][detailed_example]\n    - [Barcode splitting/trimming][split_trim]\n    - [Log files][logs]\n    - [Plotting barcode splitting summary][plot]\n\n## Usage Summary\n\nThe following can be accessed by running `./barcode_split_trim.pl --help`:\n\n    USAGE\n      barcode_split_trim.pl [options] -b BARCODE IN.FASTQ\n\n    DESCRIPTION\n      Extracts fastq reads for specified barcode(s) from one or multiple FASTQ files.\n      Use wildcards ('*') to match multiple input FASTQ files.\n\n    OPTIONS\n      -h, --help                 Print this help message\n      -v, --version              Print version number\n      --id                       Sample or Experiment ID\n      -b, --barcode   BARCODE    Specify barcode or file w/ list of barcodes to extract\n      -l, --list                 Indicate BARCODE is a list of barcodes in a file\n      --indexed                  Samples designated by index sequences\n                                  Alternate read FQ files and index FQ files\n      -m, --mismatches           Minimum number of mismatches allowed in barcode sequence [0]\n      -n, --notrim               Split without trimming barcodes\n      -st, --stats               Output summary stats only (w/o creating fastq files)\n      -o, --outdir    DIR        Output file is saved in the specified directory\n                                  (or same directory as IN.FASTQ, if --outdir is not used)\n\n    NAMING OPTIONS\n      --autoprefix               Append FASTQ file name onto output\n      --autosuffix               Append barcode onto output\n      -p, --prefix    PREFIX     Add custom prefix to output\n      -su, --suffix   SUFFIX     Add custom suffix to output\n\n    OUTPUT\n      An output file in fastq format is written for each barcode to the directory\n      containing IN.FASTQ, unless an output directory is specified.\n      The default name of the output file is SAMPLE_ID.fq. The output names can be\n      customized using the Naming Options.\n\n      Log files and a summary plot that aid in identification of problem libraries.\n\n    EXAMPLES\n      barcode_split_trim.pl -i Charlotte -b GACTG kitten_DNA.fq\n      barcode_split_trim.pl --id BigExperiment --barcode barcode.file --list *_DNA.fastq\n      barcode_split_trim.pl --help\n\n## Detailed Usage Example\n\nA pair of sample FASTQ and barcode files is provided in the [`sample_files`][sample_files_folder] folder. They have been used to generate the output FASTQ, log, and summary plot files ([`sample_files/output`][output_folder]). In this example, I show what these files look like and how to generate them.\n\n### Barcode splitting/trimming\n\nThe sample FASTQ file (`sample_files/sequences.fq`) contains 100,000 sequence reads from a pool of 14 samples. The corresponding [barcodes][barcodes] (`sample_files/barcode.list`) are:\n\n    TACGC   marmot1\n    ATCGT   marmot2\n    ATTCC   marmot3\n    CCAGC   marmot4\n    GATAC   aardvark1\n    GGATG   aardvark2\n    TCGAT   tarsier1\n    AGCGC   tarsier2\n    CCAAT   tarsier3\n    CGCTG   tarsier4\n    CTAGT   puffin1\n    TAGAG   puffin2\n    TAGTC   puffin3\n    GGTCA   puffin4\n\nTo split `sample_files/sequences.fq` with the barcodes in `sample_files/barcode.list`, we can run:\n\n```bash\n./barcode_split_trim.pl \\\n  --id demo \\\n  --barcode sample_files/barcode.list \\\n  --list \\\n  --outdir sample_files/output \\\n  sample_files/sequences.fq\n```\n\nThis results in a FASTQ file for each barcode (barcodes are trimmed), a single FASTQ file containing all unmatched barcodes (barcodes are left in tact), and two log files:\n\n    # FASTQ file for each barcode\n    aardvark1.fq\n    aardvark2.fq\n    marmot1.fq\n    marmot2.fq\n    marmot3.fq\n    marmot4.fq\n    puffin1.fq\n    puffin2.fq\n    puffin3.fq\n    puffin4.fq\n    tarsier1.fq\n    tarsier2.fq\n    tarsier3.fq\n    tarsier4.fq\n\n    # FASTQ file containing all unmatched barcodes\n    unmatched.fq_sequences.bar_barcode.list.fq\n\n    # log files\n    log_barcode_counts.fq_sequences.bar_barcode.list\n    log_barcodes_observed.fq_sequences.bar_barcode.list\n\n    # plot summary\n    demo.barcodes.png\n\n### Log files\n\nThe [first log file][LOG1] is the barcode splitting summary (`sample_files/output/log_barcode_counts.fq_sequences.bar_barcode.list`) and returns some basic stats with an emphasis on expected barcodes:\n\n    Barcode splitting summary for:\n      sample_files/sequences.fq\n    ---------------------------\n    matched   24,459 97.8%\n    unmatched    541  2.2%\n    ---------------------------\n    barcodes    14\n    min      1,260   5.0%\n    max      2,200   8.8%\n    mean     1,747   7.0%\n    median   1,735.5 6.9%\n    ---------------------------\n    id        barcode count percent\n    aardvark1 GATAC   1,595 6.4%\n    aardvark2 GGATG   1,839 7.4%\n    marmot1   TACGC   1,758 7.0%\n    marmot2   ATCGT   1,504 6.0%\n    marmot3   ATTCC   1,614 6.5%\n    marmot4   CCAGC   1,468 5.9%\n    puffin1   CTAGT   1,476 5.9%\n    puffin2   TAGAG   1,260 5.0%\n    puffin3   TAGTC   2,102 8.4%\n    puffin4   GGTCA   1,964 7.9%\n    tarsier1  TCGAT   2,010 8.0%\n    tarsier2  AGCGC   2,200 8.8%\n    tarsier3  CCAAT   1,713 6.9%\n    tarsier4  CGCTG   1,956 7.8%\n\n\nThe [second log file][LOG2] returns counts and percentages for all observed barcodes (both expected and unexpected). Below are the first 20 (of 215) observed barcodes from this log (`sample_files/output/log_barcodes_observed.fq_sequences.bar_barcode.list`):\n\n    barcode count percent id\n    AGCGC   2,200 8.8%     tarsier2\n    TAGTC   2,102 8.4%      puffin3\n    TCGAT   2,010 8.0%     tarsier1\n    GGTCA   1,964 7.9%      puffin4\n    CGCTG   1,956 7.8%     tarsier4\n    GGATG   1,839 7.4%    aardvark2\n    TACGC   1,758 7.0%      marmot1\n    CCAAT   1,713 6.9%     tarsier3\n    ATTCC   1,614 6.5%      marmot3\n    GATAC   1,595 6.4%    aardvark1\n    ATCGT   1,504 6.0%      marmot2\n    CTAGT   1,476 5.9%      puffin1\n    CCAGC   1,468 5.9%      marmot4\n    TAGAG   1,260 5.0%      puffin2\n    GGGCA      32 0.1%\n    GGTCC      27 0.1%\n    GGATT      15 0.1%\n    NAGAG      11 0.0%\n    NAGTC      11 0.0%\n    TCTAT      11 0.0%\n\n\n### Plotting barcode splitting summary\n\nThe logs are useful, but if there are numerous barcodes and/or experiments being analyzed at once, it can be difficult to easily detect irregularities or problematic barcodes. To solve this issue, we can make a barcode frequency plot using R.\n\nFor this plot (saved to `sample_files/output/demo.barcodes.png`), barcodes are split into two groups, those that match an expected barcode and those that are unmatched. Boxplots are then generated using the observed barcode frequencies (which are jitter-plotted individually on top of the boxplot).\n\n\u003cimg src=\"https://raw.github.com/mfcovington/auto_barcode/master/sample_files/output/demo.barcodes.png\" height=\"500\" /\u003e\n\n\u003c!-- LINKS --\u003e\n\n[usage_summary]: https://github.com/mfcovington/auto_barcode#usage-summary\n[detailed_example]: https://github.com/mfcovington/auto_barcode/#detailed-usage-example\n[split_trim]: https://github.com/mfcovington/auto_barcode/#barcode-splittingtrimming\n[logs]: https://github.com/mfcovington/auto_barcode/#log-files\n[plot]: https://github.com/mfcovington/auto_barcode/#plotting-barcode-splitting-summary\n\n[sample_files_folder]: https://github.com/mfcovington/auto_barcode/tree/master/sample_files\n[barcodes]: https://raw.github.com/mfcovington/auto_barcode/master/sample_files/barcode.list\n\n[output_folder]: https://github.com/mfcovington/auto_barcode/tree/master/sample_files/output\n[LOG1]: https://raw.github.com/mfcovington/auto_barcode/master/sample_files/output/log_barcode_counts.fq_sequences.bar_barcode.list\n[LOG2]: https://raw.github.com/mfcovington/auto_barcode/master/sample_files/output/log_barcodes_observed.fq_sequences.bar_barcode.list\n[LOG2_converted]: https://raw.github.com/mfcovington/auto_barcode/master/sample_files/output/log_barcodes_observed.fq_sequences.bar_barcode.list.tsv\n\n[barcode_plot]: https://github.com/mfcovington/auto_barcode/blob/master/barcode_plot.R\n\n*Version 2.1.2*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmfcovington%2Fauto_barcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmfcovington%2Fauto_barcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmfcovington%2Fauto_barcode/lists"}