annotate bismark_genome_preparation @ 6:0f8646f22b8d draft

Uploaded
author bgruening
date Wed, 11 Feb 2015 16:21:51 -0500
parents 91f07ff056ca
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
1 #!/usr/bin/perl --
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
2 use strict;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
3 use warnings;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
4 use Cwd;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
5 use File::Path qw(rmtree);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
6 $|++;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
7
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
8
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
9 ## This program is Copyright (C) 2010-13, Felix Krueger (felix.krueger@babraham.ac.uk)
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
10
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
11 ## This program is free software: you can redistribute it and/or modify
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
12 ## it under the terms of the GNU General Public License as published by
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
13 ## the Free Software Foundation, either version 3 of the License, or
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
14 ## (at your option) any later version.
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
15
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
16 ## This program is distributed in the hope that it will be useful,
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
17 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
18 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
19 ## GNU General Public License for more details.
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
20
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
21 ## You should have received a copy of the GNU General Public License
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
22 ## along with this program. If not, see <http://www.gnu.org/licenses/>.
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
23
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
24 use Getopt::Long;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
25 use Cwd;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
26
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
27 my $verbose;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
28 my $help;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
29 my $version;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
30 my $man;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
31 my $path_to_bowtie;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
32 my $multi_fasta;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
33 my $single_fasta;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
34 my $bowtie2;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
35
3
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
36 my $bismark_version = 'v0.10.0';
0
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
37
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
38 GetOptions ('verbose' => \$verbose,
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
39 'help' => \$help,
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
40 'man' => \$man,
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
41 'version' => \$version,
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
42 'path_to_bowtie:s' => \$path_to_bowtie,
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
43 'single_fasta' => \$single_fasta,
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
44 'bowtie2' => \$bowtie2,
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
45 );
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
46
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
47 if ($help or $man){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
48 print_helpfile();
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
49 exit;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
50 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
51
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
52 if ($version){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
53 print << "VERSION";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
54
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
55 Bismark - Bisulfite Mapper and Methylation Caller.
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
56
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
57 Bismark Genome Preparation Version: $bismark_version
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
58 Copyright 2010-13 Felix Krueger, Babraham Bioinformatics
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
59 www.bioinformatics.babraham.ac.uk/projects/
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
60
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
61 VERSION
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
62 exit;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
63 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
64
3
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
65 my $genome_folder = shift @ARGV; # mandatory
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
66
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
67 # Ensuring a genome folder has been specified
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
68 if ($genome_folder){
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
69 unless ($genome_folder =~ /\/$/){
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
70 $genome_folder =~ s/$/\//;
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
71 }
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
72 $verbose and print "Path to genome folder specified as: $genome_folder\n";
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
73 chdir $genome_folder or die "Could't move to directory $genome_folder. Make sure the directory exists! $!";
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
74
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
75 # making the genome folder path abolsolute so it won't break if the path was specified relative
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
76 $genome_folder = getcwd;
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
77 unless ($genome_folder =~ /\/$/){
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
78 $genome_folder =~ s/$/\//;
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
79 }
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
80 }
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
81 else{
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
82 die "Please specify a genome folder to be used for bisulfite conversion\n\n";
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
83 }
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
84
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
85
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
86 my $CT_dir;
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
87 my $GA_dir;
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
88
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
89
0
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
90 if ($single_fasta){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
91 print "Writing individual genomes out into single-entry fasta files (one per chromosome)\n\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
92 $multi_fasta = 0;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
93 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
94 else{
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
95 print "Writing bisulfite genomes out into a single MFA (multi FastA) file\n\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
96 $single_fasta = 0;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
97 $multi_fasta = 1;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
98 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
99
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
100 my @filenames = create_bisulfite_genome_folders();
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
101
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
102 process_sequence_files ();
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
103
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
104 launch_bowtie_indexer();
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
105
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
106 sub launch_bowtie_indexer{
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
107 if ($bowtie2){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
108 print "Bismark Genome Preparation - Step III: Launching the Bowtie 2 indexer\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
109 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
110 else{
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
111 print "Bismark Genome Preparation - Step III: Launching the Bowtie (1) indexer\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
112 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
113 print "Please be aware that this process can - depending on genome size - take up to several hours!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
114 sleep(5);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
115
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
116 ### if the path to bowtie was specfified explicitely
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
117 if ($path_to_bowtie){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
118 if ($bowtie2){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
119 $path_to_bowtie =~ s/$/bowtie2-build/;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
120 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
121 else{
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
122 $path_to_bowtie =~ s/$/bowtie-build/;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
123 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
124 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
125 ### otherwise we assume that bowtie-build is in the path
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
126 else{
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
127 if ($bowtie2){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
128 $path_to_bowtie = 'bowtie2-build';
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
129 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
130 else{
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
131 $path_to_bowtie = 'bowtie-build';
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
132 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
133 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
134
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
135 $verbose and print "\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
136
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
137 ### Forking the program to run 2 instances of Bowtie-build or Bowtie2-build (= the Bowtie (1/2) indexer)
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
138 my $pid = fork();
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
139
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
140 # parent process
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
141 if ($pid){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
142 sleep(1);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
143 chdir $CT_dir or die "Unable to change directory: $!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
144 $verbose and warn "Preparing indexing of CT converted genome in $CT_dir\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
145 my @fasta_files = <*.fa>;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
146 my $file_list = join (',',@fasta_files);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
147 $verbose and print "Parent process: Starting to index C->T converted genome with the following command:\n\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
148 $verbose and print "$path_to_bowtie -f $file_list BS_CT\n\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
149
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
150 sleep (11);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
151 exec ("$path_to_bowtie","-f","$file_list","BS_CT");
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
152 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
153
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
154 # child process
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
155 elsif ($pid == 0){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
156 sleep(2);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
157 chdir $GA_dir or die "Unable to change directory: $!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
158 $verbose and warn "Preparing indexing of GA converted genome in $GA_dir\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
159 my @fasta_files = <*.fa>;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
160 my $file_list = join (',',@fasta_files);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
161 $verbose and print "Child process: Starting to index G->A converted genome with the following command:\n\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
162 $verbose and print "$path_to_bowtie -f $file_list BS_GA\n\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
163 $verbose and print "(starting in 10 seconds)\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
164 sleep(10);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
165 exec ("$path_to_bowtie","-f","$file_list","BS_GA");
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
166 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
167
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
168 # if the platform doesn't support the fork command we will run the indexing processes one after the other
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
169 else{
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
170 print "Forking process was not successful, therefore performing the indexing sequentially instead\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
171 sleep(10);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
172
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
173 ### moving to CT genome folder
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
174 $verbose and warn "Preparing to index CT converted genome in $CT_dir\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
175 chdir $CT_dir or die "Unable to change directory: $!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
176 my @fasta_files = <*.fa>;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
177 my $file_list = join (',',@fasta_files);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
178 $verbose and print "$file_list\n\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
179 sleep(2);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
180 system ("$path_to_bowtie","-f","$file_list","BS_CT");
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
181 @fasta_files=();
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
182 $file_list= '';
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
183
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
184 ### moving to GA genome folder
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
185 $verbose and warn "Preparing to index GA converted genome in $GA_dir\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
186 chdir $GA_dir or die "Unable to change directory: $!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
187 @fasta_files = <*.fa>;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
188 $file_list = join (',',@fasta_files);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
189 $verbose and print "$file_list\n\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
190 sleep(2);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
191 exec ("$path_to_bowtie","-f","$file_list","BS_GA");
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
192 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
193 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
194
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
195
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
196 sub process_sequence_files {
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
197
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
198 my ($total_CT_conversions,$total_GA_conversions) = (0,0);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
199 $verbose and print "Bismark Genome Preparation - Step II: Bisulfite converting reference genome\n\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
200 sleep (3);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
201
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
202 $verbose and print "conversions performed:\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
203 $verbose and print join("\t",'chromosome','C->T','G->A'),"\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
204
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
205
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
206 ### If someone wants to index a genome which consists of thousands of contig and scaffold files we need to write the genome conversions into an MFA file
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
207 ### Otherwise the list of comma separated chromosomes we provide for bowtie-build will get too long for the kernel to handle
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
208 ### This is now the default option
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
209
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
210 if ($multi_fasta){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
211 ### Here we just use one multi FastA file name, append .CT_conversion or .GA_conversion and print all sequence conversions into these files
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
212 my $bisulfite_CT_conversion_filename = "$CT_dir/genome_mfa.CT_conversion.fa";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
213 open (CT_CONVERT,'>',$bisulfite_CT_conversion_filename) or die "Can't write to file $bisulfite_CT_conversion_filename: $!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
214
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
215 my $bisulfite_GA_conversion_filename = "$GA_dir/genome_mfa.GA_conversion.fa";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
216 open (GA_CONVERT,'>',$bisulfite_GA_conversion_filename) or die "Can't write to file $bisulfite_GA_conversion_filename: $!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
217 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
218
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
219 foreach my $filename(@filenames){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
220 my ($chromosome_CT_conversions,$chromosome_GA_conversions) = (0,0);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
221 open (IN,$filename) or die "Failed to read from sequence file $filename $!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
222 # warn "Reading chromosome information from $filename\n\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
223
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
224 ### first line needs to be a fastA header
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
225 my $first_line = <IN>;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
226 chomp $first_line;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
227
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
228 ### Extracting chromosome name from the FastA header
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
229 my $chromosome_name = extract_chromosome_name($first_line);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
230
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
231 ### alternatively, chromosomes can be written out into single-entry FastA files. This will only work for genomes with up to a few hundred chromosomes.
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
232 unless ($multi_fasta){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
233 my $bisulfite_CT_conversion_filename = "$CT_dir/$chromosome_name";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
234 $bisulfite_CT_conversion_filename =~ s/$/.CT_conversion.fa/;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
235 open (CT_CONVERT,'>',$bisulfite_CT_conversion_filename) or die "Can't write to file $bisulfite_CT_conversion_filename: $!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
236
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
237 my $bisulfite_GA_conversion_filename = "$GA_dir/$chromosome_name";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
238 $bisulfite_GA_conversion_filename =~ s/$/.GA_conversion.fa/;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
239 open (GA_CONVERT,'>',$bisulfite_GA_conversion_filename) or die "Can't write to file $bisulfite_GA_conversion_filename: $!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
240 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
241
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
242 print CT_CONVERT ">",$chromosome_name,"_CT_converted\n"; # first entry
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
243 print GA_CONVERT ">",$chromosome_name,"_GA_converted\n"; # first entry
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
244
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
245
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
246 while (<IN>){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
247
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
248 ### in case the line is a new fastA header
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
249 if ($_ =~ /^>/){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
250 ### printing out the stats for the previous chromosome
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
251 $verbose and print join ("\t",$chromosome_name,$chromosome_CT_conversions,$chromosome_GA_conversions),"\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
252 ### resetting the chromosome transliteration counters
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
253 ($chromosome_CT_conversions,$chromosome_GA_conversions) = (0,0);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
254
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
255 ### Extracting chromosome name from the additional FastA header
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
256 $chromosome_name = extract_chromosome_name($_);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
257
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
258 ### alternatively, chromosomes can be written out into single-entry FastA files. This will only work for genomes with up to a few hundred chromosomes.
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
259 unless ($multi_fasta){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
260 my $bisulfite_CT_conversion_filename = "$CT_dir/$chromosome_name";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
261 $bisulfite_CT_conversion_filename =~ s/$/.CT_conversion.fa/;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
262 open (CT_CONVERT,'>',$bisulfite_CT_conversion_filename) or die "Can't write to file $bisulfite_CT_conversion_filename: $!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
263
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
264 my $bisulfite_GA_conversion_filename = "$GA_dir/$chromosome_name";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
265 $bisulfite_GA_conversion_filename =~ s/$/.GA_conversion.fa/;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
266 open (GA_CONVERT,'>',$bisulfite_GA_conversion_filename) or die "Can't write to file $bisulfite_GA_conversion_filename: $!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
267 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
268
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
269 print CT_CONVERT ">",$chromosome_name,"_CT_converted\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
270 print GA_CONVERT ">",$chromosome_name,"_GA_converted\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
271 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
272
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
273 else{
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
274 my $sequence = uc$_;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
275
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
276 ### (I) First replacing all ambiguous sequence characters (such as M,S,R....) by N (G,A,T,C,N and the line endings \r and \n are added to a character group)
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
277
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
278 $sequence =~ s/[^ATCGN\n\r]/N/g;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
279
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
280 ### (II) Writing the chromosome out into a C->T converted version (equals forward strand conversion)
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
281
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
282 my $CT_sequence = $sequence;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
283 my $CT_transliterations_performed = ($CT_sequence =~ tr/C/T/); # converts all Cs into Ts
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
284 $total_CT_conversions += $CT_transliterations_performed;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
285 $chromosome_CT_conversions += $CT_transliterations_performed;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
286
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
287 print CT_CONVERT $CT_sequence;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
288
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
289 ### (III) Writing the chromosome out in a G->A converted version of the forward strand (this is equivalent to reverse-
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
290 ### complementing the forward strand and then C->T converting it)
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
291
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
292 my $GA_sequence = $sequence;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
293 my $GA_transliterations_performed = ($GA_sequence =~ tr/G/A/); # converts all Gs to As on the forward strand
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
294 $total_GA_conversions += $GA_transliterations_performed;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
295 $chromosome_GA_conversions += $GA_transliterations_performed;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
296
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
297 print GA_CONVERT $GA_sequence;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
298
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
299 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
300 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
301 $verbose and print join ("\t",$chromosome_name,$chromosome_CT_conversions,$chromosome_GA_conversions),"\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
302 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
303 close (CT_CONVERT) or die "Failed to close filehandle: $!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
304 close (GA_CONVERT) or die "Failed to close filehandle: $!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
305
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
306
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
307 print "\nTotal number of conversions performed:\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
308 print "C->T:\t$total_CT_conversions\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
309 print "G->A:\t$total_GA_conversions\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
310
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
311 warn "\nStep II - Genome bisulfite conversions - completed\n\n\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
312 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
313
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
314 sub extract_chromosome_name {
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
315
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
316 my $header = shift;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
317
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
318 ## Bowtie extracts the first string after the initial > in the FASTA file, so we are doing this as well
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
319
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
320 if ($header =~ s/^>//){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
321 my ($chromosome_name) = split (/\s+/,$header);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
322 return $chromosome_name;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
323 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
324 else{
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
325 die "The specified chromosome file doesn't seem to be in FASTA format as required! $!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
326 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
327 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
328
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
329 sub create_bisulfite_genome_folders{
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
330
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
331 $verbose and print "Bismark Genome Preparation - Step I: Preparing folders\n\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
332
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
333 if ($path_to_bowtie){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
334 unless ($path_to_bowtie =~ /\/$/){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
335 $path_to_bowtie =~ s/$/\//;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
336 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
337 if (chdir $path_to_bowtie){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
338 if ($bowtie2){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
339 $verbose and print "Path to Bowtie 2 specified: $path_to_bowtie\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
340 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
341 else{
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
342 $verbose and print "Path to Bowtie (1) specified: $path_to_bowtie\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
343 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
344 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
345 else{
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
346 die "There was an error with the path to bowtie: $!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
347 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
348 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
349
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
350 chdir $genome_folder or die "Could't move to directory $genome_folder. Make sure the directory exists! $!";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
351
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
352
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
353 # Exiting unless there are fastA files in the folder
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
354 my @filenames = <*.fa>;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
355
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
356 ### if there aren't any genomic files with the extension .fa we will look for files with the extension .fasta
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
357 unless (@filenames){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
358 @filenames = <*.fasta>;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
359 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
360
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
361 unless (@filenames){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
362 die "The specified genome folder $genome_folder does not contain any sequence files in FastA format (with .fa or .fasta file extensions\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
363 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
364
3
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
365 warn "Bisulfite Genome Indexer version $bismark_version (last modified 19 Sept 2013)\n\n";
0
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
366 sleep (3);
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
367
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
368 # creating a directory inside the genome folder to store the bisfulfite genomes unless it already exists
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
369 my $bisulfite_dir = "${genome_folder}Bisulfite_Genome/";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
370 unless (-d $bisulfite_dir){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
371 mkdir $bisulfite_dir or die "Unable to create directory $bisulfite_dir $!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
372 $verbose and print "Created Bisulfite Genome folder $bisulfite_dir\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
373 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
374 else{
3
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
375 print "\nA directory called $bisulfite_dir already exists. Bisulfite converted sequences and/or already existing Bowtie (1 or 2) indices will be overwritten!\n\n";
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
376 sleep(5);
0
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
377 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
378
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
379 chdir $bisulfite_dir or die "Unable to move to $bisulfite_dir\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
380 $CT_dir = "${bisulfite_dir}CT_conversion/";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
381 $GA_dir = "${bisulfite_dir}GA_conversion/";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
382
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
383 # creating 2 subdirectories to store a C->T (forward strand conversion) and a G->A (reverse strand conversion)
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
384 # converted version of the genome
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
385 unless (-d $CT_dir){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
386 mkdir $CT_dir or die "Unable to create directory $CT_dir $!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
387 $verbose and print "Created Bisulfite Genome folder $CT_dir\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
388 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
389 unless (-d $GA_dir){
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
390 mkdir $GA_dir or die "Unable to create directory $GA_dir $!\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
391 $verbose and print "Created Bisulfite Genome folder $GA_dir\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
392 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
393
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
394 # moving back to the original genome folder
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
395 chdir $genome_folder or die "Could't move to directory $genome_folder $!";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
396 # $verbose and print "Moved back to genome folder folder $genome_folder\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
397 warn "\nStep I - Prepare genome folders - completed\n\n\n";
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
398 return @filenames;
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
399 }
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
400
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
401 sub print_helpfile{
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
402 print << 'HOW_TO';
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
403
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
404
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
405 DESCRIPTION
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
406
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
407 This script is supposed to convert a specified reference genome into two different bisulfite
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
408 converted versions and index them for alignments with Bowtie 1 (default), or Bowtie 2. The first
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
409 bisulfite genome will have all Cs converted to Ts (C->T), and the other one will have all Gs
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
410 converted to As (G->A). Both bisulfite genomes will be stored in subfolders within the reference
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
411 genome folder. Once the bisulfite conversion has been completed the program will fork and launch
3
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
412 two simultaneous instances of the Bowtie 1 or 2 indexer (bowtie-build or bowtie2-build). Be aware
0
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
413 that the indexing process can take up to several hours; this will mainly depend on genome size
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
414 and system resources.
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
415
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
416
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
417
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
418 The following is a brief description of command line options and arguments to control the
3
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
419 Bismark Genome Preparation:
0
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
420
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
421
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
422 USAGE: bismark_genome_preparation [options] <arguments>
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
423
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
424
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
425 OPTIONS:
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
426
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
427 --help/--man Displays this help filea and exits.
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
428
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
429 --version Displays version information and exits.
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
430
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
431 --verbose Print verbose output for more details or debugging.
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
432
3
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
433 --path_to_bowtie </../> The full path to the Bowtie 1 or Bowtie 2 installation on your system
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
434 (depending on which aligner/indexer you intend to use). Unless this path
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
435 is specified it is assumed that Bowtie is in the PATH.
0
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
436
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
437 --bowtie2 This will create bisulfite indexes for Bowtie 2. (Default: Bowtie 1).
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
438
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
439 --single_fasta Instruct the Bismark Indexer to write the converted genomes into
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
440 single-entry FastA files instead of making one multi-FastA file (MFA)
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
441 per chromosome. This might be useful if individual bisulfite converted
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
442 chromosomes are needed (e.g. for debugging), however it can cause a
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
443 problem with indexing if the number of chromosomes is vast (this is likely
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
444 to be in the range of several thousand files; the operating system can
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
445 only handle lists up to a certain length, and some newly assembled
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
446 genomes may contain 20000-50000 contigs of scaffold files which do exceed
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
447 this list length limit).
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
448
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
449
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
450 ARGUMENTS:
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
451
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
452 <path_to_genome_folder> The path to the folder containing the genome to be bisulfite converted.
3
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
453 The Bismark Genome Preparation expects one or more fastA files in the folder
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
454 (with the file extension: .fa or .fasta). Specifying this path is mandatory.
0
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
455
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
456
3
91f07ff056ca Uploaded
bgruening
parents: 0
diff changeset
457 This script was last modified on 19 Sept 2013.
0
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
458 HOW_TO
62c6da72dd4a Uploaded
bgruening
parents:
diff changeset
459 }