]> git.donarmstrong.com Git - rsem.git/blob - rsem-generate-ngvector
Install the latest version of EBSeq from Bioconductor and if fails, try to install...
[rsem.git] / rsem-generate-ngvector
1 #!/usr/bin/perl
2
3 use Getopt::Long;
4 use Pod::Usage;
5 use FindBin;
6 use lib $FindBin::Bin;
7 use strict;
8
9 use rsem_perl_utils;
10
11 my $k = 25;
12 my $help = 0;
13
14 GetOptions("k=i" => \$k,
15            "h|help" => \$help) or pod2usage(-exitval => 2, -verbose => 2);
16
17 pod2usage(-verbose => 2) if ($help == 1);
18 pod2usage(-msg => "Invalid number of arguments!", -exitval => 2, -verbose => 2) if (scalar(@ARGV) != 2);
19
20 my $dir = "$FindBin::Bin/";
21 my $command = "";
22
23 $command = $dir."EBSeq/rsem-for-ebseq-calculate-clustering-info $k $ARGV[0] $ARGV[1].ump";
24 &runCommand($command);
25
26 $command = $dir."EBSeq/rsem-for-ebseq-generate-ngvector-from-clustering-info $ARGV[1].ump $ARGV[1].ngvec";
27 &runCommand($command);
28
29 __END__
30
31 =head1 NAME
32
33 rsem-generate-ngvector
34
35 =head1 SYNOPSIS
36
37 =over
38
39  rsem-generate-ngvector [options] input_fasta_file output_name
40
41 =back
42
43 =head1 ARGUMENTS
44
45 =over
46
47 =item B<input_fasta_file>
48
49 The fasta file containing all reference transcripts. The transcripts must be in the same order as those in expression value files. Thus, 'reference_name.transcripts.fa' generated by 'rsem-prepare-reference' should be used.   
50
51 =item B<output_name>
52
53 The name of all output files. The Ng vector will be stored as 'output_name.ngvec'.
54
55 =back
56
57 =head1 OPTIONS
58
59 =over
60
61 =item B<-k> <int>
62
63 k mer length. See description section. (Default: 25)
64
65 =item B<-h/--help>
66
67 Show help information.
68
69 =back
70
71 =head1 DESCRIPTION
72
73 This program generates the Ng vector required by EBSeq for isoform level differential expression analysis based on reference sequences only. EBSeq can take variance due to read mapping ambiguity into consideration by grouping isoforms with parent gene's number of isoforms. However, for de novo assembled transcriptome, it is hard to obtain an accurate gene-isoform relationship. Instead, this program groups isoforms by using measures on read mappaing ambiguity directly. First, it calcualtes the 'unmappability' of each transcript. The 'unmappability' of a transcript is the ratio between the number of k mers with at least one perfect match to other transcripts and the total number of k mers of this transcript, where k is a parameter. Then, Ng vector is generated by applying Kmeans algorithm to the 'unmappability' values with number of clusters set as 3. 'rsem-generate-ngvector' will make sure the mean 'unmappability' scores for clusters are in ascending order. All transcripts whose lengths are less than k are assigned to cluster 3.   
74
75 If your reference is a de novo assembled transcript set, you should run 'rsem-generate-ngvector' first. Then load the resulting 'output_name.ngvec' into R. For example, you can use
76
77  NgVec <- scan(file="output_name.ngvec", what=0, sep="\n")
78
79 . After that, replace 'IsoNgTrun' with 'NgVec' in the second line of section 3.2.5 (Page 10) of EBSeq's vignette:
80
81  IsoEBres=EBTest(Data=IsoMat, NgVector=NgVec, ...)
82
83 This program only needs to run once per RSEM reference. 
84
85 =head1 OUTPUT
86
87 =over
88
89 =item B<output_name.ump>
90
91 'unmappability' scores for each transcript. This file contains two columns. The first column is transcript name and the second column is 'unmappability' score.
92
93 =item B<output_name.ngvec>
94
95 Ng vector generated by this program.
96
97 =back
98
99 =head1 EXAMPLES
100
101 Suppose the reference sequences file is '/ref/mouse_125/mouse_125.transcripts.fa' and we set the output_name as 'mouse_125':
102
103  rsem-generate-ngvector /ref/mouse_125/mouse_125.transcripts.fa mouse_125
104
105 =cut