forked from MVZSEQ/denovoTranscriptomeMarkerDevelopment
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3-GenerateAssemblies
More file actions
executable file
·182 lines (130 loc) · 4.36 KB
/
3-GenerateAssemblies
File metadata and controls
executable file
·182 lines (130 loc) · 4.36 KB
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
#!/usr/bin/perl
#Ke Bi (kebi@berkeley.edu)
use strict;
use warnings;
use Getopt::Std;
use Getopt::Long;
use File::Basename;
&main;
exit;
sub main {
&usage if (@ARGV<1);
my $command = shift(@ARGV);
my %fun = (abyss=>\&abyss,trinity=>\&trinity, soapdenovo=>\&soapdenovo);
die("Unknown command \"$command\"\n") if (!defined($fun{$command}));
&{$fun{$command}};
}
sub usage {
die(qq/
Usage: 3-GenerateAssemblies <command> [<arguments>]\n
Command:
trinity: Assembly using trinity (for RNAseq)
abyss: Assembly using ABySS (for exon capture)
\n/);
}
sub trinity {
die(qq/
Usage 3-generateAssemblies_LOCAL.pl trinity [options]
Options: -a library folder
-c JM memory [32]
-d min_kmer_cov [2]
-e cpus [6]
Assuming the unpaired reads (XXX_u_final.txt) are
merged with the left end reads (XXX_1_final.txt),
with a new name of "XXX_1_final.txt".
\n/) if (!@ARGV);
my %opts = (a=>undef, c=>32, d=>2, e=>6);
getopts('a:c:d:e', \%opts);
my $dir;
if ($opts{a} =~ m/\/$/ ){
$dir = $opts{a};
}
else {
$dir = $opts{a} . "/";
}
my @files = <$dir*_1_final.txt>;
foreach my $file1 (@files) {
my $file2 = $file1;
$file2 =~ s/_1_/_2_/;
my $lib = $1 if basename($file1) =~ m/(\S+)_1_final.txt/;
my $resultDir = $dir.$lib;
mkdir $resultDir unless -d $resultDir;
system("Trinity.pl --seqType fq -JM $opts{c}G --left $file1 --group_pairs_distance 999 --right $file2 --min_kmer_cov $opts{d} --CPU $opts{e} --output $resultDir");
#system ("mv $resultDir'Trinity.fasta' $resultDir$lib'.fasta' ");
}
}
sub abyss {
die(qq/
Usage 3-GenerateAssemblies abyss [Options]
external dependencies:
ABySS (compiled with OpenMPI and Google sparsehash)
Options:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-reads DIR Directory with all sequence reads
-lib CHAR ... Particular libraries to process?
(e.g. AAA BBB CCC). If -lib is not
used then process all libraries in
The folder (-reads)
-mpi DIR Full path to openmpi mpirun
-out CHAR Directory where results will go
-kmer INT ... A list of kmers. At least privide
one kmer (e.g. 21 43 67 81)
-kcov INT ... A list of non-zero kmer-coverage.
Activate default without using kcov
(e.g. 5 10 20). Suggest use default.
-np INT number of processors used for assembly
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ABySS Multi-kmer assembly for exon capture data.
Reference:
Singhal S. 2012. Molecular Ecology Resources
Bi et al. 2012. BMC genomics
\n/) if (!@ARGV);
my ($reads, $out,$mpi,$kmer, $np, $kcov, $lib) = (undef, undef, undef, undef, undef,undef,undef);
GetOptions('kmer=s@{1,}' => \$kmer,'reads=s@{1,1}' => \$reads,'out=s@{1,1}' => \$out,'mpi=s@{1,1}' => \$mpi,'np=s@{1,1}' => \$np,'kcov=s@{,}' => \$kcov, 'lib=s@{,}' => \$lib );
my $dir;
if (@{$reads}[0] =~ m/\/$/ ){
$dir = @{$reads}[0];
}
else {
$dir = @{$reads}[0] . "/";
}
my $resDir;
if (@{$out}[0] =~ m/\/$/ ){
$resDir = @{$out}[0];
}
else {
$resDir = @{$out}[0] . "/";
}
mkdir $resDir unless -d $resDir;
my @files = ();
if (!$lib) {
@files= <$dir*_1_final.txt>;
}
if ($lib) {
foreach (@{$lib}) {
my $file = $dir . $_ .'_1_final.txt';
push (@files, $file);
}
}
foreach my $file1 (@files) {
my $file2 = $file1;
my $fileu = $file1;
$file2 =~ s/_1_/_2_/;
$fileu =~ s/_1_/_u_/;
my $lib = $1 if basename($file1) =~ m/(\S+)_1_final.txt/;
my $resultDir = $resDir.$lib. "/";
mkdir $resultDir unless -d $resultDir;
foreach my $k (@{$kmer}) {
if ($kcov){
foreach my $cov (@{$kcov}) {
system("abyss-pe mpirun=@{$mpi}[0] k=$k c=$cov e=$cov np=@{$np}[0] E=0 n=10 in=\'$file1 $file2\' se=$fileu name=$resultDir$lib\"_k\"$k\"_cov\"$cov ");
system("rm coverage.hist");
}
}
if (!$kcov) {
system("abyss-pe mpirun=@{$mpi}[0] k=$k np=@{$np}[0] E=0 n=10 in=\'$file1 $file2\' se=$fileu name=$resultDir$lib\"_k\"$k\"_cov_default\" ");
system("rm coverage.hist");
}
}
}
}