annotate matching.pl @ 17:b75750b21aa4 draft

Deleted selected files
author big-tiandm
date Wed, 29 Oct 2014 05:03:38 -0400
parents a8c011dc575b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
1 #!/usr/bin/perl -w
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
2 #Filename:
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
3 #Author: Tian Dongmei
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
4 #Email: tiandm@big.ac.cn
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
5 #Date: 2013/7/19
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
6 #Modified:
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
7 #Description:
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
8 my $version=1.00;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
9
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
10 use strict;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
11 use Getopt::Long;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
12
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
13 my %opts;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
14 GetOptions(\%opts,"i=s","g=s","index:s","v:i","p:i","r:s","o=s","h");
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
15 if (!(defined $opts{i} and defined $opts{o} ) || defined $opts{h}) { #necessary arguments
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
16 &usage;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
17 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
18
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
19 my $filein=$opts{'i'};
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
20 my $fileout=$opts{'o'};
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
21 unless ($fileout=~/\/$/) {$fileout.="/";}
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
22 my $genome=$opts{'g'};
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
23 my $mis=defined $opts{'v'}? $opts{'v'} : 0;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
24 my $hits=defined $opts{'r'}? $opts{'r'} : 25;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
25 my $index=defined $opts{'index'} ? $opts{'index'} : "";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
26 my $threads=defined $opts{'p'} ? $opts{'p'} : 1;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
27
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
28
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
29 #my $time=time();
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
30 #my $mapdir=$fileout."/genome_match_".$time;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
31 my $mapdir=$fileout."/genome_match";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
32 mkdir $mapdir;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
33 chdir $mapdir;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
34 ###check genome index
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
35 if (-s $index.".1.ebwt") {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
36 }else{
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
37 `bowtie-build $genome genome`;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
38 $index="genome";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
39 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
40
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
41 ### genome mapping
13
a8c011dc575b Uploaded
big-tiandm
parents: 0
diff changeset
42 `bowtie -v $mis -f -p $threads -m $hits -a --best --strata $index $filein --al genome_mapped.fa --un genome_not_mapped.fa > genome_mapped.bwt 2> run.log`;
0
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
43
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
44 #`convert_bowtie_to_blast.pl genome_mapped.bwt genome_mapped.fa $genome > genome_mapped.bst`;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
45
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
46 sub usage{
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
47 print <<"USAGE";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
48 Version $version
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
49 Usage:
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
50 $0 -i -o
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
51 options:
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
52 -i input file# input reads fasta/fastq file
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
53 -g input file# genome file
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
54 -index file-prefix #(must be indexed by bowtie-build) The parameter
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
55 string must be the prefix of the bowtie index. For instance, if
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
56 the first indexed file is called 'h_sapiens_37_asm.1.ebwt' then
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
57 the prefix is 'h_sapiens_37_asm'.##can be null
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
58 -v <int> report end-to-end hits w/ <=v mismatches; ignore qualities,default 0;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
59
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
60 -p/--threads <int> number of alignment threads to launch (default: 1)
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
61
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
62 -r int a read is allowed to map up to this number of positions in the genome
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
63 default is 25
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
64
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
65 -o output directory
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
66
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
67 -h help
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
68 USAGE
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
69 exit(1);
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
70 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
71