-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbatch_oligocount.pl
980 lines (740 loc) · 26.6 KB
/
batch_oligocount.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
#!/usr/bin/perl -w
#-----------------------------------------------------------+
# |
# batch_oligocount.pl - Batch count oligomers |
# |
#-----------------------------------------------------------+
# |
# AUTHOR: James C. Estill |
# CONTACT: JamesEstill_@_gmail.com |
# STARTED: 10/11/2007 |
# UPDATED: 02/15/2008 |
# |
# DESCRIPTION: |
# Short Program Description |
# |
# USAGE: |
# ShortFasta Infile.fasta Outfile.fasta |
# |
# VERSION: $Rev: 348 $ |
# |
# LICENSE: |
# GNU General Public License, Version 3 |
# http://www.gnu.org/licenses/gpl.html |
# |
#-----------------------------------------------------------+
#
# TO DO:
# Load to array then print to file handle instead of print on demand
#
# Accept threshold as comma delimited array
#
# MODIFY CONFIG FILE
# param_name
# kmer_len
# database_path
# additional vmatch options
package DAWGPAWS;
#-----------------------------+
# INCLUDES |
#-----------------------------+
use Bio::SeqIO; # Seq IO used to to work with the input file
use strict;
use Getopt::Long;
# The following needed for printing help
use Pod::Select; # Print subsections of POD documentation
use Pod::Text; # Print POD doc as formatted text file
use IO::Scalar; # For print_help subfunction
use IO::Pipe; # Pipe for STDIN, STDOUT for POD docs
use File::Spec; # Convert a relative path to an abosolute path
#-----------------------------+
# PROGRAM VARIABLES |
#-----------------------------+
my ($VERSION) = q$Rev$ =~ /(\d+)/;
#-----------------------------+
# VARIABLE SCOPE |
#-----------------------------+
my $indir; # Directory containing fasta files to process
my $outdir; # Base directory for output
my $indexdir; # Directory containing the index files
my $file_config; # Path to the configuration file
my $index; # Path to the sequence index file
#my $kmer_len = 20; # Oligomer length, default is 20
#my $seq_name; # Sequence name used in the output
my $name_root;
my $file_num;
#my $infile;
# Booleans
my $quiet = 0;
my $verbose = 0;
my $show_help = 0;
my $show_usage = 0;
my $show_man = 0;
my $show_version = 0;
my $do_gff = 0; # Boolean to create the gff file
my $thresh = '50';
# ARRAYS
my @params; # Parameters array for running oligocounts
# Index starts at zero
my @thresh_vals; # Array of threshold values
#-----------------------------+
# COMMAND LINE OPTIONS |
#-----------------------------+
my $ok = GetOptions(# REQUIRED OPTIONS
"i|indir=s" => \$indir,
"o|outdir=s" => \$outdir,
"c|config=s" => \$file_config,
# ADDITIONAL OPTIONS
# "t|thresh=s" => \$thresh,
# Thresh can take one or more
"t|thresh=i{1,}" => \@thresh_vals,
# BOOLEAN OPTIONS
"q|quiet" => \$quiet,
"verbose" => \$verbose,
"gff" => \$do_gff,
# ADDITIONAL INFORMATION
"usage" => \$show_usage,
"version" => \$show_version,
"man" => \$show_man,
"h|help" => \$show_help,);
#-----------------------------+
# SHOW REQUESTED HELP |
#-----------------------------+
if ( ($show_usage) ) {
print_help ("usage", $0 );
}
if ( ($show_help) || (!$ok) ) {
print_help ("help", $0 );
}
if ($show_version) {
print "\n$0:\nVersion: $VERSION\n\n";
exit;
}
if ($show_man) {
# User perldoc to generate the man documentation.
system("perldoc $0");
exit($ok ? 0 : 2);
}
# Throw error if required options not present
if ( (!$indir) || (!$outdir) || (!$file_config) ) {
print "\a";
print "\n";
print "ERROR: Input file path required\n" if (!$indir);
print "ERROR: Output directory required\n" if (!$outdir);
print "ERROR: Config file path required\n" if (!$file_config);
print_help("");
}
# TEST OF PASSING THRESHOLD VALUES ARRAY
if (@thresh_vals) {
print STDERR "There are threshold values\n";
for my $thresh (@thresh_vals) {
print STDERR "\tT: $thresh \n";
}
}
else {
print STDERR "There are no threshold values\n";
}
#exit;
#-----------------------------+
# CHECK FOR SLASH IN DIR |
# VARIABLES |
#-----------------------------+
# If the indir does not end in a slash then append one
# TO DO: Allow for backslash
unless ($indir =~ /\/$/ ) {
$indir = $indir."/";
}
unless ($outdir =~ /\/$/ ) {
$outdir = $outdir."/";
}
#unless ($indexdir =~ /\/$/ ) {
# $outdir = $indexdir."/";
#}
#-----------------------------+
# Get the FASTA files from the|
# directory provided by the |
# var $indir |
#-----------------------------+
opendir( DIR, $indir ) ||
die "Can't open directory:\n$indir";
my @fasta_files = grep /\.fasta$|\.fa$/, readdir DIR ;
closedir( DIR );
my $num_files = @fasta_files;
#-----------------------------+
# SHOW ERROR IF NO FILES |
# WERE FOUND IN THE INPUT DIR |
#-----------------------------+
if ($num_files == 0) {
print "\a";
print "\nERROR: No fasta files were found in the input directory\n".
"$indir\n".
"Fasta files must have the fasta or fa extension.\n\n";
exit;
}
print STDERR "NUMBER OF FILES TO PROCESS: $num_files\n" if $verbose;
#-----------------------------+
# CREATE THE OUT DIR |
# IF IT DOES NOT EXIST |
#-----------------------------+
unless (-e $outdir) {
print "Creating output dir ...\n" if $verbose;
mkdir $outdir ||
die "ERROR: Could not create the output directory:\n$outdir";
}
#-----------------------------+
# GET INFO FROM CONFIG FILE |
#-----------------------------+
# Load to the 2d dbs array
open (CONFIG, $file_config) ||
die "Can't open the config file:\n$file_config";
open (CONFIG, $file_config) ||
die "Can't open the config file:\n$file_config";
my $i = 0;
my $line_num = 0;
while (<CONFIG>) {
$line_num ++;
unless (m/^\#/) {
chomp;
my @tmpary = split (/\t/);
my $count_tmp = @tmpary;
# If the parameter line has the expected number of parameters
if ($count_tmp == 3 ||
$count_tmp == 4) {
$i++;
$params[$i][0] = $tmpary[0]; # Param Name
$params[$i][1] = $tmpary[1]; # k_mer length
$params[$i][2] = $tmpary[2]; # index db path
$params[$i][3] = $tmpary[3] || "NULL"; # vmatch options
}
else {
print STDERR "ERROR: Config file line number $line_num\n";
print STDERR " $count_tmp variables were found\n";
}
}
} # End of while CONFIG
close CONFIG;
# Number of parameter sets specified in the config file
my $num_par_sets = $i;
my $num_proc_total = $num_files * $num_par_sets;
print STDERR "$num_proc_total oligocount runs to process\n" if $verbose;
#-----------------------------+
# OLIGO COUNT FOR EACH FILE |
# FOR EACH CONFIG SET |
#-----------------------------+
my $proc_num = 0;
for my $ind_file (@fasta_files) {
$file_num++;
my $infile = $indir.$ind_file;
#-----------------------------+
# Get the root name of the |
# file to mask |
#-----------------------------+
if ($ind_file =~ m/(.*)\.masked\.fasta$/) {
# file ends in .masked.fasta
$name_root = "$1";
}
elsif ($ind_file =~ m/(.*)\.fasta$/ ) {
# file ends in .fasta
$name_root = "$1";
}
elsif ($ind_file =~ m/(.*)\.fa$/ ) {
# file ends in .fa
$name_root = "$1";
}
else {
$name_root = $ind_file;
}
#-----------------------------+
# Create parent dir if it |
# does not already exist |
#-----------------------------+
my $dir_parent = $outdir.$name_root."/";
unless (-e $dir_parent) {
print "creating dir: $dir_parent\n";
mkdir $dir_parent ||
die "Could not create the output dir:\n$dir_parent\n";
}
#-----------------------------+
# Create the dir to hold all |
# the oligocount outupt |
#-----------------------------+
my $dir_oligocount = $dir_parent."oligocount/";
unless (-e $dir_oligocount ) {
print "Creating output dir\n: $dir_oligocount\n" if $verbose;
mkdir $dir_oligocount ||
die "Could not create the output directory:\n$dir_oligocount";
}
#-----------------------------+
# Create the GFF dir |
#-----------------------------+
my $dir_gff = $dir_parent."gff/";
unless (-e $dir_gff ) {
print "Creating output dir\n: $dir_gff\n" if $verbose;
mkdir $dir_gff ||
die "Could not create the output directory:\n$dir_gff";
}
#-----------------------------+
# CREATE VMATCH OUT DIR |
#-----------------------------+
my $vmatch_out_dir = $dir_parent."vmatch/";
unless (-e $vmatch_out_dir) {
print "creating dir: $vmatch_out_dir\n" if $verbose;
mkdir $vmatch_out_dir ||
die "Could not create the vmatch output dir:\nmatch_out_dir\n";
}
my $max_i = $num_par_sets+1;
for (my $i=1; $i<$max_i; $i++) {
$proc_num++;
if ($verbose) {
print STDERR "===============================================\n";
print STDERR " Process $proc_num of $num_proc_total\n";
print STDERR "===============================================\n";
}
# LOAD VARS FROM THE PARAMS ARRAY
# CHANGED 03/30/2010
my $param_name = $params[$i][0]
|| die "Error in paramter array line $i\n";
my $db_name = $params[$i][1]
|| die "Error in parameter array line $i\n";
my $index = $params[$i][2]
|| die "Error in paramter array line $i\n";
#-----------------------------+
# RUN KMER COUNT FOR INFILE |
#-----------------------------+
# Need to add db_name to the following
#seq_kmer_count ($infile, $dir_parent, $index, $kmer_len, $name_root,
# $do_gff, $db_name);
seq_kmer_count ($infile, $outdir, $index, $kmer_len, $name_root,
$do_gff, $db_name);
}
}
exit 1;
#-----------------------------------------------------------+
# SUBFUNCTIONS |
#-----------------------------------------------------------+
sub print_help {
my ($help_msg, $podfile) = @_;
# help_msg is the type of help msg to use (ie. help vs. usage)
print "\n";
#-----------------------------+
# PIPE WITHIN PERL |
#-----------------------------+
# This code made possible by:
# http://www.perlmonks.org/index.pl?node_id=76409
# Tie info developed on:
# http://www.perlmonks.org/index.pl?node=perltie
#
#my $podfile = $0;
my $scalar = '';
tie *STDOUT, 'IO::Scalar', \$scalar;
if ($help_msg =~ "usage") {
podselect({-sections => ["SYNOPSIS|MORE"]}, $0);
}
else {
podselect({-sections => ["SYNOPSIS|ARGUMENTS|OPTIONS|MORE"]}, $0);
}
untie *STDOUT;
# now $scalar contains the pod from $podfile you can see this below
#print $scalar;
my $pipe = IO::Pipe->new()
or die "failed to create pipe: $!";
my ($pid,$fd);
if ( $pid = fork() ) { #parent
open(TMPSTDIN, "<&STDIN")
or die "failed to dup stdin to tmp: $!";
$pipe->reader();
$fd = $pipe->fileno;
open(STDIN, "<&=$fd")
or die "failed to dup \$fd to STDIN: $!";
my $pod_txt = Pod::Text->new (sentence => 0, width => 78);
$pod_txt->parse_from_filehandle;
# END AT WORK HERE
open(STDIN, "<&TMPSTDIN")
or die "failed to restore dup'ed stdin: $!";
}
else { #child
$pipe->writer();
$pipe->print($scalar);
$pipe->close();
exit 0;
}
$pipe->close();
close TMPSTDIN;
print "\n";
exit 0;
}
sub seq_kmer_count {
my ($fasta_in, $outdir, $vmatch_index, $k, $seq_name,
$do_gff, $db_name) = @_;
# Array of threshold values
#my @thresh = ("200");
my $thresh = 50;
my $in_seq_num = 0;
# TODO:
# Add option to do something here when infile not encountered
my $inseq = Bio::SeqIO->new( -file => "<$fasta_in",
-format => 'fasta')
|| die "Can not open seq input file $fasta_in\n";
#-----------------------------+
# SET DIR PATHS |
#-----------------------------+
# These will need to already exist
my $dir_parent = $outdir.$name_root."/";
my $vmatch_out_dir = $dir_parent."vmatch/";
my $gff_out_dir = $dir_parent."gff/";
my $dir_oligocount = $dir_parent."oligocount/";
# Counts of the number of occurences of each oligo
my @counts = ();
my @vdat; # temp array to hold the vmatch data split by tab
my $pos = 0;
my $start_pos;
my $end_pos;
my $i; # Array index value
#-----------------------------+
# FILE PATHS |
#-----------------------------+
# Something is unitilized here
#print "TEST: $db_name\n";
# Fasta file split into kmers
my $temp_fasta = $dir_oligocount.
"split_seq_".$k."mer.fasta";
# Vector of ocounts similar to
# score data
my $ocount_out = $dir_oligocount.
$seq_name."_".$k."mer_".$db_name."fast_count.txt";
# Raw vmatch output
my $vmatch_out = $vmatch_out_dir.
$seq_name."_".$k."mer_".$db_name.".txt";
# GFF Count output
#$dir_gff = $dir_parent."gff/";
my $gff_count_out = $gff_out_dir.
$seq_name."_".$k."mer_".$db_name.".gff";
#-----------------------------+
# WRITE FIRST LINE OF OCOUNT |
# FILE |
#-----------------------------+
open (OCOUNT,">$ocount_out") ||
die "Can not open oligo count file for output:\n$ocount_out\n";
print OCOUNT ">".$seq_name."_".$k."mer\n";
my $ocount_col = 1; # Set ocount col to one
while (my $seq = $inseq->next_seq) {
$in_seq_num++;
if ($in_seq_num == 2) {
print "\a";
die "Input file should be a single sequence record\n";
}
# Calculate base cooridate data
my $seq_len = $seq->length();
my $max_start = $seq->length() - $k;
# Print some summary data if running in verbose mode
print STDERR "\n==============================\n" if $verbose;
print STDERR "SEQ LEN: $seq_len\n" if $verbose;
print STDERR "MAX START: $max_start\n" if $verbose;
print STDERR "==============================\n" if $verbose;
#-----------------------------------------------------------+
# CREATE FASTA FILE OF ALL K LENGTH OLIGOS |
# IN THE INPUT SEQUENCE |
#-----------------------------------------------------------+
print STDERR "Creating oligo fasta file\n" if $verbose;
open (FASTAOUT, ">$temp_fasta") ||
die "Can not open temp fasta file:\n $temp_fasta\n";
for ($i=0; $i<=$max_start; $i++) {
$start_pos = $i + 1;
$end_pos = $start_pos + $k - 1;
my $oligo = $seq->subseq($start_pos, $end_pos);
# Set counts array to zero
$counts[$i] = 0;
print FASTAOUT ">$start_pos\n";
print FASTAOUT "$oligo\n";
}
close (FASTAOUT);
# QUERY OLIGO FASTA FILE AGAINST VMATCH INDEX
my $vmatch_cmd = "vmatch -q $temp_fasta -complete".
" $vmatch_index > $vmatch_out";
# # OUTPUT TO STDOUT FOR DEBUG
# my $vmatch_cmd = "vmatch -q $temp_fasta -complete".
# " $vmatch_index";
print STDERR "\nVmatch cmd:\n$vmatch_cmd\n" if $verbose;
system ($vmatch_cmd);
# PARSE VMATCH OUTPUT FILE
# increment
unless (-e $vmatch_out) {
print STDERR "Can not file the expected vmatch output file\n";
die;
}
# PARSE THE VMATCH OUTPUT FILE AND INCREMENT
# THE COUNTS ARRAY
open (VMATCH, "<$vmatch_out") ||
die "Can not open vmatch output file:\n$vmatch_out\n";
# Count oligos hits in index file
print STDERR "\nCounting oligos ...\n" if $verbose;
while (<VMATCH>) {
# ignore comment lines
unless (m/^\#/) {
chomp;
@vdat = split;
my $len_vdat = @vdat;
# print the following for debu
#print "VDAT LEN: $len_vdat\n";
#print $vdat[5]."\n";
# Get the seq file in the new sub se
# Counts index starts at zero
# It may be possible to increment without needing
# to add one
#$counts[$vdat[5]]++;
$counts[$vdat[5]] = $counts[$vdat[5]] + 1;
}
}
close (VMATCH);
#///////////////////////////////////
# NEED SEGMENTATION STEP HERE
# THIS WILL JOIN INDIVIDUAL PIPS
# FOR A GIVEN THRESHOLD COVERAGE
# This could also be done with a
# separate script operating on the
# gff output from this program.
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# Output oligo counts to gff file
# This is the pip segment file, a single pip with depth coverage data
# for eack oligo segment
if ($do_gff) {
open (GFFCOUNT, ">$gff_count_out") ||
die "Can not open gff out file:\n$gff_count_out\n";
}
print STDERR "\nCreating output files ...\n" if $verbose;
for ($i=0; $i<=$max_start; $i++) {
$start_pos = $i + 1;
$end_pos = $start_pos + $k - 1;
#-----------------------------+
# PRINT OCOUNT OUT |
#-----------------------------+
print OCOUNT $counts[$i];
$ocount_col++;
if ($ocount_col > 80) {
print OCOUNT "\n";
$ocount_col = 1;
}
else {
print OCOUNT " ";
}
#-----------------------------+
# GFF PIP OUTPUT FILE |
#-----------------------------+
# The count will be placed in the score position
my $seq_str = $seq->subseq($start_pos, $end_pos);
if ($do_gff) {
print GFFCOUNT "$seq_name\t". # Ref sequence
"vmatch\t". # Source
"o_count\t". # Type
"$start_pos\t". # Start
"$end_pos\t". # End
$counts[$i]."\t". # Score
".\t". # Strand
".\t". # Phase
"Vmatch ".$k."mer\n"; # Group
}
}
#-----------------------------+
# PRINT OLIGOS OVER THRESHOLD |
# TO STDOUT |
#-----------------------------+
# PRINT OUT SEQS EXCEEDING THRESHOLD VALUES TO STDOUT
# This uses a global thres_vals array ... naughty subfun
if (@thresh_vals) {
# LOAD THE THRESHOLD ARRAY
for my $thresh (@thresh_vals) {
# OPEN THE THRESHOLD GFF FILE
# Results of start end in the threshold array
my @mdr_results;
my $mdr_out =
# LOAD RESULTS TO THRESHOLD GFF FILE
print STDERR "\tT: $thresh \n";
if ($counts[$i] > $thresh) {
my $thresh_seq = $seq->subseq($start_pos, $end_pos);
#print STDOUT "$start_pos\t".$counts[$i]."\t".
# "$thresh_seq\n";
}
# PRINT THE THRESHOLD ARRAY TO GFF
# CLOSE THE THRESHOLD GFF FILE
}
}
# close the GFF and OC
close (GFFCOUNT) if ($do_gff);
close (OCOUNT);
} # End of while seq object
# May want to make a single fasta file of all oligos for the
# qry fasta_sequence and parse the results from vmatch from that
}
1;
__END__
=head1 NAME
batch_oligocount.pl - Count oligos from an input sequence
=head1 VERSION
This documentation refers to program version $Rev: 348 $
=head1 SYNOPSIS
=head2 Usage
seq_oligocount.pl -i InDir -o BaseOutDir -c ConfigFile -db index.fasta
-n SeqName -k 20
=head2 Required Arguments
-i,--indir # Directory containing the query fasta files
-d,--db # Path to the mkvtree index file
-o,--outdir # Path to the base output directory
-c,--config # Path to the configuration file
=head1 DESCRIPTION
The batch_oligocount program will run oligomer counts for a set of query
sequences in the fasta format. For each query sequence, the program
will break it
into subsequences of size k and query it against an persistent index
created by the mkvtree program. It produces a GFF output file describing
the number of copies of every oligomer in the query sequence in the
subject index database.
The variables I am considering incorporating
--thresh # Comma delimited array of integers to describe
# Currently using a single value, default is 50
# Currently just determins if this value is printed
# to STDOUT
--center # Location to center a point value of summary info as
# - start of oligomer
# - center of oligomer
# - end of oligomer
# - [left|right|center]
--gff # BOOLEAN. Don't always create a gff output
# Alternative output could be vector.
=head1 REQUIRED ARGUMENTS
=over 2
=item -i,--indir
Path of the input directory containing the sequence files to process.
=item -o,--outdir
Path of the base output directory.
=item -c,--config
Path to the configuration file. This should be in the format of a three
column tab delimited text file. Where:
=over 2
=item column 1 [integer]
Length of the kmer to generate.
=item column 2 [string]
Name to use for the database name.
=item column 3 [string]
Path to the index database to use.
=back
=back
=head1 OPTIONS
=over 2
=item --usage
Short overview of how to use program from command line.
=item --help
Show program usage with summary of options.
=item --version
Show program version.
=item --man
Show the full program manual. This uses the perldoc command to print the
POD documentation for the program.
=item -q,--quiet
Run the program with minimal output.
=back
=head1 DIAGNOSTICS
Error messages generated by this program and possible solutions are listed
below.
=over 2
=item ERROR: Could not create the output directory
The output directory could not be created at the path you specified.
This could be do to the fact that the directory that you are trying
to place your base directory in does not exist, or because you do not
have write permission to the directory you want to place your file in.
=back
=head1 CONFIGURATION AND ENVIRONMENT
=head2 Configuration File
The format of the configuration file is under current development. Currently
the config file is a tab delimited text file with two colums indicating
the oligomer length and the path to the index database.
=over 2
=item Col 1.
The length of the oligomer. The length of the oligomer is used as a
paramter k in the kmer counting, and will be used to name the output file.
=item Col 2.
The short name of the database serving as the query. This name will be used
to name the output file.
=item Col 3.
The path to the index database.
=back
=head2 Environment
The program currently does not make use of variables defined in the user
environment.
=head1 DEPENDENCIES
=head2 Required Software
=over 2
=item Vmatch
This program requires the Vmatch package of programs.
http://www.vmatch.de . This software is availabe at no cost for
noncommercial academic use. See program web page for details.
=back
=head2 Required Perl Modules
=over
=item * File::Copy
This module is required to copy the BLAST results.
=item * Getopt::Long
This module is required to accept options at the command line.
=item * Bio:SeqIO
The Bio:SeqIO module is a component of the BioPerl package
=back
=head1 BUGS AND LIMITATIONS
=head2 Bugs
=over 2
=item * No bugs currently known
If you find a bug with this software, file a bug report on the DAWG-PAWS
Sourceforge website: http://sourceforge.net/tracker/?group_id=204962
=back
=head2 Limitations
=over
=item * Limit to query sequence file
Since this program will generate a large file of your original sequence
broken into oligomers, you are somewhat limited to the size of query
sequence that is feasible to use this program with.
=item * Output limited to GFF file
The output for this program is currently limited to GFF file of
points with the copy number of each oligomer designeated.
=back
=head1 SEE ALSO
The seq_oligocount.pl program is part of the DAWG-PAWS package of genome
annotation programs. See the DAWG-PAWS web page
( http://dawgpaws.sourceforge.net/ )
or the Sourceforge project page
( http://sourceforge.net/projects/dawgpaws )
for additional information about this package.
=head1 LICENSE
GNU General Public License, Version 3
L<http://www.gnu.org/licenses/gpl.html>
=head1 AUTHOR
James C. Estill E<lt>JamesEstill at gmail.comE<gt>
=head1 HISTORY
STARTED: 12/21/2007
UPDATED: 02/15/2008
VERSION: $Rev$
=cut
#-----------------------------------------------------------+
# HISTORY |
#-----------------------------------------------------------+
#
# 12/21/2007
# - Started batch oligo count from seq_oligocount.pl
# - Modified to accept a directory of fasta files as input
# instead of a single fasta file
# - Takess directory paths as input:
# --indir # Path to indir with fasta files
# --outdir # Path to base outdir
# --indexdir # Path to dir with index databases
# - Now use a config file to set k, etc
#
# 02/15/2008
# - Debugged the batch_oligocount program
# - Fixed the use of the configuration file
# - Added additional documentation
#
#-----------------------------------------------------------+
# TO DO:
#-----------------------------------------------------------+
# - Currently the oligo fasta file is created for every single
# set of seqs from the input file. This is time consuming
# and should be avoided but this works for now.
# - Add array of threshhold values to the configuration file
# This would be a fourth column list of comma delimited integers