]> git.donarmstrong.com Git - rsem.git/blob - rsem-generate-ngvector
Modified the acknowledgement section of README.md
[rsem.git] / rsem-generate-ngvector
1 #!/usr/bin/env 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 rsem-generate-ngvector [options] input_fasta_file output_name
38
39 =head1 ARGUMENTS
40
41 =over
42
43 =item B<input_fasta_file>
44
45 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.   
46
47 =item B<output_name>
48
49 The name of all output files. The Ng vector will be stored as 'output_name.ngvec'.
50
51 =back
52
53 =head1 OPTIONS
54
55 =over
56
57 =item B<-k> <int>
58
59 k mer length. See description section. (Default: 25)
60
61 =item B<-h/--help>
62
63 Show help information.
64
65 =back
66
67 =head1 DESCRIPTION
68
69 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.   
70
71 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
72
73  NgVec <- scan(file="output_name.ngvec", what=0, sep="\n")
74
75 . After that, replace 'IsoNgTrun' with 'NgVec' in the second line of section 3.2.5 (Page 10) of EBSeq's vignette:
76
77  IsoEBres=EBTest(Data=IsoMat, NgVector=NgVec, ...)
78
79 This program only needs to run once per RSEM reference. 
80
81 =head1 OUTPUT
82
83 =over
84
85 =item B<output_name.ump>
86
87 'unmappability' scores for each transcript. This file contains two columns. The first column is transcript name and the second column is 'unmappability' score.
88
89 =item B<output_name.ngvec>
90
91 Ng vector generated by this program.
92
93 =back
94
95 =head1 EXAMPLES
96
97 Suppose the reference sequences file is '/ref/mouse_125/mouse_125.transcripts.fa' and we set the output_name as 'mouse_125':
98
99  rsem-generate-ngvector /ref/mouse_125/mouse_125.transcripts.fa mouse_125
100
101 =cut