<commit_before>/*
  Copyright <NAME> 2013-2015.

  This file is part of FreeSASA.

  FreeSASA is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  FreeSASA is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with FreeSASA.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <getopt.h>
#include <stdarg.h>
#if HAVE_CONFIG_H
#  include <config.h>
#endif

#include "freesasa.h"
#include "srp.h"

#if STDC_HEADERS
extern int getopt(int, char * const *, const char *);
extern int optind;
#endif

#ifdef PACKAGE_VERSION
const char *version = PACKAGE_VERSION;
#else
const char* version = "unknown";
#endif

char *program_name;
const char* options_string;

freesasa_parameters parameters;
freesasa_classifier *classifier = NULL;
FILE *output_pdb = NULL;
FILE *per_residue_type_file = NULL;
FILE *per_residue_file = NULL;
int per_residue_type = 0;
int per_residue = 0;
int printlog = 1;
int structure_options = 0;
int printpdb = 0;
int n_chain_groups = 0;
const char** chain_groups;

void help() {
    fprintf(stderr,"\nUsage: %s [%s] pdb-file(s)\n",
            program_name,options_string);
    fprintf(stderr,"\n"
            "  -h (--help)           Print this message\n"
            "  -v (--version)        Print version of the program\n");
    fprintf(stderr,"\nSASA calculation parameters:\n"
            "  -S (--shrake-rupley)  Use Shrake & Rupley algorithm [default]\n"
            "  -L (--lee-richards)   Use Lee & Richards algorithm\n");
    fprintf(stderr,
            "  -p <value>  --probe-radius=<value>\n"
            "                        Probe radius [default %4.2f Å]\n"
            "  -d <value>  --lr-slice=<value>\n"
            "                        Slice spacing in Lee & Richards algorithm \n"
            "                        [default %4.2f Å].\n",
            FREESASA_DEF_PROBE_RADIUS,FREESASA_DEF_LR_D);
    fprintf(stderr,
            "  -n <value>  --sr-points=<value>\n"
            "                        Number of test points in Shrake & Rupley algorithm.\n"
            "                        Default is %d, allowed values are:\n"
            "                          ", FREESASA_DEF_SR_N);
    freesasa_srp_print_n_opt(stderr);
#ifdef HAVE_LIBPTHREAD
    fprintf(stderr,
            "  -t <value>  --n-threads=<value>\n"
            "                        Number of threads to use in calculation.\n");
#endif
    fprintf(stderr,
            "  -c <file> (--config-file=<file>)\n"
            "                        Use atomic radii and classes provided in file\n");
    fprintf(stderr,
            "\nInput PDB:              (default: ignore HETATM and hydrogens, include all\n"
            "                         chains of the first MODEL)\n"
            "  -H (--hetatm)         Include HETATM entries from input\n"
            "  -Y (--hydrogen)       Include hydrogen atoms. Only makes sense in concjunction\n"
            "                        with -c option. Default H radius is 0 Å.\n"
            "  -m (--join-models)    Join all MODELs in input into one big structure.\n"
            "  -C (--separate-chains) Calculate SASA for each chain separately.\n"
            "  -M (--separate-models) Calculate SASA for each MODEL separately.\n"
            "  -g <chains> --chain-groups <chains>\n"
            "                        Select chain or group of chains to treat separately.\n"
            "                        Several groups can be concatenated by '+', or by repetition.\n"
            "                        Examples:\n"
            "                                    '-g A', '-g AB', -g 'A+B', '-g A -g B', '-g AB+CD', etc\n");
    fprintf(stderr,"\nOutput options:\n"
            "  -l (--no-log)         Don't print log message (useful with -r -R and -B)\n"
            "  -w (--no-warnings)    Don't print warnings (will still print warnings due to invalid command\n"
            "                        line options)\n\n"
            "  -r  --per-residue-type --per-residue-type-file <output-file>\n"
            "  -R  --per-sequence --per-sequence-file <output-file>\n"
            "                        Print SASA for each residue, either grouped by type or sequentially.\n"
            "                        Use the -file variant to specify an output file.\n\n"
            "  -B  --print-as-B-values --B-value-file <output-file>\n"
            "                        Print PDB file where the temperature factor of each atom has\n"
            "                        been replaced by its SASA, and the occupancy number by the atomic\n"
            "                        radius. Use the -file variant to specify an output file.\n");
    fprintf(stderr,
            "\nIf no pdb-file is specified STDIN is used for input.\n\n"
            "To calculate SASA of one or several PDB file using default parameters simply type:\n\n"
            "   '%s pdb-file(s)'     or    '%s < pdb-file'\n\n",
            program_name,program_name);
}<commit_msg>Added clarification to the help-message for the -B option.<commit_after>/*
  Copyright <NAME> 2013-2015.

  This file is part of FreeSASA.

  FreeSASA is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  FreeSASA is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with FreeSASA.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <getopt.h>
#include <stdarg.h>
#if HAVE_CONFIG_H
#  include <config.h>
#endif

#include "freesasa.h"
#include "srp.h"

#if STDC_HEADERS
extern int getopt(int, char * const *, const char *);
extern int optind;
#endif

#ifdef PACKAGE_VERSION
const char *version = PACKAGE_VERSION;
#else
const char* version = "unknown";
#endif

char *program_name;
const char* options_string;

freesasa_parameters parameters;
freesasa_classifier *classifier = NULL;
FILE *output_pdb = NULL;
FILE *per_residue_type_file = NULL;
FILE *per_residue_file = NULL;
int per_residue_type = 0;
int per_residue = 0;
int printlog = 1;
int structure_options = 0;
int printpdb = 0;
int n_chain_groups = 0;
const char** chain_groups;

void help() {
    fprintf(stderr,"\nUsage: %s [%s] pdb-file(s)\n",
            program_name,options_string);
    fprintf(stderr,"\n"
            "  -h (--help)           Print this message\n"
            "  -v (--version)        Print version of the program\n");
    fprintf(stderr,"\nSASA calculation parameters:\n"
            "  -S (--shrake-rupley)  Use Shrake & Rupley algorithm [default]\n"
            "  -L (--lee-richards)   Use Lee & Richards algorithm\n");
    fprintf(stderr,
            "  -p <value>  --probe-radius=<value>\n"
            "                        Probe radius [default %4.2f Å]\n"
            "  -d <value>  --lr-slice=<value>\n"
            "                        Slice spacing in Lee & Richards algorithm \n"
            "                        [default %4.2f Å].\n",
            FREESASA_DEF_PROBE_RADIUS,FREESASA_DEF_LR_D);
    fprintf(stderr,
            "  -n <value>  --sr-points=<value>\n"
            "                        Number of test points in Shrake & Rupley algorithm.\n"
            "                        Default is %d, allowed values are:\n"
            "                          ", FREESASA_DEF_SR_N);
    freesasa_srp_print_n_opt(stderr);
#ifdef HAVE_LIBPTHREAD
    fprintf(stderr,
            "  -t <value>  --n-threads=<value>\n"
            "                        Number of threads to use in calculation.\n");
#endif
    fprintf(stderr,
            "  -c <file> (--config-file=<file>)\n"
            "                        Use atomic radii and classes provided in file\n");
    fprintf(stderr,
            "\nInput PDB:              (default: ignore HETATM and hydrogens, include all\n"
            "                         chains of the first MODEL)\n"
            "  -H (--hetatm)         Include HETATM entries from input\n"
            "  -Y (--hydrogen)       Include hydrogen atoms. Only makes sense in concjunction\n"
            "                        with -c option. Default H radius is 0 Å.\n"
            "  -m (--join-models)    Join all MODELs in input into one big structure.\n"
            "  -C (--separate-chains) Calculate SASA for each chain separately.\n"
            "  -M (--separate-models) Calculate SASA for each MODEL separately.\n"
            "  -g <chains> --chain-groups <chains>\n"
            "                        Select chain or group of chains to treat separately.\n"
            "                        Several groups can be concatenated by '+', or by repetition.\n"
            "                        Examples:\n"
            "                                    '-g A', '-g AB', -g 'A+B', '-g A -g B', '-g AB+CD', etc\n");
    fprintf(stderr,"\nOutput options:\n"
            "  -l (--no-log)         Don't print log message (useful with -r -R and -B)\n"
            "  -w (--no-warnings)    Don't print warnings (will still print warnings due to invalid command\n"
            "                        line options)\n\n"
            "  -r  --per-residue-type --per-residue-type-file <output-file>\n"
            "  -R  --per-sequence --per-sequence-file <output-file>\n"
            "                        Print SASA for each residue, either grouped by type or sequentially.\n"
            "                        Use the -file variant to specify an output file.\n\n"
            "  -B  --print-as-B-values --B-value-file <output-file>\n"
            "                        Print PDB file where the temperature factor of each atom has\n"
            "                        been replaced by its SASA, and the occupancy number by the atomic\n"
            "                        radius. Use the -file variant to specify an output file.\n"
            "                        This option might at moment give confusing output when used in conjuction\n"
            "                        with the options -C and -g.\n");
    fprintf(stderr,
            "\nIf no pdb-file is specified STDIN is used for input.\n\n"
            "To calculate SASA of one or several PDB file using default parameters simply type:\n\n"
            "   '%s pdb-file(s)'     or    '%s < pdb-file'\n\n",
            program_name,program_name);
}
{'fraction_non_alphanumeric': 0.10793989508313329, 'fraction_numerical': 0.0035565039566106517, 'mean_word_length': 1.7018976699495556, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 58, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2295135', 'n_tokens_mistral': 3431, 'n_tokens_neox': 3276, 'n_words': 1086}