def generate_html(region_layer: RegionLayer, results: LanthiResults, _record_layer: RecordLayer, _options_layer: OptionsLayer) -> HTMLSections: """ Generates HTML output for the module """ html = HTMLSections("lanthipeptides") detail_tooltip = ( "Lists the possible core peptides for each biosynthetic enzyme, including the predicted class. " "Each core peptide shows the leader and core peptide sequences, separated by a dash." ) template = FileTemplate( path.get_full_path(__file__, "templates", "details.html")) motifs = results.get_motifs_for_region(region_layer.region_feature) html.add_detail_section( "Lanthipeptides", template.render(results=motifs, tooltip=detail_tooltip)) side_tooltip = ( "Lists the possible core peptides in the region. " "Each core peptide lists the number of lanthionine bridges, possible molecular weights, " "and the scores for cleavage site prediction and RODEO.") template = FileTemplate( path.get_full_path(__file__, "templates", "sidepanel.html")) motifs = results.get_motifs_for_region(region_layer.region_feature) html.add_sidepanel_section( "Lanthipeptides", template.render(results=motifs, tooltip=side_tooltip)) return html
def generate_html(region_layer: RegionLayer, results: ThioResults, record_layer: RecordLayer, options_layer: OptionsLayer ) -> HTMLSections: """ Generates HTML for the module """ html = HTMLSections("thiopeptides") if not results: return html thio_layer = ThiopeptideLayer(record_layer, results, region_layer.region_feature) detail_tooltip = ("Lists the possible core peptides for each biosynthetic enzyme, including the predicted class. " "Each core peptide shows the leader and core peptide sequences, separated by a dash. " "Predicted tail sequences are also shown.") template = FileTemplate(path.get_full_path(__file__, "templates", "details.html")) details = template.render(record=record_layer, cluster=thio_layer, options=options_layer, tooltip=detail_tooltip) html.add_detail_section("Thiopeptides", details) side_tooltip = ("Lists the possible core peptides in the region. " "Each core peptide lists its possible molecular weights " "and the scores for cleavage site prediction and RODEO. " "If relevant, other features, such as macrocycle and amidation, will also be listed.") template = FileTemplate(path.get_full_path(__file__, "templates", "sidepanel.html")) sidepanel = template.render(record=record_layer, cluster=thio_layer, options=options_layer, tooltip=side_tooltip) html.add_sidepanel_section("Thiopeptides", sidepanel) return html
def generate_html(region_layer: RegionLayer, results: T2PKSResults, _record_layer: RecordLayer, options_layer: OptionsLayer) -> HTMLSections: """ Generate the sidepanel HTML with results from the type II PKS module """ html = HTMLSections("t2pks") predictions = [] for cluster in region_layer.get_unique_clusters(): if cluster.product == "T2PKS": predictions.append( results.cluster_predictions[cluster.get_cluster_number()]) template = FileTemplate( path.get_full_path(__file__, "templates", "sidepanel.html")) docs_url = options_layer.urls.docs_baseurl + "modules/t2pks" tooltip_content = ( "Predictions of starter units, elongations, product classes, " "and potential molecular weights for type II PKS clusters.") tooltip_content += "<br>More detailed information is available <a href='%s' target='_blank'>here</a>." % docs_url html.add_sidepanel_section( "Type II PKS", template.render(predictions=predictions, tooltip_content=tooltip_content)) return html
def generate_html(region_layer: RegionLayer, results: SactiResults, record_layer: RecordLayer, options_layer: OptionsLayer) -> HTMLSections: """ Generates HTML for the module """ html = HTMLSections("sactipeptides") motifs_in_region = defaultdict(list) # type: Dict[str, List[CDSMotif]] for locus, motifs in results.motifs_by_locus.items(): for motif in motifs: if motif.is_contained_by(region_layer.region_feature): motifs_in_region[locus].append(motif) sacti_layer = SactipeptideLayer(record_layer, region_layer.region_feature) template = FileTemplate( path.get_full_path(__file__, "templates", "details.html")) details = template.render(record=record_layer, region=sacti_layer, options=options_layer, results=motifs_in_region) html.add_detail_section("Sactipeptides", details) template = FileTemplate( path.get_full_path(__file__, "templates", "sidepanel.html")) sidepanel = template.render(record=record_layer, region=sacti_layer, options=options_layer, results=motifs_in_region) html.add_sidepanel_section("Sactipeptides", sidepanel) return html
def generate_html(region_layer: RegionLayer, results: SactiResults, record_layer: RecordLayer, options_layer: OptionsLayer) -> HTMLSections: """ Generates HTML for the module """ html = HTMLSections("sactipeptides") motifs_in_region = defaultdict(list) # type: Dict[str, List[CDSMotif]] for locus, motifs in results.motifs_by_locus.items(): for motif in motifs: if motif.is_contained_by(region_layer.region_feature): motifs_in_region[locus].append(motif) sacti_layer = SactipeptideLayer(record_layer, region_layer.region_feature) detail_tooltip = ("Lists the possible core peptides for each biosynthetic enzyme, including the predicted class. " "Each core peptide shows the leader and core peptide sequences, separated by a dash.") template = FileTemplate(path.get_full_path(__file__, "templates", "details.html")) details = template.render(record=record_layer, region=sacti_layer, options=options_layer, results=motifs_in_region, tooltip=detail_tooltip) html.add_detail_section("Sactipeptides", details) side_tooltip = ("Lists the possible core peptides in the region. " "Each core peptide lists its RODEO score and predicted core sequence.") template = FileTemplate(path.get_full_path(__file__, "templates", "sidepanel.html")) sidepanel = template.render(record=record_layer, region=sacti_layer, options=options_layer, results=motifs_in_region, tooltip=side_tooltip) html.add_sidepanel_section("Sactipeptides", sidepanel) return html
def generate_html(region_layer: RegionLayer, results: ThioResults, record_layer: RecordLayer, options_layer: OptionsLayer) -> HTMLSections: """ Generates HTML for the module """ html = HTMLSections("thiopeptides") if not results: return html thio_layer = ThiopeptideLayer(record_layer, results, region_layer.region_feature) template = FileTemplate( path.get_full_path(__file__, "templates", "details.html")) details = template.render(record=record_layer, cluster=thio_layer, options=options_layer) html.add_detail_section("Thiopeptides", details) template = FileTemplate( path.get_full_path(__file__, "templates", "sidepanel.html")) sidepanel = template.render(record=record_layer, cluster=thio_layer, options=options_layer) html.add_sidepanel_section("Thiopeptides", sidepanel) return html
def generate_html(region_layer: RegionLayer, results: NRPS_PKS_Results, record_layer: RecordLayer, options_layer: OptionsLayer) -> HTMLSections: """ Generate the sidepanel HTML with results from the NRPS/PKS module """ html = HTMLSections("nrps_pks") nrps_layer = NrpspksLayer(results, region_layer.region_feature, record_layer) features_with_domain_predictions: Dict[str, List[str]] = {} for domain_name, consensus in results.consensus.items(): if not consensus: continue domain = record_layer.get_domain_by_name(domain_name) features_with_domain_predictions[domain.locus_tag] = [] for feature_name, monomers in features_with_domain_predictions.items(): for domain in record_layer.get_cds_by_name( feature_name).nrps_pks.domains: monomer = results.consensus.get(domain.feature_name) if monomer: monomers.append(monomer) prod_tt = ( "Shows estimated product structure and polymer for each candidate cluster in the region. " "To show the product, click on the expander or the candidate cluster feature drawn in the overview. " ) mon_tt = ( "Shows the predicted monomers for each adynelation domain and acyltransferase within genes. " "Each gene prediction can be expanded to view detailed predictions of each domain. " "Each prediction can be expanded to view the predictions by tool " " (and, for some tools, further expanded for extra details). ") if not nrps_layer.has_any_polymer(): return html for filename, name, class_name, tooltip in [ ("products.html", "NRPS/PKS products", "nrps_pks_products", prod_tt), ("monomers.html", "NRPS/PKS monomers", "", mon_tt) ]: template = FileTemplate( path.get_full_path(__file__, "templates", filename)) section = template.render( record=record_layer, region=nrps_layer, results=results, relevant_features=features_with_domain_predictions, options=options_layer, tooltip=tooltip) html.add_sidepanel_section(name, section, class_name) return html
def generate_html(region_layer: RegionLayer, results: LanthiResults, _record_layer: RecordLayer, _options_layer: OptionsLayer ) -> HTMLSections: """ Generates HTML output for the module """ html = HTMLSections("lanthipeptides") template = FileTemplate(path.get_full_path(__file__, "templates", "details.html")) motifs = results.get_motifs_for_region(region_layer.region_feature) html.add_detail_section("Lanthipeptides", template.render(results=motifs)) template = FileTemplate(path.get_full_path(__file__, "templates", "sidepanel.html")) motifs = results.get_motifs_for_region(region_layer.region_feature) html.add_sidepanel_section("Lanthipeptides", template.render(results=motifs)) return html
def generate_html(region_layer: RegionLayer, results: RREFinderResults, _record_layer: RecordLayer, _options_layer: OptionsLayer) -> HTMLSections: """ Generates HTML output for the module """ html = HTMLSections("rrefinder") side_tooltip = ("RREfinder results sidepanel.") template = FileTemplate( path.get_full_path(__file__, "templates", "sidepanel.html")) html.add_sidepanel_section( "RREFinder", template.render(results=results, region=region_layer.region_feature, tooltip=side_tooltip), "RREfinder") return html
def generate_html(region_layer: RegionLayer, results: T2PKSResults, _record_layer: RecordLayer, _options_layer: OptionsLayer) -> HTMLSections: """ Generate the sidepanel HTML with results from the type II PKS module """ html = HTMLSections("t2pks") predictions = [] for cluster in region_layer.get_unique_clusters(): if cluster.product == "t2pks": predictions.append( results.cluster_predictions[cluster.get_cluster_number()]) template = FileTemplate( path.get_full_path(__file__, "templates", "sidepanel.html")) html.add_sidepanel_section("Type II PKS", template.render(predictions=predictions)) return html
def generate_html(region_layer: RegionLayer, results: NRPS_PKS_Results, record_layer: RecordLayer, options_layer: OptionsLayer) -> HTMLSections: """ Generate the sidepanel HTML with results from the NRPS/PKS module """ html = HTMLSections("nrps_pks") nrps_layer = NrpspksLayer(results, region_layer.region_feature, record_layer) features_with_domain_predictions = {} # type: Dict[str, List[str]] for domain_name, consensus in results.consensus.items(): if not consensus: continue domain = record_layer.get_domain_by_name(domain_name) features_with_domain_predictions[domain.locus_tag] = [] for feature_name, monomers in features_with_domain_predictions.items(): for domain in record_layer.get_cds_by_name( feature_name).nrps_pks.domains: monomer = results.consensus.get(domain.feature_name) if monomer: monomers.append(monomer) for filename, name, class_name in [ ("products.html", "NRPS/PKS products", "nrps_pks_products"), ("monomers.html", "NRPS/PKS monomers", "") ]: template = FileTemplate( path.get_full_path(__file__, "templates", filename)) section = template.render( record=record_layer, region=nrps_layer, results=results, relevant_features=features_with_domain_predictions, options=options_layer) html.add_sidepanel_section(name, section, class_name) return html
def generate_html(region_layer: RegionLayer, results: LassoResults, record_layer: RecordLayer, _options_layer: OptionsLayer) -> HTMLSections: """ Generates HTML for the module """ html = HTMLSections("lassopeptides") motifs_in_region = {} for locus in results.motifs_by_locus: if record_layer.get_cds_by_name(locus).is_contained_by(region_layer.region_feature): motifs_in_region[locus] = results.motifs_by_locus[locus] detail_tooltip = ("Lists the possible core peptides for each biosynthetic enzyme, including the predicted class. " "Each core peptide shows the leader and core peptide sequences, separated by a dash.") template = FileTemplate(path.get_full_path(__file__, "templates", "details.html")) html.add_detail_section("Lasso peptides", template.render(results=motifs_in_region, tooltip=detail_tooltip)) side_tooltip = ("Lists the possible core peptides in the region. " "Each core peptide lists the number of disulfide bridges, possible molecular weights, " "and the scores for cleavage site prediction and RODEO.") template = FileTemplate(path.get_full_path(__file__, "templates", "sidepanel.html")) html.add_sidepanel_section("Lasso peptides", template.render(results=motifs_in_region, tooltip=side_tooltip)) return html
def generate_html(region_layer: RegionLayer, results: LassoResults, record_layer: RecordLayer, _options_layer: OptionsLayer) -> HTMLSections: """ Generates HTML for the module """ html = HTMLSections("lassopeptides") motifs_in_region = {} for locus in results.motifs_by_locus: if record_layer.get_cds_by_name(locus).is_contained_by( region_layer.region_feature): motifs_in_region[locus] = results.motifs_by_locus[locus] template = FileTemplate( path.get_full_path(__file__, "templates", "details.html")) html.add_detail_section("Lasso peptides", template.render(results=motifs_in_region)) template = FileTemplate( path.get_full_path(__file__, "templates", "sidepanel.html")) html.add_sidepanel_section("Lasso peptides", template.render(results=motifs_in_region)) return html
def generate_html(region_layer: RegionLayer, results: RREFinderResults, _record_layer: RecordLayer, _options_layer: OptionsLayer) -> HTMLSections: """ Generates HTML output for the module """ html = HTMLSections("rrefinder") side_tooltip = ("RREfinder results sidepanel.") template = FileTemplate( path.get_full_path(__file__, "templates", "sidepanel.html")) protoclusters = [] for proto in region_layer.get_unique_protoclusters(): if proto.get_protocluster_number() in results.hits_by_protocluster: protoclusters.append(proto) if protoclusters: section = template.render(results=results, protoclusters=protoclusters, tooltip=side_tooltip) html.add_sidepanel_section("RREFinder", section, class_name="RREfinder") return html