]> git.donarmstrong.com Git - rsem.git/blob - rsem-generate-ngvector
Updated README.md and WHAT_IS_NEW
[rsem.git] / rsem-generate-ngvector
1 #!/usr/bin/env perl
2
3 use Getopt::Long;
4 use Pod::Usage;
5
6 use FindBin;
7 use lib $FindBin::RealBin;
8 use rsem_perl_utils;
9
10 use Env qw(@PATH);
11 @PATH = ("$FindBin::RealBin/EBSeq", @PATH);
12
13 use strict;
14
15 my $k = 25;
16 my $help = 0;
17
18 GetOptions("k=i" => \$k,
19            "h|help" => \$help) or pod2usage(-exitval => 2, -verbose => 2);
20
21 pod2usage(-verbose => 2) if ($help == 1);
22 pod2usage(-msg => "Invalid number of arguments!", -exitval => 2, -verbose => 2) if (scalar(@ARGV) != 2);
23
24 my $command = "";
25
26 $command = "rsem-for-ebseq-calculate-clustering-info $k $ARGV[0] $ARGV[1].ump";
27 &runCommand($command);
28
29 $command = "rsem-for-ebseq-generate-ngvector-from-clustering-info $ARGV[1].ump $ARGV[1].ngvec";
30 &runCommand($command);
31
32 __END__
33
34 =head1 NAME
35
36 rsem-generate-ngvector
37
38 =head1 SYNOPSIS
39
40 rsem-generate-ngvector [options] input_fasta_file output_name
41
42 =head1 ARGUMENTS
43
44 =over
45
46 =item B<input_fasta_file>
47
48 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.   
49
50 =item B<output_name>
51
52 The name of all output files. The Ng vector will be stored as 'output_name.ngvec'.
53
54 =back
55
56 =head1 OPTIONS
57
58 =over
59
60 =item B<-k> <int>
61
62 k mer length. See description section. (Default: 25)
63
64 =item B<-h/--help>
65
66 Show help information.
67
68 =back
69
70 =head1 DESCRIPTION
71
72 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.   
73
74 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
75
76  NgVec <- scan(file="output_name.ngvec", what=0, sep="\n")
77
78 . After that, replace 'IsoNgTrun' with 'NgVec' in the second line of section 3.2.5 (Page 10) of EBSeq's vignette:
79
80  IsoEBres=EBTest(Data=IsoMat, NgVector=NgVec, ...)
81
82 This program only needs to run once per RSEM reference. 
83
84 =head1 OUTPUT
85
86 =over
87
88 =item B<output_name.ump>
89
90 'unmappability' scores for each transcript. This file contains two columns. The first column is transcript name and the second column is 'unmappability' score.
91
92 =item B<output_name.ngvec>
93
94 Ng vector generated by this program.
95
96 =back
97
98 =head1 EXAMPLES
99
100 Suppose the reference sequences file is '/ref/mouse_125/mouse_125.transcripts.fa' and we set the output_name as 'mouse_125':
101
102  rsem-generate-ngvector /ref/mouse_125/mouse_125.transcripts.fa mouse_125
103
104 =cut