Skip to content
Snippets Groups Projects
Commit e66ee5f8 authored by Michal Petrovič's avatar Michal Petrovič
Browse files

Merge branch '19-bedgraph-loads-too-long' into 'main'

Resolve "Bedgraph loads too long"

Closes #19

See merge request !18
parents 4283a1c9 1ee781c5
Branches
1 merge request!18Resolve "Bedgraph loads too long"
Pipeline #204004 passed with stages
in 5 minutes and 50 seconds
......@@ -181,13 +181,12 @@ public class ExporterService {
analysisColumnMapper = new ArrayList<String>();;
break;
}
try {
// add analysis specific header
result = String.format(result, name, description);
// Add analysis specific header
StringBuilder resultBuilder = new StringBuilder();
resultBuilder.append(String.format(result, name, description));
while (rs.next()) {
try {
chromStart = rs.getInt("POSITION");
if (sequenceStart == null) {
......@@ -196,47 +195,48 @@ public class ExporterService {
chromEnd = rs.getInt("POSITION") + rs.getInt("LENGTH");
String strand = null;
Integer score = 0;
int score = 0;
if (analysis == Analysis.RLOOP) {
strand = rs.getString("STRAND");
Integer g3 = rs.getInt("G3");
Integer g4 = rs.getInt("G4");
Integer gn = rs.getInt("GN");
int g3 = rs.getInt("G3");
int g4 = rs.getInt("G4");
int gn = rs.getInt("GN");
Double rizG = rs.getDouble("RIZGRICHNESS");
Double rloopG = rs.getDouble("RLOOPGRICHNESS");
double rizG = rs.getDouble("RIZGRICHNESS");
double rloopG = rs.getDouble("RLOOPGRICHNESS");
Integer scoreCalc = (int) Math.ceil(- (g3 + g4*2 + gn*3) * rizG * rloopG);
int scoreCalc = (int) Math.ceil(-(g3 + g4 * 2 + gn * 3) * rizG * rloopG);
score = strand.equals("+") ? Math.abs(scoreCalc) : scoreCalc;
}
else if (analysis == Analysis.QUADRUPLEX || analysis == Analysis.AGGREGATE) {
} else if (analysis == Analysis.QUADRUPLEX || analysis == Analysis.AGGREGATE) {
// G4 Hunter score calculation
score = (int) Math.ceil(rs.getDouble("SCORE") * 100);
}
else if (analysis == Analysis.ZDNA) {
} else if (analysis == Analysis.ZDNA) {
score = (int) Math.ceil(rs.getDouble("SCORE"));
}
dataValue = String.format(" %d", score);
} catch (SQLException e) { // score is for g4hunter, r
} catch (SQLException e) {
log.error("Error fetching analysis data: {}", e);
}
continue; // Skip the rest of this loop iteration and continue with the next
}
result += String.format(format,
resultBuilder.append(String.format(format,
chrom,
posInGenomeStart+chromStart,
posInGenomeStart+chromEnd,
posInGenomeStart + chromStart,
posInGenomeStart + chromEnd,
dataValue
);
)); // This is now using StringBuilder
dataValue = "";
}
}
catch (NullPointerException | NotFoundException e) {
log.error("Error finding analysis by id: {}\n {}", id, e);
// Convert the StringBuilder to a String
result = resultBuilder.toString();
} catch (SQLException e) {
log.error("Error processing result set: {}", e);
}
// update browser header
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment