annotate fastx_barcode_splitter.pl @ 6:8da8564e2e45 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit fd099d17eceaa319fbfe429f4725328d88b18c9f
author iuc
date Thu, 10 Aug 2023 06:51:23 +0000
parents e3d91cb9f196
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
1 #!/usr/bin/env perl
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
2
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
3 # FASTX-toolkit - FASTA/FASTQ preprocessing tools.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
4 # Copyright (C) 2009-2013 A. Gordon (assafgordon@gmail.com)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
5 #
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
6 # Lance Parsons (lparsons@princeton.edu)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
7 # 3/21/2011 - Modified to accept separate index file for barcodes
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
8 # 4/6/2011 - Modified to cleanup bad barcode identifiers (esp. useful for Galaxy)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
9 # 4/28/2016 - Modified summary output to remove file paths and add comment
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
10 # character '#'
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
11
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
12 # This program is free software: you can redistribute it and/or modify
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
13 # it under the terms of the GNU Affero General Public License as
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
14 # published by the Free Software Foundation, either version 3 of the
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
15 # License, or (at your option) any later version.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
16 #
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
17 # This program is distributed in the hope that it will be useful,
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
20 # GNU Affero General Public License for more details.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
21 #
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
22 # You should have received a copy of the GNU Affero General Public License
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
23 # along with this program. If not, see <http://www.gnu.org/licenses/>.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
24
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
25 use strict;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
26 use warnings;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
27 use IO::Handle;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
28 use Data::Dumper;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
29 use Getopt::Long;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
30 use Carp;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
31
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
32 ##
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
33 ## This program splits a FASTQ/FASTA file into several smaller files,
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
34 ## Based on barcode matching.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
35 ##
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
36 ## run with "--help" for usage information
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
37 ##
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
38 ## Assaf Gordon <assafgordon@gmail.com> , 11sep2008
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
39
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
40 # Forward declarations
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
41 sub load_barcode_file ($);
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
42 sub parse_command_line ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
43 sub match_sequences ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
44 sub mismatch_count($$) ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
45 sub print_results;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
46 sub open_and_detect_input_format;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
47 sub open_index_and_detect_input_format($);
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
48 sub read_index_record;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
49 sub read_record;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
50 sub write_record($);
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
51 sub usage();
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
52
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
53 # Global flags and arguments,
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
54 # Set by command line argumens
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
55 my $barcode_file ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
56 my $barcodes_at_eol = 0 ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
57 my $barcodes_at_bol = 0 ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
58 my $index_read_file ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
59 my $exact_match = 0 ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
60 my $allow_partial_overlap = 0;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
61 my $allowed_mismatches = 1;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
62 my $newfile_suffix = '';
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
63 my $newfile_prefix ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
64 my $quiet = 0 ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
65 my $debug = 0 ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
66 my $fastq_format = 1;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
67 my $index_fastq_format = 1;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
68 my $read_id_check_strip_characters = 1;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
69
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
70 # Global variables
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
71 # Populated by 'create_output_files'
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
72 my %filenames;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
73 my %files;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
74 my %counts = ( 'unmatched' => 0 );
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
75 my $barcodes_length;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
76 my @barcodes;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
77 my $input_file_io;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
78
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
79
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
80 # The Four lines per record in FASTQ format.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
81 # (when using FASTA format, only the first two are used)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
82 my $seq_name;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
83 my $seq_bases;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
84 my $seq_name2;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
85 my $seq_qualities;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
86
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
87 # Values used for index read file
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
88 my $index_seq_name;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
89 my $index_seq_bases;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
90 my $index_seq_name2;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
91 my $index_seq_qualities;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
92
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
93 #
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
94 # Start of Program
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
95 #
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
96 parse_command_line ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
97
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
98 load_barcode_file ( $barcode_file ) ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
99
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
100 open_and_detect_input_format;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
101
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
102 if (defined $index_read_file) {open_index_and_detect_input_format ( $index_read_file );}
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
103
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
104 match_sequences ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
105
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
106 print_results unless $quiet;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
107
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
108 #
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
109 # End of program
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
110 #
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
111
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
112 sub parse_command_line {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
113 my $help;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
114
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
115 usage() if (scalar @ARGV==0);
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
116
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
117 my $result = GetOptions ( "bcfile=s" => \$barcode_file,
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
118 "eol" => \$barcodes_at_eol,
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
119 "bol" => \$barcodes_at_bol,
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
120 "idxfile=s" => \$index_read_file,
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
121 "idxidstrip=i" => \$read_id_check_strip_characters,
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
122 "exact" => \$exact_match,
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
123 "prefix=s" => \$newfile_prefix,
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
124 "suffix=s" => \$newfile_suffix,
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
125 "quiet" => \$quiet,
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
126 "partial=i" => \$allow_partial_overlap,
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
127 "debug" => \$debug,
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
128 "mismatches=i" => \$allowed_mismatches,
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
129 "help" => \$help
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
130 ) ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
131
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
132 usage() if ($help);
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
133
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
134 die "Error: barcode file not specified (use '--bcfile [FILENAME]')\n" unless defined $barcode_file;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
135 die "Error: prefix path/filename not specified (use '--prefix [PATH]')\n" unless defined $newfile_prefix;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
136
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
137 if (! defined $index_read_file) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
138 if ($barcodes_at_bol == $barcodes_at_eol) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
139 die "Error: can't specify both --eol & --bol\n" if $barcodes_at_eol;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
140 die "Error: must specify either --eol or --bol or --idxfile\n" ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
141 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
142 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
143 elsif ($barcodes_at_bol || $barcodes_at_eol) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
144 die "Error: Must specify only one of --idxfile, --eol, or --bol";
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
145 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
146
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
147 die "Error: invalid for value partial matches (valid values are 0 or greater)\n" if $allow_partial_overlap<0;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
148
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
149 $allowed_mismatches = 0 if $exact_match;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
150
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
151 die "Error: invalid value for mismatches (valid values are 0 or more)\n" if ($allowed_mismatches<0);
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
152
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
153 die "Error: partial overlap value ($allow_partial_overlap) bigger than " .
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
154 "max. allowed mismatches ($allowed_mismatches)\n" if ($allow_partial_overlap > $allowed_mismatches);
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
155
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
156
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
157 exit unless $result;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
158 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
159
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
160
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
161
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
162 #
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
163 # Read the barcode file
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
164 #
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
165 sub load_barcode_file ($) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
166 my $filename = shift or croak "Missing barcode file name";
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
167
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
168 open BCFILE,"<$filename" or die "Error: failed to open barcode file ($filename)\n";
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
169 while (<BCFILE>) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
170 next if m/^#/;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
171 chomp;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
172 my ($ident, $barcode) = split('\t') ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
173
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
174 $barcode = uc($barcode);
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
175
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
176 # Sanity checks on the barcodes
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
177 die "Error: bad data at barcode file ($filename) line $.\n" unless defined $barcode;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
178 die "Error: bad barcode value ($barcode) at barcode file ($filename) line $.\n"
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
179 unless $barcode =~ m/^[AGCT]+$/;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
180
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
181 # Cleanup Identifiers (only allow alphanumeric, replace others with dash '-')
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
182 $ident =~ s/[^A-Za-z0-9]/-/g;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
183 die "Error: bad identifier value ($ident) at barcode file ($filename) line $. (must be alphanumeric)\n"
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
184 unless $ident =~ m/^\w+$/;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
185
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
186 die "Error: badcode($ident, $barcode) is shorter or equal to maximum number of " .
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
187 "mismatches ($allowed_mismatches). This makes no sense. Specify fewer mismatches.\n"
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
188 if length($barcode)<=$allowed_mismatches;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
189
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
190 $barcodes_length = length($barcode) unless defined $barcodes_length;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
191 die "Error: found barcodes in different lengths. this feature is not supported yet.\n"
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
192 unless $barcodes_length == length($barcode);
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
193
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
194 push @barcodes, [$ident, $barcode];
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
195
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
196 if ($allow_partial_overlap>0) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
197 foreach my $i (1 .. $allow_partial_overlap) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
198 substr $barcode, ($barcodes_at_bol)?0:-1, 1, '';
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
199 push @barcodes, [$ident, $barcode];
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
200 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
201 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
202 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
203 close BCFILE;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
204
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
205 if ($debug) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
206 print STDERR "barcode\tsequence\n";
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
207 foreach my $barcoderef (@barcodes) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
208 my ($ident, $seq) = @{$barcoderef};
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
209 print STDERR $ident,"\t", $seq ,"\n";
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
210 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
211 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
212 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
213
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
214 # Create one output file for each barcode.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
215 # (Also create a file for the dummy 'unmatched' barcode)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
216 sub create_output_files {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
217 my %barcodes = map { $_->[0] => 1 } @barcodes; #generate a uniq list of barcode identifiers;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
218 $barcodes{'unmatched'} = 1 ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
219
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
220 foreach my $ident (keys %barcodes) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
221 my $new_filename = $newfile_prefix . $ident . $newfile_suffix;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
222 $filenames{$ident} = $new_filename;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
223 open my $file, ">$new_filename" or die "Error: failed to create output file ($new_filename)\n";
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
224 $files{$ident} = $file ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
225 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
226 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
227
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
228 sub match_sequences {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
229
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
230 my %barcodes = map { $_->[0] => 1 } @barcodes; #generate a uniq list of barcode identifiers;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
231 $barcodes{'unmatched'} = 1 ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
232
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
233 #reset counters
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
234 foreach my $ident ( keys %barcodes ) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
235 $counts{$ident} = 0;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
236 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
237
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
238 create_output_files;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
239
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
240 # Read file FASTQ file
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
241 # split accotding to barcodes
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
242 while ( read_record ) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
243 chomp $seq_name;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
244 chomp $seq_bases;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
245 if (defined $index_read_file) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
246 read_index_record() or die "Error: Unable to read index sequence for sequence name ($seq_name), check to make sure the file lengths match.\n";
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
247 chomp $index_seq_name;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
248 chomp $index_seq_bases;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
249
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
250 # Assert that the read ids match
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
251 my $seq_name_match = &strip_read_id($seq_name);
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
252 my $index_seq_name_match = &strip_read_id($index_seq_name);
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
253 if ($seq_name_match ne $index_seq_name_match) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
254 die "Error: Index sequence name ($index_seq_name) does not match sequence name ($seq_name)\n";
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
255 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
256
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
257 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
258
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
259 print STDERR "sequence $seq_bases: \n" if $debug;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
260
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
261 my $best_barcode_mismatches_count = $barcodes_length;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
262 my $best_barcode_ident = undef;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
263
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
264 #Try all barcodes, find the one with the lowest mismatch count
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
265 foreach my $barcoderef (@barcodes) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
266 my ($ident, $barcode) = @{$barcoderef};
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
267
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
268 # Get DNA fragment (in the length of the barcodes)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
269 # The barcode will be tested only against this fragment
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
270 # (no point in testing the barcode against the whole sequence)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
271 my $sequence_fragment;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
272 if ($barcodes_at_bol) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
273 $sequence_fragment = substr $seq_bases, 0, $barcodes_length;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
274 } elsif ($barcodes_at_eol) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
275 $sequence_fragment = substr $seq_bases, - $barcodes_length;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
276 } else {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
277 $sequence_fragment = substr $index_seq_bases, 0, $barcodes_length;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
278 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
279
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
280 my $mm = mismatch_count($sequence_fragment, $barcode) ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
281
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
282 # if this is a partial match, add the non-overlap as a mismatch
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
283 # (partial barcodes are shorter than the length of the original barcodes)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
284 $mm += ($barcodes_length - length($barcode));
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
285
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
286 if ( $mm < $best_barcode_mismatches_count ) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
287 $best_barcode_mismatches_count = $mm ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
288 $best_barcode_ident = $ident ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
289 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
290 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
291
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
292 $best_barcode_ident = 'unmatched'
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
293 if ( (!defined $best_barcode_ident) || $best_barcode_mismatches_count>$allowed_mismatches) ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
294
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
295 print STDERR "sequence $seq_bases matched barcode: $best_barcode_ident\n" if $debug;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
296
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
297 $counts{$best_barcode_ident}++;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
298
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
299 #get the file associated with the matched barcode.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
300 #(note: there's also a file associated with 'unmatched' barcode)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
301 my $file = $files{$best_barcode_ident};
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
302
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
303 write_record($file);
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
304 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
305 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
306
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
307 # Strip end of readids when matching to avoid mismatch between read 1, 2, 3, etc.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
308 sub strip_read_id {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
309 my $read_id = shift;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
310 my $stripped_read_id = $read_id;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
311 if ($read_id_check_strip_characters) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
312 if ($read_id =~ /@([^:]+):([0-9]+):([^:]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+) ([0-9]+):([YN]):([0-9]+):([ACGT]+){0,1}/) { # CASAVA 1.8+
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
313 my @parts = split(/ /,$read_id);
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
314 $stripped_read_id = $parts[0];
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
315 } else { # CASAVA 1.7 and earlier
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
316 $stripped_read_id = substr($read_id, 0, length($read_id)-$read_id_check_strip_characters);
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
317 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
318 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
319 return $stripped_read_id;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
320 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
321
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
322 #Quickly calculate hamming distance between two strings
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
323 #
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
324 #NOTE: Strings must be same length.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
325 # returns number of different characters.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
326 #see http://www.perlmonks.org/?node_id=500235
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
327 sub mismatch_count($$) { length( $_[ 0 ] ) - ( ( $_[ 0 ] ^ $_[ 1 ] ) =~ tr[\0][\0] ) }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
328
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
329 sub print_results
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
330 {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
331 print "# Barcode\tCount\n";
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
332 my $total = 0 ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
333 foreach my $ident (sort keys %counts) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
334 print $ident, "\t", $counts{$ident},"\n";
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
335 $total += $counts{$ident};
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
336 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
337 print "total\t",$total,"\n";
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
338 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
339
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
340 sub read_record
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
341 {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
342 $seq_name = $input_file_io->getline();
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
343
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
344 return undef unless defined $seq_name; # End of file?
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
345
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
346 $seq_bases = $input_file_io->getline();
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
347 die "Error: bad input file, expecting line with sequences\n" unless defined $seq_bases;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
348
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
349 # If using FASTQ format, read two more lines
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
350 if ($fastq_format) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
351 $seq_name2 = $input_file_io->getline();
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
352 die "Error: bad input file, expecting line with sequence name2\n" unless defined $seq_name2;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
353
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
354 $seq_qualities = $input_file_io->getline();
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
355 die "Error: bad input file, expecting line with quality scores\n" unless defined $seq_qualities;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
356 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
357 return 1;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
358 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
359
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
360 sub write_record($)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
361 {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
362 my $file = shift;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
363
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
364 croak "Bad file handle" unless defined $file;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
365
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
366 print $file $seq_name,"\n";
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
367 print $file $seq_bases,"\n";
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
368
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
369 #if using FASTQ format, write two more lines
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
370 if ($fastq_format) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
371 print $file $seq_name2;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
372 print $file $seq_qualities;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
373 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
374 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
375
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
376 sub open_and_detect_input_format
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
377 {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
378 $input_file_io = new IO::Handle;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
379 die "Failed to open STDIN " unless $input_file_io->fdopen(fileno(STDIN),"r");
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
380
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
381 # Get the first characeter, and push it back
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
382 my $first_char = $input_file_io->getc();
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
383 $input_file_io->ungetc(ord $first_char);
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
384
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
385 if ($first_char eq '>') {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
386 # FASTA format
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
387 $fastq_format = 0 ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
388 print STDERR "Detected FASTA format\n" if $debug;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
389 } elsif ($first_char eq '@') {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
390 # FASTQ format
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
391 $fastq_format = 1;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
392 print STDERR "Detected FASTQ format\n" if $debug;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
393 } else {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
394 die "Error: unknown file format. First character = '$first_char' (expecting > or \@)\n";
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
395 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
396 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
397
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
398 sub open_index_and_detect_input_format($) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
399 my $filename = shift or croak "Missing index read file name";
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
400
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
401 open IDXFILE,"<$filename" or die "Error: failed to open index read file ($filename)\n";
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
402
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
403 # Get the first line, and reset file pointer
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
404 my $first_line = <IDXFILE>;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
405 my $first_char = substr($first_line, 0, 1);
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
406 seek(IDXFILE, 0, 0);
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
407
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
408 if ($first_char eq '>') {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
409 # FASTA format
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
410 $index_fastq_format = 0 ;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
411 print STDERR "Detected FASTA format for index file\n" if $debug;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
412 } elsif ($first_char eq '@') {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
413 # FASTQ format
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
414 $index_fastq_format = 1;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
415 print STDERR "Detected FASTQ format for index file\n" if $debug;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
416 } else {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
417 die "Error: unknown index file format. First character = '$first_char' (expecting > or \@)\n";
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
418 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
419 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
420
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
421 sub read_index_record
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
422 {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
423 $index_seq_name = <IDXFILE>;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
424
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
425 return undef unless defined $index_seq_name; # End of file?
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
426
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
427 $index_seq_bases = <IDXFILE>;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
428 die "Error: bad input file, expecting line with sequences\n" unless defined $index_seq_bases;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
429
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
430 # If using FASTQ format, read two more lines
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
431 if ($index_fastq_format) {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
432 $index_seq_name2 = <IDXFILE>;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
433 die "Error: bad input file, expecting line with sequence name2\n" unless defined $index_seq_name2;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
434
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
435 $index_seq_qualities = <IDXFILE>;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
436 die "Error: bad input file, expecting line with quality scores\n" unless defined $index_seq_qualities;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
437 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
438 return 1;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
439 }
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
440
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
441 sub usage()
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
442 {
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
443 print<<EOF;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
444 Barcode Splitter, by Assaf Gordon (gordon\@cshl.edu), 11sep2008
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
445
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
446 This program reads FASTA/FASTQ file and splits it into several smaller files,
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
447 Based on barcode matching.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
448 FASTA/FASTQ data is read from STDIN (format is auto-detected.)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
449 Output files will be writen to disk.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
450 Summary will be printed to STDOUT.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
451
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
452 usage: $0 --bcfile FILE --prefix PREFIX [--suffix SUFFIX] [--bol|--eol|--idxfile]
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
453 [--mismatches N] [--exact] [--partial N] [--idxidstrip N]
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
454 [--help] [--quiet] [--debug]
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
455
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
456 Arguments:
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
457
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
458 --bcfile FILE - Barcodes file name. (see explanation below.)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
459 --prefix PREFIX - File prefix. will be added to the output files. Can be used
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
460 to specify output directories.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
461 --suffix SUFFIX - File suffix (optional). Can be used to specify file
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
462 extensions.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
463 --bol - Try to match barcodes at the BEGINNING of sequences.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
464 (What biologists would call the 5' end, and programmers
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
465 would call index 0.)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
466 --eol - Try to match barcodes at the END of sequences.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
467 (What biologists would call the 3' end, and programmers
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
468 would call the end of the string.)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
469 --idxfile FILE - Read barcodes from separate index file (fasta or fastq)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
470 NOTE: one of --bol, --eol, --idxfile must be specified,
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
471 but not more than one.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
472 --idxidstrip N - When using index file, strip this number of characters
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
473 from the end of the sequence id before matching.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
474 Automatically detects CASAVA 1.8 format and strips at a
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
475 space in the id, use 0 to disable this.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
476 (Default is 1).
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
477 --mismatches N - Max. number of mismatches allowed. default is 1.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
478 --exact - Same as '--mismatches 0'. If both --exact and --mismatches
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
479 are specified, '--exact' takes precedence.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
480 --partial N - Allow partial overlap of barcodes. (see explanation below.)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
481 (Default is not partial matching)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
482 --quiet - Don't print counts and summary at the end of the run.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
483 (Default is to print.)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
484 --debug - Print lots of useless debug information to STDERR.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
485 --help - This helpful help screen.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
486
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
487 Example (Assuming 's_2_100.txt' is a FASTQ file, 'mybarcodes.txt' is
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
488 the barcodes file):
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
489
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
490 \$ cat s_2_100.txt | $0 --bcfile mybarcodes.txt --bol --mismatches 2 \\
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
491 --prefix /tmp/bla_ --suffix ".txt"
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
492
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
493 Barcode file format
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
494 -------------------
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
495 Barcode files are simple text files. Each line should contain an identifier
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
496 (descriptive name for the barcode), and the barcode itself (A/C/G/T),
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
497 separated by a TAB character. Example:
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
498
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
499 #This line is a comment (starts with a 'number' sign)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
500 BC1 GATCT
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
501 BC2 ATCGT
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
502 BC3 GTGAT
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
503 BC4 TGTCT
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
504
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
505 For each barcode, a new FASTQ file will be created (with the barcode's
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
506 identifier as part of the file name). Sequences matching the barcode
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
507 will be stored in the appropriate file.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
508
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
509 Running the above example (assuming "mybarcodes.txt" contains the above
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
510 barcodes), will create the following files:
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
511 /tmp/bla_BC1.txt
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
512 /tmp/bla_BC2.txt
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
513 /tmp/bla_BC3.txt
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
514 /tmp/bla_BC4.txt
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
515 /tmp/bla_unmatched.txt
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
516 The 'unmatched' file will contain all sequences that didn't match any barcode.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
517
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
518 Barcode matching
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
519 ----------------
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
520
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
521 ** Without partial matching:
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
522
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
523 Count mismatches between the FASTA/Q sequences and the barcodes.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
524 The barcode which matched with the lowest mismatches count (providing the
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
525 count is small or equal to '--mismatches N') 'gets' the sequences.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
526
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
527 Example (using the above barcodes):
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
528 Input Sequence:
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
529 GATTTACTATGTAAAGATAGAAGGAATAAGGTGAAG
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
530
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
531 Matching with '--bol --mismatches 1':
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
532 GATTTACTATGTAAAGATAGAAGGAATAAGGTGAAG
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
533 GATCT (1 mismatch, BC1)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
534 ATCGT (4 mismatches, BC2)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
535 GTGAT (3 mismatches, BC3)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
536 TGTCT (3 mismatches, BC4)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
537
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
538 This sequence will be classified as 'BC1' (it has the lowest mismatch count).
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
539 If '--exact' or '--mismatches 0' were specified, this sequence would be
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
540 classified as 'unmatched' (because, although BC1 had the lowest mismatch count,
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
541 it is above the maximum allowed mismatches).
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
542
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
543 Matching with '--eol' (end of line) does the same, but from the other side
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
544 of the sequence.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
545
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
546 ** With partial matching (very similar to indels):
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
547
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
548 Same as above, with the following addition: barcodes are also checked for
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
549 partial overlap (number of allowed non-overlapping bases is '--partial N').
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
550
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
551 Example:
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
552 Input sequence is ATTTACTATGTAAAGATAGAAGGAATAAGGTGAAG
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
553 (Same as above, but note the missing 'G' at the beginning.)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
554
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
555 Matching (without partial overlapping) against BC1 yields 4 mismatches:
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
556 ATTTACTATGTAAAGATAGAAGGAATAAGGTGAAG
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
557 GATCT (4 mismatches)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
558
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
559 Partial overlapping would also try the following match:
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
560 -ATTTACTATGTAAAGATAGAAGGAATAAGGTGAAG
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
561 GATCT (1 mismatch)
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
562
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
563 Note: scoring counts a missing base as a mismatch, so the final
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
564 mismatch count is 2 (1 'real' mismatch, 1 'missing base' mismatch).
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
565 If running with '--mismatches 2' (meaning allowing upto 2 mismatches) - this
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
566 seqeunce will be classified as BC1.
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
567
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
568 EOF
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
569
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
570 exit 1;
e3d91cb9f196 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/fastx_toolkit/fastx_barcode_splitter commit bbb2e6b6769b03602a8ab97001f88fbec52080a1
iuc
parents:
diff changeset
571 }