Skip to content

Commit

Permalink
Merge pull request #2 from Integrative-Transcriptomics/fixing-report-…
Browse files Browse the repository at this point in the history
…page

Further Adaptations for Report
  • Loading branch information
mwittep authored Aug 27, 2024
2 parents 47a4646 + f530451 commit f5fb5f5
Show file tree
Hide file tree
Showing 14 changed files with 242 additions and 43 deletions.
18 changes: 15 additions & 3 deletions nf/bin/app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from flask import Flask, render_template, request, make_response, url_for, abort, session, jsonify, send_from_directory, send_file
from flask import Flask, render_template
import argparse
import os
import re
Expand Down Expand Up @@ -106,7 +106,9 @@ def give_genomes():
terminators = data["terminators"]
summaryMotifs = data["summary_motifs"]
short_description = data["short_description"]
return dict(genomes=genomes, outputPath=outputPath, short_description=short_description, avoidedTSS=avoided, classified=classifiedData, terminators=terminators, overviewData=overviewData, summaryMotifs=summaryMotifs)
model = data["model_cnit"]
motifs = data["number_motifs"]
return dict(genomes=genomes, outputPath=outputPath, short_description=short_description, avoidedTSS=avoided, classified=classifiedData, terminators=terminators, overviewData=overviewData, summaryMotifs=summaryMotifs, model_cnit=model, number_motifs=motifs)


@ app.route('/overview.html')
Expand Down Expand Up @@ -156,6 +158,10 @@ def getAvoidedTSS(outputPath, genome):
def avoided():
return render_template('avoided.html')

@ app.route('/references.html')
def references():
return render_template('references.html')


@ app.after_request
def add_header(r):
Expand All @@ -174,16 +180,20 @@ def add_header(r):
index = 0
parser = argparse.ArgumentParser()
parser.add_argument("--path")
parser.add_argument("--model")
parser.add_argument("--motifs")
args = parser.parse_args()
outputPath = args.path
model = args.model
motifs = args.motifs
print("Parsing files in %s" % outputPath)
genomes_list = os.path.join(args.path, "genomes_text.txt")
with open(genomes_list) as f:
genomes = [i.strip() for i in f.readlines()]
genomes.sort()
print("Genomes found: %s" % ", ".join(genomes))
data = {"avoided": {}, "overview": {},
"classification": {}, "terminators": {}, "summary_motifs": {}, "short_description": {}}
"classification": {}, "terminators": {}, "summary_motifs": {}, "short_description": {}, "model_cnit": {}, "number_motifs": {}}
for it, g in enumerate(genomes):
print("Parsing data: {} % ".format(100 * float(it) / len(genomes)))
data["avoided"][g] = getAvoidedTSS(outputPath, g)
Expand All @@ -192,6 +202,8 @@ def add_header(r):
temp_overview = createOverviewData(outputPath, g)
data["overview"][g] = temp_overview[0]
data["summary_motifs"][g] = temp_overview[1]
data["model_cnit"][g] = model
data["number_motifs"][g] = motifs
data["short_description"][g] = createShort(
temp_overview[0], data["avoided"][g])
print("Parsing completed. Freezing Interface.")
Expand Down
3 changes: 1 addition & 2 deletions nf/bin/scripts/allocateTerminators.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ def find_terminators(row_transcript, df, max_distance):
# Depending of the strand, the end or the start of the terminator is taken into account
is_plus = strand == "+"
look_for = "start" if is_plus else "end"
# We allow a 600 nt distance from the TSS (Herbig, 2011)
# We still need to compare if the seq we are using is larger than 600, hence the min/max comparison
# We still need to compare if the seq we are using is larger than the predicted length provided by QRNA and CNIT, hence the min/max comparison
start_look_for = min(
end - max_distance[row_id], start) if not is_plus else max(start, utr_end)
end_look_for = max(
Expand Down
30 changes: 30 additions & 0 deletions nf/bin/static/css/own-css.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.citation {
background-color: #f4f4f4;
border-left: 5px solid #4CAF50;
padding: 10px;
margin-bottom: 20px;
}
.command-style {
background-color: #2d2d2d;
color: #8CD3FE;
font-family: "Courier New", Courier, monospace;
padding: 1em;
margin-bottom: 5px;
border-radius: 5px;
overflow-x: auto;
}
h2 {
color: #333;
}
.parameters-title {
color: #8CD3FE;
font-weight: bold;
}

.command-style pre {
color: #fff;
}

pre span {
color: #8CD3FE;
}
8 changes: 5 additions & 3 deletions nf/bin/templates/avoided.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
<h1 class="h3 mb-0 text-gray-800">TSS positions avoided</h1>
</div>
<p class="mb-4">
The following interface serves as a visualization of the results produced by TSS-CAPTUR. The possibility exists between an <a href="overview.html">overview</a>> of all results or the detailed results of the <a href="classified.html">classification</a> or the <a href="terminators.html">terminator allocation</a> steps of TSS-CAPTUR. The possibility of some TSS being ignored by TSS-CAPTUR due to their short lenght exists. They are found <a href="avoided.html">here</a> . </p>
<p class="mb-4">Generally, all transcripts analyzed by TSS-CAPTUR have a minimal length of 30 nts. The current page presents a list of TSS positions that were not taken into account by TSS-CAPTUR since they would produce too short transcripts due to one of the following reasons:
The following interface serves as a visualization of the results produced by TSS-CAPTUR. The possibility exists between an <a href="overview.html">overview</a> of all results or the detailed results of the <a href="classified.html">classification</a> or the <a href="terminators.html">terminator allocation</a> steps of TSS-CAPTUR. The possibility of some TSS being ignored by TSS-CAPTUR due to their short length exists. They are found <a href="avoided.html">here</a>.
For the more information on the tools and parameters used in TSS-CAPTUR, please refer to the <a href="references.html">references</a>.
</p>
<p class="mb-4">Generally, all transcripts analyzed by TSS-CAPTUR have a minimal length of 30 nts. The current page presents a list of TSS positions that were not taken into account by TSS-CAPTUR since they would produce too short transcripts due to one of the following reasons:
<ul class="mb-4">
<li class="nav-item"/> The TSS position is too close to an annotated gene of the given GFF file. This occurs when the GFF file used within TSS-CAPTUR is different as the one used for the classification of the TSS (eg. in TSSpredator)
<li class="nav-item"/> The TSS position is too close to an annotated gene of the given GFF file. This occurs when the GFF file used within TSS-CAPTUR is different as the one used for the classification of the TSS (eg. in <a href="https://journals.plos.org/plosgenetics/article?id=10.1371/journal.pgen.1003495">TSSpredator</a>)
<li class="nav-item"/> The TSS is too close to a TSS that is classified as any other category than orphan or antisense, but too far away to the gene itself to be classified. Since this would force the transcript to include the 5'-UTR region of the gene, it is discarded.
<li class="nav-item"/> Two TSS labelled as orphans or antisense are too close to each other which would force the length of one transcript to be under the chosen threshold. For this, the first TSS in the read-direction is taken to produce a longer transcript. The other TSS would be excluded and could be interpreted as an internal TSS in a further classification.

Expand Down
17 changes: 13 additions & 4 deletions nf/bin/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

<!-- Custom styles for this template-->
<link href="static/css/sb-admin-2.min.css" rel="stylesheet">
<link href="static/css/own-css.css" rel="stylesheet">
<link href="static/vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">

</head>
Expand Down Expand Up @@ -72,6 +73,12 @@
<a class="nav-link" href="avoided.html">
<i class="fas fa-fw fa-times-circle"></i>
<span>Ignored TSS positions</span></a>
<a class="nav-link" href="references.html">
<i class="fas fa-fw fa-book"></i>
<span>References</span></a>
<a class="nav-link" href="../report.zip" download>
<i class="fas fa-fw fa-download"></i>
<span>Download</span></a>
</li>

<!-- Divider -->
Expand Down Expand Up @@ -124,7 +131,8 @@
let avoidedTSS = {{ avoidedTSS | safe}};
let summaryMotifs = {{ summaryMotifs | safe}};
let shortDescription = {{ short_description | safe}}

let motifs = {{ number_motifs | safe}}
let model = {{ model_cnit | safe}}
</script>
<script src="static/js/update_interface.js?random=<?php echo uniqid(); ?> "></script>

Expand Down Expand Up @@ -158,10 +166,11 @@
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>University of Tübingen – <a
href="https://uni-tuebingen.de/fakultaeten/mathematisch-naturwissenschaftliche-fakultaet/fachbereiche/informatik/lehrstuehle/integrative-transkriptomik/home/">Integrative
Transcriptomics <i className="fas fa-external-link-alt"></i></a> –TSS-CAPTUR 2024</span>
<!-- Distribute spans in two rows-->

<span>University of Tübingen – <a href="https://uni-tuebingen.de/fakultaeten/mathematisch-naturwissenschaftliche-fakultaet/fachbereiche/informatik/lehrstuehle/integrative-transkriptomik/home/">Integrative Transcriptomics <i class="fas fa-fw fa-external-link-alt"></i></a> –TSS-CAPTUR 2024</span>
<br>
<span> HTML template provided by <a href="https://startbootstrap.com/theme/sb-admin-2">StartBootstrap </a> – Icons by <a href="https://fontawesome.com/">Font Awesome </a></span>

</div>
</div>
Expand Down
14 changes: 9 additions & 5 deletions nf/bin/templates/classified.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@
<h1 class="h3 mb-0 text-gray-800">Classification</h1>
</div>
<p class="mb-4">
The following interface serves as a visualization of the results produced by TSS-CAPTUR. The possibility exists between an <a href="overview.html">overview</a>> of all results or the detailed results of the <a href="classified.html">classification</a> or the <a href="terminators.html">terminator allocation</a> steps of TSS-CAPTUR. The possibility of some TSS being ignored by TSS-CAPTUR due to their short lenght exists. They are found <a href="avoided.html">here</a> . </p>
<p class="mb-4">The current page presents a detailed view on the results on the transcript classification. TSS-CAPTUR uses two programs (CNIT and QRNA) to classify the transcripts in either coding (COD) or non-coding (RNA) transcripts.
The following table allows the access to the final classification and some intermediate steps before it, such as which organism was used for the pairwiese alignment for QRNA.
Since both programs used different scoring functions, a normalized z-score is given. If both programs agree on the predicion, the subcoordinates of the program with the highest z-score are used.
If the predictions differ, TSS-CAPTUR labels the transcipt as a coding sequence. </p>
The following interface serves as a visualization of the results produced by TSS-CAPTUR.
The possibility exists between an <a href="overview.html">overview</a> of all results or the detailed results of the <a href="classified.html">classification</a> or the <a href="terminators.html">terminator allocation</a> steps of TSS-CAPTUR.
The possibility of some TSS being ignored by TSS-CAPTUR due to their short length exists. They are found <a href="avoided.html">here</a>.
For the more information on the tools and parameters used in TSS-CAPTUR, please refer to the <a href="references.html">references</a>.
</p>
<p class="mb-4">The current page presents a detailed view on the results on the transcript classification. TSS-CAPTUR uses two programs (<a href="https://academic.oup.com/nar/article/47/W1/W516/5506859">CNIT</a> and <a href="https://bmcbioinformatics.biomedcentral.com/articles/10.1186/1471-2105-2-8">QRNA</a>) to classify the transcripts in either coding (COD) or non-coding (RNA) transcripts.
The following table allows the access to the final classification and some intermediate steps before it, such as which organism was used for the pairwise alignment for <a href="https://bmcbioinformatics.biomedcentral.com/articles/10.1186/1471-2105-2-8">QRNA</a>.
Since both programs used different scoring functions, a normalized z-score is given. If both programs agree on the prediction, the subcoordinates of the program with the highest z-score are used.
If the predictions differ, TSS-CAPTUR labels the transcript as a coding sequence. </p>
<!-- Content Row -->
<div class="card shadow mb-4">
<div class="card-header py-3">
Expand Down
20 changes: 12 additions & 8 deletions nf/bin/templates/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
<h1 class="h3 mb-0 text-gray-800">Overview of data</h1>
</div>
<p class="mb-4">
The following interface serves as a visualization of the results produced by TSS-CAPTUR. The possibility exists between an <a href="overview.html">overview</a> of all results or the detailed results of the <a href="classified.html">classification</a> or the <a href="terminators.html">terminator allocation</a> steps of TSS-CAPTUR. The possibility of some TSS being ignored by TSS-CAPTUR due to their short lenght exists. They are found <a href="avoided.html">here</a> . </p>
<p class="mb-4">The current page presents an overview of the results of all steps run in TSS-CAPTUR, for example, the length of the transcript originally extracted from the genome and the predicted classification.
In the case of RNA-transcripts, a terminator might have been allocated to the transcript and the coordinates would have been adapted. Also, a secondary structure analysis is run for RNA transcripts and allows a visualization of it.
All transcript undergo a motif analysis of the promoter region using MEME. A short descriptive overview follows:
The following interface serves as a visualization of the results produced by TSS-CAPTUR.
The possibility exists between an <a href="overview.html">overview</a> of all results or the detailed results of the <a href="classified.html">classification</a> or the <a href="terminators.html">terminator allocation</a> steps of TSS-CAPTUR. The possibility of some TSS being ignored by TSS-CAPTUR due to their short length exists. They are found <a href="avoided.html">here</a>.
For the more information on the tools and parameters used in TSS-CAPTUR, please refer to the <a href="references.html">references</a>.
</p>
<p class="mb-4">The current page presents an overview of the results of all steps run in TSS-CAPTUR, for example, the length of the transcript originally extracted from the genome and the predicted classification.
In the case of RNA-transcripts, a terminator might have been allocated to the transcript and the coordinates would have been adapted.
Also, a secondary structure analysis is run using <a href="https://academic.oup.com/nar/article/36/suppl_2/W70/2505776">RNAFold</a> RNA transcripts and allows a visualization of it.
All transcript undergo a motif analysis of the promoter region using <a href="https://doi.org/10.1093/nar/gkp335">MEME</a> A short descriptive overview follows:
</p>
<div class="row">

Expand All @@ -20,7 +24,7 @@ <h1 class="h3 mb-0 text-gray-800">Overview of data</h1>
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-primary text-uppercase mb-1">
Total of TSS</div>
Total of input TSSs</div>
<div class="h5 mb-0 font-weight-bold text-gray-800"><span id="allTSS"></span></div>
</div>
</div>
Expand All @@ -34,7 +38,7 @@ <h1 class="h3 mb-0 text-gray-800">Overview of data</h1>
<div class="row no-gutters align-items-center">
<div id="orphan-card" class="col mr-2">
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
Total of Orphan TSS</div>
Total of analyzed orphan TSSs</div>
<div class="h5 mb-0 font-weight-bold text-gray-800"><span id="OTSS"></span></div>
<div class="h6 mb-0 font-weight-bold text-gray-800">Coding: <span id="CodingOTSS"></span></div>
<div class="h6 mb-0 font-weight-bold text-gray-800">ncRNAs: <span id="ncOTSS"></span></div>
Expand All @@ -52,7 +56,7 @@ <h1 class="h3 mb-0 text-gray-800">Overview of data</h1>
<div class="row no-gutters align-items-center">
<div id="as-card" class="col mr-2">
<div class="text-xs font-weight-bold text-info text-uppercase mb-1">
Total of Antisense TSS</div>
Total of analyzed antisense TSSs</div>
<div class="h5 mb-0 font-weight-bold text-gray-800"><span id="ATSS"></span></div>
<div class="h6 mb-0 font-weight-bold text-gray-800">Coding: <span id="CodingATSS"></span></div>
<div class="h6 mb-0 font-weight-bold text-gray-800">ncRNAs: <span id="ncATSS"></span></div>
Expand All @@ -70,7 +74,7 @@ <h1 class="h3 mb-0 text-gray-800">Overview of data</h1>
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-danger text-uppercase mb-1">
Total of <a href="avoided.html">ignored TSS</a></div>
Total of <a href="avoided.html">ignored TSSs</a></div>
<div class="h5 mb-0 font-weight-bold text-gray-800"><span id="iTSS"></span></div>
</div>

Expand Down
Loading

0 comments on commit f5fb5f5

Please sign in to comment.