<commit_before>package uk.ac.ebi.atlas.experimentpage.analysismethods;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import uk.ac.ebi.atlas.controllers.ResourceNotFoundException;

import javax.inject.Inject;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.text.MessageFormat;

@Controller
@Scope("request")
public class AnalysisMethodsPageController {

    private String pdfFileTemplate;

    @Inject
    public AnalysisMethodsPageController(@Value("#{configuration['analysis-methods.pdf.path.template']}") String pdfFileTemplate) {

        this.pdfFileTemplate = pdfFileTemplate;
    }

    @RequestMapping(value = "/experiments/{experimentAccession}/analysis-methods/{resource}.pdf", method = RequestMethod.GET)
    public String getAnalysisMethodsPdf(@PathVariable String experimentAccession,@PathVariable String resource) throws IOException {
        if(!hasPDF(experimentAccession, resource)) {<commit_msg>Document what I think analysis-methods is for (proteomics experiments)<commit_after>package uk.ac.ebi.atlas.experimentpage.analysismethods;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import uk.ac.ebi.atlas.controllers.ResourceNotFoundException;

import javax.inject.Inject;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.text.MessageFormat;

/*
I only know of E-PROT-1 that has this - and it's linked in the analysis methods tsv so can't change the url easily :(
It seems to "win" against the all-grabbing /experiments/{experimentAccession}/** but it's fragile!
 */
@Controller
@Scope("request")
public class AnalysisMethodsPageController {

    private String pdfFileTemplate;

    @Inject
    public AnalysisMethodsPageController(@Value("#{configuration['analysis-methods.pdf.path.template']}") String pdfFileTemplate) {

        this.pdfFileTemplate = pdfFileTemplate;
    }

    @RequestMapping(value = "/experiments/{experimentAccession}/analysis-methods/{resource}.pdf", method = RequestMethod.GET)
    public String getAnalysisMethodsPdf(@PathVariable String experimentAccession,@PathVariable String resource) throws IOException {
        if(!hasPDF(experimentAccession, resource)) {
{'fraction_non_alphanumeric': 0.10067352002835873, 'fraction_numerical': 0.0003544842254519674, 'mean_word_length': 6.072681704260652, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4643960', 'n_tokens_mistral': 750, 'n_tokens_neox': 738, 'n_words': 153}