Skip to content

Commit

Permalink
fix wrong position in the JSON report
Browse files Browse the repository at this point in the history
  • Loading branch information
shifu chen authored and shifu chen committed Sep 26, 2018
1 parent 7999ce9 commit c366103
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/common.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef COMMON_H
#define COMMON_H

#define FUSIONSCAN_VER "0.6.0"
#define FUSIONSCAN_VER "0.6.1"

#define _DEBUG true

Expand Down
7 changes: 7 additions & 0 deletions src/gene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ Gene Gene::parse(string linestr) {

}

int Gene::genePos2ChrPos(int genepos) {
int chrpos = abs(genepos) + mStart;
if(genepos <0)
chrpos *= -1;
return chrpos;
}

string Gene::pos2str(int pos) {
int pp = abs(pos) + mStart;
stringstream ss;
Expand Down
1 change: 1 addition & 0 deletions src/gene.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Gene{
void print();
static Gene parse(string linestr);
string pos2str(int pos);
int genePos2ChrPos(int genepos);
void getExonIntron(int pos, bool& isExon, int& number);

public:
Expand Down
4 changes: 2 additions & 2 deletions src/jsonreporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void JsonReporter::run() {
mFile << "\t\t\t\"" << "left" << "\":{" << endl;
mFile << "\t\t\t\t\"" << "gene_name" << "\":" << "\"" << fusion.mLeftGene.mName << "\"," << endl;
mFile << "\t\t\t\t\"" << "gene_chr" << "\":" << "\"" << fusion.mLeftGene.mChr << "\"," << endl;
mFile << "\t\t\t\t\"" << "position" << "\":" << fusion.mLeftGP.position << "," << endl;
mFile << "\t\t\t\t\"" << "position" << "\":" << fusion.mLeftGene.genePos2ChrPos(fusion.mLeftGP.position) << "," << endl;
mFile << "\t\t\t\t\"" << "reference" << "\":" << "\"" << fusion.mLeftRef << "\"," << endl;
mFile << "\t\t\t\t\"" << "ref_ext" << "\":" << "\"" << fusion.mLeftRefExt << "\"," << endl;
mFile << "\t\t\t\t\"" << "pos_str" << "\":" << "\"" << fusion.mLeftPos << "\"," << endl;
Expand All @@ -57,7 +57,7 @@ void JsonReporter::run() {
mFile << "\t\t\t\"" << "right" << "\":{" << endl;
mFile << "\t\t\t\t\"" << "gene_name" << "\":" << "\"" << fusion.mRightGene.mName << "\"," << endl;
mFile << "\t\t\t\t\"" << "gene_chr" << "\":" << "\"" << fusion.mRightGene.mChr << "\"," << endl;
mFile << "\t\t\t\t\"" << "position" << "\":" << fusion.mRightGP.position << "," << endl;
mFile << "\t\t\t\t\"" << "position" << "\":" << fusion.mRightGene.genePos2ChrPos(fusion.mRightGP.position) << "," << endl;
mFile << "\t\t\t\t\"" << "reference" << "\":" << "\"" << fusion.mRightRef << "\"," << endl;
mFile << "\t\t\t\t\"" << "ref_ext" << "\":" << "\"" << fusion.mRightRefExt << "\"," << endl;
mFile << "\t\t\t\t\"" << "pos_str" << "\":" << "\"" << fusion.mRightPos << "\"," << endl;
Expand Down

0 comments on commit c366103

Please sign in to comment.