Skip to content

Commit

Permalink
Added --append-names
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo Li committed Nov 11, 2015
1 parent 961c730 commit 2ffbfa7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions EM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,9 @@ int main(int argc, char* argv[]) {
printf(" -b: produce bam format output file. (default: off)\n");
printf(" -q: set it quiet\n");
printf(" --gibbs-out: generate output file used by Gibbs sampler. (default: off)\n");
printf(" --sampling: sample each read from its posterior distribution when bam file is generated. (default: off)\n");
printf(" --sampling: sample each read from its posterior distribution when BAM file is generated. (default: off)\n");
printf(" --seed uint32: the seed used for the BAM sampling. (default: off)\n");
printf(" --append-names: append transcript_name/gene_names when available. (default: off)\n");
printf(" --append-names: append transcript_name/gene_name when available. (default: off)\n");
printf("// model parameters should be in imdName.mparams.\n");
exit(-1);
}
Expand Down
16 changes: 8 additions & 8 deletions WriteResults.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ void writeResultsEM(int M, const char* refName, const char* imdName, Transcripts
std::vector<int> tlens;
std::vector<double> fpkm, tpm, isopct;
std::vector<double> glens, gene_eels, gene_counts, gene_tpm, gene_fpkm;

std::string transcript_name, gene_name;

// Load group info
sprintf(groupF, "%s.grp", refName);
Expand Down Expand Up @@ -228,9 +226,9 @@ void writeResultsEM(int M, const char* refName, const char* imdName, Transcripts
const Transcript& transcript = transcripts.getTranscriptAt(i);

fprintf(fo, "%s", transcript.getTranscriptID().c_str());
transcript_name = transcript.getTranscriptName();
if (transcript_name != "") fprintf(fo, "_%s", transcript_name.c_str());
fprintf(fo, "%c", , (i < M ? '\t' : '\n'));
if (appendNames && transcript.getTranscriptName() != "")
fprintf(fo, "_%s", transcript.getTranscriptName().c_str());
fprintf(fo, "%c", (i < M ? '\t' : '\n'));
}
for (int i = 1; i <= M; i++) {
const Transcript& transcript = transcripts.getTranscriptAt(i);
Expand Down Expand Up @@ -315,18 +313,20 @@ void writeResultsEM(int M, const char* refName, const char* imdName, Transcripts
const Transcript& transcript = transcripts.getTranscriptAt(gi.spAt(i));

fprintf(fo, "%s", transcript.getGeneID().c_str());
gene_name = transcript.getGeneName();
if (appendNames && gene_name != "") fprintf(fo, "_%s", gene_name.c_str());
if (appendNames && transcript.getGeneName() != "") fprintf(fo, "_%s", transcript.getGeneName().c_str());
fprintf(fo, "%c", (i < m - 1 ? '\t' : '\n'));
}
for (int i = 0; i < m; i++) {
int b = gi.spAt(i), e = gi.spAt(i + 1);
std::string curtid = "", tid;
for (int j = b; j < e; j++) {
tid = transcripts.getTranscriptAt(j).getTranscriptID();
const Transcript& transcript = transcripts.getTranscriptAt(j);
tid = transcript.getTranscriptID();
if (curtid != tid) {
if (curtid != "") fprintf(fo, ",");
fprintf(fo, "%s", tid.c_str());
if (appendNames && transcript.getTranscriptName() != "")
fprintf(fo, "_%s", transcript.getTranscriptName().c_str());
curtid = tid;
}
}
Expand Down
8 changes: 8 additions & 0 deletions rsem-calculate-expression
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ my $bowtie2_sensitivity_level = "sensitive"; # must be one of "very_fast", "fast

my $seed = "NULL";

my $appendNames = 0;

my $version = 0;

my $mTime = 0;
Expand Down Expand Up @@ -128,6 +130,7 @@ GetOptions("keep-intermediate-files" => \$keep_intermediate_files,
"estimate-rspd" => \$estRSPD,
"num-rspd-bins=i" => \$B,
"p|num-threads=i" => \$nThreads,
"append-names" => \$appendNames,
"no-bam-output" => sub { $genBamF = 0; },
"output-genome-bam" => \$genGenomeBamF,
"sampling-for-bam" => \$sampling,
Expand Down Expand Up @@ -466,6 +469,7 @@ if ($genBamF) {
if ($seed ne "NULL") { $command .= " --seed $seeds[0]"; }
}
if ($calcPME || $calcCI) { $command .= " --gibbs-out"; }
if ($appendNames) { $command .= " --append-names"; }
if ($quiet) { $command .= " -q"; }

&runCommand($command);
Expand Down Expand Up @@ -648,6 +652,10 @@ Input file is in BAM format. (Default: off)
Number of threads to use. Both Bowtie/Bowtie2, expression estimation and 'samtools sort' will use this many threads. (Default: 1)
=item B<--append-names>
If gene_name/transcript_name is available, append it to the end of gene_id/transcript_id (separated by '_') in files 'sample_name.isoforms.results' and 'sample_name.genes.results'. (Default: off)
=item B<--no-bam-output>
Do not output any BAM file. (Default: off)
Expand Down

0 comments on commit 2ffbfa7

Please sign in to comment.