librg-utils-perl-1.0.43/0000755015075101507510000000000011652607053012016 500000000000000librg-utils-perl-1.0.43/README0000644015075101507510000000000011576712144012607 00000000000000librg-utils-perl-1.0.43/configure.ac0000644015075101507510000000077511652606015014232 00000000000000AC_INIT([librg-utils-perl], [1.0.43], [https://rostlab.org/cgi-bin/bugzilla3/enter_bug.cgi?product=librg-utils-perl]) # remember to update version number in Build.PL # PERLLIBDIR=$(eval "`perl -V:installvendorlib`"; echo $installvendorlib) AM_INIT_AUTOMAKE AC_CONFIG_FILES([Makefile] [Build.PL] [librg-utils-perl.spec] [lib/Makefile] [lib/RG/Makefile] [lib/RG/Utils/Makefile] [mat/Makefile]) AC_SUBST(INSTALL_BASE_ARG) if test "x$prefix" != "x/usr"; then INSTALL_BASE_ARG=install_base=$prefix fi AC_OUTPUT librg-utils-perl-1.0.43/aclocal.m40000644015075101507510000005276011652606214013606 00000000000000# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],, [m4_warning([this file was generated for autoconf 2.67. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR librg-utils-perl-1.0.43/Build.PL.in0000644015075101507510000000065311640615531013640 00000000000000use warnings; use strict; use Module::Build; Module::Build->new( module_name => 'RG::Utils', license => 'perl', dist_name => 'librg-utils-perl', dist_version => '@VERSION@', dist_author => [ 'Burkhard Rost', 'Laszlo Kajan ', 'Guy Yachdav ' ], dist_abstract => 'modules for file format conversion utilities for bioinformatics', )->create_build_script; # vim:et:ts=2:ai: librg-utils-perl-1.0.43/librg-utils-perl.spec.in0000644015075101507510000000276311652605565016432 00000000000000Summary: a set of wrappers and conversion utilities for bioinformatics databases Name: librg-utils-perl Version: @VERSION@ Release: 1 License: GPL Group: Applications/Science Source: ftp://rostlab.org/%{name}/%{name}-%{version}.tar.gz URL: http://rostlab.org/ BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildRequires: perl Requires: perl-List-MoreUtils, profphd-utils %description This package contains assorted tools like: . * blast2saf.pl, blastpgp_to_saf.pl, conv_hssp2saf.pl, copf.pl, hssp_filter.pl, safFilterRed.pl . and modules like: . * RG:Utils::Conv_hssp2saf RG:Utils::Copf RG:Utils::Hssp_filter %prep %setup -q %build %configure PERLLIBDIR=%{perl_vendorlib} make %install rm -rf $RPM_BUILD_ROOT make DESTDIR=${RPM_BUILD_ROOT} install %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %doc AUTHORS %doc COPYING %{_mandir}/*/* %{_datadir}/%{name}/* %{perl_vendorlib}/RG/Utils/* %changelog * Fri Oct 28 2011 Laszlo Kajan - 1.0.42-1 - new upstream * Mon Jun 27 2011 Laszlo Kajan - 1.0.41-1 - new upstream * Mon Jun 27 2011 Laszlo Kajan - 1.0.39-1 - new upstream * Wed Jun 22 2011 Laszlo Kajan - 1.0.38-1 - new upstream * Tue Jun 21 2011 Laszlo Kajan - 1.0.37-1 - new upstream * Tue Jun 21 2011 Laszlo Kajan - 1.0.36-2 - spec file in dist root, DESTDIR on install * Wed Jun 16 2011 Guy Yachdav - 1.0.36-1 - Initial build. librg-utils-perl-1.0.43/blast2saf.pl0000755015075101507510000006723311565541412014171 00000000000000#!/usr/bin/perl -w use Carp qw| cluck :DEFAULT |; use File::Basename qw||; # $scrName=__FILE__;$scrName=~s/^.*\/|\.pl//g; $scrGoal="converts blastpgp output file into saf (optional Rdb)". " \t \n". " \t "; # # # #------------------------------------------------------------------------------# # Copyright 2000 # # Dariusz Przybylski dudek@cubic.bioc.columbia.edu # # Burkhard Rost rost@columbia.edu # # CUBIC (Columbia Univ) http://cubic.bioc.columbia.edu/ # # Dept Biochemistry & Molecular Biophysics # # 650 West, 168 Street # # New York, NY 10032 # # version 1.0 Sep, 2000 # #------------------------------------------------------------------------------# # &helpLocal() if ($#ARGV<0 || $ARGV[0]=~/^(-h|help|\?|def)$/i); if ($#ARGV < 0) { die( "*** ERROR blastpgp_to_saf.pl : no arguments given"); } #$fileErr="b2saf.tmp_".$$; #open(FHERROR, ">$fileErr") || die "*** could not open error log file \n"; INI:{ $par{"extSaf"}= ".saf"; $par{"extRdb"}= ".rdbBlast"; $par{"extFasta"}=".f"; } foreach $arg (@ARGV){ #if ($arg=~/^blast=(.*)$/) { $fileInBlast = $1;} if ($arg=~/^fasta=(.*)$/) { $fileInQuery = $1;} elsif ($arg=~/^saf=(.*)$/) { $fileOutSaf = $1;} elsif ($arg=~/^rdb=(.*)$/) { $fileOutRdb = $1;} elsif ($arg=~/^rdb$/) { $fileOutRdb = 1;} elsif ($arg=~/^short$/) { $short = 1;} elsif ($arg=~/^red=(.*)$/) { $filterThre = $1;} elsif ($arg=~/^maxAli=(.*)$/) { $maxAli = $1;} elsif ($arg=~/^tile=(.*)$/) { $alignTiling = $1;} elsif ($arg=~/^eSaf=(.*)$/) { $eThresh = $1;} elsif ($arg=~/^extSaf=(.*)$/) { $par{"extSaf"} = $1;} elsif ($arg=~/^extFasta=(.*)$/) { $par{"extFasta"}= $1;} elsif ($arg=~/^extRdb=(.*)$/) { $par{"extRdb"} = $1;} elsif ($arg=~/^debug=(.*)$/) { $par{"debug"} = $1;} elsif ($arg=~/^filterOutQueryNameHits=(.*)$/){ $par{filterOutQueryNameHits} = $1;} elsif (-e $arg) { push(@fileIn,$arg); } else { die( "*** wrong command line arg '$arg'" ); } } $fileIn=$fileIn[0]; die ("missing input $fileIn") if (! -e $fileIn); $alignTiling =1 if (! defined $alignTiling) ; $maxAli =5000 if (! defined $maxAli) ; $filterThre =100 if (! defined $filterThre) ; $eThresh =100 if (! defined $eThresh ) ; $short =0 if (! defined $short) ; $#fileTmp=-1; foreach $fileIn (@fileIn){ if ( $fileIn =~/\.list/ ) { ($Lok,$msg,$file,$tmp)= &fileListRd($fileIn);if (! $Lok){ print "*** ERROR $scrName: input list\n",$msg,"\n"; exit; } @tmpf=split(/,/,$file); push(@fileTmp,@tmpf); next;} if ($fileIn !~ /\.list/) {push(@fileTmp,$fileIn);} } @fileIn= @fileTmp; $#fileTmp=-1; # slim-is-in foreach $fileIn (@fileIn){ ++$ctfile; if (! -e $fileIn){print "-*- WARN $scrName: no fileInBlast=$fileIn\n"; next;} # output files $id=$fileIn; $id=~s/^(.*\/)//; $dirIn=$1; $id=~s/\..*$//; $dirIn='' if (! defined $dirIn); # BLAST output if ($ctfile > 1 ){ $fileOutSaf=$id.$par{"extSaf"}; $fileInQuery=$dirIn.$id.$par{"extFasta"}; if ( $fileOutRdb ne '0' ) {$fileOutRdb=$id.$par{"extRdb"}; } else{ $fileOutRdb=0; } } else { if (! defined $fileOutSaf) {$fileOutSaf=$id.$par{"extSaf"};} if (! defined $fileOutRdb) {$fileOutRdb="0"; } elsif ($fileOutRdb eq "1") {$fileOutRdb=$id.$par{"extRdb"};} if (! defined $fileInQuery) {$fileInQuery=$dirIn.$id.$par{"extFasta"}; } } if (! defined $fileInQuery) { print "*** WARNING $scrName : query input file name is not defined\n"; } ($Lok,$msg)= &blastp_to_saf($fileIn,$fileInQuery,$fileOutSaf,$fileOutRdb,$filterThre,$maxAli,$alignTiling,$eThresh,$short); if (! $Lok ) { die( "*** ERROR blastpgp_to_saf.pl : '$msg'" ); } elsif ($Lok == 2 ) { warn( "*** WARNING blastpgp_to_saf.pl : '$msg'" ); } } #close FHERROR; #unlink($fileErr) if (-z $fileErr); exit(0); #============================================================================================= sub blastp_to_saf { my ($Lok,$msg); my $sbr="blastp_to_saf"; my ($blastfile,$queryfile,$fileout,$rdb,$filter,$maxAli,$tile,$eThresh,$short)=@_; my (@query, %sequences,@alignedids,@namesSort,%rdb_lines); my (@tmp_seq,@inserted_query,@seq,@alignedNames,%u_endings,%endings ); my ($key,$first,$last,$fhin,$local_counter,$beg,$index,$iter,$Score_count); my ($Qflag,$fastaFlag); local $queryLength; $fhin= "FHIN"; #------------------- gets the query sequence and its length undef @query; $fastaFlag='0'; # lkajan: this seems to confuse things when the name assigned here to queryName happens to be the same as one of the matches in the BLAST result #$queryName = File::Basename::fileparse( $blastfile, qr/\.[^.]*$/o ); #$queryName.="_query"; $queryName = 'query'; if (-e $queryfile){ open($fhin,$queryfile) || confess("*** ERROR sbr: could not open $queryfile - no such file: $!"); #$queryName='query'; while(<$fhin>){ next if($_=~/^\n/ || $_=~/\// || $_=~/>/ || $_=~/#/ ); $_=~s/\s+//g; @tmp=split(//o,$_); push @query, @tmp; } close $fhin; $fastaFlag='1'; $queryLength=@query; } else { $fastaFlag='0';$queryName='query';} #.......................................................... #if ( $rdb ne '0' && $rdb ne '' ){ #$rdbFile=$rdb; #($Lok,$msg)= &printRdbHeader(); #if (! $Lok){ return(0,"*** ERROR $sbr : $msg"); } #} #------------------- finds number of iterations in blast file open($fhin,$blastfile) || return(0,"*** ERROR $sbr: failed to open blast file $blastfile\n"); $iter=0; $nohits=0; $Qflag='closed'; while(<$fhin>){ if (! $fastaFlag){ if($_=~/^Query=/){$Qflag='open'; next;} if( $_=~/letters\)/ && $Qflag eq 'open'){ $queryLength=$_; chomp $queryLength; $queryLength=~s/^\s*\(([0-9]*)\s*letters.*$/$1/; } } if($_=~/^Database:/){ $Qflag='closed';} if($_=~/No hits found/){$nohits=1; last;} if($_=~/^Searching../){ $iter++; } } close $fhin; if( ! defined $queryLength ) {return(0,"*** ERROR $sbr: failed to obtain length of query"); } if ( $rdb ne '0' && $rdb ne '' ){ $rdbFile=$rdb; ($Lok,$msg)= &printRdbHeader(); if (! $Lok){ return(0,"*** ERROR $sbr : $msg"); } } if( ! $fastaFlag) { for ($i=0;$i<$queryLength;$i++){$query[$i]='.';} } if ($nohits eq '1'){ $sequences{''}=''; @alignedNames=(); ($Lok,$msg)=&print_saf_file($fileout,$queryName,$queryLength,\%sequences,\@alignedNames,@query); return(0,"*** ERROR $sbr : $msg") if (! $Lok ); return(2,"*** WARNING $sbr : no hits found in Blastpgp search "); } return(0,"*** ERROR $sbr: blast file format not recognized") if ($iter == 0); #............................................................ #--------------------------------skips to the last iteration open($fhin,$blastfile) || return(0,"*** ERROR $sbr: failed to open blast file $blastfile\n"); $local_counter=0; while(<$fhin>){ if($_=~/^Searching../){ $local_counter ++; } last if($local_counter == $iter); } #............................................................ undef @alignedNames; undef @alignedids; $Score_count=0; undef %multi_aligned; $global_count=0; undef %rdb_lines; #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ while(1) { # lkajan: processing of a record is done when the beginning of the /following/ record is reached. # lkajan: the last record therefore is processed when we reach the end of the input file - we do not rely on the # lkajan: Number of Hits line any more - this allows truncated blast input (some user in Yanay's lab has such) my $bline = <$fhin>; if( !$bline || $bline=~/^>/o ) { if( $main::par{debug} ){ warn( "reading ".( $bline ? $bline : "undef" )); } if($global_count > 0){ undef %u_endings; undef @blastdat; @blastdat=@{ $rdb_lines{$id}{'1'} }; $bexp=$blastdat[$#blastdat-1]; if($bexp =~ /e/){ @tmp=split(/e/,$bexp); if($tmp[0] eq ''){$tmp[0]=1;} $bexp=$tmp[0] * 10**($tmp[1]); } my $includeFlag='yes'; if ($bexp > $eThresh) { $includeFlag='no'; if( $main::par{debug} ){ warn("exluding $id: $bexp > $eThresh"); } } @seq=@{ $multi_aligned{1} }; if( ($includeFlag eq 'yes') && ($tile ne "0") && ($Score_count > 1) ){ $u_endings{1}[0]=$endings{1}[0]; $u_endings{1}[1]=$endings{1}[1]; $mflag=0;@store_rdb_lines=(); # lkajan: this loop handles the case where multiple HSPs are returned foreach $itnum (2 .. $Score_count){ @temp=@{ $multi_aligned{$itnum} }; undef @blastdat; @blastdat=@ { $rdb_lines{$id}{$itnum} }; $bexp=$blastdat[$#blastdat-1]; if($bexp =~ /e/){ @tmp=split(/e/,$bexp); if($tmp[0] eq ''){$tmp[0]=1;} $bexp=$tmp[0] * 10**($tmp[1]); } if ($bexp > $eThresh) { delete $rdb_lines{$id}{$itnum}; if( $main::par{debug}){ warn("skipping $id:$itnum 'cause $bexp > $eThresh"); } next; } $iffy=1; # lkajan: This extends $u_endings{$it}[0..1] only in case $endings{$itnum}[0..1] entirely covers all $u_endings seen so far foreach $it ( 1 .. ($itnum-1)){ if (defined $u_endings{$it}){ if ($endings{$itnum}[0] >= $u_endings{$it}[0] && $endings{$itnum}[0] <= $u_endings{$it}[1] ){ $iffy=0;last;} if ($endings{$itnum}[1] >= $u_endings{$it}[0] && $endings{$itnum}[1] <= $u_endings{$it}[1] ){ $iffy=0;last;} } } if ($iffy==1){ $u_endings{$itnum}[0]=$endings{$itnum}[0]; $u_endings{$itnum}[1]=$endings{$itnum}[1]; $one=$u_endings{$itnum}[0]; $two=$u_endings{$itnum}[1]; @seq[$one .. $two]=@temp[$one .. $two]; $mflag=1; push @store_rdb_lines, $itnum; } else{delete $rdb_lines{$id}{$itnum}; } } } foreach $elem (@seq){ if(($elem ne ".") && ($elem !~ /[a-z_A-Z]/)){ $elem="."; } } if( $main::par{debug} ){ warn("include $includeFlag id $id seq ".join('', @seq )); } if ($includeFlag eq 'yes') { $sequences{$id}=[ @seq ]; } else { $tmp=pop @alignedids; } } $global_count++; undef @seq; $Score_count=0; undef %multi_aligned; undef %endings; undef %u_endings; #--- getting name of aligned sequence for($it=0;$it<=$queryLength-1;$it++){ $seq[$it]="."; } #initialising array seq if( $bline ) { $bline=~s/^>//o; $id=$bline; $id=~s/^(\S*)\s+(.*)\s*$/$1/o; $protDspt=$2; chomp $protDspt; push @alignedids, $id; } else { last; } } #------------------------------------ if ($bline=~/^ Score/){ $Score_count++; for($it=0;$it<=$queryLength-1;$it++){ $block_seq[$it]="."; } undef @ali_para; } if ( $Score_count > 1 && $tile==0 ){ if( $main::par{debug} ){ warn("skipping $bline 'cause $Score_count > 1 && $tile==0"); } next; } #----------------------------------------------------------------------------------------------------- if ( 1 > 0){ if ( $bline=~ /\s+Length/){ $len2=$bline;$len2=~s/.+=\s*([0-9]+).*$/$1/;$len2=~s/\s//g;} if ( $bline=~ /Score/ ){ $lali=$pid=$sim=$bitScore=$expect=''; $gap=0; $line=$bline; chomp $line; @tmp=split(/\,/,$line); push @ali_para,@tmp; } if ( $bline=~ /Identities/){ $line=$bline; chomp $line; @tmp=split(/\,/,$line); push @ali_para,@tmp; foreach $param (@ali_para){ $param=~s/\s+//g; if ($param=~/Score/){ $bitScore=$param; $bitScore=~s/^.+=(.+)bits.*$/$1/;} elsif ($param=~/Expect/){@temp=split(/=/,$param); $expect=$temp[1];} elsif ($param=~/Identities/){$lali=$param; $lali=~s/.+\/([0-9]+)\(([0-9]+)%\).*$/$1/; $pid=$2;} elsif ($param=~/Positives/){$sim=$param; $sim=~s/^.+\(([0-9]+)%\).*$/$1/;} elsif ($param=~/Gaps/){$gap=$param; $gap=~s/^.+=([0-9]+)\/.*$/$1/;} } $lali=$lali-$gap; $qLength=$queryLength; $rdb_lines{$id}{$Score_count}=[$qLength,$len2,$lali,$pid,$sim,$gap,$bitScore,$expect,$protDspt]; } } #----------------------------------------------------------------------------------------------------- # 0 1 2 3 # Query: 0 --- # Query: 0 # Query: 85 AGAWRLLGVPGAAGPSGSSGSPGAAGASGSAGA 117 # Query: 118 PGAAGASGFPG-----------------------------------RPGAARASGAAGAS 142 # Query: 203 PLLVPEREVEDAARATSTEAFQPVYTREAAYA 234 if($bline=~/^Query:/){ @tmp=split(/\s+/o,$bline); undef @aligned; undef @inserted_query; $beg=$tmp[1]-1; if( $beg == -1 ) { $end = -1; } else { $end=$tmp[3]-1; } if( !defined( $endings{$Score_count}[0] ) || $endings{$Score_count}[0] < 0 ){ $endings{$Score_count}[0]=$beg;} $endings{$Score_count}[1]=$end; if( defined($tmp[2]) ){ @inserted_query=split(//o,$tmp[2]); } } if($bline=~/^Sbjct:/){ # Sbjct: 693 TGA 695 # Sbjct: 189 189 # Sbjct: 696 KGVRGMPGFPGASGEQGLKGFPGDPGREGFPGP 728 # Sbjct: 729 PGFMGPRGSKGTTGLPGPDGPPGPIGLPGPAGPPGDRGIPGEVLGAQPGTRGDAGLPGQP 788 # Sbjct: 848 LGQPGSPGLGGLPGDRGEPGDPGVPGPVGMKG 879 @tmp=split(/\s+/o,$bline); @aligned=split(//o,$tmp[2]); #getting rid of insertions at query sequence cluck( " *** ERROR sbr: blastp_to_saf in lenghts for $id" ) if (@inserted_query != @aligned); $local_counter=0; undef @tmp_seq; for($it=0;$it <= $#inserted_query; $it++){ if ($inserted_query[$it] =~ /[a-z_A-Z]/o){ if(! $fastaFlag){$query[$beg + $local_counter]=$inserted_query[$it];} $tmp_seq[$local_counter]=$aligned[$it]; $local_counter++; } } #@aligned=@tmp_seq; #------------------------------------------- #+++++++++++= if( $main::par{debug} ){ warn("seq after gap removal #$Score_count ".substr( $id, 0, 8 ).": ".join('', @tmp_seq )); } if( $beg >= 0 ) { @block_seq[$beg .. ($beg+$#tmp_seq)]=@tmp_seq; #----alignig part of the subject seguence $multi_aligned{$Score_count}=[ @block_seq ]; } } } close $fhin; if( $main::par{debug} ){ warn("queryName: $queryName"); warn("alignedids: @alignedids"); } #getting rid of repeats in the list undef @namesSort; push @namesSort, $queryName; $Lname=$queryName; $Lname = lc($Lname); if( $main::par{filterOutQueryNameHits} ) { foreach $it (@alignedids){ $rflag=0; @tmp=split(/\|/o,$it); if( $it eq $queryName || lc($it) eq $Lname ){ $rflag=1;} else { foreach $elem (@tmp){ if($elem eq $queryName || lc($elem) eq $Lname ){$rflag=1;} } } if($rflag == 0){push @namesSort, $it;} } } else { push @namesSort, @alignedids } @alignedids=@namesSort[1 .. $#namesSort]; undef @namesSort; { my %namesSort = ( $queryName => 1 ); push @namesSort, $queryName; # lkajan: the purpose of the following seem to be to remove duplicate identifiers from @alignedids. Now what about multiple HSPs for the same one sequence? # lkajan: Why do we want to eliminate those? This does not seem right to me. However the 'logic' below seems to rely on the uniqueness of the members of # lkajan: @alignedids so let's leave this code in place foreach $it (@alignedids){ if( !$namesSort{$it} ){ push @namesSort, $it; } else { if( $main::par{debug} ){ cluck("duplicate identifier in blast output '$it' skipped"); } } $namesSort{$it}++; } } @alignedNames=@namesSort[1 .. $#namesSort]; if( $main::par{debug} ){ warn("namesSort: @namesSort"); warn("alignedNames: @alignedNames"); } #------------------------------------- #--filtering alignment if($filter != 100){ ($Lok,$msg)=&saf_filter(\@alignedNames,\%sequences,\@query,$filter,$maxAli); return(0,"*** ERROR $sbr : $msg") if(! $Lok ); } #----------------------------------- printing out the resulting files if ($rdb ne '0' ){ foreach $id (@alignedNames){ foreach $score (sort keys %{ $rdb_lines{$id} }){ if($score > 1){ foreach $it ( @{ $rdb_lines{$id}{$score} }){$it='!'.$it;} } ($qLength,$len2,$lali,$pid,$sim,$gap,$bitScore,$expect,$protDspt)= @{ $rdb_lines{$id}{$score} }; #write FHRDB; print FHRDB "$id\t$len2\t$pid\t$sim\t$lali\t$gap\t$bitScore\t$expect\t$protDspt\n"; } } } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ short naming format if($short eq "1"){ undef @short_alignedNames; undef %tmp_sequences; foreach $key (@alignedNames){ if($key =~ /trembl/ || $key =~/swiss/ || $key=~/pdb/){ @tmp=split(/\|/,$key); $short=$tmp[2]; } else { $short=$key;} push @short_alignedNames, $short; } @alignedNames=@short_alignedNames; foreach $key (keys %sequences){ if($key =~ /trembl/ || $key =~/swiss/ || $key =~/pdb/){ @tmp=split(/\|/,$key); $temp=$tmp[$#tmp]; $tmp_sequences{$temp}=$sequences{$key}; } else { $tmp_sequences{$key}=$sequences{$key}; } } %sequences=%tmp_sequences; } if( $par{debug} ) { foreach $key (@alignedNames) { warn( "alignedName: $key\n".join('', @{$sequences{$key}} ) ); } } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ($Lok,$msg)=&print_saf_file($fileout,$queryName,$queryLength,\%sequences,\@alignedNames,@query); return (0,"*** ERROR $sbr : $msg") if ( ! $Lok ); return (2,"*** WARNIG $sbr : no hits found after filtering for $queryName") if ( $#alignedNames < 0); if (-e $fileout) { return (1,"ok"); } else { return (0,"*** ERROR $sbr : failed to produce the saf output file"); } } # end of blastp_to_saf #============================================================================== sub saf_filter{ my $sbr='saf_filter'; my ($Lok,$msg); local($array_name,$ali_hash,$query,$red,$bound)=@_; my @ord_ali_list=@$array_name; my %alignment=%$ali_hash; my @queryLoc=@$query; my @new_aligned_names=(); my ($count,$ct,$same); @last= @queryLoc; $len=$#last; $count=0; Floop:for($index=0; $index <= $#ord_ali_list; $index++){ if ( ! defined $alignment{$ord_ali_list[$index]}) { return(0,"*** ERROR $sbr : alignment to be filtered is not defined\n")} @maybe=@{ $alignment{$ord_ali_list[$index]} }; $ct=$same=0; foreach $itres (0..$len) { next if ($maybe[$itres] !~ /[a-z_A-Z]/); next if ( $last[$itres] !~ /[a-z_A-Z]/); ++$same if ($maybe[$itres] eq $last[$itres]); ++ $ct; } if ( ( $ct > 0 && (100*$same/$ct) < $red ) || $ct==0 ){ @last=@maybe; $count++; push @new_aligned_names, $ord_ali_list[$index]; last Floop if ($count >= $bound); } } @$array_name=@new_aligned_names; return(1,"filtering is done"); } #============================================================================================== #============================================================================================== sub printRdbHeader{ my $sbr='printRdbHeader'; my ($Lok,$msg); #a report on blastpgp file $header="# PERL-RDB"."\n"; $header.="# SEQLENGTH\t $queryLength"."\n"; $header.="# ID\t:\tidentifier of the aligned (homologous) protein"."\n"; $header.="# LSEQ2\t:\length of the entire sequence of the aligned protein"."\n"; $header.="# LALI\t:\tlength of the alignment excluding insertions and deletions"."\n"; $header.="# %IDE\t:\tpercent indentity"."\n"; $header.="# %SIM\t:\tpercent similarity"."\n"; $header.="# LGAP\t:\ttotal gap length"."\n"; $header.="# BSCORE\t:\tblast score (bits)"."\n"; $header.="# BEXPECT\t:\tblast expectation value"."\n"; $header.="# PROTEIN\t:\tone-line description of aligned protein"."\n"; $header.="# '!'\t:\tindicates adjacent blast alignment combined with the previous one"."\n"; $header.="# ID\tLSEQ2\t%IDE\t%SIM\tLALI\tLGAP\tBSCORE\tBEXPECT\tPROTEIN\n"; open(FHRDB,">$rdbFile") || return(0, "*** ERROR $sbr : could not open rdbfile=$rdbFile for writing\n"); print FHRDB $header; return( 1,'ok'); } #============================================================================================== #============================================================================================== sub print_saf_file{ my $sbr='print_saf_file'; my ($Lok,$msg); local($fileout,$queryName,$queryLength,$alignment,$aliNames,@query)=@_; my %sequences=%$alignment; my @alignedNames=@$aliNames; my ($fhout,$pages,$nameField); #foreach $key (@alignedNames){ #print $key."\n"; #print @{ $sequences{$key} },"\n"; #} #exit; $fhout="FHOUT"; $pages=int $queryLength/50; if ($queryLength%50 != 0){$pages++;} open($fhout,">$fileout") || return(0,"*** ERROR $sbr: failed to open fileout=$fileout for writing"); print $fhout "# SAF (Simple Alignment Format)\n"; print $fhout "#\n"; $nameField=0; @tmp=split(//,$queryName); if ($#tmp+2>$nameField){$nameField=$#tmp+2;} foreach $key (@alignedNames){ @tmp=split(//,$key); if ($#tmp+2>$nameField){$nameField=$#tmp+2;} } for($it=1;$it<=$pages;$it++){ $beg=($it-1)*50; $end=$it*50-1; printf $fhout "%-${nameField}.${nameField}s", $queryName; for($index=0;$index<50;$index=$index+10){ $first=$beg+$index; $last=$first+9; #print "@query\n",$query[$first]," $query[$last]\n"; if ($last <= $queryLength -1 ){print $fhout @query[$first .. $last]," " ;} else { print $fhout @query[$first .. ($queryLength-1)]; } } print $fhout "\n"; foreach $key (@alignedNames){ printf $fhout "%-${nameField}.${nameField}s", $key; for($index=0;$index<50;$index=$index+10){ $first=$beg+$index; $last=$first+9; if ($last <= $queryLength -1 ){ print $fhout @{ $sequences{$key}}[$first .. $last]," " ; } else { print $fhout @{ $sequences{$key}}[$first .. ($queryLength-1)]," " ; } } print $fhout "\n"; } print $fhout "\n"; } close $fhout; return (1,'ok'); } #====================================================================== sub helpLocal { #------------------------------------------------------------------------------- # helpLocal #------------------------------------------------------------------------------- if ($#ARGV<0 || # help $ARGV[0] =~/^(-h|help|special)/){ print "goal: $scrGoal\n"; print "use: $scrName file_blastpgp fasta=(file_fasta) \n \n"; print " will convert without file_fasta specified \n"; print " but in some cases you may loose part of query \n"; print " submitted to blastpgp \n"; print "opt: \n"; # 'keyword' 'value' 'description' printf "%5s %-15s=%-20s %-s\n","","saf", "x", "name of saf output file; if not specified"; printf "%5s %-15s %-20s %-s\n","","", "", "default 'saf' extension used"; printf "%5s %-15s=%-20s %-s\n","","rdb", "x", "either just 'rdb' -> will write blastRdb file"; printf "%5s %-15s %-20s %-s\n","","", "", "or full name of blastRdb file"; printf "%5s %-15s=%-20s %-s\n","","red", "x", "value for filtering saf file (def=100)"; printf "%5s %-15s=%-20s %-s\n","","maxAli", "x", "maximum number of aligned sequnces"; printf "%5s %-15s %-20s %-s\n","","", "", "after filtering (def: 1500)"; printf "%5s %-15s=%-20s %-s\n","","tile", "x", "either just 'tile' -> will tile blast prediction in saf"; printf "%5s %-15s %-20s %-s\n","","", "", "or 'tile=(0|1)' to enable|disable tiling (def 1)"; printf "%5s %-15s=%-20s %-s\n","","eSaf", "x", "maximum blast expect value to be included in 'saf' file"; printf "%5s %-15s=%-20s %-s\n","","short", "x", "will write short id's in the in the saf output file \n"; printf "%5s %-15s=%-20s %-s\n","","extSaf", "x", "specify an extension for the saf file(useful for list processing"; printf "%5s %-15s=%-20s %-s\n","","extFasta", "x", "specify an extension for the fasta file(useful for list processing"; printf "%5s %-15s=%-20s %-s\n","","extRdb", "x", "specify an extension for the rdb file(useful for list processing"; printf "%5s %-15s=%-20s %-s\n","","debug", "x", "debugging messages [0*|1]"; printf "%5s %-15s=%-20s %-s\n","","filterOutQueryNameHits", "x", "filter out hits with the same name as query [0*|1]"; exit; } } # end of helpLocal #=============================================================================== sub fileListRd { local($fileInLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); #------------------------------------------------------------------------------- # fileListRd reads a list of files # in: file_list= file with filenames # in: $fhErrSbr= file handle to report missing files # (0 to surpress warnings!) # in: $extForChain= 'ext1,ext2' : extensions to check for chains, # i.e. if not existing purge ext_[A-Z0-9] # in: $dirLoc= 'dir1,dir2' : directories to scan for file # out: 1|0,msg # out: $list= 'file1,file2,...' # out: $chain= 'c1,c2,...' : if chains found # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $sbrName="lib-br:"."fileListRd";$fhinLoc="FHIN_fileListRd"; # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); #$fhErrSbr="STDOUT" if (! defined $fhErrSbr); $extForChain=0 if (! defined $extForChain); return(0,"*** $sbrName: miss in file '$fileInLoc'!",0) if (! -e $fileInLoc); @extLoc=split(/,/,$extForChain) if ($extForChain); @dirLoc=split(/,/,$dirLoc) if ($dirLoc); # ------------------------------ # open file open($fhinLoc,$fileInLoc) || return(0,"*** ERROR $sbrName: fileIn=$fileInLoc, not opened\n",0); $tmpChain=$tmpFile=""; # ------------------------------ while (<$fhinLoc>) { # read list $_=~s/\n|\s//g; $file=$_; next if (length($_)==0); if (-e $file) { $tmpFile.="$file,";$tmpChain.="*,";} # file ok else {$Lok=0;$chainTmp="unk"; foreach $ext (@extLoc){ # check chain foreach $dir ("",@dirLoc){ # check dir (first: local!) $fileTmp=$file; $dir.="/" if (length($dir)>0 && $dir !~/\/$/); $fileTmp=~s/^(.*$ext)\_([A-Z0-9])$/$1/; $chainTmp=$2 if (defined $2); $fileTmp=$dir.$fileTmp; $Lok=1 if (-e $fileTmp); last if $Lok;} last if $Lok;} if ($Lok){$tmpFile.="$fileTmp,"; $tmpChain.="*," if (! defined $chainTmp || $chainTmp eq "unk"); $tmpChain.="$chainTmp," if (defined $chainTmp && $chainTmp ne "unk"); } else { print "-*- WARN $sbrName missing file=$_,\n";}} }close($fhinLoc); $tmpFile=~s/^,*|,*$//g;$tmpChain=~s/^,*|,*$//g; return(1,"ok $sbrName",$tmpFile,$tmpChain); } # end of fileListRd #================================================================================== # vim:ai: librg-utils-perl-1.0.43/blastpgp_to_saf.pl0000755015075101507510000004540311652604561015454 00000000000000#!/usr/bin/perl -w use Carp qw| cluck :DEFAULT |; use Data::Dumper qw||; use List::MoreUtils; our $debug; if ($#ARGV < 0) { print "*** ERROR blastpgp_to_saf.pl : no arguments given\n"; print FHERROR "*** ERROR blastpgp_to_saf.pl : no arguments given\n"; die; } foreach $arg (@ARGV){ if ($arg=~/^fileInBlast=(.*)$/) { $fileInBlast = $1;} elsif ($arg=~/^fileInQuery=(.*)$/) { $fileInQuery = $1;} elsif ($arg=~/^fileOutSaf=(.*)$/) { $fileOutSaf = $1;} elsif ($arg=~/^fileOutRdb=(.*)$/) { $fileOutRdb = $1;} elsif ($arg=~/^fileOutErr=(.*)$/) { $fileOutErr = $1;} elsif ($arg=~/^red=(.*)$/) { $filterThre = $1;} elsif ($arg=~/^maxAli=(.*)$/) { $maxAli = $1;} elsif ($arg=~/^tile=(.*)$/) { $alignTiling = $1;} elsif ($arg=~/^debug=(.*)$/) { $debug = $1;} else { print FHERROR "*** wrong command line arg '$arg'\n"; die; } } if ($#ARGV < 0) { print "*** ERROR blastpgp_to_saf.pl : no arguments given\n"; print FHERROR "*** ERROR blastpgp_to_saf.pl : no arguments given\n"; die; } #if (! defined $fileOutErr) { # print "*** ERROR blastpgp_to_saf : fileOutErr output filename is not definded\n"; # die;} if( defined( $fileOutErr ) ) { open(FHERROR,">", $fileOutErr) || die "*** ERROR could not open error log file=$fileOutErr for writing"; } else { open( FHERROR, '>&', \*STDERR ) || die( "$!" ); } $inicheck=0; if (! defined $fileInBlast) { print FHERROR "*** ERROR blastpgp_to_saf : blast input file name is not defined\n"; $inicheck++;} else { if (! -e $fileInBlast){ print FHERROR "*** ERROR blastpgp_to_saf : no input blast file $fileInBlast found\n"; $inicheck++;} } if (! defined $fileInQuery) { print FHERROR "*** ERROR blastpgp_to_saf : query input file name is not defined\n"; $inicheck++;} else{ if(! -e $fileInQuery) { print FHERROR "*** ERROR blastpgp_to_saf : no input query file $fileInQuery found\n"; $inicheck++;} } if (! defined $fileOutSaf) { print FHERROR "*** ERROR blastpgp_to_saf : SAF output filename is not definded\n"; $inicheck++;} if (! defined $fileOutRdb) { print FHERROR "*** ERROR blastpgp_to_saf : blastRdb output filename is not definded\n"; $inicheck++;} if (! defined $filterThre) { print FHERROR "*** ERROR blastpgp_to_saf : filter threshold is not definded\n"; $inicheck++;} if (! defined $maxAli) { print FHERROR "*** ERROR blastpgp_to_saf : maximum number of aligned sequences to be included in saf output file is not definded\n"; $inicheck++;} if (! defined $alignTiling) { print FHERROR "*** ERROR blastpgp_to_saf : tiling method of Blast alignment is not definded\n"; $inicheck++;} die if ($inicheck != 0); ($Lok,$msg)= &blastp_to_saf($fileInBlast,$fileInQuery,$fileOutSaf,$fileOutRdb,$filterThre,$maxAli,$alignTiling); if (! $Lok ) { print FHERROR "*** ERROR blastpgp_to_saf.pl : $msg\n"; die;} if ($Lok == 2 ) { if( $debug ){ print FHERROR "*** WARNING blastpgp_to_saf.pl : $msg\n"; } exit(0); } exit(0); #============================================================================================= sub blastp_to_saf { my ($Lok,$msg); my $sbr="blastp_to_saf"; # local ($blastfile,$queryfile,$fileout,$rdb,$filter,$maxAli,$tile)=@_; # local (@query, %sequences,@alignedids,@namesSort,%rdb_lines); # local (@tmp_seq,@inserted_query,@seq,@alignedNames ); # local ($key,$first,$last,$fhin,$local_counter,$beg,$index,$iter,$Score_count); $fhin= "FHIN"; # #------------------- gets the query sequence and its length undef @query; # open($fhin,$queryfile) || return(0,"*** ERROR sbr: could not open $queryfile - no such file"); $queryName='query'; # while(<$fhin>){ next if( $_=~/^\n/ || $_=~/\// || $_=~/>/ || $_=~/#/ ); $_=~s/\s+//g; @tmp=split(//,$_); push @query, @tmp; } close $fhin; $queryLength=$#query+1; #.......................................................... if ( $rdb ne '0' && $rdb ne '' ){ $rdbFile=$rdb; ($Lok,$msg)= &printRdbHeader(); if (! $Lok){ return(0,"*** ERROR $sbr : $msg"); } } #------------------- finds number of iterations in blast file my $blastplus_flag = 0; open($fhin,$blastfile) || return(0,"*** ERROR $sbr: failed to open blast file $blastfile\n"); $iter=0; $nohits=0; while(<$fhin>){ # BLASTP 2.2.18 [Mar-02-2008] # PSIBLAST 2.2.25+ if($_=~/^\w+\s+\d+\.\d+\.\d+\+/o){ $blastplus_flag = 1; } if($_=~/No hits found/){$nohits=1; last;} if( !$blastplus_flag && $_=~/^Searching../o ){ $iter++; } if( $blastplus_flag && $_=~/Results from round/o ){ $iter++; } } close $fhin; if ($nohits eq '1'){ $sequences{''}=''; $alignedNames=''; ($Lok,$msg)=&print_saf_file($queryName,$queryLength,\%sequences,\@alignedNames,@query); return(0,"*** ERROR $sbr : $msg") if (! $Lok ); return(2,"*** WARNING $sbr : no hits found in Blastpgp search "); } return(0,"*** ERROR $sbr: blast file format not recognized") if ($iter == 0); #............................................................ #--------------------------------skips to the last iteration open($fhin,$blastfile) || return(0,"*** ERROR $sbr: failed to open blast file $blastfile\n"); $local_counter=0; while(<$fhin>){ if( !$blastplus_flag && $_=~/^Searching../o ){ $local_counter++; } if( $blastplus_flag && $_=~/Results from round/o ){ $local_counter++; } last if($local_counter == $iter); } #............................................................ my $bug_query = 0; undef @alignedNames; undef @alignedids; $Score_count=0; undef %multi_aligned; $global_count=0; undef %rdb_lines; #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ # lkajan: processing of a record is done when the beginning of the /following/ record is reached. # lkajan: the last record therefore is processed when we reach the end of the input file - we do not rely on the # lkajan: Number of Hits line any more - this allows truncated blast input (some user in Yanay's lab has such) while(1) { my $bline = <$fhin>; if( !$bline || $bline=~/^>/o ) { if($global_count > 0){ undef %u_endings; @seq=@{ $multi_aligned{'1'} }; if($tile ne "0" && $Score_count > 1){ $u_endings{'1'}[0]=$endings{'1'}[0]; $u_endings{'1'}[1]=$endings{'1'}[1]; foreach $itnum (2 .. $Score_count){ @temp=@{ $multi_aligned{$itnum} }; $iffy=1; foreach $it ( 1 .. ($itnum-1)){ if (defined $u_endings{$it}){ if ($endings{$itnum}[0] >= $u_endings{$it}[0] && $endings{$itnum}[0] <= $u_endings{$it}[1] ){ $iffy=0;last;} if ($endings{$itnum}[1] >= $u_endings{$it}[0] && $endings{$itnum}[1] <= $u_endings{$it}[1] ){ $iffy=0;last;} } } if ($iffy==1){ $u_endings{$itnum}[0]=$endings{$itnum}[0]; $u_endings{$itnum}[1]=$endings{$itnum}[1]; $one=$u_endings{$itnum}[0]; $two=$u_endings{$itnum}[1]; @seq[$one .. $two]=@temp[$one .. $two]; } else{delete $rdb_lines{$id}{$itnum}; } } } foreach $elem (@seq){ if(($elem ne ".") && ($elem !~ /[a-z_A-Z]/)){ $elem="."; } } $sequences{$id}=[ @seq ]; } $global_count++; undef @seq; $Score_count=0; undef %multi_aligned; undef %endings; undef %u_endings; #--- getting name of aligned sequence for($it=0;$it<=$queryLength-1;$it++){ $seq[$it]="."; } #initialising array seq if( $bline ) { # lkajan: PE, SV may be on the > line when it is shorter # blast: #>sp|Q9TUI5|MT4_CANFA Metallothionein-4 OS=Canis familiaris GN=MT4 # PE=3 SV=1 # Length = 62 # blast+: #> sp|Q9TUI5|MT4_CANFA Metallothionein-4 OS=Canis familiaris GN=MT4 #PE=3 SV=1 #Length=62 if( not $bline=~s/^> *//o ){ confess("unrecognized line '$bline'"); } $id=$bline; if( not $id=~s/^(\S*)\s+(.*)\s*$/$1/o ){ confess("failed to extract id from '$id'"); } $protDspt=$2; chomp $protDspt; push @alignedids, $id; } else { last; } } #------------------------------------ if ($bline=~/^ Score/o){ $Score_count++; for($it=0;$it<=$queryLength-1;$it++){ $block_seq[$it]="."; } undef @ali_para; } next if ( $Score_count > 1 && $tile==0 ); #----------------------------------------------------------------------------------------------------- if ( $rdb ne '0' && $rdb ne ''){ # if ( $bline=~ /\s*Length/){ $len2=$bline;if( $len2 !~ /Length\s*=\s*([0-9]+)/o ){ confess( "unrecognized length '$len2'"); } $len2 = $1; } # lkajan: whitespaces vary between blast and blast+ # Score = 84.3 bits (207), Expect = 2e-15, Method: Compositional matrix adjust. if ( $bline=~ /Score/ ){ $lali=$pid=$sim=$bitScore=$expect=''; $gap=0; $line=$bline; chomp $line; @tmp=split(/,/o,$line); push @ali_para,@tmp; } # 2nd: blast+ # Identities = 57/62 (91%), Positives = 59/62 (95%) # Identities = 57/62 (91%), Positives = 59/62 (95%), Gaps = 0/62 (0%) if ( $bline=~ /Identities/){ $line=$bline; chomp $line; @tmp=split(/,/o,$line); push @ali_para,@tmp; foreach $param (@ali_para){ $param=~s/\s+//g; if ($param=~/Score/){ $bitScore=$param; if( not $bitScore=~s/^.+=(.+)bits.*$/$1/o ){ confess($bitScore); } } elsif ($param=~/Expect/){@temp=split(/=/,$param); $expect=$temp[1];} elsif ($param=~/Identities/){$lali=$param; if( not $lali=~s/.+\/([0-9]+)\(([0-9]+)%\).*$/$1/o ){ confess( $lali ); } $pid=$2;} elsif ($param=~/Positives/){$sim=$param; if( not $sim=~s/^.+\(([0-9]+)%\).*$/$1/o ){ confess( $sim ); }} elsif ($param=~/Gaps/){$gap=$param; if( not $gap=~s/^.+=([0-9]+)\/.*$/$1/o ){ confess($gap); }} } $lali=$lali-$gap; $qLength=$queryLength; $rdb_lines{$id}{$Score_count}=[$qLength,$len2,$lali,$pid,$sim,$gap,$bitScore,$expect,$protDspt]; } } #----------------------------------------------------------------------------------------------------- # lkajan: below is probably a blast bug, with the Query: 0 line... # 0 1 2 # Query: 0 ---- # # Sbjct: 64 PAQG 67 # Query: 0 # # Sbjct: 67 67 # Query: 1713 HVETRWHCTVCEDYDLCINCYNTKSHAHKMVKWGLGLDDEGSSQGEPQSKSPQESRRVSI 1772 # Query: 1890 PGTPTQQPSTPQT 1902 # blast #Query: 1 MDPRECVCMSGGICMCGDNCKCTTCNCKTCRKSCCPCCPPGCAKCARGCICKGGSDKCSC 60 # MDP EC CMSGGIC+CGDNCKCTTCNCKTCRKSCCPCCPPGCAKCA+GCICKGGSDKCSC #Sbjct: 1 MDPGECTCMSGGICICGDNCKCTTCNCKTCRKSCCPCCPPGCAKCAQGCICKGGSDKCSC 60 # blast+ #Query 1 MDPRECVCMSGGICMCGDNCKCTTCNCKTCRKSCCPCCPPGCAKCARGCICKGGSDKCSC 60 # MDP EC CMSGGIC+CGDNCKCTTCNCKTCRKSCCPCCPPGCAKCA+GCICKGGSDKCSC #Sbjct 1 MDPGECTCMSGGICICGDNCKCTTCNCKTCRKSCCPCCPPGCAKCAQGCICKGGSDKCSC 60 # lkajan: do not confuse with 'Query= MT4_HUMAN' - this may appear in blast+ after each round header if($bline=~/^Query:?\s+\d+/o) { @tmp=split(/\s+/o,$bline); if( $tmp[1] != 0 ) { $bug_query = 0; undef @aligned; undef @inserted_query; $beg=$tmp[1]-1; $end=$tmp[3]-1; if (! defined $endings{$Score_count}[0] || $endings{$Score_count}[0] < 0 ){ $endings{$Score_count}[0]=$beg;} $endings{$Score_count}[1]=$end; @inserted_query=split(//o,$tmp[2]); } else { $bug_query = 1; } } if( !$bug_query && $bline =~ /^Sbjct/o ){ @tmp=split(/\s+/o,$bline); @aligned=split(//o,$tmp[2]); #getting rid of insertions at query sequence cluck( " *** ERROR sbr: blastp_to_saf in lenghts for $id" ) if ($#inserted_query != $#aligned); $local_counter=0; undef @tmp_seq; for($it=0;$it <= $#inserted_query; $it++){ if ($inserted_query[$it] =~ /[a-z_A-Z]/){ $tmp_seq[$local_counter]=$aligned[$it]; $local_counter++; } } #@aligned=@tmp_seq; #------------------------------------------- #+++++++++++= @block_seq[$beg .. ($beg+$#tmp_seq)]=@tmp_seq; #----alignig part of the subject seguence $multi_aligned{$Score_count}=[ @block_seq ]; } } close $fhin; @alignedids = sort{ $a cmp $b }@alignedids; #getting rid of repeats in the list undef @namesSort; push @namesSort, $queryName; # $Lname=$queryName; $Lname=~tr/A-Z/a-z/; # $Cname=$Lname; $Cname=~tr/a-z/A-Z/; # foreach $it (@alignedids){ # $rflag=0; @tmp=split(/\|/,$it); # if( $it eq $queryName || $it eq $Lname || $it eq $Cname){ $rflag=1;} # else { # foreach $elem (@tmp){ # if($elem eq $queryName || $elem eq $Lname || $elem eq $Cname){$rflag=1;} # } # } # if($rflag == 0){push @namesSort, $it;} # } push @namesSort, @alignedids; @namesSort = List::MoreUtils::uniq( @namesSort ); @alignedNames = splice( @namesSort, 1 ); if( $debug ){ warn( Data::Dumper::Dumper( \@alignedNames ) ); } #------------------------------------- #--filtering alignment if($filter != 100){ ($Lok,$msg)=&saf_filter(\@alignedNames,\%sequences,$filter,$maxAli); return(0,"*** ERROR $sbr : $msg") if(! $Lok ); } #----------------------------------- printing out the resulting files if ($rdb ne '0' ){ foreach $id (@alignedNames){ $identifier=$id; foreach $score (sort keys %{ $rdb_lines{$id} }){ #if($score > 1){ foreach $it ( @{ $rdb_lines{$id}{$score} }){$it='!'.$it;} }; ($qLength,$len2,$lali,$pid,$sim,$gap,$bitScore,$expect,$protDspt)= @{ $rdb_lines{$id}{$score} }; if($score > 1){ $expect='!'.$expect; $protDspt='!'.$protDspt; $identifier='!'.$identifier; } print FHRDB "$identifier\t$len2\t$pid\t$sim\t$lali\t$gap\t$bitScore\t$expect\t$protDspt\n"; } } } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ short naming format # undef %short_alignedNames; # foreach $key (@alignedNames){ # if($key =~ /trembl/ || $key =~/swiss/){ # @tmp=split(/\|/,$key); $short=$tmp[2]; # } # else { $short=$key;} # $short_alignedNames{$key}=$short; # } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ($Lok,$msg)=&print_saf_file($queryName,$queryLength,\%sequences,\@alignedNames,@query); return (0,"*** ERROR $sbr : $msg") if ( ! $Lok ); return (2,"*** WARNIG $sbr : no hits found after filtering") if ( $#alignedNames < 0); if (-e $fileout) { return (1,"ok"); } else { return (0,"*** ERROR $sbr : failed to produce the saf output file"); } } # end of blastp_to_saf #============================================================================== sub saf_filter{ my $sbr='saf_filter'; my ($Lok,$msg); local($array_name,$ali_hash,$red,$bound)=@_; my @ord_ali_list=@$array_name; my %alignment=%$ali_hash; my @new_aligned_names=(); my ($count,$ct,$same); @last= @query; $len=$#last; $count=0; Floop:for($index=0; $index <= $#ord_ali_list; $index++){ if ( ! defined $alignment{$ord_ali_list[$index]}) { return(0,"*** ERROR $sbr : alignment to be filtered is not defined\n")} @maybe=@{ $alignment{$ord_ali_list[$index]} }; $ct=$same=0; foreach $itres (0..$len){ next if ($maybe[$itres] !~ /[a-zA-Z]/); next if ( $last[$itres] !~ /[a-zA-Z]/); ++$same if ($maybe[$itres] eq $last[$itres]); ++ $ct; } if ( ( $ct > 0 && (100*$same/$ct)<$red ) || $ct==0 ){ @last=@maybe; $count++; push @new_aligned_names, $ord_ali_list[$index]; last Floop if ($count >= $bound); } } @$array_name=@new_aligned_names; return(1,"filtering is done"); } #============================================================================================== #============================================================================================== sub printRdbHeader{ my $sbr='printRdbHeader'; my ($Lok,$msg); $header=" #PERL-RDB #SEQLENGTH\t $queryLength #ID\t:\tidentifier of the aligned (homologous) protein #LSEQ2\t:\tlength of the entire sequence of the aligned protein #LALI\t:\tlength of the alignment excluding insertions and deletions #%IDE\t:\tpercent indentity #%SIM\t:\tpercent similarity #LGAP\t:\ttotal gap length #BSCORE\t:\tblast score (bits) #BEXPECT\t:\tblast expectation value #PROTEIN\t:\tone-line description of aligned protein #'!'\t:\tindicates lower scoring alignment that is combined with #the higher scoring adjacent one ##ID\tLSEQ2\t%IDE\t%SIM\tLALI\tLGAP\tBSCORE\tBEXPECT\tPROTEIN\n"; open(FHRDB,">$rdbFile") || return(0, "*** ERROR $sbr : could not open rdbfile=$rdbFile for writing\n"); print FHRDB $header; return( 1,'ok'); } #============================================================================================== #============================================================================================== sub print_saf_file{ my $sbr='print_saf_file'; my ($Lok,$msg); local($queryName,$queryLength,$alignment,$aliNames,@query)=@_; my %sequences=%$alignment; my @alignedNames=@$aliNames; my ($fhout,$pages,$nameField); $fhout="FHOUT"; $pages=int $queryLength/50; if ($queryLength%50 != 0){$pages++;} open($fhout,">", $fileout ) || return(0,"*** ERROR $sbr: failed to open fileout=$fileout for writing"); print $fhout "# SAF (Simple Alignment Format)\n"; print $fhout "#\n"; $nameField=0; @tmp=split(//,$queryName); if ($#tmp+2>$nameField){$nameField=$#tmp+2;} foreach $key (@alignedNames){ @tmp=split(//,$key); if ($#tmp+2>$nameField){$nameField=$#tmp+2;} } for($it=1;$it<=$pages;$it++){ $beg=($it-1)*50; $end=$it*50-1; printf $fhout "%-${nameField}.${nameField}s", $queryName; for($index=0;$index<50;$index=$index+10){ $first=$beg+$index; $last=$first+9; if ($last <= $queryLength -1 ){print $fhout @query[$first .. $last]," " ;} else { print $fhout @query[$first .. ($queryLength-1)]; } } print $fhout "\n"; foreach $key (@alignedNames){ printf $fhout "%-${nameField}.${nameField}s", $key; for($index=0;$index<50;$index=$index+10){ $first=$beg+$index; $last=$first+9; if ($last <= $queryLength -1 ){ print $fhout @{ $sequences{$key}}[$first .. $last]," " ; } else { print $fhout @{ $sequences{$key}}[$first .. ($queryLength-1)]," " ; } } print $fhout "\n"; } print $fhout "\n"; } close $fhout; return (1,'ok'); } #====================================================================== # vim:ai:ts=4: librg-utils-perl-1.0.43/conv_hssp2saf.pl0000755015075101507510000000125711640614621015055 00000000000000#!/usr/bin/perl no warnings 'deprecated'; #------------------------------------------------------------------------------# # Copyright 1998 # # Burkhard Rost rost@EMBL-Heidelberg.DE # # Wilckensstr. 15 http://www.embl-heidelberg.de/~rost/ # # D-69120 Heidelberg # # version 0.1 May, 1998 # #------------------------------------------------------------------------------# $[ =1 ; # sets array count to start at 1, not at 0 use RG::Utils::Conv_hssp2saf; ($Lok,$msg)= &RG::Utils::Conv_hssp2saf::conv_hssp2saf(@ARGV); die( "*** package RG::Utils::Conv_hssp2saf returned ERROR:\n".$msg." " ) if (! $Lok); exit(0); librg-utils-perl-1.0.43/copf.pl0000755015075101507510000000143011640614522013217 00000000000000#!/usr/bin/perl -w no warnings 'deprecated'; #------------------------------------------------------------------------------# # Copyright 1998 # # Burkhard Rost rost@EMBL-Heidelberg.DE # # Wilckensstr. 15 http://www.embl-heidelberg.de/~rost/ # # D-69120 Heidelberg # # version 0.1 May, 1998 # #------------------------------------------------------------------------------# $[ =1 ; # sets array count to start at 1, not at 0 use RG::Utils::Copf; #$pack= "pack/copf.pm"; # lkajan: packName does not seem to be used in copf.pm ($Lok,$msg)= &RG::Utils::Copf::copf( 'dirBin=/usr/bin', 'dirHome=/usr/share/librg-utils-perl', @ARGV); die( "*** RG::Utils::Copf::copf returned ERROR:\n".$msg." " ) if (! $Lok); exit(0); librg-utils-perl-1.0.43/dbSwiss0000775015075101507510000001110111602127352013270 00000000000000#!/usr/bin/perl -w use strict; use warnings; use Carp qw| cluck :DEFAULT |; use Getopt::Long qw(:config gnu_getopt auto_version auto_help); use Pod::Usage; use DBI; #use File::Temp qw||; use File::Path qw||; use IO::File; BEGIN { our $VERSION = "1.0"; } $ENV{'PATH'} = '/usr/bin:/bin'; delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; our $opt; my $Lok = GetOptions( $opt = { datadir => '/mnt/project/rost_db/data/swissprot', 'table' => 'dbswiss', infile => '/mnt/project/rost_db/data/swissprot/uniprot_sprot.dat' }, 'debug!', 'datadir|d=s', 'first20!', 'infile|i=s', 'man!', 'quiet!', 'readback!', 'table=s', 'workdir|w=s' ); if( !$Lok ){ die("Invalid arguments, please check man page.\n"); } our $dbg = $opt->{debug}; our $quiet = $opt->{quiet}; if( $opt->{man} ){ pod2usage(-verbose => 2); } if( $opt->{table} =~ /[^a-z0-9_]/io ){ confess("invalid table name '$opt->{table}'"); } # lkajan: the below would be nice but perhaps because of the ACLs I get "Error in tempdir() using /mnt/project/rost_db/src/XXXXXXXXXX: Parent directory (/mnt/project/rost_db/src) is not writable" when it is in fact writable #my $workdir = $opt->{workdir} || File::Temp::tempdir( DIR => $opt->{datadir}, CLEANUP => !$dbg ); my $CLEANUP = 0; my $workdir = $opt->{workdir}; if( !$workdir ){ $CLEANUP = !$dbg; $workdir = `mktemp -d '$opt->{datadir}/XXXXXXXXXX'`; chomp( $workdir ); } END { if( $CLEANUP ){ File::Path::rmtree( $workdir ); } } #my $dbh = DBI->connect('DBI:DBM(RaiseError=1):type=GDBM_File;ext=;') || confess( $DBI::errstr ); my $dbh = DBI->connect('DBI:DBM(RaiseError=1):type=DB_File;ext=;') || confess( $DBI::errstr ); $dbh->{f_dir} = $workdir; if( $dbg ){ warn( "workdir = $workdir" ); } my $infh = IO::File->new( $opt->{infile}, 'r' ) || confess( "failed to open '$opt->{infile}': $!" ); $dbh->do( "drop table if exists $opt->{table}"); $dbh->do( "create table $opt->{table} ( id text, bytepos int )" ); # the value is the byte position where the record begins in the flat file my $count = 0; my $bytetop = 0; my $t0 = time(); { local $/ = "//\n"; while( my $rec = <$infh> ) { #ID 002R_IIV3 Reviewed; 458 AA. #ID C108B_XENLA Reviewed; 183 AA. if( $rec !~ /^ID\s+(\w+)/o ){ confess("unrecognized record $count '$rec'"); } my $id = lc($1); $dbh->do("insert into $opt->{table} values ( ?, ? )", undef, $id, $bytetop ); if( $opt->{readback} ) { my $rec = $dbh->selectrow_arrayref("select * from $opt->{table} where id = ?", undef, $id ); print STDERR ">>>$rec->[0] : $rec->[1]<<<\n"; } # ++$count; $bytetop = tell( $infh ); if( $t0 != time() ){ $t0 = time(); _printcount( $count ); } if( $opt->{first20} && $count > 20 ){ last; } } _printcount( $count ); if( !$main::quiet ){ print STDERR "\n"; } } $dbh->disconnect(); # we are done, move the db files to their final destination my @resfiles = glob( "$workdir/*" ); system( 'mv', "-t", "$opt->{datadir}", @resfiles ) && confess("failed to mv @resfiles to $opt->{datadir}"); exit(0); sub _printcount { my( $__count ) = @_; if( !$main::quiet ){ print STDERR `tput hpa 0`, `tput el`, $count; } } =pod =head1 NAME dbSwiss - create DBM version of Swiss-Prot data =head1 SYNOPSIS __pkgdatadir__/dbSwiss [OPTIONS] __pkgdatadir__/dbSwiss --datadir /data/swissprot --infile /data/swissprot/uniprot_sprot.dat __pkgdatadir__/dbSwiss [--help] [--man] =head1 DESCRIPTION dbSwiss creates DBM version of Swiss-Prot data. This procedure is to replace splitSwiss.pl. splitSwiss.pl saves Swiss-Prot records in separate files resulting in over 13 million relatively tiny files that take very long to create and rsync. dbSwiss instead saves each record into a DBM database that is optimized for fast retrieval. =head1 OPTIONS =over =item -d, --datadir=I directory of database files, default: '/mnt/project/rost_db/data/swissprot' =item --debug =item --nodebug =item --first20 =item --nofirst20 process only first 20 records, for debugging =item --help =item -i, --infile=I Swiss-Prot data flatfile, default: '/mnt/project/rost_db/data/swissprot/uniprot_sprot.dat'. =item --man =item --quiet =item --noquiet do not print progress status =item --readback =item --noreadback read records back after storing and print them =item --table name of database table and consequently the base name of database files, default: 'dbswiss' =item --version =item -w, --workdir=I Optional working directory. Automatically created and removed if not defined. =back =head1 AUTHOR Laszlo Kajan =cut # vim:et:ts=2:ai: librg-utils-perl-1.0.43/hssp_filter.pl0000755015075101507510000000143711606435562014630 00000000000000#!/usr/bin/perl -w #------------------------------------------------------------------------------# # Copyright 1998 # # Burkhard Rost rost@EMBL-Heidelberg.DE # # Wilckensstr. 15 http://www.embl-heidelberg.de/~rost/ # # D-69120 Heidelberg # # version 0.1 May, 1998 # #------------------------------------------------------------------------------# # sets array count to start at 1, not at 0 use RG::Utils::Hssp_filter; # lkajan: trying to move away from $pack #$pack="hssp_filterPack"; ($Lok,$msg)= &RG::Utils::Hssp_filter::hssp_filterSbr( 'dirBin=/usr/bin', 'dirHome=/usr/share/librg-utils-perl', @ARGV); die( "*** RG::Utils::Hssp_filter::hssp_filterSbr returned ERROR:\n".$msg." " ) if (! $Lok); exit(0); __END__ librg-utils-perl-1.0.43/safFilterRed.pl0000755015075101507510000004730511640614572014662 00000000000000#!/usr/bin/perl use Carp qw| cluck :DEFAULT |; no warnings 'deprecated'; $scrName=$0;$scrName=~s/^.*\/|\.pl//g; $scrGoal="filters redudancy in SAF files\n". " \t \n". " \t "; # # #------------------------------------------------------------------------------# # Copyright 2000 # # Burkhard Rost rost@columbia.edu # # CUBIC (Columbia Univ) http://www.columbia.edu/~rost/ # # Dept Biochemistry & Molecular Biophysics # # 630 West, 168 Street # # New York, NY 10032 http://www.columbia.edu/~rost/ # # version 0.1 Feb, 2000 # #------------------------------------------------------------------------------# # $[ =1 ; # count from one # ------------------------------ # defaults %par=( 'extSaf', ".saf", 'extFil', ".safFil", 'numresPerLine', 80, # '', "", # ); @kwd=sort (keys %par); $Ldebug=0; $Lverb= 0; # ------------------------------ if ($#ARGV<2){ # help print "goal: $scrGoal\n"; print "use: '$scrName *saf (or list) redundancy (as percentag seq identity)'\n"; print "opt: \n"; # 'keyword' 'value' 'description' printf "%5s %-15s=%-20s %-s\n","","fileOut", "x", "name of output file"; printf "%5s %-15s=%-20s %-s\n","","dirOut", "x", "directory of output files"; # printf "%5s %-15s=%-20s %-s\n","","", "x", ""; # printf "%5s %-15s %-20s %-s\n","","", "no value",""; printf "%5s %-15s %-20s %-s\n","","dbg", "no value", "debug mode"; printf "%5s %-15s %-20s %-s\n","","silent|-s","no value","no screen output"; printf "%5s %-15s %-20s %-s\n","","verb|-s", "no value","verbose"; # printf "%5s %-15s %-20s %-s\n","","noScreen", "no value",""; # printf "%5s %-15s=%-20s %-s\n","","", "x", ""; # printf "%5s %-15s %-20s %-s\n","","", "no value",""; if (%par && $#kwd > 0){ $tmp= sprintf("%5s %-15s %-20s %-s\n","","-" x 15 ,"-" x 20,"-" x 30); $tmp.=sprintf("%5s %-15s %-20s %-s\n","","other:","default settings: "," "); $tmp2=""; foreach $kwd (@kwd){ next if (! defined $par{$kwd} || length($par{$kwd})<1 ); if ($par{$kwd}=~/^\d+$/){ $tmp2.=sprintf("%5s %-15s= %10d %9s %-s\n","",$kwd,$par{$kwd}," ","(def)");} elsif ($par{$kwd}=~/^[0-9\.]+$/){ $tmp2.=sprintf("%5s %-15s= %10.3f %9s %-s\n","",$kwd,$par{$kwd}," ","(def)");} else { $tmp2.=sprintf("%5s %-15s= %-20s %-s\n","",$kwd,$par{$kwd},"(def)");} } print $tmp, $tmp2 if (length($tmp2)>1); } exit;} # initialise variables #$fhin="FHIN";$fhout="FHOUT"; $LisList=0; $#fileIn=0; # ------------------------------ # read command line $dirOut=""; undef $red; foreach $arg (@ARGV){ # next if ($arg eq $ARGV[1]); if ($arg=~/^fileOut=(.*)$/) { $fileOut= $1;} elsif ($arg=~/^dirOut=(.*)$/) { $dirOut= $1; $dirOut.= "/" if ($dirOut !~/\/$/);} elsif ($arg=~/^de?bu?g$/) { $Ldebug= 1; $Lverb= 1;} elsif ($arg=~/^verb(ose)?$|^\-v$/) { $Lverb= 1;} elsif ($arg=~/^silent$|^\-s$/) { $Lverb= 0;} elsif ($arg=~/^(is)?list$/i) { $LisList= 1;} # elsif ($arg=~/^=(.*)$/){ $=$1;} elsif (-e $arg) { push(@fileIn,$arg); $LisList= 1 if ($arg=~/\.list/);} elsif ($arg=~/^red=(.*)$/ || $arg=~/^(\d+)$/ ) { $red= $1;} else { $Lok=0; if (%par && $#kwd>0) { foreach $kwd (@kwd){ if ($arg =~ /^$kwd=(.+)$/){$Lok=1;$par{$kwd}=$1; last;}}} if (! $Lok){ die("*** wrong command line arg '$arg'");}}} $fileIn=$fileIn[1]; die ("missing input redundancy (second arg or red=[0-100])\n") if (! defined $red); die ("missing input $fileIn\n") if (! -e $fileIn); if (! defined $fileOut){ $fileOut=0; } # ------------------------------ # directories: add '/' foreach $kwd (keys %par) { next if ($kwd !~/^dir/); next if (length($par{$kwd})==0 || $par{$kwd} eq "unk" ); $par{$kwd}.="/" if ($par{$kwd} !~ /\/$/);} # ------------------------------ # (0) digest file (list?) # ------------------------------ $#fileTmp=0; foreach $fileIn (@fileIn){ if ( ($#fileIn==1 && $LisList) || $fileIn =~/\.list/) { ($Lok,$msg,$file,$tmp)= &fileListRd($fileIn);if (! $Lok){ die("*** ERROR $scrName: input list\n".$msg); } @tmpf=split(/,/,$file); push(@fileTmp,@tmpf); next;} push(@fileTmp,$fileIn); } @fileIn= @fileTmp; $#fileTmp=0; # slim-is-in # ------------------------------ # (1) read file(s) # ------------------------------ $ctfile= 0; $nfileIn= $#fileIn; $fileTmp="TMP_safFilterRed".$$.".tmp"; foreach $fileIn (@fileIn){ ++$ctfile; if (! -e $fileIn){ warn( "-*- WARN $scrName: no fileIn=$fileIn" ); next;} # print "--- $scrName: working on '$fileIn'\n"; if( $Lverb ){ printf "--- $scrName: working on %-25s %4d (%4.1f perc of job)\n", $fileIn,$ctfile,(100*$ctfile/$nfileIn); } # ------------------------------ # read SAF file # x # ------------------------------ ($Lok,$msg)= &safRd($fileIn); %saf=%tmp; undef %tmp; if (! $Lok){ warn( "*** ERROR $scrName: after $fileIn\n".$msg); next; } # return(&errSbrMsg("after call xyz",$msg)) if (! $Lok); # ------------------------------ # write temporary $#excl=0; $id=$fileIn;$id=~s/^.*\///g; $id=~s/\.saf.*$//g; foreach $itali (1..($saf{"NROWS"}-1)){ next if (defined $excl[$itali]); @tmp1=split(//,$saf{"seq",$itali}); $len=$#tmp1; # get all similar to that one foreach $itali2 ($itali+1 .. $saf{"NROWS"}){ @tmp2=split(//,$saf{"seq",$itali2}); $len=$#tmp2 if ($#tmp2 < $len); $ct=$same=0; foreach $itres (1..$len){ last if ($itres > $#tmp1 || $itres > $#tmp2); next if (! defined $tmp1[$itres]); next if (! defined $tmp2[$itres]); ++$same if ($tmp1[$itres] eq $tmp2[$itres]); ++$ct; } # exclude it if ($ct > 0 && (100*$same/$ct)>$red){ $excl[$itali2]=1; print "--- $id to exclude (from $itali): ",$itali2," red=$red, ide=", (100*$same/$ct),", (ct=$ct, same=$same)\n" if ($Ldebug);} else { print "--- $id take: ",$itali2," red=$red, ide=", (100*$same/$ct),", (ct=$ct, same=$same)\n" if ($Ldebug); last; } } } # end of loop over all alis # ------------------------------ # write new if (! defined $fileOut || ! $fileOut || $ctfile > 1 ){ $fileOut=$fileIn; $fileOut=~s/^.*\///g; $fileOut=$dirOut.$fileOut; $fileOut=~s/$par{"extSaf"}/$par{"extFil"}/; } if ($#excl){ $excl="";$ctexcl=0;$cttake=0; undef %tmp; foreach $itali (1..$saf{"NROWS"}){ if (defined $excl[$itali]){ ++$ctexcl; next;} ++$cttake; $tmp{"id",$cttake}= $saf{"id",$itali}; $tmp{"seq",$cttake}=$saf{"seq",$itali}; } $tmp{"HEADER"}="# origin=$fileIn, redundancy reduced by ".$red." % (".$saf{"NROWS"}."->$cttake)\n"; $tmp{"NROWS"}=$cttake; undef %saf; # ------------------------------ # write SAF # in GLOBAL %tmp # ------------------------------ ($Lok,$msg)= &safWrt($fileOut); if (! $Lok){ warn("*** ERROR $scrName: after safWrt($fileOut)\n".$msg); next; } # return(&errSbrMsg("after call xyz",$msg)) if (! $Lok); undef %tmp; print "--- filtered ($red: $ctexcl->$cttake) $fileOut\n" if ($Lverb); } else { print "--- simply copy $fileIn $fileOut\n" if ($Lverb); system("\\cp $fileIn $fileOut"); } } exit; #=============================================================================== sub errSbr {local($txtInLoc,$sbrNameLocy) = @_ ; #------------------------------------------------------------------------------- # errSbr simply writes '*** ERROR $sbrName: $txtInLoc' #------------------------------------------------------------------------------- $sbrNameLocy=$sbrName if (! defined $sbrNameLocy); $txtInLoc.="\n"; $txtInLoc=~s/\n\n+/\n/g; return(0,"*** ERROR $sbrNameLocy: $txtInLoc"); } # end of errSbr #=============================================================================== sub errSbrMsg {local($txtInLoc,$msgInLoc,$sbrNameLocy) = @_ ; #------------------------------------------------------------------------------- # errSbrMsg simply writes '*** ERROR $sbrName: $txtInLoc\n'.$msg #------------------------------------------------------------------------------- $sbrNameLocy=$sbrName if (! defined $sbrNameLocy); $txtInLoc.="\n"; $txtInLoc=~s/\n\n+/\n/g; $msgInLoc.="\n"; $msgInLoc=~s/\n\n+/\n/g; return(0,"*** ERROR $sbrNameLocy: $txtInLoc".$msgInLoc); } # end of errSbrMsg #=============================================================================== sub errScrMsg {local($txtInLoc,$msgInLoc,$scrNameLocy) = @_ ; #------------------------------------------------------------------------------- # errScrMsg writes message and EXIT!! #------------------------------------------------------------------------------- $scrNameLocy=$scrName if (! defined $scrNameLocy); $txtInLoc.="\n"; $txtInLoc=~s/\n\n+/\n/g; if (defined $msgInLoc) { $msgInLoc.="\n"; $msgInLoc=~s/\n\n+/\n/g;} else { $msgInLoc="";} confess( "*** ERROR $scrNameLocy: $txtInLoc".$msgInLoc ); } # end of errScrMsg #=============================================================================== sub fileListRd { local($fileInLoc,$fhErrSbr,$extForChain,$dirLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # fileListRd reads a list of files # in: file_list= file with filenames # in: $fhErrSbr= file handle to report missing files # (0 to surpress warnings!) # in: $extForChain= 'ext1,ext2' : extensions to check for chains, # i.e. if not existing purge ext_[A-Z0-9] # in: $dirLoc= 'dir1,dir2' : directories to scan for file # out: 1|0,msg # out: $list= 'file1,file2,...' # out: $chain= 'c1,c2,...' : if chains found # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $sbrName="lib-br:"."fileListRd";$fhinLoc="FHIN_"."fileListRd"; # check arguments return(0,"*** $sbrName: not def fileInLoc!",0) if (! defined $fileInLoc); $fhErrSbr="STDOUT" if (! defined $fhErrSbr); $extForChain=0 if (! defined $extForChain); return(0,"*** $sbrName: miss in file '$fileInLoc'!",0) if (! -e $fileInLoc); @extLoc=split(/,/,$extForChain) if ($extForChain); @dirLoc=split(/,/,$dirLoc) if ($dirLoc); # ------------------------------ # open file open($fhinLoc,$fileInLoc) || return(0,"*** ERROR $sbrName: fileIn=$fileInLoc, not opened\n",0); $tmpChain=$tmpFile=""; # ------------------------------ while (<$fhinLoc>) { # read list $_=~s/\n|\s//g; $file=$_; next if (length($_)==0); if (-e $file) { $tmpFile.="$file,";$tmpChain.="*,";} # file ok else {$Lok=0;$chainTmp="unk"; foreach $ext (@extLoc){ # check chain foreach $dir ("",@dirLoc){ # check dir (first: local!) $fileTmp=$file; $dir.="/" if (length($dir)>0 && $dir !~/\/$/); $fileTmp=~s/^(.*$ext)\_([A-Z0-9])$/$1/; $chainTmp=$2 if (defined $2); $fileTmp=$dir.$fileTmp; $Lok=1 if (-e $fileTmp); last if $Lok;} last if $Lok;} if ($Lok){$tmpFile.="$fileTmp,"; $tmpChain.="*," if (! defined $chainTmp || $chainTmp eq "unk"); $tmpChain.="$chainTmp," if (defined $chainTmp && $chainTmp ne "unk"); } else { print $fhErrSbr "-*- WARN $sbrName missing file=$_,\n";}} }close($fhinLoc); $tmpFile=~s/^,*|,*$//g;$tmpChain=~s/^,*|,*$//g; return(1,"ok $sbrName",$tmpFile,$tmpChain); } # end of fileListRd #=============================================================================== sub safRd { local($fileInLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # safRd reads SAF format # in: $fileOutLoc, # out: ($Lok,$msg,$tmp{}) with: # out: $tmp{"NROWS"} number of alignments # out: $tmp{"id", $it} name for $it # out: $tmp{"seq",$it} sequence for $it # err: ok-> 1,ok | error -> 0,message #------------------------------------------------------------------------------- $sbrName="lib-br:"."safRd";$fhinLoc="FHIN_"."safRd"; # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); $LverbLoc=0; open($fhinLoc,$fileInLoc) || return(0,"*** ERROR $sbrName: fileIn=$fileInLoc, not opened\n"); $ctBlocks=$ctRd=$#nameLoc=0; undef %nameInBlock; undef %tmp; # -------------------------------------------------- # read file while (<$fhinLoc>) { # -------------------------------------------------- $_=~s/\n//g; next if ($_=~/\#/); # ignore comments last if ($_!~/\#/ && $_=~/^\s*[\-\_]+\s*$/); # stop when address $line=$_; # ignore lines with numbers, blanks, points only $tmp=$_; $tmp=~s/[^A-Za-z]//g; next if (length($tmp)<1); $line=~s/^\s*|\s*$//g; # purge leading blanks # ------------------------------ # names $name=$line; $name=~s/^([^\s\t]+)[\s\t]+.*$/$1/; # maximal length: 14 characters (because of MSF2Hssp) # $name=substr($name,1,14); # ------------------------------ # sequences $seq=$line;$seq=~s/^\s*//;$seq=~s/^[^\s\t]+//;$seq=~s/\s//g; # next if ($seq =~/^ACDEFGHIKLMNPQRSTVWXYZ/i); # check this!! print "--- $sbrName: name=$name, seq=$seq,\n" if ($LverbLoc); # ------------------------------ # guide sequence: determine length # NOTE: no 'left-outs' allowed here # ------------------------------ $nameFirst=$name if ($#nameLoc==0); # detect first name if ($name eq "$nameFirst"){ ++$ctBlocks; # count blocks undef %nameInBlock; if ($ctBlocks == 1){ $lenFirstBeforeThis=0;} else { $lenFirstBeforeThis=length($tmp{"seq","1"});} if ($ctBlocks>1) { # manage proteins that did not appear $lenLoc=length($tmp{"seq","1"}); foreach $itTmp (1..$#nameLoc){ $tmp{"seq",$itTmp}.="." x ($lenLoc-length($tmp{"seq",$itTmp}));} }} # ------------------------------ # ignore 2nd occurence of same name next if (defined $nameInBlock{$name}); # avoid identical names # ------------------------------ # new name if (! defined ($tmp{$name})){ push(@nameLoc,$name); ++$ctRd; $tmp{$name}=$ctRd; $tmp{"id",$ctRd}=$name; print "--- $sbrName: new name=$name,\n" if ($LverbLoc); if ($ctBlocks>1){ # fill up with dots print "--- $sbrName: file up for $name, with :$lenFirstBeforeThis\n" if ($LverbLoc); $tmp{"seq",$ctRd}="." x $lenFirstBeforeThis;} else{ $tmp{"seq",$ctRd}="";}} # ------------------------------ # finally store $seq=~s/[^A-Za-z]/\./g; # any non-character to dot $seq=~tr/[a-z]/[A-Z]/; $ptr=$tmp{$name}; $tmp{"seq",$ptr}.=$seq; $nameInBlock{$name}=1; # avoid identical names } close($fhinLoc); # ------------------------------ # fill up ends $lenLoc=length($tmp{"seq","1"}); foreach $itTmp (1..$#nameLoc){ $tmp{"seq",$itTmp}.="." x ($lenLoc-length($tmp{"seq",$itTmp}));} $tmp{"NROWS"}=$ctRd; $tmp{"names"}=join (',',@nameLoc); $tmp{"names"}=~s/^,*|,*$//; $#nameLoc=0; undef %nameInBlock; return(1,"ok $sbrName"); } # end of safRd #=============================================================================== sub safWrt { local($fileOutLoc) = @_ ; local(@nameLoc,@stringLoc,$tmp,$sbrName,$Lok); $[ =1 ; #-------------------------------------------------------------------------------- # safWrt writing an SAF formatted file of aligned strings # in: $fileOutLoc output file # = "STDOUT" -> write to screen # = "txt" -> write to string # in GLOBAL: %saf # # in: $tmp{"NROWS"} number of alignments # in: $tmp{"id", $it} name for $it # in: $tmp{"seq",$it} sequence for $it # in: $tmp{"PER_LINE"} number of res per line (def=50) # in: $tmp{"HEADER"} 'line1\n,line2\n'.. # with line1= '# NOTATION ..' # out: 1|0,msg implicit: file # err: ok-> 1,ok | error -> 0,message #-------------------------------------------------------------------------------- $sbrName="lib-br:safWrt"; $fhoutLoc="FHOUT_safWrt"; # check input return(0,"*** ERROR $sbrName: no acceptable output file ($fileOutLoc) defined\n") if (! defined $fileOutLoc || length($fileOutLoc)<1 || $fileOutLoc !~/\w/); return(0,"*** ERROR $sbrName: no input given (or not input{NROWS})\n") if (! %tmp || ! defined $tmp{"NROWS"} ); return(0,"*** ERROR $sbrName: tmp{NROWS} < 1\n") if ($tmp{"NROWS"} < 1); $tmp{"PER_LINE"}=50 if (! defined $tmp{"PER_LINE"}); $fhoutLoc="STDOUT" if ($fileOutLoc eq "STDOUT"); # ------------------------------ # write header # ------------------------------ $prtloc= "# SAF (Simple Alignment Format)\n"."\# \n"; if (defined $tmp{"HEADER"}){ @tmp=split(/\n/,$tmp{"HEADER"}); foreach $tmp (@tmp){ $tmp="# ".$tmp if ($tmp !~ /^\#/); $prtloc.=$tmp; } $prtloc.="\n"; } # ------------------------------ # get maximal length of name $max=20; foreach $it (1..$tmp{"NROWS"}){ $max=length($tmp{"id",$it}) if (length($tmp{"id",$it}) > $max); } # ------------------------------ # write data into file # ------------------------------ for ($itres=1; $itres<=length($tmp{"seq","1"}); $itres+=$tmp{"PER_LINE"}){ foreach $itpair (1..$tmp{"NROWS"}){ $prtloc.= sprintf("%-".$max."s ",$tmp{"id",$itpair}); # chunks of $tmp{"PER_LINE"} $chunkEnd=$itres + ($tmp{"PER_LINE"} - 1); foreach $itchunk ($itres .. $chunkEnd){ last if (length($tmp{"seq",$itpair}) < $itchunk); $prtloc.= substr($tmp{"seq",$itpair},$itchunk,1); # add blank every 10 $prtloc.= " " if ($itchunk != $itres && (int($itchunk/10)==($itchunk/10))); } $prtloc.= "\n"; } $prtloc.= "\n"; } $prtloc.= "\n"; $#nameLoc=$#stringLoc=0; # save space # ------------------------------ # open new file if ($fhoutLoc ne "STDOUT" && $fhoutLoc ne "txt") { open($fhoutLoc,">$fileOutLoc") || return(0,"*** ERROR $sbrName: failed opening fileOut=$fileOutLoc\n"); } if ($fhoutLoc ne "txt"){ print $fhoutLoc $prtloc; $prtloc=""; return(1,"ok $sbrName") if ($fhoutLoc eq "STDOUT"); close($fhoutLoc); return(0,"*** ERROR $sbrName: failed to write file $fileOutLoc\n") if (! -e $fileOutLoc); return(1,"ok $sbrName");} return(1,"string empty??\n".$prtloc) if (length($prtloc)<10); return(1,$prtloc); } # end of safWrt librg-utils-perl-1.0.43/Makefile.am0000644015075101507510000000237411652607050013775 00000000000000SUBDIRS = lib mat dist_noinst_DATA = Build.PL.in $(PACKAGE).spec.in dist_noinst_SCRIPTS = dist_pkgdata_SCRIPTS = blast2saf.pl blastpgp_to_saf.pl conv_hssp2saf.pl copf.pl dbSwiss hssp_filter.pl safFilterRed.pl man_MANS = dbSwiss.1 man3_MANS = CLEANFILES = $(man_MANS) all-local: build-stamp clean-local: if [ -e Build ]; then perl Build clean && rm -f Build build-stamp; fi distclean-local: rm -rf _build MYMETA.yml MANIFEST MANIFEST.SKIP.bak MANIFEST.SKIP build-stamp: Build.PL perl Build.PL installdirs=vendor && perl Build manifest && perl Build && touch build-stamp install-data-local: perl Build install destdir=$(DESTDIR) $(INSTALL_BASE_ARG) create_packlist=0 %.1: % sed -e 's|__pkgdatadir__|$(pkgdatadir)|g;s|__sysconfdir__|$(sysconfdir)|g;s|__bindir__|$(bindir)|g;s|__VERSION__|$(VERSION)|g' "$<" | \ pod2man -c 'User Commands' -r "$(VERSION)" -name $(shell echo "$(basename $@)" | tr '[:lower:]' '[:upper:]') > "$@" install-data-hook: for f in "$(DESTDIR)$(pkgdatadir)/copf.pl" "$(DESTDIR)$(pkgdatadir)/hssp_filter.pl"; do \ sed -i -e 's|__bindir__|$(bindir)|g;s|__datadir__|$(datadir)|g;s|__docdir__|$(docdir)|g;s|__pkgdatadir__|$(pkgdatadir)|g;s|__PREFIX__|$(prefix)|g;s|__sysconfdir__|$(sysconfdir)|g;s|__VERSION__|$(VERSION)|g;' "$$f"; \ done librg-utils-perl-1.0.43/Makefile.in0000644015075101507510000007164111652607052014013 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = . DIST_COMMON = README $(am__configure_deps) $(dist_noinst_DATA) \ $(dist_noinst_SCRIPTS) $(dist_pkgdata_SCRIPTS) \ $(srcdir)/Build.PL.in $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/librg-utils-perl.spec.in \ $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = Build.PL librg-utils-perl.spec CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(man1dir)" \ "$(DESTDIR)$(man3dir)" SCRIPTS = $(dist_noinst_SCRIPTS) $(dist_pkgdata_SCRIPTS) SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive man1dir = $(mandir)/man1 man3dir = $(mandir)/man3 NROFF = nroff MANS = $(man3_MANS) $(man_MANS) DATA = $(dist_noinst_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d "$(distdir)" \ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr "$(distdir)"; }; } am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ INSTALL = @INSTALL@ INSTALL_BASE_ARG = @INSTALL_BASE_ARG@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ am__leading_dot = @am__leading_dot@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = lib mat dist_noinst_DATA = Build.PL.in $(PACKAGE).spec.in dist_noinst_SCRIPTS = dist_pkgdata_SCRIPTS = blast2saf.pl blastpgp_to_saf.pl conv_hssp2saf.pl copf.pl dbSwiss hssp_filter.pl safFilterRed.pl man_MANS = dbSwiss.1 man3_MANS = CLEANFILES = $(man_MANS) all: all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): Build.PL: $(top_builddir)/config.status $(srcdir)/Build.PL.in cd $(top_builddir) && $(SHELL) ./config.status $@ librg-utils-perl.spec: $(top_builddir)/config.status $(srcdir)/librg-utils-perl.spec.in cd $(top_builddir) && $(SHELL) ./config.status $@ install-dist_pkgdataSCRIPTS: $(dist_pkgdata_SCRIPTS) @$(NORMAL_INSTALL) test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" @list='$(dist_pkgdata_SCRIPTS)'; test -n "$(pkgdatadir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(pkgdatadir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(pkgdatadir)$$dir" || exit $$?; \ } \ ; done uninstall-dist_pkgdataSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(dist_pkgdata_SCRIPTS)'; test -n "$(pkgdatadir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(pkgdatadir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgdatadir)" && rm -f $$files install-man1: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list=''; test -n "$(man1dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man1dir)" && rm -f $$files; } install-man3: $(man3_MANS) $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)" @list='$(man3_MANS)'; test -n "$(man3dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.3[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \ done; } uninstall-man3: @$(NORMAL_UNINSTALL) @list='$(man3_MANS)'; test -n "$(man3dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.3[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man3dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man3dir)" && rm -f $$files; } # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @$(am__cd) '$(distuninstallcheck_dir)' \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(SCRIPTS) $(MANS) $(DATA) all-local installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-local mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-local \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-data-local install-dist_pkgdataSCRIPTS \ install-man @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-man1 install-man3 install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-dist_pkgdataSCRIPTS uninstall-man uninstall-man: uninstall-man1 uninstall-man3 .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-data-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am all-local am--refresh check check-am clean \ clean-generic clean-local ctags ctags-recursive dist dist-all \ dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ dist-xz \ dist-zip distcheck distclean distclean-generic distclean-local \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-data-hook \ install-data-local install-dist_pkgdataSCRIPTS install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-man1 install-man3 install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ uninstall-dist_pkgdataSCRIPTS uninstall-man uninstall-man1 \ uninstall-man3 all-local: build-stamp clean-local: if [ -e Build ]; then perl Build clean && rm -f Build build-stamp; fi distclean-local: rm -rf _build MYMETA.yml MANIFEST MANIFEST.SKIP.bak MANIFEST.SKIP build-stamp: Build.PL perl Build.PL installdirs=vendor && perl Build manifest && perl Build && touch build-stamp install-data-local: perl Build install destdir=$(DESTDIR) $(INSTALL_BASE_ARG) create_packlist=0 %.1: % sed -e 's|__pkgdatadir__|$(pkgdatadir)|g;s|__sysconfdir__|$(sysconfdir)|g;s|__bindir__|$(bindir)|g;s|__VERSION__|$(VERSION)|g' "$<" | \ pod2man -c 'User Commands' -r "$(VERSION)" -name $(shell echo "$(basename $@)" | tr '[:lower:]' '[:upper:]') > "$@" install-data-hook: for f in "$(DESTDIR)$(pkgdatadir)/copf.pl" "$(DESTDIR)$(pkgdatadir)/hssp_filter.pl"; do \ sed -i -e 's|__bindir__|$(bindir)|g;s|__datadir__|$(datadir)|g;s|__docdir__|$(docdir)|g;s|__pkgdatadir__|$(pkgdatadir)|g;s|__PREFIX__|$(prefix)|g;s|__sysconfdir__|$(sysconfdir)|g;s|__VERSION__|$(VERSION)|g;' "$$f"; \ done # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: librg-utils-perl-1.0.43/configure0000755015075101507510000030255411652606215013655 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.67 for librg-utils-perl 1.0.43. # # Report bugs to . # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and $0: https://rostlab.org/cgi-bin/bugzilla3/enter_bug.cgi?product=librg-utils-perl $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='librg-utils-perl' PACKAGE_TARNAME='librg-utils-perl' PACKAGE_VERSION='1.0.43' PACKAGE_STRING='librg-utils-perl 1.0.43' PACKAGE_BUGREPORT='https://rostlab.org/cgi-bin/bugzilla3/enter_bug.cgi?product=librg-utils-perl' PACKAGE_URL='' ac_subst_vars='LTLIBOBJS LIBOBJS INSTALL_BASE_ARG am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking ' ac_precious_vars='build_alias host_alias target_alias' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures librg-utils-perl 1.0.43 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/librg-utils-perl] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of librg-utils-perl 1.0.43:";; esac cat <<\_ACEOF Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF librg-utils-perl configure 1.0.43 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by librg-utils-perl $as_me 1.0.43, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5 ; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # remember to update version number in Build.PL # PERLLIBDIR=$(eval "`perl -V:installvendorlib`"; echo $installvendorlib) am__api_version='1.11' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='librg-utils-perl' VERSION='1.0.43' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' ac_config_files="$ac_config_files Makefile Build.PL librg-utils-perl.spec lib/Makefile lib/RG/Makefile lib/RG/Utils/Makefile mat/Makefile" if test "x$prefix" != "x/usr"; then INSTALL_BASE_ARG=install_base=$prefix fi cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by librg-utils-perl $as_me 1.0.43, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ librg-utils-perl config.status 1.0.43 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "Build.PL") CONFIG_FILES="$CONFIG_FILES Build.PL" ;; "librg-utils-perl.spec") CONFIG_FILES="$CONFIG_FILES librg-utils-perl.spec" ;; "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; "lib/RG/Makefile") CONFIG_FILES="$CONFIG_FILES lib/RG/Makefile" ;; "lib/RG/Utils/Makefile") CONFIG_FILES="$CONFIG_FILES lib/RG/Utils/Makefile" ;; "mat/Makefile") CONFIG_FILES="$CONFIG_FILES mat/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi librg-utils-perl-1.0.43/AUTHORS0000644015075101507510000000050511576712340013007 00000000000000Authors: Guy Yachdav Laszlo Kajan Copyright: Copyright 2009 Guy Yachdav , CUBIC (Columbia University, NY, USA), Technical University Munich (Munich, DE) Copyright 2009 Laszlo Kajan , Technical University Munich (Munich, DE) librg-utils-perl-1.0.43/COPYING0000644015075101507510000004312211577133463013000 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program 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 2 of the License, or (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. librg-utils-perl-1.0.43/ChangeLog0000644015075101507510000001757511652606117013527 00000000000000librg-utils-perl (1.0.43) unstable; urgency=low * librg-utils-perl.spec.in added * fixed warnings caused by buggy blast output -- Laszlo Kajan Fri, 28 Oct 2011 22:10:33 +0200 librg-utils-perl (1.0.42) unstable; urgency=low * deprecated defined %hash are rewritten * deprecated $[ are silenced with no warnings 'deprecated'; * Build.PL now generated from Build.PL.in -- Laszlo Kajan Wed, 28 Sep 2011 15:05:36 +0200 librg-utils-perl (1.0.41) UNRELEASED; urgency=low * marginally better error reporting * debianization moved out of this package -- Laszlo Kajan Thu, 30 Jun 2011 15:17:53 +0200 librg-utils-perl (1.0.40) unstable; urgency=low * allow digits in dbswiss table name * silence warnings in non-debug mode -- Laszlo Kajan Mon, 27 Jun 2011 18:12:21 +0200 librg-utils-perl (1.0.39) unstable; urgency=low * fixed blast+ parsing compatibility issue -- Laszlo Kajan Mon, 27 Jun 2011 13:20:38 +0200 librg-utils-perl (1.0.38) unstable; urgency=low * now parses blast+ blastpgp output -- Laszlo Kajan Wed, 22 Jun 2011 12:40:00 +0200 librg-utils-perl (1.0.37) unstable; urgency=low * Newline in left-justified string for sprintf warnings fixed -- Laszlo Kajan Tue, 21 Jun 2011 20:10:34 +0200 librg-utils-perl (1.0.36) unstable; urgency=low * fixed blast to saf conversion for blast 'Query: 0 ----' bug -- Laszlo Kajan Fri, 20 May 2011 21:38:33 +0200 librg-utils-perl (1.0.35) stable; urgency=low * fixed blast2saf.pl problem triggered by very strange looking blast alignment -- Laszlo Kajan Thu, 14 Apr 2011 15:59:51 +0200 librg-utils-perl (1.0.34) stable; urgency=low * moved runNewPSIC.pl to its own package rost-runpsic -- Laszlo Kajan Tue, 12 Apr 2011 12:22:56 +0200 librg-utils-perl (1.0.33) stable; urgency=low * blastpgp_to_saf.pl line 15 warning cleared -- Laszlo Kajan Fri, 18 Feb 2011 18:45:45 +0100 librg-utils-perl (1.0.32) stable; urgency=low * blast2saf.pl warning on line 216 cleared -- Laszlo Kajan Sun, 30 Jan 2011 21:14:25 +0100 librg-utils-perl (1.0.31) stable; urgency=low * blast2saf.pl syntax error fixed -- Laszlo Kajan Fri, 28 Jan 2011 22:54:07 +0100 librg-utils-perl (1.0.30) stable; urgency=low * blast2saf.pl and blastpgp_to_saf.pl much cleaner logic for reading last record of blast results -- Laszlo Kajan Fri, 28 Jan 2011 16:28:50 +0100 librg-utils-perl (1.0.29) stable; urgency=low * blast2saf.pl and blastpgp_to_saf.pl bugs introduced in prev version fixed -- Laszlo Kajan Thu, 27 Jan 2011 16:26:34 +0100 librg-utils-perl (1.0.28) stable; urgency=low * blast2saf.pl and blastpgp_to_saf.pl are now capable of parsing a blast file that does not have the footer part but just ends after a record -- Laszlo Kajan Thu, 27 Jan 2011 15:28:46 +0100 librg-utils-perl (1.0.27) stable; urgency=low * silenced safFilterRed.pl in non-verbose non-debug mode -- Laszlo Kajan Wed, 26 Jan 2011 12:58:38 +0100 librg-utils-perl (1.0.26) stable; urgency=low * renamed dbSwiss.pl to dbSwiss, added man page -- Laszlo Kajan Wed, 26 Jan 2011 10:07:31 +0100 librg-utils-perl (1.0.25) stable; urgency=low * added dbSwiss.pl -- Laszlo Kajan Mon, 24 Jan 2011 22:30:37 +0100 librg-utils-perl (1.0.24) stable; urgency=low * fixed endless loop bug -- Laszlo Kajan Fri, 21 Jan 2011 16:22:47 +0100 librg-utils-perl (1.0.23) stable; urgency=low * Added --use-blastfile cmd line argument * Recoded parts to make it more readable * Made certain blast problems (incorrect blast file) lethal * Disabled 'rerun blast if too big blast input file' feature * Added logic to read only first 300 alignments from blast file that satisfy the percent identity limit requirements -- Laszlo Kajan Fri, 21 Jan 2011 15:35:02 +0100 librg-utils-perl (1.0.22) stable; urgency=low * Fixed min-seqlen = 50 issue -- Laszlo Kajan Thu, 20 Jan 2011 14:19:23 +0100 librg-utils-perl (1.0.21) stable; urgency=low * Recommends clustalw - runNewPSIC.pl requires it -- Laszlo Kajan Wed, 19 Jan 2011 17:33:01 +0100 librg-utils-perl (1.0.20) stable; urgency=low * psic Depends added -- Laszlo Kajan Wed, 19 Jan 2011 17:24:01 +0100 librg-utils-perl (1.0.19) stable; urgency=low * moved in runNewPSIC.pl from snapfun -- Laszlo Kajan Wed, 19 Jan 2011 16:41:10 +0100 librg-utils-perl (1.0.18) stable; urgency=low * RG/Utils/Copf.pm: fixed sequence name issue with trailing '|' -- Laszlo Kajan Tue, 11 Jan 2011 16:29:34 +0100 librg-utils-perl (1.0.17) stable; urgency=low * RG/Utils/Copf.pm: FASTA sequences can now consist of [A-Z.~_!-] -- Laszlo Kajan Wed, 20 Oct 2010 09:57:21 +0200 librg-utils-perl (1.0.16) stable; urgency=low * RG/Utils/Copf.pm reported success (0) even when failed - corrected -- Laszlo Kajan Thu, 07 Oct 2010 10:14:24 +0200 librg-utils-perl (1.0.15) stable; urgency=low * copf now uses a temporary directory for work dir if none given -- Laszlo Kajan Wed, 29 Sep 2010 16:41:39 +0200 librg-utils-perl (1.0.14) stable; urgency=low * copf.pl lower case FASTA format recognition bug fixed -- Laszlo Kajan Mon, 20 Sep 2010 17:16:21 +0200 librg-utils-perl (1.0.13) stable; urgency=low * Default is now not to change the nice level -- Laszlo Kajan Tue, 24 Aug 2010 10:44:39 +0200 librg-utils-perl (1.0.12) stable; urgency=low * Fixed blast2saf log file issue -- Laszlo Kajan Tue, 10 Aug 2010 21:31:43 +0200 librg-utils-perl (1.0.11) stable; urgency=low * Now tools die of errors instead of reporting success -- Laszlo Kajan Thu, 24 Jun 2010 18:27:56 +0200 librg-utils-perl (1.0.10) stable; urgency=low * Silenced regular operation of copf.pl and hssp_filter.pl -- Laszlo Kajan Thu, 17 Jun 2010 11:41:22 +0200 librg-utils-perl (1.0.9) stable; urgency=low * fileOutErr is now optional: will use STDERR if not given -- Laszlo Kajan Thu, 17 Jun 2010 10:44:54 +0200 librg-utils-perl (1.0.8) stable; urgency=low * Better command failure detection and error reporting -- Laszlo Kajan Sun, 16 May 2010 00:29:42 +0200 librg-utils-perl (1.0.7) stable; urgency=low * Better command failure detection and error reporting -- Laszlo Kajan Sat, 15 May 2010 00:00:44 +0200 librg-utils-perl (1.0.6) stable; urgency=low * Added Mat to: next if ($kwd =~ /^file(In|Out|Help|Def|Mat)/i); # lkajan: infernal. This should be a next UNLESS /something/ condition. * added profphd-utils dependency * sed --in-place -> -i because Mac sed does not understand --in-place -- Laszlo Kajan Wed, 12 May 2010 22:08:00 +0200 librg-utils-perl (1.0.5) stable; urgency=low * Added safFilterRed.pl from profphd -- Laszlo Kajan Thu, 14 Jan 2010 20:44:49 +0100 librg-utils-perl (1.0.4) unstable; urgency=low * Corrected dirSrcMat path * Corrected package method calls by qualifying package properly * Added missing mat/Blast_blosum62.metric; added conv_hssp2saf.pl from profphd; fixed syntax error in hssp_filter.pl; * Fixed syntax error in hssp_filter.pl -- Laszlo Kajan Thu, 14 Jan 2010 20:44:49 +0100 librg-utils-perl (1.0.3) unstable; urgency=low * Simpler repository organization -- Laszlo Kajan Thu, 14 Jan 2010 11:50:24 +0100 librg-utils-perl-1.0.43/INSTALL0000644015075101507510000003633211324777651013006 00000000000000Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. librg-utils-perl-1.0.43/NEWS0000644015075101507510000000000011576712144012426 00000000000000librg-utils-perl-1.0.43/install-sh0000755015075101507510000003253711324777651013764 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; -*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: librg-utils-perl-1.0.43/missing0000755015075101507510000002623311324777651013353 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2009-04-28.21; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program 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 2, or (at your option) # any later version. # This program 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 this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; tar*) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar*) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: librg-utils-perl-1.0.43/lib/0000755015075101507510000000000011652607053012564 500000000000000librg-utils-perl-1.0.43/lib/Makefile.am0000644015075101507510000000001511606306601014526 00000000000000SUBDIRS = RG librg-utils-perl-1.0.43/lib/Makefile.in0000644015075101507510000003632211652606215014556 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = lib DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ INSTALL = @INSTALL@ INSTALL_BASE_ARG = @INSTALL_BASE_ARG@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ am__leading_dot = @am__leading_dot@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = RG all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic ctags \ ctags-recursive distclean distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-recursive uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: librg-utils-perl-1.0.43/lib/RG/0000755015075101507510000000000011652607053013074 500000000000000librg-utils-perl-1.0.43/lib/RG/Makefile.am0000644015075101507510000000002011606305706015037 00000000000000SUBDIRS = Utils librg-utils-perl-1.0.43/lib/RG/Makefile.in0000644015075101507510000003633611652606215015073 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = lib/RG DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ INSTALL = @INSTALL@ INSTALL_BASE_ARG = @INSTALL_BASE_ARG@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ am__leading_dot = @am__leading_dot@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = Utils all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/RG/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/RG/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic ctags \ ctags-recursive distclean distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-recursive uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: librg-utils-perl-1.0.43/lib/RG/Utils/0000755015075101507510000000000011652607053014174 500000000000000librg-utils-perl-1.0.43/lib/RG/Utils/Conv_hssp2saf.pm0000644015075101507510000013625311640615022017172 00000000000000#!/usr/bin/perl ##------------------------------------------------------------------------------# # Copyright 1998 # # Burkhard Rost rost@EMBL-Heidelberg.DE # # Wilckensstr. 15 http://www.embl-heidelberg.de/~rost/ # # D-69120 Heidelberg # # version 0.1 May, 1998 # # version 1.1 Oct, 1998 # #------------------------------------------------------------------------------# =pod =head1 NAME RG::Utils::Conv_hssp2saf - Rost Lab perl utilities =head1 SYNOPSIS use RG::Utils::Conv_hssp2saf; =head1 FUNCTIONS See module source for description. =over =item bynumber =item bynumber_high2low =item conv_hssp2saf =item convHssp2saf =item convHssp2saf_hsspRdLoc =item errSbr =item errSbrMsg =item get_range =item get_rangeHyphen =item hsspGetChain =item hsspRdAli =item hsspRdHeader =item hsspRdSeqSecAccOneLine =item is_hssp =item is_pdbid =item open_file =item safWrt =back =head1 VARIABLES =over =back =head1 AUTHOR B. Rost =head1 SEE ALSO =over =item Main website L =back =cut package RG::Utils::Conv_hssp2saf; no warnings 'deprecated'; INIT: { $scrName=$0;$scrName=~s/^.*\/|\.pl//g; $scrGoal="converts HSSP 2 SAF\n"; } #=============================================================================== sub conv_hssp2saf { #------------------------------------------------------------------------------- # conv_hssp2saf package version of script #------------------------------------------------------------------------------- $[ =1 ; # sets array count to start at 1, not at 0 @PARAMS=@_; # pass from calling $par{packName} = __FILE__; # ------------------------------ foreach $arg(@PARAMS){ # highest priority arguments next if ($arg !~/=/); if ($arg=~/^packName=(.*)/) { $par{"packName"}=$1; shift @PARAMS if ($PARAMS[1] eq $arg); } } # ------------------------------ &convHssp2saf("ini"); # sets %par # ------------------------------ if ($#PARAMS<1){ # help print "goal:\t $scrGoal\n"; print "use: \t '$scrName list.hssp (or *.hssp)'\n"; print "opt: \t \n"; printf " \t %-15s= %-20s %-s\n","fileOut", "x",""; printf " \t %-15s= %-20s %-s\n","extr", "p1-p2,p3","(extract proteins p1-p2,p3 only)"; printf " \t %-15s= %-20s %-s\n","frag", "n1-n2", "(extract residues n1-n2 only)"; printf " \t %-15s %-20s %-s\n","noScreen", "no value",""; printf " \t %-15s %-20s %-s\n","expand", "no value","(do expand the insertion list)"; # printf " \t %-15s %-20s %-s\n","", "no value",""; if (%par){ printf " \t %-15s %-20s %-s\n","-" x 15 ,"-" x 20,"-" x 30; printf " \t %-15s %-20s %-s\n","other:","default settings: "," "; foreach $kwd (@kwd){ if ($par{"$kwd"}!~/\D/){ printf " \t %-15s= %10d %9s %-s\n",$kwd,$par{"$kwd"}," ","(def)";} elsif ($par{"$kwd"}!~/[0-9\.]/){ printf " \t %-15s= %10.3f %9s %-s\n",$kwd,$par{"$kwd"}," ","(def)";} else { printf " \t %-15s= %-20s %-s\n",$kwd,$par{"$kwd"},"(def)";} } } exit;} ($Lok,$msg)= &convHssp2saf(@PARAMS); print "*** $scrName: final msg=\n".$msg."\n" if (! $Lok); return(1,"ok $scrName:pack"); } # end of conv_hssp2saf #=============================================================================== sub convHssp2saf { local($tmpMode) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # convHssp2saf script to convert HSSP 2 SAF # in: file.hssp (or list, or *.hssp) # file.hssp_C for chain! # in: opt fileOut=X -> output file will be X # NOTE: only for single file! # in: opt frag=n1-n2 -> extract residues n1-n2 # in: opt extr=p1-p2,p3 -> extract proteins p1-p2,p3 # in: opt expand -> write expanded ali # in: opt noScreen -> avoid writing # out: 1|0,msg, implicit: file # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $tmp=$0;$tmp=~s/^.*\/|\.pl//g;$tmp.=":"; $sbrName="$tmp:lib-scr::"."convHssp2saf";$fhinLoc="FHIN_"."convHssp2saf"; # ------------------------------ # defaults @rdHsspHdr=("SEQLENGTH","ID","IDE","LALI","IFIR","ILAS"); $par{"len1Min"}= 30 if (! defined $par{"len1Min"}); # minimal length $par{"laliMin"}= 30 if (! defined $par{"laliMin"}); # minimal alignment length $par{"pideMax"}= 100 if (! defined $par{"pideMax"}); # maximal percentage sequence identity $par{"expand"}= 0 if (! defined $par{"expand"} ); # expand insertions? $par{"verbose"}= 1 if (! defined $par{"verbose"}); # $par{"verb2"}= 0 if (! defined $par{"verb2"} ); # @kwd=sort (keys %par); return if (defined $tmpMode && $tmpMode eq "ini"); # initialise variables $fhin="FHIN"; # ------------------------------ $#fileIn=$#chainIn=0; # read command line foreach $arg (@_){ if ($arg=~/^fileOut=(.*)$/) { $fileOut=$1;} elsif ($arg=~/^frag=(.*)$/) { $frag=$1; if ($frag !~/\d+\-\d+/){ print "*** arg 'frag' must be 'N1-N2'\n"; exit;}} elsif ($arg=~/^extr=(.*)$/) { $extr=$1; } elsif ($arg=~/^no[Ss]creen/) { $par{"verbose"}=$par{"verb2"}=0; } elsif ($arg=~/^expand$/) { $par{"expand"}=1; } elsif ($arg=~/^debug$/) { $par{"debug"}=1; } # elsif ($arg=~/^=(.*)$/) { $=$1; } elsif (-e $arg) { push(@fileIn,$arg); push(@chainIn,"*");} elsif ($arg=~/^(.*\.hssp)\_([A-Z0-9])/) { push(@fileIn,$1); push(@chainIn,$2);} elsif (%par && $#kwd>0) { $Lok=0; foreach $kwd (@kwd){ if ($arg =~ /^$kwd=(.+)$/){$Lok=1;$par{"$kwd"}=$1; last;}} if (! $Lok){ print "*** wrong command line arg '$arg'\n"; die;}} else { print "*** wrong command line arg '$arg'\n"; die;}} # ------------------------------ # verify 'extr' correct if (defined $extr && length($extr)>=1 && $extr=~/\d/ && $extr ne "0"){ @extr=&get_range($extr); return(&errSbr("you gave the argument 'extr=$extr', not valid!\n*** Ought to be of the form:\n". "'extr=n1-n2', or 'extr=n1,n2,n3-n4,n5'\n")) if ($#extr==0); foreach $tmp (@extr) { if ($tmp=~/\D/){ return(&errSbr("you gave the argument 'extr=$extr', not valid!\n". "*** Ought to be of the form:\n". "'extr=n1-n2', or 'extr=n1,n2,n3-n4,n5'\n")); } $extr{"$tmp"}=1; }} elsif (defined $extr) {undef $extr ; } # ------------------------------ # input file $fileIn=$fileIn[1]; die ("missing input $fileIn\n") if (! -e $fileIn); # ------------------------------ # (0) read list (if list) if (! &is_hssp($fileIn)){ # ------------------------------ print "--- $scrName: read list '$fileIn'\n"; $#fileIn=$#chainIn=0; $fhin="FHIN_$scrName"; &open_file("$fhin", "$fileIn") || die '*** $scrName ERROR opening file $fileIn'; while (<$fhin>) { $_=~s/\n|\s//g; next if (length($_)<5); if ($_=~/^(.*\.hssp)\_([A-Z0-9])/){ push(@fileIn,$1); push(@chainIn,$2);} else { push(@fileIn,$_); push(@chainIn,"*");} } close($fhin); $#fileOut=0; } else { @fileOut=($fileOut) if (defined $fileOut); $#fileOut=0 if (! defined $fileOut); } # ------------------------------ # (1) loop over file(s) # ------------------------------ foreach $itfile(1..$#fileIn){ ($Lok,$msg)= &convHssp2saf_hsspRdLoc; return(&errSbrMsg("failed reading file=$fileIn[$itfile], it=$itfile",$msg)) if (! $Lok); } if ($par{"verbose"}) { $tmp=""; foreach $file (@fileOut) { next if (! -e $file); $tmp.="$file,";} $tmp=~s/,*$//g; if (length($tmp)>2 && $tmp=~/,/){ print "--- output files:"; } elsif (length($tmp)>2){ print "--- output file:"; } print "$tmp\n";} return(1,"ok $sbrName"); } # end of convHssp2saf #=============================================================================== sub convHssp2saf_hsspRdLoc { # local($fileInLoc,$fhErrSbr) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # convHssp2saf_hsspRdLoc reads stuff # in/out GLOBAL: all # in: $fileInLoc # out: 1|0,msg, implicit: # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $sbrName="lib-scr::"."convHssp2saf_hsspRdLoc"; $fhinLoc="FHIN_"."convHssp2saf_hsspRdLoc"; $fileIn=$fileIn[$itfile]; $chainIn=$chainIn[$itfile]; if (! -e $fileIn){ print "-*- WARN $scrName: no fileIn=$fileIn\n"; next;} print "--- $scrName: working on $itfile =$fileIn $chainIn\n" if ($par{"verbose"}); $pdbid= $fileIn;$pdbid=~s/^.*\/|\.hssp//g; $pdbid.="_".$chainIn if ($chainIn ne "*"); undef %tmp; # ------------------------------ if ($chainIn ne "*"){ # get chain positions ($Lok,%tmp)= &hsspGetChain($fileIn); return(&errSbr("failed on getchain($fileIn)")) if (! $Lok); foreach $it (1..$tmp{"NROWS"}){ next if ($chainIn ne $tmp{"$it","chain"}); $ifir=$tmp{"$it","ifir"}; $ilas=$tmp{"$it","ilas"}; }} else { $ifir=$ilas=0;} # ------------------------------ undef %tmp; # read header of HSSP ($Lok,%tmp)= &hsspRdHeader($fileIn,@rdHsspHdr); return(&errSbr("failed on $fileIn")) if (! $Lok); # ------------------------------ # too short -> skip return(1,"too short=".$tmp{"SEQLENGTH"}) if ($tmp{"SEQLENGTH"} < $par{"len1Min"}); $#numTake=0; # ------------------------------ # process data foreach $it (1..$tmp{"NROWS"}){ # not chain -> skip next if ($ifir && $ilas && ( ($tmp{"IFIR","$it"} > $ilas) || ($tmp{"ILAS","$it"} < $ifir) )); next if ($par{"laliMin"} > $tmp{"LALI","$it"} ); # lali too short next if ($par{"pideMax"} < 100*$tmp{"IDE","$it"} ); # pide too high next if (defined $extr && ! defined $extr{"$it"} ); # select only some proteins push(@numTake,$it); # ok -> take } # ------------------------------ undef %tmp; # read alignments if (defined $par{"expand"} && $par{"expand"}){ $kwdSeq="seqAli";} # read ali with insertions else { $kwdSeq="seqNoins";} # read ali without insertions ($Lok,%tmp)= &hsspRdAli($fileIn,@numTake,$kwdSeq); return(&errSbrMsg("failed reading alis for $fileIn, num=". join(',',@numTake),$msg)) if (! $Lok); $nali=$tmp{"NROWS"}; undef %tmp2; # ------------------------------ if (defined $frag){ # adjust for extraction (arg: frag=N1-n2) ($ibeg,$iend)=split(/\-/,$frag); # additional complication if expand: change numbers if ($kwdSeq eq "seqAli"){ $seq=$tmp{"$kwdSeq","0"}; @tmp=split(//,$seq); $ct=0; foreach $it (1..$#tmp){ next if ($tmp[$it] eq "."); # skip insertions ++$ct; # count no-insertions next if ($ct > $iend); # outside of range to read next if ($ct < $ibeg); # outside of range to read $ibeg=$it if ($ct == $ibeg); # change begin $iend=$it if ($ct == $iend);}}} # change end else { $ibeg=$iend=0;} # ---------------------------------------- # cut out non-chain, and not to read parts # ---------------------------------------- foreach $it (0..$nali){ if ($ifir && $ilas){ $tmp{"$kwdSeq","$it"}=substr($tmp{"$kwdSeq","$it"},$ifir,($ilas-$ifir+1));} if ($ibeg && $iend){ $tmp{"$kwdSeq","$it"}=substr($tmp{"$kwdSeq","$it"},$ibeg,($iend-$ibeg+1));} $ct=$it+1; $tmp2{"seq","$ct"}=$tmp{"$kwdSeq","$it"}; undef $tmp{"$kwdSeq","$it"}; $tmp2{"id","$ct"}= $tmp{"$it"};} $tmp2{"NROWS"}=$nali+1; undef %tmp; # slick-is-in! # ------------------------------ undef %tmp; # slick-is-in ! undef @numTake; # slick-is-in ! # ------------------------------ # write output file if (defined $fileOut && $#fileIn==1){ $fileOutLoc=$fileOut;} else { $fileOutLoc="$pdbid".".saf"; $fileOut.=$fileOutLoc."," if (defined $fileOut); } ($Lok,$msg)= &safWrt($fileOutLoc,%tmp2); return(&errSbrMsg("failed writing out=$fileOutLoc, for in=$fileIn",$msg)) if (! $Lok); push(@fileOut,$fileOutLoc); undef %tmp2; # slick-is-in ! return(1,"ok $sbrName"); } # end of convHssp2saf_hsspRdLoc #============================================================================== # library collected (begin) #============================================================================== #=============================================================================== sub bynumber { #------------------------------------------------------------------------------- # bynumber function sorting list by number #------------------------------------------------------------------------------- $a<=>$b; } # end of bynumber #=============================================================================== sub bynumber_high2low { #------------------------------------------------------------------------------- # bynumber_high2low function sorting list by number (start with high) #------------------------------------------------------------------------------- $b<=>$a; } # end of bynumber_high2low #============================================================================== sub errSbr {local($txtInLoc,$sbrNameLocy) = @_ ; #------------------------------------------------------------------------------- # errSbr simply writes '*** ERROR $sbrName: $txtInLoc' #------------------------------------------------------------------------------- $sbrNameLocy=$sbrName if (! defined $sbrNameLocy); $txtInLoc.="\n"; $txtInLoc=~s/\n\n+/\n/g; return(0,"*** ERROR $sbrNameLocy: $txtInLoc"); } # end of errSbr #============================================================================== sub errSbrMsg {local($txtInLoc,$msgInLoc,$sbrNameLocy) = @_ ; #------------------------------------------------------------------------------- # errSbrMsg simply writes '*** ERROR $sbrName: $txtInLoc\n'.$msg #------------------------------------------------------------------------------- $sbrNameLocy=$sbrName if (! defined $sbrNameLocy); $txtInLoc.="\n"; $txtInLoc=~s/\n\n+/\n/g; $msgInLoc.="\n"; $msgInLoc=~s/\n\n+/\n/g; return(0,"*** ERROR $sbrNameLocy: $txtInLoc".$msgInLoc); } # end of errSbrMsg #============================================================================== sub get_range { local ($range_txt,$nall) = @_; local (@range,@rangeLoc,$it,$range1,$range2); $[ =1 ; #-------------------------------------------------------------------------------- # get_range converts range=n1-n2 into @range (1,2) # in: 'n1-n2' NALL: e.g. incl=1-5,9,15 # n1= begin, n2 = end, * for wild card # NALL = number of last position # out: @takeLoc: begin,begin+1,...,end-1,end #-------------------------------------------------------------------------------- $#range=0; if (! defined $range_txt || length($range_txt)<1 || $range_txt eq "unk" || $range_txt !~/\d/ ) { print "*** ERROR in get_range: argument: range=$range_txt, nall=$nall, not digestable\n"; return(0);} $range_txt=~s/\s//g; # purge blanks $nall=0 if (! defined $nall); # already only a number return($range_txt) if ($range_txt !~/[^0-9]/); if ($range_txt !~/[\-,]/) { # no range given print "*** ERROR in get_range: argument: '$range_txt,$nall' not digestable\n"; return(0);} # ------------------------------ # dissect commata if ($range_txt =~ /\,/) { @range=split(/,/,$range_txt);} # ------------------------------ # dissect hyphens elsif ($range_txt =~ /(\d*|\*)-(\d*|\*)/) { @range=&get_rangeHyphen($range_txt,$nall);} # ------------------------------ # process further elements with hyphens $#range2=0; foreach $range (@range){ if ($range =~ /(\d*|\*)-(\d*|\*)/) { push(@range2,&get_rangeHyphen($range,$nall));} else { push(@range2,$range);}} @range=@range2; $#range2=0; # ------------------------------ if ($#range>1){ # sort @range=sort {$a<=>$b} @range;} return (@range); } # end of get_range #============================================================================== sub get_rangeHyphen { local ($range_txt,$nall) = @_ ; local (@rangeLoc,$it,$range1,$range2); $[ =1 ; #-------------------------------------------------------------------------------- # get_rangeHyphen reads 'n1-n2' # in: 'n1-n2', NALL (n1= begin, n2 = end, * for wild card) # NALL = number of last position # out: begin,begin+1,...,end-1,end #-------------------------------------------------------------------------------- if ($range_txt =~ /(\d*|\*)-(\d*|\*)/) { ($range1,$range2)=split(/-/,$range_txt); if ($range1=~/\*/) {$range1=1;} if ($range2=~/\*/) {$range2=$nall;} for($it=$range1;$it<=$range2;++$it) {push(@rangeLoc,$it);} } else { @rangeLoc=($range_txt);} return(@rangeLoc); } # end of get_rangeHyphen #============================================================================== sub hsspGetChain { local ($fileIn) = @_ ; local ($fhin,$ifirLoc,$ilasLoc,$tmp1,$tmp2, $chainLoc,$posLoc,$posRd,$chainRd,@cLoc,@pLoc,%rdLoc); $[ =1 ; #-------------------------------------------------------------------------------- # hsspGetChain extracts all chain identifiers in HSSP file # in: $file # out: $chains (ABC) ,%rdLoc # no chain -> $chains=' ' # out $rdLoc{"NROWS"},$rdLoc{"$ct","chain"}, # out $rdLoc{"$ct","ifir"},$rdLoc{"$ct","ilas"} #-------------------------------------------------------------------------------- $fhin="FhInHssp"; return(0,"no file") if (! -e $fileIn); &open_file("$fhin","$fileIn"); while(<$fhin>){ # until start of data last if ($_=~/^ SeqNo/);} $chainLoc=$posLoc=""; while(<$fhin>){ if ($_=~/^\#/ && (length($chainLoc)>1) ) { $posLoc.="$ifirLoc-$ilasLoc".","; last;} $chainRd=substr($_,13,1); $aaRd= substr($_,15,1); $posRd= substr($_,1,6);$posRd=~s/\s//g; next if ($aaRd eq "!") ; # skip over chain break if ($chainLoc !~/$chainRd/){ # new chain? $posLoc.= "$ifirLoc-$ilasLoc"."," if (length($chainLoc)>1); $chainLoc.= "$chainRd".","; $ifirLoc=$ilasLoc=$posRd;} else { $ilasLoc=$posRd;} }close($fhin); $chainLoc=~s/^,|,$//g; $posLoc=~s/\s//g;$posLoc=~s/^,|,$//g; # purge leading ',' # now split chains read undef %rdLoc; $ctLoc=0; @cLoc=split(/,/,$chainLoc); @pLoc=split(/,/,$posLoc); foreach $itLoc(1..$#cLoc){ ($tmp1,$tmp2)=split(/-/,$pLoc[$itLoc]); next if ($tmp2 == $tmp1); # exclude chains of length 1 ++$ctLoc; $rdLoc{"NROWS"}= $ctLoc; $rdLoc{"$ctLoc","chain"}=$cLoc[$itLoc]; $rdLoc{"$ctLoc","ifir"}= $tmp1; $rdLoc{"$ctLoc","ilas"}= $tmp2;} $chainLoc=~s/,//g; return($chainLoc,%rdLoc); } # end of hsspGetChain #============================================================================== sub hsspRdAli { local ($fileInLoc,@want) = @_ ; local ($sbrName,$fhinLoc,$tmp); $[ =1 ; #------------------------------------------------------------------------------- # hsspRdAli reads and writes the sequence of HSSP + 70 alis # in: $fileHssp (must exist), # @des (1) =1, 2, ..., i.e. number of sequence to be read # (2) = swiss_id1, swiss_id2, i.e. identifiers to read # (3) = all (or undefined) # NOTE: you can give ids AND numbers ('1','paho_chick','2') .. # furthermore: # if @want = 'seq|seqAli|seqNoins' # only those will be returned (e.g. $tmp{"seq","$ct"}) # default: all 3! # out: 1|0,$rd{} with: # err: (0,$msg) # overall: # $rd{"NROWS"}= : number of alis, i.e. $#want # $rd{"NRES"}=N : number of residues in guide # $rd{"SWISS"}='sw1,sw2' : list of swiss-ids read # $rd{"0"}='pdbid' : id of guide sequence (in file header) # $rd{"$it"}='sw$ct' : swiss id of the it-th alignment # $rd{"$id"}='$it' : position of $id in final list # $rd{"sec","$itres"} : secondary structure for residue itres # $rd{"acc","$itres"} : accessibility for residue itres # $rd{"chn","$itres"} : chain for residue itres # per prot: # $rd{"seqNoins","$ct"}=sequences without insertions # $rd{"seqNoins","0"}= GUIDE sequence # $rd{"seq","$ct"}=SEQW : sequences, with all insertions # but NOT aligned!!! # $rd{"seqAli","$ct"} : sequences, with all insertions, # AND aligned (all, including guide # filled up with '.' !! #------------------------------------------------------------------------------- $sbrName="lib-br:hsspRdAli"; $fhinLoc="FHIN"."$sbrName"; $fhinLoc=~tr/[a-z]/[A-Z]/; # file existing? if ((! -e $fileInLoc) || (! &is_hssp($fileInLoc))){ print "*** ERROR $sbrName no HSSP file '$fileInLoc'\n"; return(0);} # ------------------------------ # HSSP file format settings $regexpBegAli= "^\#\# ALIGNMENTS"; # begin of reading $regexpEndAli= "^\#\# SEQUENCE PROFILE"; # end of reading $regexpSkip= "^ SeqNo"; # skip lines with pattern $nmaxBlocks= 100; # maximal number of blocks considered (=7000 alis!) $regexpBegIns= "^\#\# INSERTION LIST"; # begin of reading insertion list undef %tmp; undef @seqNo; undef %seqNo; # ------------------------------ # pointers undef %ptr_id2num; # $ptr{xyz}= N : id=xyz is the Nth ali undef @ptr_num2id; # $ptr[N]= xyz : Nth ali has id= xyz undef @ptr_numWant2numFin; # $ptr[N]= M : the Nth ali is the Mth one in the list # of all numbers wanted (i.e. = $want[M]) undef @ptr_numFin2numWant; # $ptr[M]= N : see previous, the other way around! $#want=0 if (! defined @want); $LreadAll=0; # ------------------------------ # digest input $#tmp=0; undef %kwd; # (1) detect keywords foreach $tmp (@want){ if ($tmp=~/^(seq|seqAli|seqNoins)$/){ $kwd{$tmp}=1; next;} push(@tmp,$tmp);} if (($#want>0) && ($#want == $#tmp) ){ # default keyworkds foreach $des ("seq","seqAli","seqNoins"){ $kwd{"$des"}=1;}} @want=@tmp; # (2) all? $LreadAll=1 if ( ! @want || ! $want[1] || ($want[1] eq "all")); if (! $LreadAll){ # (3) read some $#wantNum=$#wantId=0; foreach $want (@want) { if ($want !~ /[^0-9]/){push(@wantNum,$want);} # is number else {push(@wantId,$want);}}} # is id # ------------------------------ # get numbers/ids to read ($Lok,%rdHeader)= &hsspRdHeader($fileInLoc,"SEQLENGTH","PDBID","NR","ID"); if (! $Lok){ print "*** ERROR $sbrName reading header of HSSP file '$fileInLoc'\n"; return(0);} $tmp{"NRES"}= $rdHeader{"SEQLENGTH"};$tmp{"NRES"}=~s/\s//g; $tmp{"0"}= $rdHeader{"PDBID"}; $tmp{"0"}=~s/\s//g; $idGuide= $tmp{"0"}; $#locNum=$#locId=0; # store the translation name/number foreach $it (1..$rdHeader{"NROWS"}){ $num=$rdHeader{"NR","$it"}; $id=$rdHeader{"ID","$it"}; push(@locNum,$num);push(@locId,$id); $ptr_id2num{"$id"}=$num; $ptr_num2id[$num]=$id;} push(@locNum,"1") if ($#locNum==0); # nali=1 # ------------------------------ foreach $want (@wantId){ # CASE: input=list of names $Lok=0; # -> add to @wantNum foreach $loc (@locId){ if ($want eq $loc){$Lok=1;push(@wantNum,$ptr_id2num{"$loc"}); last;}} if (! $Lok){ print "-*- WARNING $sbrName wanted id '$want' not in '$fileInLoc'\n";}} # ------------------------------ # NOW we have all numbers to get # sort the array @wantNum= sort bynumber (@wantNum); # too many wanted if (defined @wantNum && ($wantNum[$#wantNum] > $locNum[$#locNum])){ $#tmp=0; foreach $want (@wantNum){ if ($want <= $locNum[$#locNum]){ push(@tmp,$want)} else { print "-*- WARNING $sbrName no $want not in '$fileInLoc'\n"; exit; }} @wantNum=@tmp;} @wantNum=@locNum if ($LreadAll); if ($#wantNum==0){ print "*** ERROR $sbrName nothing to read ???\n"; return(0);} # sort the array, again @wantNum= sort bynumber (@wantNum); # ------------------------------ # assign pointers to final output foreach $it (1..$#wantNum){ $numWant=$wantNum[$it]; $ptr_numWant2numFin[$numWant]=$it; $ptr_numFin2numWant[$it]= $numWant;} # ------------------------------ # get blocks to take $wantLast=$wantNum[$#wantNum];$#wantBlock=0; foreach $ctBlock (1..$nmaxBlocks){ $beg=1+($ctBlock-1)*70; $end=$ctBlock*70; last if ($wantLast < $beg); $Ltake=0; foreach $num(@wantNum){ if ( ($beg<=$num)&&($num<=$end) ){ $Ltake=1; last;}} if ($Ltake){ $wantBlock[$ctBlock]=1;} else{ $wantBlock[$ctBlock]=0;}} # writes ids read $tmp{"SWISS"}=""; foreach $it (1..$#wantNum){ $num=$wantNum[$it]; $tmp{"$it"}= $ptr_num2id[$num]; $tmp{"SWISS"}.="$ptr_num2id[$num]".",";} $tmp{"SWISS"}=~s/,*$//g; $tmp{"NROWS"}=$#wantNum; # ------------------------------------------------------------ # # NOTATION: # $tmp{"0",$it}= $it-th residue of guide sequnec # $tmp{$itali,$it}= $it-th residue of of ali $itali # note: itali= same numbering as in 1..$#want # i.e. NOT the position in the file # $ptr_numFin2numWant[$itali]=5 may reveal that # the itali-th ali was actually the fifth in the # HSSP file!! # # ------------------------------------------------------------ # -------------------------------------------------- # read the file finally # -------------------------------------------------- $Lok=&open_file("$fhinLoc","$fileInLoc"); if (! $Lok){print "*** ERROR $sbrName opening hssp file '$fileInLoc'\n"; return(0);} # ------------------------------ # move until first alis # ------------------------------ $ctBlock=$Lread=$#takeTmp=0; while (<$fhinLoc>){ last if ($_=~/$regexpEndAli/); # ending if ($_=~/$regexpBegAli/){ # this block to take? ++$ctBlock;$Lread=0; if ($wantBlock[$ctBlock]){ $_=~s/^[^0-9]+(\d+) -\s+(\d+).*$//; $beg=$1;$end=$2;$Lread=1; $#wantTmp=0; # local numbers foreach $num (@wantNum){ if ( ($beg<=$num) && ($num<=$end) ){ $tmp=($num-$beg)+1; print "*** $sbrName negative number $tmp,$beg,$end,\n" x 3 if ($tmp<1); push(@wantTmp,$tmp);}} next;}} next if (! $Lread); # move on next if ($_=~/$regexpSkip/); # skip line $line=$_; # -------------------- if (length($line)<52){ # no alis in line $seqNo=substr($line,1,6);$seqNo=~s/\s//g; if (! defined $seqNo{$seqNo}){ $seqNo{$seqNo}=1; push(@seqNo,$seqNo);} # NOTE: $chn,$sec,$acc are returned per residue! if (! defined $tmp{"0","$seqNo"}){ ($seqNo,$pdbNo, $tmp{"chn","$seqNo"},$tmp{"0","$seqNo"}, $tmp{"sec","$seqNo"},$tmp{"acc","$seqNo"})= &hsspRdSeqSecAccOneLine($line);} foreach $num(@wantTmp){ # add insertions if no alis $pos= $num+$beg-1; $posFin= $ptr_numWant2numFin[$pos]; $tmp{"$posFin","$seqNo"}="."; } next;} # ------------------------------ # everything fine, so read ! # ------------------------------ # -------------------- # first the HSSP stuff $seqNo=substr($line,1,6);$seqNo=~s/\s//g; if (! defined $seqNo{$seqNo}){ $seqNo{$seqNo}=1; push(@seqNo,$seqNo);} # NOTE: $chn,$sec,$acc are returned per residue! if (! defined $tmp{"0","$seqNo"}){ ($seqNo,$pdbNo, $tmp{"chn","$seqNo"},$tmp{"0","$seqNo"}, $tmp{"sec","$seqNo"},$tmp{"acc","$seqNo"})= &hsspRdSeqSecAccOneLine($line);} # -------------------- # now the alignments $alis=substr($line,52); $alis=~s/\n//g; # NOTE: @wantTmp has the positions to read in current block, # e.g. want no 75, block=71-90, => 75->4 foreach $num (@wantTmp){ $pos= $num+$beg-1; # note: beg=71 in the example above $id= $ptr_num2id[$pos]; $posFin= $ptr_numWant2numFin[$pos]; $tmp{"$posFin"}= $id; $takeTmp[$pos]= 1; print "*** $sbrName neg number $pos,$beg,$num,\n" x 3 if ($pos<1); $tmp{"seq","$posFin"}= "" if (! defined $tmp{"seq","$posFin"}); if (length($alis) < $num){ $tmp{"seq","$posFin"}.= "."; $tmp{"$posFin","$seqNo"}=".";} else { $tmp{"seq","$posFin"}.= substr($alis,$num,1); $tmp{"$posFin","$seqNo"}=substr($alis,$num,1);}}} # ------------------------------ while (<$fhinLoc>){ # skip over profiles last if ($_=~/$regexpBegIns/); } # begin reading insertion list # ---------------------------------------- # store sequences without insertions!! # ---------------------------------------- if (defined $kwd{"seqNoins"} && $kwd{"seqNoins"}){ # -------------------- $seq=""; # guide sequence foreach $seqNo(@seqNo){ $seq.=$tmp{"0","$seqNo"};} $seq=~s/[a-z]/C/g; # small caps to 'C' $tmp{"seqNoins","0"}=$seq; # -------------------- # all others (by final count!) foreach $it (1..$#wantNum){ $seq=""; foreach $seqNo(@seqNo){ $seq.=$tmp{"$it","$seqNo"};} $seq=~s/\s/\./g; # fill up insertions $seq=~tr/[a-z]/[A-Z]/; # small caps to large $tmp{"seqNoins","$it"}=$seq;} } # -------------------------------------------------- # read insertion list # # syntax of insertion list: # ....,....1....,....2....,....3....,....4 # AliNo IPOS JPOS Len Sequence # 9 58 59 5 kQLGAEi # # -------------------------------------------------- undef @insMax; # note: $insMax[$seqNo]=5 means at residue 'seqNo' foreach $seqNo (@seqNo){ # the longest insertion was 5 residues $insMax[$seqNo]=0;} while (<$fhinLoc>){ $rd=$_; last if ((! defined $kwd{"seqAli"} || ! $kwd{"seqAli"}) && (! defined $kwd{"seq"} || ! $kwd{"seq"}) ); next if ($rd =~ /AliNo\s+IPOS/); # skip key last if ($rd =~ /^\//); # end next if ($rd !~ /^\s*\d+/); # should not happen (see syntax) $rd=~s/\n//g; $line=$rd; $posIns=$rd; # current insertion from ali $pos $posIns=~s/^\s*(\d+).*$/$1/; # takeTmp[$pos]=1 if $pos to be read next if (! defined $takeTmp[$posIns] || ! $takeTmp[$posIns]); # ok -> take $line=~s/^\s*|\s*$//g; # purge leading blanks @tmp=split(/\s+/,$line); $iposIns=$tmp[2]; # residue position of insertion $seqIns= $tmp[5]; # sequence at insertion 'kQLGAEi' $nresIns=(length($seqIns) - 2); # number of residues inserted $posFin= $ptr_numWant2numFin[$posIns]; # -------------------------------------------------- # NOTE: here $tmp{"$it","$seqNo"} gets more than # one residue assigned (ref=11) # -------------------------------------------------- # change 'ACinK' -> 'ACINEWNK' $tmp{"$posFin","$iposIns"}=substr($seqIns,1,(length($seqIns)-1)); # maximal number of insertions $insMax[$iposIns]=$nresIns if ($nresIns > $insMax[$iposIns]); } close($fhinLoc); # end of reading file # -------------------------------------------------- # ------------------------------ # final sequences (not aligned) # ------------------------------ if (defined $kwd{"seq"} && $kwd{"seq"}){ foreach $it (0..$tmp{"NROWS"}){ $seq=""; foreach $seqNo(@seqNo){ $seq.=$tmp{"$it","$seqNo"};} $seq=~s/[\s\.!]//g; # replace insertions $seq=~tr/[a-z]/[A-Z]/; # all capitals $tmp{"seq","$it"}=$seq; }} # ------------------------------ # fill up insertions # ------------------------------ if (defined $kwd{"seqAli"} && $kwd{"seqAli"}){ undef %ali; # temporary for storing sequences foreach $it (0..$tmp{"NROWS"}){ $ali{$it}="";} # set for all alis # ------------------------------ foreach $seqNo(@seqNo){ # loop over residues $insMax=$insMax[$seqNo]; # loop over all alis foreach $it (0..$tmp{"NROWS"}){ # (1) CASE: no insertion if ($insMax==0){ $ali{$it}.=$tmp{"$it","$seqNo"}; next;} # (2) CASE: insertions $seqHere=$tmp{"$it","$seqNo"}; $insHere=(1+$insMax-length($seqHere)); # NOTE: dirty fill them in 'somewhere' # take first residue $ali{$it}.=substr($seqHere,1,1); # fill up with dots $ali{$it}.="." x $insHere ; # take remaining residues (if any) $ali{$it}.=substr($seqHere,2) if (length($seqHere)>1); }} # ------------------------------ # now assign to final foreach $it (0..$tmp{"NROWS"}){ $ali{$it}=~s/\s/\./g; # replace ' ' -> '.' $ali{$it}=~tr/[a-z]/[A-Z]/; # all capital $tmp{"seqAli","$it"}=$ali{$it};} undef %ali; # slim-is-in! } # ------------------------------ # save memory foreach $it (0..$tmp{"NROWS"}){ if ($it == 0){ # guide $id= $idGuide; } else { # pairs $posOriginal=$ptr_numFin2numWant[$it]; $id= $ptr_num2id[$posOriginal]; } $tmp{"$id"}= $id; foreach $seqNo (@seqNo){ undef $tmp{"$it","$seqNo"};}} undef @seqNo; undef %seqNo; undef @takeTmp; undef @idLoc; undef @want; undef @wantNum; undef @wantId; undef @wantBlock; undef %rdHeader; undef %ptr_id2num; undef @ptr_num2id; undef @ptr_numWant2numFin; undef @ptr_numFin2numWant; return(1,%tmp); } # end of hsspRdAli #============================================================================== sub hsspRdHeader { local ($fileInLoc,@kwdInLoc) = @_ ; local ($sbrName,$fhinLoc,$tmp, @kwdDefHsspTopLoc,@kwdDefHsspHdrLoc,@kwdHsspTopLoc,@kwdHsspHdrLoc,@tmp, $regexpBegHeader,$regexpEndHeader,$regexpLongId,$lenStrid,$LisLongId, %ptr,$kwd,$Lok,$Lpdb,$des,$beg,$end,$mid,$ct,$id,$strid,$ptr,$tmp); $[ =1 ; #------------------------------------------------------------------------------- # hsspRdHeader reads a HSSP header # in: $fileHssp (must exist), # @kwdInLoc = one of the default keywords # (@kwdLocHsspTop,@kwdLocHsspHeader) # in: 'nopair' surpresses reading of pair information # out: for top (e.g. NALIGN): $rd{"kwd"} # for prot (e.g. LALI): $rd{"kwd","$it"} # note: for the later number of elements (it) in # $rd{"NROWS"} # special ID=ID1, $rd{"kwd","$it"} existes for ID1 and ID2 #------------------------------------------------------------------------------- $sbrName="lib-br:hsspRdHeader";$fhinLoc="FHIN"."$sbrName";$fhinLoc=~tr/[a-z]/[A-Z]/; # file existing? if (! -e $fileInLoc || ! &is_hssp($fileInLoc) ){ print "*** ERROR $sbrName no HSSP file '$fileInLoc'\n"; return(0);} # ------------------------------ # settings describing format @kwdDefHsspTopLoc= ("PDBID","DATE","SEQBASE","PARAMETER","THRESHOLD", "REFERENCE","HEADER","COMPND","SOURCE","AUTHOR", "SEQLENGTH","NCHAIN","KCHAIN","NALIGN"); @kwdDefHsspHdrLoc= ("NR","ID","STRID","IDE","WSIM","IFIR","ILAS", "JFIR","JLAS","LALI","NGAP","LGAP","LSEQ2","ACCNUM","PROTEIN"); $regexpBegHeader= "^\#\# PROTEINS"; # begin of reading $regexpEndHeader= "^\#\# ALIGNMENTS"; # end of reading $regexpLongId= "^PARAMETER LONG-ID :YES"; # identification of long id $lenStrid= 4; # minimal length to identify PDB identifiers $LisLongId= 0; # long identifier names $ptr{"IDE"}=1;$ptr{"WSIM"}=2;$ptr{"IFIR"}=3;$ptr{"ILAS"}=4;$ptr{"JFIR"}=5;$ptr{"JLAS"}=6; $ptr{"LALI"}=7;$ptr{"NGAP"}=8;$ptr{"LGAP"}=9;$ptr{"LSEQ2"}=10; $ptr{"ACCNUM"}=11; # ------------------------------ # check input arguments $#kwdHsspTopLoc=$#kwdHsspHdrLoc=$Lpdb=$LnoPair=0; foreach $kwd (@kwdInLoc){ $Lok=0; if ($kwd eq "nopair"){ $LnoPair=1; next;} $Lpdb=1 if (! $Lpdb && ($kwd =~/^PDBID/)); foreach $des (@kwdDefHsspTopLoc) { if ($kwd eq $des){ $Lok=1; push(@kwdHsspTopLoc,$kwd); last;}} next if ($Lok || $LnoPair); foreach $des (@kwdDefHsspHdrLoc){ if ($kwd eq $des){ $Lok=1; push(@kwdHsspHdrLoc,$kwd); last;} } print "-*- WARNING $sbrName input kwd=$kwd, makes no sense??\n" if (! $Lok);} # force reading of NALI push(@kwdHsspTopLoc,"PDBID") if (! $Lpdb); # get column numbers to read # ------------------------------ # now start to read $Lok=&open_file("$fhinLoc","$fileInLoc"); if (! $Lok){print "*** ERROR $sbrName HSSP file could not be opened '$fileInLoc'\n"; return(0);} undef %tmp; # save space # ------------------------------ while ( <$fhinLoc> ) { # read top last if ($_ =~ /$regexpBegHeader/); if ($_ =~ /$regexpLongId/) { $LisLongId=1;} else{$_=~s/\n//g;$arg=$_; foreach $des (@kwdHsspTopLoc){ if ($arg =~ /^$des\s+(.+)$/){ if (defined $ok{"$des"}){ # multiple lines! $tmp="$1"."\t"; if (defined $tmp{"$des"}){ $tmp{"$des"}.=$tmp;} else{$tmp{"$des"}=$tmp;}} else {$ok{"$des"}=1;$tmp{"$des"}=$1;} if ($des=~/SEQLENGTH|NCHAIN|KCHAIN|NALIGN/){ $tmp{"$des"}=~s/^(\d+)[^0-9]+.*$/$1/;} # purge blanks last;}}}} # ------------------------------ $ct=0; # read header while ( <$fhinLoc> ) { last if ($LnoPair); # supress reading pair info last if ($_ =~ /$regexpEndHeader/); next if ($_ =~ /^ NR\./); # skip descriptors $_=~s/\n//g; $lenLine=length($_); if ($LisLongId){ $maxMid=115; $maxMid=($lenLine-56) if ($lenLine < 115); $maxEnd=109; $maxEnd=$lenLine if ($lenLine < 109); $beg=substr($_,1,56); $end=0; $end=substr($_,109) if ($lenLine >=109); $mid=substr($_,57,115); } else { $maxMid= 62; $maxMid=($lenLine-28) if ($lenLine < 90); $beg=substr($_,1,28); $end=0; $end=substr($_,90) if ($lenLine >=90); $mid=substr($_,29,90); } $end=~s/^\s*|\s*$//g; # purge leading blanks $mid=~s/^\s*|\s*$//g; # purge leading blanks # SWISS accession: hack because it may be empty! if ($lenLine > 86) { $accnum=substr($_,81,6); $accnum=~s/(\s)\s+/$1/g ; } else { $accnum=0;} # begin: counter and id $beg=~s/.+ \:\s*|\s*$//g; if (! $LisLongId) {$id=$beg;$id=~s/([^\s]+).*$/$1/; $strid=$beg;$strid=~s/$id|\s//g; } else {$id=$beg;$id=~s/(.+_\S+).*/$1/; $strid=substr($_,49,6);$strid=~s/\s//g; } $tmp=$lenStrid-1; if ( (length($strid)<$lenStrid) && ($id=~/^[0-9][A-Z0-9]{$tmp,$tmp}\s*/)){ $strid=substr($id,1,$lenStrid); } ++$ct; $tmp{"ID","$ct"}= $id; $tmp{"NR","$ct"}= $ct; $tmp{"STRID","$ct"}= $strid; # correct for ID = PDBid $tmp{"STRID","$ct"}= $id if ($strid=~/^\s*$/ && &is_pdbid($id)); $tmp{"PROTEIN","$ct"}=$end; $tmp{"ID1","$ct"}=$tmp{"PDBID"}; $tmp{"ACCNUM","$ct"}=$accnum; # middle all info $#tmp=0;@tmp=split(/\s+/,$mid); foreach $_ (@tmp) {$_=~s/\s//g;} foreach $des (@kwdHsspHdrLoc){ next if ( ! defined $ptr{"$des"}); next if ( $des =~/^ACCNUM/); $ptr=$ptr{"$des"}; $tmp{"$des","$ct"}=$tmp[$ptr]; }}close($fhinLoc); $tmp{"NROWS"}=$ct; # clean up $#kwdInLoc=$#kwdDefHsspHdrLoc=$#kwdHsspTopLoc=$#tmp= $#kwdDefHsspTopLoc=$#kwdHsspHdrLoc=0; undef %ptr; return(1,%tmp); } # end of hsspRdHeader #============================================================================== sub hsspRdSeqSecAccOneLine { local ($inLine) = @_ ; local ($sbrName,$fhinLoc,$seqNo,$pdbNo,$chn,$seq,$sec,$acc,$tmp); $[ =1 ; #------------------------------------------------------------------------------- # hsspRdSeqSecAccOneLine reads begin of one HSSP line #------------------------------------------------------------------------------- $sbrName="hsspRdSeqSecAccOneLine"; $seqNo=substr($inLine,1,6);$seqNo=~s/\s//g; $pdbNo=substr($inLine,7,5);$pdbNo=~s/\s//g; $chn= substr($inLine,13,1); $seq= substr($inLine,15,1); $sec= substr($inLine,18,1); $acc= substr($inLine,36,4);$acc=~s/\s//g; return($seqNo,$pdbNo,$chn,$seq,$sec,$acc) } # end of hsspRdSeqSecAccOneLine #============================================================================== sub is_hssp { local ($fileInLoc) = @_ ;local ($fh,$Lis); #-------------------------------------------------------------------------------- # is_hssp checks whether or not file is in HSSP format # in: $file # out: 1 if is hssp; 0 else #-------------------------------------------------------------------------------- return (0) if (! defined $fileInLoc || ! -e $fileInLoc) ; $fh="FHIN_CHECK_HSSP"; &open_file("$fh", "$fileInLoc") || return(0); $Lis=0; while ( <$fh> ) {$Lis=1 if (/^HSSP/) ; last; }close($fh); return $Lis; } # end of is_hssp #============================================================================== sub is_pdbid { local ($id) = @_ ; #-------------------------------------------------------------------------------- # is_pdbid checks whether or not id is a valid PDBid (number 3 char) # in: $file # out: 1 if is DBid, 0 else #-------------------------------------------------------------------------------- return 1 if ((length($id) <= 6) && ($id=~/^[0-9][0-9a-z]{3,3}[^0-9a-z]?/)); return 0; } # end of is_pdbid #============================================================================== sub open_file { local ($file_handle,$file_name,$log_file) = @_ ; local ($temp_name) ; #------------------------------------------------------------------------------- # open_file opens file, writes warning asf #------------------------------------------------------------------------------- $temp_name = $file_name ; $temp_name =~ s/^>>|^>//g ; if ( ($file_name =~ /^>>/ ) && ( ! -e $temp_name ) ) { print "*** INFO (open_file): append file=$temp_name, does not exist-> create it\n" ; open ($file_handle, ">$temp_name") || ( do { warn "***\t Cannot create new file: $temp_name\n" ; if ( $log_file ) { print $log_file "***\t Cannot create new file: $temp_name\n" ;} return (0); } ); close ("$file_handle") ;} open ($file_handle, "$file_name") || ( do { warn "*** ERROR lib-br:open_file: Cannot open file '$file_name'\n" ; if ( $log_file ) { print $log_file "*** lib-br:open_file: Cannot create new file '$file_name'\n" ;} return(0); } ); return(1); } # end of open_file #============================================================================== sub safWrt { local($fileOutLoc,%tmp) = @_ ; local(@nameLoc,@stringLoc,$tmp,$sbrName,$Lok); $[ =1 ; #-------------------------------------------------------------------------------- # safWrt writing an SAF formatted file of aligned strings # in: $fileOutLoc output file # = "STDOUT" -> write to screen # in: $tmp{"NROWS"} number of alignments # in: $tmp{"id", "$it"} name for $it # in: $tmp{"seq","$it"} sequence for $it # in: $tmp{"PER_LINE"} number of res per line (def=50) # in: $tmp{"HEADER"} 'line1\n,line2\n'.. # with line1= '# NOTATION ..' # out: 1|0,msg implicit: file # err: ok-> 1,ok | error -> 0,message #-------------------------------------------------------------------------------- $sbrName="lib-br:safWrt"; $fhoutLoc="FHOUT_safWrt"; # check input return(0,"*** ERROR $sbrName: no acceptable output file ($fileOutLoc) defined\n") if (! defined $fileOutLoc || length($fileOutLoc)<1 || $fileOutLoc !~/\w/); return(0,"*** ERROR $sbrName: no input given (or not input{NROWS})\n") if (! %tmp || ! defined $tmp{"NROWS"} ); return(0,"*** ERROR $sbrName: tmp{NROWS} < 1\n") if ($tmp{"NROWS"} < 1); $tmp{"PER_LINE"}=50 if (! defined $tmp{"PER_LINE"}); $fhoutLoc="STDOUT" if ($fileOutLoc eq "STDOUT"); # ------------------------------ # open new file if ($fhoutLoc ne "STDOUT") { &open_file("$fhoutLoc",">$fileOutLoc") || return(0,"*** ERROR $sbrName: failed opening fileOut=$fileOutLoc\n"); } # ------------------------------ # write header # ------------------------------ print $fhoutLoc "# SAF (Simple Alignment Format)\n","\# \n"; print $fhoutLoc $tmp{"HEADER"} if (defined $tmp{"HEADER"}); # ------------------------------ # write data into file # ------------------------------ for($itres=1; $itres<=length($tmp{"seq","1"}); $itres+=$tmp{"PER_LINE"}){ foreach $itpair (1..$tmp{"NROWS"}){ printf $fhoutLoc "%-20s",$tmp{"id","$itpair"}; # chunks of $tmp{"PER_LINE"} $chunkEnd=$itres + ($tmp{"PER_LINE"} - 1); foreach $itchunk ($itres .. $chunkEnd){ last if (length($tmp{"seq","$itpair"}) < $itchunk); print $fhoutLoc substr($tmp{"seq","$itpair"},$itchunk,1); # add blank every 10 print $fhoutLoc " " if ($itchunk != $itres && (int($itchunk/10)==($itchunk/10))); } print $fhoutLoc "\n"; } print $fhoutLoc "\n"; } print $fhoutLoc "\n"; close($fhoutLoc); $#nameLoc=$#stringLoc=0; # save space return(0,"*** ERROR $sbrName: failed to write file $fileOutLoc\n") if (! -e $fileOutLoc); return(1,"ok $sbrName"); } # end of safWrt #============================================================================== # library collected (end) #============================================================================== 1; librg-utils-perl-1.0.43/lib/RG/Utils/Copf.pm0000644015075101507510000133402711640615221015344 00000000000000=pod =head1 NAME RG::Utils::Copf - Rost Lab perl utilities =head1 SYNOPSIS use RG::Utils::Copf; =head1 FUNCTIONS See module source for description. =over =item amino_acid_convert_3_to_1 =item amino_acid_convert_3_to_1_ini =item brIniErr =item brIniGetArg =item brIniHelp =item brIniHelpLoop =item brIniHelpRdItself =item brIniRdDef =item brIniSet =item brIniWrt =item bynumber =item bynumber_high2low =item cleanUp =item complete_dir =item completeDir =item convAliGen =item convDsspGen =item convFastamul2many =item convFssp2Daf =item convFsspGen =item convGcg2fasta =item convHssp2seq =item convHsspGen =item convMsf2saf =item convPdb2seq =item convPdbGen =item convPhd2dssp =item convPhd2seq =item convPhdGen =item convPir2fasta =item convPirmulGen =item convSaf2many =item convSeq2fastaPerl =item convSeq2seq =item convSeq2seqOld =item convSeqGen =item convSwiss2fasta =item copf =item dsspGetChain =item dsspRdSeq =item dsspWrtFromPhd =item errSbr =item errSbrMsg =item fastaRdGuide =item fastaRdMul =item fastaWrt =item fastaWrtMul =item fctRunTimeLeft =item fctSeconds2time =item gcgRd =item gcgWrt =item getDistanceNewCurveIde =item getFileFormatQuick =item get_in_keyboard =item get_range =item get_rangeHyphen =item getSysARCH =item hsspCorrectNali =item hsspGetChain =item hsspGetChainLength =item hsspRdAli =item hsspRdHeader =item hsspRdSeqSecAccOneLine =item ini =item iniDef =item iniHelpLoc =item is_chain =item isDaf =item is_dssp =item isFasta =item isFastaMul =item is_fssp =item isGcg =item is_hssp =item isMsf =item isPdb =item is_pdbid =item isPhdAcc =item isPhdBoth =item isPhdHtm =item isPhdSec =item isPir =item isPirMul =item is_ppcol =item isRdb =item is_rdb_htmref =item is_rdb_htmtop =item is_rdb_nnDb =item isSaf =item is_strip =item isSwiss =item msfBlowUp =item msfCheckFormat =item msfCompress =item msfCountNali =item msfRd =item msfShorten =item msfWrt =item open_file =item pdbExtrSequence =item pirRdMul =item pirWrtMul =item pirWrtOne =item rdRdbAssociative =item rdRdbAssociativeNum =item safCompress =item safRd =item safWrt =item seqGenWrt =item swissRdSeq =item sysDate =item sysGetUserLoc =item sysRunProg =item wrtLoc =back =head1 VARIABLES =over =back =head1 AUTHOR B. Rost L. Kajan =head1 SEE ALSO =over =item Main website L =back =cut package RG::Utils::Copf; use Carp qw| cluck :DEFAULT |; use File::Temp; no warnings 'deprecated'; #------------------------------------------------------------------------------# # Copyright 1998 # # Burkhard Rost rost@EMBL-Heidelberg.DE # # Wilckensstr. 15 http://www.embl-heidelberg.de/~rost/ # # D-69120 Heidelberg # # version 0.1 May, 1998 # #------------------------------------------------------------------------------# INIT: { #====================================================================== # Read environment parameters #====================================================================== # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $scrName=$0; $scrName=~s/^.*\/|\.pl//g; $scrGoal= "copff: converts protein file formats"; $scrIn= "toConvert toConvTo|files* format-out"; # $scrNarg= 2; # minimal number of input arguments # additional information about script $okFormOut= "hssp,dssp,msf,saf,daf,fastamul,pirmul,fasta,pir,gcg"; $okFormIn= "hssp,dssp,fssp,msf,saf,fastamul,pirmul,fasta,pir,gcg,phdrdb,swiss,pdb"; @okFormOut=split(/,/,$okFormOut);@okFormIn=split(/,/,$okFormIn); $okFormOutOr=join('|',@okFormOut);$okFormInOr=join('|',@okFormIn); $scrHelpTxt= "Formats supported: \n"; $scrHelpTxt.=" * Input: ". $okFormOut."\n"; $scrHelpTxt.=" * Output: ". $okFormIn ."\n"; $scrHelpTxt.=" \n"; $scrHelpTxt.="Several ways to run the script:\n"; $scrHelpTxt.="in: 'file.msf file.hssp' -> convert MSF to HSSP (assigned according to extensions)\n"; # $scrHelpTxt.="in: '*.msf hssp' -> all input MSF files converted to HSSP\n"; $scrHelpTxt.="in: 'file.listx hssp list'-> all files listed in 'file.list' converted to HSSP\n"; $scrHelpTxt.=" NOTE: the keyword 'list' makes things easier for me...\n"; $scrHelpTxt.=" if file named *.list, list is assumed!!\n"; $scrHelpTxt.="in: '*.f fastamul' -> many FASTAs converted to one big FASTAmul (e.g. database)\n"; $scrHelpTxt.="in: '' -> \n"; $scrHelpTxt.=" \n"; $scrHelpTxt.="Note 1: if your alignment format is none of the above, I suggest you convert it to\n"; $scrHelpTxt.=" the SAF format (see 'help saf' and 'help saf-syn'), which is the simplest.\n"; $scrHelpTxt.=" \n"; $scrHelpTxt.="Note 2: Sorry for inconveniences, writing this 'shit' was boring and time consuming\n"; $scrHelpTxt.=" -> for many conversions A -> B you will have to run the program repetively:\n"; $scrHelpTxt.=" A -> A1 , A1 -> A2, A2 -> B ...\n"; $scrHelpTxt.=" \n"; $scrHelpTxt.="Further options may be obtained by 'help FORMAT' ...\n"; $scrHelpTxt.=" \n"; # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } #=============================================================================== sub copf { $[ =1 ; #------------------------------------------------------------------------------- # copf package version of script #------------------------------------------------------------------------------- $[ =1 ; # sets array count to start at 1, not at 0 @PARAMS=@_; # pass from calling ($Lok,$msg)= &ini(); # initialise variables if (! $Lok){ Carp::confess("--> ERROR during initialising $scrName \nmsg=$msg"); } #------------------------------------------------------------------------------- # do the job (here we go) #------------------------------------------------------------------------------- # general assignments to reduce typing $formIn= $par{"formatIn"}; $extIn= $par{"ext_$formIn"}; $formOut=$par{"formatOut"}; $extOut=$par{"ext_$formOut"}; $fh="STDOUT" if ($Lverb); $fh=$fhTrace if (! $Lverb); $nfileIn=$#fileIn; $itFile=0; # -------------------------------------------------- # alignments # -------------------------------------------------- # ------------------------------ if ($formIn eq "hssp"){ # in: HSSP while (@fileIn) { ++$itFile; $fileIn=shift @fileIn; $fileOutDef=shift @fileOutDef; next if (! $par{"doAgain"} && -e $fileOutDef); &wrtLoc($fh) if ($par{"verbose"}); ($Lok,$msg)= &convHsspGen($fileIn,$chainIn[$itFile],$fileOutDef,$formOut,$extOut, $par{"exeConvertSeq"},$par{"exeConvHssp2saf"}, $par{"doExpand"},$par{"frag"},$par{"extr"}, $par{"fileOutScreen"},$par{"dirWork"},$fhTrace,$par{"doSplitChain"}); print $fh "*** ERROR $scrName after convHsspGen\n","*** $msg\n" if (! $Lok || $Lok==2);}} # ------------------------------ elsif ($formIn eq "fssp"){ # in: FSSP while (@fileIn) { ++$itFile; $fileIn=shift @fileIn; $fileOutDef=shift @fileOutDef; next if (! $par{"doAgain"} && -e $fileOutDef); &wrtLoc($fh) if ($par{"verbose"}); ($Lok,$msg)= &convFsspGen($fileIn,$fileOutDef,$formOut,$extOut,$par{"exeFssp2daf"}, $par{"fileInclProt"},$par{"dirDssp"},$par{"dirWork"},$fhTrace); print $fh "*** ERROR $scrName after convFsspGen\n","*** $msg\n" if (! $Lok || $Lok==2);}} # ------------------------------ # in: MSF|SAF|FASTAmul elsif ($formIn eq "msf" || $formIn eq "saf" || $formIn eq "fastamul" || $formIn eq "pirmul"){ while (@fileIn) { ++$itFile; $fileIn=shift @fileIn; $fileOutDef=shift @fileOutDef; next if (! $par{"doAgain"} && -e $fileOutDef); &wrtLoc($fh) if ($par{"verbose"}); ($Lok,$msg)= &convAliGen($fileIn,$fileOutDef,$formIn,$formOut,$extOut, $par{"exeConvertSeq"},$par{"fileMatGcg"},$par{"doCompress"}, $par{"frag"},$par{"extr"},$par{"fileOutScreen"},$par{"dirWork"},$fhTrace); print $fh "*** ERROR $scrName after convAliGen\n","*** $msg\n" if (! $Lok || $Lok==2);} } # change br 99-03 : commented out, since included in previous! # # ------------------------------ # elsif ($formIn eq "pirmul"){ # in: PIRMUL # while (@fileIn) { # ++$itFile; $fileIn=shift @fileIn; $fileOutDef=shift @fileOutDef; # next if (! $par{"doAgain"} && -e $fileOutDef); # &wrtLoc($fh) if ($par{"verbose"}); # ($Lok,$msg)= # &convPirmulGen($fileIn,$fileOutDef,$formOut,$extOut, # $par{"frag"},$par{"extr"},$par{"dirWork"},$fhTrace); # print $fh "*** ERROR $scrName after convPirmulGen\n","*** $msg\n" if (! $Lok || $Lok==2);}} # -------------------------------------------------- # sequences # -------------------------------------------------- # ------------------------------ # in: FASTA, SWISS, PIR, GCG elsif ($formIn eq "fasta" || $formIn eq "swiss" || $formIn eq "pir" || $formIn eq "gcg"){ while (@fileIn) { ++$itFile; $fileIn=shift @fileIn; $fileOutDef=shift @fileOutDef; next if (! $par{"doAgain"} && -e $fileOutDef); &wrtLoc($fh) if ($par{"verbose"}); # out: ali if ($formOut eq "hssp"){ ($Lok,$msg)= &convAliGen($fileIn,$fileOutDef,$formIn,$formOut,$extOut, $par{"exeConvertSeq"},$par{"fileMatGcg"},$par{"doCompress"}, $par{"frag"},$par{"extr"},$par{"fileOutScreen"},$par{"dirWork"},$fhTrace); print $fh "*** ERROR $scrName after convAliGen\n","*** $msg\n" if (! $Lok || $Lok==2); } # out: sequence else { ($Lok,$msg)= &convSeqGen($fileIn,$fileOutDef,$formIn,$formOut,$extOut, $par{"exeConvertSeq"},$par{"frag"},$par{"fileOutScreen"}, $par{"dirWork"},$fhTrace); print $fh "*** ERROR $scrName after convSeqGen\n","*** $msg\n" if (! $Lok || $Lok==2);}}} # ------------------------------ # in: PDB elsif ($formIn eq "pdb"){ if ($formOut !~ /^(fasta|pir|gcg)/){ print $fh "*** ERROR $scrName supported only PDB -> FASTA|PIR|GCG\n"; Carp::confess("*** ERROR $scrName supported only PDB -> FASTA|PIR|GCG");} while (@fileIn) { ++$itFile; $fileIn=shift @fileIn; $fileOutDef=shift @fileOutDef; next if (! $par{"doAgain"} && -e $fileOutDef); $chainIn=0; $chainIn=shift @chainIn if (@chainIn); &wrtLoc($fh) if ($par{"verbose"}); ($Lok,$msg)= &convPdbGen($fileIn,$chainIn,$fileOutDef,$formOut,$extOut, $par{"exeConvertSeq"},$par{"frag"},$par{"dirWork"},$fhTrace); print $fh "*** ERROR $scrName after convPdbGen\n","*** $msg\n" if (! $Lok || $Lok==2);}} # ------------------------------ elsif ($formIn eq "dssp"){ # in: DSSP if ($formOut !~ /^(fasta|pir|saf|msf|hssp)/){ # print $fh "*** ERROR $scrName supported only DSSP -> FASTA|PIR|MSF|SAF2\n"; Carp::confess("*** ERROR $scrName supported only DSSP -> FASTA|PIR|MSF|SAF2");} while (@fileIn) { ++$itFile; $fileIn=shift @fileIn; $fileOutDef=shift @fileOutDef; next if (! $par{"doAgain"} && -e $fileOutDef); $chainIn=0; $chainIn=shift @chainIn if (@chainIn); &wrtLoc($fh) if ($par{"verbose"}); ($Lok,$msg)= &convDsspGen($fileIn,$chainIn,$fileOutDef,$formOut,$extOut, $par{"exeConvertSeq"},$par{"fileMatGcg"}, $par{"frag"},$par{"fileOutScreen"},$par{"dirWork"},$fhTrace, $par{"doSplitChain"}); print $fh "*** ERROR $scrName after convDsspGen\n","*** $msg\n" if (! $Lok || $Lok==2);}} # -------------------------------------------------- # PHD predictions # -------------------------------------------------- # ------------------------------ # in: PHDrdb elsif ($formIn =~ /^phdrdb/) { while (@fileIn) { ++$itFile; $fileIn=shift @fileIn; $fileOutDef=shift @fileOutDef; next if (! $par{"doAgain"} && -e $fileOutDef); $chainIn=0; $chainIn=shift @chainIn if (@chainIn); &wrtLoc($fh) if ($par{"verbose"}); # out: msf if ($formOut =~ /^(saf|msf)$/) { print $fh "*** option PHD -> $formOut not implemented, yet!\n"; Carp::confess("*** option PHD -> $formOut not implemented, yet!"); } # out: DSSP, nicer, HTML, .. else { ($Lok,$msg)= &convPhdGen($fileIn,$chainIn,$fileOutDef,$formIn,$formOut,$extOut, $par{"frag"},$par{"fileOutScreen"},$par{"dirWork"},$fhTrace); print $fh "*** ERROR $scrName after convPhdGen\n","*** $msg\n" if (! $Lok || $Lok==2); }}} # ************************************************** # unrecognised input format # ************************************************** else { Carp::confess("*** ERROR $scrName input format $formIn not supported");} #------------------------------------------------------------------------------- # work done, go home #------------------------------------------------------------------------------- # ------------------------------ # deleting intermediate files &cleanUp() if (! $par{"debug"}); # ------------------------------ # final words if ($Lverb) { $timeEnd=time; # runtime , run time $timeRun=$timeEnd-$timeBeg; if( $par{debug} ){ cluck "--- $scrName ended on $Date (run time=".&fctSeconds2time($timeRun).")"; } # ------------------------------ # output files if( $par{debug} ) { if ($#fileOut==1){ printf STDERR "--- %-20s %-s\n","output file:",$fileOut[1];} elsif ($#fileOut > 10){ printf STDERR "--- %-20s %-s\n","output files:",""; foreach $file (@fileOut){ print STDERR "$file," if (-e $file);} print STDERR "\n"; } elsif ($#fileOut > 0){ print STDERR "--- output files:"; foreach $_(@fileOut){ printf STDERR "--- %-20s %-s\n"," ",$_ if (-e $_);}} } } return(1,"ok $sbrName"); } # end of copf #=============================================================================== sub ini { $[ =1 ; #------------------------------------------------------------------------------- # initialises variables/arguments #------------------------------------------------------------------------------- $sbrName="$scrName".":ini"; # ------------------------------ foreach $arg(@PARAMS){ # highest priority arguments next if ($arg !~/=/); if ($arg=~/dirLib=(.*)$/) { $dir= $1;} elsif ($arg=~/dirHome=(.*)$/i) { $par{"dirHome"}= $1;} elsif ($arg=~/ARCH=(.*)$/) { $ARCH= $1;} elsif ($arg=~/PWD=(.*)$/) { $PWD= $1;} elsif ($arg=~/^packName=(.*)/) { $par{"packName"}=$1; shift @PARAMS if ($PARAMS[1] eq $arg); } } # ****************************** # ERROR return(&errSbrMsg("after $0:", "missing dirHome, please add the command line option:\n". "dirHome=THE_PATH_WHERE_THIS_SCRIPT_SITS",$SBR)) if( !$par{dirHome} || !-e $par{dirHome} ); # ------------------------------ # get architecture $ARCH= $ARCH=$ARCH || &getSysARCH(); $PWD= $ENV{'PWD'} if (! defined $PWD && defined $ENV{'PWD'}); $PWD=~s/\/$// if (defined $PWD && $PWD=~/\/$/); $pwd= $PWD if (defined $PWD); $pwd.="/" if (defined $pwd && $pwd !~ /\/$/); # ------------------------------ $timeBeg= time; # date and time $Date= &sysDate(); # ------------------------------ # first settings for parameters &iniDef(); # NOTE: may be overwritten by DEFAULT file!!!! # ------------------------------ # HELP stuff &iniHelpLoc(); ($Lok,$msg)= # want help? &brIniHelpLoop($scrName,%tmp); return(&errSbrMsg("after lib-ut:brIniHelpLoop",$msg,$SBR)) if (! $Lok); exit if ($msg eq "fin"); # ------------------------------ # read command line input $#fileIn=0; @argUnk= # standard command line handler &brIniGetArg(); $LuseBigConvertSeq=0; foreach $arg (@argUnk){ # interpret specific command line arguments next if ($arg=~/^(dirLib|ARCH|PWD|packName)=/); if ($arg=~/^verb\w*2/) {$par{"verb2"}=$Lverb2= 1;} elsif ($arg=~/^verbose/) {$par{"verbose"}=$Lverb= 1;} elsif ($arg=~/not_?([vV]er|[sS]creen)/ ) {$par{"verbose"}=$Lverb= 0; } elsif ($arg=~/^expand$/i) {$par{"doExpand"}= 1;} elsif ($arg=~/^compress$/i) {$par{"doCompress"}= 1;} elsif ($arg=~/^nocompr?e?s?s?$/i) {$par{"doCompress"}= 0;} elsif ($arg=~/^list$/i) {$par{"isList"}= 1;} elsif ($arg=~/^skip$/i) {$par{"doAgain"}= 0;} elsif ($arg=~/^big$/i) {$LuseBigConvertSeq= 1;} elsif ($arg=~/^split$/i) {$par{"doSplitChain"}= 1;} elsif ($arg=~/^de?bu?g$/i) {$par{"debug"}= 1;} elsif ($arg =~/^formatIn=(.*)$/) {$par{"formatIn"}=$formIn=$1;} elsif ($arg =~/^formatOut=(.*)$/) {$par{"formatOut"}=$formOut=$1;} elsif ($arg=~/^(hssp|msf|dssp|fssp|saf|daf|fastamul|pirmul|swiss|fasta|pir|gcg)$/i){ $par{"formatOut"}=$1; $par{"formatOut"}=~tr/[A-Z]/[a-z]/;} elsif ($arg=~/^fileOut=(.+)$/) {$par{"fileOut"}=$fileOut=$1;} # process chains (PDB) elsif ($arg=~/^(.*)($par{"ext_pdb"}|\.brk)\_([A-Z0-9])/){ return(0,"*** ERROR $sbrName: kwd=$arg not correct syntax (use:file.pdb_C)\n") if (! defined $1 || ! -e $1); next if (length($1)<2 || ! -e $1); push(@fileIn,$1);push(@chainIn,$2);} # process chains (dssp) elsif ($arg=~/^(.*$par{"ext_dssp"})\_([A-Z0-9])/){ return(0,"*** ERROR $sbrName: kwd=$arg not correct syntax (use:file.dssp_C)\n") if (! defined $1 || ! -e $1); next if (length($1)<2 || ! -e $1); push(@fileIn,$1);push(@chainIn,$2);} # process chains (hssp) elsif ($arg=~/^(.*$par{"ext_hssp"})\_([A-Z0-9])/){ return(0,"*** ERROR $sbrName: kwd=$arg not correct syntax (use:file.hssp_C)\n") if (! defined $1 || ! -e $1); next if (length($1)<2 || ! -e $1); push(@fileIn,$1);push(@chainIn,$2);} elsif ($arg eq $PARAMS[2]){ # to enable calling by 'copf 1ppt.hssp 1ppt.daf' next;} elsif ($arg=~/^expand$/i) {$par{"doExpand"}= 1;} else { return(0,"*** ERROR $sbrName: '$arg' file does not exist or kwd not understood\n");}} # ------------------------------ # replace binary # if ($LuseBigConvertSeq){ # $par{"exeConvertSeq"}=$par{"exeConvertSeqBig"}; # if (! -e $par{"exeConvertSeq"} && ! -l $par{"exeConvertSeq"}){ # print # "*** you want the BIG for convert_seq.$ARCH(". # $par{"exeConvertSeq"}."), however none there!\n"; # exit;}} # ------------------------------ # output file given? $fileOut=$par{"fileOut"} if (defined $par{"fileOut"} && $par{"fileOut"} && $par{"fileOut"} ne "unk"); # ------------------------------ # correct blabla levels $par{"verbose"}=$par{"verb2"}=1 if ($par{"debug"}); # ------------------------------ # require packages # ------------------------------ # foreach $exe ("exeConvHssp2saf","exeFssp2daf") { # next if ($par{"$exe"}=~/\.pl/); # if (! -e $par{"$exe"}){ # print "*** WARN or ERROR (?) $scrName: failed to find package ",$par{"$exe"},"\n"; # next; } # $Lok= require $par{"$exe"}; # Carp::confess("*** $scrName: failed to require perl package '".$par{"$exe"}."'\n") if (! $Lok);} # -------------------------------------------------- # digest input file formats # -------------------------------------------------- return(0,"*** ERROR $sbrName: no input file given!!\n") if ($#fileIn==0); # any file ending with 'list'? foreach $fileIn (@fileIn){ if ($fileIn =~ /\.list/) { $par{"isList"}=1; last;}} if (defined $par{"isList"} && $par{"isList"} eq "1"){ # input is file list &open_file("$fhin","$fileIn[1]") || return(0,"*** ERROR $sbrName: failed to open fileIn=$fileIn\n"); $#fileIn=$#chainIn=$#dir=0; while (<$fhin>) { $_=~s/\s|\n//g;$file=$_; # for DSSP and HSSP: digest chains if ($file =~ /^(.*)($par{"ext_hssp"}|$par{"ext_dssp"})\_([A-Z0-9])$/){ $file=$1.$2;$chain=$3;} else {$chain="*";} # add dir if file not existing (hssp) if (! -e $file && $file =~ /^.*$par{"ext_hssp"}/){ if (! $#dir){@tmp=split(/,/,$par{"dirHssp"}); foreach $tmp(@tmp){ push(@dir,&complete_dir($tmp)) if (-d $tmp);}} foreach $dir (@dir){ $tmp=$dir.$file; if (-e $tmp){$file=$tmp; last;}}} # add dir if file not existing (dssp) elsif (! -e $file && $file =~ /^.*$par{"ext_dssp"}/){ if (! $#dir){@tmp=split(/,/,$par{"dirDssp"}); foreach $tmp(@tmp){ push(@dir,&complete_dir($tmp)) if (-d $tmp);}} foreach $dir (@dir){ $tmp=$dir.$file; if (-e $tmp){$file=$tmp; last;}}} if (! -e $file){ print "-*- WARN $sbrName no file=$file, (ignored)\n" if ($par{"verbose"}); next;} push(@fileIn,$file);push(@chainIn,$chain);}close($fhin);} # -------------------------------------------------- # watch chain if not provided in list! else { foreach $it (1..$#fileIn){ $chainIn[$it]="*" if (! defined $chainIn[$it]);}} # ------------------------------ # determine input format if( !$par{formatIn} ) { ($Lok,$msg) = &getFileFormatQuick($fileIn[1]); if (! $Lok || $msg =~ /ERROR/ || length($msg)>10 || length($msg)<3) { return(0,"*** ERROR $sbrName: could not determine format for file list ($fileIn[1])\n"); } $par{"formatIn"}=$msg; if( $par{debug} ){ cluck("guessed file format of '$fileIn[1]': $par{formatIn}"); } } $par{"formatIn"}=~tr/[A-Z]/[a-z]/; # case FSSP : you must have DSSP directory if ($par{"formatIn"} eq "fssp"){ @tmp=split(/,/,$par{"dirDssp"});$Lok=0; foreach $dir (@tmp){ if (-d $dir){$Lok=1;$par{"dirDssp"}=$dir;$par{"dirDssp"}.="/" if ($dir !~/\/$/); last;}} return(0,"*** ERROR $sbrName: for FSSP you must provide the directory for the DSSP\n". "*** database by the argument 'dirDssp=/home/data/dssp'\n") if (!$Lok);} # ------------------------------ # input format supported? if ($par{"formatIn"} !~ /^($okFormInOr)$/ && $par{"formatIn"} !~ /^phdrdb/i ) { my $msg = "*** ERROR $sbrName: input format '".$par{"formatIn"}."' (of files in $fileIn[1]) unsupported\n"; cluck( $msg ); return(0,$msg); } # ------------------------------ $#tmpx=0; # security: allow only files with same format as first foreach $file (@fileIn[2..$#fileIn]){ ($Lok,$msg)=&getFileFormatQuick($file); next if ($msg !~/$par{"formatIn"}/i); next if (! defined $file); push(@tmpx,$file);} @fileIn=($fileIn[1],@tmpx); # ------------------------------ # determine output format # (1) not provided, but 2nd arg = file.WANTED_CONVERSION if (! defined $par{"formatOut"} || length($par{"formatOut"})<2 || $par{"formatOut"} eq "unk"){ $fileOut=$PARAMS[2]; $par{"formatOut"}=$fileOut; $par{"formatOut"}=~s/^.*\.([^\.]+)$/$1/; $par{"formatOut"}=~tr/[A-Z]/[a-z]/;} # ------------------------------ # output format supported? return(0,"*** ERROR $sbrName: output format '".$par{"formatOut"}."' unsupported\n") if ($par{"formatOut"} !~ /^($okFormOutOr)$/); # ------------------------------ # final settings $Lok= # standard settings &brIniSet(); return(0,"*** ERROR $sbrName: after lib-ut:brIniSet\n") if (! $Lok); $#fileOut=0; # reset output files $#fileOutDef=0; # standard output names # note: for single input file: name already assigned if (! defined $fileOut){ $ct=0; foreach $fileIn (@fileIn){ $formIn= $par{"formatIn"}; # special for Brookhaven: if ($formIn eq "pdb" && $fileIn =~/\.brk/) { $extIn=".brk";} else { $extIn= $par{"ext_$formIn"};} $formOut=$par{"formatOut"}; $extOut=$par{"ext_$formOut"}; $extOut= $par{"ext_dsspPhd"} if ($formIn=~/phdrdb/ && $formOut=~/^dssp/); $fileOut=$fileIn; # purge dir $fileOut=~s/^.*\///g; # replace extension $fileOut=~s/(\.f(asta)?(mul)?|\.pirmul|$extIn(_.)?)$/$extOut/i; # add dirOut $fileOut=$par{"dirOut"}.$fileOut; ++$ct; $fileOut=~s/$extOut$/$par{"ext_chain"}$chainIn[$ct]$extOut/ if ($formIn =~/[hd]ssp/ && defined $chainIn[$ct] && $chainIn[$ct] =~/[A-Z0-9]/); # security $fileOut.=".tmp" if ($fileOut eq $fileIn); push(@fileOutDef,$fileOut);}} else{ $formOut=$par{"formatOut"}; # security $fileOut.=".tmp" if (defined $fileIn && $fileOut eq $fileIn); push(@fileOutDef,$fileOut);} # correction for single: add file name $par{"fileOut"}=$fileOut if ($#fileOutDef==1 && $par{"fileOut"} !~ $par{"ext_".$formOut}); # correct settings for executables: add directories if (0){ foreach $kwd (keys %par){ next if ($kwd !~/^exe/); next if (-e $par{$kwd} || -l $par{$kwd}); } } # ------------------------------ # check errors $exclude= "exeFssp2daf,exeConvHssp2saf,exeConvertSeqBig"; # yy to exclude from error check ($Lok,$msg)= # &brIniErr($exclude); return(0,"*** ERROR $sbrName: after lib-ut:brIniErr\n".$msg) if (! $Lok); # yy # yy add syntax check # yy # ------------------------------ # massage temporary files if( $par{"dirWork"} && $par{"dirWork"} ne "unk" && length($par{"dirWork"}) > 0) { $par{"fileOutTrace"}= $par{"dirWork"}.$par{"fileOutTrace"} if ($par{"fileOutTrace"} !~ /$par{"dirWork"}/ && defined $par{"fileOutTrace"} && $par{"fileOutTrace"} ne "unk" && length($par{"fileOutTrace"}) > 0); $par{"fileOutScreen"}=$par{"dirWork"}.$par{"fileOutScreen"} if ($par{"fileOutScreen"} !~ /$par{"dirWork"}/ && defined $par{"fileOutScreen"} && $par{"fileOutScreen"} ne "unk" && length($par{"fileOutScreen"}) > 0); } # -------------------------------------------------- # trace file # -------------------------------------------------- if( $par{"fileOutTrace"} && $par{"fileOutTrace"} ne "unk" && length($par{"fileOutTrace"}) > 0) { print "--- \t open $fhTrace for trace file ",$par{"fileOutTrace"}," \n" if ($Lverb2); &open_file("$fhTrace",">$par{fileOutTrace}") || return(&errSbr("failed to open new file for trace : ".$par{"fileOutTrace"},$SBR));} else { $fhTrace="STDOUT";} $fhTrace="STDOUT" if ($par{"debug"}); # ------------------------------ # write settings # ------------------------------ if ($par{"verb2"}){ $exclude="kwd,dir*,ext*"; # keyword not to write $fhloc="STDOUT"; $fhloc=$fhTrace if (! $par{"debug"}); ($Lok,$msg)= &brIniWrt($exclude,$fhloc); return(&errSbrMsg("after lib-ut:brIniWrt",$msg,$SBR)) if (! $Lok); } # ------------------------------ undef %tmp; # clean memory return(1,"ok $sbrName"); } # end of ini #=============================================================================== sub iniDef { $[ =1 ; #------------------------------------------------------------------------------- # iniDef initialise defaults #------------------------------------------------------------------------------- # d.d # -------------------- # directories # <<<<<<<<<<<<<<<<<<<< # normal $par{"dirSrc"}= $par{"dirHome"}. "/lib/"; # all source except for binaries $par{"dirSrcMat"}= $par{"dirSrc"}. "mat/"; # general material # perl libraries $par{"dirPerl"}= $par{"dirSrc"}. "perl/" if (! defined $par{"dirPerl"}); $par{"dirPerlScr"}= $par{"dirPerl"}. "scr/"; # perl scripts needed $par{"dirBin"}= $par{"dirHome"}. "/bin/"; # FORTRAN binaries of programs needed # lkajan: there's got to be a better way to do this # if ($0=~/maxhom/){ # $par{"dirSrc"}= $par{"dirHome"}. "scr/"; # all source except for binaries # $par{"dirSrcMat"}= $par{"dirHome"}. "mat/"; # general material # $par{"dirPerl"}= $par{"dirHome"}. "scr/" if (! defined $par{"dirPerl"}); # $par{"dirPerlScr"}= $par{"dirHome"}. "scr/"; # perl scripts needed # } # <<<<<<<<<<<<<<<<<<<< # for porting PHD asf # lkajan: there's got to be a better way to do this # if( $0=~/phd/ ){ # $par{"dirSrcMat"}= "/nfs/home1/yachdav/work/SNAP/phd/". "mat/"; # general material # $par{"dirPerl"}= "/nfs/home1/yachdav/work/SNAP/phd/". "scr/"; # perl libraries # $par{"dirPerlScr"}= "/nfs/home1/yachdav/work/SNAP/phd/". "scr/"; # perl scripts needed # $par{"dirBin"}= "/nfs/home1/yachdav/work/SNAP/phd/". "bin/"; # FORTRAN binaries of programs needed # } # elsif( $0=~/prof/ ){ $par{"dirSrcMat"}= "$par{dirHome}/mat/"; # general material #$par{"dirPerl"}= "$par{dirHome}embl/scr/"; # perl libraries # lkajan: deprecated #$par{"dirPerlScr"}= "$par{dirHome}embl/scr/"; # perl scripts needed # lkajan: wrong $par{"dirBin"}= "/usr/bin/"; # FORTRAN binaries of programs needed # } $par{"dirPerlPack"}= $par{"dirPerlScr"}."pack/"; # perl scripts needed $par{"dirConvertSeq"}= $par{"dirBin"}; $par{"dirOut"}= ""; # directory for output files $par{"dirWork"}= ""; # working directory # databases to search for files $par{"dirHssp"}= "/home/rost/data/hssp/,/data/hssp/"; # dir for HSSP files $par{"dirDssp"}= "/home/rost/data/dssp/,/data/dssp/"; # dir for DSSP files $par{"dirFssp"}= "/home/rost/data/fssp/,/data/fssp/"; # dir for FSSP files $par{"dirSwiss"}= "/home/rost/data/swissprot/current/,/data/swissprot/current/"; # # dir for SWISS-PROT files # additional user specified db $par{"dirMsf"}= "unk"; # dir for MSF files # additional user specified db $par{"dirMsf"}= "unk"; # dir for MSF files $par{"dirSaf"}= "unk"; # dir for SAF files $par{"dirDaf"}= "unk"; # dir for DAF files $par{"dirFastaMul"}= "unk"; # dir for FASTA files $par{"dirPirMul"}= "unk"; # dir for PIR files $par{"dirFasta"}= "unk"; $par{"dirGcg"}= "unk"; # dir for GCG files # further on work # -------------------- # files $par{"title"}= "unk"; # output files will be called 'Pre-title.ext' $par{"titleTmp"}= "COPF-tmp"."jobid"; # title used for temporary files $par{"fileOut"}= "unk"; # lkajan: I see no reason to /set/ these by default #$par{"fileOutTrace"}= "COPF-TRACE-"."jobid".".tmp"; # file tracing some warnings and errors #$par{"fileOutScreen"}= "COPF-SCREEN-"."jobid".".tmp"; # file dumping the screen for convert_seq output $par{"fileOutTrace"}= ''; $par{"fileOutScreen"}= ''; $par{"fileHelpMan"}= "unk"; # file with manual $par{"fileHelpOpt"}= "unk"; # file with options $par{"fileHelpHints"}= "unk"; # file with hints, note: also passed as par{scrHelpHints} $par{"fileHelpProblems"}= "unk"; # file with known problems, also passed as par{scrHelpProblems} # file extensions # $par{"preOutTmp"}= "Out-"; # $par{"extOut"}= ".tmp"; $par{"ext_chain"}= "_"; # for extraction of chain, output file will contain 'ext_chain'.chain $par{"ext_hssp"}= ".hssp"; $par{"ext_dssp"}= ".dssp"; $par{"ext_fssp"}= ".fssp"; $par{"ext_msf"}= ".msf"; $par{"ext_pdb"}= ".pdb"; $par{"ext_daf"}= ".daf"; $par{"ext_saf"}= ".saf"; $par{"ext_fasta"}= ".f"; $par{"ext_fastamul"}= ".fasta"; $par{"ext_pirmul"}= ".pir"; $par{"ext_pir"}= ".pir"; $par{"ext_fasta"}= ".f"; $par{"ext_swiss"}= ""; # no extension, simply following structure 'id_species' $par{"ext_gcg"}= ".gcg"; $par{"ext_phdrdbboth"}= ".rdbPhd"; $par{"ext_dsspPhd"}= ".dsspPhd"; $par{"pre_id"}= 0; # additional information added to protein name, # e.g. 'pre_id=hssp|1ppt' # file handles $fhin= "FHIN"; $fhTrace= "FHTRACE"; # -------------------- # job control $par{"jobid"}= "jobid"; # unique job identifier (set to $$ if not defined) $par{"debug"}= 0; # if 1 : keep (most) temporary files $par{"verbose"}=$Lverb= 0; # blabla on screen $par{"verb2"}=$Lverb2= 0; # more verbose blabla # -------------------- # parameters $par{"doHsspStrip"}= 0; # also write the HSSP strip file $par{"doExpand"}= 0; # expand insertions in HSSP sequences? $par{"doCompress"}= 1; # delete insertions in guide sequence for conversion to HSSP? $par{"doSplitChain"}= 0; # split HSSP|DSSP|PDB files -> FASTA into chains $par{"frag"}= 0; # convert fragments, only? Use the following notation: # '1-55,77-99' to get two fragments one from 1-55, the other from 77-99 # NOTE: output files will be named xyz_1_55 and xyz_77_99 $par{"extr"}= 0; # extract particular protein from alignment format? # provide the number of the protein in the alignment for which you want # the sequence written into the output file $par{"doAgain"}= 1; # if 1: existing files overwritten! $par{"fileInclProt"}= 0; # contains ids to include, syntax PDBids + chain 1pdbC (or h|f|dssp files) # note: used only for FSSP->DAF # $par{"fileMatGcg"}= $par{"dirSrcMat"}. "Maxhom_GCG.metric"; # MAXHOM-GCG matrix $par{"fileMatGcg"}= $par{"dirSrcMat"}. "Maxhom_McLachlan.metric"; # MAXHOM-GCG matrix # $par{"fileMatGcg"}= $par{"dirSrcMat"}. "Maxhom_Blosum.metric"; # MAXHOM-GCG matrix # needed for conversion into HSSP format! # -------------------- # executables $par{"exeConvertSeq"}= "$par{dirConvertSeq}convert_seq"; $par{"exeConvertSeqBig"}= "$par{dirConvertSeq}convert_seq"; # $par{"exeFssp2daf"}= $par{"dirPerlPack"}. "conv_fssp2daf_lh.pm"; $par{"exeFssp2daf"}= $par{"dirPerlScr"}. "conv_fssp2daf_lh.pl"; $par{"exeConvHssp2saf"}= $par{"dirPerlPack"}. "conv_hssp2saf.pm"; # $par{"exeConvHssp2saf"}= $par{"dirPerlScr"}. "conv_hssp2saf.pl"; } # end of iniDef #=============================================================================== sub iniHelpLoc { $[ =1 ; #------------------------------------------------------------------------------- # iniHelpLoc initialising some variables #------------------------------------------------------------------------------- # standard help $tmp=0; $tmp=$par{"packName"} if (defined $par{"packName"}); # lkajan: not entirely sure - sourceFile is supposed to be module or command name? #if( ! $tmp ) { $tmp = __FILE__; } $tmp=$0 if (! defined $tmp || ! $tmp); $tmp=~s/^\.\/// if ($tmp=~/^\.\//);$tmpSource=$tmp; %tmp=('sourceFile', $tmp, 'scrName',$scrName, 'scrIn',$scrIn, 'scrGoal', $scrGoal, 'scrNarg',$scrNarg, 'scrHelpTxt', $scrHelpTxt); $tmp{"scrNameFull"}=$0; # missing stuff $tmp{"s_k_i_p"}= "problems,manual,hints"; # special help $tmp{"scrAddHelp"}= ""; $tmp{"special"}= "expand,compress,nocompress,list,split,"; $tmp{"special"}= "skip,"; $tmp{"special"}.= "help saf-syn,"; $tmp{"special"}.= "big,"; $tmp{"expand"}= "OR doExpand=1, do expand HSSP deletions (conversion to MSF|SAF)"; $tmp{"compress"}= "OR doCompress=1, do delete insertions in MASTER (conversion to HSSP)"; $tmp{"nocompress"}= "OR doCompress=0, do NOT delete insertions in MASTER (conversion to HSSP)"; $tmp{"list"}= "OR isList=1, input file is list of files (extension *.list recognised!)"; $tmp{"split"}= "OR doSplitChain=1 split DSSP chains when converting to FASTA!"; $tmp{"skip"}= "OR doAgain=0, no action if output file existing!"; $tmp{"big"}= " use BIG binaries for *->hssp!"; undef %tmp2; foreach $form (@okFormIn,@okFormOut){ next if (defined $tmp2{$form});$tmp2{$form}=1;$formTmp=$form;$formTmp=~tr/[a-z]/[A-Z]/; $tmp{"special"}.= "help $form".","; $tmp{"scrAddHelp"}.= "help ".$form." " x (9-length($form)).": ".$formTmp." " x (10 -length($form))."format specific info\n";} $tmp{"special"}=~s/,*$//g; $tmp{"scrAddHelp"}.= "help saf-syn : specification of SAF format\n"; # $tmp{"scrAddHelp"}= "help zzz : all info on zzz format\n"; # ------------------------------ # alignment IN / OUT $tmp{"help hssp"}= "DES: HSSP = Homology derived Secondary Structure of Proteins format (ali, IN | OUT)\n"; $tmp{"help hssp"}.= "OUT: MSF|DAF|SAF|FASTAmul|PIRmul|FASTA|PIR \n"; $tmp{"help hssp"}.= "OPT: The following options are available\n"; $tmp{"help hssp"}.= "OPT: \n"; $tmp{"help hssp"}.= "OPT: expand -> expand the deletion list when writing\n"; $tmp{"help hssp"}.= "OPT: * RESTRICT: for MSF and SAF output, only!!\n"; $tmp{"help hssp"}.= "OPT: extr=N -> extract sequence of protein N\n"; $tmp{"help hssp"}.= "OPT: * RESTRICT: for single sequence output, only!\n"; $tmp{"help hssp"}.= "OPT: default for HSSP->PIR/FASTA: extract guide seq (N=1)!\n"; $tmp{"help hssp"}.= "OPT: frag=n-m -> selects fragment from residues N-M\n"; $tmp{"help hssp"}.= "OPT: type 'help frag' for more information on this one\n"; $tmp{"help hssp"}.= "OPT: * RESTRICT: NOT for DAF formatted output\n"; $tmp{"help hssp"}.= "OPT: \n"; $tmp{"help hssp"}.= "OPT: chain=A,B -> selects only the chains A and B\n"; $tmp{"help hssp"}.= "OPT: NOTE: pass the identifier for chain C as \n"; $tmp{"help hssp"}.= "OPT: file.hssp_C\n"; $tmp{"help hssp"}.= "OPT: providing a chain disables the option 'frag=N-M'\n"; # $tmp{"help hssp"}.= "OPT: split -> split HSSP|DSSP|PDB files -> FASTA into chains\n"; $tmp{"help pdb"}= "DES: PDB\n"; $tmp{"help pdb"}.= "OUT: FASTAmul|FASTA|PIR|PIRmul|GCG \n"; $tmp{"help pdb"}.= "OPT: The following options are available\n"; $tmp{"help pdb"}.= "OPT: chain=A,B -> selects only the chains A and B\n"; $tmp{"help pdb"}.= "OPT: NOTE: pass the identifier for chain C as \n"; $tmp{"help pdb"}.= "OPT: file.pdb_C\n"; $tmp{"help pdb"}.= "OPT: providing a chain disables the option 'frag=N-M'\n"; $tmp{"help pdb"}.= "OPT: frag=n-m -> selects fragment from residues N-M\n"; $tmp{"help pdb"}.= "OPT: type 'help frag' for more information on this one\n"; $tmp{"help pdb"}.= "OPT: * RESTRICT: NOT for DAF formatted output\n"; # $tmp{"help pdb"}.= "OPT: split -> split HSSP|DSSP|PDB files -> FASTA into chains\n"; $tmp{"help msf"}= "DES: MSF = Multiple Sequence Format (ali, IN | OUT)\n"; $tmp{"help msf"}.= "OUT: HSSP|SAF|FASTAmul|FASTA \n"; $tmp{"help msf"}.= "OPT: The following options are available\n"; $tmp{"help msf"}.= "OPT: compress -> delete insertions in GUIDE sequence\n"; $tmp{"help msf"}.= "OPT: * RESTRICT: for HSSP output, only!!\n"; $tmp{"help msf"}.= "OPT: extr=N -> extract sequence of protein N\n"; $tmp{"help msf"}.= "OPT: * RESTRICT: for single sequence output, only!\n"; $tmp{"help msf"}.= "OPT: frag=n-m -> selects fragment from residues N-M\n"; $tmp{"help msf"}.= "OPT: type 'help frag' for more information on this one\n"; $tmp{"help msf"}.= "OPT: * RESTRICT: NOT for DAF formatted output\n"; $tmp{"help saf"}= "DES: SAF = Simple Alignment Format (ali, IN | OUT)\n"; $tmp{"help saf"}.= "DES: resembles MSF, but less restrictive\n"; $tmp{"help saf"}.= "OUT: HSSP|MSF|FASTAmul|FASTA|PIRmul|PIR\n"; $tmp{"help saf"}.= "OPT: The following options are available\n"; $tmp{"help saf"}.= "OPT: compress -> delete insertions in GUIDE sequence\n"; $tmp{"help saf"}.= "OPT: * RESTRICT: for HSSP output, only!!\n"; $tmp{"help saf"}.= "OPT: extr=p1-p2,p3 -> extract sequence of proteins\n"; $tmp{"help saf"}.= "OPT: any list ok, e.g., '1-5,7,19-20,35'\n"; $tmp{"help saf"}.= "OPT: frag=n-m -> selects fragment from residues N-M\n"; $tmp{"help saf"}.= "OPT: type 'help frag' for more information on this one\n"; $tmp{"help saf"}.= "OPT: * RESTRICT: NOT for DAF formatted output\n"; $tmp{"help saf"}.= " \n"; $tmp{"help saf"}.= " To learn the detailed specifications about the SAF format , please typ:\n"; $tmp{"help saf"}.= "$tmpSource help saf-syn\n"; $tmp{"help saf"}.= " \n"; $tmp{"help saf-syn"}= "\n"; $tmp{"help saf-syn"}.= "============================================================\n"; $tmp{"help saf-syn"}.= "Specification of SAF (Simple Alignment Format)\n"; $tmp{"help saf-syn"}.= "============================================================\n"; $tmp{"help saf-syn"}.= "\n"; $tmp{"help saf-syn"}.= "NOTE: in principle SAF is like MSF ommitting the header, and\n"; $tmp{"help saf-syn"}.= " not requiring the MSF stringency.\n"; $tmp{"help saf-syn"}.= "NEW: Additional features are:\n"; $tmp{"help saf-syn"}.= " * comment lines can be inserted anywhere (by '#')\n"; $tmp{"help saf-syn"}.= " * unaligned regions do not have to be filled in\n"; $tmp{"help saf-syn"}.= "\n"; $tmp{"help saf-syn"}.= "------------------------------\n"; $tmp{"help saf-syn"}.= "EACH ROW\n"; $tmp{"help saf-syn"}.= "------------\n"; $tmp{"help saf-syn"}.= "two columns: 1. name (protein identifier, shorter than 15 characters)\n"; $tmp{"help saf-syn"}.= " 2. one-letter sequence (any number of characters)\n"; $tmp{"help saf-syn"}.= " insertions: dots (.), or hyphens (-)\n"; $tmp{"help saf-syn"}.= "------------\n"; $tmp{"help saf-syn"}.= "EACH BLOCK\n"; $tmp{"help saf-syn"}.= "------------\n"; $tmp{"help saf-syn"}.= "rows: 1. row must be guide sequence (i.e. always the same name,\n"; $tmp{"help saf-syn"}.= " this implies, in particular, that this sequence shold\n"; $tmp{"help saf-syn"}.= " not have blanks\n"; $tmp{"help saf-syn"}.= " 2, ..., n the aligned sequences\n"; $tmp{"help saf-syn"}.= " comments: * rows beginning with a '#' will be ignored\n"; $tmp{"help saf-syn"}.= " * rows containing only blanks, dots, numbers will also be ignored\n"; $tmp{"help saf-syn"}.= " (in particular numbering is possible)\n"; $tmp{"help saf-syn"}.= "\n"; $tmp{"help saf-syn"}.= "unspecified: * order of sequences 2-n can differ between the blocks,\n"; $tmp{"help saf-syn"}.= " * not all 2-n sequences have to occur in each block,\n"; $tmp{"help saf-syn"}.= " * \n"; $tmp{"help saf-syn"}.= " * BUT: whenever a sequence is present, it should have\n"; $tmp{"help saf-syn"}.= " * dots for insertions rather than blanks\n"; $tmp{"help saf-syn"}.= " * \n"; $tmp{"help saf-syn"}.= "------------\n"; $tmp{"help saf-syn"}.= "NOTE\n"; $tmp{"help saf-syn"}.= "------------\n"; $tmp{"help saf-syn"}.= " The 'freedom' of this format has various consequences:\n"; $tmp{"help saf-syn"}.= " * identical names in different rows of the same block\n"; $tmp{"help saf-syn"}.= " are not identified. Instead, whenever this applies,\n"; $tmp{"help saf-syn"}.= " the second, (third, ..) sequences are ignored.\n"; $tmp{"help saf-syn"}.= " e.g. \n"; $tmp{"help saf-syn"}.= " t2_11751 EFQEDQENVN \n"; $tmp{"help saf-syn"}.= " name-1 ...EDQENvk\n"; $tmp{"help saf-syn"}.= " name-1 GGAPTLPETL\n"; $tmp{"help saf-syn"}.= " will be interpreted as:\n"; $tmp{"help saf-syn"}.= " t2_11751 EFQEDQENVN \n"; $tmp{"help saf-syn"}.= " name-1 ...EDQENvk\n"; $tmp{"help saf-syn"}.= " wheras:\n"; $tmp{"help saf-syn"}.= " t2_11751 EFQEDQENVN \n"; $tmp{"help saf-syn"}.= " name-1 ...EDQENvk\n"; $tmp{"help saf-syn"}.= " name_1 GGAPTLPETL\n"; $tmp{"help saf-syn"}.= " has three different names.\n"; $tmp{"help saf-syn"}.= "------------\n"; $tmp{"help saf-syn"}.= "EXAMPLE 1\n"; $tmp{"help saf-syn"}.= "------------\n"; $tmp{"help saf-syn"}.= " t2_11751 EFQEDQENVN PEKAAPAQQP RTRAGLAVLR AGNSRGAGGA PTLPETLNVA\n"; $tmp{"help saf-syn"}.= " name_1 EFQEDQENVN PEKAAPAQQP RTRAGLAVLR AGNSRGAGGA PTLPETLNVA\n"; $tmp{"help saf-syn"}.= " name_2 ...EDQENvk PEKAAPAQQP RTRAGLAVLR AGNSRG.... ...PETLNV.\n"; $tmp{"help saf-syn"}.= " name_22 ...EDQENvk PEKAAPAQQP RTRAGLAVLR AGNSRG.... ...PETLNV.\n"; $tmp{"help saf-syn"}.= " t2_11751 GGAPTLPETL NVAGGAPTLP ETLNVAGGAP TLPETLNV\n"; $tmp{"help saf-syn"}.= " name_1 GGAPTLPETL NVAGGAPTLP ETLNVAGGAP TLPETLNV\n"; $tmp{"help saf-syn"}.= "\n"; $tmp{"help saf-syn"}.= "------------\n"; $tmp{"help saf-syn"}.= "EXAMPLE 2\n"; $tmp{"help saf-syn"}.= "------------\n"; $tmp{"help saf-syn"}.= " 10 20 30 40 \n"; $tmp{"help saf-syn"}.= " t2_11751 EFQEDQENVN PEKAAPAQQP RTRAGLAVLR AGNSRGAGGA PTLPETLNVA\n"; $tmp{"help saf-syn"}.= " name_1 EFQEDQENVN PEKAAPAQQP RTRAGLAVLR AGNSRGAGGA PTLPETLNVA\n"; $tmp{"help saf-syn"}.= " name_2 ...EDQENvk PEKAAPAQQP RTRAGLAVLR AGNSRG.... ...PETLNV.\n"; $tmp{"help saf-syn"}.= " name_22 ...EDQENvk PEKAAPAQQP RTRAGLAVLR AGNSRG.... ...PETLNV.\n"; $tmp{"help saf-syn"}.= " 50 60 70 80 90\n"; $tmp{"help saf-syn"}.= " t2_11751 GGAPTLPETL NVAGGAPTLP ETLNVAGGAP TLPETLNV\n"; $tmp{"help saf-syn"}.= " name_22 .......... .......... .......... ........\n"; $tmp{"help saf-syn"}.= " name_1 GGAPTLPETL NVAGGAPTLP ETLNVAGGAP TLPETLNV\n"; $tmp{"help saf-syn"}.= " name_2 .......... NVAGGAPTLP \n"; $tmp{"help saf-syn"}.= " \n"; $tmp{"help saf-syn"}.= " enough?\n"; $tmp{"help saf-syn"}.= " \n"; $tmp{"help fastamul"}= "DES: FASTAmul = Multiple FASTA format (ali, IN | OUT)\n"; $tmp{"help fastamul"}.= "DES: Simply many proteins each in FASTA format.\n"; $tmp{"help fastamul"}.= "DES: \n"; $tmp{"help fastamul"}.= "DES: ***********************************************************\n"; $tmp{"help fastamul"}.= "DES: NOTE: for a correct conversion into alignment formats, all\n"; $tmp{"help fastamul"}.= "DES: sequences have to be aligned already. This implies:\n"; $tmp{"help fastamul"}.= "DES: that ALL sequences have to have IDENTICAL lengths!!\n"; $tmp{"help fastamul"}.= "DES: ***********************************************************\n"; $tmp{"help fastamul"}.= "DES: \n"; $tmp{"help fastamul"}.= "OUT: HSSP|MSF|SAF|FASTA|PIRmul|PIR \n"; $tmp{"help fastamul"}.= "OPT: The following options are available\n"; $tmp{"help fastamul"}.= "OPT: compress -> delete insertions in GUIDE sequence\n"; $tmp{"help fastamul"}.= "OPT: * RESTRICT: for HSSP output, only!!\n"; $tmp{"help fastamul"}.= "OPT: extr=N -> extract sequence of protein N\n"; $tmp{"help fastamul"}.= "OPT: * RESTRICT: for single sequence output, only!\n"; $tmp{"help fastamul"}.= "OPT: frag=n-m -> selects fragment from residues N-M\n"; $tmp{"help fastamul"}.= "OPT: type 'help frag' for more information on this one\n"; $tmp{"help fastamul"}.= "OPT: * RESTRICT: NOT for DAF formatted output\n"; $tmp{"help pirmul"}= "DES: PIRmul = Multiple PIR format (ali, IN | OUT)\n"; $tmp{"help pirmul"}.= "DES: Simply many proteins each in PIR format.\n"; $tmp{"help pirmul"}.= "DES: \n"; $tmp{"help pirmul"}.= "OUT: FASTAmul|FASTA \n"; $tmp{"help pirmul"}.= "OPT: The following options are available\n"; $tmp{"help pirmul"}.= "OPT: extr=N -> extract sequence of protein N\n"; $tmp{"help pirmul"}.= "OPT: * RESTRICT: for single sequence output (FASTA), only!\n"; $tmp{"help pirmul"}.= "OPT: frag=n-m -> selects fragment from residues N-M\n"; $tmp{"help pirmul"}.= "OPT: type 'help frag' for more information on this one\n"; # ------------------------------ # alignment IN $tmp{"help fssp"}= "DES: FSSP = Definition of Secondary Structure for Proteins format (ali, IN)\n"; $tmp{"help fssp"}.= "OUT: DAF\n"; $tmp{"help fssp"}.= "OPT: The following options are available\n"; $tmp{"help fssp"}.= "OPT: frag=n-m -> selects fragment from residues N-M\n"; $tmp{"help fssp"}.= "OPT: type 'help frag' for more information on this one\n"; $tmp{"help fssp"}.= "OPT: * RESTRICT: NOT for DAF formatted output\n"; # ------------------------------ # alignment OUT $tmp{"help daf"}= "DES: DAF = Dirty Alignment Format (ali, OUT)\n"; $tmp{"help daf"}.= "OPT: No options are available (output only HSSP|FSSP -> DAF)\n"; # ------------------------------ # sequence IN / OUT $tmp{"help dssp"}= "DES: DSSP = Definition of Secondary Structure for Proteins format (seq, IN | OUT)\n"; $tmp{"help dssp"}.= "OUT: FASTA|PIR|MSF|SAF\n"; $tmp{"help dssp"}.= "OPT: The following options are available\n"; $tmp{"help dssp"}.= "OPT: frag=n-m -> selects fragment from residues N-M\n"; $tmp{"help dssp"}.= "OPT: type 'help frag' for more information on this one\n"; $tmp{"help dssp"}.= "OPT: NOTE: if you extract chains, these numbers refer\n"; $tmp{"help dssp"}.= "OPT: to the position in the extracted chain!!\n"; $tmp{"help dssp"}.= "OPT: chain=A,B -> selects only the chains A and B\n"; $tmp{"help dssp"}.= "OPT: NOTE: pass the identifier for chain C as \n"; $tmp{"help dssp"}.= "OPT: file.dssp_C\n"; $tmp{"help dssp"}.= "OPT: providing a chain disables the option 'frag=N-M'\n"; $tmp{"help dssp"}.= "OPT: split -> split HSSP|DSSP|PDB files -> FASTA into chains\n"; $tmp{"help fasta"}= "DES: FASTA format (seq, IN | OUT)\n"; $tmp{"help fasta"}.= "OUT: PIR|GCG\n"; $tmp{"help fasta"}.= "OPT: The following options are available\n"; $tmp{"help fasta"}.= "OPT: frag=n-m -> selects fragment from residues N-M\n"; $tmp{"help fasta"}.= "OPT: type 'help frag' for more information on this one\n"; $tmp{"help fasta"}.= "OPT: * RESTRICT: NOT for DAF formatted output\n"; $tmp{"help pir"}= "DES: PIR = Protein Identification Resource format (seq, IN | OUT)\n"; $tmp{"help pir"}.= "OUT: FASTA|GCG \n"; $tmp{"help pir"}.= "OPT: The following options are available\n"; $tmp{"help pir"}.= "OPT: frag=n-m -> selects fragment from residues N-M\n"; $tmp{"help pir"}.= "OPT: type 'help frag' for more information on this one\n"; $tmp{"help pir"}.= "OPT: * RESTRICT: NOT for DAF formatted output\n"; $tmp{"help gcg"}= "DES: GCG format (seq, IN | OUT)\n"; $tmp{"help gcg"}.= "OUT: PIR|FASTA|FASTAmul|PIRmul \n"; $tmp{"help gcg"}.= "OPT: The following options are available\n"; $tmp{"help gcg"}.= "OPT: frag=n-m -> selects fragment from residues N-M\n"; $tmp{"help gcg"}.= "OPT: type 'help frag' for more information on this one\n"; $tmp{"help gcg"}.= "OPT: * RESTRICT: NOT for DAF formatted output\n"; # ------------------------------ # sequence IN $tmp{"help swiss"}= "DES: SWISS = Homology derived Secondary Structure of Proteins format (alignment)\n"; $tmp{"help swiss"}.= "OUT: MSF|DAF|SAF|FASTAmul|PIRmul|PIR|FASTA|GCG \n"; $tmp{"help swiss"}.= "OPT: The following options are available\n"; $tmp{"help swiss"}.= "OPT: expand -> expand the deletion list when writing\n"; $tmp{"help swiss"}.= "OPT: * RESTRICT: for MSF output, only!!\n"; $tmp{"help swiss"}.= "OPT: extr=N -> extract sequence of protein N\n"; $tmp{"help swiss"}.= "OPT: * RESTRICT: for single sequence output, only!\n"; $tmp{"help swiss"}.= "OPT: frag=n-m -> selects fragment from residues N-M\n"; $tmp{"help swiss"}.= "OPT: type 'help frag' for more information on this one\n"; $tmp{"help swiss"}.= "OPT: * RESTRICT: NOT for DAF formatted output\n"; $tmp{"help phdrdb"}= "DES: PHDrdb = PHD.rdb format (seq, IN)\n"; $tmp{"help phdrdb"}.= "OUT: DSSP\n"; $tmp{"help phdrdb"}.= "OUT: Converts PHD rdb file into DSSP formatted file.\n"; $tmp{"help phdrdb"}.= "OUT: NOTE: you have to run PHD with the default or the\n"; $tmp{"help phdrdb"}.= "OUT: option 'both' on the command line\n"; $tmp{"help phdrdb"}.= "OPT: \n"; $tmp{"help phdrdb"}.= "OUT: MSF|PIR|FASTA|GCG|FASTAmul|PIRmul \n"; $tmp{"help phdrdb"}.= "OPT: NOT IMPLEMENTED, yet!\n"; $tmp{"help phdrdb"}.= "OPT: \n"; $tmp{"help phdrdb"}.= "OUT: MSF|PIR|FASTA|GCG|FASTAmul|PIRmul \n"; $tmp{"help phdrdb"}.= "OPT: The following options are available\n"; $tmp{"help phdrdb"}.= "OPT: frag=n-m -> selects fragment from residues N-M\n"; $tmp{"help phdrdb"}.= "OPT: type 'help frag' for more information on this one\n"; $tmp{"help phdrdb"}.= "OPT: * RESTRICT: NOT for DAF formatted output\n"; $tmp{"help phdrdb"}.= "OPT: mergeAli -> provide a valid HSSP file to merge the PHD output\n"; $tmp{"help phdrdb"}.= "OPT: into that one.\n"; $tmp{"help phdrdb"}.= "OPT: \n"; # "------------------------------------------------------------\n"; $tmp{"scrHelpProblems"}= "Maximal protein length:\n"; $tmp{"scrHelpProblems"}.=" $scrName bases upon a FORTRAN program by Reinhard Schneider\n"; $tmp{"scrHelpProblems"}.=" LION Heidelberg), and Ulrike Goebel (now Jena). That pro-\n"; $tmp{"scrHelpProblems"}.=" gram restricts memory space by crashing with proteins of\n"; $tmp{"scrHelpProblems"}.=" more than 6,000 residues. Recompile the FORTRAN program\n"; $tmp{"scrHelpProblems"}.=" to change this feature.\n"; $tmp{"scrHelpProblems"}.=" \n"; $tmp{"scrHelpProblems"}.=" \n"; $tmp{"scrHelpProblems"}.=" \n"; $tmp{"scrHelpProblems"}.=" \n"; } # end of iniHelpLoc #============================================================================== # library collected (begin) lll #============================================================================== #=============================================================================== sub amino_acid_convert_3_to_1 { local($three_letter_acid) = @_ ; local($sbrName3); $[ =1 ; #------------------------------------------------------------------------------- # amino_acid_convert_3_to_1 converts 3 letter alphabet to single letter alphabet # in: $three_letter_acid # out: 1|0,msg,$one_letter_acid # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $sbrName3="amino_acid_convert_3_to_1"; return(0,"no input to $sbrName3") if (! defined $three_letter_acid); # initialise translation table &amino_acid_convert_3_to_1_ini() if (! %amino_acid_convert_3_to_1); # not found return(0,"no conversion for acid=$three_letter_acid!","unk") if (! defined $amino_acid_convert_3_to_1{$three_letter_acid}); # ok return(1,"ok",$amino_acid_convert_3_to_1{$three_letter_acid}); } # end of amino_acid_convert_3_to_1 #=============================================================================== sub amino_acid_convert_3_to_1_ini { #------------------------------------------------------------------------------- # amino_acid_convert_3_to_1_ini returns GLOBAL array with 3 letter acid -> 1 letter # out GLOBAL: %amino_acid_convert_3_to_1 #------------------------------------------------------------------------------- %amino_acid_convert_3_to_1= ( # amino 'ALA',"A", 'ARG',"R", 'ASN',"N", 'ASP',"D", 'CYS',"C", 'GLN',"Q", 'GLU',"E", 'GLY',"G", 'HIS',"H", 'ILE',"I", 'LEU',"L", 'LYS',"K", 'MET',"M", 'PHE',"F", 'PRO',"P", 'SER',"S", 'THR',"T", 'TRP',"W", 'TYR',"Y", 'VAL',"V", # nucleic 'A', "A", 'C', "C", 'G', "G", 'T', "T", ); } # end of amino_acid_convert3_to_1 #============================================================================== sub brIniErr { local($local)=@_; $[ =1 ; #------------------------------------------------------------------------------- # brIniErr error check for initial parameters # in GLOBAL: $par{},@PARAMS # in: $exceptions = 'kwd1,kwd2' # key words not to check for file existence # out: ($Lok,$msg) #------------------------------------------------------------------------------- #if( $par{"debug"} ) { cluck( "$scrName:brIniErr" ); } $sbrName="$scrName:".__FILE__.":".__LINE__.":brIniErr"; @kwd= keys (%par) if (%par); # ------------------------------ undef %tmp; $#excl=0; # exclude some keyword from check? @excl=split(/,/,$local) if (defined $local); if ($#excl>0){ foreach $kwd(@excl){ $tmp{$kwd}=1;}} $msgHere=""; # ------------------------------ foreach $kwd (@kwd){ # file existence next if ($kwd =~ /^file(Out|Help|Def)/i); next if (defined $tmp{$kwd}); if ($kwd=~/^exe/) { # $msgHere.="*** ERROR executable ($kwd) '".$par{$kwd}."' missing!\n" # if (! -e $par{$kwd} && ! -l $par{$kwd}); # $msgHere.="*** ERROR executable ($kwd) '".$par{$kwd}."' not executable!\n". # "*** do the following \t 'chmod +x ".$par{$kwd}."'\n" # if (-e $par{$kwd} && ! -x $par{$kwd}); } elsif($kwd=~/^file/){ next if ($par{$kwd} eq "unk" || length($par{$kwd})==0 || !$par{$kwd}); $msgHere.="*** ERROR ".__FILE__.":".__LINE__." file ($kwd) '".$par{$kwd}."' missing!\n" if (! -e $par{$kwd} && ! -l $par{$kwd});} # } if ($msgHere=~/ERROR/){ Carp::confess( $msgHere ); return(0,$msgHere); } return(1,"ok $sbrName"); } # end of brIniErr #============================================================================== sub brIniGetArg { $[ =1 ; #------------------------------------------------------------------------------- # brIniGetArg standard reading of command line arguments # in GLOBAL: @PARAMS,$defaults{},$par{} # out GLOBAL: $par{},@fileIn # out: @arg_not_understood (i.e. returns 0 if everything ok!) #------------------------------------------------------------------------------- $sbrName="lib-br:"."brIniGetArg"; $#argUnk=0; # ------------------------------ # (1) get input directory foreach $arg (@PARAMS){ # search in command line if ($arg=~/^dirIn=(.+)$/){$par{"dirIn"}=$1; last;}} # search in defaults if ((! defined $par{"dirIn"} || ! -d $par{"dirIn"}) && %defaults){ if (defined $defaults{"dirIn"}){ $par{"dirIn"}=$defaults{"dirIn"}; $par{"dirIn"}=$PWD if (defined $PWD && ($par{"dirIn"}=~/^(local|unk)$/ || length($par{"dirIn"})==0));}} $par{"dirIn"}.="/" if (defined $par{"dirIn"} && -d $par{"dirIn"} && $par{"dirIn"}!~/\/$/); # slash $par{"dirIn"}="" if (! defined $par{"dirIn"} || ! -d $par{"dirIn"}); # empty # ------------------------------ if (%par){ # all keywords used in script @tmp=sort keys (%par);} else{ $#tmp=0;} $Lverb3=0 if (! defined $Lverb3); $Lverb2=0 if (! defined $Lverb2); $#fileIn=0; # ------------------------------ foreach $arg (@PARAMS){ # (2) key word driven input if ($arg=~/^verb\w*3=(\d)/) {$par{"verb3"}=$Lverb3=$1;} elsif ($arg=~/^verb\w*3/) {$par{"verb3"}=$Lverb3=1;} elsif ($arg=~/^verb\w*2=(\d)/) {$par{"verb2"}=$Lverb2=$1;} elsif ($arg=~/^verb\w*2/) {$par{"verb2"}=$Lverb2=1;} elsif ($arg=~/^verbose=(\d)/) {$par{"verbose"}=$Lverb=$1;} elsif ($arg=~/^verbose/) {$par{"verbose"}=$Lverb=1;} elsif ($arg=~/^not_?([vV]er|[sS]creen)/) {$par{"verbose"}=$Lverb=0; } else {$Lok=0; # general # is it file? if ((-e $arg && ! -d $arg) || -l $arg){ $Lok=1; push(@fileIn,$arg);} if (! $Lok && length($par{"dirIn"})>1 && -e $par{"dirIn"}.$arg){ $Lok=1;push(@fileIn,$par{"dirIn"}.$arg);} # any of the paras defined ? if (! $Lok && $arg=~/=/){ foreach $kwd (@tmp){ if ($arg=~/^$kwd=(.+)$/){$Lok=1;$par{$kwd}=$1; last;}}} push(@argUnk,$arg) if (! $Lok);}} return(@argUnk); } # end of brIniGetArg #============================================================================== sub brIniHelp { local(%tmp)=@_; $[ =1 ; #------------------------------------------------------------------------------- # brIniHelp initialise help text # out: \d,txt # err: 0,$msg -> error # err: 1,'fin' -> wanted help, given help # err: 1,$msg -> continue, was just trying # in: $tmp{} with # $tmp{sourceFile}= name and path of calling script # $tmp{scrName}= name of calling script (no .pl) # $tmp{scrIn}= input arguments for script # $tmp{scrGoal}= what script does # $tmp{scrNarg}= number of argument needed for script # $tmp{scrHelpTxt}= long blabla about script # separate by '\n' # $tmp{scrAddHelp}= help option other than standard # e.g.: "help xyz : explain .xyz " # many: '\n' separated # NOTE: this will be an entry to $tmp{$special}, # -> $special = 'help xyz' will give explanation # $tmp{$special} # $tmp{special}= 'kwd1,kwd2,...' special keywords # $tmp{$special}= explanation for $special # syntax: print flat lines (or '--- $line'), separate by '\n' # $tmp{scrHelpHints}= hints (tab separated) # $tmp{scrHelpProblems}= known problems (tab separated) # in GLOBULAR: @PARAMS # $par{fileHelpOpt} # $par{fileHelpMan} # $par{fileHelpHints} # $par{fileHelpProblems} # $par{fileDefautlts} # in unk: leave undefined, or give value = 'unk' #------------------------------------------------------------------------------- $sbrName="lib-br:brIniHelp"; # ------------------------------ # check input if (0){ foreach $kwd ("sourceFile","scrName","scrIn","scrGoal", "scrNarg","scrAddHelp","special"){ print "--- input to $sbrName kwd=$kwd, val=",$tmp{$kwd},",\n";} } @scrTask= ("--- Task: ".$tmp{"scrGoal"}, "--- ", "--- Input: ".$tmp{"scrIn"}, # "--- i.e. requires at least ".$tmp{"scrNarg"}. # " command line argument(s)", "--- "); $tmp{"scrNameFull"}=$0 if (! defined $tmp{"scrNameFull"}); # ------------------------------ # additional help keywords? # ------------------------------ $#tmpAdd=0; if (defined $tmp{"scrAddHelp"} && $tmp{"scrAddHelp"} ne "unk"){ @tmp=split(/\n/,$tmp{"scrAddHelp"});$Lerr=0; foreach $tmp(@tmp){ push(@tmpAdd,$tmp{"scrNameFull"}." ".$tmp); $tmp2=$tmp;$tmp2=~s/^(.+)\s+\:.*$/$1/;$tmp2=~s/\s*$//g; if (!defined $tmp{"$tmp2"}){ $Lerr=1; print "-*- WARN $sbrName: miss \$tmp{\$special} for '$tmp2'\n";}} if ($Lerr){ print "-*- " x 20,"\n","-*- WARN $sbrName: HELP on HELP\n", "-*- if you provide special help in tmp{scrAddHelp}, then\n", "-*- provide also the respective explanation in tmp{\$special},\n", "-*- where \$special is e.g. 'help xyz' in \n", "-*- scrAddHelp='help xyz : what to do'\n","-*- " x 20,"\n";}} # ------------------------------ # build up help standard # ------------------------------ @scrHelp= ("--- Help: For further information on input options type:", "--- "." " x length($tmp{"scrNameFull"}). " ........................................"); @scrHelpLoop= ($tmp{"scrNameFull"}." help : lists all options", $tmp{"scrNameFull"}." def : writes default settings", $tmp{"scrNameFull"}." def keyword : settings for keyword", $tmp{"scrNameFull"}." help keyword : explain key, e.g. 'special', or how for 'how' and 'howie'"); push(@scrHelpLoop, $tmp{"scrNameFull"}." problems : known problems") if (! defined $tmp{"s_k_i_p"} || $tmp{"s_k_i_p"} !~ /problems/); push(@scrHelpLoop, $tmp{"scrNameFull"}." hints : hints for users") if (! defined $tmp{"s_k_i_p"} || $tmp{"s_k_i_p"} !~ /hints/); push(@scrHelpLoop, $tmp{"scrNameFull"}." manual : will cat the entire manual (... MAY be it will)") if (! defined $tmp{"s_k_i_p"} || $tmp{"s_k_i_p"} !~ /manual/); push(@scrHelpLoop,@tmpAdd) if ($#tmpAdd>0); push(@scrHelp,@scrHelpLoop, "--- "." " x length($tmp{"scrNameFull"}). " ........................................"); # ------------------------------ # additional general information # ------------------------------ $#scrHelpTxtLoc=0; if (defined $tmp{"scrHelpTxt"}){ @tmp=split(/\n/,$tmp{"scrHelpTxt"}); # '--- scrHelptTxt' # '> program' i.e. use: '>' to ommitt '--- ' foreach $txt (@tmp){ push(@scrHelpTxtLoc,"--- $txt\n") if ($txt !~ /^[>\%]/); push(@scrHelpTxtLoc,"$txt\n") if ($txt =~ /^[>\%]/); }} # ------------------------------ # additional special info # ------------------------------ $#scrSpecialLoc=0; if (defined $tmp{"special"}) { @kwdLoc=split(/,/,$tmp{"special"}); if ($#kwdLoc>1){ foreach $kwd (@kwdLoc){ $tmp=" "; $tmp=$tmp{$kwd} if (defined $tmp{$kwd}); $tmp=~s/\n$//o; $tmpWrt=sprintf ("--- %-15s %s\n",$kwd,$tmp); push(@scrSpecialLoc,$tmpWrt); } }} # ------------------------------ # general: # ------------------------------ $fstLineLoc= "-" x 80 . "\n"; $fstLineLoc.="--- Perl script $scrName.pl (" . $tmp{"sourceFile"} . ")\n"; $syntaxLoc= "-" x 80 . "\n"; $syntaxLoc.= "--- Syntax used to set parameters by command line:\n"; $syntaxLoc.= "--- 'keyword=value'\n"; $syntaxLoc.= "--- where 'keyword' is one of the following keywords:\n"; # ------------------------------ # no input if ($#PARAMS < 1) { # ------------------------------ print $fstLineLoc; print join("\n",@scrTask,"\n"); print @scrHelpTxtLoc; print join("\n",@scrHelp); print "\n"; return(1,"fin");} # ------------------------------ # help request # ------------------------------ elsif ($#PARAMS < 2 && $PARAMS[1] =~ /^(help|man|-m|-h)$/){ print $fstLineLoc; print join("\n",@scrTask,"\n"); print @scrHelpTxtLoc; if ($#scrSpecialLoc > 0) { print "-" x 80,"\n"; print "--- 'special' keywords:\n"; print @scrSpecialLoc,"\n"; } if (%par) { @kwdLoc=sort keys (%par); if ($#kwdLoc>1){ print $syntaxLoc; $ct=0;print "OPT \t "; foreach $kwd(@kwdLoc){ ++$ct; printf "%-20s ",$kwd; if ($ct==4){ $ct=0;print "\nOPT \t ";}} print "\n";} print "--- \n", "--- you may get further explanations on a particular keyword\n", "--- by typing:\n", $tmp{"scrNameFull"}." help keyword\n", "--- this could explain the key. Type 'how' for info on ". "'how,howie,show'.\n", "--- \n";} else { print "--- no other options enabled by \%par\n";} return(1,"fin loop?");} # ------------------------------ # wants manual # ------------------------------ elsif ($#PARAMS<2 && $PARAMS[1] eq "manual"){ print $fstLineLoc; if (defined $par{"fileHelpMan"} && -e $par{"fileHelpMan"}){ open("FHIN",$par{"fileHelpOpt"}) || cluck "*** $sbrName: could NOT open file".$par{"fileHelpOpt"}; while(){ print $_;}close(FHIN);} else { print "no manual in \%par{'fileHelpMan'}!!\n";} return(1,"fin");} # ------------------------------ # wants hints # ------------------------------ elsif ($#PARAMS==1 && $PARAMS[1] eq "hints"){ print $fstLineLoc; print "--- Hints for users:\n";$ct=0; if (defined $par{"fileHelpHints"} && -e $par{"fileHelpHints"}){ open("FHIN",$par{"fileHelpHints"}) || cluck "*** $sbrName: could NOT open file".$par{"fileHelpHints"}; while(){ print $_; ++$ct;}close(FHIN);} if (defined $par{"scrHelpHints"}){ @tmp=split(/\n/,$par{"scrHelpHints"}); foreach $txt(@tmp){print "--- $txt\n";++$ct;}} if ($ct==0){ print "--- the only hint to give: try another help option!\n"; print "--- sorry ...\n";} return(1,"fin loop?");} # ------------------------------ # wants problems # ------------------------------ elsif ($#PARAMS<2 && $PARAMS[1] eq "problems"){ print $fstLineLoc; print "--- Known problems with script:\n";$ct=0; if (defined $par{"fileHelpProblems"} && -e $par{"fileHelpProblems"}){ open("FHIN",$par{"fileHelpProblems"}) || cluck "*** $sbrName: could NOT open file".$par{"fileHelpProblems"}; while(){ print $_; ++$ct;}close(FHIN);} if (defined $par{"scrHelpProblems"}){ @tmp=split(/\n/,$par{"scrHelpProblems"}); foreach $txt(@tmp){print "--- $txt\n";++$ct;}} if ($ct==0){ print "--- One problem is: there is no problem annotated.\n"; print "--- sorry ...\n";} return(1,"fin loop?");} # ------------------------------ # wants default settings # ------------------------------ elsif ($#PARAMS<2 && $PARAMS[1] eq "def"){ print $fstLineLoc; if (%par){ @kwdLoc=sort keys (%par); if ($#kwdLoc>1){ print "--- the default settings are:\n"; printf "--- %-20s %-s\n","." x 20,"." x 20; printf "--- %-20s = %-s\n","keyword","value"; printf "--- %-20s %-s\n","." x 20,"." x 20; foreach $kwd(@kwdLoc){ printf "--- %-20s = %-s\n",$kwd,$par{$kwd};} printf "--- %-20s %-s\n","." x 20,"." x 20; print "--- \n", "--- to get settings for particular keywords use:\n", $tmp{"scrNameFull"}," def keyword'\n \n";}} else { print "--- no setting defined in \%par\n"; print "--- sorry...\n";} return(1,"fin loop?");} # ------------------------------ # help for particular keyword # ------------------------------ elsif ($#PARAMS>=2 && $PARAMS[1] eq "help" || $#PARAMS==1 && $PARAMS[1] eq "special"){ print $fstLineLoc; $kwdHelp=$PARAMS[2] if ($#PARAMS > 1); $kwdHelp=$PARAMS[1] if ($#PARAMS== 1); $tmp="help $kwdHelp"; # special? $tmp=~tr/[A-Z]/[a-z]/; # make special keywords case independent $tmp2=$tmp;$tmp2=~s/help //; $tmpSpecial=$tmp{"$tmp"} if (defined $tmp{"$tmp"}); $tmpSpecial=$tmp{"$tmp2"} if (! defined $tmp{"$tmp"} && defined $tmp{"$tmp2"}); $#kwdLoc=$#expLoc=0; # (1) get all respective keywords if (%par && $kwdHelp ne "special"){ @kwdLoc=keys (%par);$#tmp=0; foreach $kwd (@kwdLoc){ push(@tmp,$kwd) if ($kwd =~/$kwdHelp/i);} @kwdLoc=sort @tmp;} # (2) is there a 'help option file' ? if (defined $par{"fileHelpOpt"} && -e $par{"fileHelpOpt"} && $kwdHelp ne "special"){ print $syntaxLoc; open("FHIN",$par{"fileHelpOpt"}) || cluck "*** $sbrName: could NOT open file".$par{"fileHelpOpt"}; while(){ next if ($_=~/^\#/); $line=$_; $tmp=$_;$tmp=~s/\s//g; next if (length($tmp)<2); next if ($_=~/^\s/ && ! $Lok); if ($Lok && $_=~/^\s/){ print $_; next;} elsif ($Lok && $_!~/^\s/){ $Lok=0;} if (! $Lok && $_ !~ /^[\s\t]+/){ $line=$_; ($tmp1,$tmp2)=split(/[\s\t]+/,$_); $Lok=1 if (length($tmp1)>1 && $tmp1 =~ /$kwdHelp/i); print $line if ($Lok);}}close(FHIN); print "-" x 80, "\n";} # (3) is there a default file? elsif (defined $par{"fileDefaults"} && -e $par{"fileDefaults"} && $kwdHelp ne "special"){ ($Lok,$msg,%def)=&brIniRdDef($par{"fileDefaults"}); $def{"kwd"}="" if (! $Lok); # hack: short cut error @kwdLoc=split(/,/,$def{"kwd"});$#tmp=0; foreach $kwd (@kwdLoc){ if ($kwd =~/$kwdHelp/i){ push(@tmp,$kwd); if (defined $def{$kwd,"expl"}){ $def{$kwd,"expl"}=~s/\n/\n--- /g; push(@expLoc,$def{$kwd,"expl"});} else { push(@expLoc," ");}}} @kwdLoc=@tmp;} # (4) else: read itself elsif ($kwdHelp ne "special"){ ($Lok,$msg,%def)= &brIniHelpRdItself($tmp{"sourceFile"}); Carp::confess('..... verrry sorry the option blew up ... ') if (! $Lok); $def{"kwd"}="" if (! $Lok); # hack: short cut error @kwdLoc=split(/,/,$def{"kwd"});$#tmp=0; foreach $kwd (@kwdLoc){ next if ($kwd !~/$kwdHelp/i && $kwdHelp !~ /$kwd/ ); push(@tmp,$kwd); if (defined $def{$kwd}){ $def{$kwd}=~s/\n[\t\s]*/\n--- /g; push(@expLoc,$def{$kwd});} else {push(@expLoc," ");}} @kwdLoc=@tmp;} $Lerr=1; if ($#kwdLoc>0){ # (4) write the stuff printf "--- %-20s %-s\n","." x 20,"." x 53; printf "--- %-20s %-s\n","keyword","explanation"; printf "--- %-20s %-s\n","." x 20,"." x 53; foreach $it(1..$#kwdLoc){ $tmp=" "; $tmp=$expLoc[$it] if (defined $expLoc[$it]); printf "--- %-20s %-s\n",$kwdLoc[$it],$tmp;} printf "--- %-20s %-s\n","." x 20,"." x 53; print "--- \n";$Lerr=0;} # (5) special help? if (defined $tmpSpecial || ($kwdHelp eq "special" && defined $tmp{"special"})){ print "--- Special help for '$kwdHelp':\n"; if ($kwdHelp eq "special"){ print @scrSpecialLoc,"\n";} else { foreach $scrSpecialLoc (@scrSpecialLoc) { $scrSpecialLoc=~s/\n$//; next if ($scrSpecialLoc !~ /$kwdHelp/); print "$scrSpecialLoc";} print "\n";} $Lerr=0; return(1,"fin") if ($kwdHelp eq "special");} print "--- sorry, no explanations found for keyword '$kwdHelp'\n" if ($Lerr); return(1,"fin loop?");} # ------------------------------ # wants settings for keyword # ------------------------------ elsif ($#PARAMS>=2 && $PARAMS[1] eq "def"){ $kwdHelp=$PARAMS[2]; print "-" x 80, "\n"; print "--- Perl script $scrName.pl (",$tmp{"sourceFile"},")\n"; if (%par){ @kwdLoc=sort keys (%par); if ($#kwdLoc>1){ print "--- the default settings are:\n"; printf "--- %-20s %-s\n","." x 20,"." x 53; printf "--- %-20s = %-s\n","keyword","value"; printf "--- %-20s %-s\n","." x 20,"." x 53; foreach $kwd(@kwdLoc){ next if ($kwd !~ /$kwdHelp/); printf "--- %-20s = %-s\n",$kwd,$par{$kwd};} printf "--- %-20s %-s\n","." x 20,"." x 53; print " \n";}} else { print "--- sorry, no setting defined in \%par\n";} return(1,"fin loop?");} return(1,"ok $sbrName"); } # end of brIniHelp #============================================================================== sub brIniHelpLoop { local($promptLoc,%tmp)=@_; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # brIniHelpLoop loop over help # in/out: see brIniHelp # out: 1|0,msg, implicit: # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $sbrName="lib-br:"."brIniHelpLoop";$fhinLoc="FHIN_"."brIniHelpLoop"; ($Lok,$msg)= # want help? &brIniHelp(%tmp); return(&errSbrMsg("after brIniHelp",$msg)) if (! $Lok); # ------------------------------ # loop over help # ------------------------------ if ($msg =~ /^fin loop/) { $#tmp=0; foreach $txt (@scrHelpLoop) { $txt=~s/^.*\.pl\s*//g; push(@tmp,$txt); } @scrHelpLoop2=@tmp; $Lquit=0; $def="help"; $ct=0; while (! $Lquit) { printf "%-s %-s\n", $promptLoc,"-" x (79 - length($promptLoc)); printf "%-s %-15s %-s\n",$promptLoc,"", "Interactive help"; printf "%-s %-15s %-s\n",$promptLoc,"OPTIONS",""; foreach $txt (@scrHelpLoop2) { printf "%-s %-15s %-s\n",$promptLoc," ",$txt; } printf "%-s %-15s %-s\n",$promptLoc,"",""; printf "%-s %-15s %-s\n",$promptLoc,"ABBREVIATIONS", "h=help, d=def (e.g. 'h kwd')"; printf "%-s %-15s %-s\n",$promptLoc,"ENOUGH ?", "[quit|q|e|exit] to end"; $def="$PARAMS[1]" if (defined $def); # take previous $ansr= &get_in_keyboard("type",$def,$promptLoc); # <--- QUIT $tmp=$ansr;$tmp=~s/\s//g; if ($ansr=~/^[q|quit|e|exit]$/) { $Lquit=1; last; } # redefine @PARAMS @PARAMS=split(/\s+/,$ansr); $PARAMS[1]="help" if ($PARAMS[1] eq "h" || $PARAMS[1] eq "H"); $PARAMS[1]="def" if ($PARAMS[1] eq "d" || $PARAMS[1] eq "D"); ++$ct; # add keyword help if ($ct > 1 && $#PARAMS < 2) { $PARAMS[2]=$PARAMS[1]; $PARAMS[1]="help";} $txt1="start again with("; $txt2=join(' ',@PARAMS); $lenfin=80 - 6 - (length($txt1) + length($txt2)); print "--- ","-" x length($txt1),"#" x length($txt2),"--", "-" x $lenfin,"\n"; print "--- ",$txt1,$txt2,")\n"; print "--- ","-" x length($txt1),"#" x length($txt2),"--", "-" x $lenfin,"\n"; # call again ($Lok,$msg)= &brIniHelp(%tmp); return(&errSbrMsg("after brIniHelp",$msg)) if (! $Lok); # <--- QUIT $Lquit=1 if ($msg eq "fin"); } $msg="fin"; } return(1,$msg); } # end of brIniHelpLoop #============================================================================== sub brIniHelpRdItself { local($fileInLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # brIniHelpRdItself reads the calling perl script (scrName), # searches for 'sub\siniDef', and gets comment lines # in: perl-script-source # out: (Lok,$msg,%tmp), with: # $tmp{"kwd"} = 'kwd1,kwd2' # $tmp{"$kwd1"} = explanations for keyword 1 #------------------------------------------------------------------------------- $sbrName="lib-br:"."brIniHelpRdItself";$fhinLoc="FHIN_"."brIniHelpRdItself"; $Lok= &open_file("$fhinLoc","$fileInLoc"); return(0,"*** ERROR $sbrName: old '$fileInLoc' not opened\n") if (! $Lok); # read file while (<$fhinLoc>) { # search for initialising subroutine last if ($_=/^su[b] iniDef.* \{/);} $Lis=0;undef %tmp; $#tmp=0; while (<$fhinLoc>) { # read lines with ' %par{"kwd"}= $val # comment ' $_=~s/\n//g; last if ($_=~/^su[b] .*\{/ && $_!~/^su[b] iniDef.* \{/); # new expression if ($_=~/[\s\t]+\$par\{[\"\']?([^\"\'\}]+)[\"\']?\}[^\#]*\#\s*(.*)$/){ $Lis=1;$kwd=$1; push(@tmp,$kwd); $tmp{$kwd}=$2 if (defined $2);} # end if only '------' line elsif ($Lis && defined $tmp{$kwd} && $_=~/^[\s\t]+\# ?\-+/){ $Lis=0;} # add to previous (only if it had an explanation) elsif ($Lis && defined $tmp{$kwd} && $_=~/^[\s\t]*\# (.*)$/){ $tmp{$kwd}.="\n".$1;} # end if nothing followed elsif ($Lis){ $Lis=0;}}close($fhinLoc); $tmp{"kwd"}=join(',',@tmp); return(1,"ok $sbrName",%tmp); } # end of brIniHelpRdItself #============================================================================== sub brIniRdDef { local ($fileLoc)=@_; $[ =1 ; #------------------------------------------------------------------------------- # brIniRdDef reads defaults for initialsing parameters # in GLOBAL: $par{},@PARAMS # out GLOBAL: $par{} (i.e. changes settings automatically) # in: file_default # out: ($Lok,$msg,%defaults) with: # $defaults{"kwd"}= 'kwd1,kwd2,...,' # $defaults{"$kwd1"}= val1 # $defaults{"$kwd1","expl"}=explanation for kwd1 # note: long explanations split by '\n' #------------------------------------------------------------------------------- $sbrName="lib-br:brIniRdDef"; $fhin="FHIN_brIniRdDef"; &open_file("$fhin","$fileLoc") || return(0,"*** ERROR $sbrName: failed to open in '$fileLoc'\n"); undef %defaults; $#kwd=0; $Lis=0; # ------------------------------ while (<$fhin>){ # read file next if (length($_)<3 || $_=~/^\#/ || $_!~/\t/); # ignore lines beginning with '#' $_=~s/\n//g; $line=$_; $tmp=$line; $tmp=~s/[\s\#\-\*\.\=\t]//g; # ignore lines with only spaces or '-|#|*|=' next if (length($tmp)<1); # purge leading blanks and tabs $line=~s/^[\s\t]*|[\s\t]*$//g; # ------------------------------ # (1) case 'kwd val # comment' if ($line=~/^([^\s\t]+)[\s\t]+([^\s\t]+)[\s\t]+\# ?(.*)$/){ $kwd=$1; push(@kwd,$kwd); $defaults{$kwd}=$2; $defaults{$kwd,"expl"}=$3 if (defined $3 && length($3)>1); $Lis=1;} # (2) case 'kwd val' elsif ($line=~/^([^\s\t]+)[\s\t]+([^\s\t]+)[\s\t]*$/){ $kwd=$1; $defaults{$kwd}=$2; $Lis=1; $defaults{$kwd,"expl"}=""; } # (3) case ' # ----' elsif ($Lis && $line =~ /^\#\s*[\-\=\_\.\*]+/){ $Lis=0;} elsif ($Lis && defined $defaults{$kwd,"expl"} && $line =~ /^\#\s*(.*)$/){ $defaults{$kwd,"expl"}.="\n".$1;}} close($fhin); # ------------------------------ foreach $kwd (@kwd){ # fill in wild cards $defaults{$kwd}=$ARCH if ($defaults{$kwd}=~/ARCH/);} # ------------------------------ foreach $kwd (@kwd){ # complete it $defaults{$kwd,"expl"}=" " if (! defined $defaults{$kwd,"expl"});} $defaults{"kwd"}=join(',',@kwd); # ------------------------------ # check the defaults read # AND OVERWRITE $par{} !! @kwdDef=keys %par; foreach $kwd (@kwdDef){ $tmp{$kwd}=1;} $Lok=1; foreach $kwd (@kwd){ if (! defined $tmp{$kwd}){ $Lok=0; print "*** ERROR $sbrName: wrong keyword ($kwd) in defaults file ", $par{"fileDefaults"},"\n";} # ****************************** else { # overwrite # ****************************** $par{$kwd}=$defaults{$kwd};}} return(0,"*** ERROR $sbrName failed finishing to read defaults file\n") if (! $Lok); return(1,"ok $sbrName",%defaults); } # end of brIniRdDef #============================================================================== sub brIniSet { $[ =1 ; #------------------------------------------------------------------------------- # brIniSet changing parameters according to input arguments # e.g. adding directories to file names asf #------------------------------------------------------------------------------- $sbrName="lib-br:brIniSet"; @kwd=sort keys(%par) if (%par); # ------------------------------ $#tmp=0; # purge empty keywords foreach $kwd (@kwd){ if (defined $kwd && length($kwd)>=1 && defined $par{$kwd}){ push(@tmp,$kwd);} else { print "-*- WARN $sbrName: for kwd '$kwd', par{kwd} not defined!\n";}} @kwd=@tmp; # jobId $par{"jobid"}=$$ if (! defined $par{"jobid"} || $par{"jobid"} eq 'jobid' || length($par{"jobid"})<1); # ------------------------------ # add jobid foreach $kwd (@kwd){ $par{$kwd}=~s/jobid/$par{"jobid"}/;} # ------------------------------ # WATCH it for file lists: add dirIn if (defined $par{"dirIn"} && $par{"dirIn"} ne "unk" && $par{"dirIn"} ne "local" && length($par{"dirIn"})>1){ foreach $fileIn(@fileIn){ $fileIn=$par{"dirIn"}.$fileIn if (! -e $fileIn); if (! -e $fileIn){ print "*** $sbrName: no fileIn=$fileIn, dir=",$par{"dirIn"},",\n"; return(0);}}} $#kwdFileOut=0; # ------------------------------ foreach $kwd (@kwd){ # add 'pre' 'title' 'ext' to output files not specified next if ($kwd !~ /^fileOut/); push(@kwdFileOut,$kwd); next if (defined $par{$kwd} && $par{$kwd} ne "unk" && length($par{$kwd})>0); $kwdPre=$kwd; $kwdPre=~s/file/pre/; $kwdExt=$kwd; $kwdExt=~s/file/ext/; $pre="";$pre=$par{"$kwdPre"} if (defined $par{"$kwdPre"}); $ext="";$ext=$par{"$kwdExt"} if (defined $par{"$kwdExt"}); if (! defined $par{"title"} || $par{"title"} eq "unk"){ $par{"title"}=$scrName;$par{"title"}=~tr/[a-z]/[A-Z]/;} # capitalize title $par{$kwd}=$pre.$par{"title"}.$ext;} # ------------------------------ # add output directory if (defined $par{"dirOut"} && $par{"dirOut"} ne "unk" && $par{"dirOut"} ne "local" && length($par{"dirOut"})>1){ if (! -d $par{"dirOut"}){ # make directory print "--- $sbrName mkdir ",$par{"dirOut"},"\n" if ($par{"verb2"}); $tmp=$par{"dirOut"};$tmp=~s/\/$// if ($tmp=~/\/$/); $Lok= mkdir ($tmp,umask); print "*** $sbrName failed making directory '", $par{"dirOut"},"'\n" if (! $Lok);} # add slash $par{"dirOut"}.="/" if (-d $par{"dirOut"} && $par{"dirOut"} !~/\/$/); foreach $kwd (@kwdFileOut){ next if ($par{$kwd} =~ /^$par{"dirOut"}/); next if ($par{$kwd} eq "unk" || ! $par{$kwd}); $par{$kwd}=$par{"dirOut"}.$par{$kwd} if (-d $par{"dirOut"});}} # ------------------------------ # push array of output files $#fileOut=0 if (! defined @fileOut); foreach $kwd (@kwdFileOut){ push(@fileOut,$par{$kwd});} # ------------------------------ # temporary files: add work dir if( !$par{dirWork} ){ $par{dirWork} = File::Temp::tempdir( CLEANUP => !$par{debug} ); } if (defined $par{"dirWork"} && $par{"dirWork"} ne "unk" && $par{"dirWork"} ne "local" && length($par{"dirWork"})>1) { if (! -d $par{"dirWork"}){ # make directory print "--- $sbrName mkdir ",$par{"dirWork"},"\n" if ($par{"verb2"}); $tmp=$par{"dirWork"};$tmp=~s/\/$// if ($tmp=~/\/$/); $Lok= mkdir ($tmp,umask); print "*** $sbrName failed making directory '",$par{"dirWork"},"'\n" if (! $Lok);} $par{"dirWork"}.="/" if (-d $par{"dirWork"} && $par{"dirWork"} !~/\/$/); # add slash foreach $kwd (@kwd){ next if ($kwd !~ /^file/); next if ($kwd =~ /^file(In|Out|Help|Def|Mat)/i); # lkajan: infernal. This should be a next UNLESS /something/ condition. $par{$kwd}=~s/jobid/$par{"jobid"}/ ; next if ($par{$kwd} =~ /^$par{"dirWork"}/); $par{$kwd}=$par{"dirWork"}.$par{$kwd};}} # ------------------------------ # blabla $Lverb=1 if (defined $par{"verbose"} && $par{"verbose"}); $Lverb2=1 if (defined $par{"verb2"} && $par{"verb2"}); $Lverb3=1 if (defined $par{"verb3"} && $par{"verb3"}); # ------------------------------ # add ARCH if (defined $ARCH || defined $par{"ARCH"}){ $ARCH=$par{"ARCH"} if (! defined $ARCH && defined $par{"ARCH"}); $par{"ARCH"}=$ARCH if ( defined $ARCH && ! defined $par{"ARCH"}); foreach $kwd (@kwd){ # add directory to executables next if ($kwd !~ /^exe/); next if ($par{$kwd} !~ /ARCH/); $par{$kwd}=~s/ARCH/$ARCH/;}} # ------------------------------ foreach $kwd (@kwd){ # add directory to executables next if ($kwd !~/^exe/); next if (-e $par{$kwd} || -l $par{$kwd}); # try to add perl script directory next if (! defined $par{"dirPerl"} || ! -d $par{"dirPerl"}); next if ($par{$kwd}=~/$par{"dirPerl"}/); # did already, no result $tmp=$par{"dirPerl"}; $tmp.="/" if ($tmp !~ /\/$/); $tmp=$tmp.$par{$kwd}; next if (! -e $tmp && ! -l $tmp); $par{$kwd}=$tmp; } # ------------------------------ # priority if (defined $par{"optNice"} && $par{"optNice"} ne " " && length($par{"optNice"})>0){ $niceNum=""; if ($par{"optNice"}=~/nice\s*-/){ $par{"optNice"}=~s/nice-/nice -/; $niceNum=$par{"optNice"};$niceNum=~s/\s|nice|\-|\+//g; } elsif ($par{"optNice"}=~/^\d+$/){ $niceNum=$par{"optNice"};} $niceNum=~s/\D//g; setpriority(0,0,$niceNum) if (length($niceNum)>0); } return(1); } # end of brIniSet #============================================================================== sub brIniWrt { local($exclLoc,$fhTraceLocSbr)=@_; $[ =1 ; #------------------------------------------------------------------------------- # brIniWrt write initial settings on screen # in: $excl : 'kwd1,kwd2,kw*' exclude from writing # '*' for wild card # in: $fhTrace : file handle to write # = 0, or undefined -> STDOUT #------------------------------------------------------------------------------- $sbrName="lib-br:"."brIniWrt"; return(0,"*** $sbrName: no settings defined in %par\n") if (! %par); $fhTraceLocSbr="STDOUT" if (! defined $fhTraceLocSbr || ! $fhTraceLocSbr); if (defined $Date) { $dateTmp=$Date; } else { $tmp=`date`; $tmp=~s/\n//g if (defined $tmp); $dateTmp=$tmp || "before year 2000"; } print $fhTraceLocSbr "--- ","-" x 80, "\n"; print $fhTraceLocSbr "--- Initial settings for $scrName ($0) on $dateTmp:\n"; @kwd= sort keys (%par); # ------------------------------ # to exclude @tmp= split(/,/,$exclLoc) if (defined $exclLoc); $#exclLoc=0; undef %exclLoc; foreach $tmp (@tmp) { if ($tmp !~ /\*/) { # exact match $exclLoc{"$tmp"}=1; } else { # wild card $tmp=~s/\*//g; push(@exclLoc,$tmp); } } if ($#exclLoc > 0) { $exclLoc2=join('|',@exclLoc); } else { $exclLoc2=0; } $#kwd2=0; # ------------------------------ foreach $kwd (@kwd) { # parameters next if (! defined $par{$kwd}); next if ($kwd=~/expl$/); next if (length($par{$kwd})<1); if ($kwd =~/^fileOut/) { push(@kwd2,$kwd); next;} next if ($par{$kwd} eq "unk"); next if (defined $exclLoc{$kwd}); # exclusion required next if ($exclLoc2 && $kwd =~ /$exclLoc2/); printf $fhTraceLocSbr "--- %-20s '%-s'\n",$kwd,$par{$kwd};} # ------------------------------ if ($#kwd2>0){ # output files print $fhTraceLocSbr "--- \n","--- Output files:\n"; foreach $kwd (@kwd2) { next if ($par{$kwd} eq "unk"|| ! $par{$kwd}); next if (defined $exclLoc{$kwd}); # exclusion required next if ($exclLoc2 && $kwd =~ /$exclLoc2/); printf $fhTraceLocSbr "--- %-20s '%-s'\n",$kwd,$par{$kwd};}} # ------------------------------ # input files if (defined @fileIn && $#fileIn>1){ # get dirs $#tmpdir=0; undef %tmpdir; foreach $file (@fileIn){ if ($file =~ /^(.*\/)[^\/]/){ $tmp=$1;$tmp=~s/\/$//g; if (! defined $tmpdir{$tmp}){push(@tmpdir,$tmp); $tmpdir{$tmp}=1;}}} # write print $fhTraceLocSbr "--- \n"; printf $fhTraceLocSbr "--- %-20s number =%6d\n","Input files:",$#fileIn; printf $fhTraceLocSbr "--- %-20s dirs =%-s\n","Input dir:", join(',',@tmpdir) if ($#tmpdir == 1); printf $fhTraceLocSbr "--- %-20s dirs =%-s\n","Input dirs:",join(',',@tmpdir) if ($#tmpdir > 1); for ($it=1;$it<=$#fileIn;$it+=5){ print $fhTraceLocSbr "--- IN: "; $it2=$it; while ( $it2 <= $#fileIn && $it2 < ($it+5) ){ $tmp=$fileIn[$it2]; $tmp=~s/^.*\///g; printf $fhTraceLocSbr "%-18s ",$tmp;++$it2;} print $fhTraceLocSbr "\n";}} elsif ((defined @fileIn && $#fileIn==1) || (defined $fileIn && -e $fileIn)){ $tmp=0; $tmp=$fileIn if (defined $fileIn && $fileIn); $tmp=$fileIn[1] if (! $tmp && defined @fileIn && $#fileIn==1); print $fhTraceLocSbr "--- \n"; printf $fhTraceLocSbr "--- %-20s '%-s'\n","Input file:",$tmp;} print $fhTraceLocSbr "--- \n"; printf $fhTraceLocSbr "--- %-20s %-s\n","excluded from write:",$exclLoc if (defined $exclLoc); print $fhTraceLocSbr "--- \n","--- ","-" x 80, "\n","--- \n"; return(1,"ok $sbrName"); } # end of brIniWrt #=============================================================================== sub bynumber { #------------------------------------------------------------------------------- # bynumber function sorting list by number #------------------------------------------------------------------------------- $a<=>$b; } # end of bynumber #=============================================================================== sub bynumber_high2low { #------------------------------------------------------------------------------- # bynumber_high2low function sorting list by number (start with high) #------------------------------------------------------------------------------- $b<=>$a; } # end of bynumber_high2low #============================================================================== sub complete_dir { return(&completeDir(@_)); } # alias #=============================================================================== sub completeDir {local($DIR)=@_; $[=1 ; return(0) if (! defined $DIR); return($DIR) if ($DIR =~/\/$/); return($DIR."/");} # end of completeDir #============================================================================== sub convFastamul2many { local($fileInLoc,$fileOutLoc,$formOutLoc,$fragLoc,$extrLoc,$fhErrSbr, $LdoCompressLoc,$LshortNamesLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # convFastamul2msf converts FASTAmul into many formats: FASTA,MSF,PIR,SAF,PIRmul # in: $fileInLoc,$fileOutLoc,$formOutLoc,$fragLoc,$extrLoc,$fhErrSbr # in: $formOutLoc format MSF|FASTA|PIR # in: $fragLoc=n-m fragment to extract (optional) # in: $extrLoc=i,j,k take only sequences i,j,k from PIRmul # in: NOTE: to leave blank =0, e.g. # in: 'file.fastamul,file.f,0,5' would get fifth sequence # in: $LdoCompressLoc delete insertions in master # in: $LshortNamesLoc: if 1 names <=15 characters # out: implicit: file written # err: (1,'ok'), (0,'message') # err: e: (1,msg) -> ok # err: a: (0,msg) -> some arguments missing/files not opened # err: b: (2,msg) -> no output file written # err: b: (3,msg) -> ERROR from msfCheckFormat # specification of format see interpretSeqFastamul #------------------------------------------------------------------------------- $sbrName="lib-br:"."convFastamul2msf";$fhinLoc="FHIN_"."convFastamul2msf"; # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); return(0,"*** $sbrName: not def formOutLoc!") if (! defined $formOutLoc); $fragLoc=0 if (! defined $fragLoc); $extrLoc=0 if (! defined $extrLoc); $LdoCompressLoc=0 if (! defined $LdoCompressLoc); $LshortNamesLoc=0 if (! defined $LshortNamesLoc); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); # interpret input $formOutLoc=~tr/[A-Z]/[a-z]/; if ($fragLoc){ $fragLoc=~s/\s//g; return(0,"*** $sbrName: syntax of fragLoc ($fragLoc) must be :\n". " 'ifir-ilas', where ifir,ilas are integers (or 1-*)\n") if ($fragLoc && $fragLoc !~/[\d\*]\-[\d\*]/);} if ($extrLoc){ $extrLoc=~s/\s//g; return(0,"*** $sbrName: syntax of extrLoc ($extrLoc) must be :\n". " 'n1,n2,n3-n4', where n* are integers\n") if ($extrLoc && $extrLoc =~/[^0-9\-,]/); @extr=&get_range($extrLoc); undef %take; foreach $it(@extr){ $take{$it}=1;}} # open file open($fhinLoc,$fileInLoc) || Carp::confess( "failed to open $fileInLoc: $!" ) || return(0,"*** ERROR $sbrName: fileIn=$fileInLoc, not opened\n"); # ------------------------------ undef %fasta; $ct=$#id=0; # read file while (<$fhinLoc>) { $_=~s/\n//g; if ($_=~/^\s*\>\s*(.*)$/){ # is id $name=$1;$name=~s/[\s\t]+/ /g; # purge too many blanks $name=~s/^\s*|\s*$//g; # purge leading blanks $id=$name;$id=~s/^(\S+).*$/$1/; # shorter identifier ++$ct; $id="$ct" if (length($id)<1); push(@id,$id); $fasta{"id",$ct}= $name; $fasta{"seq",$ct}="";} else { # is sequence $_=~s/\s|\t//g; $fasta{"seq",$ct}.=$_;}} # ------------------------------ undef %tmp; $ctTake=0; # store names for passing variables foreach $it (1..$#id){ next if ($extrLoc && (! defined $take{$it} || ! $take{$it})); ++$ctTake; $tmp{"id",$ctTake}= $fasta{"id",$it}; $tmp{"seq",$ctTake}=$fasta{"seq",$it};} $tmp{"NROWS"}=$ctTake; %fasta=%tmp; undef %tmp; # ------------------------------ # compress # ------------------------------ if ($LdoCompressLoc){ $ctcleave=$ctres=0; $lenloc=length($fasta{"seq",1}); # all 0 foreach $itprot (1..$fasta{"NROWS"}){ $fasta{"new",$itprot}=""; } # loop over all residues foreach $itres (1..$lenloc){ # is residue if (substr($fasta{"seq",1},$itres,1)=~/^[A-Za-z]/){ foreach $itprot (1..$fasta{"NROWS"}){ $fasta{"new",$itprot}.=substr($fasta{"seq",$itprot},$itres,1); } ++$ctres; next;} # seems insertion ++$ctcleave; } # check: sum ok? return(0,"*** $sbrName: failed at compressing ncleave=$ctcleave, nresnew=$ctres,". " before=".$lenloc." file=$fileInLoc!") if ($lenloc != ($ctcleave + $ctres)); # replace by cleaved version foreach $itprot (1..$fasta{"NROWS"}){ $fasta{"seq",$itprot}=$fasta{"new",$itprot}; }} $ctres=length($fasta{"seq",1}); # ------------------------------ # shorten names? # ------------------------------ if ($LshortNamesLoc){ undef %fasta2; foreach $it (1..$fasta{"NROWS"}){ if (length($fasta{"id",$it})<=15) { $fasta2{$fasta{"id",$it}}=1; next;} # too long $id=$fasta{"id",$it}; $id=~s/^.*\|//g; # purge paths # purge blanks $id=~s/\s//g if (length($id)>15); # purge extensions $id=~s/\.[a-z]//g if (length($id)>15); # cleave if (length($id)>15){ $id=substr($id,1,15);} # not unique if (defined $fasta2{$id}){ $id=substr($id,1,12); $ct=1;$idfasta=$id.$ct; while(defined $fasta2{$idfasta}){ ++$ct; last if ($ct>999);} $id=$idfasta;} return(0,"*** $sbrName: shoot id=$id, orig=",,", failed shortening\n") if (defined $fasta2{$id} || length($id)>15); $fasta2{$id}=1; $fasta{"id",$it}=$id; } undef %fasta2; } # ------------------------------ # select subsets # ------------------------------ if ($fragLoc){ ($beg,$end)=split('-',$fragLoc);$len=length($fasta{"seq","1"}); $beg=1 if ($beg eq "*"); $end=$len if ($end eq "*"); if ($len< ($end-$beg+1)){ print "-*- WARN $sbrName: $beg-$end not possible, as length of protein=$len\n";} else { foreach $it (1..$fasta{"NROWS"}){ $fasta{"seq",$it}=substr($fasta{"seq",$it},$beg,($end-$beg+1));}}} # -------------------------------------------------- # write output # -------------------------------------------------- # ------------------------------ # write an MSF formatted file if ($formOutLoc eq "msf"){ undef %tmp; undef %tmp2; foreach $it (1..$fasta{"NROWS"}){ $name= $fasta{"id",$it}; $name=~s/^\s*|\s*$//g;$name=~s/^(\S+).*$/$1/g; $name=substr($name,1,14) if (length($name)>14); # yy hack for convert_seq if (defined $tmp2{$name}){ # avoid duplication $ct=0;while (defined $tmp2{$name}){ ++$ct;$name=substr($name,1,12).$ct;}}$tmp2{$name}=1; $tmp{$it}= $name; $tmp{SEQS}->{$name}= $fasta{"seq",$it}; } $tmp{"NROWS"}=$fasta{"NROWS"}; $tmp{"FROM"}=$fileInLoc; $tmp{"TO"}= $fileOutLoc; $fhout="FHOUT_MSF_FROM_SAF"; open("$fhout",">$fileOutLoc") || Carp::confess( "failed to open $fileOutLoc: $!" ) || # open file return(0,"*** $sbrName cannot open fileOutLoc=$fileOutLoc\n"); $Lok= &msfWrt($fhout,%tmp); # write the file close("$fhout"); return(0,"*** ERROR $sbrName: failed in MSF format ($fileOutLoc)\n") if (! $Lok);} # ------------------------------ # write a SAF,PIR,FASTA, formatted file elsif ($formOutLoc eq "saf" || $formOutLoc eq "fastamul" || $formOutLoc eq "pirmul" || $formOutLoc eq "fasta" || $formOutLoc eq "pir" || $formOutLoc eq "gcg"){ if ($formOutLoc =~ /^fasta/){ ($Lok,$msg)=&fastaWrtMul($fileOutLoc,%fasta);} elsif ($formOutLoc =~ /^pir/){ ($Lok,$msg)=&pirWrtMul($fileOutLoc,%fasta);} elsif ($formOutLoc eq "saf"){ ($Lok,$msg)=&safWrt($fileOutLoc,%fasta);} elsif ($formOutLoc eq "gcg"){ ($Lok,$msg)=&gcgWrt($fileOutLoc,$fasta{"id","1"},$fasta{"seq","1"});} return(0,"*** ERROR $sbrName: failed in FASTA format ($fileOutLoc)\n".$msg."\n") if (! $Lok);} # ------------------------------ # file existing?? return(2,"*** $sbrName ERROR after write, missing fileOutLoc=$fileOutLoc\n") if (! -e $fileOutLoc); # ------------------------------ # make a basic test of msf format if ($formOutLoc eq "msf"){ ($Lok,$msg)= &msfCheckFormat($fileOutLoc); return(3,"$msg"."*** $sbrName ERROR from msfCheckFormat fileOutLoc=$fileOutLoc\n") if (! $Lok);} # ------------------------------ $#fasta=$#nameLoc=0; # save space undef %fasta; undef %nameInBlock; undef %tmp; return(1,"$sbrName ok"); } # end of convFastamul2many #============================================================================== sub convFssp2Daf { local ($fileFssp,$fileDaf,$fileDafTmp,$exeConv,$dirDsspLoc) = @_ ; local ($fhinLoc,$fhoutLoc,$tmp,@tmp); $[ =1 ; #-------------------------------------------------------------------------------- # convFssp2Daf converts an HSSP file into the DAF format # in: fileHssp, fileDaf, execonvFssp2Daf # out: 1 if converted file in DAF and existing, 0 else #-------------------------------------------------------------------------------- $sbrName="lib-br:convFssp2Daf"; return(0,"*** ERROR $sbrName: fileFssp=$fileFssp missing\n") if (! defined $fileFssp || ! -e $fileFssp); $dirDsspLoc="" if (! defined $dirDsspLoc || ! -d $dirDsspLoc); # ------------------------------ # run via system call: # ------------------------------ if ($exeConv=~/\.pl/){ system("$exeConv $fileFssp $dirDsspLoc >> $fileDafTmp") && Carp::confess( "cmd $exeConv $fileFssp $dirDsspLoc >> $fileDafTmp failed: ".( $? >> 8 ) ); } # ------------------------------ # include as package # ------------------------------ else { &conv_fssp2daf_lh'conv_fssp2daf_lh($fileFssp,$dirDsspLoc,"fileOut=$fileDafTmp"); } # e.e' # ------------------------------ # as Liisa cannot do it: clean up! $fhinLoc= "FhInconvFssp2Daf"; $fhoutLoc="FhOutconvFssp2Daf"; &open_file("$fhinLoc","$fileDafTmp") || return(0,"*** ERROR $sbrName failed to open temp=$fileDafTmp (piped from $exeConv)\n"); &open_file("$fhoutLoc",">$fileDaf") || return(0,"*** ERROR $sbrName failed to open new=$fileDaf\n"); # ------------------------------ while(<$fhinLoc>){ # header $tmp=$_; last if (/^\# idSeq/);print $fhoutLoc $tmp; } $tmp=~s/^\# //g; # correct error 1 (names) $tmp=~s/\n//g;$tmp=~s/^[\t\s]*|[\t\s]*$//g; @tmp=split(/[\t\s]+/,$tmp); foreach $tmp(@tmp){ print $fhoutLoc "$tmp\t";}print $fhoutLoc "\n"; # ------------------------------ while(<$fhinLoc>){ # body $_=~s/\n//g;$_=~s/^[\s\t]*|[\s\t]*$//g; # purge trailing blanks @tmp=split(/[\t\s]+/,$_); $seq=$tmp[$#tmp-1];$str=$tmp[$#tmp]; # consistency return(0,"*** ERROR in $sbrName: lenSeq ne lenStr!\n". "*** seq=$seq,\n","*** str=$str,\n","*** line=$_,\n") if (length($seq) != length($str)); $seqOut=$strOut=""; # expand small caps foreach $it (1..length($seq)){ $seq1=substr($seq,$it,1);$str1=substr($str,$it,1); if ( ($seq1=~/[a-z]/) && ($str1=~/[a-z]/) ){ $seq1=~tr/[a-z]/[A-Z]/;$str1=~tr/[a-z]/[A-Z]/;$seqOut.=$seq1;$strOut.=$str1;} elsif ($seq1=~/[a-z]/){ $seq1=~tr/[a-z]/[A-Z]/;$seqOut.=$seq1;$strOut.=".";} elsif ($str1=~/[a-z]/){ $str1=~tr/[a-z]/[A-Z]/;$seqOut.=".";$strOut.=$str1;} else {$seqOut.=$seq1;$strOut.=$str1;}} # print $tmp[$#tmp-1]=$seqOut;$tmp[$#tmp]=$strOut; foreach $tmp(@tmp){print $fhoutLoc "$tmp\t";}print $fhoutLoc "\n"; } close($fhinLoc);close($fhoutLoc); return(1,"ok $sbrName") if ( (-e $fileDaf) && (&isDaf($fileDaf))); return(0,"*** ERROR $sbrName output $fileDaf missing or not DAF format\n"); } # end of convFssp2Daf #============================================================================== sub convGcg2fasta { local($fileInLoc,$fileOutLoc,$fragLoc,$LshortNamesLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # convGcg2fasta converts GCG to FASTA format # in: $fileInLoc,$fileOutLoc,$fragLoc # in: $fragLoc=n-m fragment to extract (optional) # in: $LshortNamesLoc: if 1 names <=15 characters # out: implicit: file out # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $sbrName="lib-br:"."convGcg2fasta";$fhinLoc="FHIN_"."convGcg2fasta"; # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); $fragLoc=0 if (! defined $fragLoc); $LshortNamesLoc=0 if (! defined $LshortNamesLoc); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); # ------------------------------ ($Lok,$id,$seq)= # read GCG &gcgRd($fileInLoc); return(0,"*** ERROR $sbrName: failed to read SWISS ($fileInLoc)\n". "*** found id=$id\n") if (! $Lok || length($seq)<1); undef %tmp; $tmp{"id","1"}= $id; $tmp{"seq","1"}=$seq; $tmp{"NROWS"}=1; # ------------------------------ # extract? if ($fragLoc){($beg,$end)=split(/-/,$frag); foreach $it (1..$tmp{"NROWS"}){ $tmp{"seq",$it}=substr($tmp{"seq",$it},$beg,($end-$beg+1));}} $ctres=length($tmp{"seq",1}); # ------------------------------ # shorten names? # ------------------------------ if ($LshortNamesLoc){ undef %tmp2; foreach $it (1..$tmp{"NROWS"}){ if (length($tmp{"id",$it})<=15) { $tmp2{$tmp{"id",$it}}=1; next;} # too long $id=$tmp{"id",$it}; $id=~s/^.*\|//g; # purge paths # purge blanks $id=~s/\s//g if (length($id)>15); # purge extensions $id=~s/\.[a-z]//g if (length($id)>15); # cleave if (length($id)>15){ $id=substr($id,1,15);} # not unique if (defined $tmp2{$id}){ $id=substr($id,1,12); $ct=1;$idtmp=$id.$ct; while(defined $tmp2{$idtmp}){ ++$ct; last if ($ct>999);} $id=$idtmp;} return(0,"*** $sbrName: shoot id=$id, orig=",,", failed shortening\n") if (defined $tmp2{$id} || length($id)>15); $tmp2{$id}=1; $tmp{"id",$it}=$id; } undef %tmp2; } # ------------------------------ # write output ($Lok,$msg)= &fastaWrtMul($fileOutLoc,%tmp); return(0,"*** ERROR $sbrName: failed to write FASTAmul ($fileOutLoc)\n". "*** msg=$msg\n") if (! $Lok); return(2,"-*- WARN $sbrName: wrong number written\n$msg\n") if ($Lok != 1); return(1,"ok $sbrName"); } # end of convGcg2fasta #============================================================================== sub convHssp2seq { local($fileInLoc,$chainInLoc,$fileOutLoc,$formOutLoc,$extOutLoc, $doExpand,$fragLoc,$extrLoc,$lenMin,$laliMin,$distMin,$pideMax,$fhErrSbr, $doSplitChainLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # convHssp2seq converts HSSP file to PIR(mul), FASTA(mul) # in: $fileInLoc file.hssp, file.out, format_of_output_file # in: $fileOutLoc output file with converted sequence(s) # in: $formOut output format (lower caps) # = 'fasta|pir' (or pirmul/fastamul) # in: $extOutLoc extension of expected output # (fragments into _beg_end$extension) # in: $doExpand do expand the deletions? (only for MSF) # in: $frag fragment e.g. '1-5','10-100' # = 0 for any # NOTE: only ONE fragment allowed, here # in: $extrIn number of protein(s) to extract # = 'p1-p2,p3' -> extract proteins p1-p2,p3 # = 0 for all # NOTE: = guide to write only the guide sequence!! # in: $lenMin minimal length of sequence to write # = 0 for any # in: $laliMin minimal alignment length (0 for wild card) # = 0 for any # in: $distMin minimal distance from HSSP threshold # = 0 for any # in: $pideMAx !! maximal sequence identity # = 0 for any # in: $fhSbr ERRORs of convert_seq # in: $doSplitChain split chains when converting to FASTA # # in GLOBAL $par{"pre_id"} -> id -> 'DB|id name' # # out: 1|0,msg,implicit: converted file # # err: 0,$msg -> unspecified error # err: 1,$msg -> ok # err: 2,$msg -> conversion option not supported #------------------------------------------------------------------------------- $sbrName="lib-br::"."convHssp2seq"; $fhinLoc="FHIN_"."convHssp2seq"; # ------------------------------ # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); $chainInLoc="*" if (! defined $chainInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); return(0,"*** $sbrName: not def formOutLoc!") if (! defined $formOutLoc); return(0,"*** $sbrName: not def extOutLoc!") if (! defined $extOutLoc); return(0,"*** $sbrName: not def doExpand!") if (! defined $doExpand); return(0,"*** $sbrName: not def fragLoc!") if (! defined $fragLoc); return(0,"*** $sbrName: not def extrLoc!") if (! defined $extrLoc); $lenMin=0 if (! defined $lenMin); $laliMin=0 if (! defined $laliMin); $distMin=0 if (! defined $distMin); $pideMax=0 if (! defined $pideMax); $fhErrSbr="STDOUT" if (! defined $fhErrSbr); $doSplitChainLoc=0 if (! defined $doSplitChainLoc); # existence of file return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); # ------------------------------ # supported output options return(&errSbr("output format $formOutLoc not supported by this sbr")) if ($formOutLoc !~ /^(pir|fasta)/); # ------------------------------ if ($fragLoc) { # fragment of proteins return(&errSbr("frag MUST be 'N1-N2', only ONE!")) if ($fragLoc !~/\d+\-\d+/); ($ifirFrag,$ilasFrag)=split(/\-/,$fragLoc); } else { $ifirFrag=$ilasFrag=0; } $LextrGuideOnly=0; # ------------------------------ undef %extr; # extraction of proteins if ($extrLoc eq "guide"){ # only guide $LextrGuideOnly=1;} elsif ($extrLoc) { # get numbers to extract return(&errSbr("extr MUST be of the form:\n". "'extr=n1-n2', or 'extr=n1,n2,n3-n4,n5'")) if ($extr !~ /\d/); @extr=&get_range($extr); return(&errSbr("you gave the argument 'extr=$extr', not valid!\n". "*** Ought to be of the form:\n". "'extr=n1-n2', or 'extr=n1,n2,n3-n4,n5'\n")) if ($#extr==0); foreach $tmp (@extr) { if ($tmp=~/\D/){ return(&errSbr("you gave the argument 'extr=$extr', not valid!\n". "*** Ought to be of the form:\n". "'extr=n1-n2', or 'extr=n1,n2,n3-n4,n5'\n")); } $extr{"$tmp"}=1; }} # ------------------------------ # determine id $pdbid= $fileInLoc;$pdbid=~s/^.*\/|\.hssp//g; $pdbid.="_".$chainInLoc if ($chainInLoc ne "*"); undef %tmp; # ------------------------------ if ($chainInLoc ne "*"){ # get chain positions ($Lok,%tmp)= &hsspGetChain($fileInLoc); return(&errSbr("failed on getchain($fileInLoc)")) if (! $Lok); foreach $it (1..$tmp{"NROWS"}){ next if ($chainInLoc ne $tmp{$it,"chain"}); $ifirChain=$tmp{$it,"ifir"}; $ilasChain=$tmp{$it,"ilas"}; }} else { $ifirChain=$ilasChain=0;} # ------------------------------ undef %tmp; # read header of HSSP ($Lok,%tmp)= &hsspRdHeader($fileInLoc,"HEADER","SEQLENGTH","ID","IDE","LALI","IFIR","ILAS"); return(&errSbr("failed on $fileInLoc")) if (! $Lok); $header=""; $header=$tmp{"HEADER"} if (defined $tmp{"HEADER"}); # ------------------------------ # too short -> skip return(1,"too short=".$tmp{"SEQLENGTH"}) if ($tmp{"SEQLENGTH"} < $lenMin); $#numTake=0; # ------------------------------ # process data if ($LextrGuideOnly){ # guide, only -> skip the following push(@numTake,1); $tmp{"NROWS"}=0; } foreach $it (1..$tmp{"NROWS"}){ # loop over all alis # not to include next if ($extrLoc && ! defined $extr{$it}); # not chain -> skip next if ($ifir && $ilas && ( ($tmp{"IFIR",$it} > $ilas) || ($tmp{"ILAS",$it} < $ifir) )); # lali too short next if ($laliMin > $tmp{"LALI",$it} ); # pide too high next if ($pideMax && $pideMax < 100*$tmp{"IDE",$it} ); # distance from threshold too high if ($distMin){ # compile distance to HSSP threshold (new) ($pideCurve,$msg)= &getDistanceNewCurveIde($tmp{"LALI",$it}); next if ($msg !~ /^ok/); $dist=100*$tmp{"IDE",$it} - $pideCurve; next if ($dist < $distMin); } push(@numTake,$it); # ok -> take } # ------------------------------ undef %tmp; # read alignments $kwdSeq="seqNoins"; # default: read ali without insertions $kwdSeq="seqAli" if ($doExpand); # wanted: read ali with insertions ($Lok,%tmp)= &hsspRdAli($fileInLoc,@numTake,$kwdSeq); return(&errSbrMsg("failed reading alis for $fileInLoc, num=". join(',',@numTake),$msg)) if (! $Lok); $nali=$tmp{"NROWS"}; undef %tmp2; # ------------------------------ if (defined $fragLoc){ # adjust for extraction (arg: frag=N1-n2) # additional complication if expand: change numbers if ($kwdSeq eq "seqAli"){ $seq=$tmp{$kwdSeq,"0"}; @tmp=split(//,$seq); $ct=0; foreach $it (1..$#tmp){ next if ($tmp[$it] eq "."); # skip insertions ++$ct; # count no-insertions next if ($ct > $ifirFrag); # outside of range to read next if ($ct < $ilasFrag); # outside of range to read $ifirFrag=$it if ($ct == $ifirFrag); # change begin !! WARN !! $ilasFrag=$it if ($ct == $ilasFrag);}}} # change end !! WARN !! # ---------------------------------------- # cut out non-chain, and not to read parts # ---------------------------------------- foreach $it (0..$nali){ # guide, only -> skip the following last if ($LextrGuideOnly && $it>0); # chain restricts reading if ($ifirChain && $ilasChain){ $tmp{$kwdSeq,$it}= substr($tmp{$kwdSeq,$it},$ifirChain,($ilasChain-$ifirChain+1));} # wanted fragment restricts reading if ($ifirFrag && $ilasFrag){ $len=length($tmp{$kwdSeq,$it}); return(&errSbr(" : sequence outside (f=$fileInLoc, c=$chainInLoc)\n". "itNali=$it, ifirFrag=$ifirFrag, len=$len, kwdSeq=$kwdSeq,\n". "seq=".$tmp{$kwdSeq,$it})) if ( $len < $ifirFrag); $lenWrt=($ilasFrag-$ifirFrag+1); $lenWrt=$len-$ifirFrag+1 if ($lenWrt < $len); $tmp{$kwdSeq,$it}= substr($tmp{$kwdSeq,$it},$ifirFrag,$len); } $ct=$it+1; $tmp2{"seq",$ct}=$tmp{$kwdSeq,$it}; undef $tmp{$kwdSeq,$it}; # slim-is-in ! $tmp2{"id",$ct}= $tmp{$it}; $tmp2{"id",$ct}.="_".$chainInLoc if ($ct==1 && $chainInLoc ne "*"); # add db asf $tmp2{"id",$ct}= $par{"pre_id"}."|".$tmp2{"id",$ct}." ".$header if ($par{"pre_id"}); } $tmp2{"NROWS"}=$nali+1; $tmp2{"NROWS"}=1 if ($LextrGuideOnly); undef %tmp; # slim-is-in! # ------------------------------ undef %tmp; # slim-is-in ! undef @numTake; # slim-is-in ! # -------------------------------------------------- # write output file # -------------------------------------------------- if ($formOutLoc =~ /^pir/){ # PIR, PIRmul ($Lok,$msg)= &pirWrtMul($fileOutLoc,%tmp2); } else { # FASTA, FASTAmul ($Lok,$msg)= &fastaWrtMul($fileOutLoc,%tmp2); } return(&errSbrMsg("failed writing out=$fileOutLoc, for in=$fileInLoc",$msg)) if (! $Lok); print $fhErrSbr # warning if returned Lok==2 "-*- WARN $sbrName: outformat=$formOutLoc, not enough written:\n",$msg,"\n" if ($Lok==2); undef %tmp2; # slim-is-in ! return(1,"ok $sbrName"); } # end of convHssp2seq #============================================================================== sub convMsf2saf { local($fileInLoc,$fileOutLoc,$doCompressLoc) = @_ ; local($sbrName,$fhinLoc,$fhoutLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # convMsf2saf converts MSF into SAF format # in: fileMsf,fileSaf # out: 0|1,$msg # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $sbrName="lib-br:convMsf2saf";$fhinLoc="FHIN_"."convMsf2saf";$fhoutLoc="FHOUT_"."convMsf2saf"; # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); $doCompressLoc=0 if (! defined $doCompressLoc || $doCompressLoc ne "1"); # -------------------------------------------------- # change br 2000-02: read and write & compress # -------------------------------------------------- ($Lok,$msg,%tmp)= &msfRd($fileInLoc); return(0,"*** $sbrName: failed on msfRd msg=\n". $msg) if (! $Lok); return(0,"*** ERROR $sbrName: $fileInLoc no valid MSF file?\n") if ($tmp{"NROWS"}==0); # cleave off insertions in guide sequence if ($doCompressLoc){ $lenloc=length($tmp{"seq",1}); $ctcleave=$ctres=0; # all 0 foreach $itprot (1..$tmp{"NROWS"}){ $tmp{"new",$itprot}=""; } # loop over all residues foreach $itres (1..$lenloc){ # is residue if (substr($tmp{"seq",1},$itres,1)=~/^[A-Za-z]/){ foreach $itprot (1..$tmp{"NROWS"}){ $tmp{"new",$itprot}.=substr($tmp{"seq",$itprot},$itres,1); } ++$ctres; next;} # seems insertion ++$ctcleave; } # check: sum ok? return(0,"*** $sbrName: failed at compressing ncleave=$ctcleave, nresnew=$ctres,". " before=".$lenloc." file=$fileInLoc!") if ($lenloc != ($ctcleave + $ctres)); # replace by cleaved version foreach $itprot (1..$tmp{"NROWS"}){ $tmp{"seq",$itprot}=$tmp{"new",$itprot}; } } # ------------------------------ # now write SAF # ------------------------------ ($Lok,$msg)= &safWrt($fileOutLoc, %tmp); return(0,"*** $sbrName: failed writing SAF=$fileOutLoc, in=". $fileInLoc." err msg=\n".$msg) if (! $Lok); return(0,"*** $sbrName: failed writing SAF=$fileOutLoc, in=". $fileInLoc) if ( ! -e $fileOutLoc); undef %tmp; # slim-is-in return(1,"ok $sbrName"); # ************************************************** # dead code before 2000-02 open($fhinLoc,$fileInLoc) || Carp::confess( "failed to open $fileInLoc: $!" ) || return(0,"*** ERROR $sbrName: fileIn=$fileInLoc, not opened\n"); $#tmp=$ct=$Lname=$LMsf=$LSeq=0; # ------------------------------ while (<$fhinLoc>) { # read MSF file $_=~s/\n//g; # -------------------- # find sequence if (! $LSeq && $_=~/^\/\// && $Lname && $LMsf){ $LSeq=1;} # -------------------- elsif (! $LSeq){ # header $LMsf=1 if (! $LMsf && $_=~/msf\s*of\s*\:|msf\:\s+\d+/i); $Lname=1 if (! $Lname && $_=~/name\s*:/i); push(@tmp,$_) if (! $Lname); } # store header # -------------------- elsif ($LSeq){ # sequence # first open file if ($ct==0){ open($fhoutLoc,">".$fileOutLoc) || Carp::confess( "failed to open $fileOutLoc: $!" ) || return(0,"*** ERROR $sbrName: failed opening fileout (saf)=$fileOutLoc\n"); print $fhoutLoc "# SAF (Simple Alignment Format)\n"; foreach $tmp(@tmp){ print $fhoutLoc "# $tmp\n"; } } ++$ct; print $fhoutLoc "$_\n"; # simply mirror file } } close($fhinLoc); close($fhoutLoc) if ($ct>0); $#tmp=0; # save memory return(0,"*** ERROR $sbrName: $fileInLoc no valid MSF file\n") if ($ct==0); return(1,"ok $sbrName"); } # end of convMsf2saf #============================================================================== sub convPdb2seq { local($fileInLoc,$chainInLoc,$fileOutLoc,$formOutLoc,$frag,$fhTraceLoc)=@_; local($outformat,$an,$commandLoc); #---------------------------------------------------------------------- # convPdb2seq convert PDB to sequence only # in: $fileIn,$fileOut,$formOutLoc,$frag,$fhTraceLoc # in: $chainInLoc= PDB chain # = "*" for any # in: $formOutLoc= 'FASTA|GCG|PIR' # in: $frag= 1-5, fragment from 1 -5 # out: file # err: ok=(1,'ok'), err=(0,'msg') #---------------------------------------------------------------------- $sbrName="convPdb2seq"; $allow="fasta|pir|gcg"; return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def chainInLoc!") if (! defined $chainInLoc); $chainInLoc="*" if (length($chainInLoc) < 1 || $chainInLoc =~/\s/); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); return(0,"*** $sbrName: not def formOutLoc!") if (! defined $formOutLoc); $frag=0 if (! defined $frag); $fhTraceLoc="STDOUT" if (! defined $fhTraceLoc); # check existence of files return(0,"*** $sbrName: no file '$fileInLoc'!") if (! -e $fileInLoc); # check format $formOutLoc=~tr/[A-Z]/[a-z]/; return(0,"*** $sbrName: output format $formOutLoc not supported\n") if ($formOutLoc !~ /$allow/); $anFormOut=substr($formOutLoc,1,1);$anFormOut=~tr/[a-z]/[A-Z]/; $frag=0 if ($frag !~ /\-/); # ------------------------------ if ($frag){ # extract fragments? $frag=~s/\s//g; ($beg,$end)=split('-',$frag); $frag=0 if ($beg =~/\D/ || $end =~ /\D/);} # ------------------------------ # read PDB ($Lok,$msg,$rh_pdb)= &pdbExtrSequence($fileInLoc,$chainInLoc,1); return(0,"*** $sbrName: error in reading PDB $fileInLoc :\n".$msg."\n") if (! $Lok); return(2,"*** $sbrName: $fileInLoc is RNA DNA?\n") if ($Lok==2); return(0,"*** $sbrName: error in reading PDB $fileInLoc (not defined pdb(chains)):\n". $msg."\n") if (! defined $rh_pdb->{"chains"}); @chainTmp=split(/,/,$rh_pdb->{"chains"}); # ------------------------------ # loop over all chains # ------------------------------ $seq=$chain=""; $name=0; $id=$fileInLoc;$id=~s/^.*\/|\..*$//g; foreach $chainTmp (@chainTmp) { $chain.=$chainTmp if ($chainTmp ne "none"); # ------------------------------ # id # first line: id if (! $name) { $name=$id; $name.=" ".$rh_pdb->{"header"} if (defined $rh_pdb->{"header"}); $name.=" ".$rh_pdb->{"compnd"} if (defined $rh_pdb->{"compnd"}); $name.=" source=".$rh_pdb->{"source"} if (defined $rh_pdb->{"source"});} # ------------------------------ # next lines: sequence $seqRd=$rh_pdb->{$chainTmp}; $seqRd=~s/\s//g; # add '!' as chain symbol $seq.="!" if (length($seq)>0); $seq.=$seqRd; } # ****************************** # not really found return(0,"*** $sbrName: seq=$seq, for file=$fileInLoc,$chainInLoc,$frag!") if (length($seq)<1); # ****************************** # add all chains to name $name.=" chains=".join(',',split(//,$chain)) if (length($chain)>0); # ------------------------------ # extract fragment if ($frag) { return(0,"*** ERROR $sbrName: $fileInLoc seqrd=". $seq."*** however wanted to restrict to fragment from $beg-$end\n") if (length($seq)<$beg); $seq=substr($seq,$beg); $lenWant=1+$end-$beg; if (length($seq)<$lenWant) { print $fhTraceLoc "-*- WARN $sbrName: $fileInLoc ($chainTmp) shorter than expected!\n", "-*- wanted $beg-$end, but is ",length($seq)," residues long\n"; } else { $seq=substr($seq,1,$lenWant);}} # ------------------------------ # write out $Lok=0; if ($formOutLoc =~ /^pir/){ ($Lok,$msg)=&pirWrtOne($fileOutLoc,$id,$seq); } elsif ($formOutLoc =~ /^fasta/){ ($Lok,$msg)=&fastaWrt($fileOutLoc,$id,$seq); } elsif ($formOutLoc =~ /^gcg/){ ($Lok,$msg)=&gcgWrt($fileOutLoc,$id,$seq); } # return(0,"*** $sbrName: error in converting PDB $fileInLoc:\n".$msg."\n") if (! $Lok); return(1,"ok $sbrName"); } # end of convPdb2seq #=============================================================================== sub convPhd2dssp { local($fileInLoc,$fileOutLoc,$chainLoc,$fhErrSbr) = @_ ; local($sbrName,$fhinLoc,$fhoutLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # convPhd2dssp converts PHDrdb format to DSSP format # in: $fileInLoc,$fileOutLoc,$chainLoc, # in: $chainLoc chain name ([A-Z0-9 ]) # in: $fhErrSbr 0 for no write # out: 1|0,msg, implicit: writes fileDSsp # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $tmp=$0;$tmp=~s/^.*\/|\.pl//g;$tmp.=":"; $sbrName=$tmp."convPhd2dssp"; $fhinLoc="FHIN_"."convPhd2dssp";$fhoutLoc="FHOUT_"."convPhd2dssp"; # ------------------------------ # check arguments return(&errSbr("not def fileInLoc!")) if (! defined $fileInLoc); return(&errSbr("not def fileOutLoc!")) if (! defined $fileOutLoc); $chainLoc=" " if (! defined $chainLoc); $fhErrSbr="STDOUT" if (! defined $fhErrSbr); # return(&errSbr("not def !")) if (! defined $); # return(&errSbr("not def !")) if (! defined $); return(&errSbr("no fileIn=$fileInLoc!")) if (! -e $fileInLoc); # ------------------------------ # defaults # keywords to read from RDB file @kwdLoc =("No","AA","PHEL","RI_S","PACC","RI_A"); $idLoc=$fileInLoc; $idLoc=~s/^.*\///g;$idLoc=~s/\s|\n|\.rdb.*//g; # -------------------------------------------------- # read RDB file # -------------------------------------------------- undef %rd; %rd= &rdRdbAssociative($fileInLoc,"body",@kwdLoc); # -------------------------------------------------- # store into NUM, SEQ, SEC, RISEC, ACC, RIACC # -------------------------------------------------- $#NUM=$#SEQ=$#SEC=$#RISEC=$#ACC=$#RIACC=0; foreach $kwd (@kwdLoc) { next if (! defined $rd{$kwd,"1"}) ; if ($kwd eq "No") { $ct=1; while(defined $rd{$kwd,$ct}){push(@NUM,$rd{$kwd,$ct});++$ct;}} elsif ($kwd eq "AA") { $ct=1; while(defined $rd{$kwd,$ct}){push(@SEQ,$rd{$kwd,$ct});++$ct;}} elsif ($kwd eq "PHEL") { $ct=1; while(defined $rd{$kwd,$ct}){push(@SEC,$rd{$kwd,$ct});++$ct;}} elsif ($kwd eq "RI_S") { $ct=1; while(defined $rd{$kwd,$ct}){push(@RISEC,$rd{$kwd,$ct});++$ct;}} elsif ($kwd eq "PACC") { $ct=1; while(defined $rd{$kwd,$ct}){push(@ACC,$rd{$kwd,$ct});++$ct;}} elsif ($kwd eq "RI_A") { $ct=1; while(defined $rd{$kwd,$ct}){push(@RIACC,$rd{$kwd,$ct});++$ct;}} } # ------------------------------ # convert L->' ' foreach $it(1..$#SEC){ $SEC[$it]=~s/L/ /;} # -------------------------------------------------- # writing phd into DSSP format # -------------------------------------------------- $CHAIN=$chainLoc; print $fhErrSbr "--- $sbrName: writing id=$idLoc, chain=$CHAIN, fileOut=$fileOutLoc\n" if ($fhErrSbr); # NOTE: GLOBAL in: all $CHAIN,@NUM,@SEQ,@SEC,@ACC,@RI* ($Lok,$msg)= &dsspWrtFromPhd($fileOutLoc,$idLoc); if (! $Lok) { $msgErr="*** ERROR $scrName: failed writing $fileOutLoc\n".$msg; Carp::confess( $msgErr ); } $#NUM=$#SEQ=$#SEC=$#RISEC=$#ACC=$#RIACC=0; # slim-is-in! undef %rd; # slim-is-in! return(1,"ok $sbrName"); } # end of convPhd2dssp #=============================================================================== sub convPhd2seq { local($fileInLoc,$fileOutLoc,$formatOutLoc,$fhErrSbr) = @_ ; local($sbrName,$fhinLoc,$fhoutLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # convPhd2seq converts PHDrdb to SEQUENCE format || string # in: $fileIn PHD rdb file # in: $fileOut name of output file # note: string returned if =0 ! # in: $formOut PIR|GCG|FASTA|keyword # note: keyword determines which string is # to be extracted: # combine many by 'AA,PHEL,..' # AA sequence # OHEL observed sec str # OHL observed HTM # OACC observed accessibility (angstrom) # OREL observed relative acc # # PHEL predicted sec str # PHL predicted HTM # PFHL filtered HTM # PRHL refined HTM # PiTo topology HTM # PACC predicted accessibility (angstrom) # PREL predicted relative acc # Pbie predicted accessibility in 3 states # # RI_S reliability index sec str # RI_A reliability index accessibility # RI_H reliability index HTM # # pH normalised output unit H # pE normalised output unit E # pL normalised output unit L # pb normalised output unit b (buried) # pe normalised output unit e (exposed) # # OtH full output unit (0-100) H # OtE full output unit (0-100) E # OtL full output unit (0-100) L # Otb full output unit (0-100) b (buried) # Ote full output unit (0-100) e (exposed) # # # out: $string1,$string2, or implicit file! # NOTE: string1=that matching formatOut1 # NOTE2: residues separated by commata! # err: (1,'ok',@strings), (0,'message') #------------------------------------------------------------------------------- $tmp=$0;$tmp=~s/^.*\/|\.pl//g;$tmp.=":"; $sbrName=$tmp."convPhd2seq"; $fhinLoc="FHIN_"."convPhd2seq";$fhoutLoc="FHOUT_"."convPhd2seq"; # ------------------------------ # check arguments return(&errSbr("not def fileInLoc!")) if (! defined $fileInLoc); return(&errSbr("not def fileOutLoc!")) if (! defined $fileOutLoc); return(&errSbr("not def formatOutLoc!")) if (! defined $formatOutLoc); $fhErrSbr="STDOUT" if (! defined $fhErrSbr); # return(&errSbr("not def !")) if (! defined $); return(&errSbr("no fileIn=$fileInLoc!")) if (! -e $fileInLoc); # ------------------------------ # defaults # keywords to read from RDB file $#kwdLoc=0; undef %translate; if ($formatOutLoc =~/^(PIR|FASTA|GCG)$/i) { push(@kwdLoc,"AA");} elsif ($formatOutLoc) { $formatOutLoc=~s/\s//g; push(@kwdLoc,split(/,/,$formatOutLoc)); } # -------------------------------------------------- # read RDB file # -------------------------------------------------- undef %rd; %rd= &rdRdbAssociative($fileInLoc,"body",@kwdLoc); # -------------------------------------------------- # extract strings (residues separated by commata) # -------------------------------------------------- $#tmp=0; foreach $kwd (@kwdLoc) { next if (! defined $rd{$kwd,"1"}); $string=""; $it=1; while (defined $rd{$kwd,$it}) { $string.=$rd{$kwd,$it}.","; ++$it; } $string=~s/\,$//g; # purge final comma push(@tmp,$string); } undef %rd; # slim-is-in # ================================================== # <--- <--- <--- <--- <--- <--- # EARLY end: just return strings return(1,"ok",@tmp) if (! $fileOutLoc || $formatOutLoc !~ /^(PIR|FASTA|GCG)$/i); # <--- <--- <--- <--- <--- <--- # ================================================== # -------------------------------------------------- # writing phd into sequence file format # -------------------------------------------------- $idLoc=$fileInLoc;$idLoc=~s/^.*\///g; print $fhErrSbr "--- $sbrName: writing id=$idLoc, fileOut=$fileOutLoc\n" if ($fhErrSbr); # output PIR format if ($formatOutLoc =~/^pir/) { # foreach $it (1..$#kwdLoc) { next if ($kwdLoc[$it] !~/^AA$/); $seq=$tmp[$it]; $seq=~s/\,//g; # purge commata last; } $id=$fileInLoc;$id=~s/^.*\/|\..*$//g; ($Lok,$msg)= &pirWrtOne($fileOutLoc,$id,$seq); return(0,"*** ERROR $sbrName: failed converting PHDrdb to PIR\n".$msg) if (! $Lok); } # output FASTA format elsif ($formatOutLoc =~/^fasta/) { foreach $it (1..$#kwdLoc) { next if ($kwdLoc[$it] !~/^AA$/); $seq=$tmp[$it]; $seq=~s/\,//g; # purge commata last; } $id=$fileInLoc;$id=~s/^.*\/|\..*$//g; ($Lok,$msg)= &fastaWrt($fileOutLoc,$id,$seq); return(0,"*** ERROR $sbrName: failed converting PHDrdb to FASTA\n") if (! $Lok);} # output format unknown else { return(0,"*** ERROR $sbrName: output format $formatOutLoc unknown!\n"); } $#tmp=0; # slim-is-in! $#kwdLoc=0; # slim-is-in! return(1,"ok $sbrName"); } # end of convPhd2seq #=============================================================================== sub convPhdGen { local($fileInLoc,$chainInLoc,$fileOutLoc,$formIn,$formOut,$extOutLoc, $frag,$fileScreenLoc,$dirWork,$fhSbr) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # convPhdGen general converter for PHD predictions into -> x # in: for general info see 'convPhdGen' # out: converted file # out GLOBAL: @fileOut,@kwdRm,$file{"kwd"} files to remove # err: 0,$msg -> unspecified error # err: 1,$msg -> ok # err: 2,$msg -> conversion option not supported #------------------------------------------------------------------------------- $sbrName="$scrName:"."convPhdGen";$fhinLoc="FHIN"."$sbrName"; # ------------------------------ # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def chainInLoc!") if (! defined $chainInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); return(0,"*** $sbrName: not def formIn!") if (! defined $formIn); return(0,"*** $sbrName: not def formOut!") if (! defined $formOut); return(0,"*** $sbrName: not def extOutLoc!") if (! defined $extOutLoc); return(0,"*** $sbrName: not def frag!") if (! defined $frag); return(0,"*** $sbrName: not def fileScreenLoc!") if (! defined $fileScreenLoc); return(0,"*** $sbrName: not def dirWork!") if (! defined $dirWork); $fhSbr="STDOUT" if (! defined $fhSbr); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); $chainIn=$chainInLoc; $chainIn="*" if (! $chainInLoc || length($chainInLoc)!=1 || $chainInLoc !~/[A-Z0-9]/); $#beg=$#end=0; # ------------------------------ if ($frag && # extract fragments? NOT for DSSP! ($formOut eq "dssp" || $formOut =~ /^(pir|fasta)/)){ print "-*- WARN $sbrName: fragments not supported for PHD->\n"; $frag=0; } # ------------------------------ if ($frag){ # extract fragments? @tmp=split(/,/,$frag);$#beg=$#end=0; foreach $frag(@tmp){next if ($frag !~ /\-/);$frag=~s/\s//g; ($beg,$end)=split('-',$frag); next if ($beg =~/\D/ || $end =~ /\D/); push(@beg,$beg);push(@end,$end);}} # ------------------------------ # DSSP out if ($formOut eq "dssp") { ($Lok,$msg)= &convPhd2dssp($fileInLoc,$fileOutLoc,$chainLoc,$fhSbr); return(0,"*** ERROR $sbrName: failed to convert PHDrdb to $formOut\n". $msg."\n") if (! $Lok); push(@fileOut,$fileOutLoc); } # ------------------------------ # convert to sequence formats elsif ($formOut =~ /^(pir|fasta)/){ ($Lok,$msg)= &convPhd2seq($fileInLoc,$fileOutLoc,$formOut,$fhSbr); return(0,"*** ERROR $sbrName: failed to convert PHDrdb to $formOut\n". $msg."\n") if (! $Lok); push(@fileOut,$fileOutLoc);} # ------------------------------ # convert to HTML elsif ($formOut eq "html"){ print "xx html : working on it !\n"; Carp::confess("*** output format is HTML??? not yet in it!"); if ($#beg>0){ # loop over fragments foreach $it (1..$#beg){ $fileOutTmp=$fileOutLoc;$fileOutTmp=~s/(\.$extOutLoc)/\_$beg[$it]\_$end[$it]$1/; ($Lok,$id,$seq)=&fastaRdGuide($fileInLoc); $tmp{"seq","1"}=substr($seq,$beg[$it],($end[$it]-$beg[$it]+1)); $tmp{"NROWS"}= 1;$tmp{"id","1"}= $id; ($Lok,$msg)=&safWrt($fileOutTmp,%tmp); return(0,"*** ERROR $sbrName: failed to convert fasta to $formOut\n"."$msg\n") if (! $Lok); push(@fileOut,$fileOutTmp);}} else {$fragHere=0; ($Lok,$id,$tmp{"seq","1"})= &fastaRdGuide($fileInLoc); return(0,"*** ERROR $sbrName: failed to convert fasta to $formOut\n"."$msg\n") if (! $Lok); $id=~s/^(\S+).*$/$1/; $tmp{"NROWS"}= 1;$tmp{"id","1"}= $id; ($Lok,$msg)=&safWrt($fileOutLoc,%tmp); return(0,"*** ERROR $sbrName: failed to convert fasta to $formOut\n"."$msg\n") if (! $Lok); push(@fileOut,$fileOutLoc);}} else { return(2,"*** ERROR $sbrName: output option $formOut not supported for $formIn\n");} return(1,"ok $sbrName"); } # end of convPhdGen #============================================================================== sub convPir2fasta { local($fileInLoc,$fileOutLoc,$fragLoc,$extrLoc,$LshortNamesLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # convPir2fasta converts PIR to FASTA format # in: $fileInLoc,$fileOutLoc,$fragLoc,$extrLoc # in: $fragLoc=n-m fragment to extract (optional) # in: $extrLoc=i,j,k take only sequences i,j,k from PIRmul # NOTE: to leave blank =0, e.g. # 'file.pir,file.f,0,5' would get fifth sequence # in: $LshortNamesLoc: if 1 names <=15 characters # out: implicit: file out # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $sbrName="lib-br:"."convPir2fasta";$fhinLoc="FHIN_"."convPir2fasta"; # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); $fragLoc=0 if (! defined $fragLoc); $extrLoc=0 if (! defined $extrLoc); $LshortNamesLoc=0 if (! defined $LshortNamesLoc); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); # interpret input $num=$extrLoc;# $num=1 if (! $extrLoc); # ------------------------------ ($Lok,$id,$seq)= # read PIR &pirRdMul($fileInLoc,$num); return(0,"*** ERROR $sbrName: failed to read PIRmul ($fileInLoc,$num)\n". "*** found id=$id\n") if (! $Lok || length($seq)<1); # ------------------------------ # interpret info @id=split(/\n/,$id);@seq=split(/\n/,$seq); return(0,"*** ERROR $sbrName: seq=$seq, and id=$id, not matching (differing number)\n") if ($#id != $#seq); $tmp{"NROWS"}=$#id; foreach $it (1..$#id){$tmp{"id",$it}= $id[$it]; $tmp{"seq",$it}=$seq[$it];} # ------------------------------ # extract? if ($fragLoc){($beg,$end)=split(/-/,$frag); foreach $it (1..$tmp{"NROWS"}){ $tmp{"seq",$it}=substr($tmp{"seq",$it},$beg,($end-$beg+1));}} $ctres=length($tmp{"seq",1}); # ------------------------------ # shorten names? if ($LshortNamesLoc){ undef %tmp2; foreach $it (1..$tmp{"NROWS"}){ if (length($tmp{"id",$it})<=15) { $tmp2{$tmp{"id",$it}}=1; next;} # too long $id=$tmp{"id",$it}; $id=~s/^.*\|//g; # purge paths # purge blanks $id=~s/\s//g if (length($id)>15); # purge extensions $id=~s/\.[a-z]//g if (length($id)>15); # cleave if (length($id)>15){ $id=substr($id,1,15);} # not unique if (defined $tmp2{$id}){ $id=substr($id,1,12); $ct=1;$idtmp=$id.$ct; while(defined $tmp2{$idtmp}){ ++$ct; last if ($ct>999);} $id=$idtmp;} return(0,"*** $sbrName: shoot id=$id, orig=",,", failed shortening\n") if (defined $tmp2{$id} || length($id)>15); $tmp2{$id}=1; $tmp{"id",$it}=$id; } undef %tmp2; } # ------------------------------ # write output ($Lok,$msg)= &fastaWrtMul($fileOutLoc,%tmp); return(0,"*** ERROR $sbrName: failed to write FASTAmul ($fileOutLoc)\n". "*** msg=$msg\n") if (! $Lok); return(2,"-*- WARN $sbrName: wrong number written\n$msg\n") if ($Lok != 1); return(1,"ok $sbrName"); } # end of convPir2fasta #============================================================================== sub convSaf2many { local($fileInLoc,$fileOutLoc,$formOutLoc,$fragLoc,$extrLoc,$fhErrSbr, $LdoCompressLoc,$LshortNamesLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # convSaf2many converts SAF into many formats: saf2msf, saf2fasta, saf2pir # in: $fileInLoc,$fileOutLoc,$formOutLoc,$fragLoc,$extrLoc,$fhErrSbr # in: $formOutLoc format MSF|FASTA|PIR # in: $fragLoc=n-m fragment to extract (optional) # in: $extrLoc=i,j,k take only sequences i,j,k from PIRmul # in: NOTE: to leave blank =0, e.g. # in: 'file.saf,file.f,0,5' would get fifth sequence # in: $LdoCompressLoc delete insertions in master # in: $LshortNamesLoc: if 1 names <=15 characters # out: implicit: file written # err: (1,'ok'), (0,'message') # err: e: (1,msg) -> ok # err: a: (0,msg) -> some arguments missing/files not opened # err: b: (2,msg) -> no output file written # err: b: (3,msg) -> ERROR from msfCheckFormat # specification of format see interpretSeqSaf #------------------------------------------------------------------------------- $sbrName="lib-br:"."convSaf2many";$fhinLoc="FHIN_"."convSaf2many"; # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); return(0,"*** $sbrName: not def formOutLoc!") if (! defined $formOutLoc); $fragLoc=0 if (! defined $fragLoc); $extrLoc=0 if (! defined $extrLoc); $LdoCompressLoc=0 if (! defined $LdoCompressLoc); $LshortNamesLoc=0 if (! defined $LshortNamesLoc); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); # interpret input $formOutLoc=~tr/[A-Z]/[a-z]/; if ($fragLoc){$fragLoc=~s/\s//g; return(0,"*** $sbrName: syntax of fragLoc ($fragLoc) must be :\n". " 'ifir-ilas', where ifir,ilas are integers (or 1-*)\n") if ($fragLoc && $fragLoc !~/[\d\*]\-[\d\*]/);} if ($extrLoc){$extrLoc=~s/\s//g; return(0,"*** $sbrName: syntax of extrLoc ($extrLoc) must be :\n". " 'n1,n2,n3-n4', where n* are integers\n") if ($extrLoc && $extrLoc =~/[^0-9\-,]/); @extr=&get_range($extrLoc); undef %take; foreach $it(@extr){ $take{$it}=1;}} # ------------------------------ # read file ($Lok,$msg,%safIn)= &safRd($fileInLoc); @nameLoc=split(/,/o,$safIn{"names"}); # ------------------------------ undef %tmp; $ctTake=0; # store names for passing variables foreach $it (1..$#nameLoc){ next if ($extrLoc && (! defined $take{$it} || ! $take{$it})); ++$ctTake; $tmp{"id",$ctTake}= $nameLoc[$it]; $tmp{"seq",$ctTake}=$safIn{"seq",$it}; } $tmp{"NROWS"}=$ctTake; %safIn=%tmp; undef %tmp; # ------------------------------ # compress # ------------------------------ if ($LdoCompressLoc){ $ctcleave=$ctres=0; $lenloc=length($safIn{"seq",1}); # all 0 foreach $itprot (1..$safIn{"NROWS"}){ $safIn{"new",$itprot}=""; } # loop over all residues foreach $itres (1..$lenloc){ # is residue if (substr($safIn{"seq",1},$itres,1)=~/^[A-Za-z]/){ foreach $itprot (1..$safIn{"NROWS"}){ $safIn{"new",$itprot}.=substr($safIn{"seq",$itprot},$itres,1); } ++$ctres; next;} # seems insertion ++$ctcleave; } # check: sum ok? return(0,"*** $sbrName: failed at compressing ncleave=$ctcleave, nresnew=$ctres,". " before=".$lenloc." file=$fileInLoc!") if ($lenloc != ($ctcleave + $ctres)); # replace by cleaved version foreach $itprot (1..$safIn{"NROWS"}){ $safIn{"seq",$itprot}=$safIn{"new",$itprot}; }} $ctres=length($safIn{"seq",1}); # ------------------------------ # select subsets # ------------------------------ if ($fragLoc){ ($beg,$end)=split("-",$fragLoc);$name=$safIn{"1"};$len=length($safIn{$name}); $beg=1 if ($beg eq "*"); $end=$len if ($end eq "*"); if ($len < ($end-$beg+1)){ print "-*- WARN $sbrName: $beg-$end not possible, as length of protein=$len\n";} else { foreach $it (1..$safIn{"NROWS"}){ $name=$safIn{"id",$it}; $safIn{"seq",$it}=substr($safIn{"seq",$it},$beg,($end-$beg+1)); } }} # ------------------------------ # shorten names? # ------------------------------ if ($LshortNamesLoc){ undef %safIn2; foreach $it (1..$safIn{"NROWS"}){ if (length($safIn{"id",$it})<=15) { $safIn2{$safIn{"id",$it}}=1; next;} # too long $id=$safIn{"id",$it}; $id=~s/^.*\|//g; # purge paths # purge blanks $id=~s/\s//g if (length($id)>15); # purge extensions $id=~s/\.[a-z]//g if (length($id)>15); # cleave if (length($id)>15){ $id=substr($id,1,15);} # not unique if (defined $safIn2{$id}){ $id=substr($id,1,12); $ct=1;$idsafIn=$id.$ct; while(defined $safIn2{$idsafIn}){ ++$ct; last if ($ct>999);} $id=$idsafIn;} return(0,"*** $sbrName: shoot id=$id, orig=",,", failed shortening\n") if (defined $safIn2{$id} || length($id)>15); $safIn2{$id}=1; $safIn{"id",$it}=$id; } undef %safIn2; } # -------------------------------------------------- # write output # -------------------------------------------------- # write an MSF formatted file if ($formOutLoc eq "msf"){ # reconvert to what MSF wants... foreach $it (1..$safIn{"NROWS"}){$name=$safIn{"id",$it}; $tmp{$it}=$name; $tmp{SEQS}->{$name}=$safIn{"seq",$it};} $tmp{"NROWS"}=$safIn{"NROWS"}; $tmp{"FROM"}= $fileInLoc; $tmp{"TO"}= $fileOutLoc; $fhout="FHOUT_MSF_FROM_SAF"; open("$fhout",">$fileOutLoc") || Carp::confess( "failed to open $fileOutLoc: $!" ) || # open file return(0,"*** $sbrName cannot open fileOutLoc=$fileOutLoc\n"); $Lok=&msfWrt("$fhout",%tmp); # write the file close("$fhout"); undef %tmp;} # write a FASTA or PIR formatted file elsif ($formOutLoc eq "fasta" || $formOutLoc eq "fastamul" || $formOutLoc eq "saf" || $formOutLoc eq "pirmul" || $formOutLoc eq "pir" || $formOutLoc eq "gcg"){ if ($formOutLoc =~ /^fasta/){ ($Lok,$msg)=&fastaWrtMul($fileOutLoc,%safIn);} elsif ($formOutLoc =~ /^pir/){ ($Lok,$msg)=&pirWrtMul($fileOutLoc,%safIn);} elsif ($formOutLoc eq "saf"){ ($Lok,$msg)=&safWrt($fileOutLoc,%safIn);} elsif ($formOutLoc eq "gcg"){ ($Lok,$msg)=&gcgWrt($fileOutLoc,$safIn{"id","1"},$safIn{"seq","1"});} return(0,"*** ERROR $sbrName: failed in $formOutLoc ($fileOutLoc)\n".$msg."\n") if (! $Lok);} else { return(0,"*** $sbrName: output format $formOutLoc not supported\n");} # ------------------------------ # file existing?? return(2,"*** $sbrName ERROR after write, missing fileOutLoc=$fileOutLoc\n") if (! -e $fileOutLoc); # ------------------------------ # make a basic test of msf format if ($formOutLoc eq "msf"){ ($Lok,$msg)= &msfCheckFormat($fileOutLoc); return(3,"$msg"."*** $sbrName ERROR from msfCheckFormat fileOutLoc=$fileOutLoc\n") if (! $Lok);} # ------------------------------ $#safIn=$#nameLoc=0; # save space undef %safIn; undef %nameInBlock; undef %tmp; return(1,"$sbrName ok"); } # end of convSaf2many #============================================================================== sub convSeq2fastaPerl { local($fileInLoc,$fileOutLoc,$formInLoc,$fragLoc,$LshortNamesLoc)=@_; local($outformat,$an,$commandLoc); #---------------------------------------------------------------------- # convSeq2fastaPerl convert all formats to fasta (no fortran) # in: $fileInLoc,$fileOutLoc,$formInLoc,$fragLoc # in: $formInLoc: pir, pirmul, gcg, swiss, dssp # in: $fragLoce = 1-5, fragment from 1 -5 # in: $LshortNamesLoc: if 1 names <=15 characters # out: # err: ok=(1,'ok'), err=(0,'msg') #---------------------------------------------------------------------- $sbrName="lib-br:convSeq2fastaPerl"; return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); return(0,"*** $sbrName: not def formInLoc!") if (! defined $formInLoc); $fragLoc=0 if (! defined $fragLoc); $LshortNamesLoc=0 if (! defined $LshortNamesLoc); # check existence of files return(0,"*** $sbrName: no file '$fileInLoc'!") if (! -e $fileInLoc); $fragLoc=0 if ($fragLoc !~ /\-/); # ------------------------------ # do conversion # ------------------------------ if ($formInLoc=~ /^pir/){ # PIR ($Lok,$msg)= &convPir2fasta($fileInLoc,$fileOutLoc,$fragLoc,$LshortNamesLoc);} elsif ($formInLoc=~ /^swiss/){ # SWISS-PROT ($Lok,$msg)= &convSwiss2fasta($fileInLoc,$fileOutLoc,$fragLoc,$LshortNamesLoc);} elsif ($formInLoc eq "gcg"){ # GCG ($Lok,$msg)= &convGcg2fasta($fileInLoc,$fileOutLoc,$fragLoc,$LshortNamesLoc);} else { return(&errSbr("format $formInLoc to FASTA not supported"));} return(&errSbrMsg("failed converting format=$formInLoc ($fileInLoc,$fileOutLoc,$fragLoc)", $msg)) if (! $Lok); return(1,"ok $sbrName"); } # end of convSeq2fastaPerl #============================================================================== sub convSeq2seq { local($fileInLoc,$formInLoc,$fileOutLoc,$formOutLoc,$frag,$fileScreenLoc,$fhTraceLoc)=@_; local($outformat,$an,$commandLoc); #---------------------------------------------------------------------- # convSeq2seq convert all sequence-only formats to sequence only # in: $exeConvSeq,$fileIn,$fileOut,$formOutLoc,$frag,$fileScreen,$fhTraceLoc # in: $formOutLoc= 'FASTA|GCG|PIR' # in: $frage = 1-5, fragment from 1 -5 # out: file # err: ok=(1,'ok'), err=(0,'msg') #---------------------------------------------------------------------- $sbrName="lib-br:convSeq2seq"; $allow="fasta|pir|gcg"; return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def formInLoc!") if (! defined $formInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); return(0,"*** $sbrName: not def formOutLoc!") if (! defined $formOutLoc); $fileScreenLoc=0 if (! defined $fileScreenLoc); $frag=0 if (! defined $frag); $fhTraceLoc="STDOUT" if (! defined $fhTraceLoc); # check existence of files return(0,"*** $sbrName: no file '$fileInLoc'!") if (! -e $fileInLoc); # check format $formInLoc=~tr/[A-Z]/[a-z]/; $formOutLoc=~tr/[A-Z]/[a-z]/; return(0,"*** $sbrName: output format $formOutLoc not supported\n") if ($formOutLoc !~ /$allow/); $anFormOut=substr($formOutLoc,1,1);$anFormOut=~tr/[a-z]/[A-Z]/; $frag=0 if ($frag !~ /\-/); # ------------------------------ # get input $Lok=$id=0; if ($formInLoc =~/swiss/) { ($Lok,$id,$seq)=&swissRdSeq($fileInLoc); } elsif ($formInLoc =~/fasta/) { ($Lok,$id,$seq)=&fastaRdMul($fileInLoc,1); } elsif ($formInLoc =~/pir/) { ($Lok,$id,$seq)=&pirRdMul($fileInLoc,1); } elsif ($formInLoc =~/gcg/) { ($Lok,$id,$seq)=&gcgRdMul($fileInLoc); } return(&errSbrMsg("input format=$formInLoc, not valid!\n")) if (! $Lok && ! $id); return(&errSbrMsg("problem reading input format=$formInLoc, file=$fileInLoc!\n")) if (! $Lok); # ------------------------------ if ($frag){ # extract fragments? $frag=~s/\s//g; ($beg,$end)=split('-',$frag); if ($beg =~/^\d+$/ && $end =~ /^\d+$/) { $seq=substr($seq,$beg,(1+$end-$beg));}} # ------------------------------ # write output $Lok=$msg=0; if ($formOutLoc =~/fasta/) { ($Lok,$msg)=&fastaWrt($fileOutLoc,$id,$seq); } elsif ($formOutLoc =~/pir/) { ($Lok,$msg)=&pirWrtOne($fileOutLoc,$id,$seq); } elsif ($formOutLoc =~/gcg/) { ($Lok,$msg)=&gcgWrt($fileOutLoc,$id,$seq); } return(&errSbrMsg("output format=$formOutLoc not digested!\n".$id."\n")) if (! $Lok && ! $msg); return(&errSbrMsg("problem writing output format=$formOutLoc, file=$fileOutLoc!\n")) if (! $Lok); return(1,"ok $sbrName"); } # end of convSeq2seq #============================================================================== sub convSeq2seqOld { local($exeConvSeqLoc,$fileInLoc,$fileOutLoc,$formOutLoc,$frag,$fileScreenLoc,$fhTraceLoc)=@_; local($outformat,$an,$commandLoc); #---------------------------------------------------------------------- # convSeq2seqOld convert all sequence-only formats to sequence only # in: $exeConvSeq,$fileIn,$fileOut,$formOutLoc,$frag,$fileScreen,$fhTraceLoc # in: $formOutLoc= 'FASTA|GCG|PIR' # in: $frage = 1-5, fragment from 1 -5 # out: file # err: ok=(1,'ok'), err=(0,'msg') #---------------------------------------------------------------------- $sbrName="lib-br:convSeq2seqOld"; $allow="fasta|pir|gcg"; return(0,"*** $sbrName: not def exeConvSeqLoc!") if (! defined $exeConvSeqLoc); return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); return(0,"*** $sbrName: not def formOutLoc!") if (! defined $formOutLoc); $fileScreenLoc=0 if (! defined $fileScreenLoc); $frag=0 if (! defined $frag); $fhTraceLoc="STDOUT" if (! defined $fhTraceLoc); # check existence of files # return(0,"*** $sbrName: no exe '$exeConvSeqLoc'!") if (! -e $exeConvSeqLoc); return(0,"*** $sbrName: no file '$fileInLoc'!") if (! -e $fileInLoc); # check format $formOutLoc=~tr/[A-Z]/[a-z]/; return(0,"*** $sbrName: output format $formOutLoc not supported\n") if ($formOutLoc !~ /$allow/); $anFormOut=substr($formOutLoc,1,1);$anFormOut=~tr/[a-z]/[A-Z]/; $frag=0 if ($frag !~ /\-/); # ------------------------------ if ($frag){ # extract fragments? $frag=~s/\s//g; ($beg,$end)=split('-',$frag); $frag=0 if ($beg =~/\D/ || $end =~ /\D/);} # ------------------------------ # call FORTRAN program $cmd= ""; # eschew warnings $an2= "N"; # write another format? if ($frag){ $an1= "Y"; # do fragment $anF= "$beg $end"; # answer for fragment eval "\$cmd=\"$exeConvSeqLoc,$fileInLoc,$anFormOut,$an1,$anF,$fileOutLoc,$an2,\""; ($Lok,$msg)= &sysRunProg($cmd,$fileScreenLoc,$fhTraceLoc);} else { $an1= "N"; # no fragment eval "\$cmd=\"$exeConvSeqLoc,$fileInLoc,$anFormOut,$an1,$fileOutLoc,$an2,\""; ($Lok,$msg)= &sysRunProg($cmd,$fileScreenLoc,$fhTraceLoc);} return(&errSbrMsg("no output from FORTRAN convert_seq, could not run_program cmd=$cmd\n", $msg)) if (! $Lok || ! -e $fileOutLoc); return(1,"ok $sbrName"); } # end of convSeq2seqOld #============================================================================== sub convSwiss2fasta { local($fileInLoc,$fileOutLoc,$fragLoc,$LshortNamesLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # convSwiss2fasta converts SWISS-PROT to FASTA format # in: $fileInLoc,$fileOutLoc,$fragLoc # in: $fragLoc=n-m fragment to extract (optional) # in: $LshortNamesLoc: if 1 names <=15 characters # out: implicit: file out # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $sbrName="lib-br:"."convSwiss2fasta";$fhinLoc="FHIN_"."convSwiss2fasta"; # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); $fragLoc=0 if (! defined $fragLoc); $LshortNamesLoc=0 if (! defined $LshortNamesLoc); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); # ------------------------------ ($Lok,$id,$seq)= # read SWISS &swissRdSeq($fileInLoc); return(0,"*** ERROR $sbrName: failed to read SWISS ($fileInLoc)\n". "*** found id=$id\n") if (! $Lok || length($seq)<1); undef %tmp; $tmp{"id","1"}= $id; $tmp{"seq","1"}=$seq; $tmp{"NROWS"}=1; # ------------------------------ # extract? if ($fragLoc){($beg,$end)=split(/-/,$frag); foreach $it (1..$tmp{"NROWS"}){ $tmp{"seq",$it}=substr($tmp{"seq",$it},$beg,($end-$beg+1));}} $ctres=length($tmp{"seq",1}); # ------------------------------ # shorten names? if ($LshortNamesLoc){ undef %tmp2; foreach $it (1..$tmp{"NROWS"}){ if (length($tmp{"id",$it})<=15) { $tmp2{$tmp{"id",$it}}=1; next;} # too long $id=$tmp{"id",$it}; $id=~s/^.*\|//g; # purge paths # purge blanks $id=~s/\s//g if (length($id)>15); # purge extensions $id=~s/\.[a-z]//g if (length($id)>15); # cleave if (length($id)>15){ $id=substr($id,1,15);} # not unique if (defined $tmp2{$id}){ $id=substr($id,1,12); $ct=1;$idtmp=$id.$ct; while(defined $tmp2{$idtmp}){ ++$ct; last if ($ct>999);} $id=$idtmp;} return(0,"*** $sbrName: shoot id=$id, orig=",,", failed shortening\n") if (defined $tmp2{$id} || length($id)>15); $tmp2{$id}=1; $tmp{"id",$it}=$id; } undef %tmp2; } # ------------------------------ # write output ($Lok,$msg)= &fastaWrtMul($fileOutLoc,%tmp); return(0,"*** ERROR $sbrName: failed to write FASTAmul ($fileOutLoc)\n". "*** msg=$msg\n") if (! $Lok); return(2,"-*- WARN $sbrName: wrong number written\n$msg\n") if ($Lok != 1); return(1,"ok $sbrName"); } # end of convSwiss2fasta #============================================================================== sub dsspGetChain { local ($fileIn,$chainIn,$begIn,$endIn) = @_ ; local ($Lread,$sbrName,$fhin,$aa,$aa2,$seq,$seqC,$chainRd,$pos); $[=1; #---------------------------------------------------------------------- # dsspGetChain extracts all chains from DSSP # in: $file # out: $Lok,$tmp{"chains"}='C,D,...' # out: $tmp{"$chain","beg"},$tmp{"$chain","end"}, #---------------------------------------------------------------------- $sbrName = "lib-br:dsspGetChain" ;$fhin="fhinDssp"; open($fhin,$fileIn) || Carp::confess( "failed to open $fileIn: $!" ) || return(0,"*** ERROR $sbrName: failed to open input $fileIn\n"); #-------------------------------------------------- while ( <$fhin> ) { # read in file last if ( /^ \# RESIDUE/ ); } # skip anything before data... undef %tmp; $chainNow=$chains=""; while ( <$fhin> ) { # read chain $Lread=1; $chainRd=substr($_,12,1); $resRd= substr($_,14,1); next if ($resRd eq "!"); $chainRd="*" if ($chainRd eq " "); # strange $pos= substr($_,7,5); $pos=~s/\s//g; $posdssp= substr($_,1,5); $posdssp=~s/\s//g; if (defined $tmp{$chainRd} && $chainRd ne $chainNow){ print "--- WARN $sbrName: problem: chainRd=$chainRd, ", "posPDB=$pos, posDSSP=$posdssp, res=$resRd, now=$chainNow, will be skipped\n"; next;} if ($chainRd ne $chainNow){ $tmp{$chainRd}=1; $chainNow= $chainRd; $chains.= $chainRd.","; $tmp{$chainRd,"begpdb"}=$pos; $tmp{$chainRd,"beg"}= $posdssp; } else { $tmp{$chainRd,"endpdb"}=$pos; $tmp{$chainRd,"end"}= $posdssp; }} close($fhin); $chains=~s/^,*|,*$//g; # clean up strange bits $tmp{"chains"}=""; foreach $tmp (split(/,/,$chains)){ next if (! defined $tmp{$tmp,"beg"}); next if (! defined $tmp{$tmp,"end"}); # too short next if ( ($tmp{$tmp,"end"} - $tmp{$tmp,"beg"}) < 5); $tmp{"chains"}.=$tmp.","; } $tmp{"chains"}=~s/,*$//g; return(1,%tmp); } # end of: dsspGetChain #============================================================================== sub dsspRdSeq { local ($fileIn,$chainIn,$begIn,$endIn) = @_ ; local ($Lread,$sbrName,$fhin,$aa,$aa2,$seq,$seqC,$chainRd,$pos); $[=1; #---------------------------------------------------------------------- # dsspRdSeq extracts the sequence from DSSP # in: $file,$chain,$beg,$end # in: for wild cards beg="", end="" # out: $Lok,$seq,$seqC (second replaced a-z to C) #---------------------------------------------------------------------- $sbrName = "lib-br:dsspRdSeq" ;$fhin="fhinDssp"; &open_file("$fhin","$fileIn") || return(0,"*** ERROR $sbrName: failed to open input $fileIn\n"); #---------------------------------------- # extract input if (defined $chainIn && length($chainIn)>0 && $chainIn=~/[A-Z0-9]/){ $chainIn=~s/\s//g;$chainIn =~tr/[a-z]/[A-Z]/; }else{$chainIn = "*" ;} $begIn = "*" if (! defined $begIn || length($begIn)==0); $begIn=~s/\s//g;; $endIn = "*" if (! defined $endIn || length($endIn)==0); $endIn=~s/\s//g;; #-------------------------------------------------- # read in file $ctline=0; while ( <$fhin> ) { ++$ctline; last if ( /^ \# RESIDUE/ ); } # skip anything before data... $seq=$seqC=""; while ( <$fhin> ) { # read sequence ++$ctline; $Lread=1; if (length($_)<12){ Carp::confess("*** fatal ERROR in $fileIn: line=$ctline:$_!");} $chainRd=substr($_,12,1); $pos= substr($_,7,5); $pos=~s/\s//g; next if (($chainRd ne "$chainIn" && $chainIn ne "*" ) || # check chain ($begIn ne "*" && $pos < $begIn) || # check begin ($endIn ne "*" && $pos > $endIn)) ; # check end $aa=substr($_,14,1); $aa2=$aa;if ($aa2=~/[a-z]/){$aa2="C";} # lower case to C $seq.=$aa;$seqC.=$aa2; } close ($fhin); return(1,$seq,$seqC) if (length($seq)>0); return(0); } # end of: dsspRdSeq #=============================================================================== sub dsspWrtFromPhd { local ($fileOutLoc,$id_in)=@_; local ($it,$fhoutLoc); $[ =1 ; #------------------------------------------------------------------------------- # dsspWrtFromPhd # in: $fileOutLoc # in GLOBAL: @NUM, @SEQ, @SEC(HE ), @ACC, @RISEC, @RIACC # in GLOBAL: $CHAIN # out: 1|0,msg, implicit: # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $tmp=$0;$tmp=~s/^.*\/|\.pl//g;$tmp.=":"; $sbrName=$tmp."dsspWrtFromPhd"; $fhoutLoc="FHOUT_"."dsspWrtFromPhd"; # ------------------------------ # check arguments return(&errSbr("not def fileOutLoc!")) if (! defined $fileOutLoc); # return(&errSbr("not def !")) if (! defined $); # return(&errSbr("miss in file '$fileInLoc'!")) if (! -e $fileInLoc); # chain identifier $CHAIN=" " if (! defined $CHAIN || length($CHAIN) != 1); # ------------------------------ # open new file &open_file("$fhoutLoc",">$fileOutLoc") || return(&errSbr("fileOutLoc=$fileOutLoc, not created")); # ------------------------------ # DSSP header print $fhoutLoc "**** SECONDARY STRUCTURE DEFINITION BY THE PROGRAM DSSP, here PHD prediction\n", "REFERENCE BURKHARD ROST (1996) METHODS IN ENZYMOLOGY, 266, 525-539\n", "HEADER $id_in \n", "COMPND \n", "SOURCE \n", "AUTHOR \n", " \# RESIDUE AA STRUCTURE BP1 BP2 ACC N-H-->O O-->H-N N-H-->O O-->H-N TCO KAPPA ALPHA PHI PSI X-CA Y-CA Z-CA \n"; # ------------------------------ # body # ------------------------------ for ($it=1; $it<=$#SEC; ++$it) { # defaults $num=$it; $riacc=0; $risec=0; $seq="U"; $sec="U"; $acc=999; # fill in $num= $NUM[$it] if (defined $NUM[$it]); $seq= $SEQ[$it] if (defined $SEQ[$it]); $sec= $SEC[$it] if (defined $SEC[$it]); $acc= $ACC[$it] if (defined $ACC[$it]); $risec=$RISEC[$it] if (defined $RISEC[$it]); $riacc=$RIACC[$it] if (defined $RIACC[$it]); # ERROR messages print "*** ERROR $sbrName: it=$it, SEQ not defined\n" if ($seq eq "U" ); print "*** ERROR $sbrName: it=$it, SEC not defined\n" if ($sec eq "U" ); print "*** ERROR $sbrName: it=$it, ACC not defined\n" if ($acc eq "999"); # write it printf $fhoutLoc " %4d %4d %1s %1s %1s 0 0 %3d %1d %1d\n", $num, $num, $CHAIN, $seq, $sec, $acc, $risec, $riacc; } close($fhoutLoc); return(1,"ok"); } # end of dsspWrtFromPhd #============================================================================== sub errSbr {local($txtInLoc,$sbrNameLocy) = @_ ; #------------------------------------------------------------------------------- # errSbr simply writes '*** ERROR $sbrName: $txtInLoc' #------------------------------------------------------------------------------- $sbrNameLocy=$sbrName if (! defined $sbrNameLocy); $txtInLoc.="\n"; $txtInLoc=~s/\n\n+/\n/g; return(0,"*** ERROR $sbrNameLocy: $txtInLoc"); } # end of errSbr #============================================================================== sub errSbrMsg {local($txtInLoc,$msgInLoc,$sbrNameLocy) = @_ ; #------------------------------------------------------------------------------- # errSbrMsg simply writes '*** ERROR $sbrName: $txtInLoc\n'.$msg #------------------------------------------------------------------------------- $sbrNameLocy=$sbrName if (! defined $sbrNameLocy); $txtInLoc.="\n"; $txtInLoc=~s/\n\n+/\n/g; $msgInLoc.="\n"; $msgInLoc=~s/\n\n+/\n/g; return(0,"*** ERROR $sbrNameLocy: $txtInLoc".$msgInLoc); } # end of errSbrMsg #============================================================================== sub fastaRdGuide { local($fileInLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # fastaRdGuide reads first sequence in list of FASTA format # in: $fileInLoc,$fhErrSbr # out: 0|1,$id,$seq # err: ok=(1,id,seq), err=(0,'msg',) #------------------------------------------------------------------------------- $tmp=$0;$tmp=~s/^.*\/|\.pl//g;$tmp.=":"; $sbrName="$tmp"."fastaRdGuide";$fhinLoc="FHIN"."$sbrName"; $Lok= &open_file("$fhinLoc","$fileInLoc"); return(0,"*** ERROR $sbrName: old '$fileInLoc' not opened\n"," ") if (! $Lok); $ct=0;$seq=""; while (<$fhinLoc>) { $_=~s/\n//g; if ($_=~/^\s*>\s*(.+)$/){ ++$ct; last if ($ct>1); $id=$1;$id=~s/[\s\t]+/ /g; # $id=~s/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$//g; next;} $seq.="$_";} $seq=~s/\s//g; return(0,"*** ERROR $sbrName: no guide sequence found\n"," ") if (length($seq)<1); return(1,$id,$seq); } # end of fastaRdGuide #=============================================================================== sub fastaRdMul { local($fileInLoc,$rd) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # fastaRdMul reads many sequences in FASTA db # in: $fileInLoc,$rd with: # $rd = '1,5,6', i.e. list of numbers to read # $rd = 'id1,id2', i.e. list of ids to read # NOTE: numbers faster!!! # out: 1|0,$id,$seq (note: many ids/seq separated by '\n' # err: ok=(1,id,seq), err=(0,'msg') #------------------------------------------------------------------------------- $sbrName="lib-br:fastaRdMul";$fhinLoc="FHIN_"."$sbrName"; &open_file("$fhinLoc","$fileInLoc") || return(0,"*** ERROR $sbrName: old '$fileInLoc' not opened\n"," "); undef %tmp; if (! defined $rd) { $LisNumber=1; $rd=0;} elsif ($rd !~ /[^0-9\,]/){ @tmp=split(/,/,$rd); $LisNumber=1; foreach $tmp(@tmp){$tmp{$tmp}=1;}} else {$LisNumber=0; @tmp=split(/,/,$rd); } $ct=$ctRd=0; while (<$fhinLoc>) { $_=~s/\n//g; if ($_=~/^\s*>\s*(.+)$/){ # line with id ++$ct;$Lread=0; last if ($rd && $ctRd==$#tmp); # fin if all found next if ($rd && $LisNumber && ! defined $tmp{$ct}); $id=$1;$id=~s/\s\s*/ /g;$id=~s/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$//g; $Lread=1 if ( ($LisNumber && defined $tmp{$ct}) || $rd == 0); if (! $Lread){ # go through all ids foreach $tmp(@tmp){ next if ($tmp !~/$id/); $Lread=1; # does match, so take last;}} next if (! $Lread); ++$ctRd; $tmp{"$ctRd","id"}=$id; $tmp{"$ctRd","seq"}="";} elsif ($Lread) { # line with sequence $tmp{"$ctRd","seq"}.="$_";}} $seq=$id=""; # join to long strings foreach $it (1..$ctRd) { $id.= $tmp{"$it","id"}."\n"; $tmp{"$it","seq"}=~s/\s//g; $seq.=$tmp{"$it","seq"}."\n";} $#tmp=0; # save memory undef %tmp; # save memory return(0,"*** ERROR $sbrName: file=$fileInLoc, nali=$ct, wanted: (rd=$rd)\n"," ") if (length($seq)<1); return(1,$id,$seq); } # end of fastaRdMul #=============================================================================== sub fastaWrt { local($fileOutLoc,$id,$seqLoc) = @_ ; local($sbrName,$fhoutLoc,$tmp,$Lok,$idloc); $[ =1 ; #------------------------------------------------------------------------------- # fastaWrt writes a sequence in FASTA format # in: $fileOut,$id,$seq (one string) # out: # err: ok=(1,'ok'), err=(0,'msg') #------------------------------------------------------------------------------- $sbrName="lib-br:fastaWrt";$fhoutLoc="FHOUT_"."$sbrName"; # print "yy into write seq=$seqLoc,\n"; &open_file("$fhoutLoc",">$fileOutLoc") || return(0,"*** ERROR $sbrName: '$fileOutLoc' not opened for write\n"); # 2003-09: br remove stuff $idloc=$id; $idloc=~s/\n//g; $idloc=~s/^\s*|\s*$//g; print $fhoutLoc ">".$idloc."\n"; for($it=1;$it<=length($seqLoc);$it+=50){ $tmpwrt=""; foreach $it2 (0..4){ last if (($it+10*$it2)>=length($seqLoc)); $tmp=substr($seqLoc,($it+10*$it2),10); $tmp=~s/^\s*|\s*$//g; next if ($tmp=~/^\s*$/); $tmpwrt.=sprintf(" %-10s",$tmp); } $tmpwrt=~s/^\s*|\s*$//g; $tmpwrt.="\n"; print $fhoutLoc $tmpwrt; } close($fhoutLoc); return(1,"ok $sbrName"); } # end of fastaWrt #============================================================================== sub fastaWrtMul { local($fileOutLoc,%tmp) = @_ ; local($sbrName,$fhoutLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # fastaWrtMul writes a list of sequences in FASTA format # in: $fileOut,$tmp{} with: # in: $tmp{"NROWS"} number of sequences # in: $tmp{"id",$ct} id for sequence $ct # in: $tmp{"seq",$ct} seq for sequence $ct # out: file # err: err -> 0,message # err: ok -> 1,ok # err: warn -> 2,not enough written #------------------------------------------------------------------------------- $sbrName="lib-br:fastaWrtMul";$fhoutLoc="FHOUT_"."$sbrName"; return(0,"*** ERROR $sbrName: no tmp{NROWS} defined\n") if (! defined $tmp{"NROWS"}); &open_file("$fhoutLoc",">$fileOutLoc") || return(0,"*** ERROR $sbrName: '$fileOutLoc' not opened for write\n"); $ctOk=0; foreach $itpair (1..$tmp{"NROWS"}){ next if (! defined $tmp{"id",$itpair} || ! defined $tmp{"seq",$itpair}); ++$ctOk; # some massage $tmp{"id",$itpair}=~s/[\s\t\n]+/ /g; $tmp{"seq",$itpair}=~s/[\s\t\n]+//g; # write print $fhoutLoc ">",$tmp{"id",$itpair},"\n"; $lenHere=length($tmp{"seq",$itpair}); for($it=1; $it<=$lenHere; $it+=50){ $tmpWrt= ""; foreach $it2 (0..4){ $itHere=($it + 10*$it2); last if ( $itHere >= $lenHere); $nchunk=10; $nchunk=1+($lenHere-$itHere) if ( (10 + $itHere) > $lenHere); $tmpWrt.= sprintf(" %-10s",substr($tmp{"seq",$itpair},$itHere,$nchunk)); } print $fhoutLoc $tmpWrt,"\n"; } } close($fhoutLoc); return(0,"*** ERROR $sbrName: no sequence written\n") if (! $ctOk); return(2,"-*- WARN $sbrName: wrote fewer sequences than expected\n") if ($ctOk!=$tmp{"NROWS"}); return(1,"ok $sbrName"); } # end of fastaWrtMul #============================================================================== sub fctRunTimeLeft { local($timeBegLoc,$num_to_run,$num_did_run) = @_ ; local($sbrName); $[ =1 ; #------------------------------------------------------------------------------- # fctRunTimeLeft estimates the time the job still needs to run # in: $timeBegLoc : time (time) when job began # in: $num_to_run : number of things to do # in: $num_did_run: number of things that are done, so far # out: $_string_time-still (hour:min:sec) #------------------------------------------------------------------------------- $sbrName="lib-br:"."fctRunTimeLeft"; $timeNow=time; $timeRun=$timeNow-$timeBegLoc; $percLoc=0; $percLoc=100*($num_did_run/$num_to_run) if ($num_to_run > 0); if ($percLoc) { $timeTot=int(100*($timeRun/$percLoc)); $timeLeft=$timeTot-$timeRun; $tmp= &fctSeconds2time($timeLeft); @tmp=split(/:/,$tmp); foreach $tmp (@tmp){$tmp=~s/^0//g;} $estimateLoc= ""; $estimateLoc.= $tmp[1]."h " if ($tmp[1] > 9); $estimateLoc.=" ".$tmp[1]."h " if (9 >= $tmp[1] && $tmp[1] > 0); $estimateLoc.= $tmp[2]."m " if ($tmp[2] > 9); $estimateLoc.=" ".$tmp[2]."m " if (9 >= $tmp[2] && $tmp[2] > 0); $estimateLoc.=" "." ". " " if ($tmp[2] <= 0 && $tmp[1] > 0); $estimateLoc.= $tmp[3]."s " if ($tmp[3] > 9); $estimateLoc.=" ".$tmp[3]."s " if (9 >= $tmp[3] && $tmp[3] > 0); $estimateLoc.=" "." ". " " if ($tmp[3] <= 0 && ($tmp[1] > 0 || $tmp[2] > 0)); $estimateLoc= "done" if (length($estimateLoc) < 1);} else { $estimateLoc="?";} return($estimateLoc); } # end of fctRunTimeLeft #============================================================================== sub fctSeconds2time { local($secIn) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # fctSeconds2time converts seconds to hours:minutes:seconds # in: seconds # out: 05:13:50 #------------------------------------------------------------------------------- $sbrName="lib-comp:"."fctSeconds2time";$fhinLoc="FHIN"."$sbrName"; $minTmp= int($secIn/60); $seconds= ($secIn - $minTmp*60); $seconds=int($seconds); $hours= int($minTmp/60); $hours= int($hours); $minutes= ($minTmp - $hours*60); $minutes=int($minutes); $seconds="0".$seconds if (length($seconds)==1); $minutes="0".$minutes if (length($minutes)==1); $hours= "0".$hours if (length($hours)==1); return("$hours".":".$minutes.":".$seconds); } # end of fctSeconds2time #============================================================================== sub gcgRd { local($fileInLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # gcgRd reads sequence in GCG format # in: $fileInLoc # out: 1|0,$id,$seq # err: ok=(1,id,seq), err=(0,'msg') #------------------------------------------------------------------------------- $sbrName="lib-br:gcgRd";$fhinLoc="FHIN_"."$sbrName"; &open_file("$fhinLoc","$fileInLoc") || return(0,"*** ERROR $sbrName: old '$fileInLoc' not opened\n"," "); $seq=""; while (<$fhinLoc>) { $_=~s/\n//g;$line=$_; if ($line=~/^\s*(\S+)\s*from\s*:/){ $id=$1; next;} next if ($line !~ /^\s*\d+\s+(.*)$/); $tmp=$1;$tmp=~s/\s//g; $seq.=$tmp;}close($fhinLoc); return(0,"*** ERROR $sbrName: file=$fileInLoc, no sequence found\n") if (length($seq)<1); return(1,$id,$seq); } # end of gcgRd #=============================================================================== sub gcgWrt { local($fileOutLoc,$idLoc,$seqLoc) = @_ ; local($sbrName,$fhoutLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # gcgWrt writes one sequence in GCG format # in: $fileOut,$id,$seq, # out: file # err: err -> 0,message # err: ok -> 1,ok #------------------------------------------------------------------------------- $sbrName="lib-br:gcgWrt";$fhoutLoc="FHOUT_"."$sbrName"; return(0,"*** ERROR $sbrName: no seq defined\n") if (! defined $seqLoc); &open_file("$fhoutLoc",">$fileOutLoc") || return(0,"*** ERROR $sbrName: '$fileOutLoc' not opened for write\n"); #....,....1....,....2....,....3....,....4....,....5....,....6....,....7 #1ppt.f from: 1 to: 36 # #1ppt # 1ppt.gcg Length: 36 24-Feb-99 Check: 2818 .. # # 1 GPSQPTYPGD DAPVEDLIRF YDNLQQYLNV VTRHRY # some massage $idLoc=~s/[\s\t\n]+/ /g; $seqLoc=~s/[\s\t\n]+//g; # write printf $fhoutLoc "%-s from: %5d to:%5d\n",$idLoc,1,length($seqLoc); print $fhoutLoc "\n"; print $fhoutLoc $idLoc,"\n"; printf $fhoutLoc " %-s Length:%5d 11-Jul-99 Check: 2818 ..\n",$fileOutLoc,length($seqLoc); print $fhoutLoc "\n"; # ------------------------------ # sequence $len=length($seqLoc); $num=1+int($len/50); $lenSub=10; foreach $it (1..$num) { $beg=($it-1)*50+1; $end=$it*50; last if ($beg > $len); printf $fhoutLoc "%8d ",$beg; foreach $it2 (1..5) { $beg2=$beg+($it2-1)*10; last if ($beg2 > $len); $tmp=1+$len-$beg2; $lenSub=$tmp if ($tmp < 10); print $fhoutLoc " ",substr($seqLoc,$beg2,$lenSub); last if ($lenSub < 10); } print $fhoutLoc "\n\n"; } close($fhoutLoc); return(0,"*** ERROR $sbrName: no sequence written\n") if (! -e $fileOutLoc); return(1,"ok $sbrName"); } # end of gcgWrt #============================================================================== sub get_in_keyboard { local($des,$def,$pre,$Lmirror)=@_;local($txt); #-------------------------------------------------------------------------------- # get_in_keyboard gets info from keyboard # in: $des : keyword to get # in: $def : default settings # in: $pre : text string beginning screen output # default '--- ' # in: $Lmirror: if true, the default is mirrored # out: $val : value obtained #-------------------------------------------------------------------------------- $pre= "---" if (! defined $pre); $Lmirror=0 if (! defined $Lmirror || ! $Lmirror); $txt=""; # ini printf "%-s %-s\n", $pre,"-" x (79 - length($pre)); printf "%-s %-15s:%-s\n", $pre,"type value for",$des; if (defined $def){ printf "%-s %-15s:%-s\n",$pre,"type RETURN to enter value, or to keep default"; printf "%-s %-15s>%-s\n",$pre,"default value",$def;} else { printf "%-s %-15s>%-s\n",$pre,"type RETURN to enter value"; } $txt=$def if ($Lmirror); # mirror it printf "%-s %-15s>%-s", $pre,"type",$txt; while(){ $txt.=$_; last if ($_=~/\n/);} $txt=~s/^\s+|\s+$//g; $txt=$def if (length($txt) < 1); printf "%-s %-15s>%-s\n", $pre,"--> you chose",$txt; return ($txt); } # end of get_in_keyboard #============================================================================== sub get_range { local ($range_txt,$nall) = @_; local (@range,@rangeLoc,$it,$range1,$range2); $[ =1 ; #-------------------------------------------------------------------------------- # get_range converts range=n1-n2 into @range (1,2) # in: 'n1-n2' NALL: e.g. incl=1-5,9,15 # n1= begin, n2 = end, * for wild card # NALL = number of last position # out: @takeLoc: begin,begin+1,...,end-1,end #-------------------------------------------------------------------------------- $#range=0; if (! defined $range_txt || length($range_txt)<1 || $range_txt eq "unk" || $range_txt !~/\d/ ) { print "*** ERROR in get_range: argument: range=$range_txt, nall=$nall, not digestable\n"; return(0);} $range_txt=~s/\s//g; # purge blanks $nall=0 if (! defined $nall); # already only a number return($range_txt) if ($range_txt !~/[^0-9]/); if ($range_txt !~/[\-,]/) { # no range given print "*** ERROR in get_range: argument: '$range_txt,$nall' not digestable\n"; return(0);} # ------------------------------ # dissect commata if ($range_txt =~ /\,/) { @range=split(/,/,$range_txt);} # ------------------------------ # dissect hyphens elsif ($range_txt =~ /(\d*|\*)-(\d*|\*)/) { @range=&get_rangeHyphen($range_txt,$nall);} # ------------------------------ # process further elements with hyphens $#range2=0; foreach $range (@range){ if ($range =~ /(\d*|\*)-(\d*|\*)/) { push(@range2,&get_rangeHyphen($range,$nall));} else { push(@range2,$range);}} @range=@range2; $#range2=0; # ------------------------------ if ($#range>1){ # sort @range=sort {$a<=>$b} @range;} return (@range); } # end of get_range #============================================================================== sub get_rangeHyphen { local ($range_txt,$nall) = @_ ; local (@rangeLoc,$it,$range1,$range2); $[ =1 ; #-------------------------------------------------------------------------------- # get_rangeHyphen reads 'n1-n2' # in: 'n1-n2', NALL (n1= begin, n2 = end, * for wild card) # NALL = number of last position # out: begin,begin+1,...,end-1,end #-------------------------------------------------------------------------------- if ($range_txt =~ /(\d*|\*)-(\d*|\*)/) { ($range1,$range2)=split(/-/,$range_txt); if ($range1=~/\*/) {$range1=1;} if ($range2=~/\*/) {$range2=$nall;} for($it=$range1;$it<=$range2;++$it) {push(@rangeLoc,$it);} } else { @rangeLoc=($range_txt);} return(@rangeLoc); } # end of get_rangeHyphen #=============================================================================== sub getDistanceNewCurveIde { local($laliLoc)=@_; local($expon,$loc); $[ =1 ; #------------------------------------------------------------------------------- # getDistanceNewCurveIde out= pide value for new curve # br 2003-08: mistake corrected # # in: $lali # out: $pide # # OLD pide= 510 * L ^ { -0.32 (1 + e ^-(L/1000)) } # NEW pide= 480 * L ^ { -0.32 (1 + e ^-(L/1000)) } #------------------------------------------------------------------------------- $sbrName="lib-br:getDistanceNewCurveIde"; return(0,"*** ERROR $sbrName: lali not defined \n") if (! defined $laliLoc); return(0,"*** ERROR $sbrName: '$laliLoc' = alignment length??\n") if (length($laliLoc)<1 || $laliLoc=~/[^0-9.]/); # saturation short: <=11 return(100,"ok $sbrName saturation short") if ($laliLoc<=11); # saturation long: >450 return(19.5,"ok $sbrName saturation long") if ($laliLoc>450); $expon= - 0.32 * ( 1 + exp (-$laliLoc/1000) ); # $loc= 510 * $laliLoc ** ($expon); $loc= 480 * $laliLoc ** ($expon); $loc=100 if ($loc > 100); # saturation short $loc=19.5 if ($loc < 19.5); # saturation long return($loc,"ok $sbrName"); } # end of getDistanceNewCurveIde #============================================================================== sub getFileFormatQuick { local($fileInLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # getFileFormatQuick quick scan for file format: assumptions # file exists # file is db format (i.e. no list) # in: file # out: 0|1,format # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $sbrName="lib-br:"."getFileFormatQuick";$fhinLoc="FHIN_"."getFileFormatQuick"; # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); # alignments (EMBL 1) return(1,"HSSP") if (&is_hssp($fileInLoc)); return(1,"STRIP") if (&is_strip($fileInLoc)); # return(1,"STRIPOLD") if (&is_strip_old($fileInLoc)); return(1,"DSSP") if (&is_dssp($fileInLoc)); return(1,"FSSP") if (&is_fssp($fileInLoc)); # alignments (EMBL 1) return(1,"DAF") if (&isDaf($fileInLoc)); return(1,"SAF") if (&isSaf($fileInLoc)); # alignments other return(1,"MSF") if (&isMsf($fileInLoc)); return(1,"FASTAMUL") if (&isFastaMul($fileInLoc)); return(1,"PIRMUL") if (&isPirMul($fileInLoc)); # sequences return(1,"FASTA") if (&isFasta($fileInLoc)); return(1,"SWISS") if (&isSwiss($fileInLoc)); return(1,"PIR") if (&isPir($fileInLoc)); return(1,"GCG") if (&isGcg($fileInLoc)); return(1,"PDB") if (&isPdb($fileInLoc)); # PP return(1,"PPCOL") if (&is_ppcol($fileInLoc)); # NN return(1,"NNDB") if (&is_rdb_nnDb($fileInLoc)); # PHD return(1,"PHDRDBBOTH") if (&isPhdBoth($fileInLoc)); return(1,"PHDRDBACC") if (&isPhdAcc($fileInLoc)); return(1,"PHDRDBHTM") if (&isPhdHtm($fileInLoc)); return(1,"PHDRDBHTMREF") if (&is_rdb_htmref($fileInLoc)); return(1,"PHDRDBHTMTOP") if (&is_rdb_htmtop($fileInLoc)); return(1,"PHDRDBSEC") if (&isPhdSec($fileInLoc)); # RDB return(1,"RDB") if (&isRdb($fileInLoc)); return(1,"unk"); } # end of getFileFormatQuick #=============================================================================== sub getSysARCH { # DEPRECATED DEPRECATED DEPRECATED DEPRECATED DEPRECATED # 01/10/10 GY # WE ARE NO LONGER LOOKING FOR PLATFORM INFORMATION USING THIS METHOD # local($exePvmgetarch,@argLoc) = @_ ; # local($sbrName,$Lok); # $[ =1 ; #------------------------------------------------------------------------------- # getSysARCH tries to get the system architecture # # in: $exePvmgetarch: bin-shell script to get ARCH # = 0 to not execute that one.. # in: @argLoc: all arguments passed to program, checks # for one with: # ARCH=SGI64 .. or so # out: <0,$ARCH> #------------------------------------------------------------------------------- # $tmp=$0;$tmp=~s/^.*\/|\.pl//g;$tmp.=":";$sbrName=$tmp."getSysARCH"; # $archFound=0; # $exePvmgetarch=0 if (! defined $exePvmgetarch); # ------------------------------ # (1) find in arguments passed # ------------------------------ # if (defined @argLoc && $#argLoc > 0) { # foreach $arg (@argLoc) { # if ($arg=~/^ARCH=(\S+)/i) { # $archFound=$1; # archs are upper case: convert # $archFound=~tr/[a-z]/[A-Z]/; # last; }} } # return($archFound) if ($archFound); # ------------------------------ # (2) try env asf # ------------------------------ # $archFound=$ENV{'ARCH'} || $ENV{'CPUARC'} || 0; # return($archFound) if ($archFound); # ------------------------------ # (3) run bin shell script given # ------------------------------ # if ($exePvmgetarch && (-e $exePvmgetarch || -l $exePvmgetarch)) { # $scr=$exePvmgetarch; # $archFound=`$scr`; # system call # $archFound=~s/\s|\n//g; # $archFound=0 if (length($archFound < 3) || $archFound !~ /[A-Z][A-Z]/);} # return($archFound) if ($archFound); # ------------------------------ # (4) search bin shell script # ------------------------------ # foreach $possible ("/home/rost/pub/phd/scr/pvmgetarch.sh", # "/home/rost/etc/pvmgetarch.sh") { # if (-e $possible || -l $possible) { # $exePvmgetarch=$possible; # last; }} # somewhere in relative paths # if (! $exePvmgetarch) { # $dirRelative=$0; $dirRelative=~s/\.\///g; $dirRelative=~s/^(.*\/).*$/$1/; # foreach $possible ("scr/pvmgetarch.sh","scr/which_arch.sh", # "bin/pvmgetarch.sh","bin/which_arch.sh", # "etc/pvmgetarch.sh","etc/which_arch.sh", # "pvmgetarch.sh","which_arch.sh") { # if (-e $possible || -l $possible) { # $exePvmgetarch=$possible; # last; }}} # ****************************** # script not found # return(0) if (! $exePvmgetarch); # ****************************** # ------------------------------ # (5) run bin shell script # ------------------------------ # $scr=$exePvmgetarch; # $archFound=`$scr`; # system call # $archFound=~s/\s|\n//g; # $archFound=0 if (length($archFound) < 3 || $archFound !~ /[A-Z][A-Z]/); # return($archFound); } # end of getSysARCH #=============================================================================== sub hsspCorrectNali { local($fileInLoc,$fileTmpLoc,$fhErrSbr) = @_ ; local($sbrName,$fhinLoc,$fhoutLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # hsspCorrectNali convert_seq makes mistakes in NALI # these are corrected here! # in: $fileInLoc # in: $fileInLoc # out: 1|0,msg, implicit: # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $tmp=$0;$tmp=~s/^.*\/|\.pl//g;$tmp.=":"; $sbrName=$tmp."hsspCorrectNali"; $fhinLoc="FHIN_"."hsspCorrectNali";$fhoutLoc="FHOUT_"."hsspCorrectNali"; # check arguments return(&errSbr("not def fileInLoc!")) if (! defined $fileInLoc); return(&errSbr("not def fileTmpLoc!")) if (! defined $fileTmpLoc); # return(&errSbr("not def !")) if (! defined $); return(&errSbr("no fileIn=$fileInLoc!")) if (! -e $fileInLoc); # open file open($fhinLoc,$fileInLoc) || Carp::confess( "failed to open $fileInLoc: $!" ) || return(&errSbr("fileInLoc=$fileInLoc, not opened")); # ------------------------------ while (<$fhinLoc>) { # read file if ($_=~/^NALIGN \s+(\d+)/){ $nalign=$1; } elsif ($_=~/^\s+(\d+)\s\:\s/){ $itali=$1; } elsif ($_=~/^\#\# ALIGNMENTS/){ last; } } close($fhinLoc); # ------------------------------ # ok? if ($itali==$nalign){ return(1,"ok $sbrName no change"); } # change: print $fhErrSbr "--- file.hssp ($fileInLoc) NALI=$nalign, itali=$itali-> have to change it!\n" if ($par{"debug"}); # move files $cmd="\\mv ".$fileInLoc." ".$fileTmpLoc; ($Lok,$msg)=&sysRunProg($cmd,$fileScreenLoc,$fhSysRunProg); return(0,"*** ERROR $sbrName: failed to run system ($cmd)\n".$msg."\n") if (! $Lok || ! -e $fileTmpLoc); print $fhErrSbr "--- $sbrName system '$cmd'\n" if ($par{"debug"}); # now change open($fhinLoc,$fileTmpLoc) || Carp::confess( "failed to open $fileTmpLoc: $!" ) || return(&errSbr("in fileTmpLoc=$fileTmpLoc, not opened")); open($fhoutLoc,">".$fileInLoc) || Carp::confess( "failed to open $fileInLoc: $!" ) || return(&errSbr("out fileInLoc=$fileInLoc, not created")); # ------------------------------ while (<$fhinLoc>) { # read file if ($_=~/^NALIGN \s+(\d+)/){ # '....,....1....,' # 'NALIGN 64' printf $fhoutLoc "NALIGN %8d\n",$itali; } else { print $fhoutLoc $_; } } close($fhinLoc); close($fhoutLoc); return(1,"ok $sbrName"); } # end of hsspCorrectNali #============================================================================== sub hsspGetChain { local ($fileIn) = @_ ; local ($fhin,$ifirLoc,$ilasLoc,$tmp1,$tmp2, $chainLoc,$posLoc,$posRd,$chainRd,@cLoc,@pLoc,%rdLoc); $[ =1 ; #-------------------------------------------------------------------------------- # hsspGetChain extracts all chain identifiers in HSSP file # in: $file # out: $chains (ABC) ,%rdLoc # no chain -> $chains=' ' # out $rdLoc{"NROWS"},$rdLoc{"$ct","chain"}, # out $rdLoc{"$ct","ifir"},$rdLoc{"$ct","ilas"} #-------------------------------------------------------------------------------- $fhin="FhInHssp"; return(0,"no file") if (! -e $fileIn); &open_file("$fhin","$fileIn"); while(<$fhin>){ # until start of data last if ($_=~/^ SeqNo/);} $chainLoc=$posLoc=""; while(<$fhin>){ if ($_=~/^\#/ && (length($chainLoc)>1) ) { $posLoc.="$ifirLoc-$ilasLoc".","; last;} $chainRd=substr($_,13,1); $aaRd= substr($_,15,1); $posRd= substr($_,1,6);$posRd=~s/\s//g; next if ($aaRd eq "!") ; # skip over chain break if ($chainLoc !~/$chainRd/){ # new chain? $posLoc.= "$ifirLoc-$ilasLoc"."," if (length($chainLoc)>1); $chainLoc.= "$chainRd".","; $ifirLoc=$ilasLoc=$posRd;} else { $ilasLoc=$posRd;} }close($fhin); $chainLoc=~s/^,|,$//g; $posLoc=~s/\s//g;$posLoc=~s/^,|,$//g; # purge leading ',' # now split chains read undef %rdLoc; $ctLoc=0; @cLoc=split(/,/,$chainLoc); @pLoc=split(/,/,$posLoc); foreach $itLoc(1..$#cLoc){ ($tmp1,$tmp2)=split(/-/,$pLoc[$itLoc]); next if ($tmp2 == $tmp1); # exclude chains of length 1 ++$ctLoc; $rdLoc{"NROWS"}= $ctLoc; $rdLoc{"$ctLoc","chain"}=$cLoc[$itLoc]; $rdLoc{"$ctLoc","ifir"}= $tmp1; $rdLoc{"$ctLoc","ilas"}= $tmp2;} $chainLoc=~s/,//g; return($chainLoc,%rdLoc); } # end of hsspGetChain #============================================================================== sub hsspGetChainLength { local ($fileIn,$chainLoc) = @_ ; local ($file_hssp,$ct,$tmp,$beg,$end,$pos); $[ =1 ; #-------------------------------------------------------------------------------- # hsspGetChainLength extracts the length of a chain in an HSSP file # in: hssp_file,chain, # out: $length,$ifir,$ilas #-------------------------------------------------------------------------------- $fileIn=~s/\s//g;$fileIn=~s/\n//g; $file_hssp=$fileIn; $Lchain=1; $Lchain=0 if ($chainLoc eq "*" || ! &is_chain($chainLoc)); if (! -e $file_hssp){ print "*** ERROR hsspGetChainLength: no HSSP=$fileIn,\n"; return(0,"*** ERROR hsspGetChainLength: no HSSP=$fileIn,");} &open_file("FHIN", "$file_hssp") || return(0,"*** ERROR hsspGetChainLength: failed opening HSSP=$fileIn,"); while ( ) { last if (/^ SeqNo/); } $ct=$pos=0; while ( ) { last if (/^\#\# /); ++$pos;$tmp=substr($_,13,1); if ( $Lchain && ($tmp eq $chainLoc) ) { ++$ct; } elsif ( ! $Lchain ) { ++$ct; } elsif ( $ct>1 ) { last;} $beg=$pos if ($ct==1); } close(FHIN); $end=$pos; return($ct,$beg,$end); } # end of hsspGetChainLength #============================================================================== sub hsspRdAli { local ($fileInLoc,@want) = @_ ; local ($sbrName,$fhinLoc,$tmp); $[ =1 ; #------------------------------------------------------------------------------- # hsspRdAli reads and writes the sequence of HSSP + 70 alis # in: $fileHssp (must exist), # @des (1) =1, 2, ..., i.e. number of sequence to be read # (2) = swiss_id1, swiss_id2, i.e. identifiers to read # (3) = all (or undefined) # NOTE: you can give ids AND numbers ('1','paho_chick','2') .. # furthermore: # if @want = 'seq|seqAli|seqNoins' # only those will be returned (e.g. $tmp{"seq",$ct}) # default: all 3! # out: 1|0,$rd{} with: # err: (0,$msg) # overall: # $rd{"NROWS"}= : number of alis, i.e. $#want # $rd{"NRES"}=N : number of residues in guide # $rd{"SWISS"}='sw1,sw2' : list of swiss-ids read # $rd{"0"}='pdbid' : id of guide sequence (in file header) # $rd{$it}='sw$ct' : swiss id of the it-th alignment # $rd{"$id"}='$it' : position of $id in final list # $rd{"sec","$itres"} : secondary structure for residue itres # $rd{"acc","$itres"} : accessibility for residue itres # $rd{"chn","$itres"} : chain for residue itres # per prot: # $rd{"seqNoins",$ct}=sequences without insertions # $rd{"seqNoins","0"}= GUIDE sequence # $rd{"seq",$ct}=SEQW : sequences, with all insertions # but NOT aligned!!! # $rd{"seqAli",$ct} : sequences, with all insertions, # AND aligned (all, including guide # filled up with '.' !! #------------------------------------------------------------------------------- $sbrName="lib-br:hsspRdAli"; $fhinLoc="FHIN"."$sbrName"; $fhinLoc=~tr/[a-z]/[A-Z]/; # file existing? if ((! -e $fileInLoc) || (! &is_hssp($fileInLoc))){ print "*** ERROR $sbrName no HSSP file '$fileInLoc'\n"; return(0);} # ------------------------------ # HSSP file format settings $regexpBegAli= "^\#\# ALIGNMENTS"; # begin of reading $regexpEndAli= "^\#\# SEQUENCE PROFILE"; # end of reading $regexpSkip= "^ SeqNo"; # skip lines with pattern $nmaxBlocks= 100; # maximal number of blocks considered (=7000 alis!) $regexpBegIns= "^\#\# INSERTION LIST"; # begin of reading insertion list undef %tmp; undef @seqNo; undef %seqNo; # ------------------------------ # pointers undef %ptr_id2num; # $ptr{xyz}= N : id=xyz is the Nth ali undef @ptr_num2id; # $ptr[N]= xyz : Nth ali has id= xyz undef @ptr_numWant2numFin; # $ptr[N]= M : the Nth ali is the Mth one in the list # of all numbers wanted (i.e. = $want[M]) undef @ptr_numFin2numWant; # $ptr[M]= N : see previous, the other way around! $#want=0 if (! defined @want); $LreadAll=0; # ------------------------------ # digest input $#tmp=0; undef %kwd; # (1) detect keywords foreach $tmp (@want){ if ($tmp=~/^(seq|seqAli|seqNoins)$/){ $kwd{$tmp}=1; next;} push(@tmp,$tmp);} if (($#want>0) && ($#want == $#tmp) ){ # default keyworkds foreach $des ("seq","seqAli","seqNoins"){ $kwd{"$des"}=1;}} @want=@tmp; # (2) all? $LreadAll=1 if ( ! @want || ! $want[1] || ($want[1] eq "all")); if (! $LreadAll){ # (3) read some $#wantNum=$#wantId=0; foreach $want (@want) { if ($want !~ /[^0-9]/){push(@wantNum,$want);} # is number else {push(@wantId,$want);}}} # is id # ------------------------------ # get numbers/ids to read ($Lok,%rdHeader)= &hsspRdHeader($fileInLoc,"SEQLENGTH","PDBID","NR","ID"); if (! $Lok){ print "*** ERROR $sbrName reading header of HSSP file '$fileInLoc'\n"; return(0);} $tmp{"NRES"}= $rdHeader{"SEQLENGTH"};$tmp{"NRES"}=~s/\s//g; $tmp{"0"}= $rdHeader{"PDBID"}; $tmp{"0"}=~s/\s//g; $idGuide= $tmp{"0"}; $#locNum=$#locId=0; # store the translation name/number foreach $it (1..$rdHeader{"NROWS"}){ $num=$rdHeader{"NR",$it}; $id=$rdHeader{"ID",$it}; push(@locNum,$num);push(@locId,$id); $ptr_id2num{"$id"}=$num; $ptr_num2id[$num]=$id;} push(@locNum,"1") if ($#locNum==0); # nali=1 # ------------------------------ foreach $want (@wantId){ # CASE: input=list of names $Lok=0; # -> add to @wantNum foreach $loc (@locId){ if ($want eq $loc){$Lok=1;push(@wantNum,$ptr_id2num{"$loc"}); last;}} if (! $Lok){ print "-*- WARNING $sbrName wanted id '$want' not in '$fileInLoc'\n";}} # ------------------------------ # NOW we have all numbers to get # sort the array @wantNum= sort bynumber (@wantNum); # too many wanted if (defined @wantNum && ($wantNum[$#wantNum] > $locNum[$#locNum])){ $#tmp=0; foreach $want (@wantNum){ if ($want <= $locNum[$#locNum]){ push(@tmp,$want)} else { print "-*- WARNING $sbrName no $want not in '$fileInLoc'\n"; exit; }} @wantNum=@tmp;} @wantNum=@locNum if ($LreadAll); if ($#wantNum==0){ print "*** ERROR $sbrName nothing to read ???\n"; return(0);} # sort the array, again @wantNum= sort bynumber (@wantNum); # ------------------------------ # assign pointers to final output foreach $it (1..$#wantNum){ $numWant=$wantNum[$it]; $ptr_numWant2numFin[$numWant]=$it; $ptr_numFin2numWant[$it]= $numWant;} # ------------------------------ # get blocks to take $wantLast=$wantNum[$#wantNum];$#wantBlock=0; foreach $ctBlock (1..$nmaxBlocks){ $beg=1+($ctBlock-1)*70; $end=$ctBlock*70; last if ($wantLast < $beg); $Ltake=0; foreach $num(@wantNum){ if ( ($beg<=$num)&&($num<=$end) ){ $Ltake=1; last;}} if ($Ltake){ $wantBlock[$ctBlock]=1;} else{ $wantBlock[$ctBlock]=0;}} # writes ids read $tmp{"SWISS"}=""; foreach $it (1..$#wantNum){ $num=$wantNum[$it]; $tmp{$it}= $ptr_num2id[$num]; $tmp{"SWISS"}.=$ptr_num2id[$num].",";} $tmp{"SWISS"}=~s/,*$//g; $tmp{"NROWS"}=$#wantNum; # ------------------------------------------------------------ # # NOTATION: # $tmp{"0",$it}= $it-th residue of guide sequnec # $tmp{$itali,$it}= $it-th residue of of ali $itali # note: itali= same numbering as in 1..$#want # i.e. NOT the position in the file # $ptr_numFin2numWant[$itali]=5 may reveal that # the itali-th ali was actually the fifth in the # HSSP file!! # # ------------------------------------------------------------ # -------------------------------------------------- # read the file finally # -------------------------------------------------- $Lok=&open_file("$fhinLoc","$fileInLoc"); if (! $Lok){print "*** ERROR $sbrName opening hssp file '$fileInLoc'\n"; return(0);} # ------------------------------ # move until first alis # ------------------------------ $ctBlock=$Lread=$#takeTmp=0; while (<$fhinLoc>){ last if ($_=~/$regexpEndAli/); # ending if ($_=~/$regexpBegAli/){ # this block to take? ++$ctBlock;$Lread=0; if ($wantBlock[$ctBlock]){ $_=~s/^[^0-9]+(\d+) -\s+(\d+).*$//; $beg=$1;$end=$2;$Lread=1; $#wantTmp=0; # local numbers foreach $num (@wantNum){ if ( ($beg<=$num) && ($num<=$end) ){ $tmp=($num-$beg)+1; print "*** $sbrName negative number $tmp,$beg,$end,\n" x 3 if ($tmp<1); push(@wantTmp,$tmp);}} next;}} next if (! $Lread); # move on next if ($_=~/$regexpSkip/); # skip line $line=$_; # -------------------- if (length($line)<52){ # no alis in line $seqNo=substr($line,1,6);$seqNo=~s/\s//g; if (! defined $seqNo{$seqNo}){ $seqNo{$seqNo}=1; push(@seqNo,$seqNo);} # NOTE: $chn,$sec,$acc are returned per residue! if (! defined $tmp{"0","$seqNo"}){ ($seqNo,$pdbNo, $tmp{"chn","$seqNo"},$tmp{"0","$seqNo"}, $tmp{"sec","$seqNo"},$tmp{"acc","$seqNo"})= &hsspRdSeqSecAccOneLine($line);} foreach $num(@wantTmp){ # add insertions if no alis $pos= $num+$beg-1; $posFin= $ptr_numWant2numFin[$pos]; $tmp{"$posFin","$seqNo"}="."; } next;} # ------------------------------ # everything fine, so read ! # ------------------------------ # -------------------- # first the HSSP stuff $seqNo=substr($line,1,6);$seqNo=~s/\s//g; if (! defined $seqNo{$seqNo}){ $seqNo{$seqNo}=1; push(@seqNo,$seqNo);} # NOTE: $chn,$sec,$acc are returned per residue! if (! defined $tmp{"0","$seqNo"}){ ($seqNo,$pdbNo, $tmp{"chn","$seqNo"},$tmp{"0","$seqNo"}, $tmp{"sec","$seqNo"},$tmp{"acc","$seqNo"})= &hsspRdSeqSecAccOneLine($line);} # -------------------- # now the alignments $alis=substr($line,52); $alis=~s/\n//g; # NOTE: @wantTmp has the positions to read in current block, # e.g. want no 75, block=71-90, => 75->4 foreach $num (@wantTmp){ $pos= $num+$beg-1; # note: beg=71 in the example above $id= $ptr_num2id[$pos]; $posFin= $ptr_numWant2numFin[$pos]; $tmp{"$posFin"}= $id; $takeTmp[$pos]= 1; print "*** $sbrName neg number $pos,$beg,$num,\n" x 3 if ($pos<1); $tmp{"seq","$posFin"}= "" if (! defined $tmp{"seq","$posFin"}); if (length($alis) < $num){ $tmp{"seq","$posFin"}.= "."; $tmp{"$posFin","$seqNo"}=".";} else { $tmp{"seq","$posFin"}.= substr($alis,$num,1); $tmp{"$posFin","$seqNo"}=substr($alis,$num,1);}}} # ------------------------------ while (<$fhinLoc>){ # skip over profiles last if ($_=~/$regexpBegIns/); } # begin reading insertion list # ---------------------------------------- # store sequences without insertions!! # ---------------------------------------- if (defined $kwd{"seqNoins"} && $kwd{"seqNoins"}){ # -------------------- $seq=""; # guide sequence foreach $seqNo(@seqNo){ $seq.=$tmp{"0","$seqNo"};} $seq=~s/[a-z]/C/g; # small caps to 'C' $tmp{"seqNoins","0"}=$seq; # -------------------- # all others (by final count!) foreach $it (1..$#wantNum){ $seq=""; foreach $seqNo(@seqNo){ $seq.=$tmp{$it,"$seqNo"};} $seq=~s/\s/\./g; # fill up insertions $seq=~tr/[a-z]/[A-Z]/; # small caps to large $tmp{"seqNoins",$it}=$seq;} } # -------------------------------------------------- # read insertion list # # syntax of insertion list: # ....,....1....,....2....,....3....,....4 # AliNo IPOS JPOS Len Sequence # 9 58 59 5 kQLGAEi # # -------------------------------------------------- undef @insMax; # note: $insMax[$seqNo]=5 means at residue 'seqNo' foreach $seqNo (@seqNo){ # the longest insertion was 5 residues $insMax[$seqNo]=0;} while (<$fhinLoc>){ $rd=$_; last if ((! defined $kwd{"seqAli"} || ! $kwd{"seqAli"}) && (! defined $kwd{"seq"} || ! $kwd{"seq"}) ); next if ($rd =~ /AliNo\s+IPOS/); # skip key last if ($rd =~ /^\//); # end next if ($rd !~ /^\s*\d+/); # should not happen (see syntax) $rd=~s/\n//g; $line=$rd; $posIns=$rd; # current insertion from ali $pos $posIns=~s/^\s*(\d+).*$/$1/; # takeTmp[$pos]=1 if $pos to be read next if (! defined $takeTmp[$posIns] || ! $takeTmp[$posIns]); # ok -> take $line=~s/^\s*|\s*$//g; # purge leading blanks @tmp=split(/\s+/,$line); $iposIns=$tmp[2]; # residue position of insertion $seqIns= $tmp[5]; # sequence at insertion 'kQLGAEi' $nresIns=(length($seqIns) - 2); # number of residues inserted $posFin= $ptr_numWant2numFin[$posIns]; # -------------------------------------------------- # NOTE: here $tmp{$it,"$seqNo"} gets more than # one residue assigned (ref=11) # -------------------------------------------------- # change 'ACinK' -> 'ACINEWNK' $tmp{"$posFin","$iposIns"}=substr($seqIns,1,(length($seqIns)-1)); # maximal number of insertions $insMax[$iposIns]=$nresIns if ($nresIns > $insMax[$iposIns]); } close($fhinLoc); # end of reading file # -------------------------------------------------- # ------------------------------ # final sequences (not aligned) # ------------------------------ if (defined $kwd{"seq"} && $kwd{"seq"}){ foreach $it (0..$tmp{"NROWS"}){ $seq=""; foreach $seqNo(@seqNo){ $seq.=$tmp{$it,"$seqNo"};} $seq=~s/[\s\.!]//g; # replace insertions $seq=~tr/[a-z]/[A-Z]/; # all capitals $tmp{"seq",$it}=$seq; }} # ------------------------------ # fill up insertions # ------------------------------ if (defined $kwd{"seqAli"} && $kwd{"seqAli"}){ undef %ali; # temporary for storing sequences foreach $it (0..$tmp{"NROWS"}){ $ali{$it}="";} # set for all alis # ------------------------------ foreach $seqNo(@seqNo){ # loop over residues $insMax=$insMax[$seqNo]; # loop over all alis foreach $it (0..$tmp{"NROWS"}){ # (1) CASE: no insertion if ($insMax==0){ $ali{$it}.=$tmp{$it,"$seqNo"}; next;} # (2) CASE: insertions $seqHere=$tmp{$it,"$seqNo"}; $insHere=(1+$insMax-length($seqHere)); # NOTE: dirty fill them in 'somewhere' # take first residue $ali{$it}.=substr($seqHere,1,1); # fill up with dots $ali{$it}.="." x $insHere ; # take remaining residues (if any) $ali{$it}.=substr($seqHere,2) if (length($seqHere)>1); }} # ------------------------------ # now assign to final foreach $it (0..$tmp{"NROWS"}){ $ali{$it}=~s/\s/\./g; # replace ' ' -> '.' $ali{$it}=~tr/[a-z]/[A-Z]/; # all capital $tmp{"seqAli",$it}=$ali{$it};} undef %ali; # slim-is-in! } # ------------------------------ # save memory foreach $it (0..$tmp{"NROWS"}){ if ($it == 0){ # guide $id= $idGuide; } else { # pairs $posOriginal=$ptr_numFin2numWant[$it]; $id= $ptr_num2id[$posOriginal]; } $tmp{"$id"}= $id; foreach $seqNo (@seqNo){ undef $tmp{$it,"$seqNo"};}} undef @seqNo; undef %seqNo; undef @takeTmp; undef @idLoc; undef @want; undef @wantNum; undef @wantId; undef @wantBlock; undef %rdHeader; undef %ptr_id2num; undef @ptr_num2id; undef @ptr_numWant2numFin; undef @ptr_numFin2numWant; return(1,%tmp); } # end of hsspRdAli #============================================================================== sub hsspRdHeader { local ($fileInLoc,@kwdInLoc) = @_ ; local ($sbrName,$fhinLoc,$tmp, @kwdDefHsspTopLoc,@kwdDefHsspHdrLoc,@kwdHsspTopLoc,@kwdHsspHdrLoc,@tmp, $regexpBegHeader,$regexpEndHeader,$regexpLongId,$lenStrid,$LisLongId, %ptr,$kwd,$Lok,$Lpdb,$des,$beg,$end,$mid,$ct,$id,$strid,$ptr,$tmp); $[ =1 ; #------------------------------------------------------------------------------- # hsspRdHeader reads a HSSP header # in: $fileHssp (must exist), # @kwdInLoc = one of the default keywords # (@kwdLocHsspTop,@kwdLocHsspHeader) # in: 'nopair' surpresses reading of pair information # out: for top (e.g. NALIGN): $rd{"kwd"} # for prot (e.g. LALI): $rd{"kwd",$it} # note: for the later number of elements (it) in # $rd{"NROWS"} # special ID=ID1, $rd{"kwd",$it} existes for ID1 and ID2 #------------------------------------------------------------------------------- $sbrName="lib-br:hsspRdHeader";$fhinLoc="FHIN"."$sbrName";$fhinLoc=~tr/[a-z]/[A-Z]/; # file existing? if (! -e $fileInLoc || ! &is_hssp($fileInLoc) ){ print "*** ERROR $sbrName no HSSP file '$fileInLoc'\n"; return(0);} # ------------------------------ # settings describing format @kwdDefHsspTopLoc= ("PDBID","DATE","SEQBASE","PARAMETER","THRESHOLD", "REFERENCE","HEADER","COMPND","SOURCE","AUTHOR", "SEQLENGTH","NCHAIN","KCHAIN","NALIGN"); @kwdDefHsspHdrLoc= ("NR","ID","STRID","IDE","WSIM","IFIR","ILAS", "JFIR","JLAS","LALI","NGAP","LGAP","LSEQ2","ACCNUM","PROTEIN"); $regexpBegHeader= "^\#\# PROTEINS"; # begin of reading $regexpEndHeader= "^\#\# ALIGNMENTS"; # end of reading $regexpLongId= "^PARAMETER LONG-ID :YES"; # identification of long id $lenStrid= 4; # minimal length to identify PDB identifiers $LisLongId= 0; # long identifier names $ptr{"IDE"}=1;$ptr{"WSIM"}=2;$ptr{"IFIR"}=3;$ptr{"ILAS"}=4;$ptr{"JFIR"}=5;$ptr{"JLAS"}=6; $ptr{"LALI"}=7;$ptr{"NGAP"}=8;$ptr{"LGAP"}=9;$ptr{"LSEQ2"}=10; $ptr{"ACCNUM"}=11; # ------------------------------ # check input arguments $#kwdHsspTopLoc=$#kwdHsspHdrLoc=$Lpdb=$LnoPair=0; foreach $kwd (@kwdInLoc){ $Lok=0; if ($kwd eq "nopair"){ $LnoPair=1; next;} $Lpdb=1 if (! $Lpdb && ($kwd =~/^PDBID/)); foreach $des (@kwdDefHsspTopLoc) { if ($kwd eq $des){ $Lok=1; push(@kwdHsspTopLoc,$kwd); last;}} next if ($Lok || $LnoPair); foreach $des (@kwdDefHsspHdrLoc){ if ($kwd eq $des){ $Lok=1; push(@kwdHsspHdrLoc,$kwd); last;} } print "-*- WARNING $sbrName input kwd=$kwd, makes no sense??\n" if (! $Lok);} # force reading of NALI push(@kwdHsspTopLoc,"PDBID") if (! $Lpdb); # get column numbers to read # ------------------------------ # now start to read $Lok=&open_file("$fhinLoc","$fileInLoc"); if (! $Lok){print "*** ERROR $sbrName HSSP file could not be opened '$fileInLoc'\n"; return(0);} undef %tmp; # save space # ------------------------------ while ( <$fhinLoc> ) { # read top last if ($_ =~ /$regexpBegHeader/); if ($_ =~ /$regexpLongId/) { $LisLongId=1;} else{$_=~s/\n//g;$arg=$_; foreach $des (@kwdHsspTopLoc){ if ($arg =~ /^$des\s+(.+)$/){ if (defined $ok{"$des"}){ # multiple lines! $tmp="$1"."\t"; if (defined $tmp{"$des"}){ $tmp{"$des"}.=$tmp;} else{$tmp{"$des"}=$tmp;}} else {$ok{"$des"}=1;$tmp{"$des"}=$1;} if ($des=~/SEQLENGTH|NCHAIN|KCHAIN|NALIGN/){ $tmp{"$des"}=~s/^(\d+)[^0-9]+.*$/$1/;} # purge blanks last;}}}} # ------------------------------ $ct=0; # read header while ( <$fhinLoc> ) { last if ($LnoPair); # supress reading pair info last if ($_ =~ /$regexpEndHeader/); next if ($_ =~ /^ NR\./); # skip descriptors $_=~s/\n//g; $lenLine=length($_); if ($LisLongId){ $maxMid=115; $maxMid=($lenLine-56) if ($lenLine < 115); $maxEnd=109; $maxEnd=$lenLine if ($lenLine < 109); $beg=substr($_,1,56); $end=0; $end=substr($_,109) if ($lenLine >=109); $mid=substr($_,57,115); } else { $maxMid= 62; $maxMid=($lenLine-28) if ($lenLine < 90); $beg=substr($_,1,28); $end=0; $end=substr($_,90) if ($lenLine >=90); $mid=substr($_,29,90); } $end=~s/^\s*|\s*$//g; # purge leading blanks $mid=~s/^\s*|\s*$//g; # purge leading blanks # SWISS accession: hack because it may be empty! if ($lenLine > 86) { $accnum=substr($_,81,6); $accnum=~s/(\s)\s+/$1/g ; } else { $accnum=0;} # begin: counter and id $beg=~s/.+ \:\s*|\s*$//g; if (! $LisLongId) {$id=$beg;$id=~s/([^\s]+).*$/$1/; $strid=$beg;$strid=~s/$id|\s//g; } else {$id=$beg;$id=~s/(.+_\S+).*/$1/; $strid=substr($_,49,6);$strid=~s/\s//g; } $tmp=$lenStrid-1; if ( (length($strid)<$lenStrid) && ($id=~/^[0-9][A-Z0-9]{$tmp,$tmp}\s*/)){ $strid=substr($id,1,$lenStrid); } ++$ct; $tmp{"ID",$ct}= $id; $tmp{"NR",$ct}= $ct; $tmp{"STRID",$ct}= $strid; # correct for ID = PDBid $tmp{"STRID",$ct}= $id if ($strid=~/^\s*$/ && &is_pdbid($id)); $tmp{"PROTEIN",$ct}=$end; $tmp{"ID1",$ct}=$tmp{"PDBID"}; $tmp{"ACCNUM",$ct}=$accnum; # middle all info $#tmp=0;@tmp=split(/\s+/,$mid); foreach $_ (@tmp) {$_=~s/\s//g;} foreach $des (@kwdHsspHdrLoc){ next if ( ! defined $ptr{"$des"}); next if ( $des =~/^ACCNUM/); $ptr=$ptr{"$des"}; $tmp{"$des",$ct}=$tmp[$ptr]; }}close($fhinLoc); $tmp{"NROWS"}=$ct; # clean up $#kwdInLoc=$#kwdDefHsspHdrLoc=$#kwdHsspTopLoc=$#tmp= $#kwdDefHsspTopLoc=$#kwdHsspHdrLoc=0; undef %ptr; return(1,%tmp); } # end of hsspRdHeader #============================================================================== sub hsspRdSeqSecAccOneLine { local ($inLine) = @_ ; local ($sbrName,$fhinLoc,$seqNo,$pdbNo,$chn,$seq,$sec,$acc,$tmp); $[ =1 ; #------------------------------------------------------------------------------- # hsspRdSeqSecAccOneLine reads begin of one HSSP line #------------------------------------------------------------------------------- $sbrName="hsspRdSeqSecAccOneLine"; $seqNo=substr($inLine,1,6);$seqNo=~s/\s//g; $pdbNo=substr($inLine,7,5);$pdbNo=~s/\s//g; $chn= substr($inLine,13,1); $seq= substr($inLine,15,1); $sec= substr($inLine,18,1); $acc= substr($inLine,36,4);$acc=~s/\s//g; return($seqNo,$pdbNo,$chn,$seq,$sec,$acc) } # end of hsspRdSeqSecAccOneLine #============================================================================== sub isDaf { local ($fileLoc) = @_ ; local ($Lok); #-------------------------------------------------------------------------------- # isDaf checks whether or not file is in DAF format # (i.e. the dirty ali format used for aqua) # in: $file # out: 1 if is DAF; 0 else #-------------------------------------------------------------------------------- open("FHIN_DAF","$fileLoc") || Carp::confess( "failed to open $fileLoc: $!" ); while (){ if ($_=~/^\# DAF/){$Lok=1;} else {$Lok=0;} last;}close(FHIN_DAF); return($Lok); } # end of isDaf #=============================================================================== sub isFasta { local ($fileLoc) = @_ ; local ($Lok); #-------------------------------------------------------------------------------- # isFasta checks whether or not file is in FASTA format # (first line /^>\w/, second (non white) = AA # in: $file # out: 1 if is yes; 0 else #-------------------------------------------------------------------------------- $fhinLoc2="FHIN_FASTA"; open($fhinLoc2,$fileLoc) || Carp::confess( "failed to open $fileLoc: $!" ); $one=(<$fhinLoc2>); $two=(<$fhinLoc2>); $two=~s/\s|\n//g if (defined $two); close($fhinLoc2); return(0) if (! defined $two || ! defined $one); return(1) if ($one =~ /^\s*>\s*\w+/ && $two !~ /[^A-Z.~_!-]/io); return(0); } # end of isFasta #============================================================================== sub isFastaMul { local ($fileLoc) = @_ ; local ($Lok); #-------------------------------------------------------------------------------- # isFastaMul checks whether more than 1 sequence in FASTA found # (first line /^>\w/, second (non white) = AA *2 # in: $file # out: 1 if is yes; 0 else #-------------------------------------------------------------------------------- $fhinLoc2="FHIN_FASTA"; open($fhinLoc2,$fileLoc) || Carp::confess( "failed to open $fileLoc: $!" ) || return(0); $one=(<$fhinLoc2>); $two=(<$fhinLoc2>); $two=~s/\s//g if (defined $two); return (0) if (! defined $two || ! defined $one); return (0) if (($one !~ /^\s*\>\s*\w+/) || ($two =~ /[^A-Z.~_!-]/io)); $Lok=0; while (<$fhinLoc2>) { next if ($_ !~ /^\s*>\s*\w+/); $Lok=1; last;}close($fhinLoc2); return($Lok); } # end of isFastaMul #============================================================================== sub isGcg { local ($fileLoc) = @_ ; $[ =1 ; #-------------------------------------------------------------------------------- # isGcg checks whether or not file is in Gcg format (/# SAF/) # in: $file # out: 1 if is yes; 0 else # EXA: paho_chick from: 1 to: 80 # EXA: PANCREATIC HORMONE PRECURSOR (PANCREATIC POLYPEPTIDE) (PP). # EXA: paho_chick.gcg Length: 80 31-May-98 Check: 8929 .. # EXA: 1 MPPRWASLLL LACSLLLLAV PPGTAGPSQP TYPGDDAPVE DLIRFYNDLQ # EXA: 51 QYLNVVTRHR YGRRSSSRVL CEEPMGAAGC #-------------------------------------------------------------------------------- return(0) if (! defined $fileLoc || ! -e $fileLoc); $fhinLoc="FHIN_GCG"; open($fhinLoc,$fileLoc) || Carp::confess( "failed to open $fileLoc: $!" ) || do { cluck "-*- isGcg failed opening=$fileLoc\n"; return(0); }; $ctLocFlag=$#tmp=0; while(<$fhinLoc>){++$ctLocFlag; push(@tmp,$_); last if ($ctLocFlag==5);} close($fhinLoc); $ctLocFlag=$already_sequence=0; foreach $tmp (@tmp){ last if ($tmp=~/^\#/); # avoid being too friendly to GCG! if ($tmp=~/from\s*:\s*\d+\s*to:\s*\d+/i) { ++$ctLocFlag;} elsif($tmp=~/^\s*\w+\s+Length\s*:\s+\d+\s+\d\d\-/i) { ++$ctLocFlag;} elsif(! $already_sequence && $tmp=~/[\s\t]*\d+\s+[A-Z]+/i) { $already_sequence=1; ++$ctLocFlag;} last if ($ctLocFlag==3);} return(1) if ($ctLocFlag==3); return(0) ; } # end of isGcg #============================================================================== sub isMsf { local ($fileLoc) = @_ ; local ($Lok); #-------------------------------------------------------------------------------- # isMsf checks whether or not file is in MSF format # (i.e. the dirty ali format used for aqua) # in: $file # out: 1 if is yes; 0 else #-------------------------------------------------------------------------------- open("FHIN_MSF","$fileLoc") || Carp::confess( "failed to open $fileLoc: $!" ); $ct=0; while (){ $Lok=0; $Lok=1 if ($_=~/\s*MSF[\s:]+/ || # new PileUp shit $_=~/\s*PileUp|^\s*\!\!AA_MULTIPLE_ALIGNMENT/); last;} close(FHIN_MSF); return($Lok); } # end of isMsf #=============================================================================== sub isPdb { local ($fileLoc) = @_ ; local ($Lok,$fhinLoc,$fileTmp); #-------------------------------------------------------------------------------- # isPdb checks whether or not file is PDB format # in: $file # out: 1 if is yes; 0 else #-------------------------------------------------------------------------------- $fhinLoc="FhIn_PDB";$Lok=0; open($fhinLoc,$fileLoc) || Carp::confess( "failed to open $fileLoc: $!" ) || do { cluck "*** isPdb failed opening file=$fileLoc!\n"; return(0); }; $tmp=""; while(<$fhinLoc>){ $tmp=$_; $tmp=~s/\n//g; last;} close($fhinLoc); #HEADER PANCREATIC HORMONE 16-JAN-81 1PPT 1PPT 3 return(1) if ($tmp=~/^HEADER\s+.*\d\w\w\w\s+\d+\s*$/); return(0); } # end of isPdb #============================================================================== sub isPhdAcc { local ($fileLoc) = @_ ; local ($Lok); #-------------------------------------------------------------------------------- # isPhdAcc checks whether or not file is in PHD.rdb_acc format # in: $file # out: 1 if is yes; 0 else #-------------------------------------------------------------------------------- open("FHIN_RDB_PHDACC",$fileLoc) || Carp::confess( "failed to open $fileLoc: $!" ) || return(0); $ctLoc=0; while (){ $_=~s/^[\#\s]//g; next if (length($_)<5); ++$ctLoc; last if ($ctLoc>3); if ($ctLoc==1 && $_=~/^\s*Perl-RDB/){ $Lok=1;} elsif ($ctLoc==1) { close(FHIN_RDB_PHDACC); return(0);} elsif ($_=~/PHDacc/) { close(FHIN_RDB_PHDACC); return(1);}} close(FHIN_RDB_PHDACC); return(0); } # end of isPhdAcc #=============================================================================== sub isPhdBoth { local ($fileLoc) = @_ ; local ($Lok); #-------------------------------------------------------------------------------- # isPhdBoth checks whether or not file is in PHD.rdb format # acc + sec # in: $file # out: 1 if is yes; 0 else #-------------------------------------------------------------------------------- open("FHIN_RDB_PHDBOTH",$fileLoc) || Carp::confess( "failed to open $fileLoc: $!" ) || return(0); $ctLoc=0; while (){ $_=~s/^[\#\s]//g; next if (length($_)<5); ++$ctLoc; last if ($ctLoc>3); if ($ctLoc==1 && $_=~/^\s*Perl-RDB/) { $Lok=1;} elsif ($ctLoc==1) { close(FHIN_RDB_PHDBOTH); return(0); } elsif ($_=~/PHDsec/ && $_=~/PHDacc/) { close(FHIN_RDB_PHDBOTH); return(1);}} close(FHIN_RDB_PHDBOTH); return(0); } # end of isPhdBoth #============================================================================== sub isPhdHtm { local ($fileLoc) = @_ ; local ($Lok); #-------------------------------------------------------------------------------- # isPhdHtm checks whether or not file is in PHD.rdb_htm format # (i.e. the dirty ali format used for aqua) # in: $file # out: 1 if is yes; 0 else #-------------------------------------------------------------------------------- open("FHIN_RDB_PHDHTM",$fileLoc) || Carp::confess( "failed to open $fileLoc: $!" ) || return(0); $ctLoc=0; while (){ $_=~s/^[\#\s]//g; next if (length($_)<5); ++$ctLoc; last if ($ctLoc>3); if ($ctLoc==1 && $_=~/^\s*Perl-RDB/){ $Lok=1;} elsif ($ctLoc==1) { close(FHIN_RDB_PHDHTM); return(0);} elsif ($_=~/PHDhtm/){ close(FHIN_RDB_PHDHTM); return(1);}} close(FHIN_RDB_PHDHTM); return(0); } # end of isPhdHtm #============================================================================== sub isPhdSec { local ($fileLoc) = @_ ; local ($Lok); #-------------------------------------------------------------------------------- # isPhdSec checks whether or not file is in PHD.rdb_sec format # in: $file # out: 1 if is yes; 0 else #-------------------------------------------------------------------------------- open("FHIN_RDB_PHDSEC",$fileLoc) || Carp::confess( "failed to open $fileLoc: $!" ) || return(0); $ctLoc=0; while (){ $_=~s/^[\#\s]//g; next if (length($_)<5); ++$ctLoc; last if ($ctLoc>3); if ($ctLoc==1 && $_=~/^\s*Perl-RDB/) { $Lok=1;} elsif ($ctLoc==1) { close(FHIN_RDB_PHDSEC); return(0); } elsif ($_=~/PHDsec/) { close(FHIN_RDB_PHDSEC); return(1);}} close(FHIN_RDB_PHDSEC); return(0); } # end of isPhdSec #============================================================================== sub isPir { local ($fileLoc) = @_ ; local ($Lok); #-------------------------------------------------------------------------------- # isPir checks whether or not file is in Pir format # (first line /^>P1\;/, second (non white) = AA # in: $file # out: 1 if is yes; 0 else #-------------------------------------------------------------------------------- open("FHIN_PIR",$fileLoc) || Carp::confess( "failed to open $fileLoc: $!" ) || return(0); $one=();close(FHIN_PIR); return(1) if (defined $one && $one =~ /^\>P1\;/i); return(0); } # end of isPir #============================================================================== sub isPirMul { local ($fileLoc) = @_ ; local ($Lok); #-------------------------------------------------------------------------------- # isPirMul checks whether or not file contains many sequences # in PIR format # more than once: first line /^>P1\;/ # in: $file # out: 1 if is yes; 0 else #-------------------------------------------------------------------------------- open("FHIN_PIR",$fileLoc) || Carp::confess( "failed to open $fileLoc: $!" ) || return(0); $ctLoc=0; while(){ ++$ctLoc if ($_=~/^>P1\;/i); last if ($ctLoc>1);} close(FHIN_PIR); return(1) if ($ctLoc>1); return(0); } # end of isPirMul #============================================================================== sub isRdb { local ($fileInLoc) = @_ ;local ($fh); #-------------------------------------------------------------------------------- # isRdb checks whether or not file is in RDB format # in: file # out: returns 1 if is RDB, 0 else #-------------------------------------------------------------------------------- return (0) if (! -e $fileInLoc); $fh="FHIN_CHECK_RDB"; open("$fh", $fileInLoc) || Carp::confess( "failed to open $fileInLoc: $!" ) || return(0); $tmp=<$fh>; close($fh); return(1) if (defined $tmp && $tmp =~/^\# .*RDB/); return 0; } # end of isRdb #============================================================================== sub isSaf { local ($fileLoc) = @_ ; #-------------------------------------------------------------------------------- # isSaf checks whether or not file is in SAF format (/# SAF/) # in: $file # out: 1 if is yes; 0 else #-------------------------------------------------------------------------------- return(0) if (! defined $fileLoc || ! -e $fileLoc); $fhinLoc="FHIN_SAF"; open("$fhinLoc",$fileLoc) || Carp::confess( "failed to open $fileLoc: $!" ) || return (0); $tmp=<$fhinLoc>; close("$fhinLoc"); return(1) if (defined $tmp && $tmp =~ /^\#.*SAF/); return(0); } # end of isSaf #============================================================================== sub isSwiss { local ($fileLoc) = @_ ; local ($Lok); #-------------------------------------------------------------------------------- # isSwiss checks whether or not file is in SWISS-PROT format (/^ID /) # in: $file # out: 1 if is yes; 0 else #-------------------------------------------------------------------------------- $fhinLoc="FHIN_SWISS"; open("$fhinLoc","$fileLoc") || Carp::confess( "failed to open $fileLoc: $!" ); $Lok=0; while (<$fhinLoc>){ $Lok=1 if ($_=~/^ID /); last;} close($fhinLoc); return($Lok); } # end of isSwiss #============================================================================== sub is_chain { local($tmp) = @_ ; #------------------------------------------------------------------------------- # is_chain checks whether or not a PDB chain # in: character # out: 1,0 #------------------------------------------------------------------------------- return(0) if (! defined $tmp); return(1) if ($tmp=~/[A-Z0-9]/); return(0); } # end of is_chain #============================================================================== sub is_dssp { local ($fileInLoc) = @_ ; local ($fh,$Lis); #-------------------------------------------------------------------------------- # is_dssp checks whether or not file is in DSSP format # in: $file # out: 1 if is dssp; 0 else #-------------------------------------------------------------------------------- return (0) if (! defined $fileInLoc || ! -e $fileInLoc); $fh="FHIN_CHECK_DSSP"; open($fh,$fileInLoc) || Carp::confess( "failed to open $fileInLoc: $!" ) || return(0); $Lis=0; while ( <$fh> ) { $Lis=1 if ($_=~/SECONDARY STRUCTURE DEFINITION BY THE PROGRAM DSSP/i); last; } close($fh); return $Lis; } # end of is_dssp #============================================================================== sub is_fssp { local ($fileInLoc) = @_ ; #-------------------------------------------------------------------------------- # is_fssp checks whether or not file is in FSSP format # in: $file # out: 1 if is fssp; 0 else #-------------------------------------------------------------------------------- return(0) if (! defined $fileInLoc || ! -e $fileInLoc); $fh="FHIN_CHECK_FSSP"; open($fh, $fileInLoc) || Carp::confess( "failed to open $fileInLoc: $!" ) || return(0); $tmp=<$fh> ; close($fh); return(1) if (defined $tmp && $tmp=~/^FSSP/); return(0); } # end of is_fssp #============================================================================== sub is_hssp { local ($fileInLoc) = @_ ;local ($fh,$Lis); #-------------------------------------------------------------------------------- # is_hssp checks whether or not file is in HSSP format # in: $file # out: 1 if is hssp; 0 else #-------------------------------------------------------------------------------- return (0) if (! defined $fileInLoc || ! -e $fileInLoc) ; $fh="FHIN_CHECK_HSSP"; open($fh, $fileInLoc) || Carp::confess( "failed to open $fileInLoc: $!" ) || return(0); $Lis=0; while ( <$fh> ) { $Lis=1 if (/^HSSP/) ; last; } close($fh); return $Lis; } # end of is_hssp #============================================================================== sub is_pdbid { local ($id) = @_ ; #-------------------------------------------------------------------------------- # is_pdbid checks whether or not id is a valid PDBid (number 3 char) # in: $file # out: 1 if is DBid, 0 else #-------------------------------------------------------------------------------- return 1 if ((length($id) <= 6) && ($id=~/^[0-9][0-9a-z]{3,3}[^0-9a-z]?/)); return 0; } # end of is_pdbid #============================================================================== sub is_ppcol { local ($fileInLoc) = @_ ; local ($fh,$Lis); #-------------------------------------------------------------------------------- # is_ppcol checks whether or not file is in RDB format # in: $file # out: 1 if is ppcol, 0 else #-------------------------------------------------------------------------------- return(0) if (! defined $fileInLoc || ! -e $fileInLoc); $fh="FHIN_CHECK_HSSP"; open($fh, $fileInLoc) || Carp::confess( "failed to open $fileInLoc: $!" ); $Lis=0; while ( <$fh> ) { $_=~tr/[A-Z]/[a-z]/; $Lis=1 if ($_=~/^\# pp.*col/); last; } close($fh); return $Lis; } # end of is_ppcol #============================================================================== sub is_rdb_htmref { local ($fileInLoc) = @_ ;local ($fh,$Lisrdb,$Lishtm); #-------------------------------------------------------------------------------- # is_rdb_htmref checks whether or not file is RDB from PHDhtm_ref # in: $file # out: 1 if is .; 0 else #-------------------------------------------------------------------------------- return (0) if (! -e $fileInLoc); $fh="FHIN_CHECK_RDB_PHDHTM_REF";$Lisrdb=$Lishtm=0; open($fh, $fileInLoc) || Carp::confess( "failed to open $fileInLoc: $!" ) || return(0); $ctLoc=$Lishtm=0; while ( <$fh> ) { ++$ctLoc; $Lisrdb=1 if ($_=~/^\# Perl-RDB/); last if (! $Lisrdb); $Lishtm=1 if ($_=~/^\#\s*PHD\s*htm.*ref\:/); last if ($Lishtm); last if ($_ !~/^\#/); last if ($ctLoc > 5); } close($fh); return ($Lishtm); } # end of is_rdb_htmref #============================================================================== sub is_rdb_htmtop { local ($fileInLoc) = @_ ;local ($fh,$Lisrdb,$Lishtm); #-------------------------------------------------------------------------------- # is_rdb_htmtop checks whether or not file is RDB from PHDhtm_top # in: $file # out: 1 if is .; 0 else #-------------------------------------------------------------------------------- return (0) if (! -e $fileInLoc); $fh="FHIN_CHECK_RDB_PHDHTM_TOP";$Lisrdb=$Lishtm=0; open($fh, $fileInLoc) || Carp::confess( "failed to open $fileInLoc: $!" ) || return(0); $ctLoc=$Lishtm=0; while ( <$fh> ) { ++$ctLoc; $Lisrdb=1 if ($_=~/^\# Perl-RDB/); last if (! $Lisrdb); $Lishtm=1 if ($_=~/^\#\s*PHD\s*htm.*top\:/); last if ($Lishtm); last if ($_ !~/^\#/); last if ($ctLoc > 5); } close($fh); return ($Lishtm); } # end of is_rdb_htmtop #============================================================================== sub is_rdb_nnDb { local ($fileInLoc) = @_ ; local ($fh,$Lisrdb,$Lisacc); #-------------------------------------------------------------------------------- # is_rdb_nnDb checks whether or not file is in RDB format for NN.pl # in: $file # out: 1 if is rdb_nn; 0 else #-------------------------------------------------------------------------------- return (0) if (! -e $fileInLoc); $fh="FHIN_CHECK_RDB_RDBNN"; open($fh, $fileInLoc) || Carp::confess( "failed to open $fileInLoc: $!" ) || return(0); $tmp=(<$fh>); close($fh); return(1) if (defined $tmp && $tmp=~/^\# Perl-RDB.*NNdb/i); return (0); } # end of is_rdb_nnDb #============================================================================== sub is_strip { local ($fileInLoc) = @_ ; local ($fh,$Lis); #-------------------------------------------------------------------------------- # is_strip checks whether or not file is in HSSP-strip format # in: $file # out: 1 if is strip; 0 else #-------------------------------------------------------------------------------- return (0) if (! -e $fileInLoc); $fh="FHIN_CHECK_STRIP"; open($fh, $fileInLoc) || Carp::confess( "failed to open $fileInLoc: $!" ) || return(0); $Lis=0; while ( <$fh> ) { $Lis=1 if ($_=~/=== MAXHOM-STRIP ===/); last; } close($fh); return $Lis; } # end of is_strip #============================================================================== sub msfBlowUp { local($fileInLoc,$fileOutLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # msfBlowUp duplicates guide sequence for conversion to HSSP # in: $fileInLoc,$fileOutLoc # out: 1|0, msg, # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $sbrName="lib-br:"."msfBlowUp"; $fhinLoc="FHIN_"."msfBlowUp";$fhoutLoc="FHOUT_"."msfBlowUp"; # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); ($Lok,$msg,%msfIn)=&msfRd($fileInLoc); return(0,"*** ERROR $sbrName: msfRd \n".$msg."\n") if (! $Lok); open("$fhoutLoc",">$fileOutLoc") || Carp::confess( "failed to open $fileOutLoc: $!" ) || return(0,"*** ERROR $sbrName: fileNew=$fileOutLoc, not opened\n"); $name=$msfIn{"id","1"}; $namex=substr($name,1,(length($name)-1))."x"; $namex.="x" if ($name eq $namex); $tmp{"1"}=$name; $tmp{"2"}=$namex; $tmp{SEQS}->{$name}= $msfIn{"seq","1"}; $tmp{SEQS}->{$namex}= $msfIn{"seq","1"}; $tmp{"NROWS"}= 2; $tmp{"FROM"}= $fileInLoc; $tmp{"TO"}= $fileOutLoc; undef %msfIn; # save memory # write msf open ("$fhoutLoc",">$fileOutLoc") || Carp::confess( "failed to open $fileOutLoc: $!" ) || return(0,"*** ERROR $sbrName: failed opening new '$fileOutLoc'\n") ; ($Lok,$msg)= &msfWrt($fhoutLoc,%tmp); close($fhoutLoc); return(0,"*** ERROR $sbrName: failed to write $fileOutLoc, \n".$msg."\n") if (! $Lok || ! -e $fileOutLoc); return(1,"ok $sbrName"); } # end of msfBlowUp #============================================================================== sub msfCheckFormat { local ($fileMsf) = @_; local ($format,$tmp,$kw_msf,$kw_check,$ali_sec,$ali_des_sec,$valid_id_len,$fhLoc, $uniq_id, $same_nb, $same_len, $nb_al, $seq_tmp, $seql, $ali_des_len); $[ =1 ; #-------------------------------------------------------------------------------- # msfCheckFormat basic checking of msf file format # - mandatory keywords and values (MSF: val, Check: val) # - alignment description start after "..", each line with the following structure: # Name: id Len: val Check: val Weight: val (and all ids diferents) # - alignment same number of line for each id (>0) # in: $fileMsf # out: return 1 if format seems OK, 0 else #-------------------------------------------------------------------------------- $sbrNameLoc="msfCheckFormat"; # ---------------------------------------- # initialise the flags # ---------------------------------------- $fhLoc="FHIN_CHECK_MSF_FORMAT"; $kw_msf=$kw_check=$ali_sec=$ali_des_sec=$ali_des_seq=$nb_al=0; $format=1; $valid_id_len=1; # sequence name < 15 characters $uniq_id=1; # id must be unique $same_len=1; # each seq must have the same len $lenok=1; # length in header and of sequence differ # ---------------------------------------- # read the file # ---------------------------------------- open ($fhLoc,$fileMsf) || Carp::confess( "failed to open $fileMsf: $!" ) || return(0,"*** $sbrNameLoc cannot open fileMsf=$fileMsf\n"); while (<$fhLoc>) { $_=~s/\n//g; $tmp=$_;$tmp=~ tr/a-z/A-Z/; # MSF keyword and value $kw_msf=1 if (!$ali_des_seq && ($tmp =~ /MSF:\s*\d*\s/)); next if (!$kw_msf); # CHECK keyword and value $kw_check=1 if (!$ali_des_seq && ($tmp =~ /CHECK:\s*\d*/)); next if (!$kw_check); # begin of the alignment description section # the line with MSF and CHECK must end with ".." if (!$ali_sec && $tmp =~ /MSF:\D*(\d*).*CHECK:.*\.\.\s*$/) { $ali_des_len=$1;$ali_des_sec=1;} # ------------------------------ # the alignment description section if (!$ali_sec && $ali_des_sec) { if ($tmp=~ /^\s*NAME:\s*(\S*).*LEN:.*\d.*CHECK:.*\d.*WEIGHT:.*\d.*/) { $id=$1; $valid_id_len=0 if (length($id) > 14); # is sequence name <= 14 if ($SEQID{$id}) { # is the sequence unique? $uniq_id=0; $ali_sec=1; last; } $lenRd=$tmp;$lenRd=~s/^.*LEN\:\s*(\d+)\s*CHEC.*$/$1/; $SEQID{$id}=1; # store seq ID $SEQL{$id}= 0; # initialise seq len array } } # ------------------------------ # begin of the alignment section $ali_sec=1 if ($ali_des_sec && $tmp =~ /\/\/\s*$/); # ------------------------------ # the alignment section if ($ali_sec) { if ($tmp =~ /^\s*(\S+)\s+(.*)$/) { $id= $1; if ($SEQID{$id}) {++$SEQID{$id}; $seq_tmp= $2;$seq_tmp=~ s/\s|\n//g; $SEQL{$id}+= length($seq_tmp);}}} }close($fhLoc); # ---------------------------------------- # test if all sequences are present the # same number of time with the same length # ---------------------------------------- if ($kw_msf && $kw_check && $ali_des_sec && $uniq_id && $valid_id_len){ foreach $id (keys %SEQID) { $nb_al= $SEQID{$id} if (!$nb_al); if ($SEQID{$id} < 2 || $SEQID{$id} != $nb_al) { $same_len=0; last; } if ($SEQL{$id} != $lenRd){ $lenok=0; last;}}} # TEST ALL THE FLAGS $msg=""; $msg.="*** $sbrNameLoc wrong MSF: no keyword MSF!\n" if (!$kw_msf); $msg.="*** $sbrNameLoc wrong MSF: no keyword Check!\n" if (!$kw_check); $msg.="*** $sbrNameLoc wrong MSF: no ali descr section!\n" if (!$ali_des_sec); $msg.="*** $sbrNameLoc wrong MSF: no ali section!\n" if (!$ali_sec); $msg.="*** $sbrNameLoc wrong MSF: id not unique!\n" if (!$uniq_id); $msg.="*** $sbrNameLoc wrong MSF: seq name too long!\n" if (!$valid_id_len); $msg.="*** $sbrNameLoc wrong MSF: varying length of seq!\n" if (!$same_len); $msg.="*** $sbrNameLoc wrong MSF: length given and real differ!\n" if (!$lenok); return(0,$msg) if (length($msg)>1); return(1,"$sbrNameLoc ok"); } # end msfCheckFormat #=============================================================================== sub msfCompress { local($fileInLoc,$fileOutLoc) = @_ ; local($sbrName,$fhinLoc,$fhoutLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # msfCompress deletes insertions in guide sequence # in: $fileInLoc # out: 1|0,msg, implicit: # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $tmp=$0;$tmp=~s/^.*\/|\.pl//g;$tmp.=":"; $sbrName=$tmp."msfCompress"; $fhinLoc="FHIN_"."msfCompress";$fhoutLoc="FHOUT_"."msfCompress"; # check arguments return(&errSbr("not def fileInLoc!")) if (! defined $fileInLoc); return(&errSbr("not def fileOutLoc!")) if (! defined $fileOutLoc); return(&errSbr("no fileIn=$fileInLoc!")) if (! -e $fileInLoc); # number of characters per line $nperlineLoc=60; # open MSF file open($fhinLoc,$fileInLoc) || Carp::confess( "failed to open $fileInLoc: $!" ) || return(&errSbr("fileInLoc=$fileInLoc, not opened")); $#tmp=0; undef %msfIn; # ------------------------------ while (<$fhinLoc>) { # read file $_=~s/\n//g; push(@tmp,$_); last if ($_ eq "//" ); # skip everything before ali sections } undef %tmp;$ct=0; while (<$fhinLoc>) { # read file $_=~s/\n//g; $_=~s/^\s*|\s*$//g; # purge leading blanks $rd=$_; $tmp=$_; $tmp=~s/^\s*\d+[\s\t\.\,\d]+$//g; next if (length($tmp)<1); # skip lines empty or with numbers, only # -------------------- # from here on: 'id sequence' $id= $rd; $id =~s/^\s*(\S+)\s*.*$/$1/; $seq=$rd; $seq=~s/^\s*(\S+)\s+(\S.*)$/$2/; $seq=~s/\s//g; if (! defined $tmp{$id}){ # new ++$ct;$tmp{$id}=$ct; $msfIn{"id",$ct}= $id; $msfIn{"seq",$ct}=$seq;} else { $ptr=$tmp{$id}; $msfIn{"seq",$ptr}.=$seq; } } close($fhinLoc); $msfIn{"NROWS"}=$ct; # ------------------------------ # now compress insertions in guide # ------------------------------ $ctcleave=$ctres=0; $lenloc=length($msfIn{"seq",1}); # all 0 foreach $itprot (1..$msfIn{"NROWS"}){ $msfIn{"new",$itprot}=""; } # loop over all residues foreach $itres (1..$lenloc){ # is residue if (substr($msfIn{"seq",1},$itres,1)=~/^[A-Za-z]/){ foreach $itprot (1..$msfIn{"NROWS"}){ $msfIn{"new",$itprot}.=substr($msfIn{"seq",$itprot},$itres,1); } ++$ctres; next;} # seems insertion ++$ctcleave; } # check: sum ok? return(0,"*** $sbrName: failed at compressing ncleave=$ctcleave, nresnew=$ctres,". " before=".$lenloc." file=$fileInLoc!") if ($lenloc != ($ctcleave + $ctres)); # replace by cleaved version foreach $itprot (1..$msfIn{"NROWS"}){ $msfIn{"seq",$itprot}=$msfIn{"new",$itprot}; } # ------------------------------ # write new MSF # ------------------------------ open($fhoutLoc,">".$fileOutLoc) || Carp::confess( "failed to open $fileOutLoc: $!" ) || return(&errSbr("fileOutLoc=$fileOutLoc, not created")); # get longest name $maxlen=0; foreach $itprot (1..$msfIn{"NROWS"}){ $maxlen=length($msfIn{"id",$itprot}) if (length($msfIn{"id",$itprot}) > $maxlen); } # header foreach $tmp (@tmp){ $tmp=~s/$lenloc/$ctres/g; # replace old by new length print $fhoutLoc $tmp,"\n"; } # body for($it=1;$it<=$ctres;$it+=$nperlineLoc){ print $fhoutLoc "\n"; printf $fhoutLoc "%-".$maxlen."s %-s\n", " ",$it." " x ($nperlineLoc-length($it)-length($it+$nperlineLoc)) .($it+$nperlineLoc); foreach $itprot (1..$msfIn{"NROWS"}){ printf $fhoutLoc "%-".$maxlen."s %-s\n", $msfIn{"id",$itprot},substr($msfIn{"seq",$itprot},$it,$nperlineLoc),"\n"; } } close($fhoutLoc); return(0,"*** $sbrName: no output file=$fileOutLoc!") if (! -e $fileOutLoc); # clean up undef %msfIn; undef %tmp; # slim-is-in $#tmp=0; return(1,"ok $sbrName"); } # end of msfCompress #============================================================================== sub msfCountNali { local($fileInLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # msfCountNali counts the number of alignments in MSF file # in: file # out: $nali,$msg if error #------------------------------------------------------------------------------- $tmp=$0;$tmp=~s/^.*\/|\.pl//g;$tmp.=":"; $sbrName="$tmp"."msfCountNali";$fhinLoc="FHIN_"."msfCountNali"; # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); open("$fhinLoc","<", $fileInLoc) || do { Carp::confess( "failed to open <$fileInLoc: $!" ); return(0,"*** ERROR $sbrName: fileIn=$fileInLoc, not opened\n"); }; $ct=0; # ------------------------------ while (<$fhinLoc>) { # read MSF chomp; #Name: tsnap Len: 332 Check: 2222 Weight: 1.00 if($_=~ /^\s*NAME:\s*(\S+).*LEN:.*\d+\s*CHECK:\s*\d+\s*WEIGHT:/i){ ++$ct; } last if ($_ eq "//" ); next;} close($fhinLoc); return($ct); } # end of msfCountNali #============================================================================== sub msfRd { local ($fileInLoc) = @_ ; local ($sbrName,$Lok,$msg,$tmp,$fhout,$LfirstLine,$Lhead, $Lguide,$seqGuide,$nameGuide); $[ =1 ; #-------------------------------------------------------------------------------- # msfRd reads MSF files input format # in: $fileInLoc # out: ($Lok,$msg,$msfIn{}) with: # out: $msfIn{"NROWS"} number of alignments # out: $msfIn{"id", $it} name for $it # out: $msfIn{"seq",$it} sequence for $it # err: ok-> 1,ok | error -> 0,message #------------------------------------------------------------------------------- $sbrName="lib-br:msfRd"; $fhinLoc="FHIN_"."msfRd"; # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); open("$fhinLoc","$fileInLoc") || do { Carp::confess( "failed to open $fileInLoc: $!" ); return(0,"*** ERROR $sbrName: fileIn=$fileInLoc, not opened\n"); }; undef %msfIn; # ------------------------------ while (<$fhinLoc>) { # read file chomp; last if ($_ eq "//" ); # skip everything before ali sections } undef %tmp;$ct=0; while (<$fhinLoc>) { # read file $_=~s/\n//g; $_=~s/^\s*|\s*$//g; # purge leading blanks $rd=$_; $tmp=$_; $tmp=~s/^\s*\d+[\s\t\.\,\d]+$//g; next if (length($tmp)<1); # skip lines empty or with numbers, only # -------------------- # from here on: 'id sequence' $id= $rd; $id =~s/^\s*(\S+)\s*.*$/$1/; $seq=$rd; $seq=~s/^\s*(\S+)\s+(\S.*)$/$2/; $seq=~s/\s//g; if (! defined $tmp{$id}){ # new ++$ct;$tmp{$id}=$ct; $msfIn{"id",$ct}= $id; $msfIn{"seq",$ct}=$seq;} else { $ptr=$tmp{$id}; $msfIn{"seq",$ptr}.=$seq; } } close($fhinLoc); $msfIn{"NROWS"}=$ct; return(1,"ok $sbrName",%msfIn); } # end of msfRd #=============================================================================== sub msfShorten { local($fileInLoc,$fileOutLoc) = @_ ; local($sbrName,$fhinLoc,$fhoutLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # msfShorten shortens names to <= 15 characters # in: $fileInLoc # out: 1|0,msg, implicit: # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $tmp=$0;$tmp=~s/^.*\/|\.pl//g;$tmp.=":"; $sbrName=$tmp."msfShorten"; $fhinLoc="FHIN_"."msfShorten";$fhoutLoc="FHOUT_"."msfShorten"; # check arguments return(&errSbr("not def fileInLoc!")) if (! defined $fileInLoc); return(&errSbr("not def fileOutLoc!")) if (! defined $fileOutLoc); return(&errSbr("no fileIn=$fileInLoc!")) if (! -e $fileInLoc); # number of characters per line $nperlineLoc=60; # open MSF file open($fhinLoc,$fileInLoc) || Carp::confess( "failed to open $fileInLoc: $!" ) || return(&errSbr("fileInLoc=$fileInLoc, not opened")); $#tmp=0; undef %msfIn; # ------------------------------ while (<$fhinLoc>) { # read file $_=~s/\n//g; push(@tmp,$_); last if ($_ eq "//" ); # skip everything before ali sections } undef %tmp;$ct=0; while (<$fhinLoc>) { # read file $_=~s/\n//g; $_=~s/^\s*|\s*$//g; # purge leading blanks $rd=$_; $tmp=$_; $tmp=~s/^\s*\d+[\s\t\.\,\d]+$//g; next if (length($tmp)<1); # skip lines empty or with numbers, only # -------------------- # from here on: 'id sequence' $id= $rd; $id =~s/^\s*(\S+)\s*.*$/$1/; $seq=$rd; $seq=~s/^\s*(\S+)\s+(\S.*)$/$2/; $seq=~s/\s//g; if (! defined $tmp{$id}){ # new ++$ct;$tmp{$id}=$ct; $msfIn{"id",$ct}= $id; $msfIn{"seq",$ct}=$seq;} else { $ptr=$tmp{$id}; $msfIn{"seq",$ptr}.=$seq; } } close($fhinLoc); $msfIn{"NROWS"}=$ct; # ------------------------------ # now shorten names # ------------------------------ undef %msfIn2; foreach $it (1..$msfIn{"NROWS"}){ if (length($msfIn{"id",$it})<=15) { $msfIn2{$msfIn{"id",$it}}=1; next;} # too long $id=$msfIn{"id",$it}; $id=~s/^.*\|//g; # purge paths # purge blanks $id=~s/\s//g if (length($id)>15); # purge extensions $id=~s/\.[a-z]//g if (length($id)>15); # cleave $id=substr($id,1,15) if (length($id)>15); # not unique if (defined $msfIn2{$id}){ $id=substr($id,1,12); $ct=1;$idmsfIn=$id.$ct; while(defined $msfIn2{$idmsfIn}){ ++$ct; last if ($ct>999);} $id=$idmsfIn;} return(0,"*** $sbrName: shoot id=$id, orig=",,", failed shortening\n") if (defined $msfIn2{$id} || length($id)>15); $msfIn2{$id}=1; $msfIn{"id",$it}=$id; } undef %msfIn2; # ------------------------------ # change header $#tmp2=$ct=0; foreach $tmp (@tmp){ if ($tmp !~/[Nn]ame\s*:\s*(\S+)/){ push(@tmp2,$tmp);} else { ++$ct; $tmp=~s/([Nn]ame\s*:\s*)\S+/$1$msfIn{"id",$ct}/; push(@tmp2,$tmp);}} @tmp=@tmp2; $#tmp2=0; # ------------------------------ # write new MSF # ------------------------------ $lenloc=length($msfIn{"seq",1}); open($fhoutLoc,">".$fileOutLoc) || Carp::confess( "failed to open $fileOutLoc: $!" ) || return(&errSbr("fileOutLoc=$fileOutLoc, not created")); # get longest name $maxlen=0; foreach $itprot (1..$msfIn{"NROWS"}){ $maxlen=length($msfIn{"id",$itprot}) if (length($msfIn{"id",$itprot}) > $maxlen); } $ctres=length($msfIn{"seq",1}); # header foreach $tmp (@tmp){ $tmp=~s/$lenloc/$ctres/g; # replace old by new length print $fhoutLoc $tmp,"\n"; } # body for($it=1;$it<=$ctres;$it+=$nperlineLoc){ print $fhoutLoc "\n"; printf $fhoutLoc "%-".$maxlen."s %-s\n", " ",$it." " x ($nperlineLoc-length($it)-length($it+$nperlineLoc)) .($it+$nperlineLoc); foreach $itprot (1..$msfIn{"NROWS"}){ printf $fhoutLoc "%-".$maxlen."s %-s\n", $msfIn{"id",$itprot},substr($msfIn{"seq",$itprot},$it,$nperlineLoc),"\n"; } } close($fhoutLoc); return(0,"*** $sbrName: no output file=$fileOutLoc!") if (! -e $fileOutLoc); # clean up undef %msfIn; undef %tmp; # slim-is-in $#tmp=0; return(1,"ok $sbrName"); } # end of msfShorten #============================================================================== sub msfWrt { local($fhoutLoc,%input) = @_ ; local(@nameLoc,@stringLoc,$tmp,$sbrName,$Lok); $[ =1 ; if( $par{debug} ){ cluck("msfWrt ".join(', ', map{"$_ => $input{$_}";}(keys(%input)))); } #-------------------------------------------------------------------------------- # msfWrt writing an MSF formatted file of aligned strings # in: $fileMsf,$input{} # $input{"NROWS"} number of alignments # $input{"FROM"} name of input file # $input{"TO"} name of output file # $input{$it} sequence identifier ($name) # $input{SEQS}->{$name} sequence for $name #-------------------------------------------------------------------------------- $sbrName="msfWrt"; if( $input{"NROWS"} && !$input{SEQS} ){ confess("no SEQS in %input - update calling code"); } # ------------------------------ $#nameLoc=$#tmp=0; # process input foreach $it (1..$input{"NROWS"}){ $name=$input{$it}; push(@nameLoc,$name); # store the names push(@stringLoc,$input{SEQS}->{$name}); } # store sequences $FROM=$input{"FROM"} if (defined $input{"FROM"}); $TO= $input{"TO"} if (defined $input{"TO"}); # ------------------------------ # write into file print $fhoutLoc "MSF of: ",$FROM," from: 1 to: ",length($stringLoc[1])," \n", $TO," MSF: ",length($stringLoc[1]), " Type: P Jul-11-1961 14:00 Check: 1933 ..\n \n \n"; foreach $it (1..$#stringLoc){ printf $fhoutLoc "Name: %-20s Len: %-5d Check: 2222 Weight: 1.00\n", $nameLoc[$it],length($stringLoc[$it]); } print $fhoutLoc " \n","\/\/\n"," \n"; for($it=1;$it<=length($stringLoc[1]);$it+=50){ foreach $it2 (1..$#stringLoc){ printf $fhoutLoc "%-20s",$nameLoc[$it2]; foreach $it3 (1..5){ last if (length($stringLoc[$it2])<($it+($it3-1)*10)); printf $fhoutLoc " %-10s",substr($stringLoc[$it2],($it+($it3-1)*10),10);} print $fhoutLoc "\n";} print $fhoutLoc "\n"; } print $fhoutLoc "\n"; close($fhoutLoc); $#nameLoc=$#stringLoc=0; # save space return(1); } # end of msfWrt #============================================================================== sub open_file { local ($file_handle,$file_name,$log_file) = @_ ; local ($temp_name) ; #------------------------------------------------------------------------------- # open_file opens file, writes warning asf #------------------------------------------------------------------------------- $temp_name = $file_name ; $temp_name =~ s/^>>|^>//g ; if ( ($file_name =~ /^>>/ ) && ( ! -e $temp_name ) ) { print "*** INFO (open_file): append file=$temp_name, does not exist-> create it\n" ; open ($file_handle, ">$temp_name") || Carp::confess( "failed to open $temp_name: $!" ) || ( do { cluck "***\t Cannot create new file: $temp_name\n" ; if ( $log_file ) { print $log_file "***\t Cannot create new file: $temp_name\n" ;} return (0); } ); close ("$file_handle") ;} open ($file_handle, "$file_name") || Carp::confess( "failed to open $file_name: $!" ) || ( do { cluck "*** ERROR lib-br:open_file: Cannot open file '$file_name'\n" ; if ( $log_file ) { print $log_file "*** lib-br:open_file: Cannot create new file '$file_name'\n" ;} return(0); } ); return(1); } # end of open_file #=============================================================================== sub pdbExtrSequence { local($fileInLoc,$chainInLoc,$LskipNucleic) = @_ ; local($sbrName,$fhinLoc,$fhoutLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # pdbExtrSequence reads the sequence in a PDB file # in: $fileInLoc= PDB file # in: $chainInLoc= chains to read ('A,B,C' for many) # ='*' to read all # in: $LskipNucleic= skip if nucleic acids # out: 1|0,msg,%pdb as implicit reference with: # out: $pdb{"chains"}="A,B" -> all chains found ('none' for not specified) # $pdb{$chain}= sequence for chain $chain # (='none' for not specified chain) # NOTE: 'X' used for hetero-atoms, or for symbol 'U' # $pdb{"header"} # $pdb{"compnd"} # $pdb{"source"} # $pdb{"percentage_strange"}= # percentage (0-100) of 'strange' acids ('!X') # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $tmp=$0;$tmp=~s/^.*\/|\.pl//g;$tmp.=":"; $sbrName=$tmp."pdbExtrSequence"; $fhinLoc="FHIN_"."pdbExtrSequence";$fhoutLoc="FHOUT_"."pdbExtrSequence"; # check arguments return(&errSbr("not def fileInLoc!")) if (! defined $fileInLoc); return(&errSbr("not def chainInLoc!")) if (! defined $chainInLoc); return(&errSbr("not def LskipNucleic!")) if (! defined $LskipNucleic); $chainInLoc="*" if (length($chainInLoc) < 1 || $chainInLoc =~/\s/); return(&errSbr("no fileIn=$fileInLoc!")) if (! -e $fileInLoc); # open file open($fhinLoc,$fileInLoc) || Carp::confess( "failed to open $fileInLoc: $!" ) || return(&errSbr("fileInLoc=$fileInLoc, not opened")); undef %pdb; # security $#chainLoc=0; $ctLine=0; # count lines in file (for error) $ctStrange=0; # count amino acids (non ACGT) $ctRes=0; $Lflag=0; # set to 1 as soon as sequence found # ------------------------------ while (<$fhinLoc>) { # read file # ------------------------------ ++$ctLine; # skip anything before sequence if ($_!~/^SEQRES/) { #HEADER HYDROLASE (SERINE PROTEINASE) 24-APR-89 1P06 1P06 3 if ($_=~/^HEADER\s+(.*)\d\d\-[A-Z][A-Z][A-Z]\-\d\d\s*\d\w\w\w\s+/){ $pdb{"header"}=$1; $pdb{"header"}=~s/^\s*|\s*$//g; $pdb{"header"}=~s/^\s\s+|\s//g; next; } #COMPND ALPHA-LYTIC PROTEASE (E.C.3.4.21.12) COMPLEX WITH 1P06 4 #COMPND 2 METHOXYSUCCINYL-*ALA-*ALA-*PRO-*PHENYLALANINE BORONIC ACID 1P06 5 if ($_=~/^COMPND\s+(.*)\s+\d\w\w\w\s+\d+\s*$/) { $pdb{"compnd"}="" if (! defined $pdb{"compnd"}); $pdb{"compnd"}.=$1; $pdb{"compnd"}=~s/^\s*|\s*$//g; $pdb{"compnd"}=~s/\s\s+/ /g; # purge many blanks next; } #SOURCE (LYSOBACTER $ENZYMOGENES 495) 1P06 6 if ($_=~/^SOURCE\s+(.*)\s+\d\w\w\w\s+\d+\s*$/) { $pdb{"source"}=$1; $pdb{"source"}=~s/[\(\)\$]//g; $pdb{"source"}=~s/^\s*|\s*$//g; $pdb{"source"}=~s/\s\s+/ /g; # purge many blanks next; } last if ($Lflag); # end after read next; } # delete stuff at ends #....,....1....,....2....,....3....,....4....,....5....,....6....,....7....,....8 #SEQRES 1 A 198 ALA ASN ILE VAL GLY GLY ILE GLU TYR SER ILE ASN ASN 1P06 74 $Lflag=1; # sequence found $_=~s/\n//g; $line=substr($_,11); $line=substr($line,1,60); $chainRd=$line; $chainRd=~s/^\s*(\D*)\d+.*$/$1/g; $chainRd=~s/\s//g; $chainRd="*" if (! defined $chainRd || length($chainRd)<1); # skip if wrong chain next if ($chainInLoc ne "*" && $chainRd ne $chainInLoc); # rename chain for non-specified $chainRd="none" if ($chainRd eq "*"); # get sequence part $seqRd3= $line; $seqRd3=~s/^\D*\d+(\D+).*$/$1/g; $seqRd3=~s/^\s*|\s*$//g; # purge trailing spaces # strange next if (! defined $seqRd3 || length($seqRd3)<3); # split into array of 3-letter residues @tmp=split(/\s+/,$seqRd3); # ------------------------------ # end if is nucleic that was NOT # wanted! return(2,"nucleic","") if ($LskipNucleic && $tmp[1]=~/^[ACGT]$/); # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $seqRd1=""; # 3 letter to 1 letter foreach $tmp (@tmp) { ($Lok,$msg,$oneletter)=&amino_acid_convert_3_to_1($tmp); # HETERO atom? if (! $Lok && $oneletter eq "unk") { print "-*- WARN $fileInLoc ($ctLine) residue =$tmp\n"; $oneletter="X";} elsif (! $Lok || $oneletter !~/^[A-Z]$/) { $msgErr="*** $sbrName ($fileInLoc): line=$ctLine, problem with conversion to 1 letter:\n"; return(0,$msgErr.$msg); } $seqRd1.=$oneletter; } # first if (! defined $pdb{$chainRd}) { push(@chainLoc,$chainRd); $pdb{$chainRd}=""; } # append to current chain $pdb{$chainRd}.=$seqRd1; # count non ACGT @tmp=split(//,$seqRd1); $ctRes+=$#tmp; # count residues foreach $tmp (@tmp) { next if ($tmp!~/^[A-Z]$/); # exclude strange stuff ++$ctStrange;} } close($fhinLoc); $pdb{"chains"}=join(',',@chainLoc); $pdb{"percentage_strange"}=0; $pdb{"percentage_strange"}=100*int($ctStrange/$ctRes) if ($ctStrange && $ctRes); return(1,"ok $sbrName",\%pdb); } # end of pdbExtrSequence #============================================================================== sub pirRdMul { local($fileInLoc,$extr) = @_ ; local($sbrName,$fhinLoc,$msg,$Lok,$seq,$id); $[ =1 ; #------------------------------------------------------------------------------- # pirRdMul reads the sequence from a PIR file # in: file,$extr with: # $extr = '1,5,6', i.e. list of numbers to read # out: 1|0,$id,$seq (note: many ids/seq separated by '\n' # err: ok=(1,'ok'), err=(0,'msg') #------------------------------------------------------------------------------- $sbrName="lib-br:pirRdMul";$fhinLoc="FHIN_"."$sbrName"; open("$fhinLoc","$fileInLoc") || Carp::confess( "failed to open $fileInLoc: $!" ) || return(0,"*** ERROR $sbrName: fileIn=$fileInLoc not opened\n"); $extr=~s/\s//g if (defined $extr); $extr=0 if (! defined $extr || $extr =~ /[^0-9\,]/); if ($extr){@tmp=split(/,/,$extr); undef %tmp; foreach $tmp(@tmp){ $tmp{$tmp}=1;}} $ct=$ctRd=$ctProt=0; # ------------------------------ while (<$fhinLoc>) { # read the file $_=~s/\n//g; if ($_ =~ /^\s*>/){ # (1) = id (>P1;) $Lread=0; ++$ctProt; $id=$_;$id=~s/^\s*>\s*P1?\s*\;\s*//g;$id=~s/(\S+)[\s\n]*.*$/$1/g;$id=~s/^\s*|\s*$//g; $id.="_"; $id.=<$fhinLoc>; # (2) still id in second line $id=~s/[\s\t]+/ /g; $id=~s/_\s*$/g/; $id=~s/^[\s\t]*|[\s\t]*$//g; if (! $extr || ($extr && defined $tmp{$ctProt} && $tmp{$ctProt})){ ++$ctRd;$Lread=1; $tmp{"$ctRd","id"}=$id; $tmp{"$ctRd","seq"}="";}} elsif($Lread){ # (3+) sequence $_=~s/[\s\*]//g; $tmp{"$ctRd","seq"}.="$_";}}close($fhinLoc); # ------------------------------ $seq=$id=""; # join to long strings if ($ctRd > 1) { foreach $it(1..$ctRd){ $id.= $tmp{$it,"id"}."\n"; $tmp{$it,"seq"}=~s/\s//g;$tmp{$it,"seq"}=~s/\*$//g; $seq.=$tmp{$it,"seq"}."\n";} } else { $it=1; $id= $tmp{$it,"id"}; $tmp{$it,"seq"}=~s/\s//g;$tmp{$it,"seq"}=~s/\*$//g; $seq=$tmp{$it,"seq"}; } $#tmp=0;undef %tmp; # save memory return(0,"*** ERROR $sbrName: file=$fileInLoc, nali=$ct, wanted: (rd=$rd)\n"," ") if (length($seq)<1); return(1,$id,$seq); } # end of pirRdMul #============================================================================== sub pirWrtMul { local($fileOutLoc,%tmp) = @_ ; local($sbrName,$fhoutLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # pirWrtMul writes a list of sequences in PIR format # in: $fileOut,$tmp{} with: # in: $tmp{"NROWS"} number of sequences # in: $tmp{"id",$ct} id for sequence $ct # in: $tmp{"seq",$ct} seq for sequence $ct # out: file # err: err -> 0,message # err: ok -> 1,ok # err: warn -> 2,not enough written #------------------------------------------------------------------------------- $sbrName="lib-br:pirWrtMul";$fhoutLoc="FHOUT_"."$sbrName"; return(0,"*** ERROR $sbrName: no tmp{NROWS} defined\n") if (! defined $tmp{"NROWS"}); open("$fhoutLoc",">$fileOutLoc") || Carp::confess( "failed to open $fileOutLoc: $!" ) || return(0,"*** ERROR $sbrName: '$fileOutLoc' not opened for write\n"); $ctOk=0; foreach $itpair (1..$tmp{"NROWS"}){ next if (! defined $tmp{"id",$itpair} || ! defined $tmp{"seq",$itpair}); ++$ctOk; # some massage $tmp{"id",$itpair}=~s/[\s\t\n]+/ /g; $tmp{"seq",$itpair}=~s/[\s\t\n]+//g; # write print $fhoutLoc ">P1\; ",$tmp{"id",$itpair},"\n"; print $fhoutLoc $tmp{"id",$itpair},"\n"; $tmp{"seq",$itpair}.="*"; $lenHere=length($tmp{"seq",$itpair}); for($it=1; $it<=$lenHere; $it+=50){ $tmpWrt= ""; foreach $it2 (0..4){ $itHere=($it + 10*$it2); last if ( $itHere >= $lenHere); $nchunk=10; $nchunk=1+($lenHere-$itHere) if ( (10 + $itHere) > $lenHere); $tmpWrt.= sprintf(" %-10s",substr($tmp{"seq",$itpair},$itHere,$nchunk)); } print $fhoutLoc $tmpWrt,"\n"; } } close($fhoutLoc); return(0,"*** ERROR $sbrName: no sequence written\n") if (! $ctOk); return(2,"-*- WARN $sbrName: wrote fewere sequences than expected\n") if ($ctOk!=$tmp{"NROWS"}); return(1,"ok $sbrName"); } # end of pirWrtMul #=============================================================================== sub pirWrtOne { local($fileOutLoc,$idLoc,$seqLoc) = @_ ; local($sbrName,$fhoutLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # pirWrtOne writes one sequence in PIR format # in: $fileOut,$id,$seq, # out: file # err: err -> 0,message # err: ok -> 1,ok #------------------------------------------------------------------------------- $sbrName="lib-br:pirWrtOne";$fhoutLoc="FHOUT_"."$sbrName"; return(0,"*** ERROR $sbrName: no seq defined\n") if (! defined $seqLoc); open("$fhoutLoc",">$fileOutLoc") || Carp::confess( "failed to open $fileOutLoc: $!" ) || return(0,"*** ERROR $sbrName: '$fileOutLoc' not opened for write\n"); # some massage $idLoc=~s/[\s\t\n]+/ /g; $seqLoc=~s/[\s\t\n]+//g; # write print $fhoutLoc ">P1\; ",$idLoc,"\n"; print $fhoutLoc $idLoc,"\n"; $seqLoc.="*"; # add star $lenHere=length($seqLoc); for($it=1; $it<=$lenHere; $it+=50){ $tmpWrt= ""; foreach $it2 (0..4){ $itHere=($it + 10*$it2); last if ( $itHere >= $lenHere); $nchunk=10; $nchunk=1+($lenHere-$itHere) if ( (10 + $itHere) > $lenHere); $tmpWrt.= sprintf(" %-10s",substr($seqLoc,$itHere,$nchunk)); } print $fhoutLoc $tmpWrt,"\n"; } close($fhoutLoc); return(0,"*** ERROR $sbrName: no sequence written\n") if (! -e $fileOutLoc); return(1,"ok $sbrName"); } # end of pirWrtOne #=============================================================================== sub rdRdbAssociative { local ($fileInLoc,@des_in) = @_ ; local ($sbr_name,$fhinLoc,$Lhead,$Lbody,$Lfound,$it,$itrd,@tmp,$tmp,$des_in,$rd, @des_head,@des_headin,@des_bodyin,@des_body,%ptr_rd2des,$nrow_rd,%rdrdb, $Lscreen); $[ =1 ; #-------------------------------------------------------------------------------- # rdRdbAssociative reads content of an RDB file into associative array # in: Names used for columns in perl file, e.g., # "header,NALIGN,body,POS,NPROT" as arguments passed # would result in: # reading anything in file header using the keyword 'NALIGN' # reading the columns named POS and NPROT # out: rdrdb{"NALIGN"},rdrdb{"POS","ct"},rdrdb{"NPROT","ct"}, # where ct counts the rows read, # rdrdb{"NROWS"} returns the numbers of rows read #-------------------------------------------------------------------------------- # avoid warning $READHEADER=""; $Lscreen=1; # set some defaults $fhinLoc="FHIN_RDB";$sbr_name="rdRdbAssociative"; # get input $Lhead=$Lbody=$#des_headin=$#des_bodyin=0; foreach $des_in (@des_in){ if ($des_in=~/^not_screen/) {$Lscreen=0;} elsif((!$Lhead) && ($des_in=~/head/)){$Lhead=1;$Lhead_all=1;} elsif((!$Lbody) && ($des_in=~/body/)){$Lbody=1;$Lhead=0; } elsif($Lhead) {push(@des_headin,$des_in);} elsif($Lbody) {$des_in=~s/\n|\s//g;; push(@des_bodyin,$des_in);} else { print "*** WARNING $sbr_name: input '$des_in' not recognised.\n";} } if ($Lscreen) { print "--- $sbr_name: header \t "; foreach $it (@des_headin){print"$it,";}print"\n"; print "--- $sbr_name: body \t "; foreach $it (@des_bodyin){print"$it,";}print"\n"; } # -------------------------------------------------- # read RDB file # -------------------------------------------------- open("$fhinLoc","$fileInLoc") || Carp::confess( "failed to open $fileInLoc: $!" ); # out: $READHEADER :whole header, one string # @READCOL : all columns # @READNAME :names of columns &rdRdbAssociativeNum($fhinLoc,0); close($fhinLoc); # ------------------------------ $#des_head=0; # process header @tmp=split(/\#\s?/,$READHEADER); if ($#des_headin>=1){ foreach $des_in (@des_headin) { $Lfound=0; foreach $rd (@tmp){ if ($rd =~ /^(PARA\s*:?\s*)?$des_in\s*[ :,\;=]/){ $tmp=$rd;$tmp=~s/\n|\s$//g;$tmp=~s/^.*$des_in//g;$tmp=~s/^\s*//g; $tmp=~s/^[\s:\t]*//g; if (defined $rdrdb{"$des_in"}){ $rdrdb{"$des_in"}.="\t".$tmp;} else { $rdrdb{"$des_in"}=$tmp;} push(@des_head,$des_in);$Lfound=1;} } print "--- $sbr_name: \t expected to find in header key word:\n", "--- \t '$des_in', but not in file '$fileInLoc'\n" if (!$Lfound && $Lscreen); }} elsif ($Lhead_all) { # whole header into $rdrdb{"header"} $rdrdb{"header"}=""; foreach $rd (@tmp) { $rd=~s/^\s?|\n//g; $rdrdb{"header"}.="# ".$rd."\n"; }} # ------------------------------ $#des_body=0; # get column numbers to be read foreach $des_in (@des_bodyin) { $Lfound=0; for($it=1; $it<=$#READNAME; ++$it) { $rd=$READNAME[$it];$rd=~s/\s//g; if ($rd eq $des_in) { $ptr_rd2des{"$des_in"}=$it;push(@des_body,$des_in);$Lfound=1; last;} } if((!$Lfound) && $Lscreen){ print"--- $sbr_name: \t expected to find column name:\n"; print"--- \t '$des_in', but not in file '$fileInLoc'\n";}} # ------------------------------ # get format foreach $des_in(@des_bodyin) { $it=$ptr_rd2des{"$des_in"}; if ( defined $it && defined $READFORMAT[$it] ) { $rdrdb{"$des_in","format"}=$READFORMAT[$it];} else { $rdrdb{"$des_in","format"}="8";}} $nrow_rd=0; foreach $des_in(@des_body) { $itrd=$ptr_rd2des{"$des_in"}; @tmp=split(/\t/,$READCOL[$itrd]); if ($nrow_rd==0) {$nrow_rd=$#tmp;} elsif($nrow_rd!=$#tmp){print "*** WARNING $sbr_name: different number of rows\n"; print "*** in RDB file '$fileInLoc' for rows with ". "key=$des_in, column=$itrd, prev=$nrow_rd, now=$#tmp,\n";} for ($it=1; $it<=$#tmp; ++$it){ $rdrdb{"$des_in",$it}=$tmp[$it]; $rdrdb{"$des_in",$it}=~s/\s//g;} } $rdrdb{"NROWS"}=$rdrdb{"NROWS"}=$nrow_rd; # ------------------------------ # safe memory $READHEADER=""; $#READCOL=$#READNAME=$#READFORMAT=0; $#des_headin=$#des_body=$#tmp=$#des_head=0; undef %ptr_rd2des; $#des_in=0; # slim_is_in ! return (%rdrdb); } # end of rdRdbAssociative #=============================================================================== sub rdRdbAssociativeNum { local ($fhLoc2,@readnum) = @_ ; local ($ctLoc, @tmpar, $it, $ipos, $tmp); $[ =1 ; #---------------------------------------------------------------------- # rdRdbAssociativeNum reads from a file of Michael RDB format: # in: $fhLoc,@readnum,$readheader,@readcol,@readname,@readformat # $fhLoc: file handle for reading # @readnum: vector containing the number of columns to be read, if empty, # then all columns will be read! # $READHEADER: returns the complete header as one string # @READCOL: returns all columns to be read (tab separated) # @READNAME: returns the names of the columns # @READFORMAT: returns the format of each column #---------------------------------------------------------------------- $READHEADER=""; $#READCOL=$#READNAME=$#READFORMAT=0; for ($it=1; $it<=$#readnum; ++$it) { $READCOL[$it]=""; } $ctLoc= 0; $tmpct=0; while ( <$fhLoc2> ) { # ------------------------------ ++$tmpct; # header if ( /^\#/ ) { $READHEADER.= "$_"; next; } $rd=$_;$rd=~s/^\s+|\s+$//g; next if (length($rd)<2); ++$ctLoc; # count non-comment # ------------------------------ # names if ($ctLoc==1){ $rd=$_;$rd=~s/^\t+|\t$//g;@tmpar=split(/\t/,$rd); # process wild card if ($#readnum==0 || $readnum[1]==0 || $readnum[1] !~ /[0-9]/ || ! defined $readnum[1] ) { foreach $it (1..$#tmpar){ $readnum[$it]=$it; $READCOL[$it]=""; }} foreach $it (1..$#readnum){ $tmp_name=$tmpar[$readnum[$it]];$tmp_name=~s/\s|\n//g; $READNAME[$it]="$tmp_name"; } next; } # ------------------------------ # skip format? if ($ctLoc==2 && $rd!~/\d+[SNF]\t|\t\d+[SNF]/){ ++$ctLoc; } if ($ctLoc==2) { # read format $rd=$_;$rd=~s/^\t+|\t$//g;@tmpar=split(/\t/,$rd); foreach $it (1..$#readnum){ $ipos=$readnum[$it];$tmp=$tmpar[$ipos]; $tmp=~s/\s//g; $READFORMAT[$it]=$tmp; } next; } # ------------------------------ # data $rd=$_;$rd=~s/^\t+|\t$//g;@tmpar=split(/\t/,$rd); foreach $it (1..$#readnum){ next if (! defined $tmpar[$readnum[$it]]); $READCOL[$it].=$tmpar[$readnum[$it]] . "\t"; } } # ------------------------------ # massage FORMAT/COL/NAME foreach $it (1..$#READCOL){ $READFORMAT[$it]=~ s/^\s+//g if (defined $READFORMAT[$it]); $READFORMAT[$it]=~ s/\t$|\n//g if (defined $READFORMAT[$it]); $READNAME[$it]=~ s/^\s+//g if ($#READNAME>0); $READNAME[$it]=~s/\t|\n//g; $READNAME[$it]=~s/\n//g if ($#READNAME>0); $READCOL[$it] =~ s/\t$|\n//g; # correction: last not return! } } # end of rdRdbAssociativeNum #=============================================================================== sub safCompress { local($fileInLoc,$fileOutLoc) = @_ ; local($sbrName,$fhinLoc,$fhoutLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # safCompress deletes insertions in guide sequence # in: $fileInLoc # out: 1|0,msg, implicit: # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $tmp=$0;$tmp=~s/^.*\/|\.pl//g;$tmp.=":"; $sbrName=$tmp."safCompress"; $fhinLoc="FHIN_"."safCompress";$fhoutLoc="FHOUT_"."safCompress"; # check arguments return(&errSbr("not def fileInLoc!")) if (! defined $fileInLoc); return(&errSbr("not def fileOutLoc!")) if (! defined $fileOutLoc); return(&errSbr("no fileIn=$fileInLoc!")) if (! -e $fileInLoc); # number of characters per line $nperlineLoc=60; ($Lok,$msg,%safIn)= &safRd($fileInLoc); return(&errSbrMsg("safRd failed on fileInLoc=$fileInLoc!", $msg)) if (! $Lok); # ------------------------------ # now compress insertions in guide # ------------------------------ $ctcleave=$ctres=0; $lenloc=length($safIn{"seq",1}); # all 0 foreach $itprot (1..$safIn{"NROWS"}){ $safIn{"new",$itprot}=""; } # loop over all residues foreach $itres (1..$lenloc){ # is residue if (substr($safIn{"seq",1},$itres,1)=~/^[A-Za-z]/){ foreach $itprot (1..$safIn{"NROWS"}){ $safIn{"new",$itprot}.=substr($safIn{"seq",$itprot},$itres,1); } ++$ctres; next;} # seems insertion ++$ctcleave; } # check: sum ok? return(0,"*** $sbrName: failed at compressing ncleave=$ctcleave, nresnew=$ctres,". " before=".$lenloc." file=$fileInLoc!") if ($lenloc != ($ctcleave + $ctres)); # replace by cleaved version foreach $itprot (1..$safIn{"NROWS"}){ $safIn{"seq",$itprot}=$safIn{"new",$itprot}; } # ------------------------------ # write new SAF # ------------------------------ open($fhoutLoc,">".$fileOutLoc) || Carp::confess( "failed to open $fileOutLoc: $!" ) || return(&errSbr("fileOutLoc=$fileOutLoc, not created")); # get longest name $maxlen=0; foreach $itprot (1..$safIn{"NROWS"}){ $maxlen=length($safIn{$itprot}) if (length($safIn{$itprot}) > $maxlen); } # body for($it=1;$it<=$ctres;$it+=$nperlineLoc){ print $fhoutLoc "\n"; printf $fhoutLoc "%-".$maxlen."s %-s\n", " ",$it." " x ($nperlineLoc-length($it)-length($it+$nperlineLoc)) .($it+$nperlineLoc); foreach $itprot (1..$safIn{"NROWS"}){ printf $fhoutLoc "%-".$maxlen."s %-s\n", $safIn{"id",$itprot},substr($safIn{"seq",$itprot},$it,$nperlineLoc),"\n"; } } close($fhoutLoc); return(0,"*** $sbrName: no output file=$fileOutLoc!") if (! -e $fileOutLoc); # clean up undef %safIn; undef %tmp; # slim-is-in $#tmp=0; return(1,"ok $sbrName"); } # end of safCompress #============================================================================== sub safRd { local($fileInLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # safRd reads SAF format # in: $fileOutLoc, # out: ($Lok,$msg,$tmp{}) with: # out: $tmp{"NROWS"} number of alignments # out: $tmp{"id", $it} name for $it # out: $tmp{"seq",$it} sequence for $it # err: ok-> 1,ok | error -> 0,message #------------------------------------------------------------------------------- $sbrName="lib-br:"."safRd";$fhinLoc="FHIN_"."safRd"; # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); $LverbLoc=0; open("$fhinLoc","$fileInLoc") || Carp::confess( "failed to open $fileInLoc: $!" ) || return(0,"*** ERROR $sbrName: fileIn=$fileInLoc, not opened\n"); $ctBlocks=$ctRd=$#nameLoc=0; undef %nameInBlock; undef %tmp2; undef %tmp; # -------------------------------------------------- # read file while (<$fhinLoc>) { # -------------------------------------------------- $_=~s/\n//g; next if ($_=~/^#/o); # ignore comments last if ($_=~/^\s*[\-\_]+\s*$/); # stop when address $line=$_; # ignore lines with numbers, blanks, points only $tmp=$_; $tmp=~s/[^A-Z]//gi; next if (length($tmp)<1); $line=~s/^\s*|\s*$//g; # purge leading blanks # ------------------------------ # names $nameRd=$line; $nameRd=~s/^(\S+)\s+.*$/$1/o; # new name? if (! defined $tmp2{"ptr",$nameRd}){ # maximal length: 14 characters (because of MSF2Hssp) if (length($nameRd)<=14){ $nameTake=$nameRd;} else { $tmp=$nameRd; #$tmp=~s/^.*\|//; # purge database $tmp=~s/^[^|]*\|//o; # purge database # make sure not too long if(length($tmp)>14){ $tmp = substr($tmp,$[,14); } # make sure not too short while (length($tmp)<2){ # nonsense name $tmp .= substr( $nameRd, $[+length($tmp), 1 ); } # security check $Lok=0; $Lok=1 if (length($tmp)>=2 && length($tmp)<=14); if(! $Lok){ confess("could NOT find name '$tmp' for name=$nameRd"); } $nameTake=$tmp;} # make sure that it name unique if (! defined $tmp2{$nameTake}){ $tmp2{$nameTake}=1;} else { $nameNew=$nameTmp=substr($nameTake,1,12); $it=0; while (defined $tmp2{$nameTmp} && $it<99){ ++$it; $nameTmp=$nameNew.$it; } if (defined $tmp2{$nameTmp}){ $nameNew=$nameTmp=substr($nameRd,1,10); $it=0; while (defined $tmp2{$nameTmp} && $it<9999){ ++$it; $nameTmp=$nameNew.$it; } } else { $tmp2{$nameTmp}=1; } $nameTake=$nameTmp; $tmp2{$nameTake}=1;} # store a pointer $tmp2{"ptr",$nameRd}=$nameTake; } else { # old name: translate $nameTake=$tmp2{"ptr",$nameRd}; } # ------------------------------ # sequences $seq=$line;$seq=~s/^\s*//;$seq=~s/^[^\s\t]+//;$seq=~s/\s//g; # next if ($seq =~/^ACDEFGHIKLMNPQRSTVWXYZ/i); # check this!! print "--- $sbrName: nameRd=$nameRd, nameTake=$nameTake, seq=$seq,\n" if ($LverbLoc); # ------------------------------ # guide sequence: determine length # NOTE: no 'left-outs' allowed here # ------------------------------ $nameFirst=$nameTake if ($#nameLoc==0); # detect first name if ($nameTake eq "$nameFirst"){ ++$ctBlocks; # count blocks undef %nameInBlock; if ($ctBlocks == 1){ $lenFirstBeforeThis=0;} else { $lenFirstBeforeThis=length($tmp{"seq","1"});} if ($ctBlocks>1) { # manage proteins that did not appear $lenLoc=length($tmp{"seq","1"}); foreach $itTmp (1..$#nameLoc){ $tmp{"seq",$itTmp}.="." x ($lenLoc-length($tmp{"seq",$itTmp}));} }} # ------------------------------ # ignore 2nd occurence of same name next if (defined $nameInBlock{$nameTake}); # avoid identical names # ------------------------------ # new name if (! defined ($tmp{$nameTake})){ push(@nameLoc,$nameTake); ++$ctRd; $tmp{$nameTake}=$ctRd; $tmp{"id","$ctRd"}=$nameTake; print "--- $sbrName: new name=$nameTake,\n" if ($LverbLoc); if ($ctBlocks>1){ # fill up with dots print "--- $sbrName: file up for $nameTake, with :$lenFirstBeforeThis\n" if ($LverbLoc); $tmp{"seq","$ctRd"}="." x $lenFirstBeforeThis;} else{ $tmp{"seq","$ctRd"}="";}} # ------------------------------ # finally store $seq=~s/[^A-Za-z]/\./g; # any non-character to dot $seq=~tr/[a-z]/[A-Z]/; $ptr=$tmp{$nameTake}; $tmp{"seq",$ptr}.=$seq; $nameInBlock{$nameTake}=1; # avoid identical names } close($fhinLoc); # ------------------------------ # fill up ends $lenLoc=length($tmp{"seq","1"}); foreach $itTmp (1..$#nameLoc){ $tmp{"seq",$itTmp}.="." x ($lenLoc-length($tmp{"seq",$itTmp}));} $tmp{"NROWS"}=$ctRd; $tmp{"names"}=join (',',@nameLoc); $tmp{"names"}=~s/^,*|,*$//; $#nameLoc=0; undef %nameInBlock; return(1,"ok $sbrName",%tmp); } # end of safRd #============================================================================== sub safWrt { local($fileOutLoc,%tmp) = @_ ; local(@nameLoc,@stringLoc,$tmp,$sbrName,$Lok); $[ =1 ; #-------------------------------------------------------------------------------- # safWrt writing an SAF formatted file of aligned strings # in: $fileOutLoc output file # = "STDOUT" -> write to screen # in: $tmp{"NROWS"} number of alignments # in: $tmp{"id", $it} name for $it # in: $tmp{"seq",$it} sequence for $it # in: $tmp{"PER_LINE"} number of res per line (def=50) # in: $tmp{"HEADER"} 'line1\n,line2\n'.. # with line1= '# NOTATION ..' # out: 1|0,msg implicit: file # err: ok-> 1,ok | error -> 0,message #-------------------------------------------------------------------------------- $sbrName="lib-br:safWrt"; $fhoutLoc="FHOUT_safWrt"; # check input return(0,"*** ERROR $sbrName: no acceptable output file ($fileOutLoc) defined\n") if (! defined $fileOutLoc || length($fileOutLoc)<1 || $fileOutLoc !~/\w/); return(0,"*** ERROR $sbrName: no input given (or not input{NROWS})\n") if (! %tmp || ! defined $tmp{"NROWS"} ); return(0,"*** ERROR $sbrName: tmp{NROWS} < 1\n") if ($tmp{"NROWS"} < 1); $tmp{"PER_LINE"}=50 if (! defined $tmp{"PER_LINE"}); $fhoutLoc="STDOUT" if ($fileOutLoc eq "STDOUT"); # ------------------------------ # open new file if ($fhoutLoc ne "STDOUT") { open("$fhoutLoc",">$fileOutLoc") || Carp::confess( "failed to open $fileOutLoc: $!" ) || return(0,"*** ERROR $sbrName: failed opening fileOut=$fileOutLoc\n"); } # ------------------------------ # write header # ------------------------------ print $fhoutLoc "# SAF (Simple Alignment Format)\n","\# \n"; print $fhoutLoc $tmp{"HEADER"} if (defined $tmp{"HEADER"}); # get longest name $maxlen=0; foreach $itprot (1..$tmp{"NROWS"}){ $maxlen=length($tmp{"id",$itprot}) if (length($tmp{"id",$itprot}) > $maxlen); } # ------------------------------ # write data into file # ------------------------------ for($itres=1; $itres<=length($tmp{"seq","1"}); $itres+=$tmp{"PER_LINE"}){ foreach $itpair (1..$tmp{"NROWS"}){ printf $fhoutLoc "%-".$maxlen."s ",$tmp{"id",$itpair}; # chunks of $tmp{"PER_LINE"} $chunkEnd=$itres + ($tmp{"PER_LINE"} - 1); foreach $itchunk ($itres .. $chunkEnd){ last if (length($tmp{"seq",$itpair}) < $itchunk); print $fhoutLoc substr($tmp{"seq",$itpair},$itchunk,1); # add blank every 10 print $fhoutLoc " " if ($itchunk != $itres && (int($itchunk/10)==($itchunk/10))); } print $fhoutLoc "\n"; } print $fhoutLoc "\n"; } print $fhoutLoc "\n"; close($fhoutLoc); $#nameLoc=$#stringLoc=0; # save space return(0,"*** ERROR $sbrName: failed to write file $fileOutLoc\n") if (! -e $fileOutLoc); return(1,"ok $sbrName"); } # end of safWrt #============================================================================== sub seqGenWrt { local($seqInLoc,$idInLoc,$formOutLoc,$fileOutLoc,$fhErrSbr) = @_ ; local($sbrName,$fhoutLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # seqGenWrt writes protein sequence in various output formats # in: $seq,$id,$formOut,$fileOut,$fhErrSbr # out: implicit: fileOut # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $tmp=$0;$tmp=~s/^.*\/|\.pl//g;$tmp.=":"; $sbrName="lib-br:"."seqGenWrt"; $fhoutLoc="FHOUT_"."seqGenWrt"; # check arguments return(0,"*** $sbrName: not def seqInLoc!") if (! defined $seqInLoc); return(0,"*** $sbrName: not def idInLoc!") if (! defined $idInLoc); return(0,"*** $sbrName: not def formOutLoc!") if (! defined $formOutLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); $fhErrSbr="STDOUT" if (! defined $fhErrSbr); return(0,"*** $sbrName: sequence missing") if (length($seqInLoc)<1); undef %tmp; # ------------------------------ $tmp{"seq","1"}=$seqInLoc; # intermediate variable for seq $tmp{"NROWS"}= 1; $tmp{"id","1"}= $idInLoc; $Lok=0; # ------------------------------ # write output if ($formOutLoc =~ /^fasta/){ ($Lok,$msg)=&fastaWrtMul($fileOutLoc,%tmp);} elsif ($formOutLoc =~ /^pir/) { ($Lok,$msg)=&pirWrtMul($fileOutLoc,%tmp);} elsif ($formOutLoc eq "saf") { ($Lok,$msg)=&safWrt($fileOutLoc,%tmp);} elsif ($formOutLoc eq "msf") { $tmp{"FROM"}="unk";$tmp{"TO"}=$fileOutLoc; $tmp{"1"}=$idInLoc;$tmp{SEQS}->{$idInLoc}=$seqInLoc; open("$fhoutLoc",">$fileOutLoc") || Carp::confess( "failed to open $fileOutLoc: $!" ) || return(&errSbr("failed creating $fileOutLoc")); $Lok= &msfWrt($fhoutLoc,%tmp); close($fhoutLoc); return(&errSbr("failed writing msf=$fileOutLoc (msfWrt)")) if (! $Lok);} else { return(0,"*** ERROR $sbrName output format $formOutLoc not supported\n");} return(0,"*** ERROR $sbrName: failed to write $formOutLoc into $fileOutLoc\n") if (! $Lok || ! -e $fileOutLoc); return(1,"ok $sbrName"); } # end of seqGenWrt #============================================================================== sub swissRdSeq { local($fileInLoc) = @_ ; local($sbrName,$fhinLoc,$msg,$Lok,$seq,$id); $[ =1 ; #------------------------------------------------------------------------------- # swissRdSeq reads the sequence from a SWISS-PROT file # in: file # out: (1,name,sequence in one string) #------------------------------------------------------------------------------- $sbrName="swissRdSeq";$fhinLoc="FHIN"."$sbrName"; $Lok= open("$fhinLoc","$fileInLoc") || Carp::confess( "failed to open $fileInLoc: $!" ); if (! $Lok){$msg="*** ERROR $sbrName: '$fileInLoc' not opened\n"; return(0,$msg,"error");} $seq=""; while (<$fhinLoc>) {$_=~s/\n//g; if ($_=~/^ID\s+(\S*)\s*.*$/){ $id=$1;} last if ($_=~/^\/\//); next if ($_=~/^[A-Z]/); $seq.="$_";}close($fhinLoc); $seq=~s/\s//g; return(1,$id,$seq); } # end of swissRdSeq #============================================================================== sub sysDate { # local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # sysDate returns $Date # out: $Date (May 30, 1998 59:39:03) #------------------------------------------------------------------------------- @tmp=("/home/rost/perl/ctime.pl","/home/rost/pub/perl/ctime.pl"); # ------------------------------ # get function if (defined &localtime) { foreach $tmp(@tmp){ if (-e $tmp){$Lok=require("$tmp"); last;}} if (defined &ctime && &ctime && defined &localtime && &localtime){ # $date is e.g.: Oct:14:13:06:47:1993 # @Date is e.g.: Oct1413:06:471993 # &ctime(time) is e.g.: Thu Oct 14 13:06:47 1993 # print "xx enter\n"; @Date = split(' ',&ctime(time)) ; shift (@Date) ; $Date="$Date[2] $Date[3], $Date[$#Date] $Date[4]"; return($Date);} } # ------------------------------ # or get system time $localtime=`date`; @Date=split(/\s+/,$localtime); $Date="$Date[2] $Date[3], $Date[$#Date] $Date[4]"; return($Date); } # end of sysDate #=============================================================================== sub sysGetUserLoc { $[ =1 ; #------------------------------------------------------------------------------- # sysGetUserLoc returns $USER (i.e. user name) # out: USER #------------------------------------------------------------------------------- $sbrName="lib-ut:"."sysGetUserLoc"; if (defined $ENV{'USER'}){ return($ENV{'USER'}); } $tmp=`whoami`; return($tmp) if (defined $tmp && length($tmp)>0); $tmp=`who am i`; # SUNMP return($tmp) if (defined $tmp && length($tmp)>0); return(0); } # end of sysGetUserLoc #============================================================================== sub sysRunProg { local ($cmd,$fileScrLoc,$fhErrLoc) = @_ ; $[ =1; #------------------------------------------------------------------------------- # sysRunProg pipes arguments into $prog, and cats the output # from $prog into a file # in: $cmd,$fileScrLoc,$fhError # in: $cmd='prog,arg1,arg2' # in: where prog is the program, e.g. 'wc -l, file1,file2' # in: $fileScrLoc is the output file # in: NOTE: if not defined: buffered to STDOUT # in: = 0 to surpress writing # in: $fhError filehandle for ERROR writing # NOTE: to STDOUT if not defined # in: = 0 to surpress writing # out: 0|1,message # err: ok -> 1,ok | err -> 0,message #------------------------------------------------------------------------------- $sbrName="lib-sys:".( $par{"debug"} ? __FILE__.":".__LINE__ : '' ).":sysRunProg"; return(0,"*** ERROR $sbrName: argument program ($cmd) not defined\n") if (! defined $cmd || length($cmd)<1); $fhErrLoc=0 if (! defined $fhErrLoc); $fileScrLoc=0 if (! defined $fileScrLoc); # ------------------------------ # dissect arguments ($prog,@arg)=split(/,/o,$cmd); if ($fhErrLoc && ! @arg) { print $fhErrLoc "-*- WARN $sbrName: no arguments to pipe into:\n$prog\n"; } elsif ($fhErrLoc && $par{debug}) { print $fhErrLoc "--- $sbrName: system cmd=\n$prog\n--- $sbrName: fileOut=$fileScrLoc cmd IN:\n$cmd\n"; } # ------------------------------ # pipe output into file? $Lpipe=0; $Lpipe=1 if ($fileScrLoc); $Lpipe=0 if ($prog =~ /\s+>>?\s+\S+\s*$/); $prog.=" >> $fileScrLoc " if ($Lpipe); # print "$cmd\n";exit; # ------------------------------ # opens cmdtmp into pipe # cluck/longmess fails with some perl bug!!! if( $par{"debug"} ) { cluck( "|$prog" ); } open (CMD, "|$prog") || Carp::confess( "*** $sbrName cannot open program '|$prog': $!" ); # get input arguments (< arg) foreach $tmp (@arg) { $tmp=~s/\n|^\s*|\s*$//; # delete end of line, and leading blanks print CMD "$tmp\n"; if( $par{"debug"} ) { warn("CMD: $tmp|"); } } if( !close(CMD) ){ confess( "cmd '|$prog' failed: ".( $? >> 8 ) ); } # upon closing: cmdtmp < @out_command executed return(1,"ok $sbrName"); } # end of sysRunProg #============================================================================== # library collected (end) lll #============================================================================== #=============================================================================== sub cleanUp { local($sbrName,$fhinLoc,@tmp); $[ =1 ; #------------------------------------------------------------------------------- # cleanUp deletes intermediate files #------------------------------------------------------------------------------- if ($scrName){$tmp="$scrName".":";}else{$tmp="";} $sbrName="$tmp"."cleanUp"; if ($#kwdRm>0){ # remove intermediate files foreach $kwd (@kwdRm){ next if (! defined $file{$kwd} || ! -e $file{$kwd}); print "--- $sbrName unlink '",$file{$kwd},"'\n" if ($Lverb2); unlink($file{$kwd});}} foreach $kwd ("fileOutTrace","fileOutScreen"){ next if (! defined $par{$kwd} || ! -e $par{$kwd}); print "--- $sbrName unlink '",$par{$kwd},"'\n" if ($Lverb2); unlink($par{$kwd});} } # end of cleanUp #=============================================================================== sub convAliGen { local($fileInLoc,$fileOutLoc,$formIn,$formOut,$extOutLoc,$exeConvSeq,$fileMatGcg, $doCompress,$frag,$extrLoc,$fileScreenLoc,$dirWork,$fhSbr) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # convAliGen general converter for SAF|MSF|FASTAmul -> HSSP,SAF,MSF,FASTAmul,PIRmul # in: $fileInLoc,$fileOutLoc,$formIn,$formOut,$extOutLoc,$frag,$extrLoc, # + $fileScreenLoc,$dirWork,$fhSbr # in: $fileInLoc file.Ali, file.out, format_of_output_file # in: $fileOutLoc output file with converted sequence(s) # in: NOTE: if many appended to @fileOut # in: $formOut output format (lower caps) # in: $extOutLoc extension of expected output (fragments into _beg_end$extension) # in: $exeConvSeq FORTRAN program convert_seq # in: $fileMatGcg Maxhom_GCG.metric (for converting to HSSP) # in: $doCompress for conversion into HSSP : delete insertions in MASTER? # in: $frag fragments e.g. '1-5,10-100' # in: $extrIn number of protein to extract # in: $fileScreen output file for system commands # in: $dirWork directory for temporary files # in: $fhSbr ERRORs of convert_seq # out: converted file # out GLOBAL: @fileOut,@kwdRm,$file{"kwd"} files to remove # err: 0,$msg -> unspecified error # err: 1,$msg -> ok # err: 2,$msg -> conversion option not supported #------------------------------------------------------------------------------- $sbrName="$scrName:"."convAliGen";$fhinLoc="FHIN"."$sbrName"; # ------------------------------ # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); return(0,"*** $sbrName: not def formIn!") if (! defined $formIn); return(0,"*** $sbrName: not def formOut!") if (! defined $formOut); return(0,"*** $sbrName: not def extOutLoc!") if (! defined $extOutLoc); return(0,"*** $sbrName: not def exeConvSeq!") if (! defined $exeConvSeq); return(0,"*** $sbrName: not def fileMatGcg!") if (! defined $fileMatGcg); return(0,"*** $sbrName: not def doCompress!") if (! defined $doCompress); return(0,"*** $sbrName: not def frag!") if (! defined $frag); return(0,"*** $sbrName: not def extrLoc!") if (! defined $extrLoc); return(0,"*** $sbrName: not def fileScreenLoc!") if (! defined $fileScreenLoc); return(0,"*** $sbrName: not def dirWork!") if (! defined $dirWork); $fhSbr="STDOUT" if (! defined $fhSbr); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); return(0,"*** $sbrName: miss in file '$fileMatGcg'!") if (! -e $fileMatGcg); #return(0,"*** $sbrName: miss exe '$exeConvSeq'!") if (! -e $exeConvSeq && ! -l $exeConvSeq); $msgErr=""; return(0,"*** $sbrName: input format $formIn not supported\n") if ($formIn !~/pir|gcg|swiss|msf|saf|fasta/); $fhSysRunProg=0; $fhSysRunProg="STDOUT" if ($par{"verbose"} || $par{"debug"}); $fileScreenLoc=0 if ($par{"debug"}); $#beg=$#end=0; # ------------------------------ if ($frag){ # extract fragments? @tmp=split(/,/,$frag); $#beg=$#end=0; foreach $frag(@tmp){ next if ($frag !~ /\-/);$frag=~s/\s//g; ($beg,$end)=split('-',$frag); next if ($beg =~/\D/ || $end =~ /\D/); push(@beg,$beg);push(@end,$end);}} # ------------------------------ $#kwdRmTmp=0; # temporary files # -------------------------------------------------- if ($formOut eq "hssp"){ # HSSP output if ($#beg>1){ warn( "-*- WARN $sbrName: for $formIn -> HSSP currently only one fragment at a time!!" x 2 );} $shortNames=1; # for HSSP: names shorter than 15 characters! # ------------------------------ # (1) convert all seq to FASTA if ($formIn =~ /^pir/ || $formIn eq "gcg" || $formIn eq "swiss" ){ $kwd=$formIn."-".$formOut ;push(@kwdRmTmp,$kwd); $fileOutSeqTmp=$file{$kwd}=$dirWork.$par{"titleTmp"}.".fasta_tmp"; $fragHere=0; $fragHere="$beg[1]-$end[1]" if ($#beg>0); return(&errSbr("more than one fragment not supported for converting ". "$formIn to $formOut")) if ($#beg>1); ($Lok,$msg)= &convSeq2fastaPerl($fileInLoc,$fileOutSeqTmp,$formIn,$fragHere,$shortNames); return(&errSbrMsg("failed converting seq ($formIn) to FASTA",$msg)) if (! $Lok); # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # change input format # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! $formIn="fasta";} else { $fileOutSeqTmp=$fileInLoc;} # ------------------------------ # (2) convert all to MSF if( $par{debug} ){ cluck("convert all to MSF"); } if ($formIn eq "saf" || $formIn =~/^fasta/){ $kwd=$formIn."-".$formOut;push(@kwdRmTmp,$kwd); $fileOutMsfTmp=$file{$kwd}=$dirWork.$par{"titleTmp"}.".msf_tmp"; $fragHere=0; $fragHere="$beg[1]-$end[1]" if ($#beg>0); if ($formIn eq "saf"){ ($Lok,$msg)= &convSaf2many($fileOutSeqTmp,$fileOutMsfTmp,"msf", $fragHere,$extrLoc,$fhSbr,$doCompress,$shortNames);} elsif ($formIn =~ /^fasta/){ ($Lok,$msg)= &convFastamul2many($fileOutSeqTmp,$fileOutMsfTmp,"msf", $fragHere,$extrLoc,$fhSbr,$doCompress,$shortNames);} return(0,"*** ERROR $sbrName: failed to write msf ($fileOutMsfTmp) from $fileInLoc, ". "to seq=$fileOutSeqTmp, for extr=$extrLoc". $msg."\n") if (! $Lok || ! -e $fileOutMsfTmp);} elsif ($formIn eq "msf") { # shorten names $kwd="msfShorten"; push(@kwdRmTmp,$kwd); $fileOutMsfShorten=$file{$kwd}=$dirWork.$par{"titleTmp"}.".msf_shorten"; ($Lok,$msg)= &msfShorten ($fileOutSeqTmp,$fileOutMsfShorten ); return(&errSbrMsg("failed shortening names msf=$fileOutSeqTmp->". $fileOutMsfShorten.",msg=",$msg)) if (! $Lok); # convert too to make sure compressing works if ($doCompress){ $kwd=$formIn."-".$formOut; push(@kwdRmTmp,$kwd); $fileOutMsfTmp=$file{$kwd}=$dirWork.$par{"titleTmp"}.".msf_tmp"; ($Lok,$msg)= &msfCompress ($fileOutMsfShorten,$fileOutMsfTmp ); return(&errSbrMsg("failed compressing MSF=$fileOutSeqTmp->". $fileOutMsfTmp."! msg=",$msg)) if (! $Lok);} else { $fileOutMsfTmp=$fileOutMsfShorten;}} else { return(&errSbr("input format=$formIn -> output=$formOut, not supported\n"));} # ------------------------------ # (3) blow up when single sequence if (&msfCountNali($fileOutMsfTmp) == 1){ $kwd=$formIn."-".$formOut."-addSelf";push(@kwdRmTmp,$kwd); $fileOutMsfTmp2=$file{$kwd}=$dirWork.$par{"titleTmp"}.".msf_tmpSelf"; ($Lok,$msg)= &msfBlowUp ($fileOutMsfTmp,$fileOutMsfTmp2 ); return(0,"*** ERROR $sbrName: failed to write msf2 ($fileOutMsfTmp2)". $msg."\n") if (! $Lok); $fileOutMsfTmp=$fileOutMsfTmp2;} # ------------------------------ # (4) now convert_seq to write HSSP $cmd= ""; # eschew warnings $an2= "N"; # write another format? # gaps in master sequence as insertions? $anIns= "N"; $anIns= "Y" if ($doCompress); $anFormOut= "H"; # output = HSSP $anId= " "; # specify id for master # ------------------------------ # (5) convert to HSSP $fileOutTmp=$fileOutLoc; eval "\$cmd=\"$exeConvSeq,$fileOutMsfTmp,$anFormOut,$fileMatGcg,$anIns,$fileOutTmp,$anId,$an2\""; # run FORTRAN script # ($Lok,$msg)=&sysRunProg($cmd,0,"STDOUT"); ($Lok,$msg)=&sysRunProg($cmd,$fileScreenLoc,$fhSysRunProg); return(0,"*** ERROR $sbrName: failed to convert hssp to MSF\n".$msg."\n") if (! $Lok || ! -e $fileOutTmp); # ------------------------------ # (6) verify NALI in HSSP $kwd=$formIn."-".$formOut."-correct";push(@kwdRmTmp,$kwd); $fileOutHsspTmp=$file{$kwd}=$dirWork.$par{"titleTmp"}.".hssp_error"; ($Lok,$msg)=&hsspCorrectNali($fileOutTmp,$fileOutHsspTmp,$fhSbr); push(@fileOut,$fileOutTmp);} # -------------------------------------------------- # MSF, FASTA, PIR, FASTAmul, PIRmul elsif ($formOut eq "msf" || $formOut eq "fasta" || $formOut eq "pir" || $formOut eq "saf" || $formOut eq "fastamul" || $formOut eq "pirmul" || $formOut eq "gcg"){ # -------------------- # (1) convert MSF to SAF if ($formIn eq "msf"){ $kwd=$formOut."-SAF";push(@kwdRmTmp,$kwd); $fileOutSafTmp=$file{$kwd}=$dirWork.$par{"titleTmp"}.$kwd.$extOutLoc; ($Lok,$msg)= &convMsf2saf ($fileInLoc,$fileOutSafTmp,$doCompress ); return(0,"*** ERROR $sbrName: failed to write saf ($fileOutSafTmp) ". "from $fileInLoc".$msg."\n") if (! $Lok || ! -e $fileOutSafTmp); $fileInLoc2=$fileOutSafTmp;} else { $fileInLoc2=$fileInLoc;} # -------------------- if ($#beg>0){ # (2a) loop over fragments foreach $it (1..$#beg){ $fileOutTmp=$fileOutLoc;$fileOutTmp=~s/(\.$extOutLoc)/\_$beg[$it]\_$end[$it]$1/; $fragHere="$beg[$it]-$end[$it]"; if ($formIn eq "saf" || $formIn eq "msf"){ ($Lok,$msg)= &convSaf2many ($fileInLoc2,$fileOutTmp,$formOut,$fragHere,$extrLoc, $fhSbr,$doCompress ); return(0,"*** ERROR $sbrName: failed to convert $fileInLoc2 to ". "$formOut\n"."$msg\n") if (! $Lok);} elsif ($formIn =~ /^fasta/){ ($Lok,$msg)= &convFastamul2many ($fileInLoc2,$fileOutTmp,$formOut,$fragHere, $extrLoc,$fhSbr,$doCompress ); return(0,"*** ERROR $sbrName: failed to convert $fileInLoc2 to ". "$formOut\n"."$msg\n") if (! $Lok);} push(@fileOut,$fileOutTmp);}} # -------------------- else {$fragHere=0; # (2b) no fragments if ($formIn eq "saf" || $formIn eq "msf"){ ($Lok,$msg)= &convSaf2many ($fileInLoc2,$fileOutLoc,$formOut,$fragHere, $extrLoc,$fhSbr,$doCompress ); return(0,"*** ERROR $sbrName: failed to convert $fileInLoc2 to ". "$formOut\n".$msg."\n") if (! $Lok);} elsif ($formIn =~ /^fasta/){ ($Lok,$msg)= &convFastamul2many ($fileInLoc2,$fileOutLoc,$formOut,$fragHere, $extrLoc,$fhSbr,$doCompress ); return(0,"*** ERROR $sbrName: failed to convert $fileInLoc2 (fasta) ". "to $formOut\n"."$msg\n") if (! $Lok);} push(@fileOut,$fileOutLoc);} } else { return(2,"*** ERROR $sbrName: output option $formOut not supported\n");} # ------------------------------ # remove temporary files if (! $par{"debug"}){ foreach $kwd(@kwdRmTmp){ if (-e $file{$kwd}){ print "--- \t $sbrName: remove (",$file{$kwd},") \n" if (defined $par{"verb2"} && $par{"verb2"}); unlink $file{$kwd};}}} return(1,"ok $sbrName"); } # end of convAliGen #=============================================================================== sub convDsspGen { local($fileInLoc,$chainInLoc,$fileOutLoc,$formOut,$extOutLoc,$exeConvSeq,$fileMatGcg, $frag,$fileScreenLoc,$dirWork,$fhSbr,$doSplitChainLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # convDsspGen general converter for all DSSP in -> x # in: for general info see 'convDsspGen' # in: $fileInLoc file,dssp # in: $chainLoc chain to extract # in: $fileOut # in: $formOut format_of_output_file # in: $extOutLoc extension of expected output (fragments into _beg_end$extension) # in: $exeConvSeq FORTRAN program convert_seq # in: $fileMatGcg Maxhom_GCG.metric (for converting to HSSP) # in: $frag fragments e.g. '1-5,10-100' # in: $fileScreen output file for system commands # in: $doSplitChain split chains when converting to FASTA # # out: converted file # # out GLOBAL: @fileOut,@kwdRm,$file{"kwd"} files to remove # # err: 0,$msg -> unspecified error # err: 1,$msg -> ok # err: 2,$msg -> conversion option not supported #------------------------------------------------------------------------------- $sbrName="$scrName:"."convDsspGen";$fhinLoc="FHIN"."$sbrName"; # ------------------------------ # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def chainInLoc!") if (! defined $chainInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); return(0,"*** $sbrName: not def formOut!") if (! defined $formOut); return(0,"*** $sbrName: not def extOutLoc!") if (! defined $extOutLoc); return(0,"*** $sbrName: not def frag!") if (! defined $frag); return(0,"*** $sbrName: not def dirWork!") if (! defined $dirWork); $fhSbr="STDOUT" if (! defined $fhSbr); $doSplitChainLoc=0 if (! defined $doSplitChainLoc); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); $chainIn=$chainInLoc; $chainIn="*" if (! $chainInLoc || length($chainInLoc)!=1 || $chainInLoc !~/[A-Z0-9]/); # ------------------------------ $#kwdRmTmp=0; # temporary files $fhSysRunProg=0; $fhSysRunProg="STDOUT" if ($par{"verb2"}); $fileScreenLoc=0 if ($par{"debug"}); # ------------------------------ # chain over-rules fragments if (($chainInLoc && $chainInLoc =~ /[A-Z0-9]/) || $doSplitChainLoc){ ($Lok,%tmp)= &dsspGetChain($fileInLoc); return(0,"*** ERROR $sbrName: failed to extract chain from DSSP ($fileInLoc)\n") if (! $Lok); @tmp=split(/,/,$tmp{"chains"}); if ($doSplitChainLoc){ @chainLoc=@tmp;} else { $#chainLoc=0;} undef %chainLoc; foreach $it (1..$#tmp){ if (! $doSplitChainLoc && $tmp[$it] eq $chainInLoc){ $frag=$tmp{$chainInLoc,"beg"}."-".$tmp{$chainInLoc,"end"}; last;} else { $chainLoc{$tmp[$it],"beg"}=$tmp{$tmp[$it],"beg"}; $chainLoc{$tmp[$it],"end"}=$tmp{$tmp[$it],"end"}; } }} else { $#chainLoc=0;} $#beg=$#end=0; # ------------------------------ if ($frag){ # extract fragments? @tmp=split(/,/,$frag);$#beg=$#end=0; foreach $frag (@tmp){ next if ($frag !~ /\-/);$frag=~s/\s//g; ($beg,$end)=split('-',$frag); next if ($beg =~/\D/ || $end =~ /\D/); push(@beg,$beg);push(@end,$end);}} # ------------------------------ # FASTA/mul, PIR/mul, SAF/MSF if ($formOut =~/^pir/ || $formOut =~/^fasta/ || $formOut =~/^msf/ || $formOut =~/^saf/ ){ # read entire DSSP sequence ($Lok,$seqSmallCap,$seqDssp)= &dsspRdSeq($fileInLoc,$chainIn); return(0,"*** ERROR $sbrName: failed to read dssp sequence for chain $chainIn\n". $seqSmallCap."\n") if (! $Lok || length($seqDssp)<5); # security margin for chainbreaks # ****************************** # set fragment to zero! if ($chainIn ne "*"){ $#beg=$#end=0 ;} elsif ($#beg && $beg[1] > length($seqDssp)){ $#beg=$#end=0 ;} elsif ($#beg && (1+$end[1]-$beg[1]) > length($seqDssp)){ $#beg=$#end=0 ;} if ($#beg>0){ # loop over fragments foreach $it (1..$#beg){ if (defined $chainIn && $chainIn && $chainIn ne "*" && length($chainIn)==1) { $fileOutTmp=$fileOutLoc; $id=$fileInLoc;$id=~s/^.*\/|\..*$//g; # purge dir $id.="_".$chainIn;} else { $fileOutTmp=$fileOutLoc;$fileOutTmp=~s/($extOutLoc)/\_$beg[$it]\_$end[$it]$1/; $id=$fileInLoc;$id=~s/^.*\/|\..*$//g;} # purge dir $seqDsspTmp=substr($seqDssp,$beg[$it],($end[$it]-$beg[$it]+1)); if (length($seqDsspTmp)<5){ print "-*- WARN $sbrName: seq=$seqDsspTmp (beg=$beg[$it], end=$end[$it]) very short!\n"; next;} ($Lok,$msg)= &seqGenWrt($seqDsspTmp,$id,$formOut,$fileOutTmp,$fhSbr); return(0,"*** ERROR $sbrName: failed to write $formOut from DSSP\n"."$msg\n") if (! $Lok || ! -e $fileOutTmp); push(@fileOut,$fileOutTmp);}} # loop over chains elsif ($doSplitChainLoc){ foreach $chaintmp (@chainLoc){ $seqDsspTmp= substr($seqDssp, $chainLoc{$chaintmp,"beg"}, (1+$chainLoc{$chaintmp,"end"}-$chainLoc{$chaintmp,"beg"})); # avoid duplicating identical chains next if (defined $tmp{$seqDsspTmp}); $tmp{$seqDsspTmp}=1; if (length($seqDsspTmp)<5){ print "-*- WARN $sbrName: seq=$seqDsspTmp (beg=", $chainLoc{$chaintmp,"beg"}," end=",$chainLoc{$chaintmp,"end"},") very short!\n"; next;} if ($chaintmp !~ /^( |\*)$/ && length($chaintmp)==1){ $fileOutTmp=$fileOutLoc; $id=$fileInLoc; $id=~s/^.*\/|\..*$//g; # purge dir $idnochain=$id; $id.="_".$chaintmp; $fileOutTmp=~s/$idnochain/$id/;} else { $fileOutTmp=$fileOutLoc; $id=$fileInLoc;$id=~s/^.*\/|\..*$//g;} # purge dir ($Lok,$msg)= &seqGenWrt($seqDsspTmp,$id,$formOut,$fileOutTmp,$fhSbr); return(0,"*** ERROR $sbrName: failed to write $formOut from DSSP\n"."$msg\n") if (! $Lok || ! -e $fileOutTmp); push(@fileOut,$fileOutTmp);}} else { $id=$fileInLoc;$id=~s/^.*\/|\..*$//g; # purge dir $id.="_".$chainIn if (defined $chainIn && $chainIn && $chainIn ne "*" && length($chainIn)==1); ($Lok,$msg)= &seqGenWrt($seqDssp,$id,$formOut,$fileOutLoc,$fhSbr); return(0,"*** ERROR $sbrName: failed to write $formOut from DSSP\n"."$msg\n") if (! $Lok || ! -e $fileOutLoc); push(@fileOut,$fileOutLoc);} } # ------------------------------ # HSSP elsif ($formOut eq "hssp"){ # (1) read entire DSSP sequence ($Lok,$seqSmallCap,$seqDssp)= &dsspRdSeq($fileInLoc,$chainIn); return(0,"*** ERROR $sbrName: failed to read dssp sequence for chain $chainIn\n". "$seqSmallCap\n") if (! $Lok || length($seqDssp)<5); # security margin for chainbreaks if ($#beg>0){ # (2a) loop over fragments foreach $it (1..$#beg){ if (defined $chainIn && $chainIn && $chainIn ne "*" && length($chainIn)==1) { $fileOutTmp=$fileOutLoc; $id=$fileInLoc;$id=~s/^.*\/|\..*$//g; # purge dir $id.="_".$chainIn;} else { $fileOutTmp=$fileOutLoc;$fileOutTmp=~s/($extOutLoc)/\_$beg[$it]\_$end[$it]$1/; $id=$fileInLoc;$id=~s/^.*\/|\..*$//g;} # purge dir $seqDsspTmp=substr($seqDssp,$beg[$it],($end[$it]-$beg[$it]+1)); if (length($seqDsspTmp)<5){ print "-*- WARN $sbrName: seq=$seqDsspTmp (beg=$beg[$it], end=$end[$it]) very short!\n"; next;} # (3a) convert to MSF $kwd="dssp-hssp"; push(@kwdRmTmp,$kwd); $fileOutMsf=$file{$kwd}=$dirWork.$par{"titleTmp"}.".msf_tmp"; ($Lok,$msg)= &seqGenWrt($seqDsspTmp,$id,"msf",$fileOutMsf,$fhSbr); return(0,"*** ERROR $sbrName: failed to write MSF from DSSP\n"."$msg\n") if (! $Lok || ! -e $fileOutMsf); # (4a) blow up when single sequence if (&msfCountNali($fileOutMsf) == 1){ $kwd=$formIn."-".$formOut."-addSelf";push(@kwdRmTmp,$kwd); $fileOutMsfTmp2=$file{$kwd}=$dirWork.$par{"titleTmp"}.".msf_tmpSelf"; ($Lok,$msg)= &msfBlowUp($fileOutMsf,$fileOutMsfTmp2); return(0,"*** ERROR $sbrName: failed to write msf2 ($fileOutMsfTmp2)". $msg."\n") if (! $Lok); $fileOutMsf=$fileOutMsfTmp2;} # (5a) now convert_seq to write HSSP $cmd= ""; # eschew warnings $an2= "N"; # write another format? # gaps in master sequence as insertions? $anIns= "N"; $anFormOut= "H"; # output = HSSP $anId= " "; # specify id for master eval "\$cmd=\"$exeConvSeq,$fileOutMsf,$anFormOut,$fileMatGcg,$anIns,$fileOutTmp,$anId,$an2\""; # run FORTRAN script ($Lok,$msg)= &sysRunProg($cmd,$fileScreenLoc,$fhSysRunProg); return(0,"*** ERROR $sbrName: failed to convert DSSP -> MSF -> HSSP\n".$msg."\n") if (! $Lok || ! -e $fileOutTmp); push(@fileOut,$fileOutTmp);} } else { # (2b) no loop if( $par{debug} ){ cluck("(2b) no loop"); } $id=$fileInLoc;$id=~s/^.*\/|\..*$//g; # purge dir $id.="_".$chainIn if (defined $chainIn && $chainIn && $chainIn ne "*" && length($chainIn)==1); # (3a) convert to MSF $kwd="dssp-hssp"; push(@kwdRmTmp,$kwd); $fileOutMsf=$file{$kwd}=$dirWork.$par{"titleTmp"}.".msf_tmp"; ($Lok,$msg)= &seqGenWrt($seqDssp,$id,"msf",$fileOutMsf,$fhSbr); return(0,"*** ERROR $sbrName: failed to write MSF from DSSP\n"."$msg\n") if (! $Lok || ! -e $fileOutMsf); # (4a) blow up when single sequence if (&msfCountNali($fileOutMsf) == 1){ $kwd=$formIn."-".$formOut."-addSelf";push(@kwdRmTmp,$kwd); $fileOutMsfTmp2=$file{$kwd}=$dirWork.$par{"titleTmp"}.".msf_tmpSelf"; ($Lok,$msg)= &msfBlowUp($fileOutMsf,$fileOutMsfTmp2); return(0,"*** ERROR $sbrName: failed to write msf2 ($fileOutMsfTmp2)". $msg."\n") if (! $Lok); $fileOutMsf=$fileOutMsfTmp2;} # (5a) now convert_seq to write HSSP $cmd= ""; # eschew warnings $an2= "N"; # write another format? # gaps in master sequence as insertions? $anIns= "N"; $anFormOut= "H"; # output = HSSP $anId= " "; # specify id for master eval "\$cmd=\"$exeConvSeq,$fileOutMsf,$anFormOut,$fileMatGcg,$anIns,$fileOutLoc,$anId,$an2\""; # run FORTRAN script ($Lok,$msg)= &sysRunProg($cmd,$fileScreenLoc,$fhSysRunProg); return(0,"*** ERROR $sbrName: failed to convert DSSP -> MSF -> HSSP\n".$msg."\n") if (! $Lok || ! -e $fileOutMsf); push(@fileOut,$fileOutLoc);} } # ------------------------------ # unsupported output # ------------------------------ else { return(2,"*** ERROR $sbrName: output option $formOut not supported for FSSP\n");} # ------------------------------ # remove temporary files foreach $kwd(@kwdRmTmp){ if (-e $file{$kwd}){ print "--- \t $sbrName: remove (",$file{$kwd},") \n" if (defined $par{"verb2"} && $par{"verb2"}); unlink $file{$kwd};}} # clean up undef %tmp; # slim-is-in undef %chainLoc; # slim-is-in $#chainLoc=0; # slim-is-in return(1,"ok $sbrName"); } # end of convDsspGen #=============================================================================== sub convFsspGen { local($fileInLoc,$fileOutLoc,$formOut,$extOutLoc,$exeConvFssp2daf,$fileIncl,$dirDsspLoc,$dirWork,$fhSbr) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # convFsspGen general converter for all FSSP in -> x # in: for general info see 'convFsspGen' # in: special: # in: $fileIncl: contains ids to include, syntax PDBids + chain 1pdbC (or h|f|dssp files) # out: converted file # out GLOBAL: @fileOut,@kwdRm,$file{"kwd"} files to remove # err: 0,$msg -> unspecified error # err: 1,$msg -> ok # err: 2,$msg -> conversion option not supported #------------------------------------------------------------------------------- $sbrName="$scrName:"."convFsspGen";$fhinLoc="FHIN_"."$sbrName"; # ------------------------------ # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); return(0,"*** $sbrName: not def formOut!") if (! defined $formOut); return(0,"*** $sbrName: not def extOutLoc!") if (! defined $extOutLoc); return(0,"*** $sbrName: not def exeConvFssp2daf!") if (! defined $exeConvFssp2daf); return(0,"*** $sbrName: not def fileIncl!") if (! defined $fileIncl); return(0,"*** $sbrName: not def dirDsspLoc!") if (! defined $dirDsspLoc); return(0,"*** $sbrName: not def dirWork!") if (! defined $dirWork); $fhSbr="STDOUT" if (! defined $fhSbr); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); #return(0,"*** $sbrName: miss exe '$exeConvFssp2daf'!") if (! -e $exeConvFssp2daf && ! -l $exeConvFssp2daf); return(0,"*** $sbrName: miss in file '$fileIncl'!") if ($fileIncl && ! -e $fileInLoc); return(0,"*** $sbrName: miss dssp dir '$dirDsspLoc'!") if (! -d $dirDsspLoc); # ------------------------------ # supported output options $cmd= ""; # eschew warnings $an2= "N"; # write another format? # ------------------------------ if ($formOut eq "daf"){ # 2 daf # -------------------- $#incl=0;$incl="unk"; # read include file if ($fileIncl && -e $fileIncl){ open("$fhinLoc","$fileIncl") || confess( "failed to open $fileIncl: $!" ) || return(0,"*** $sbrName failed opening fileIn=$fileIncl\n"); $incl=""; while(<$fhinLoc>){next if (/^\#/);$_=~s/\n|\s//g; next if (length($_)<3); $_=~s/^.*\///g;$_=~s/\.[dhf]ssp[_!]*//g; push(@incl,$_);$incl.="$_,";}close($fhinLoc); $incl=~s/,$//g;} $fileDafTmp=$dirWork.$par{"titleTmp"}."-fssp".$extOutLoc; $Lok= &convFssp2Daf($fileInLoc,$fileOutLoc,$fileDafTmp,$exeConvFssp2daf,$dirDsspLoc); return(0,"*** ERROR $sbrName: failed to convert $fileInLoc to DAF $fileOutLoc, tmp=$fileDafTmp, ". "exe=$exeConvFssp2daf\n") if (! $Lok || ! -e $fileOutLoc); print "--- \t $sbrName: remove ($fileDafTmp) \n" if (defined $par{"verb2"} && $par{"verb2"}); unlink $fileDafTmp; push(@fileOut,$fileOutLoc);} else { return(2,"*** ERROR $sbrName: output option $formOut not supported for FSSP\n");} return(1,"ok $sbrName"); } # end of convFsspGen #=============================================================================== sub convHsspGen { local($fileInLoc,$chainInLoc,$fileOutLoc,$formOut,$extOutLoc,$exeConvSeq,$exeConvHssp2saf, $doExpand,$frag,$extrIn,$fileScreenLoc,$dirWork,$fhSbr,$doSplitChainLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; if( $par{debug} ){ cluck(); } #------------------------------------------------------------------------------- # convHsspGen general converter for all HSSP in -> x # in: $fileInLoc,$chainIn,$fileOutLoc,$formOut,$extOutLoc,$exeConvSeq, # in: $doExpand,$frag,$extrIn,$dirWork,$fileScreenLoc,$fhSbr # in: $fileInLoc file.hssp, file.out, format_of_output_file # in: $fileOutLoc output file with converted sequence(s) # in: NOTE: if many appended to @fileOut # in: $formOut output format (lower caps) # in: $extOutLoc extension of expected output (fragments into _beg_end$extension) # in: $exeConvSeq the good old FORTRAN convert_seq # in: $exeConvHssp2saf the new perl script doing it # in: $doExpand do expand the deletions? (only for MSF) # in: $frag fragments e.g. '1-5,10-100' # in: $extrIn number of protein to extract # in: $dirWork directory for temporary files # in: $fileScreen file to dump convert_seq .. # in: $fhSbr ERRORs of convert_seq # in: $doSplitChain split chains when converting to FASTA # # out: converted file # out GLOBAL: @fileOut,@kwdRm,$file{"kwd"} files to remove # # err: 0,$msg -> unspecified error # err: 1,$msg -> ok # err: 2,$msg -> conversion option not supported #------------------------------------------------------------------------------- $sbrName="$scrName:"."convHsspGen";$fhinLoc="FHIN"."$sbrName"; # ------------------------------ # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); $chainInLoc="*" if (! defined $chainInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); return(0,"*** $sbrName: not def formOut!") if (! defined $formOut); return(0,"*** $sbrName: not def extOutLoc!") if (! defined $extOutLoc); return(0,"*** $sbrName: not def exeConvSeq!") if (! defined $exeConvSeq); return(0,"*** $sbrName: not def exeConvHssp2saf!") if (! defined $exeConvHssp2saf); return(0,"*** $sbrName: not def doExpand!") if (! defined $doExpand); return(0,"*** $sbrName: not def frag!") if (! defined $frag); return(0,"*** $sbrName: not def extrIn!") if (! defined $extrIn); return(0,"*** $sbrName: not def fileScreenLoc!") if (! defined $fileScreenLoc); return(0,"*** $sbrName: not def dirWork!") if (! defined $dirWork); $fhSbr="STDOUT" if (! defined $fhSbr); $doSplitChainLoc=0 if (! defined $doSplitChainLoc); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); #return(0,"*** $sbrName: miss exe '$exeConvSeq'!") if (! -e $exeConvSeq && ! -l $exeConvSeq); #return(0,"*** $sbrName: miss exe '$exeConvHssp2saf'!") if (! -e $exeConvHssp2saf && ! -l $exeConvHssp2saf); $msgErr=""; $fhSysRunProg=0; $fhSysRunProg="STDOUT" if ($par{"verb2"}); $fileScreenLoc=0 if ($par{"debug"}); # ------------------------------ # supported output options if ($frag && $formOut eq "daf"){ print "-*- WARN $sbrName: fragment selection not supported for hssp->$formOut\n"; $frag=0;} if ($doExpand && $formOut eq "daf"){ print "-*- WARN $sbrName: expansion of HSSP automatic (?) for hssp->$formOut\n"; $doExpand=0;} # ------------------------------ # chain over-rules fragments if ($chainInLoc && $chainInLoc =~ /[A-Z0-9]/){ ($len,$ifir,$ilas)= &hsspGetChainLength($fileInLoc,$chainInLoc); # ignore!!!! for output which read only chains!! if ($formOut !~ /^(pir|fasta)/){ $frag="$ifir-$ilas" if ($len>0); } } $#beg=$#end=0; # ------------------------------ if ($frag){ # extract fragments? @tmp=split(/,/,$frag);$#beg=$#end=0; foreach $frag(@tmp){next if ($frag !~ /\-/);$frag=~s/\s//g; ($beg,$end)=split('-',$frag); next if ($beg =~/\D/ || $end =~ /\D/);push(@beg,$beg);push(@end,$end);}} $#kwdRmTmp=0; # temporary files $cmd= ""; # eschew warnings $an2= "N"; # write another format? $anExpand= "N"; # expand sequences (i.e. fill in insertion list) $anExpand= "Y" if ($doExpand); # ------------------------------ if ($formOut eq "daf"){ # 2 daf $anFormOut= "d"; $an1= "N"; # fragment? (if: prompted for two integers: beg end) eval "\$cmd=\"$exeConvSeq,$fileInLoc,$anFormOut,$an1,$fileOutLoc,$an2\""; # run FORTRAN script ($Lok,$msg)=&sysRunProg($cmd,$fileScreenLoc,$fhSysRunProg); return(0,"*** ERROR $sbrName: failed to convert hssp to daf\n".$msg."\n") if (! $Lok || ! -e $fileOutLoc); push(@fileOut,$fileOutLoc);} # ------------------------------ # MSF elsif ($formOut eq "msf") { $anFormOut= "m"; if ($#beg>0){ # loop over fragments foreach $it (1..$#beg){ if ($formOut eq "saf"){ $kwd=$formOut.$it; $fileOutTmp=$file{$kwd}=$dirWork.$par{"titleTmp"}.$kwd.$extOutLoc; push(@kwdRmTmp,$kwd);} else { $fileOutTmp=$fileOutLoc;$fileOutTmp=~s/(\.$extOutLoc)/\_$beg[$it]\_$end[$it]$1/;} $an1= "Y"; # fragment? (if: prompted for two integers: beg end) $anF= "$beg[$it] $end[$it]"; # answer for fragment eval "\$cmd=\"$exeConvSeq,$fileInLoc,$anFormOut,$an1,$anF,$fileOutTmp,$anExpand,$an2\""; # run FORTRAN script ($Lok,$msg)=&sysRunProg($cmd,$fileScreenLoc,$fhSysRunProg); $msgErr.="*** ERROR $sbrName: failed to convert hssp to MSF frag $it \n".$msg."\n" if (! $Lok || ! -e $fileOutTmp); push(@fileOut,$fileOutTmp);} return(0,$msgErr) if ($msgErr =~ /ERROR/);} else { $an1= "N"; # fragment? (if: prompted for two integers: beg end) $fileOutTmp=$fileOutLoc; eval "\$cmd=\"$exeConvSeq,$fileInLoc,$anFormOut,$an1,$fileOutTmp,$anExpand,$an2\""; # run FORTRAN script ($Lok,$msg)=&sysRunProg($cmd,$fileScreenLoc,$fhSysRunProg); return(0,"*** ERROR $sbrName: failed to convert hssp to MSF\n".$msg."\n") if (! $Lok || ! -e $fileOutTmp); push(@fileOut,$fileOutTmp);}} # ------------------------------ # SAF elsif ($formOut eq "saf" ){ if ($#beg>0){ # loop over fragments foreach $it (1..$#beg){ $fileOutTmp=$fileOutLoc;$fileOutTmp=~s/(\.$extOutLoc)/\_$beg[$it]\_$end[$it]$1/; @tmp=($fileInLoc,"fileOut=$fileOutTmp"); push(@tmp,"frag=$beg[$it]-$end[$it]"); push(@tmp,"extr=$extrIn") if (defined $extrIn && $extrIn); push(@tmp,"expand") if ($doExpand); push(@tmp,"debug") if (! $fileScreenLoc); # call package ($Lok,$msg)=&conv_hssp2saf::conv_hssp2saf(@tmp); $msgErr.="*** ERROR $sbrName: failed to convert hssp to SAF frag $it \n".$msg."\n" if (! $Lok || ! -e $fileOutTmp); push(@fileOut,$fileOutTmp);} return(0,$msgErr) if ($msgErr =~ /ERROR/);} else { $fileOutTmp=$fileOutLoc; @tmp=($fileInLoc,"fileOut=$fileOutTmp"); push(@tmp,"extr=$extrIn") if (defined $extrIn && $extrIn); push(@tmp,"expand") if ($doExpand); push(@tmp,"debug") if (! $fileScreenLoc); # call package ($Lok,$msg)=&conv_hssp2saf::conv_hssp2saf(@tmp); return(0,"*** ERROR $sbrName: failed to convert hssp to Saf\n".$msg."\n") if (! $Lok || ! -e $fileOutTmp); push(@fileOut,$fileOutTmp);}} # ------------------------------ # FASTA/PIR mul elsif ($formOut eq "pirmul" || $formOut eq "fastamul" || $formOut eq "fasta" || $formOut eq "pir" ){ $anFormOut= substr($formOut,1,1); $Lone=$extr=0; # extract only some sequences? if ($formOut eq "fasta" || $formOut eq "pir" ){ $Lone=1;$extr=$extrIn;$extr=1 if (! defined $extr || $extr < 1);} $extr="guide" if ($Lone); # -------------------- if ($#beg>0){ # loop over fragments foreach $it (1..$#beg){ $fileOutTmp=$fileOutLoc;$fileOutTmp=~s/(\.$extOutLoc)/\_$beg[$it]\_$end[$it]$1/; $fragTmp=$beg[$it]."-".$end[$it]; # sbr call ($Lok,$msg)= &convHssp2seq($fileInLoc,$chainInLoc,$fileOutTmp,$formOut,$extOutLoc, $doExpand,$fragTmp,$extr,0,0,0,0,$fhSbr); return(&errSbrMsg("failed HSSP -> $formOut (sbr)",$msg)) if (! $Lok); # no output -> skip if (! -e $fileOutTmp){ $msgErr.="*** ERROR $sbrName: failed to convert hssp to $formOut frag $it\n"; next; } # extract particular sequence push(@fileOut,$fileOutTmp); } } # -------------------- else { # NO fragment $fileOutTmp=$fileOutLoc; $fragTmp=0; # sbr call ($Lok,$msg)= &convHssp2seq($fileInLoc,$chainInLoc,$fileOutTmp,$formOut,$extOutLoc, $doExpand,$fragTmp,$extr,0,0,0,0,$fhSbr,$doSplitChainLoc); return(&errSbrMsg("failed HSSP -> $formOut (sbr)",$msg)) if (! $Lok || ! -e $fileOutTmp); # extract particular sequence push(@fileOut,$fileOutTmp); } } else { return(2,"*** ERROR $sbrName: output option $formOut not supported for HSSP\n");} # ------------------------------ # remove temporary files foreach $kwd(@kwdRmTmp){ if (-e $file{$kwd}){ print "--- \t $sbrName: remove (",$file{$kwd},") \n" if (defined $par{"verb2"} && $par{"verb2"}); unlink $file{$kwd};}} return(1,"ok $sbrName"); } # end of convHsspGen #=============================================================================== sub convPirmulGen { local($fileInLoc,$fileOutLoc,$formOut,$extOutLoc,$frag,$extrIn,$dirWork,$fhSbr) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # convPirmulGen general converter for all PIRMUL in -> x # in: for general info see 'convPirmulGen' # out: converted file # out GLOBAL: @fileOut,@kwdRm,$file{"kwd"} files to remove # err: 0,$msg -> unspecified error # err: 1,$msg -> ok # err: 2,$msg -> conversion option not supported #------------------------------------------------------------------------------- $sbrName="$scrName:"."convPirmulGen";$fhinLoc="FHIN"."$sbrName"; # ------------------------------ # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); return(0,"*** $sbrName: not def formOut!") if (! defined $formOut); return(0,"*** $sbrName: not def extOutLoc!") if (! defined $extOutLoc); return(0,"*** $sbrName: not def frag!") if (! defined $frag); return(0,"*** $sbrName: not def dirWork!") if (! defined $dirWork); $fhSbr="STDOUT" if (! defined $fhSbr); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); # ------------------------------ $#kwdRmTmp=0; # temporary files $#beg=$#end=0; # ------------------------------ if ($frag){ # extract fragments? @tmp=split(/,/,$frag);$#beg=$#end=0; foreach $frag(@tmp){next if ($frag !~ /\-/);$frag=~s/\s//g; ($beg,$end)=split('-',$frag); next if ($beg =~/\D/ || $end =~ /\D/);push(@beg,$beg);push(@end,$end);}} # ------------------------------ # only to FASTA and FASTAmul if ($formOut eq "fasta" || $formOut eq "fastamul" ){ $Lone=$extr=0; # extract only some sequences? if ($formOut eq "fasta"){ $Lone=1;$extr=$extrIn;$extr=1 if (! defined $extr || $extr < 1);} if ($#beg>0){ # loop over fragments foreach $it (1..$#beg){ $fileOutTmp=$fileOutLoc;$fileOutTmp=~s/(\.$extOutLoc)/\_$beg[$it]\_$end[$it]$1/; $fragHere="$beg[$it]-$end[$it]"; ($Lok,$msg)= &convPir2fasta($fileInLoc,$fileOutTmp,$fragHere,$extr); return(0,"*** ERROR $sbrName: failed to convert pirmul to $formOut\n"."$msg\n") if (! $Lok); push(@fileOut,$fileOutTmp);}} else {$fragHere=0; ($Lok,$msg)= &convPir2fasta($fileInLoc,$fileOutLoc,$fragHere,$extr); return(0,"*** ERROR $sbrName: failed to convert pirmul to $formOut\n"."$msg\n") if (! $Lok); push(@fileOut,$fileOutLoc);}} else { return(2,"*** ERROR $sbrName: output option $formOut not supported for FSSP\n");} return(1,"ok $sbrName"); } # end of convPirmulGen #=============================================================================== sub convSeqGen { local($fileInLoc,$fileOutLoc,$formIn,$formOut,$extOutLoc, $exeConvSeq,$frag,$fileScreenLoc,$dirWork,$fhSbr) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # convSeqGen general converter for all sequence formats into -> x # in: for general info see 'convSeqGen' # out: converted file # out GLOBAL: @fileOut,@kwdRm,$file{"kwd"} files to remove # err: 0,$msg -> unspecified error # err: 1,$msg -> ok # err: 2,$msg -> conversion option not supported #------------------------------------------------------------------------------- $sbrName="$scrName:"."convSeqGen";$fhinLoc="FHIN"."$sbrName"; # ------------------------------ # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); return(0,"*** $sbrName: not def formIn!") if (! defined $formIn); return(0,"*** $sbrName: not def formOut!") if (! defined $formOut); return(0,"*** $sbrName: not def extOutLoc!") if (! defined $extOutLoc); return(0,"*** $sbrName: not def exeConvSeq!") if (! defined $exeConvSeq); return(0,"*** $sbrName: not def frag!") if (! defined $frag); return(0,"*** $sbrName: not def fileScreenLoc!") if (! defined $fileScreenLoc); return(0,"*** $sbrName: not def dirWork!") if (! defined $dirWork); $fhSbr="STDOUT" if (! defined $fhSbr); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); #return(0,"*** $sbrName: miss exe '$exeConvSeq'!") if (! -e $exeConvSeq && ! -l $exeConvSeq); $#beg=$#end=0; # ------------------------------ if ($frag){ # extract fragments? @tmp=split(/,/,$frag);$#beg=$#end=0; foreach $frag(@tmp){ next if ($frag !~ /\-/);$frag=~s/\s//g; ($beg,$end)=split('-',$frag); next if ($beg =~/\D/ || $end =~ /\D/);push(@beg,$beg);push(@end,$end);}} # ------------------------------ # only sequence formats if ($formOut eq "fasta" || $formOut eq "pir" || $formOut eq "gcg"){ if ($#beg>0){ # loop over fragments foreach $it (1..$#beg){ $fileOutTmp=$fileOutLoc;$fileOutTmp=~s/(\.$extOutLoc)/\_$beg[$it]\_$end[$it]$1/; $fragHere="$beg[$it]-$end[$it]"; ($Lok,$msg)= &convSeq2seq($fileInLoc,$formIn,$fileOutTmp,$formOut,$fragHere,$fileScreenLoc,$fhSbr); # ($Lok,$msg)= # &convSeq2seqOld($exeConvSeq,$fileInLoc,$fileOutTmp,$formOut,$fragHere,$fileScreenLoc,$fhSbr); return(0,"*** ERROR $sbrName: failed to convert fasta to $formOut\n"."$msg\n") if (! $Lok); push(@fileOut,$fileOutTmp);}} else {$fragHere=0; ($Lok,$msg)= &convSeq2seq($fileInLoc,$formIn,$fileOutLoc,$formOut,$fragHere,$fileScreenLoc,$fhSbr); # ($Lok,$msg)= # &convSeq2seqOld($exeConvSeq,$fileInLoc,$fileOutLoc,$formOut,$fragHere,$fileScreenLoc,$fhSbr); return(0,"*** ERROR $sbrName: failed to convert fasta to $formOut\n"."$msg\n") if (! $Lok); push(@fileOut,$fileOutLoc);}} # ------------------------------ # convert to SAF elsif ($formOut eq "saf" && $formIn eq "fasta"){ if ($#beg>0){ # loop over fragments foreach $it (1..$#beg){ $fileOutTmp=$fileOutLoc;$fileOutTmp=~s/(\.$extOutLoc)/\_$beg[$it]\_$end[$it]$1/; ($Lok,$id,$seq)=&fastaRdGuide($fileInLoc); $tmp{"seq","1"}=substr($seq,$beg[$it],($end[$it]-$beg[$it]+1)); $tmp{"NROWS"}= 1;$tmp{"id","1"}= $id; ($Lok,$msg)=&safWrt($fileOutTmp,%tmp); return(0,"*** ERROR $sbrName: failed to convert fasta to $formOut\n"."$msg\n") if (! $Lok); push(@fileOut,$fileOutTmp);}} else {$fragHere=0; ($Lok,$id,$tmp{"seq","1"})= &fastaRdGuide($fileInLoc); return(0,"*** ERROR $sbrName: failed to convert fasta to $formOut\n"."$msg\n") if (! $Lok); $id=~s/^(\S+).*$/$1/; $tmp{"NROWS"}= 1;$tmp{"id","1"}= $id; ($Lok,$msg)=&safWrt($fileOutLoc,%tmp); return(0,"*** ERROR $sbrName: failed to convert fasta to $formOut\n"."$msg\n") if (! $Lok); push(@fileOut,$fileOutLoc);}} else { return(2,"*** ERROR $sbrName: output option $formOut not supported for $formIn\n");} return(1,"ok $sbrName"); } # end of convSeqGen #=============================================================================== sub convPdbGen { local($fileInLoc,$chainInLoc,$fileOutLoc,$formOut,$extOutLoc,$frag,$dirWork,$fhSbr) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # convPdbGen general converter for all sequence formats into -> x # in: for general info see 'convPdbGen' # out: converted file # out GLOBAL: @fileOut,@kwdRm,$file{"kwd"} files to remove # err: 0,$msg -> unspecified error # err: 1,$msg -> ok # err: 2,$msg -> conversion option not supported #------------------------------------------------------------------------------- $sbrName="$scrName:"."convPdbGen";$fhinLoc="FHIN"."$sbrName"; # ------------------------------ # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def chainInLoc!") if (! defined $chainInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); return(0,"*** $sbrName: not def formOut!") if (! defined $formOut); return(0,"*** $sbrName: not def extOutLoc!") if (! defined $extOutLoc); return(0,"*** $sbrName: not def frag!") if (! defined $frag); return(0,"*** $sbrName: not def dirWork!") if (! defined $dirWork); $fhSbr="STDOUT" if (! defined $fhSbr); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); $#beg=$#end=0; # ------------------------------ if ($frag){ # extract fragments? @tmp=split(/,/,$frag);$#beg=$#end=0; foreach $frag(@tmp){ next if ($frag !~ /\-/);$frag=~s/\s//g; ($beg,$end)=split('-',$frag); next if ($beg =~/\D/ || $end =~ /\D/);push(@beg,$beg);push(@end,$end);}} # ------------------------------ # PDB return(2,"*** ERROR $sbrName: output option $formOut not supported for $formIn\n") if ($formOut !~/^(fasta|pir|gcg)/); if ($#beg>0){ # loop over fragments foreach $it (1..$#beg){ $fileOutTmp=$fileOutLoc;$fileOutTmp=~s/(\.$extOutLoc)/\_$beg[$it]\_$end[$it]$1/; # read sequence ($Lok,$msg)= &convPdb2seq($fileInLoc,$chainInLoc,$fileOutTmp,$formOut,$fragHere,$fhSbr); return(0,"*** ERROR $sbrName: failed to convert PDB to $formOut\n". "$msg\n") if (! $Lok); push(@fileOut,$fileOutTmp);}} else { $fragHere=0; ($Lok,$msg)= &convPdb2seq($fileInLoc,$chainInLoc,$fileOutLoc,$formOut,$fragHere,$fhSbr); return(0,"*** ERROR $sbrName: failed to convert PDB to $formOut\n". "$msg\n") if (! $Lok); push(@fileOut,$fileOutLoc); } return(1,"ok $sbrName"); } # end of convPdbGen #=============================================================================== sub wrtLoc { local($fhLoc)=@_; $[ =1 ; #------------------------------------------------------------------------------- # wrtLoc write onto screen where we are #------------------------------------------------------------------------------- # for many files to convert: do time estimate if ($nfileIn > 10) { $estimate= &fctRunTimeLeft($timeBeg,$nfileIn,$itFile); $estimate="?" if ($itFile < 5); $tmp= sprintf("%4d (%4.1f%-1s), time left=%-s", $itFile,(100*$itFile/$nfileIn),"%",$estimate); } else { $tmp="file no=".$itFile; } $tmpWrt= "$formIn -> $formOut: $fileIn -> $fileOutDef "; $tmpWrt.=$tmp; if( $par{debug} ){ print $fhLoc "$tmpWrt\n"; } } # end of wrtLoc 1; # vim:et:ai: librg-utils-perl-1.0.43/lib/RG/Utils/Hssp_filter.pm0000644015075101507510000041356211640614764016753 00000000000000=pod =head1 NAME RG::Utils::Hssp_filter - Rost Lab perl utilities =head1 SYNOPSIS use RG::Utils::Hssp_filter; =head1 FUNCTIONS See module source for description. =over =item brIniErr =item brIniGetArg =item brIniHelp =item brIniHelpLoop =item brIniHelpRdItself =item brIniRdDef =item brIniSet =item brIniWrt =item cleanUp =item complete_dir =item completeDir =item errSbrMsg =item fctRunTimeLeft =item fctSeconds2time =item get_in_keyboard =item get_range =item get_rangeHyphen =item getSysARCH =item getYcurveIde =item getYcurveOld =item getYcurveSim =item hsspFilter =item hsspFilterGetCurveIde =item hsspFilterGetCurveMinMaxIde =item hsspFilterGetCurveMinMaxSim =item hsspFilterGetCurveOld =item hsspFilterGetCurveSim =item hsspFilterGetPosExcl =item hsspFilterGetPosIncl =item hsspFilterGetRuleBoth =item hsspFilterGetRuleSgi =item hsspFilterMarkFile =item hssp_filterSbr =item hsspGetFile =item hsspGetFileLoop =item hsspRdHeader =item ini =item iniDef =item is_hssp =item is_hssp_empty =item is_pdbid =item maxhomGetThresh =item open_file =item sysCpfile =item sysDate =item sysGetPwd =item sysGetUserLoc =item sysRunProg =back =head1 VARIABLES =over =back =head1 AUTHOR B. Rost =head1 SEE ALSO =over =item Main website L =back =cut #------------------------------------------------------------------------------# # Copyright 1998 # # Burkhard Rost rost@EMBL-Heidelberg.DE # # Wilckensstr. 15 http://www.embl-heidelberg.de/~rost/ # # D-69120 Heidelberg # # version 1.0 May, 1998 # # version 1.1 Oct, 1998 # #------------------------------------------------------------------------------# package RG::Utils::Hssp_filter; use Carp; use File::Temp; no warnings 'deprecated'; INIT: { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $scrName=$0; $scrName=~s/^.*\/|\.pl//g; $scrGoal= "filters HSSP files\n"; $scrIn= "files (or list thereof, note: for lists give kwd 'list'"; $scrNarg= 1; # minimal number of input arguments $scrHelpTxt= "You can specify the filtering in various ways:\n"; $scrHelpTxt.=" - exclude by position (e.g. excl=1-5,7,9-11,30-*)\n"; $scrHelpTxt.=" - include by position (e.g. incl=1-5,7,9-11,30-*)\n"; $scrHelpTxt.=" - include by sequence identity|similarity (see help 'sim|ide|thresh|mode' \n"; $scrHelpTxt.=" - exclude mutually too similar pairs (too redundant alis, red=80, see help red)\n"; $scrHelpTxt.=" - exclude too short alignments (e.g. minLen=40)\n"; $scrHelpTxt.=" \n"; $scrHelpTxt.="Example:\n"; $scrHelpTxt.=" hssp_filter file.hssp red=80 threshSgi=-10 thresh=0 mode=ide\n"; # $scrHelpTxt.=" \n"; $scrHelpTxt.=" \n"; # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } #=============================================================================== sub hssp_filterSbr { #------------------------------------------------------------------------------- # hssp_filterSbr package version of script #------------------------------------------------------------------------------- $[ =1 ; # sets array count to start at 1, not at 0 @PARAMS=@_; # pass from calling # ------------------------------ # initialise variables # @PARAMS=split(/\s+/,&get_in_keyboard("command line")); # x.x mac specific # ------------------------------ # initialise variables ($Lok,$msg)= &ini(); if (! $Lok) { warn "*** ERROR $scrName after ini\n".$msg ; Carp::confess( "*** during initialising $scrName" );} #------------------------------------------------------------------------------- # do the job (here we go) #------------------------------------------------------------------------------- $fh="STDOUT" if ($Lverb); $fh=$fhTrace if (! $Lverb); $#fileOutOk=0; # -------------------------------------------------- foreach $it (1..$#fileIn){ # loop over all input files print $fh "--- $scrName \t $fileIn[$it] -> $fileOut[$it]\n" if ($par{"verbose"}); if ($par{"skipExisting"} && -e $fileOut[$it]){ print $fh "--- $scrName skipped since $fileOut[$it] existing\n"; next;} if (! $par{"doTable"}) { $fileOutTable=0;} elsif (! defined $par{"fileOutTable"} || $par{"fileOutTable"} eq "1" || length($par{"fileOutTable"})<=1 || $par{"fileOutTable"} eq "unk"){ $fileOutTable=1;} else{ $fileOutTable=$par{"fileOutTable"};} ($Lok,$msg,@fileRm)= &hsspFilter($fileIn[$it],$fileOut[$it],$par{"exeFilterHssp"},$par{"fileMatGcg"}, $par{"inclPos"},$par{"exclPos"},$par{"minLen"},$par{"maxLen"}, $par{"minIde"},$par{"maxIde"},$par{"minSim"},$par{"maxSim"}, $par{"thresh"},$par{"threshSgi"},$par{"threshBoth"},$par{"mode"}, $fileOutTable,$par{"redRed"}, $par{"dirWork"},$par{"debug"},$par{"jobid"},$par{"fileOutScreen"},$fh); print $fh "--- $scrName \t ok $fileOut[$it]\n" if ($par{"verbose"} && $Lok); print $fh "*** ERROR $scrName: no $fileOut[$it] (from ". "$fileIn[$it])\n$msg\n" if (! $Lok); push(@fileOutOk,$fileOut[$it]) if ($Lok); # ------------------------------ # estimate time if ($#fileIn > 10 && $par{"verbose"} && $Lok) { $estimate= &fctRunTimeLeft($timeBeg,$#fileIn,$it); $estimate="?" if ($it < 5); printf $fh "--- %-40s %4d (%4.1f%-1s), time left=%-s\n", $fileIn[$it],$it,(100*$it/$#fileIn),"%",$estimate; } } #------------------------------------------------------------------------------- # work done, go home #------------------------------------------------------------------------------- # ------------------------------ # deleting intermediate files &cleanUp($fh) if (! $par{"debug"}); # ------------------------------ # final words if ($Lverb) { print $fh "--- $scrName ended fine .. -:\)\n" if ($#fileOutOk>0); print $fh "*** $scrName failed nicely .. -:\)\n" if ($#fileOutOk==0); # ------------------------------ $timeEnd=time; # runtime , run time $timeRun=$timeEnd-$timeBeg; print $fh "--- date \t \t $Date \n", "--- run time \t \t ",&fctSeconds2time($timeRun)," (hour:min:sec)\n"; # ------------------------------ # output files print $fh "--- \n"; # print $fh "--- output file";print $fh "s" if ($#fileOut>1); print $fh ":\n"; foreach $_(@fileOutOk){ printf $fh "--- %-20s %-s\n"," ",$_ if (-e $_);}} return(1,"ok $sbrName"); # } # end of hssp_filterSbr #=============================================================================== sub ini { $[ =1 ; #------------------------------------------------------------------------------- # initialises variables/arguments #------------------------------------------------------------------------------- $sbrName="$scrName".":ini"; # ------------------------------ # get user name $USERID=&sysGetUserLoc(); # ------------------------------ foreach $arg (@PARAMS){ # highest priority arguments next if ($arg !~/=/); if ($arg=~/dirLib=(.*)$/) { $dir= $1;} elsif ($arg=~/dirHome=(.*)$/i) { $par{"dirHome"}=$1;} elsif ($arg=~/PWD=(.*)$/i) { $PWD= $1;} elsif ($arg=~/^ARCH=(.*)$/i) { $ARCH= $1;} elsif ($arg=~/^packName=(.*)/|| $arg=~/^pack=(.*)/ ) { $par{"packName"}=$1; shift @PARAMS if ($PARAMS[1] eq $arg); } } return(&errSbrMsg("after $0:", "missing dirHome, please add the command line option:\n". "dirHome=THE_PATH_WHERE_THIS_SCRIPT_SITS",$SBR)) if( !$par{dirHome} || !-e $par{dirHome} ); $par{"dirPerl"}= $par{"dirHome"}."/scr/"; # directory for perl scripts needed $ARCH=$ENV{'ARCH'} if (! defined $ARCH && defined $ENV{'ARCH'}); $ARCH=$ARCH || 0; # try to determine archictecture (ARCH) if (! $ARCH) { $ARCH=&getSysARCH(0); if (! $ARCH) { $ARCH="LINUX"; # default ARCH print "*** WARN $sbrName: failed to get machine architecture!\n"; print "*** please provide the following argument on the command line:\n"; print "*** ARCH=ARCHITECTURE\n"; print "*** where ARCHITECTURE is e.g. SGI64, SGI32, SUNMP, ALPHA\n"; print "*** DEFAULT taken:\n"; print "*** \n"; print "*** ARCH=$ARCH\n"; print "*** \n"; print "*** NOTE if this is wrong the program will not run correctly!\n"; }} # local dir if (! defined $PWD || ! -e $PWD) { $PWD=&sysGetPwd(); } $pwd= $PWD if (defined $PWD && -d $PWD); $pwd.="/" if (defined $pwd && $pwd !~ /\/$/); # ------------------------------ $timeBeg= time; # date and time $Date= &sysDate(); # ------------------------------ # first settings for parameters &iniDef(); # NOTE: may be overwritten by DEFAULT file!!!! # ------------------------------ # HELP stuff # standard help $tmp=0; $tmp=$par{"packName"} if (defined $par{"packName"}); # lkajan: not entirely sure - sourceFile is supposed to be module or command name? #if( !$tmp ) { $tmp = __FILE__; } $tmp=$0 if (! defined $tmp || ! $tmp); %tmp=('sourceFile', $tmp, 'scrName',$scrName, 'scrIn',$scrIn, 'scrGoal', $scrGoal, 'scrNarg',$scrNarg, 'scrHelpTxt', $scrHelpTxt); $tmp{"scrNameFull"}=$0; # special help $tmp{"scrAddHelp"}= ""; $tmp{"special"}= "table,list,red,curve,exe,minLen,len,skip,"; $tmp{"skip"}= "no job if output file existing"; $tmp{"table"}= "shortcut for doTable=1, write table of pairwise sequence ide (all-against-all)\n"; $tmp{"list"}= "shortcut for isList=1, i.e. input file is list of files"; $tmp{"red"}= "=N : shortcut for redRed=N\n"; $tmp{"minLen"}= "=INTEGER -> all alignments shorter than this excluded\n"; $tmp{"len"}= $tmp{"minLen"}; $tmp{"scrAddHelp"}.="help curve : general info about the HSSP curves, distances, thresholds\n"; $tmp= "--- "; # $tmp= "--- "; $tmp{"exe"}= "=x OR exeFilterHssp=x -> FORTRAN executable"; # "------------------------------------------------------------\n"; $tmp{"help curve"}= "\n"; $tmp= "--- "; $tmp{"help curve"}.= "--- concept of filter (HSSP curve)\n"; $tmp{"help curve"}.=$tmp."The general concept is to filter pairs that are not signifi-\n"; $tmp{"help curve"}.=$tmp."cantly sequence similar to the guide sequence to assure the\n"; $tmp{"help curve"}.=$tmp."structural similarity between the aligned protein pair. The\n"; $tmp{"help curve"}.=$tmp."notion of SIGNIFICANT is taken from analysing a large data\n"; $tmp{"help curve"}.=$tmp."set of protein pairs of known structure. For details see:\n"; $tmp{"help curve"}.=$tmp." http://www.embl-heidelberg.de/~rost/Papers/98curve.html\n"; $tmp{"help curve"}.=$tmp." -> well, soon you may access that site...\n"; $tmp{"help curve"}.=$tmp." (Meanwhile: Sander & Schneider, Proteins, 1991, 9, 56-68.)\n"; $tmp{"help curve"}.=$tmp." \n"; $tmp{"help curve"}.=$tmp."All distances, and thresholds are compiled as distances from\n"; $tmp{"help curve"}.=$tmp."an alignment-dependent cut-off for significant homology. \n"; # "------------------------------------------------------------\n"; $tmp{"help curve"}.= "--- thresh=I, with: -75 <= I <= 75 \n"; $tmp{"help curve"}.=$tmp."All alignments further away from the threshold curve than I\n"; $tmp{"help curve"}.=$tmp."are excluded. Three modes of curves are available:\n"; $tmp{"help curve"}.= "--- mode=[ide|sim|ruleBoth|ruleSgi|old] \n"; $tmp{"help curve"}.=$tmp."ide -> filter with to new (1998) identity curve\n"; $tmp{"help curve"}.=$tmp."sim -> filter with to new (1999) similarity curve\n"; $tmp{"help curve"}.=$tmp."old -> filter with to old (1991) identity curve\n"; $tmp{"help curve"}.=$tmp."ruleBoth : see below\n"; $tmp{"help curve"}.=$tmp."ruleBoth : see below\n"; $tmp{"help curve"}.= "--- [ruleSgi|ruleBoth] \n"; $tmp{"help curve"}.=$tmp."Rules (ruleBoth, ruleSgi) implement simple rules-of-thumb to\n"; $tmp{"help curve"}.=$tmp."increase the chance of structural similarity (in particular:\n"; $tmp{"help curve"}.=$tmp." ruleSgi = include all with similarity > identity\n"; $tmp{"help curve"}.=$tmp."proved to be extremely powerful (however, at the expense of\n"; $tmp{"help curve"}.=$tmp."low coverage (i.e. not many pairs fulfill this constraint).\n"; $tmp{"help curve"}.= "--- threshSgi=I, with: -75 <= I <= 75 \n"; $tmp{"help curve"}.=$tmp."1. sets mode to 'ruleSgi', i.e. all pairs with similarity >\n"; $tmp{"help curve"}.=$tmp." identity are included. \n"; $tmp{"help curve"}.=$tmp."2. the minimal threshold for which the rule is applied is I \n"; # "------------------------------------------------------------\n"; $tmp{"help curve"}.= "--- red=I , with 0 < I <= 100 \n"; $tmp{"help curve"}.=$tmp."The in-built reduction of redundancy ('help red') is crucial\n"; $tmp{"help curve"}.=$tmp."to improve the accuracy of the current version of PHD. E.g.:\n"; $tmp{"help curve"}.=$tmp." redRed=80 \n"; $tmp{"help curve"}.=$tmp."will exclude all pairs with more than 80% pairwise sequence\n"; $tmp{"help curve"}.=$tmp."identity. (Note: values of redRed=80-90 are highly recommen-\n"; $tmp{"help curve"}.=$tmp."ded for running PHD.)\n"; # "------------------------------------------------------------\n"; $tmp{"help curve"}.= "--- [minLen|maxLen|minIde|maxIde|minSim|maxSim]=I\n"; $tmp{"help curve"}.=$tmp."Maximal or minimal values for sequence length (Len), identi-\n"; $tmp{"help curve"}.=$tmp."ty (Ide), and similarity (Sim).\n"; # "------------------------------------------------------------\n"; $tmp{"help curve"}.= "--- \\\\\\ Suggested for running PHD: ///\n"; $tmp{"help curve"}.= "--- ++> red=90 thresh=-2 threshSgi=-10 <++\n"; $tmp{"help curve"}.= "--- /// \\\\\\\n"; # $tmp{"help curve"}.=$tmp."\n"; # "------------------------------------------------------------\n"; $tmp{"curve"}=$tmp{"help curve"}; $tmp{"s_k_i_p"}="manual,problems,hints"; if ($#PARAMS > 1 && "$PARAMS[1] $PARAMS[2]" eq "help curve") { ($Lok,$msg)= &brIniHelp(%tmp); return(0,"*** ERROR $sbrName: after copf.pm:brIniHelp\n". $msg) if (! $Lok); exit; } ($Lok,$msg)= # want help? &brIniHelpLoop($scrName, %tmp); return(0,"*** ERROR $sbrName: after copf.pm:brIniHelp\n". $msg) if (! $Lok); if ($msg eq "fin") {print "--- suggest \n". "copf.pm help curve\n"; exit;} # ------------------------------ # read command line input @argUnk= # standard command line handler &brIniGetArg(); $LruleBoth=$LruleSgi=0; foreach $arg (@argUnk){ # interpret specific command line arguments next if ($arg=~/^(dirLib|ARCH|PWD|packName)=/); if ($arg=~/^list$/i) { $par{"isList"}= 1;} elsif ($arg=~/^de?bu?g$/i) { $par{"debug"}= 1;} # dbg elsif ($arg=~/^table$/i) { $par{"doTable"}= 1;} elsif ($arg=~/^nice-(\d+)$/) { $par{"optNice"}= "nice -".$1;} elsif ($arg=~/^red=(\d+)/i) { $par{"redRed"}= $1;} elsif ($arg=~/^incl=(.*)/i) { $par{"inclPos"}= $1;} elsif ($arg=~/^excl=(.*)/i) { $par{"exclPos"}= $1;} elsif ($arg=~/^exe=(.*)/i) { $par{"exeFilterHssp"}=$1; } elsif ($arg=~/^ide=(.*)/i) { $par{"minIde"}= $1; } elsif ($arg=~/^len=(.*)/i) { $par{"minLen"}= $1; } elsif ($arg=~/^minLen=(.*)/i) { $par{"minLen"}= $1; } elsif ($arg=~/^maxLen=(.*)/i) { $par{"maxLen"}= $1; } elsif ($arg=~/^ruleBoth/i) { $LruleBoth= 1; } elsif ($arg=~/^ruleSgi/i) { $LruleSgi= 1; } elsif ($arg=~/^skip$/) { $par{"skipExisting"}= 1; } elsif ($arg=~/^fileOut=(.*)/i) { $par{"fileOut"}= $1; } elsif ($arg=~/^no[t]?_?scr[en]*$/i) { $Lverb=$Lverb2= $par{"verbose"}=$par{"verb2"}=0; } elsif ($arg eq "nonice") { $par{"optNice"}= "";} else { Carp::confess( "kwd '$arg' not understood: $0 @PARAMS" ); return(0,"*** ERROR $sbrName: kwd '$arg' not understood\n");}} # ------------------------------ # correct for modes $par{"mode"}=$par{"modeDef"} if (! $par{"mode"} && (length($par{"thresh"}) > 0 || length($par{"threshSgi"}) > 0 || length($par{"threshBoth"}) > 0)); $par{"mode"}.=",ruleBoth" if ($LruleBoth || length($par{"threshBoth"}) > 0); $par{"mode"}.=",ruleSgi" if ($LruleSgi || length($par{"threshSgi"}) > 0); # ------------------------------ # hierarchy of blabla $par{"verb2"}=1 if ($par{"debug"}); $par{"verbose"}=1 if ($par{"verb2"}); $Lverb= $par{"verbose"} if (defined $par{"verbose"} && $par{"verbose"}); $Lverb2=$par{"verb2"} if (defined $par{"verb2"} && $par{"verb2"}); # ------------------------------ # directories: add '/' foreach $kwd (keys %par) { next if ($kwd !~/^dir/); next if (length($par{"$kwd"})==0 || $par{"$kwd"} eq "unk" ); $par{"$kwd"}.="/" if ($par{"$kwd"} !~ /\/$/);} # -------------------------------------------------- # digest input file formats # -------------------------------------------------- # automatic list finding.. $par{"isList"}=1 if ($fileIn[1] =~/\.list$/); # read list $#fileMissing=0; if (defined $par{"isList"} && $par{"isList"} eq "1"){ # input is file list &open_file("$fhin","$fileIn[1]") || return(0,"*** ERROR $sbrName: failed to open fileIn=$fileIn\n"); $#fileIn= 0 if ($#fileIn==1); while (<$fhin>) { $_=~s/\s|\n//g;$file=$_; if (-e $file){ push(@fileIn,$file);} else { # search for it ($fileOk,$tmp)=&hsspGetFile($file,"STDOUT",$par{"dirHssp"}); if ($fileOk && -e $fileOk) { push(@fileIn,$fileOk); push(@fileMissing,$file);} else { print "--- missing $file \n" if ($par{"verbose"}); push(@fileMissing,$file);} } }close($fhin); # ------------------------------ # write record of missing files if ($#fileMissing>=1){ $fileMissing="MISSING_FILES_".$scrName; $fileMissing=~s/\s|\..*$//g; print "--- NOTE $sbrName: write file of missing files=$fileMissing\n"; # if ($par{"verbose"}); $fhout_miss= "FHOUT_MISSING"; open($fhout_miss,">".$fileMissing) || Carp::confess( "failed to open $fileMissing: $!" ) || warn("*** ERROR $sbrName: failed opening fileMissing=$fileMissing!\n"); foreach $file (@fileMissing){ print $fhout_miss "$file\n";} close($fhout_miss);} } # ------------------------------ # final settings $Lok= # standard settings &brIniSet(); return(0,"*** ERROR $sbrName: after copf.pm:brIniSet\n") if (! $Lok); return(0,"*** ERROR $sbrName: no input file given!!\n") if ($#fileIn==0); $#fileOut=0; # reset output files if (defined $fileOut && $fileOut && length($fileOut) > 1){ $par{"fileOut"}=$fileOut;} elsif (defined $par{"fileOut"} && $par{"fileOut"} ne "unk" && $par{"fileOut"} && length($par{"fileOut"}) > 1){ $fileOut=$par{"fileOut"}; } if (! defined $fileOut || ! $fileOut || length($fileOut)<1){ foreach $it (1..$#fileIn){ $tmp=$fileIn[$it]; $tmp=~s/^.*\///g;$tmp=~s/$par{"extHssp"}//g; $fileOut=$par{"dirOut"}.$tmp.$par{"extOut"}; push(@fileOut,$fileOut);}} else{ push(@fileOut,$fileOut);} # correct settings for executables: add directories if (0){ foreach $kwd (keys %par){ next if ($kwd !~/^exe/); next if (-e $par{"$kwd"} || -l $par{"$kwd"}); } } $exclude="exe,xyz"; # xyz to exclude from error check # ------------------------------ ($Lok,$msg)= # check errors &brIniErr($exclude); return(0,"*** ERROR $sbrName: after copf.pm:brIniErr\n".$msg) if (! $Lok); # ------------------------------ # massage temporary files if ($par{"dirWork"} && $par{"dirWork"} ne "unk" && length($par{"dirWork"}) > 0) { $par{"fileOutTrace"}= $par{"dirWork"}.$par{"fileOutTrace"} if ($par{"fileOutTrace"} !~ /$par{"dirWork"}/ && defined $par{"fileOutTrace"} && $par{"fileOutTrace"} ne "unk" && length($par{"fileOutTrace"}) > 0); $par{"fileOutScreen"}=$par{"dirWork"}.$par{"fileOutScreen"} if ($par{"fileOutScreen"} !~ /$par{"dirWork"}/ && defined $par{"fileOutScreen"} && $par{"fileOutScreen"} ne "unk" && length($par{"fileOutScreen"}) > 0); } # ------------------------------ # trace file if( $par{"fileOutTrace"} && $par{"fileOutTrace"} ne "unk" && length($par{"fileOutTrace"}) > 0 && ! $par{"debug"} ){ print "--- \t open $fhTrace for trace file ",$par{"fileOutTrace"}," \n" if ($Lverb2); &open_file( $fhTrace,">".$par{"fileOutTrace"}) || return(0,"*** ERROR $sbrName: failed to open new file for trace : $par{fileOutTrace}\n"); } else { $fhTrace = \*STDERR; } # ------------------------------ # write settings if ($par{"verbose"}){ ($Lok,$msg)= &brIniWrt($exclude,$fhTrace); return(0,"*** ERROR $sbrName: after copf.pm:brIniWrt\n". $msg) if (! $Lok);} $optNice=$par{"optNice"}; if ($optNice=~/nice\s*-/){$optNice=~s/nice-/nice -/; $tmp=$optNice;$tmp=~s/\s|nice|\-|\+//g; setpriority(0,0,$tmp) if (length($tmp)>0);} # ------------------------------ undef %tmp; # clean memory return(1,"ok $sbrName"); } # end of ini #=============================================================================== sub iniDef { $[ =1 ; #------------------------------------------------------------------------------- # iniDef initialise defaults #------------------------------------------------------------------------------- # d.d # -------------------- # directories $par{"dirSrc"}= $par{"dirHome"}. "/lib/"; # all source except for binaries $par{"dirSrcMat"}= $par{"dirSrc"}. "mat/"; # general material $par{"dirPerl"}= $par{"dirSrc"}. "perl/" # perl libraries if (! defined $par{"dirPerl"}); $par{"dirPerlScr"}= $par{"dirPerl"}. "scr"; # perl scripts needed $par{"dirBin"}= $par{"dirHome"}. "/bin/"; # FORTRAN binaries of programs needed # lkajan: there's got to be a better way to do this # if ($0=~/maxhom/){ # $par{"dirSrc"}= $par{"dirHome"}. "scr/"; # all source except for binaries # $par{"dirSrcMat"}= $par{"dirHome"}. "mat/"; # general material # $par{"dirPerl"}= $par{"dirHome"}. "scr/" if (! defined $par{"dirPerl"}); # $par{"dirPerlScr"}= $par{"dirHome"}. "scr/"; # perl scripts needed # } # <<<<<<<<<<<<<<<<<<<< # for porting PHD asf # lkajan: there's got to be a better way to do this # if( $0=~/phd/ ){ # $par{"dirSrcMat"}= "/nfs/home1/yachdav/work/SNAP/phd/". "mat/"; # general material # $par{"dirPerl"}= "/nfs/home1/yachdav/work/SNAP/phd/". "scr/"; # perl libraries # $par{"dirPerlScr"}= "/nfs/home1/yachdav/work/SNAP/phd/". "scr/"; # perl scripts needed # $par{"dirBin"}= "/nfs/home1/yachdav/work/SNAP/phd/". "bin/"; # FORTRAN binaries of programs needed # } # elsif( $0=~/prof/ ){ $par{"dirSrcMat"}= "$par{dirHome}/mat/"; # general material #$par{"dirPerl"}= "$par{dirHome}embl/scr/"; # perl libraries # lkajan: deprecated #$par{"dirPerlScr"}= "$par{dirHome}embl/scr/"; # perl scripts needed # lkajan: wrong $par{"dirBin"}= "/usr/bin/"; # FORTRAN binaries of programs needed # } $par{"dirConvertSeq"}= $par{"dirBin"}; $par{"dirOut"}= ""; # directory for output files $par{"dirWork"}= ""; # working directory # databases to search for files $par{"dirHssp"}= "/home/rost/data/hssp/,/data/hssp/"; # additional user specified db # further on work # -------------------- # files # $par{"title"}= "unk"; # output files will be called 'Pre-title.ext' $par{"fileOut"}= 0; $par{"fileOutTable"}= 0; # file with the table of the pairwise distances (you must activate the # option by 'doTable=1' or 'table' on the command line # lkajan: I see no reason to /set/ these by default #$par{"fileOutTrace"}= "HSSPFIL-TRACE-". "jobid".".tmp"; # file tracing some warnings and errors #$par{"fileOutScreen"}= "HSSPFIL-SCREEN-"."jobid".".tmp"; # file dumping the screen for convert_seq output $par{"fileOutTrace"}= ''; $par{"fileOutScreen"}= ''; $par{"fileHelpMan"}= "unk"; # file with manual $par{"fileHelpOpt"}= "unk"; # file with options $par{"fileHelpHints"}= "unk"; # file with hints, note: also passed as par{scrHelpHints} $par{"fileHelpProblems"}= "unk"; # file with known problems, also passed as par{scrHelpProblems} # file extensions # $par{"preOutTmp"}= "Out-"; $par{"extOut"}= "-fil.hssp"; # extension added to output file name (extHssp in input file will be # replaced by extOut, chains added before that) $par{"extOutTable"}= ".distance_tab"; $par{"extHssp"}= ".hssp"; # expected extension of HSSP file # file handles $fhin= "FHIN"; $fhTrace= "FHTRACE"; # -------------------- # job control $par{"jobid"}= "jobid"; # unique job identifier (set to $$ if not defined) $par{"debug"}= 0; # if 1 : keep (most) temporary files $par{"verbose"}=$Lverb= 0; # blabla on screen $par{"verb2"}=$Lverb2= 0; # more verbose blabla $par{"optNice"}= ""; # "nice -15 " # -------------------- # parameters $par{"skipExisting"}= 0; # skip if output file already there $par{"doTable"}= 0; # also write the distance table $par{"exclPos"}= 0; # exclude particular positions = '1' | '1-5' | '1,3,7' | '1-5,7' $par{"inclPos"}= 0; # include particular positions = '1' | '1-5' | '1,3,7' | '1-5,7' $par{"minLen"}= 0; # exclude alignments shorter than this $par{"maxLen"}= 0; # exclude alignments longer than this $par{"minIde"}= 0; # exclude if below minimal distance for thresholds on identity $par{"maxIde"}= 0; # exclude if above maximal distance for thresholds on identity $par{"minSim"}= 0; # exclude if below minimal distance for thresholds on similarity $par{"maxSim"}= 0; # exclude if above maximal distance for thresholds on similarity $par{"thresh"}= ""; # include all above threshold (given as percentage distance from HSSP curves) $par{"threshSgi"}= ""; # include if SIM > IDE and both above threshSgi $par{"threshBoth"}= ""; # include if SIM and IDE both above threshBoth $par{"mode"}= 0; # specifies the mode of applying the thresholds 'thresh' and 'treshSgi': # = 'ide|sim|ruleBoth|ruleSgi|old' (or combination separated by ' ') # - mode must be defined to use rule, or thresh, or threshSgi!! # - for additional filter on old threshold add 'old' $par{"modeDef"}= "ide"; # default mode when keywords thresh|threshSgi used # $par{"modeDef"}= "old"; # default mode when keywords thresh|threshSgi used $par{"redRed"}= 0; # reduce redundancy, i.e., exclude all pairs with pairwise sequence # identity higher than value given (integer for percenge seq ide!). # note: exclusion in the order of appearance in the HSSP file $par{"fileMatGcg"}= $par{"dirSrcMat"}. "Maxhom_GCG.metric"; # MAXHOM-GCG matrix # $par{"fileMatGcg"}= $par{"dirSrcMat"}. "Maxhom_McLachlan.metric"; # MAXHOM-GCG matrix # $par{"fileMatGcg"}= $par{"dirSrcMat"}. "Maxhom_Blosum.metric"; # MAXHOM-GCG matrix # needed for conversion into HSSP format! # -------------------- # executables # $par{"exeConvertSeq"}= $par{"dirBin"}. "convert_seq"; $par{"exeFilterHssp"}= "filter_hssp"; # FORTRAN excutable # $par{"exeFilterHssp"}= "/home/rost/lion/src-lib/filter_hssp"; # FORTRAN excutable } # end of iniDef #============================================================================== # library collected (begin) #============================================================================== #============================================================================== sub brIniErr { local($local)=@_; $[ =1 ; #------------------------------------------------------------------------------- # brIniErr error check for initial parameters # in GLOBAL: $par{},@PARAMS # in: $exceptions = 'kwd1,kwd2' # key words not to check for file existence # out: ($Lok,$msg) #------------------------------------------------------------------------------- $sbrName="$scrName:"."brIniErr"; @kwd= keys (%par) if (%par); # ------------------------------ undef %tmp; $#excl=0; # exclude some keyword from check? @excl=split(/,/,$local) if (defined $local); if ($#excl>0){ foreach $kwd(@excl){ $tmp{"$kwd"}=1;}} $msgHere=""; # ------------------------------ foreach $kwd (@kwd){ # file existence next if ($kwd =~ /^file(Out|Help|Def)/i); next if (defined $tmp{"$kwd"}); if ($kwd=~/^exe/) { # $msgHere.="*** ERROR executable ($kwd) '".$par{"$kwd"}."' missing!\n" # if (! -e $par{"$kwd"} && ! -l $par{"$kwd"}); # $msgHere.="*** ERROR executable ($kwd) '".$par{"$kwd"}."' not executable!\n". # "*** do the following \t 'chmod +x ".$par{"$kwd"}."'\n" # if (! -x $par{"$kwd"}); } elsif($kwd=~/^file/){ next if ($par{"$kwd"} eq "unk" || length($par{"$kwd"})==0 || !$par{"$kwd"}); $msgHere.= "*** ERROR file ($kwd) '".$par{"$kwd"}."' missing! ".Carp::longmess if (! -e $par{"$kwd"} && ! -l $par{"$kwd"});} # } return(0,$msgHere) if ($msgHere=~/ERROR/); return(1,"ok $sbrName"); } # end of brIniErr #============================================================================== sub brIniGetArg { $[ =1 ; #------------------------------------------------------------------------------- # brIniGetArg standard reading of command line arguments # in GLOBAL: @PARAMS,$defaults{},$par{} # out GLOBAL: $par{},@fileIn # out: @arg_not_understood (i.e. returns 0 if everything ok!) #------------------------------------------------------------------------------- $sbrName="lib-br:"."brIniGetArg"; $#argUnk=0; # ------------------------------ # (1) get input directory foreach $arg (@PARAMS){ # search in command line if ($arg=~/^dirIn=(.+)$/){$par{"dirIn"}=$1; last;}} # search in defaults if ((! defined $par{"dirIn"} || ! -d $par{"dirIn"}) && %defaults){ if (defined $defaults{"dirIn"}){ $par{"dirIn"}=$defaults{"dirIn"}; $par{"dirIn"}=$PWD if (defined $PWD && ($par{"dirIn"}=~/^(local|unk)$/ || length($par{"dirIn"})==0));}} $par{"dirIn"}.="/" if (defined $par{"dirIn"} && -d $par{"dirIn"} && $par{"dirIn"}!~/\/$/); # slash $par{"dirIn"}="" if (! defined $par{"dirIn"} || ! -d $par{"dirIn"}); # empty # ------------------------------ if (%par){ # all keywords used in script @tmp=sort keys (%par);} else{ $#tmp=0;} $Lverb3=0 if (! defined $Lverb3); $Lverb2=0 if (! defined $Lverb2); $#fileIn=0; # ------------------------------ foreach $arg (@PARAMS){ # (2) key word driven input if ($arg=~/^verb\w*3=(\d)/) {$par{"verb3"}=$Lverb3=$1;} elsif ($arg=~/^verb\w*3/) {$par{"verb3"}=$Lverb3=1;} elsif ($arg=~/^verb\w*2=(\d)/) {$par{"verb2"}=$Lverb2=$1;} elsif ($arg=~/^verb\w*2/) {$par{"verb2"}=$Lverb2=1;} elsif ($arg=~/^verbose=(\d)/) {$par{"verbose"}=$Lverb=$1;} elsif ($arg=~/^verbose/) {$par{"verbose"}=$Lverb=1;} elsif ($arg=~/^not_?([vV]er|[sS]creen)/) {$par{"verbose"}=$Lverb=0; } else {$Lok=0; # general if (-e $arg && ! -d $arg){ # is it file? $Lok=1;push(@fileIn,$arg);} if (! $Lok && length($par{"dirIn"})>1 && -e $par{"dirIn"}.$arg){ $Lok=1;push(@fileIn,$par{"dirIn"}.$arg);} # any of the paras defined ? if (! $Lok && $arg=~/=/){ foreach $kwd (@tmp){ if ($arg=~/^$kwd=(.+)$/){$Lok=1;$par{"$kwd"}=$1; last;}}} push(@argUnk,$arg) if (! $Lok);}} return(@argUnk); } # end of brIniGetArg #============================================================================== sub brIniHelp { local(%tmp)=@_; $[ =1 ; #------------------------------------------------------------------------------- # brIniHelp initialise help text # out: \d,txt # err: 0,$msg -> error # err: 1,'fin' -> wanted help, given help # err: 1,$msg -> continue, was just trying # in: $tmp{} with # $tmp{sourceFile}= name and path of calling script # $tmp{scrName}= name of calling script (no .pl) # $tmp{scrIn}= input arguments for script # $tmp{scrGoal}= what script does # $tmp{scrNarg}= number of argument needed for script # $tmp{scrHelpTxt}= long blabla about script # separate by '\n' # $tmp{scrAddHelp}= help option other than standard # e.g.: "help xyz : explain .xyz " # many: '\n' separated # NOTE: this will be an entry to $tmp{$special}, # -> $special = 'help xyz' will give explanation # $tmp{$special} # $tmp{special}= 'kwd1,kwd2,...' special keywords # $tmp{$special}= explanation for $special # syntax: print flat lines (or '--- $line'), separate by '\n' # $tmp{scrHelpHints}= hints (tab separated) # $tmp{scrHelpProblems}= known problems (tab separated) # in GLOBULAR: @PARAMS # $par{fileHelpOpt} # $par{fileHelpMan} # $par{fileHelpHints} # $par{fileHelpProblems} # $par{fileDefautlts} # in unk: leave undefined, or give value = 'unk' #------------------------------------------------------------------------------- $sbrName="lib-br:brIniHelp"; # ------------------------------ # check input if (0){ foreach $kwd ("sourceFile","scrName","scrIn","scrGoal", "scrNarg","scrAddHelp","special"){ print "--- input to $sbrName kwd=$kwd, val=",$tmp{"$kwd"},",\n";} } @scrTask= ("--- Task: ".$tmp{"scrGoal"}, "--- ", "--- Input: ".$tmp{"scrIn"}, # "--- i.e. requires at least ".$tmp{"scrNarg"}. # " command line argument(s)", "--- "); # ------------------------------ # additional help keywords? # ------------------------------ $#tmpAdd=0; if (defined $tmp{"scrAddHelp"} && $tmp{"scrAddHelp"} ne "unk"){ @tmp=split(/\n/,$tmp{"scrAddHelp"});$Lerr=0; foreach $tmp(@tmp){ push(@tmpAdd,$tmp{"scrNameFull"}." ".$tmp); $tmp2=$tmp;$tmp2=~s/^(.+)\s+\:.*$/$1/;$tmp2=~s/\s*$//g; if (!defined $tmp{"$tmp2"}){ $Lerr=1; print "-*- WARN $sbrName: miss \$tmp{\$special} for '$tmp2'\n";}} if ($Lerr){ print "-*- " x 20,"\n","-*- WARN $sbrName: HELP on HELP\n", "-*- if you provide special help in tmp{scrAddHelp}, then\n", "-*- provide also the respective explanation in tmp{\$special},\n", "-*- where \$special is e.g. 'help xyz' in \n", "-*- scrAddHelp='help xyz : what to do'\n","-*- " x 20,"\n";}} # ------------------------------ # build up help standard # ------------------------------ @scrHelp= ("--- Help: For further information on input options type:", "--- "." " x length($tmp{"scrNameFull"}). " ........................................"); @scrHelpLoop= ($tmp{"scrNameFull"}." help : lists all options", $tmp{"scrNameFull"}." def : writes default settings", $tmp{"scrNameFull"}." def keyword : settings for keyword", $tmp{"scrNameFull"}." help keyword : explain key, e.g. 'special', or how for 'how' and 'howie'"); push(@scrHelpLoop, $tmp{"scrNameFull"}." problems : known problems") if (! defined $tmp{"s_k_i_p"} || $tmp{"s_k_i_p"} !~ /problems/); push(@scrHelpLoop, $tmp{"scrNameFull"}." hints : hints for users") if (! defined $tmp{"s_k_i_p"} || $tmp{"s_k_i_p"} !~ /hints/); push(@scrHelpLoop, $tmp{"scrNameFull"}." manual : will cat the entire manual (... MAY be it will)") if (! defined $tmp{"s_k_i_p"} || $tmp{"s_k_i_p"} !~ /manual/); push(@scrHelpLoop,@tmpAdd) if ($#tmpAdd>0); push(@scrHelp,@scrHelpLoop, "--- "." " x length($tmp{"scrNameFull"}). " ........................................"); # ------------------------------ # additional general information # ------------------------------ $#scrHelpTxtLoc=0; if (defined $tmp{"scrHelpTxt"}){ @tmp=split(/\n/,$tmp{"scrHelpTxt"}); # '--- scrHelptTxt' # '> program' i.e. use: '>' to ommitt '--- ' foreach $txt (@tmp){ push(@scrHelpTxtLoc,"--- $txt\n") if ($txt !~ /^[>\%]/); push(@scrHelpTxtLoc,"$txt\n") if ($txt =~ /^[>\%]/); }} # ------------------------------ # additional special info # ------------------------------ $#scrSpecialLoc=0; if (defined $tmp{"special"}) { @kwdLoc=split(/,/,$tmp{"special"}); if ($#kwdLoc>1){ foreach $kwd (@kwdLoc){ $tmp=" "; $tmp=$tmp{"$kwd"} if (defined $tmp{"$kwd"}); $tmp=~s/\n$//; $tmpWrt=sprintf ("--- %-15s %s\n",$kwd,$tmp); push(@scrSpecialLoc,$tmpWrt); } }} # ------------------------------ # general: # ------------------------------ $fstLineLoc= "-" x 80 . "\n"; $fstLineLoc.="--- Perl script $scrName.pl (" . $tmp{"sourceFile"} . ")\n"; $syntaxLoc= "-" x 80 . "\n"; $syntaxLoc.= "--- Syntax used to set parameters by command line:\n"; $syntaxLoc.= "--- 'keyword=value'\n"; $syntaxLoc.= "--- where 'keyword' is one of the following keywords:\n"; # ------------------------------ # no input if ($#PARAMS < 1) { # ------------------------------ print $fstLineLoc; print join("\n",@scrTask,"\n"); print @scrHelpTxtLoc; print join("\n",@scrHelp); print "\n"; return(1,"fin");} # ------------------------------ # help request # ------------------------------ elsif ($#PARAMS < 2 && $PARAMS[1] =~ /^(help|man|-m|-h)$/){ print $fstLineLoc; print join("\n",@scrTask,"\n"); print @scrHelpTxtLoc; if ($#scrSpecialLoc > 0) { print "-" x 80,"\n"; print "--- 'special' keywords:\n"; print @scrSpecialLoc,"\n"; } if (%par) { @kwdLoc=sort keys (%par); if ($#kwdLoc>1){ print $syntaxLoc; $ct=0;print "OPT \t "; foreach $kwd(@kwdLoc){ ++$ct; printf "%-20s ",$kwd; if ($ct==4){ $ct=0;print "\nOPT \t ";}} print "\n";} print "--- \n", "--- you may get further explanations on a particular keyword\n", "--- by typing:\n", $tmp{"scrNameFull"}." help keyword\n", "--- this could explain the key. Type 'how' for info on ". "'how,howie,show'.\n", "--- \n";} else { print "--- no other options enabled by \%par\n";} return(1,"fin loop?");} # ------------------------------ # wants manual # ------------------------------ elsif ($#PARAMS<2 && $PARAMS[1] eq "manual"){ print $fstLineLoc; if (defined $par{"fileHelpMan"} && -e $par{"fileHelpMan"}){ open("FHIN",$par{"fileHelpOpt"}) || warn "*** $sbrName: could NOT open file".$par{"fileHelpOpt"}; while(){ print $_;}close(FHIN);} else { print "no manual in \%par{'fileHelpMan'}!!\n";} return(1,"fin");} # ------------------------------ # wants hints # ------------------------------ elsif ($#PARAMS==1 && $PARAMS[1] eq "hints"){ print $fstLineLoc; print "--- Hints for users:\n";$ct=0; if (defined $par{"fileHelpHints"} && -e $par{"fileHelpHints"}){ open("FHIN",$par{"fileHelpHints"}) || warn "*** $sbrName: could NOT open file".$par{"fileHelpHints"}; while(){ print $_; ++$ct;}close(FHIN);} if (defined $par{"scrHelpHints"}){ @tmp=split(/\n/,$par{"scrHelpHints"}); foreach $txt(@tmp){print "--- $txt\n";++$ct;}} if ($ct==0){ print "--- the only hint to give: try another help option!\n"; print "--- sorry ...\n";} return(1,"fin loop?");} # ------------------------------ # wants problems # ------------------------------ elsif ($#PARAMS<2 && $PARAMS[1] eq "problems"){ print $fstLineLoc; print "--- Known problems with script:\n";$ct=0; if (defined $par{"fileHelpProblems"} && -e $par{"fileHelpProblems"}){ open("FHIN",$par{"fileHelpProblems"}) || warn "*** $sbrName: could NOT open file".$par{"fileHelpProblems"}; while(){ print $_; ++$ct;}close(FHIN);} if (defined $par{"scrHelpProblems"}){ @tmp=split(/\n/,$par{"scrHelpProblems"}); foreach $txt(@tmp){print "--- $txt\n";++$ct;}} if ($ct==0){ print "--- One problem is: there is no problem annotated.\n"; print "--- sorry ...\n";} return(1,"fin loop?");} # ------------------------------ # wants default settings # ------------------------------ elsif ($#PARAMS<2 && $PARAMS[1] eq "def"){ print $fstLineLoc; if (%par){ @kwdLoc=sort keys (%par); if ($#kwdLoc>1){ print "--- the default settings are:\n"; printf "--- %-20s %-s\n","." x 20,"." x 20; printf "--- %-20s = %-s\n","keyword","value"; printf "--- %-20s %-s\n","." x 20,"." x 20; foreach $kwd(@kwdLoc){ printf "--- %-20s = %-s\n",$kwd,$par{"$kwd"};} printf "--- %-20s %-s\n","." x 20,"." x 20; print "--- \n", "--- to get settings for particular keywords use:\n", $tmp{"scrNameFull"}," def keyword'\n \n";}} else { print "--- no setting defined in \%par\n"; print "--- sorry...\n";} return(1,"fin loop?");} # ------------------------------ # help for particular keyword # ------------------------------ elsif ($#PARAMS>=2 && $PARAMS[1] eq "help" || $#PARAMS==1 && $PARAMS[1] eq "special"){ print $fstLineLoc; $kwdHelp=$PARAMS[2] if ($#PARAMS > 1); $kwdHelp=$PARAMS[1] if ($#PARAMS== 1); $tmp="help $kwdHelp"; # special? $tmp=~tr/[A-Z]/[a-z]/; # make special keywords case independent $tmp2=$tmp;$tmp2=~s/help //; $tmpSpecial=$tmp{"$tmp"} if (defined $tmp{"$tmp"}); $tmpSpecial=$tmp{"$tmp2"} if (! defined $tmp{"$tmp"} && defined $tmp{"$tmp2"}); $#kwdLoc=$#expLoc=0; # (1) get all respective keywords if (%par && $kwdHelp ne "special"){ @kwdLoc=keys (%par);$#tmp=0; foreach $kwd (@kwdLoc){ push(@tmp,$kwd) if ($kwd =~/$kwdHelp/i);} @kwdLoc=sort @tmp;} # (2) is there a 'help option file' ? if (defined $par{"fileHelpOpt"} && -e $par{"fileHelpOpt"} && $kwdHelp ne "special"){ print $syntaxLoc; open("FHIN",$par{"fileHelpOpt"}) || warn "*** $sbrName: could NOT open file".$par{"fileHelpOpt"}; while(){ next if ($_=~/^\#/); $line=$_; $tmp=$_;$tmp=~s/\s//g; next if (length($tmp)<2); next if ($_=~/^\s/ && ! $Lok); if ($Lok && $_=~/^\s/){ print $_; next;} elsif ($Lok && $_!~/^\s/){ $Lok=0;} if (! $Lok && $_ !~ /^[\s\t]+/){ $line=$_; ($tmp1,$tmp2)=split(/[\s\t]+/,$_); $Lok=1 if (length($tmp1)>1 && $tmp1 =~ /$kwdHelp/i); print $line if ($Lok);}}close(FHIN); print "-" x 80, "\n";} # (3) is there a default file? elsif (defined $par{"fileDefaults"} && -e $par{"fileDefaults"} && $kwdHelp ne "special"){ ($Lok,$msg,%def)=&brIniRdDef($par{"fileDefaults"}); $def{"kwd"}="" if (! $Lok); # hack: short cut error @kwdLoc=split(/,/,$def{"kwd"});$#tmp=0; foreach $kwd (@kwdLoc){ if ($kwd =~/$kwdHelp/i){ push(@tmp,$kwd); if (defined $def{"$kwd","expl"}){ $def{"$kwd","expl"}=~s/\n/\n--- /g; push(@expLoc,$def{"$kwd","expl"});} else { push(@expLoc," ");}}} @kwdLoc=@tmp;} # (4) else: read itself elsif ($kwdHelp ne "special"){ ($Lok,$msg,%def)= &brIniHelpRdItself($tmp{"sourceFile"}); die '..... verrry sorry the option blew up ... ' if (! $Lok); $def{"kwd"}="" if (! $Lok); # hack: short cut error @kwdLoc=split(/,/,$def{"kwd"});$#tmp=0; foreach $kwd (@kwdLoc){ next if ($kwd !~/$kwdHelp/i && $kwdHelp !~ /$kwd/ ); push(@tmp,$kwd); if (defined $def{"$kwd"}){ $def{"$kwd"}=~s/\n[\t\s]*/\n--- /g; push(@expLoc,$def{"$kwd"});} else {push(@expLoc," ");}} @kwdLoc=@tmp;} $Lerr=1; if ($#kwdLoc>0){ # (4) write the stuff printf "--- %-20s %-s\n","." x 20,"." x 53; printf "--- %-20s %-s\n","keyword","explanation"; printf "--- %-20s %-s\n","." x 20,"." x 53; foreach $it(1..$#kwdLoc){ $tmp=" "; $tmp=$expLoc[$it] if (defined $expLoc[$it]); printf "--- %-20s %-s\n",$kwdLoc[$it],$tmp;} printf "--- %-20s %-s\n","." x 20,"." x 53; print "--- \n";$Lerr=0;} # (5) special help? if (defined $tmpSpecial || ($kwdHelp eq "special" && defined $tmp{"special"})){ print "--- Special help for '$kwdHelp':\n"; if ($kwdHelp eq "special"){ print @scrSpecialLoc,"\n";} else { foreach $scrSpecialLoc (@scrSpecialLoc) { $scrSpecialLoc=~s/\n$//; next if ($scrSpecialLoc !~ /$kwdHelp/); print "$scrSpecialLoc";} print "\n";} $Lerr=0; return(1,"fin") if ($kwdHelp eq "special");} print "--- sorry, no explanations found for keyword '$kwdHelp'\n" if ($Lerr); return(1,"fin loop?");} # ------------------------------ # wants settings for keyword # ------------------------------ elsif ($#PARAMS>=2 && $PARAMS[1] eq "def"){ $kwdHelp=$PARAMS[2]; print "-" x 80, "\n"; print "--- Perl script $scrName.pl (",$tmp{"sourceFile"},")\n"; if (%par){ @kwdLoc=sort keys (%par); if ($#kwdLoc>1){ print "--- the default settings are:\n"; printf "--- %-20s %-s\n","." x 20,"." x 53; printf "--- %-20s = %-s\n","keyword","value"; printf "--- %-20s %-s\n","." x 20,"." x 53; foreach $kwd(@kwdLoc){ next if ($kwd !~ /$kwdHelp/); printf "--- %-20s = %-s\n",$kwd,$par{"$kwd"};} printf "--- %-20s %-s\n","." x 20,"." x 53; print " \n";}} else { print "--- sorry, no setting defined in \%par\n";} return(1,"fin loop?");} return(1,"ok $sbrName"); } # end of brIniHelp #============================================================================== sub brIniHelpLoop { local($promptLoc,%tmp)=@_; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # brIniHelpLoop loop over help # in/out: see brIniHelp # out: 1|0,msg, implicit: # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $sbrName="lib-br:"."brIniHelpLoop";$fhinLoc="FHIN_"."brIniHelpLoop"; ($Lok,$msg)= # want help? &brIniHelp(%tmp); return(&errSbrMsg("after brIniHelp",$msg)) if (! $Lok); # ------------------------------ # loop over help # ------------------------------ if ($msg =~ /^fin loop/) { $#tmp=0; foreach $txt (@scrHelpLoop) { $txt=~s/^.*\.pl\s*//g; push(@tmp,$txt); } @scrHelpLoop2=@tmp; $Lquit=0; $def="help"; while (! $Lquit) { printf "%-s %-s\n", $promptLoc,"-" x (79 - length($promptLoc)); printf "%-s %-15s %-s\n",$promptLoc,"", "Interactive help"; printf "%-s %-15s %-s\n",$promptLoc,"OPTIONS",""; foreach $txt (@scrHelpLoop2) { printf "%-s %-15s %-s\n",$promptLoc," ",$txt; } printf "%-s %-15s %-s\n",$promptLoc,"",""; printf "%-s %-15s %-s\n",$promptLoc,"ABBREVIATIONS", "h=help, d=def (e.g. 'h kwd')"; printf "%-s %-15s %-s\n",$promptLoc,"ENOUGH ?", "[quit|q|e|exit] to end"; $def="$PARAMS[1]" if (defined $def); # take previous $ansr= &get_in_keyboard("type",$def,$promptLoc); # <--- QUIT $tmp=$ansr;$tmp=~s/\s//g; if ($ansr=~/^[q|quit|e|exit]$/) { $Lquit=1; last; } # redefine @PARAMS @PARAMS=split(/\s+/,$ansr); $PARAMS[1]="help" if ($PARAMS[1] eq "h" || $PARAMS[1] eq "H"); $PARAMS[1]="def" if ($PARAMS[1] eq "d" || $PARAMS[1] eq "D"); $txt1="start again with("; $txt2=join(' ',@PARAMS); $lenfin=80 - 6 - (length($txt1) + length($txt2)); print "--- ","-" x length($txt1),"#" x length($txt2),"--", "-" x $lenfin,"\n"; print "--- ",$txt1,$txt2,")\n"; print "--- ","-" x length($txt1),"#" x length($txt2),"--", "-" x $lenfin,"\n"; # call again ($Lok,$msg)= &brIniHelp(%tmp); return(&errSbrMsg("after brIniHelp",$msg)) if (! $Lok); # <--- QUIT $Lquit=1 if ($msg eq "fin"); } $msg="fin"; } return(1,$msg); } # end of brIniHelpLoop #============================================================================== sub brIniHelpRdItself { local($fileInLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # brIniHelpRdItself reads the calling perl script (scrName), # searches for 'sub\siniDef', and gets comment lines # in: perl-script-source # out: (Lok,$msg,%tmp), with: # $tmp{"kwd"} = 'kwd1,kwd2' # $tmp{"$kwd1"} = explanations for keyword 1 #------------------------------------------------------------------------------- $sbrName="lib-br:"."brIniHelpRdItself";$fhinLoc="FHIN_"."brIniHelpRdItself"; $Lok= &open_file("$fhinLoc","$fileInLoc"); return(0,"*** ERROR $sbrName: old '$fileInLoc' not opened\n") if (! $Lok); # read file while (<$fhinLoc>) { # search for initialising subroutine last if ($_=/^su[b] iniDef.* \{/);} $Lis=0;undef %tmp; $#tmp=0; while (<$fhinLoc>) { # read lines with ' %par{"kwd"}= $val # comment ' $_=~s/\n//g; last if ($_=~/^su[b] .*\{/ && $_!~/^su[b] iniDef.* \{/); # new expression if ($_=~/[\s\t]+\$par\{[\"\']?([^\"\'\}]+)[\"\']?\}[^\#]*\#\s*(.*)$/){ $Lis=1;$kwd=$1; push(@tmp,$kwd); $tmp{"$kwd"}=$2 if (defined $2);} # end if only '------' line elsif ($Lis && defined $tmp{"$kwd"} && $_=~/^[\s\t]+\# ?\-+/){ $Lis=0;} # add to previous (only if it had an explanation) elsif ($Lis && defined $tmp{"$kwd"} && $_=~/^[\s\t]*\# (.*)$/){ $tmp{"$kwd"}.="\n".$1;} # end if nothing followed elsif ($Lis){ $Lis=0;}}close($fhinLoc); $tmp{"kwd"}=join(',',@tmp); return(1,"ok $sbrName",%tmp); } # end of brIniHelpRdItself #============================================================================== sub brIniRdDef { local ($fileLoc)=@_; $[ =1 ; #------------------------------------------------------------------------------- # brIniRdDef reads defaults for initialsing parameters # in GLOBAL: $par{},@PARAMS # out GLOBAL: $par{} (i.e. changes settings automatically) # in: file_default # out: ($Lok,$msg,%defaults) with: # $defaults{"kwd"}= 'kwd1,kwd2,...,' # $defaults{"$kwd1"}= val1 # $defaults{"$kwd1","expl"}=explanation for kwd1 # note: long explanations split by '\n' #------------------------------------------------------------------------------- $sbrName="lib-br:brIniRdDef"; $fhin="FHIN_brIniRdDef"; &open_file("$fhin","$fileLoc") || return(0,"*** ERROR $sbrName: failed to open in '$fileLoc'\n"); undef %defaults; $#kwd=0; $Lis=0; # ------------------------------ while (<$fhin>){ # read file next if (length($_)<3 || $_=~/^\#/ || $_!~/\t/); # ignore lines beginning with '#' $_=~s/\n//g; $line=$_; $tmp=$line; $tmp=~s/[\s\#\-\*\.\=\t]//g; # ignore lines with only spaces or '-|#|*|=' next if (length($tmp)<1); # purge leading blanks and tabs $line=~s/^[\s\t]*|[\s\t]*$//g; # ------------------------------ # (1) case 'kwd val # comment' if ($line=~/^([^\s\t]+)[\s\t]+([^\s\t]+)[\s\t]+\# ?(.*)$/){ $kwd=$1; push(@kwd,$kwd); $defaults{"$kwd"}=$2; $defaults{"$kwd","expl"}=$3 if (defined $3 && length($3)>1); $Lis=1;} # (2) case 'kwd val' elsif ($line=~/^([^\s\t]+)[\s\t]+([^\s\t]+)[\s\t]*$/){ $kwd=$1; $defaults{"$kwd"}=$2; $Lis=1; $defaults{"$kwd","expl"}=""; } # (3) case ' # ----' elsif ($Lis && $line =~ /^\#\s*[\-\=\_\.\*]+/){ $Lis=0;} elsif ($Lis && defined $defaults{"$kwd","expl"} && $line =~ /^\#\s*(.*)$/){ $defaults{"$kwd","expl"}.="\n".$1;}} close($fhin); # ------------------------------ foreach $kwd (@kwd){ # fill in wild cards $defaults{"$kwd"}=$ARCH if ($defaults{"$kwd"}=~/ARCH/);} # ------------------------------ foreach $kwd (@kwd){ # complete it $defaults{"$kwd","expl"}=" " if (! defined $defaults{"$kwd","expl"});} $defaults{"kwd"}=join(',',@kwd); # ------------------------------ # check the defaults read # AND OVERWRITE $par{} !! @kwdDef=keys %par; foreach $kwd (@kwdDef){ $tmp{$kwd}=1;} $Lok=1; foreach $kwd (@kwd){ if (! defined $tmp{$kwd}){ $Lok=0; print "*** ERROR $sbrName: wrong keyword ($kwd) in defaults file ", $par{"fileDefaults"},"\n";} # ****************************** else { # overwrite # ****************************** $par{"$kwd"}=$defaults{"$kwd"};}} return(0,"*** ERROR $sbrName failed finishing to read defaults file\n") if (! $Lok); return(1,"ok $sbrName",%defaults); } # end of brIniRdDef #============================================================================== sub brIniSet { $[ =1 ; #------------------------------------------------------------------------------- # brIniSet changing parameters according to input arguments # e.g. adding directories to file names asf #------------------------------------------------------------------------------- $sbrName="lib-br:brIniSet"; @kwd=sort keys(%par) if (%par); # ------------------------------ $#tmp=0; # purge empty keywords foreach $kwd (@kwd){ if (defined $kwd && length($kwd)>=1 && defined $par{"$kwd"}){ push(@tmp,$kwd);} else { print "-*- WARN $sbrName: for kwd '$kwd', par{kwd} not defined!\n";}} @kwd=@tmp; # jobId $par{"jobid"}=$$ if (! defined $par{"jobid"} || $par{"jobid"} eq 'jobid' || length($par{"jobid"})<1); # ------------------------------ # add jobid foreach $kwd (@kwd){ $par{"$kwd"}=~s/jobid/$par{"jobid"}/;} # ------------------------------ # WATCH it for file lists: add dirIn if (defined $par{"dirIn"} && $par{"dirIn"} ne "unk" && $par{"dirIn"} ne "local" && length($par{"dirIn"})>1){ foreach $fileIn(@fileIn){ $fileIn=$par{"dirIn"}.$fileIn if (! -e $fileIn); if (! -e $fileIn){ print "*** $sbrName: no fileIn=$fileIn, dir=",$par{"dirIn"},",\n"; return(0);}}} $#kwdFileOut=0; # ------------------------------ foreach $kwd (@kwd){ # add 'pre' 'title' 'ext' to output files not specified next if ($kwd !~ /^fileOut/); push(@kwdFileOut,$kwd); next if (defined $par{"$kwd"} && $par{"$kwd"} ne "unk" && length($par{"$kwd"})>0); $kwdPre=$kwd; $kwdPre=~s/file/pre/; $kwdExt=$kwd; $kwdExt=~s/file/ext/; $pre="";$pre=$par{"$kwdPre"} if (defined $par{"$kwdPre"}); $ext="";$ext=$par{"$kwdExt"} if (defined $par{"$kwdExt"}); if (! defined $par{"title"} || $par{"title"} eq "unk"){ $par{"title"}=$scrName;$par{"title"}=~tr/[a-z]/[A-Z]/;} # capitalize title $par{"$kwd"}=$pre.$par{"title"}.$ext;} # ------------------------------ # add output directory if (defined $par{"dirOut"} && $par{"dirOut"} ne "unk" && $par{"dirOut"} ne "local" && length($par{"dirOut"})>1){ if (! -d $par{"dirOut"}){ # make directory print "--- $sbrName mkdir ",$par{"dirOut"},"\n" if ($par{"verb2"}); $tmp=$par{"dirOut"};$tmp=~s/\/$// if ($tmp=~/\/$/); $Lok= mkdir ($tmp,umask); print "*** $sbrName failed making directory '",$par{"dirOut"},"'\n" if (! $Lok);} $par{"dirOut"}.="/" if (-d $par{"dirOut"} && $par{"dirOut"} !~/\/$/); # add slash foreach $kwd (@kwdFileOut){ next if ($par{$kwd} =~ /^$par{"dirOut"}/); next if ($par{$kwd} eq "unk" || ! $par{$kwd}); next if ($kwd =~ /screen|trace/i); $par{"$kwd"}=$par{"dirOut"}.$par{"$kwd"} if (-d $par{"dirOut"});}} # ------------------------------ # push array of output files $#fileOut=0 if (! defined @fileOut); foreach $kwd (@kwdFileOut){ push(@fileOut,$par{"$kwd"});} # ------------------------------ # temporary files: add work dir if( !$par{dirWork} ){ $par{dirWork} = File::Temp::tempdir( CLEANUP => !$par{debug} ); } if (defined $par{"dirWork"} && $par{"dirWork"} ne "unk" && $par{"dirWork"} ne "local" && length($par{"dirWork"})>1) { if (! -d $par{"dirWork"}){ # make directory print "--- $sbrName mkdir ",$par{"dirWork"},"\n" if ($par{"verb2"}); $tmp=$par{"dirWork"};$tmp=~s/\/$// if ($tmp=~/\/$/); $Lok= mkdir ($tmp,umask); print "*** $sbrName failed making directory '",$par{"dirWork"},"'\n" if (! $Lok);} $par{"dirWork"}.="/" if (-d $par{"dirWork"} && $par{"dirWork"} !~/\/$/); # add slash foreach $kwd (@kwd){ next if ($kwd !~ /^file/); next if ($kwd =~ /^file(In|Out|Help|Def)/i); $par{"$kwd"}=~s/jobid/$par{"jobid"}/ ; next if ($par{"$kwd"} =~ /^$par{"dirWork"}/); next if (-e $par{"$kwd"}); $par{"$kwd"}=$par{"dirWork"}.$par{"$kwd"};}} # ------------------------------ # blabla $Lverb=1 if (defined $par{"verbose"} && $par{"verbose"}); $Lverb2=1 if (defined $par{"verb2"} && $par{"verb2"}); $Lverb3=1 if (defined $par{"verb3"} && $par{"verb3"}); # ------------------------------ # add ARCH if (defined $ARCH || defined $par{"ARCH"}){ $ARCH=$par{"ARCH"} if (! defined $ARCH && defined $par{"ARCH"}); $par{"ARCH"}=$ARCH if ( defined $ARCH && ! defined $par{"ARCH"}); foreach $kwd (@kwd){ # add directory to executables next if ($kwd !~ /^exe/); next if ($par{"$kwd"} !~ /ARCH/); $par{"$kwd"}=~s/ARCH/$ARCH/;}} # ------------------------------ foreach $kwd (@kwd){ # add directory to executables next if ($kwd !~/^exe/); next if (-e $par{"$kwd"} || -l $par{"$kwd"}); # try to add perl script directory next if (! defined $par{"dirPerl"} || ! -d $par{"dirPerl"}); next if ($par{"$kwd"}=~/$par{"dirPerl"}/); # did already, no result $tmp=$par{"dirPerl"}; $tmp.="/" if ($tmp !~ /\/$/); $tmp=$tmp.$par{"$kwd"}; next if (! -e $tmp && ! -l $tmp); $par{"$kwd"}=$tmp; } # ------------------------------ # priority if (defined $par{"optNice"} && $par{"optNice"} ne " " && length($par{"optNice"})>0){ $niceNum=""; if ($par{"optNice"}=~/nice\s*-/){ $par{"optNice"}=~s/nice-/nice -/; $niceNum=$par{"optNice"};$niceNum=~s/\s|nice|\-|\+//g; } elsif ($par{"optNice"}=~/^\d+$/){ $niceNum=$par{"optNice"};} $niceNum=~s/\D//g; setpriority(0,0,$niceNum) if (length($niceNum)>0); } return(1); } # end of brIniSet #============================================================================== sub brIniWrt { local($exclLoc,$fhTraceLocSbr)=@_; $[ =1 ; #------------------------------------------------------------------------------- # brIniWrt write initial settings on screen # in: $excl : 'kwd1,kwd2,kw*' exclude from writing # '*' for wild card # in: $fhTrace : file handle to write # = 0, or undefined -> STDOUT #------------------------------------------------------------------------------- $sbrName="lib-br:"."brIniWrt"; return(0,"*** $sbrName: no settings defined in %par\n") if (! %par); $fhTraceLocSbr="STDOUT" if (! defined $fhTraceLocSbr || ! $fhTraceLocSbr); if (defined $Date) { $dateTmp=$Date; } else { $tmp=`date`; $tmp=~s/\n//g if (defined $tmp); $dateTmp=$tmp || "before year 2000"; } print $fhTraceLocSbr "--- ","-" x 80, "\n"; print $fhTraceLocSbr "--- Initial settings for $scrName (copf.pm) on $dateTmp:\n"; @kwd= sort keys (%par); # ------------------------------ # to exclude @tmp= split(/,/,$exclLoc) if (defined $exclLoc); $#exclLoc=0; undef %exclLoc; foreach $tmp (@tmp) { if ($tmp !~ /\*/) { # exact match $exclLoc{"$tmp"}=1; } else { # wild card $tmp=~s/\*//g; push(@exclLoc,$tmp); } } if ($#exclLoc > 0) { $exclLoc2=join('|',@exclLoc); } else { $exclLoc2=0; } $#kwd2=0; # ------------------------------ foreach $kwd (@kwd) { # parameters next if (! defined $par{"$kwd"}); next if ($kwd=~/expl$/); next if (length($par{"$kwd"})<1); if ($kwd =~/^fileOut/) { push(@kwd2,$kwd); next;} next if ($par{"$kwd"} eq "unk"); next if (defined $exclLoc{"$kwd"}); # exclusion required next if ($exclLoc2 && $kwd =~ /$exclLoc2/); printf $fhTraceLocSbr "--- %-20s '%-s'\n",$kwd,$par{"$kwd"};} # ------------------------------ if ($#kwd2>0){ # output files print $fhTraceLocSbr "--- \n","--- Output files:\n"; foreach $kwd (@kwd2) { next if ($par{"$kwd"} eq "unk"|| ! $par{"$kwd"}); next if (defined $exclLoc{"$kwd"}); # exclusion required next if ($exclLoc2 && $kwd =~ /$exclLoc2/); printf $fhTraceLocSbr "--- %-20s '%-s'\n",$kwd,$par{"$kwd"};}} # ------------------------------ # input files if (defined @fileIn && $#fileIn>1){ # get dirs $#tmpdir=0; undef %tmpdir; foreach $file (@fileIn){ if ($file =~ /^(.*\/)[^\/]/){ $tmp=$1;$tmp=~s/\/$//g; if (! defined $tmpdir{$tmp}){push(@tmpdir,$tmp); $tmpdir{$tmp}=1;}}} # write print $fhTraceLocSbr "--- \n"; printf $fhTraceLocSbr "--- %-20s number =%6d\n","Input files:",$#fileIn; printf $fhTraceLocSbr "--- %-20s dirs =%-s\n","Input dir:", join(',',@tmpdir) if ($#tmpdir == 1); printf $fhTraceLocSbr "--- %-20s dirs =%-s\n","Input dirs:",join(',',@tmpdir) if ($#tmpdir > 1); for ($it=1;$it<=$#fileIn;$it+=5){ print $fhTraceLocSbr "--- IN: "; $it2=$it; while ( $it2 <= $#fileIn && $it2 < ($it+5) ){ $tmp=$fileIn[$it2]; $tmp=~s/^.*\///g; printf $fhTraceLocSbr "%-18s ",$tmp;++$it2;} print $fhTraceLocSbr "\n";}} elsif ((defined @fileIn && $#fileIn==1) || (defined $fileIn && -e $fileIn)){ $tmp=0; $tmp=$fileIn if (defined $fileIn && $fileIn); $tmp=$fileIn[1] if (! $tmp && defined @fileIn && $#fileIn==1); print $fhTraceLocSbr "--- \n"; printf $fhTraceLocSbr "--- %-20s '%-s'\n","Input file:",$tmp;} print $fhTraceLocSbr "--- \n"; printf $fhTraceLocSbr "--- %-20s %-s\n","excluded from write:",$exclLoc if (defined $exclLoc); print $fhTraceLocSbr "--- \n","--- ","-" x 80, "\n","--- \n"; return(1,"ok $sbrName"); } # end of brIniWrt #=============================================================================== sub complete_dir { local($DIR)=@_; $[=1 ; return(0) if (! defined $DIR); return($DIR) if ($DIR =~/\/$/); return($DIR."/");} # end of complete_dir #=============================================================================== sub completeDir { local($DIR)=@_; $[=1 ; return(0) if (! defined $DIR); return($DIR) if ($DIR =~/\/$/); return($DIR."/");} # end of completeDir #============================================================================== sub errSbrMsg {local($txtInLoc,$msgInLoc,$sbrNameLocy) = @_ ; #------------------------------------------------------------------------------- # errSbrMsg simply writes '*** ERROR $sbrName: $txtInLoc\n'.$msg #------------------------------------------------------------------------------- $sbrNameLocy=$sbrName if (! defined $sbrNameLocy); $txtInLoc.="\n"; $txtInLoc=~s/\n\n+/\n/g; $msgInLoc.="\n"; $msgInLoc=~s/\n\n+/\n/g; return(0,"*** ERROR $sbrNameLocy: $txtInLoc".$msgInLoc); } # end of errSbrMsg #============================================================================== sub fctRunTimeLeft { local($timeBegLoc,$num_to_run,$num_did_run) = @_ ; local($sbrName); $[ =1 ; #------------------------------------------------------------------------------- # fctRunTimeLeft estimates the time the job still needs to run # in: $timeBegLoc : time (time) when job began # in: $num_to_run : number of things to do # in: $num_did_run: number of things that are done, so far # out: $_string_time-still (hour:min:sec) #------------------------------------------------------------------------------- $sbrName="lib-br:"."fctRunTimeLeft"; $timeNow=time; $timeRun=$timeNow-$timeBegLoc; $percLoc=0; $percLoc=100*($num_did_run/$num_to_run) if ($num_to_run > 0); if ($percLoc) { $timeTot=int(100*($timeRun/$percLoc)); $timeLeft=$timeTot-$timeRun; $tmp= &fctSeconds2time($timeLeft); @tmp=split(/:/,$tmp); foreach $tmp (@tmp){$tmp=~s/^0//g;} $estimateLoc= ""; $estimateLoc.= $tmp[1]."h " if ($tmp[1] > 9); $estimateLoc.=" ".$tmp[1]."h " if (9 >= $tmp[1] && $tmp[1] > 0); $estimateLoc.= $tmp[2]."m " if ($tmp[2] > 9); $estimateLoc.=" ".$tmp[2]."m " if (9 >= $tmp[2] && $tmp[2] > 0); $estimateLoc.=" "." ". " " if ($tmp[2] <= 0 && $tmp[1] > 0); $estimateLoc.= $tmp[3]."s " if ($tmp[3] > 9); $estimateLoc.=" ".$tmp[3]."s " if (9 >= $tmp[3] && $tmp[3] > 0); $estimateLoc.=" "." ". " " if ($tmp[3] <= 0 && ($tmp[1] > 0 || $tmp[2] > 0)); $estimateLoc= "done" if (length($estimateLoc) < 1);} else { $estimateLoc="?";} return($estimateLoc); } # end of fctRunTimeLeft #============================================================================== sub fctSeconds2time { local($secIn) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # fctSeconds2time converts seconds to hours:minutes:seconds # in: seconds # out: 05:13:50 #------------------------------------------------------------------------------- $sbrName="lib-comp:"."fctSeconds2time";$fhinLoc="FHIN"."$sbrName"; $minTmp= int($secIn/60); $seconds= ($secIn - $minTmp*60); $seconds=int($seconds); $hours= int($minTmp/60); $hours= int($hours); $minutes= ($minTmp - $hours*60); $minutes=int($minutes); $seconds="0".$seconds if (length($seconds)==1); $minutes="0".$minutes if (length($minutes)==1); $hours= "0".$hours if (length($hours)==1); return("$hours".":".$minutes.":".$seconds); } # end of fctSeconds2time #============================================================================== sub get_in_keyboard { local($des,$def,$pre,$Lmirror)=@_;local($txt); #-------------------------------------------------------------------------------- # get_in_keyboard gets info from keyboard # in: $des : keyword to get # in: $def : default settings # in: $pre : text string beginning screen output # default '--- ' # in: $Lmirror: if true, the default is mirrored # out: $val : value obtained #-------------------------------------------------------------------------------- $pre= "---" if (! defined $pre); $Lmirror=0 if (! defined $Lmirror || ! $Lmirror); $txt=""; # ini printf "%-s %-s\n", $pre,"-" x (79 - length($pre)); printf "%-s %-15s:%-s\n", $pre,"type value for",$des; if (defined $def){ printf "%-s %-15s:%-s\n",$pre,"type RETURN to enter value, or to keep default"; printf "%-s %-15s>%-s\n",$pre,"default value",$def;} else { printf "%-s %-15s>%-s\n",$pre,"type RETURN to enter value"; } $txt=$def if ($Lmirror); # mirror it printf "%-s %-15s>%-s", $pre,"type",$txt; while(){ $txt.=$_; last if ($_=~/\n/);} $txt=~s/^\s+|\s+$//g; $txt=$def if (length($txt) < 1); printf "%-s %-15s>%-s\n", $pre,"--> you chose",$txt; return ($txt); } # end of get_in_keyboard #============================================================================== sub get_range { local ($range_txt,$nall) = @_; local (@range,@rangeLoc,$it,$range1,$range2); $[ =1 ; #-------------------------------------------------------------------------------- # get_range converts range=n1-n2 into @range (1,2) # in: 'n1-n2' NALL: e.g. incl=1-5,9,15 # n1= begin, n2 = end, * for wild card # NALL = number of last position # out: @takeLoc: begin,begin+1,...,end-1,end #-------------------------------------------------------------------------------- $#range=0; if (! defined $range_txt || length($range_txt)<1 || $range_txt eq "unk" || $range_txt !~/\d/ ) { print "*** ERROR in get_range: argument: range=$range_txt, nall=$nall, not digestable\n"; return(0);} $range_txt=~s/\s//g; # purge blanks $nall=0 if (! defined $nall); # already only a number return($range_txt) if ($range_txt !~/[^0-9]/); if ($range_txt !~/[\-,]/) { # no range given print "*** ERROR in get_range: argument: '$range_txt,$nall' not digestable\n"; return(0);} # ------------------------------ # dissect commata if ($range_txt =~ /\,/) { @range=split(/,/,$range_txt);} # ------------------------------ # dissect hyphens elsif ($range_txt =~ /(\d*|\*)-(\d*|\*)/) { @range=&get_rangeHyphen($range_txt,$nall);} # ------------------------------ # process further elements with hyphens $#range2=0; foreach $range (@range){ if ($range =~ /(\d*|\*)-(\d*|\*)/) { push(@range2,&get_rangeHyphen($range,$nall));} else { push(@range2,$range);}} @range=@range2; $#range2=0; # ------------------------------ if ($#range>1){ # sort @range=sort {$a<=>$b} @range;} return (@range); } # end of get_range #=============================================================================== sub get_rangeHyphen { local ($range_txt,$nall) = @_ ; local (@rangeLoc,$it,$range1,$range2); $[ =1 ; #-------------------------------------------------------------------------------- # get_rangeHyphen reads 'n1-n2' # in: 'n1-n2', NALL (n1= begin, n2 = end, * for wild card) # NALL = number of last position # out: begin,begin+1,...,end-1,end #-------------------------------------------------------------------------------- if ($range_txt =~ /(\d*|\*)-(\d*|\*)/) { ($range1,$range2)=split(/-/,$range_txt); if ($range1=~/\*/) {$range1=1;} if ($range2=~/\*/) {$range2=$nall;} for($it=$range1;$it<=$range2;++$it) {push(@rangeLoc,$it);} } else { @rangeLoc=($range_txt);} return(@rangeLoc); } # end of get_rangeHyphen #=============================================================================== sub getSysARCH { local($exePvmgetarch,@argLoc) = @_ ; local($sbrName,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # getSysARCH tries to get the system architecture # # in: $exePvmgetarch: bin-shell script to get ARCH # = 0 to not execute that one.. # in: @argLoc: all arguments passed to program, checks # for one with: # ARCH=SGI64 .. or so # out: <0,$ARCH> #------------------------------------------------------------------------------- # lkajan: the following seems obsolete return( 'LINUX' ); $tmp=$0;$tmp=~s/^.*\/|\.pl//g;$tmp.=":";$sbrName=$tmp."getSysARCH"; $archFound=0; $exePvmgetarch=0 if (! defined $exePvmgetarch); # ------------------------------ # (1) find in arguments passed # ------------------------------ if (defined @argLoc && $#argLoc > 0) { foreach $arg (@argLoc) { if ($arg=~/^ARCH=(\S+)/i) { $archFound=$1; # archs are upper case: convert $archFound=~tr/[a-z]/[A-Z]/; last; }} } return($archFound) if ($archFound); # ------------------------------ # (2) try env asf # ------------------------------ $archFound=$ENV{'ARCH'} || $ENV{'CPUARC'} || 0; return($archFound) if ($archFound); # ------------------------------ # (3) run bin shell script given # ------------------------------ if ($exePvmgetarch && (-e $exePvmgetarch || -l $exePvmgetarch)) { $scr=$exePvmgetarch; $archFound=`$scr`; # system call $archFound=~s/\s|\n//g; $archFound=0 if (length($archFound < 3) || $archFound !~ /[A-Z][A-Z]/);} return($archFound) if ($archFound); # ------------------------------ # (4) search bin shell script # ------------------------------ foreach $possible ("/home/rost/pub/phd/scr/pvmgetarch.sh", "/home/rost/etc/pvmgetarch.sh") { if (-e $possible || -l $possible) { $exePvmgetarch=$possible; last; }} # somewhere in relative paths if (! $exePvmgetarch) { $dirRelative=$0; $dirRelative=~s/\.\///g; $dirRelative=~s/^(.*\/).*$/$1/; foreach $possible ("scr/pvmgetarch.sh","scr/which_arch.sh", "bin/pvmgetarch.sh","bin/which_arch.sh", "etc/pvmgetarch.sh","etc/which_arch.sh", "pvmgetarch.sh","which_arch.sh") { if (-e $possible || -l $possible) { $exePvmgetarch=$possible; last; }}} # ****************************** # script not found return(0) if (! $exePvmgetarch); # ****************************** # ------------------------------ # (5) run bin shell script # ------------------------------ $scr=$exePvmgetarch; $archFound=`$scr`; # system call $archFound=~s/\s|\n//g; $archFound=0 if (length($archFound) < 3 || $archFound !~ /[A-Z][A-Z]/); return($archFound); } # end of getSysARCH #============================================================================== sub getYcurveIde { local($laliLoc)=@_; local($expon,$loc); $[ =1 ; #------------------------------------------------------------------------------- # getYcurveIde out= pide value for new curve # in: $lali # out: $pide # pide= 510 * L ^ { -0.32 (1 + e ^-(L/1000)) } #------------------------------------------------------------------------------- $sbrName="lib-br:getYcurveIde"; return(0,"*** ERROR $sbrName: lali not defined \n") if (! defined $laliLoc); return(0,"*** ERROR $sbrName: '$laliLoc' = alignment length??\n") if (length($laliLoc)<1 || $laliLoc=~/[^0-9.]/); # saturation short: <=11 return(100,"ok $sbrName saturation short") if ($laliLoc<=11); # saturation long: >450 return(19.5,"ok $sbrName saturation long") if ($laliLoc>450); $expon= - 0.32 * ( 1 + exp (-$laliLoc/1000) ); # $loc= 510 * $laliLoc ** ($expon); $loc= 480 * $laliLoc ** ($expon); $loc=100 if ($loc > 100); # saturation short $loc=19.5 if ($loc < 19.5); # saturation long return($loc,"ok $sbrName"); } # end of getYcurveIde #============================================================================== sub getYcurveOld { local($laliLoc)=@_; local($expon,$loc); $[ =1 ; #------------------------------------------------------------------------------- # getYcurveOld out= pide value for old curve # in: $lali # out: $pide # pide= 510 * L ^ { -0.32 (1 + e ^-(L/1000)) } #------------------------------------------------------------------------------- $sbrName="lib-br:getYcurveOld"; return(0,"*** ERROR $sbrName: lali not defined \n") if (! defined $laliLoc); return(0,"*** ERROR $sbrName: '$laliLoc' = alignment length??\n") if (length($laliLoc)<1 || $laliLoc=~/[^0-9.]/); $loc= 290.15 * $laliLoc ** (-0.562); $loc=100 if ($loc > 100); # saturation $loc=25 if ($loc < 25); # saturation return($loc,"ok $sbrName"); } # end of getYcurveOld #============================================================================== sub getYcurveSim { local($laliLoc)=@_; local($expon,$loc); $[ =1 ; #------------------------------------------------------------------------------- # getYcurveSim out= psim value for new curve # in: $lali # out: $sim # psim= 420 * L ^ { -0.335 (1 + e ^-(L/2000)) } #------------------------------------------------------------------------------- $sbrName="lib-br:getYcurveSim"; return(0,"*** ERROR $sbrName: lali not defined \n") if (! defined $laliLoc); return(0,"*** ERROR $sbrName: '$laliLoc' = alignment length??\n") if (length($laliLoc)<1 || $laliLoc=~/[^0-9.]/); $expon= - 0.335 * ( 1 + exp (-$laliLoc/2000) ); $loc= 420 * $laliLoc ** ($expon); $loc=100 if ($loc>100); # saturation return($loc,"ok $sbrName"); } # end of getYcurveSim #============================================================================== sub hsspFilterGetCurveIde { local($threshLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok,@takeLoc); $[ =1 ; #------------------------------------------------------------------------------- # hsspFilterGetCurveIde flags positions (in pairs) above identity threshold # in: $threshLoc= distance from HSSP (new ide) threshold # out: @takeLoc # GLOBAL in /out: $rd{"NR","$it"},$rd{"LALI","$it"} #------------------------------------------------------------------------------- $sbrName="lib-br:"."hsspFilterGetCurveIde"; $LscreenTmp=0 if (! defined $LscreenTmp); $#takeLoc=0; foreach $it (1..$rd{"NROWS"}){ # loop over all pairs ($newIdeThresh,$msg)= &getYcurveIde($rd{"LALI","$it"}); return(&errSbrMsg("failed getYcurveIde for it=$it, lali=". $rd{"LALI","$it"}.", ide=".$rd{"IDE","$it"}, $msg)) if ($msg !~/^ok/); $dist= 100 * $rd{"IDE","$it"} - $newIdeThresh; if ($dist >= $threshLoc){ printf "TMP: %3d + d=%5.1f ide=%3d lali=%3d t=%3d\n", $it,$dist,int(100*$rd{"IDE","$it"}),$rd{"LALI","$it"},int($threshLoc) if ($LscreenTmp); $takeLoc[$it]=1;} else { printf "TMP: %3d - d=%5.1f ide=%3d lali=%3d t=%3d\n", $it,$dist,int(100*$rd{"IDE","$it"}),$rd{"LALI","$it"},int($threshLoc) if ($LscreenTmp); $takeLoc[$it]=0;} } # control: plot curve if (0){ for ($it=1; $it<=300; $it+=5){ ($newIdeThresh,$msg)=&getYcurveIde($it); printf "%3d %8.2f\n",$it,$newIdeThresh;} } return(@takeLoc); } # end of hsspFilterGetCurveIde #============================================================================== sub hsspFilterGetCurveMinMaxIde { local($minLoc,$maxLoc,$fhSbr) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok,@notLoc); $[ =1 ; #------------------------------------------------------------------------------- # hsspFilterGetCurveMinMaxIde flags positions (in pairs) above maxIde and below minIde # in: $minLoc,$maxLoc = distances from HSSP (new ide) threshold # in: $fhSbr: if not defined, no output written # out: @notLoc # GLOBAL in /out: $rd{"NR","$it"},$rd{"LALI","$it"} #------------------------------------------------------------------------------- $sbrName="lib-br:"."hsspFilterGetCurveMinMaxIde"; $#notLoc=0; foreach $it (1..$rd{"NROWS"}){ # loop over all pairs ($newIdeThresh,$msg)= &getYcurveIde($rd{"LALI","$it"}); return(&errSbrMsg("failed getYcurveIde for it=$it, lali=". $rd{"LALI","$it"}.", ide=".$rd{"IDE","$it"}, $msg)) if ($msg !~/^ok/); $dist= 100 * $rd{"IDE","$it"} - $newIdeThresh; if ($dist > $maxLoc){ $notLoc[$it]=1;} elsif ($dist < $minLoc){ $notLoc[$it]=1;} else { printf "--- %3d: %5.2f < %5.2f < %5.2f i=%5.2f (%5d)\n", $it,$minLoc,$dist,$maxLoc,(100*$rd{"IDE","$it"}),$rd{"LALI","$it"} if (defined $fhSbr);} } return(@notLoc); } # end of hsspFilterGetCurveMinMaxIde #============================================================================== sub hsspFilterGetCurveOld { local($threshLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok,@takeLoc); $[ =1 ; #------------------------------------------------------------------------------- # hsspFilterGetCurveOld flags positions (in pairs) above old identity threshold # in: $threshLoc= distance from HSSP (old ide) threshold # out: @takeLoc # GLOBAL in /out: $rd{"NR","$it"},$rd{"LALI","$it"} #------------------------------------------------------------------------------- $sbrName="lib-br:"."hsspFilterGetCurveOld"; $LscreenTmp=0 if (! defined $LscreenTmp); $#takeLoc=0; foreach $it (1..$rd{"NROWS"}){ # loop over all pairs ($oldIdeThresh,$msg)= &getYcurveOld($rd{"LALI","$it"}); return(&errSbrMsg("failed getYcurveOld for it=$it, lali=". $rd{"LALI","$it"}.", ide=".$rd{"IDE","$it"}, $msg)) if ($msg !~/^ok/); $dist= 100 * $rd{"IDE","$it"} - $oldIdeThresh; if ($dist >= $threshLoc){ printf "TMP: %3d + d=%5.1f ide=%3d lali=%3d t=%3d\n", $it,$dist,int(100*$rd{"IDE","$it"}),$rd{"LALI","$it"},int($threshLoc) if ($LscreenTmp); $takeLoc[$it]=1;} else { printf "TMP: %3d - d=%5.1f ide=%3d lali=%3d t=%3d\n", $it,$dist,int(100*$rd{"IDE","$it"}),$rd{"LALI","$it"},int($threshLoc) if ($LscreenTmp); $takeLoc[$it]=0;} } # control: plot curve if (0){ for ($it=1; $it<=100; $it+=5){ ($ideThresh,$msg)=&getYcurveOld($it); printf "%3d %8.2f\n",$it,$ideThresh;} } return(@takeLoc); } # end of hsspFilterGetCurveOld #============================================================================== sub hsspFilterGetCurveSim { local($threshLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok,@takeLoc); $[ =1 ; #------------------------------------------------------------------------------- # hsspFilterGetCurveSim flags positions (in pairs) above similarity threshold # in: $threshLoc= distance from HSSP (new sim) threshold # out: @take # GLOBAL in /out: @take,$rd{"NR","$it"} #------------------------------------------------------------------------------- $sbrName="lib-br:"."hsspFilterGetCurveSim"; $#takeLoc=0; $LscreenTmp=0 if (! defined $LscreenTmp); foreach $it (1..$rd{"NROWS"}){ # loop over all pairs ($newSimThresh,$msg)= &getYcurveSim($rd{"LALI","$it"}); return(&errSbrMsg("failed getYcurveSim for it=$it, lali=". $rd{"LALI","$it"}.", ide=".$rd{"WSIM","$it"}, $msg)) if ($msg !~/^ok/); $dist=100 * $rd{"WSIM","$it"} - $newSimThresh; if ($dist >= $threshLoc){ printf "TMP: %3d + d=%5.1f sim=%3d lali=%3d t=%3d\n", $it,$dist,int(100*$rd{"WSIM","$it"}),$rd{"LALI","$it"},int($threshLoc) if ($LscreenTmp); $takeLoc[$it]=1; } else { printf "TMP: %3d - d=%5.1f sim=%3d lali=%3d t=%3d\n", $it,$dist,int(100*$rd{"WSIM","$it"}),$rd{"LALI","$it"},int($threshLoc) if ($LscreenTmp); $takeLoc[$it]=0;} } # control: plot curve if (0){ for ($it=1; $it<=300; $it+=5){ ($newSimThresh,$msg)=&getYcurveSim($it); printf "%3d %8.2f\n",$it,$newSimThresh;} } return(@takeLoc); } # end of hsspFilterGetCurveSim #============================================================================== sub hsspFilterGetCurveMinMaxSim { local($minLoc,$maxLoc,$fhSbr) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok,@notLoc); $[ =1 ; #------------------------------------------------------------------------------- # hsspFilterGetCurveMinMaxSim flags positions (in pairs) above maxSim and below minSim # in: $minLoc,$maxLoc = distances from HSSP (new sim) threshold # in: $fhSbr: if not defined, no output written # out: @notLoc # GLOBAL in /out: $rd{"NR","$it"} #------------------------------------------------------------------------------- $sbrName="lib-br:"."hsspFilterGetCurveMinMaxSim"; $#notLoc=0; foreach $it (1..$rd{"NROWS"}){ # loop over all pairs ($newSimThresh,$msg)= &getYcurveSim($rd{"LALI","$it"}); return(&errSbrMsg("failed getYcurveSim for it=$it, lali=". $rd{"LALI","$it"}.", ide=".$rd{"WSIM","$it"}, $msg)) if ($msg !~/^ok/); $dist=100 * $rd{"WSIM","$it"} - $newSimThresh; if ($dist > $maxLoc){ $notLoc[$it]=1;} elsif ($dist < $minLoc){ $notLoc[$it]=1;} else { printf "--- %3d: %5.2f < %5.2f < %5.2f i=%5.2f (%5d)\n", $it,$minLoc,$dist,$maxLoc,(100*$rd{"WSIM","$it"}),$rd{"LALI","$it"} if (defined $fhSbr);} } return(@notLoc); } # end of hsspFilterGetCurveMinMaxSim #============================================================================== sub hsspFilterGetPosExcl { local($exclTxtLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok,@notLoc,@exclLoc); $[ =1 ; #------------------------------------------------------------------------------- # hsspFilterGetPosExcl flags positions (in pairs) to exclude # in: e.g. excl=1-5,9,15 # out: @notLoc # GLOBAL in /out: $rd{"NALIGN"},$rd{"NROWS"},$rd{"NR","$it"} #------------------------------------------------------------------------------- $sbrName="lib-br:"."hsspFilterGetPosExcl"; # text '1-5,7,12' to array (1,2,3,4,5,7,12) $#exclLoc=$#notLoc=0; if ($exclTxtLoc=~/\*$/){ # replace wild card $exclTxtLoc=~s/\*$/$rd{"NALIGN"}/;} # @exclLoc= &get_range($exclTxtLoc); # all pairs foreach $it (1..$rd{"NROWS"}){ $takeLoc[$it]=0; foreach $i (@exclLoc) { if ($i == $rd{"NR","$it"}) { $notLoc[$it]=1; last;}}} return(@notLoc); } # end of hsspFilterGetPosExcl #============================================================================== sub hsspFilterGetPosIncl { local($inclTxtLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok,@takeLoc,@inclLoc); $[ =1 ; #------------------------------------------------------------------------------- # hsspFilterGetPosIncl flags positions (in pairs) to include # in: e.g. incl=1-5,9,15 # out: @takeLoc # GLOBAL in /out: $rd{"NALIGN"},$rd{"NROWS"},$rd{"NR","$it"} #------------------------------------------------------------------------------- $sbrName="lib-br:"."hsspFilterGetPosExIn"; # text '1-5,7,12' to array (1,2,3,4,5,7,12) $#inclLoc=$#takeLoc=0; if ($inclTxtLoc=~/\*$/){ # replace wild card $inclTxtLoc=~s/\*$/$rd{"NALIGN"}/;} @inclLoc= &get_range($inclTxtLoc); # all pairs foreach $it (1..$rd{"NROWS"}){ $takeLoc[$it]=0; foreach $i (@inclLoc) { if ($i == $rd{"NR","$it"}) { $takeLoc[$it]=1; last;}}} return(@takeLoc); } # end of hsspFilterGetPosIncl #============================================================================== sub hsspFilterGetRuleBoth { local($threshLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok,@notLoc); $[ =1 ; #------------------------------------------------------------------------------- # hsspFilterGetRuleBoth flags all positions (in pairs) with: # ide > thresh, and similarity > thresh # in: $threshLoc= distance from HSSP (new ide) threshold # out: @notLoc # GLOBAL in /out: $rd{"NR","$it"},$rd{"LALI","$it"},$rd{"IDE","$it"},$rd{"WSIM","$it"} #------------------------------------------------------------------------------- $sbrName="lib-br:"."hsspFilterGetRuleBoth"; $threshLoc="-100" if (! defined $threshLoc); $#tmp=0; foreach $it (1..$rd{"NROWS"}){ # loop over all pairs $tmp[$it]=0; if ($threshLoc > -100){ ($newIdeThresh,$msg)= &getYcurveIde($rd{"LALI","$it"}); return(&errSbrMsg("failed getYcurveIde for it=$it, lali=". $rd{"LALI","$it"}.", ide=".$rd{"IDE","$it"}, $msg)) if ($msg !~/^ok/); ($newSimThresh,$msg)= &getYcurveSim($rd{"LALI","$it"}); return(&errSbrMsg("failed getYcurveIde for it=$it, lali=". $rd{"LALI","$it"}.", ide=".$rd{"WSIM","$it"}, $msg)) if ($msg !~/^ok/); $distSim=100 * $rd{"WSIM","$it"} - $newSimThresh; next if ($distSim < $threshLoc); $distIde=100 * $rd{"IDE","$it"} - $newIdeThresh; next if ($distIde < $threshLoc);} $tmp[$it]=1; } return(@tmp); } # end of hsspFilterGetRuleBoth #============================================================================== sub hsspFilterGetRuleSgi { local($threshLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok,@okLoc); $[ =1 ; #------------------------------------------------------------------------------- # hsspFilterGetRuleSgi Sim > Ide, i.e. flags all positions (in pairs) with: # sim > ide, and both above thresh (optional) # in: $threshLoc distance from HSSP (new) threshold (optional), # in: if not defined thresh -> take all # out: @okLoc # GLOBAL in /out: $rd{"NR","$it"},$rd{"LALI","$it"},$rd{"IDE","$it"},$rd{"WSIM","$it"} #------------------------------------------------------------------------------- $sbrName="lib-br:"."hsspFilterGetRuleBoth"; $threshLoc="-100" if (! defined $threshLoc); $LscreenTmp=0; $#tmp=0; foreach $it (1..$rd{"NROWS"}){ # loop over all pairs $tmp[$it]=0; # no threshold given next if ($threshLoc <= -100); $simLoc=$rd{"WSIM","$it"};$ideLoc=$rd{"IDE","$it"}; print "TMP: $it not sim=$simLoc, ide=$ideLoc, \n" if ($LscreenTmp && $simLoc < $ideLoc); # similarity <= identity next if ($simLoc <= $ideLoc); print "TMP: $it sim=$simLoc, ide=$ideLoc, \n" if ($LscreenTmp); ($newSimThresh,$msg)= &getYcurveSim($rd{"LALI","$it"}); return(&errSbrMsg("failed getYcurveSim for it=$it, lali=". $rd{"LALI","$it"}.", ide=".$rd{"WSIM","$it"}, $msg)) if ($msg !~/^ok/); ($newIdeThresh,$msg)= &getYcurveIde($rd{"LALI","$it"}); return(&errSbrMsg("failed getYcurveIde for it=$it, lali=". $rd{"LALI","$it"}.", ide=".$rd{"IDE","$it"}, $msg)) if ($msg !~/^ok/); print "TMP: threshSim=$newSimThresh, \n" if ($LscreenTmp); print "TMP: threshIde=$newIdeThresh, \n" if ($LscreenTmp); $distSim=100 * $rd{"WSIM","$it"} - $newSimThresh; print "TMP: not dsim=$distSim < $threshLoc\n" if ($LscreenTmp && $distSim < $threshLoc); next if ($distSim < $threshLoc); $distIde=100 * $rd{"IDE","$it"} - $newIdeThresh; print "TMP: not dide=$distIde < $threshLoc\n" if ($LscreenTmp && $distIde < $threshLoc); next if ($distIde < $threshLoc); print "TMP: take: dsim=$distSim, dide=$distIde, threshloc=$threshLoc\n" if ($LscreenTmp); $tmp[$it]=1; } return(@tmp); } # end of hsspFilterGetRuleSgi #============================================================================== sub hsspFilterMarkFile { local($fileInLoc,$fileOutLoc,@takeLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # hsspFilterMarkFile marks the positions specified in command line # in: $fileIn,$fileOut,@num = number to mark # out: implicit: fileMarked # err: (1,'ok'), (0,'message') #------------------------------------------------------------------------------- $sbrName="lib-br:"."hsspFilterMarkFile";$fhinLoc="FHIN_"."$sbrName";$fhoutLoc="FHOUT_"."$sbrName"; # check arguments return(0,"*** $sbrName: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrName: not def fileOutLoc!") if (! defined $fileOutLoc); return(0,"*** $sbrName: not def \@takeLoc!") if (! defined @takeLoc || $#takeLoc<1); return(0,"*** $sbrName: miss in file '$fileInLoc'!") if (! -e $fileInLoc); # open files &open_file("$fhinLoc","$fileInLoc") || return(0,"*** ERROR $sbrName: in=$fileInLoc not opened\n"); &open_file("$fhoutLoc", ">$fileOutLoc") || return(0,"*** ERROR $sbrName: out=$fileOutLoc not opened\n"); # ------------------------------ while ( <$fhinLoc> ) { # read/write HSSP header $tmp=$_; print $fhoutLoc $tmp; last if (/^ NR\./); } # last when header info start $ct=0; # ------------------------------ while ( <$fhinLoc> ) { # read/write each pair (header) $tmp=$_;$tmp=~s/\n//g; $tmpx=$tmp;$tmpx=~s/\s//g; $line=$_; next if ( length($tmpx)==0 ); if (/^\#\#/) { print $fhoutLoc $line; last;} # now alignments start ++$ct; $tmppos=substr($tmp,1,7); # get first 7 characters of line $tmprest=$tmp;$tmprest=~s/$tmppos//g; # extract rest $pos=$tmppos;$pos=~s/\s|\://g; if (defined $takeLoc[$ct] && $takeLoc[$ct]) { print $fhoutLoc $line;} elsif (defined $takeLoc[$ct] &&! $takeLoc[$ct]) { $tmppos=~s/ \:/\*\:/g; print $fhoutLoc "$tmppos","$tmprest\n"; } else { print "*** ERROR for ct=$ct, $tmppos","$tmprest\n"; }} # ------------------------------ while ( <$fhinLoc> ) { # read/write remaining file (alis asf) print $fhoutLoc $_;} close($fhinLoc);close($fhoutLoc); return(1,"ok $sbrName"); } # end of hsspFilterMarkFile #============================================================================== sub hsspGetFile { local ($fileInLoc,$Lscreen,@dir) = @_ ; local ($fileHssp,$dir,$tmp,$chainLoc,@dir2,$idLoc); $[ =1 ; #-------------------------------------------------------------------------------- # hsspGetFile searches all directories for existing HSSP file # in: $file,$Lscreen,@dir # out: returned file,chain ($hssp,$chain), (if chain in file) # watch: loop onto itself: # 1prcH.hssp not found -> try 1prc.hssp #-------------------------------------------------------------------------------- $#dir2=$Lok=0; return(0,"no input file") if (! defined $fileInLoc); $chainLoc="";$idLoc=$fileInLoc;$idLoc=~s/^.*\///g; $#dir=0 if (! defined @dir); $Lscreen=0 if (! defined $Lscreen); # passed dir instead of Lscreen if (-d $Lscreen) { @dir=($Lscreen,@dir); $Lscreen=0;} $fileInLoc=~s/\s|\n//g; # ------------------------------ # is HSSP ok return($fileInLoc," ") if (-e $fileInLoc && &is_hssp($fileInLoc)); # ------------------------------ # purge chain? if ($fileInLoc=~/^(.*\.hssp)_?([A-Za-z0-9])$/){ $file=$1; $chainLoc=$2; return($file,$chainLoc) if (-e $file && &is_hssp($file)); } # ------------------------------ # try adding directories foreach $dir(@dir){ # avoid endless loop when calling itself $Lok=1 if ($dir =~ /\/data\/hssp/); push(@dir2,$dir);} @dir=@dir2; push(@dir,"/data/hssp/") if (!$Lok); # give default # ------------------------------ # before trying: purge chain $file=$fileInLoc; $chainLoc=" "; $file=~s/^(.*\.hssp)_?([A-Za-z0-9])$/$1/; $chainLoc=$2 if (defined $2); # loop over all directories $fileHssp= &hsspGetFileLoop($file,$Lscreen,@dir); return($fileHssp,$chainLoc) if (-e $fileHssp && &is_hssp($fileHssp)); # ------------------------------ # still not: dissect into 'id'.'chain' $tmp_file=$fileInLoc; $tmp_file=~s/^([A-Za-z0-9]+).*(\.hssp.*)$/$1$2/g; $fileHssp= &hsspGetFileLoop($tmp_file,$Lscreen,@dir); return($fileHssp,$chainLoc) if (-e $fileHssp && &is_hssp($fileHssp)); # ------------------------------ # change version of file (1sha->2sha) $tmp1=substr($idLoc,2,3); foreach $it (1..9) { $tmp_file="$it"."$tmp1".".hssp"; $fileHssp= &hsspGetFileLoop($tmp_file,$Lscreen,@dir); last if ($fileHssp ne "0");} return (0) if ( ! -e $fileHssp || &is_hssp_empty($fileHssp)); return($fileHssp,$chainLoc); } # end of hsspGetFile #============================================================================== sub hsspGetFileLoop { local ($fileInLoop,$Lscreen,@dir) = @_ ; local ($dir,$tmp); $[ =1 ; #-------------------------------------------------------------------------------- # hsspGetFileLoop loops over all directories # in: $file,$Lscreen,@dir # out: returned file #-------------------------------------------------------------------------------- # already ok return($fileInLoop) if (&is_hssp($fileInLoop)); # missing extension $fileInLoop.=".hssp" if ($fileInLoop !~ /\.hssp/); # already ok return($fileInLoop) if (&is_hssp($fileInLoop)); # do NOT continue if starting with dir!! return(0) if ($fileInLoop =~ /^\//); # ------------------------------ foreach $dir (@dir) { # search through dirs $tmp=&complete_dir($dir) . $fileInLoop; # try directory $tmp=~s/\/\//\//g; # '//' -> '/' print "--- hsspGetFileLoop: \t trying '$tmp'\n" if ($Lscreen); return($tmp) if (-e $tmp && &is_hssp($tmp) ); } return(0); # none found } # end of hsspGetFileLoop #============================================================================== sub hsspRdHeader { local ($fileInLoc,@kwdInLoc) = @_ ; local ($sbrName,$fhinLoc,$tmp, @kwdDefHsspTopLoc,@kwdDefHsspHdrLoc,@kwdHsspTopLoc,@kwdHsspHdrLoc,@tmp, $regexpBegHeader,$regexpEndHeader,$regexpLongId,$lenStrid,$LisLongId, %ptr,$kwd,$Lok,$Lpdb,$des,$beg,$end,$mid,$ct,$id,$strid,$ptr,$tmp); $[ =1 ; #------------------------------------------------------------------------------- # hsspRdHeader reads a HSSP header # in: $fileHssp (must exist), # @kwdInLoc = one of the default keywords # (@kwdLocHsspTop,@kwdLocHsspHeader) # in: 'nopair' surpresses reading of pair information # out: for top (e.g. NALIGN): $rd{"kwd"} # for prot (e.g. LALI): $rd{"kwd","$it"} # note: for the later number of elements (it) in # $rd{"NROWS"} # special ID=ID1, $rd{"kwd","$it"} existes for ID1 and ID2 #------------------------------------------------------------------------------- $sbrName="lib-br:hsspRdHeader";$fhinLoc="FHIN"."$sbrName";$fhinLoc=~tr/[a-z]/[A-Z]/; # file existing? if (! -e $fileInLoc || ! &is_hssp($fileInLoc) ){ print "*** ERROR $sbrName no HSSP file '$fileInLoc'\n"; return(0);} # ------------------------------ # settings describing format @kwdDefHsspTopLoc= ("PDBID","DATE","SEQBASE","PARAMETER","THRESHOLD", "REFERENCE","HEADER","COMPND","SOURCE","AUTHOR", "SEQLENGTH","NCHAIN","KCHAIN","NALIGN"); @kwdDefHsspHdrLoc= ("NR","ID","STRID","IDE","WSIM","IFIR","ILAS", "JFIR","JLAS","LALI","NGAP","LGAP","LSEQ2","ACCNUM","PROTEIN"); $regexpBegHeader= "^\#\# PROTEINS"; # begin of reading $regexpEndHeader= "^\#\# ALIGNMENTS"; # end of reading $regexpLongId= "^PARAMETER LONG-ID :YES"; # identification of long id $lenStrid= 4; # minimal length to identify PDB identifiers $LisLongId= 0; # long identifier names $ptr{"IDE"}=1;$ptr{"WSIM"}=2;$ptr{"IFIR"}=3;$ptr{"ILAS"}=4;$ptr{"JFIR"}=5;$ptr{"JLAS"}=6; $ptr{"LALI"}=7;$ptr{"NGAP"}=8;$ptr{"LGAP"}=9;$ptr{"LSEQ2"}=10; $ptr{"ACCNUM"}=11; # ------------------------------ # check input arguments $#kwdHsspTopLoc=$#kwdHsspHdrLoc=$Lpdb=$LnoPair=0; foreach $kwd (@kwdInLoc){ $Lok=0; if ($kwd eq "nopair"){ $LnoPair=1; next;} $Lpdb=1 if (! $Lpdb && ($kwd =~/^PDBID/)); foreach $des (@kwdDefHsspTopLoc) { if ($kwd eq $des){ $Lok=1; push(@kwdHsspTopLoc,$kwd); last;}} next if ($Lok || $LnoPair); foreach $des (@kwdDefHsspHdrLoc){ if ($kwd eq $des){ $Lok=1; push(@kwdHsspHdrLoc,$kwd); last;} } print "-*- WARNING $sbrName input kwd=$kwd, makes no sense??\n" if (! $Lok);} # force reading of NALI push(@kwdHsspTopLoc,"PDBID") if (! $Lpdb); # get column numbers to read # ------------------------------ # now start to read $Lok=&open_file("$fhinLoc","$fileInLoc"); if (! $Lok){print "*** ERROR $sbrName HSSP file could not be opened '$fileInLoc'\n"; return(0);} undef %tmp; # save space # ------------------------------ while ( <$fhinLoc> ) { # read top last if ($_ =~ /$regexpBegHeader/); if ($_ =~ /$regexpLongId/) { $LisLongId=1;} else{$_=~s/\n//g;$arg=$_; foreach $des (@kwdHsspTopLoc){ if ($arg =~ /^$des\s+(.+)$/){ if (defined $ok{"$des"}){ # multiple lines! $tmp="$1"."\t"; if (defined $tmp{"$des"}){ $tmp{"$des"}.=$tmp;} else{$tmp{"$des"}=$tmp;}} else {$ok{"$des"}=1;$tmp{"$des"}=$1;} if ($des=~/SEQLENGTH|NCHAIN|KCHAIN|NALIGN/){ $tmp{"$des"}=~s/^(\d+)[^0-9]+.*$/$1/;} # purge blanks last;}}}} # ------------------------------ $ct=0; # read header while ( <$fhinLoc> ) { last if ($LnoPair); # supress reading pair info last if ($_ =~ /$regexpEndHeader/); next if ($_ =~ /^ NR\./); # skip descriptors $_=~s/\n//g; $lenLine=length($_); if ($LisLongId){ $maxMid=115; $maxMid=($lenLine-56) if ($lenLine < 115); $maxEnd=109; $maxEnd=$lenLine if ($lenLine < 109); $beg=substr($_,1,56); $end=0; $end=substr($_,109) if ($lenLine >=109); $mid=substr($_,57,115); } else { $maxMid= 62; $maxMid=($lenLine-28) if ($lenLine < 90); $beg=substr($_,1,28); $end=0; $end=substr($_,90) if ($lenLine >=90); $mid=substr($_,29,90); } $end=~s/^\s*|\s*$//g; # purge leading blanks $mid=~s/^\s*|\s*$//g; # purge leading blanks # SWISS accession: hack because it may be empty! if ($lenLine > 86) { $accnum=substr($_,81,6); $accnum=~s/(\s)\s+/$1/g ; } else { $accnum=0;} # begin: counter and id $beg=~s/.+ \:\s*|\s*$//g; if (! $LisLongId) {$id=$beg;$id=~s/([^\s]+).*$/$1/; $strid=$beg;$strid=~s/$id|\s//g; } else {$id=$beg;$id=~s/(.+_\S+).*/$1/; $strid=substr($_,49,6);$strid=~s/\s//g; } $tmp=$lenStrid-1; if ( (length($strid)<$lenStrid) && ($id=~/^[0-9][A-Z0-9]{$tmp,$tmp}\s*/)){ $strid=substr($id,1,$lenStrid); } ++$ct; $tmp{"ID","$ct"}= $id; $tmp{"NR","$ct"}= $ct; $tmp{"STRID","$ct"}= $strid; # correct for ID = PDBid $tmp{"STRID","$ct"}= $id if ($strid=~/^\s*$/ && &is_pdbid($id)); $tmp{"PROTEIN","$ct"}=$end; $tmp{"ID1","$ct"}=$tmp{"PDBID"}; $tmp{"ACCNUM","$ct"}=$accnum; # middle all info $#tmp=0;@tmp=split(/\s+/,$mid); foreach $_ (@tmp) {$_=~s/\s//g;} foreach $des (@kwdHsspHdrLoc){ next if ( ! defined $ptr{"$des"}); next if ( $des =~/^ACCNUM/); $ptr=$ptr{"$des"}; $tmp{"$des","$ct"}=$tmp[$ptr]; }}close($fhinLoc); $tmp{"NROWS"}=$ct; # clean up $#kwdInLoc=$#kwdDefHsspHdrLoc=$#kwdHsspTopLoc=$#tmp= $#kwdDefHsspTopLoc=$#kwdHsspHdrLoc=0; undef %ptr; return(1,%tmp); } # end of hsspRdHeader #============================================================================== sub is_hssp { local ($fileInLoc) = @_ ;local ($fh,$Lis); #-------------------------------------------------------------------------------- # is_hssp checks whether or not file is in HSSP format # in: $file # out: 1 if is hssp; 0 else #-------------------------------------------------------------------------------- return (0) if (! defined $fileInLoc || ! -e $fileInLoc) ; $fh="FHIN_CHECK_HSSP"; &open_file("$fh", "$fileInLoc") || return(0); $Lis=0; while ( <$fh> ) {$Lis=1 if (/^HSSP/) ; last; }close($fh); return $Lis; } # end of is_hssp #============================================================================== sub is_hssp_empty { local ($fileInLoc) = @_ ;local ($fh,$Lis); #-------------------------------------------------------------------------------- # is_hssp_empty checks whether or not HSSP file has NALIGN=0 # in: $file # out: 1 if is empty; 0 else #-------------------------------------------------------------------------------- return (0) if (! defined $fileInLoc || ! -e $fileInLoc); $fh="FHIN_CHECK_HSSP"; &open_file("$fh", "$fileInLoc") || return(0); while ( <$fh> ) { if ($_=~/^NALIGN\s+(\d+)/){ if ($1 eq "0"){ close($fh); return(1);} last; }}close($fh); return 0; } # end of is_hssp_empty #============================================================================== sub is_pdbid { local ($id) = @_ ; #-------------------------------------------------------------------------------- # is_pdbid checks whether or not id is a valid PDBid (number 3 char) # in: $file # out: 1 if is DBid, 0 else #-------------------------------------------------------------------------------- return 1 if ((length($id) <= 6) && ($id=~/^[0-9][0-9a-z]{3,3}[^0-9a-z]?/)); return 0; } # end of is_pdbid #============================================================================== sub maxhomGetThresh { local($ideIn)=@_; local($tmp,$thresh_txt); $[ =1 ; #---------------------------------------------------------------------- # maxhomGetThresh translates cut-off ide into text input for MAXHOM csh # in: $ideIn (= distance to FORMULA, old) # out: $txt 'FORMULA+/-n' #---------------------------------------------------------------------- # final txt for MAXHOM cshell (FORMULA,FORMULA-n,FORMULA+n) if ($ideIn>25) { $tmp=$ideIn-25; $thresh_txt="FORMULA+"."$tmp"; } elsif($ideIn<25) { $tmp=25-$ideIn; $thresh_txt="FORMULA-"."$tmp"; } else { $thresh_txt="FORMULA"; } return($thresh_txt); } # end of maxhomGetThresh #============================================================================== sub open_file { local ($file_handle,$file_name,$log_file) = @_ ; local ($temp_name) ; #------------------------------------------------------------------------------- # open_file opens file, writes warning asf #------------------------------------------------------------------------------- $temp_name = $file_name ; $temp_name =~ s/^>>|^>//g ; if ( ($file_name =~ /^>>/ ) && ( ! -e $temp_name ) ) { print "*** INFO (open_file): append file=$temp_name, does not exist-> create it\n" ; open ($file_handle, ">$temp_name") || Carp::confess( "failed to open $temp_name: $!" ) || do { if ( $log_file ) { print $log_file "***\t Cannot create new file: $temp_name\n" ;} return (0); }; close ("$file_handle") ;} open ($file_handle, "$file_name") || Carp::confess( "failed to open $file_name: $!" ) || do { if ( $log_file ) { print $log_file "*** lib-br:open_file: Cannot create new file '$file_name'\n" ;} return(0); }; return(1); } # end of open_file #============================================================================== sub sysCpfile { local($fileToCopy,$fileToCopyTo,$niceLoc) = @_ ; local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # sysCpfile system call '\\cp file1 file2' (or to dir) # in: file1,file2 (or dir), nice value (nice -19) # out: ok=(1,'cp a b') , else=(0,msg) #------------------------------------------------------------------------------- $sbrName="sysCpfile"; $niceLoc="" if (! defined $niceLoc); return(0,"*** $sbrName: missing input file '$fileToCopy'!") if (! -e $fileToCopy); return(0,"*** $sbrName: needs 2 arg 'fToCopy fToCopyTo'!") if (! defined $fileToCopyTo); if (-d $fileToCopyTo){ # is directory if ($fileToCopyTo !~/\/$/){$fileToCopyTo.="/";}} $Lok= system("$niceLoc \\cp $fileToCopy $fileToCopyTo"); if( $Lok ){ Carp::confess( "cmd $niceLoc \\cp $fileToCopy $fileToCopyTo failed: ".( $? >> 8 ) ); } # return(0,"*** $sbrName: fail copy '$fileToCopy -> $fileToCopyTo' ($Lok)!") if (! $Lok); if (-d $fileToCopyTo){ # is directory $tmp=$fileToCopy;$tmp=~s/^.*\///g;$tmp=$fileToCopyTo.$tmp; $Lok=0 if (! -e $tmp);} elsif (! -e $fileToCopyTo){ $Lok=0; } elsif (-e $fileToCopyTo) { $Lok=1; } return(0,"*** $sbrName: fail copy '$fileToCopy -> $fileToCopyTo' ($Lok)!") if (! $Lok); return(1,"$niceLoc \\cp $fileToCopy $fileToCopyTo"); } # end of sysCpfile #============================================================================== sub sysDate { # local($sbrName,$fhinLoc,$tmp,$Lok); $[ =1 ; #------------------------------------------------------------------------------- # sysDate returns $Date # out: $Date (May 30, 1998 59:39:03) #------------------------------------------------------------------------------- @tmp=("/home/rost/perl/ctime.pl","/home/rost/pub/perl/ctime.pl"); # ------------------------------ # get function if (defined &localtime) { foreach $tmp(@tmp){ if (-e $tmp){$Lok=require("$tmp"); last;}} if (defined &ctime && &ctime && defined &localtime && &localtime){ @Date = split(' ',&ctime(time)) ; shift (@Date) ; $Date="$Date[2] $Date[3], $Date[$#Date] $Date[4]"; return($Date); } } # ------------------------------ # or get system time $localtime=`date`; @Date=split(/\s+/,$localtime); $Date="$Date[2] $Date[3], $Date[$#Date] $Date[4]"; return($Date); } # end of sysDate #=============================================================================== sub sysGetPwd { $[ =1 ; #------------------------------------------------------------------------------- # sysGetPwd returns local directory # out: $DIR (no slash at end!) #------------------------------------------------------------------------------- $sbrName="lib-sys:"."sysGetPwd"; # already defined or in ENV? $pwdLoc= $PWD || $ENV{'PWD'} || 0; if ($pwdLoc && -d $pwdLoc) { $pwdLoc=~s/\/$//g; return($pwdLoc); } # read bin/pwd if ($pwdLoc && -d "/bin/pwd") { open(C,"/bin/pwd|"); $pwdLoc= || 0; close(C); return($pwdLoc) if ($pwdLoc && -d $pwdLoc); } if ($pwdLoc && -d $pwdLoc) { $pwdLoc=~s/\/$//g; return($pwdLoc); } # system call $pwdLoc=`pwd`; $pwdLoc=~s/\s|\n//g; if (-d $pwdLoc) { $pwdLoc=~s/\/$//g; return($pwdLoc); } return(0); } # end of sysGetPwd #=============================================================================== sub sysGetUserLoc { $[ =1 ; #------------------------------------------------------------------------------- # sysGetUserLoc returns $USER (i.e. user name) # out: USER #------------------------------------------------------------------------------- $sbrName=$0.":"."sysGetUserLoc"; if (defined $ENV{'USER'}){ return($ENV{'USER'}); } $tmp=`whoami`; return($tmp) if (defined $tmp && length($tmp)>0); $tmp=`who am i`; # SUNMP return($tmp) if (defined $tmp && length($tmp)>0); return(0); } # end of sysGetUserLoc #============================================================================== sub sysRunProg { local ($cmd,$fileScrLoc,$fhErrLoc) = @_ ; $[ =1; #------------------------------------------------------------------------------- # sysRunProg pipes arguments into $prog, and cats the output # from $prog into a file # in: $cmd,$fileScrLoc,$fhError # in: $cmd='prog,arg1,arg2' # in: where prog is the program, e.g. 'wc -l, file1,file2' # in: $fileScrLoc is the output file # in: NOTE: if not defined: buffered to STDOUT # in: = 0 to surpress writing # in: $fhError filehandle for ERROR writing # NOTE: to STDOUT if not defined # in: = 0 to surpress writing # out: 0|1,message # err: ok -> 1,ok | err -> 0,message #------------------------------------------------------------------------------- $sbrName="$0:sysRunProg"; return(0,"*** ERROR $sbrName: argument program ($cmd) not defined\n") if (! defined $cmd || length($cmd)<1); $fhErrLoc=0 if (! defined $fhErrLoc); $fileScrLoc=0 if (! defined $fileScrLoc); # ------------------------------ # dissect arguments ($prog,@arg)=split(/,/,$cmd); if ($fhErrLoc && ! @arg) { print $fhErrLoc "-*- WARN $sbrName: no arguments to pipe into:\n$prog\n"; } elsif ($fhErrLoc && $par{debug}) { print $fhErrLoc "--- $sbrName: system cmd=\n$prog\n--- $sbrName: fileOut=$fileScrLoc cmd IN:\n$cmd\n";} # ------------------------------ # pipe output into file? $Lpipe=0; $Lpipe=1 if ($fileScrLoc); # hack br: 08-98 to avoid pipe pipe, i.e. # prog="cmd > file" -> 'cmd > file | cat >> filescreen' fails $Lpipe=0 if ($prog =~ /\s+>>?\s+\S+\s*$/); $prog.=" | cat >> $fileScrLoc " if ($Lpipe); # print "$cmd\n";exit; # ------------------------------ # opens cmdtmp into pipe if( $par{"debug"} ) { Carp::cluck( "|$prog" ); } open (CMD, "|$prog") || Carp::confess( "*** $sbrName cannot open program '|$prog': $!" ); # get input arguments (< arg) foreach $tmp (@arg) { $tmp=~s/\n|^\s*|\s*$//; # delete end of line, and leading blanks print CMD "$tmp\n"; if( $par{"debug"} ) { warn("CMD: $tmp|"); } } if( !close(CMD) ){ Carp::confess( "cmd '|$prog' failed: ".( $? >> 8 ) ); } # upon closing: cmdtmp < @out_command executed return(1,"ok $sbrName"); } # end of sysRunProg #============================================================================== # library collected (end) #============================================================================== #=============================================================================== sub cleanUp { local($fhLoc)=@_; local($sbrName,$fhinLoc,@tmp); $[ =1 ; #------------------------------------------------------------------------------- # cleanUp deletes intermediate files #------------------------------------------------------------------------------- $fhLoc="STDOUT" if (! defined $fhLoc || ! $fhLoc); if ($scrName){$tmp="$scrName".":";}else{$tmp="";} $sbrName="$tmp"."cleanUp"; if ($#fileRm>0){ # remove intermediate files foreach $file (@fileRm){ next if (! -e $file); print $fhLoc "--- $sbrName unlink '",$file,"'\n" if ($Lverb2); unlink($file);}} foreach $kwd ("fileOutTrace","fileOutScreen"){ next if (! defined $par{"$kwd"} || ! -e $par{"$kwd"}); print $fhLoc "--- $sbrName unlink '",$par{"$kwd"},"'\n" if ($Lverb2); unlink($par{"$kwd"});} } # end of cleanUp #=============================================================================== sub hsspFilter { local($fileInLoc,$fileOutLoc,$exeFilterHssp,$fileMatGcg, $inclTxtIn,$exclTxtIn,$minLenIn,$maxLenIn, $minIdeIn,$maxIdeIn,$minSimIn,$maxSimIn, $threshIn,$threshSgiIn,$threshBothIn,$mode,$fileTable,$redRed, $dirWork,$LdebugLoc,$jobidLoc,$fileScreenLoc,$fhSbr) = @_ ; local($sbrNamex,$fhinLoc,$tmp,$Lok,@kwdRdHdr); $[ =1 ; #------------------------------------------------------------------------------- # hsspFilter filters HSSP file # in: $fileIn,$fileOut,$exeFilterHssp,$fileMatGcg, # in NOTE: give 'def' instead of argument for default settings # of any of the above argument (except for files) # in NOTE: for the following '=0' -> no action # in: $inclTxt = '1' | '1-5' | '1,3,7' | '1-5,7' # in: $exclTxt = '1' | '1-5' | '1,3,7' | '1-5,7' # in: $minLen = minimal length of alignment (integer) # in: $maxLen = maximal length of alignment (integer) # in: $minIde|Sim = minimal ide|sim distance # in: $maxIde|Sim = maximal ide|sim distance # in: $thresh = threshold applied # in: $threshSgi = threshold applied for rule 'similarity > identity' # in: $threshBoth = threshold applied for rule 'sim AND ide > threshold' # in: $mode = 'ide|sim|ruleBoth|ruleSgi' (or combination separated by ' ') # in NOTE: mode must be defined to use rule, or thresh, or threshSgi!! # in NOTE: for additional filter on old threshold add 'old' # in: $fileTable = table with pairwise levels of sequence identity # in NOTE: =0 -> avoid writing a table # in NOTE: =1 -> default name = out-filter.dist_tab # in: $redRed = clean all pairs above this threshold (order of appearance!) # in NOTE: integer for percentage cut-off! # in: $dirWork -> directory in which temporary files are # written (if not existing: assume is file name) # =0 -> local dir (files HSSPFIL...) # in: $LdebugLoc = 1 -> temporary files kept # in: $jobid = additional qualifier for temporary files (if 0 =$$) # in: $fileScreen = intermediat file for FORTRAN output (if 0 -> STDOUT) # in: $fhSbr = file handle for info (if 0 -> none written) # out: implicit fileout # err: (1,'ok'), (0,'message') # GLOBAL: $rd{} used as GLOBAL for communication with sbr #------------------------------------------------------------------------------- $sbrNamex="lib-prot:"."hsspFilter";$fhinLoc="FHIN_"."hsspFilter"; $LscreenTmp=0; # $LscreenTmp=1; # ------------------------------ # check arguments return(0,"*** $sbrNamex: not def fileInLoc!") if (! defined $fileInLoc); return(0,"*** $sbrNamex: not def fileOutLoc!") if (! defined $fileOutLoc); return(0,"*** $sbrNamex: not def exeFilterHssp!") if (! defined $exeFilterHssp); return(0,"*** $sbrNamex: not def fileMatGcg!") if (! defined $fileMatGcg); return(0,"*** $sbrNamex: not def inclTxtIn!") if (! defined $inclTxtIn); return(0,"*** $sbrNamex: not def exclTxtIn!") if (! defined $exclTxtIn); return(0,"*** $sbrNamex: not def minLenIn!") if (! defined $minLenIn); return(0,"*** $sbrNamex: not def maxLenIn!") if (! defined $maxLenIn); return(0,"*** $sbrNamex: not def minIdeIn!") if (! defined $minIdeIn); return(0,"*** $sbrNamex: not def maxIdeIn!") if (! defined $maxIdeIn); return(0,"*** $sbrNamex: not def minSimIn!") if (! defined $minSimIn); return(0,"*** $sbrNamex: not def maxSimIn!") if (! defined $maxSimIn); return(0,"*** $sbrNamex: not def threshIn!") if (! defined $threshIn); return(0,"*** $sbrNamex: not def threshSgiIn!") if (! defined $threshSgiIn); return(0,"*** $sbrNamex: not def threshBothIn!") if (! defined $threshBothIn); return(0,"*** $sbrNamex: not def fileTable!") if (! defined $fileTable); return(0,"*** $sbrNamex: not def redRed!") if (! defined $redRed); return(0,"*** $sbrNamex: not def dirWork!") if (! defined $dirWork); return(0,"*** $sbrNamex: not def LdebugLoc!") if (! defined $LdebugLoc); return(0,"*** $sbrNamex: not def jobidLoc!") if (! defined $jobidLoc); return(0,"*** $sbrNamex: not def fileScreenLoc!") if (! defined $fileScreenLoc); return(0,"*** $sbrNamex: not def fhSbr!") if (! defined $fhSbr); # ------------------------------ # default settings $exeFilterHssp="filter_hssp" if ($exeFilterHssp eq "def"); $fileMatGcg= "$par{dirHome}/mat/Maxhom_GCG.metric" if ($fileMatGcg eq "def"); return(0,"*** $sbrNamex: miss in file '$fileInLoc'!") if (! -e $fileInLoc); return(0,"*** $sbrNamex: miss in file '$fileMatGcg'!") if (! -e $fileMatGcg); #lkajan: following does not take PATH into account #return(0,"*** $sbrNamex: miss exe '$exeFilterHssp'!") if (! -e $exeFilterHssp && ! -l $exeFilterHssp); return(0,"*** $sbrNamex: '$fileInLoc' not HSSP file!") if (! &is_hssp($fileInLoc)); return(0,"*** $sbrNamex: '$fileInLoc' empty HSSP file!") if (&is_hssp_empty($fileInLoc)); # ------------------------------ # defaults # ------------------------------ $minIde= 0; $maxIde= 100; $minSim= 0; $maxSim= 100; $thresh= -100; $threshSgi= -100; $threshBoth=-100; $fhSysRunProg= 0; # ------------------------------ # digest input # ------------------------------ $minIde= $minIdeIn if ($minIdeIn); $maxIde= $maxIdeIn if ($maxIdeIn); $minSim= $minSimIn if ($minSimIn); $maxSim= $maxSimIn if ($maxSimIn); $thresh= $threshIn if (length($threshIn) > 0); $threshSgi= $threshSgiIn if (length($threshSgiIn) > 0); $threshBoth=$threshBothIn if (length($threshBothIn) > 0); $fhSysRunProg="STDOUT" if ($fhSbr eq "1"); $fhSysRunProg=$fhSbr if ($fhSbr && $fhSbr ne "1"); $fhSysRunProg="STDOUT" if ($LdebugLoc); $fileScreenLoc=0 if ($LdebugLoc); if (! $dirWork){ $dirWork="";} elsif ($dirWork !~/\/$/) { $dirWork.="/"; } $fileTmp= $dirWork."HSSPFIL-".$jobidLoc.".tmp"; push(@fileRm,$fileTmp); if ($fileTable eq "1"){ # name of file with pair ide table $tmp=$fileOutLoc;$tmp=~s/\.hssp.*$//g; $fileTable=$tmp.".dist_tab";} # ------------------------------ # add full path to output file # if not local if ($fileOutLoc=~/\// && $fileOutLoc !~ /^\// ) { # local dir $pwdLoc=$PWD || &sysGetPwd(); $fileOutLoc=$pwdLoc."/".$fileOutLoc;} # ------------------------------ # defaults @kwdRdHdr=("NALIGN","NR","ID","STRID","IDE","WSIM","LALI"); undef %rd; # -------------------------------------------------- # read HSSP header # out : $rd{"kwd","$it"} ($Lok,%rd)= &hsspRdHeader($fileInLoc,@kwdRdHdr); return(0,"*** ERROR $sbrNamex: failed to read HSSP file ". "'$fileInLoc' header\n") if (! $Lok); # -------------------------------------------------- # marke those to be excluded # (written into temporary file) $#inclPos=$#inclIde=$#inclSim=$#inclBoth=$#inclSgi=$#exclPos=$#exclIde=$#exclSim=0; # label by number @inclPos= &hsspFilterGetPosIncl($inclTxtIn) if ($inclTxtIn); @exclPos= &hsspFilterGetPosExcl($exclTxtIn) if ($exclTxtIn); # label by max/min distance @exclOld= &hsspFilterGetCurveMinMaxOld($minIde,$maxIde) if (($mode && $mode=~/^old/) && ($maxSimIn || $minSimIn) ); @exclIde= &hsspFilterGetCurveMinMaxIde($minIde,$maxIde) if (($mode && $mode=~/^ide/) && ($maxIdeIn || $minIdeIn) ); @exclSim= &hsspFilterGetCurveMinMaxSim($minSim,$maxSim) if ($maxSimIn || $minSimIn); # label by thresholds @inclOld= &hsspFilterGetCurveOld($thresh) if ($mode && $mode =~/^old/); @inclIde= &hsspFilterGetCurveIde($thresh) if ($mode && $mode =~/^ide/); @inclSim= &hsspFilterGetCurveSim($thresh) if ($mode && $mode =~/^sim/); @inclBoth=&hsspFilterGetRuleBoth($threshBoth) if ($mode && $mode =~/ruleBoth/i); @inclSgi= &hsspFilterGetRuleSgi ($threshSgi) if ($mode && $mode =~/ruleSgi/i || $threshSgi > -100); # -------------------------------------------------- # hierarchy $#incl=$ctNoAction=$ctIncl=0; foreach $it (1..$rd{"NROWS"}){ # thresholds # (1a) do NOT take IDE or SIM $incl[$it]=0 if ((defined $inclIde[$it] && ! $inclIde[$it]) || (defined $inclSim[$it] && ! $inclSim[$it]) || (defined $inclOld[$it] && ! $inclOld[$it]) ); # (2a) take IDE or SIM $incl[$it]=1 if ((defined $inclIde[$it] && $inclIde[$it]) || (defined $inclSim[$it] && $inclSim[$it]) || (defined $inclOld[$it] && $inclOld[$it]) ); # (2b) exclude overrides $incl[$it]=0 if ((defined $exclIde[$it] && $exclIde[$it]) || (defined $exclSim[$it] && $exclSim[$it]) || (defined $exclOld[$it] && $exclOld[$it])); # rules # (3) take from rules $incl[$it]=1 if ((defined $inclBoth[$it] && $inclBoth[$it]) || (defined $inclSgi[$it] && $inclSgi[$it])); # length $incl[$it]=0 if (! $incl[$it] && ( ($minLenIn > 0 && $rd{"LALI",$it} < $minLenIn) || ($maxLenIn > 0 && $rd{"LALI",$it} > $maxLenIn) ) ); # positions # (4a) position specified ? $incl[$it]=1 if (defined $inclPos[$it] && $inclPos[$it]); # (4b) exclude overrides $incl[$it]=0 if (defined $exclPos[$it] && $exclPos[$it]); # ------------------------------ # what to do if not? if (! defined $incl[$it]){ # no wishes -> take it! if (! @inclIde && ! @inclSim && ! @inclBoth && ! @inclSgi && ! @inclPos){ $incl[$it]=1; ++$ctNoAction;} else { # there was a 'wish list' -> default is to exclude $incl[$it]=0;}} ++$ctIncl if ($incl[$it]); if ($LscreenTmp) { printf "take %3d lali=%3d ide=%3d\n",$it,$rd{"LALI",$it},100*$rd{"IDE",$it} if ($incl[$it]); printf " no %3d lali=%3d ide=%3d\n",$it,$rd{"LALI",$it},100*$rd{"IDE",$it} if (! $incl[$it]);} } $numProt=$rd{"NROWS"}; # store to clean memory undef %rd; # save memory # ------------------------------ # security: if none survived get # self, at least! if ($ctIncl == 0) { $incl[1]=1; $ctIncl=1;} # ------------------------------ # print onto screen if ($fhSbr && $par{debug}){print $fhSbr "--- $sbrNamex: take no:"; foreach $it (1..$numProt){ print $fhSbr "$it," if ($incl[$it]);} print $fhSbr "\n"; printf $fhSbr "--- $sbrNamex: --> =%5d alignments\n",$ctIncl;} # ------------------------------ # write new file # no action, just copy if ($ctNoAction == $numProt && $ctIncl == $numProt){ ($Lok,$msg)= &sysCpfile($fileInLoc,$fileTmp); return(0,"*** ERROR $sbrNamex: failed to copy in=$fileInLoc, to new=$fileTmp\n") if (! $Lok);} else { # mark file ($Lok,$msg)= &hsspFilterMarkFile($fileInLoc,$fileTmp,@incl); return(0,"*** ERROR $sbrNamex: failed to mark=$fileInLoc, to new=$fileTmp\n") if (! $Lok);} # securtiy: check again for existence of file return(0,"*** ERROR $sbrNamex: failed to make new=$fileTmp\n") if (! -e $fileTmp); # -------------------------------------------------- # run FORTRAN # ------------------------------ $threshOld="ALL"; # correct threshold (formula+x) $threshOld= &maxhomGetThresh($thresh) if ($mode =~ /^old/ && $thresh); # ------------------------------ # set up answers $cmd= ""; # avoid warnings $anClean= "NO"; $anClean= "YES" if ($redRed); $anRed= " "; if ($redRed && $redRed<100){ # reduce redundant pairs? $tmp=$redRed/100; $tmp=~s/(\.\d\d).*$/$1/; # only 2 digits $anRed= "$tmp";} $anTable= "NO" if (! $fileTable); $anTable= $fileTable if ($fileTable); # ------------------------------ # run filter_hssp $cmd="$exeFilterHssp,$fileTmp,$fileOutLoc,$fileMatGcg,$threshOld,$anRed,$anClean,$anTable "; ($Lok,$msg)= # &sysRunProg($cmd,0,$fhSysRunProg); # xx &sysRunProg($cmd,$fileScreenLoc,$fhSysRunProg); return(0,"*** ERROR $sbrNamex: failed to filter hssp ($fileTmp,$fileOutLoc)\n".$msg."\n") if (! $Lok || ! -e $fileOutLoc); # ------------------------------ # security: none found -> take # self if (&is_hssp_empty($fileOutLoc)) { # all =0 foreach $it (1..$#incl) { $incl[$it]=0;} # except first $incl[1]=1; ($Lok,$msg)= &hsspFilterMarkFile($fileInLoc,$fileTmp,@incl); return(0,"*** ERROR $sbrNamex: failed to mark (2)=$fileInLoc, to new=$fileTmp\n") if (! $Lok); $anClean= "NO"; $anTable= "NO" if (! $fileTable); $anTable= $fileTable if ($fileTable); # ------------------------------ # run filter_hssp $cmd="$exeFilterHssp,$fileTmp,$fileOutLoc,$fileMatGcg,$threshOld,$anRed,$anClean,$anTable "; ($Lok,$msg)= &sysRunProg($cmd,$fileScreenLoc,$fhSysRunProg); return(0,"*** ERROR $sbrNamex: failed to filter hssp 2nd round ($fileTmp,$fileOutLoc)\n".$msg."\n") if (! $Lok || ! -e $fileOutLoc || &is_hssp_empty($fileOutLoc));} # ------------------------------ # free memory $#inclPos=$#inclIde=$#inclSim=$#inclBoth=$#inclSgi=$#exclPos=$#exclIde=$#exclSim=$#incl= $ctNoAction=$ctIncl=0; undef %rd; # hack br: 98-10 change one day such that # distance table name is input to FORTRAN! $fileOutTableTmp=$fileInLoc; $fileOutTableTmp=~s/\.hssp/_distance.table/; # ------------------------------ $#tmp=0; # process temporary files foreach $file ($fileTmp,$fileScreenLoc){ push(@tmp,$file) if (-e $file);} if (! $LdebugLoc){ # remove temporary files foreach $file(@tmp,$fileOutTableTmp){ next if ($file eq $fileInLoc); print $fhSbr "--- $sbrNamex: remove $file\n" if ($fhSbr && $par{debug}); unlink($file);} return(1,"ok $sbrNamex");} else { return(1,"ok $sbrNamex",@tmp);} } # end of hsspFilter 1; librg-utils-perl-1.0.43/lib/RG/Utils/Makefile.am0000644015075101507510000000004211606322323016135 00000000000000dist_noinst_DATA = $(srcdir)/*.pm librg-utils-perl-1.0.43/lib/RG/Utils/Makefile.in0000644015075101507510000002035711652606215016167 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = lib/RG/Utils DIST_COMMON = $(dist_noinst_DATA) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DATA = $(dist_noinst_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ INSTALL = @INSTALL@ INSTALL_BASE_ARG = @INSTALL_BASE_ARG@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ am__leading_dot = @am__leading_dot@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ dist_noinst_DATA = $(srcdir)/*.pm all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/RG/Utils/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/RG/Utils/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: librg-utils-perl-1.0.43/mat/0000755015075101507510000000000011652607053012577 500000000000000librg-utils-perl-1.0.43/mat/Blast_blosum62.metric0000644015075101507510000000411211171644272016520 00000000000000# Matrix made by matblas from blosum62.iij # * column uses minimum score # BLOSUM Clustered Scoring Matrix in 1/2 Bit Units # Blocks Database = /data/blocks_5.0/blocks.dat # Cluster Percentage: >= 62 # Entropy = 0.6979, Expected = -0.5209 A R N D C Q E G H I L K M F P S T W Y V B Z X * A 4 -1 -2 -2 0 -1 -1 0 -2 -1 -1 -1 -1 -2 -1 1 0 -3 -2 0 -2 -1 0 -4 R -1 5 0 -2 -3 1 0 -2 0 -3 -2 2 -1 -3 -2 -1 -1 -3 -2 -3 -1 0 -1 -4 N -2 0 6 1 -3 0 0 0 1 -3 -3 0 -2 -3 -2 1 0 -4 -2 -3 3 0 -1 -4 D -2 -2 1 6 -3 0 2 -1 -1 -3 -4 -1 -3 -3 -1 0 -1 -4 -3 -3 4 1 -1 -4 C 0 -3 -3 -3 9 -3 -4 -3 -3 -1 -1 -3 -1 -2 -3 -1 -1 -2 -2 -1 -3 -3 -2 -4 Q -1 1 0 0 -3 5 2 -2 0 -3 -2 1 0 -3 -1 0 -1 -2 -1 -2 0 3 -1 -4 E -1 0 0 2 -4 2 5 -2 0 -3 -3 1 -2 -3 -1 0 -1 -3 -2 -2 1 4 -1 -4 G 0 -2 0 -1 -3 -2 -2 6 -2 -4 -4 -2 -3 -3 -2 0 -2 -2 -3 -3 -1 -2 -1 -4 H -2 0 1 -1 -3 0 0 -2 8 -3 -3 -1 -2 -1 -2 -1 -2 -2 2 -3 0 0 -1 -4 I -1 -3 -3 -3 -1 -3 -3 -4 -3 4 2 -3 1 0 -3 -2 -1 -3 -1 3 -3 -3 -1 -4 L -1 -2 -3 -4 -1 -2 -3 -4 -3 2 4 -2 2 0 -3 -2 -1 -2 -1 1 -4 -3 -1 -4 K -1 2 0 -1 -3 1 1 -2 -1 -3 -2 5 -1 -3 -1 0 -1 -3 -2 -2 0 1 -1 -4 M -1 -1 -2 -3 -1 0 -2 -3 -2 1 2 -1 5 0 -2 -1 -1 -1 -1 1 -3 -1 -1 -4 F -2 -3 -3 -3 -2 -3 -3 -3 -1 0 0 -3 0 6 -4 -2 -2 1 3 -1 -3 -3 -1 -4 P -1 -2 -2 -1 -3 -1 -1 -2 -2 -3 -3 -1 -2 -4 7 -1 -1 -4 -3 -2 -2 -1 -2 -4 S 1 -1 1 0 -1 0 0 0 -1 -2 -2 0 -1 -2 -1 4 1 -3 -2 -2 0 0 0 -4 T 0 -1 0 -1 -1 -1 -1 -2 -2 -1 -1 -1 -1 -2 -1 1 5 -2 -2 0 -1 -1 0 -4 W -3 -3 -4 -4 -2 -2 -3 -2 -2 -3 -2 -3 -1 1 -4 -3 -2 11 2 -3 -4 -3 -2 -4 Y -2 -2 -2 -3 -2 -1 -2 -3 2 -1 -1 -2 -1 3 -3 -2 -2 2 7 -1 -3 -2 -1 -4 V 0 -3 -3 -3 -1 -2 -2 -3 -3 3 1 -2 1 -1 -2 -2 0 -3 -1 4 -3 -2 -1 -4 B -2 -1 3 4 -3 0 1 -1 0 -3 -4 0 -3 -3 -2 0 -1 -4 -3 -3 4 1 -1 -4 Z -1 0 0 1 -3 3 4 -2 0 -3 -3 1 -1 -3 -1 0 -1 -3 -2 -2 1 4 -1 -4 X 0 -1 -1 -1 -2 -1 -1 -1 -1 -1 -1 -1 -1 -1 -2 0 0 -2 -1 -1 -1 -1 -1 -4 * -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 -4 1 librg-utils-perl-1.0.43/mat/Maxhom_Blosum.metric0000644015075101507510000000774111323577622016512 00000000000000#********************************************************** MAXHOM AMINO ACID EXCHANGE MATRIX ********************************************** # reference: S.Henikoff and J.Henikoff, PNAS, 89, 10915-10919 (1992) # Matrix made by matblas from blosum62.iij # * column uses minimum score # BLOSUM Clustered Scoring Matrix in 1/2 Bit Units # Blocks Database = /data/blocks_5.0/blocks.dat # Cluster Percentage: >= 62 # Entropy = 0.6979, Expected = -0.5209 #============================================================================================================================================ STRUCTURE-STATES: 1 I/O-STATES: 1 #============================================================================================================================================ AA STR I/O V L I M F W Y G A P S T C H R K Q E N D B Z V 4.00 1.00 3.00 1.00 -1.00 -3.00 -1.00 -3.00 0.00 -2.00 -2.00 0.00 -1.00 -3.00 -3.00 -2.00 -2.00 -2.00 -3.00 -3.00 -3.00 -2.00 L 1.00 4.00 2.00 2.00 0.00 -2.00 -1.00 -4.00 -1.00 -3.00 -2.00 -1.00 -1.00 -3.00 -2.00 -2.00 -2.00 -3.00 -3.00 -4.00 -4.00 -3.00 I 3.00 2.00 4.00 1.00 0.00 -3.00 -1.00 -4.00 -1.00 -3.00 -2.00 -1.00 -1.00 -3.00 -3.00 -3.00 -3.00 -3.00 -3.00 -3.00 -3.00 -3.00 M 1.00 2.00 1.00 5.00 0.00 -1.00 -1.00 -3.00 -1.00 -2.00 -1.00 -1.00 -1.00 -2.00 -1.00 -1.00 0.00 -2.00 -2.00 -3.00 -3.00 -1.00 F -1.00 0.00 0.00 0.00 6.00 1.00 3.00 -3.00 -2.00 -4.00 -2.00 -2.00 -2.00 -1.00 -3.00 -3.00 -3.00 -3.00 -3.00 -3.00 -3.00 -3.00 W -3.00 -2.00 -3.00 -1.00 1.00 11.00 2.00 -2.00 -3.00 -4.00 -3.00 -2.00 -2.00 -2.00 -3.00 -3.00 -2.00 -3.00 -4.00 -4.00 -4.00 -3.00 Y -1.00 -1.00 -1.00 -1.00 3.00 2.00 7.00 -3.00 -2.00 -3.00 -2.00 -2.00 -2.00 2.00 -2.00 -2.00 -1.00 -2.00 -2.00 -3.00 -3.00 -2.00 G -3.00 -4.00 -4.00 -3.00 -3.00 -2.00 -3.00 6.00 0.00 -2.00 0.00 -2.00 -3.00 -2.00 -2.00 -2.00 -2.00 -2.00 0.00 -1.00 -1.00 -2.00 A 0.00 -1.00 -1.00 -1.00 -2.00 -3.00 -2.00 0.00 4.00 -1.00 1.00 0.00 0.00 -2.00 -1.00 -1.00 -1.00 -1.00 -2.00 -2.00 -2.00 -1.00 P -2.00 -3.00 -3.00 -2.00 -4.00 -4.00 -3.00 -2.00 -1.00 7.00 -1.00 -1.00 -3.00 -2.00 -2.00 -1.00 -1.00 -1.00 -2.00 -1.00 -2.00 -1.00 S -2.00 -2.00 -2.00 -1.00 -2.00 -3.00 -2.00 0.00 1.00 -1.00 4.00 1.00 -1.00 -1.00 -1.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 T 0.00 -1.00 -1.00 -1.00 -2.00 -2.00 -2.00 -2.00 0.00 -1.00 1.00 5.00 -1.00 -2.00 -1.00 -1.00 -1.00 -1.00 0.00 -1.00 -1.00 -1.00 C -1.00 -1.00 -1.00 -1.00 -2.00 -2.00 -2.00 -3.00 0.00 -3.00 -1.00 -1.00 9.00 -3.00 -3.00 -3.00 -3.00 -4.00 -3.00 -3.00 -3.00 -3.00 H -3.00 -3.00 -3.00 -2.00 -1.00 -2.00 2.00 -2.00 -2.00 -2.00 -1.00 -2.00 -3.00 8.00 0.00 -1.00 0.00 0.00 1.00 -1.00 0.00 0.00 R -3.00 -2.00 -3.00 -1.00 -3.00 -3.00 -2.00 -2.00 -1.00 -2.00 -1.00 -1.00 -3.00 0.00 5.00 2.00 1.00 0.00 0.00 -2.00 -1.00 0.00 K -2.00 -2.00 -3.00 -1.00 -3.00 -3.00 -2.00 -2.00 -1.00 -1.00 0.00 -1.00 -3.00 -1.00 2.00 5.00 1.00 1.00 0.00 -1.00 0.00 1.00 Q -2.00 -2.00 -3.00 0.00 -3.00 -2.00 -1.00 -2.00 -1.00 -1.00 0.00 -1.00 -3.00 0.00 1.00 1.00 5.00 2.00 0.00 0.00 0.00 3.00 E -2.00 -3.00 -3.00 -2.00 -3.00 -3.00 -2.00 -2.00 -1.00 -1.00 0.00 -1.00 -4.00 0.00 0.00 1.00 2.00 5.00 0.00 2.00 1.00 4.00 N -3.00 -3.00 -3.00 -2.00 -3.00 -4.00 -2.00 0.00 -2.00 -2.00 1.00 0.00 -3.00 1.00 0.00 0.00 0.00 0.00 6.00 1.00 3.00 0.00 D -3.00 -4.00 -3.00 -3.00 -3.00 -4.00 -3.00 -1.00 -2.00 -1.00 0.00 -1.00 -3.00 -1.00 -2.00 -1.00 0.00 2.00 1.00 6.00 4.00 1.00 B -3.00 -4.00 -3.00 -3.00 -3.00 -4.00 -3.00 -1.00 -2.00 -2.00 0.00 -1.00 -3.00 0.00 -1.00 0.00 0.00 1.00 3.00 4.00 4.00 1.00 Z -2.00 -3.00 -3.00 -1.00 -3.00 -3.00 -2.00 -2.00 -1.00 -1.00 0.00 -1.00 -3.00 0.00 0.00 1.00 3.00 4.00 0.00 1.00 1.00 4.00 librg-utils-perl-1.0.43/mat/Maxhom_GCG.metric0000644015075101507510000001036111323577622015641 00000000000000#****************************************************************** MAXHOM AMINO ACID EXCHANGE MATRIX *************************************** # table used by the GCG-package # see: Gribskov and Burgess NAR 14(16) 6745-6763 # minimal value: -1.2 ; maximal value: 1.5 # symbols: "-X!" added # Dayhoff table (Schwartz, R. M. and Dayhoff, M. O. [1979] in Atlas of Protein Sequence and Structure, Dayhoff, M. O. Ed, # pp. 353-358, National Biomedical Research Foundation, Washington D.C.) rescaled by dividing each value by the sum of its row # and column, and normalizing to a mean of 0 and standard deviation of 1.0. The value for FY (Phe-Tyr) = RW =1.425. # Perfect matches are set to 1.5 and no matches on any row are better than perfect matches. #============================================================================================================================================ STRUCTURE-STATES: 1 I/O-STATES: 1 #============================================================================================================================================ AA STR I/O V L I M F W Y G A P S T C H R K Q E N D B Z V 1.50 0.80 1.10 0.60 0.20 -0.80 -0.10 0.20 0.20 0.10 -0.10 0.20 0.20 -0.30 -0.30 -0.20 -0.20 -0.20 -0.30 -0.20 -0.20 -0.20 L 0.80 1.50 0.80 1.30 1.20 0.50 0.30 -0.50 -0.10 -0.30 -0.40 -0.10 -0.80 -0.20 -0.40 -0.30 -0.10 -0.30 -0.40 -0.50 -0.50 -0.20 I 1.10 0.80 1.50 0.60 0.70 -0.50 0.10 -0.30 0.00 -0.20 -0.10 0.20 0.20 -0.30 -0.30 -0.20 -0.30 -0.20 -0.30 -0.20 -0.20 -0.20 M 0.60 1.30 0.60 1.50 0.50 -0.30 -0.10 -0.30 0.00 -0.20 -0.30 0.00 -0.60 -0.30 0.20 0.20 0.00 -0.20 -0.30 -0.40 -0.30 -0.10 F 0.20 1.20 0.70 0.50 1.50 1.30 1.40 -0.60 -0.50 -0.70 -0.30 -0.30 -0.10 -0.10 -0.50 -0.70 -0.80 -0.70 -0.50 -1.00 -0.70 -0.70 W -0.80 0.50 -0.50 -0.30 1.30 1.50 1.10 -1.00 -0.80 -0.80 0.30 -0.60 -1.20 -0.10 1.40 0.10 -0.50 -1.10 -0.30 -1.10 -0.70 -0.80 Y -0.10 0.30 0.10 -0.10 1.40 1.10 1.50 -0.70 -0.30 -0.80 -0.40 -0.30 1.00 0.30 -0.60 -0.60 -0.60 -0.50 -0.10 -0.50 -0.30 -0.60 G 0.20 -0.50 -0.30 -0.30 -0.60 -1.00 -0.70 1.50 0.70 0.30 0.60 0.40 0.20 -0.20 -0.30 -0.10 0.20 0.50 0.40 0.70 0.60 0.30 A 0.20 -0.10 0.00 0.00 -0.50 -0.80 -0.30 0.70 1.50 0.50 0.40 0.40 0.30 -0.10 -0.30 0.00 0.20 0.30 0.20 0.30 0.20 0.20 P 0.10 -0.30 -0.20 -0.20 -0.70 -0.80 -0.80 0.30 0.50 1.50 0.40 0.30 0.10 0.20 0.30 0.10 0.30 0.10 0.00 0.10 0.10 0.20 S -0.10 -0.40 -0.10 -0.30 -0.30 0.30 -0.40 0.60 0.40 0.40 1.50 0.30 0.70 -0.20 0.10 0.20 -0.10 0.20 0.30 0.20 0.30 0.00 T 0.20 -0.10 0.20 0.00 -0.30 -0.60 -0.30 0.40 0.40 0.30 0.30 1.50 0.20 -0.10 -0.10 0.20 -0.10 0.20 0.20 0.20 0.20 0.10 C 0.20 -0.80 0.20 -0.60 -0.10 -1.20 1.00 0.20 0.30 0.10 0.70 0.20 1.50 -0.10 -0.30 -0.60 -0.60 -0.60 -0.30 -0.50 -0.40 -0.60 H -0.30 -0.20 -0.30 -0.30 -0.10 -0.10 0.30 -0.20 -0.10 0.20 -0.20 -0.10 -0.10 1.50 0.50 0.10 0.70 0.40 0.50 0.40 0.40 0.50 R -0.30 -0.40 -0.30 0.20 -0.50 1.40 -0.60 -0.30 -0.30 0.30 0.10 -0.10 -0.30 0.50 1.50 0.80 0.40 0.00 0.10 0.00 0.10 0.20 K -0.20 -0.30 -0.20 0.20 -0.70 0.10 -0.60 -0.10 0.00 0.10 0.20 0.20 -0.60 0.10 0.80 1.50 0.40 0.30 0.40 0.30 0.40 0.40 Q -0.20 -0.10 -0.30 0.00 -0.80 -0.50 -0.60 0.20 0.20 0.30 -0.10 -0.10 -0.60 0.70 0.40 0.40 1.50 0.70 0.40 0.70 0.50 1.10 E -0.20 -0.30 -0.20 -0.20 -0.70 -1.10 -0.50 0.50 0.30 0.10 0.20 0.20 -0.60 0.40 0.00 0.30 0.70 1.50 0.50 1.00 0.70 1.10 N -0.30 -0.40 -0.30 -0.30 -0.50 -0.30 -0.10 0.40 0.20 0.00 0.30 0.20 -0.30 0.50 0.10 0.40 0.40 0.50 1.50 0.70 1.10 0.40 D -0.20 -0.50 -0.20 -0.40 -1.00 -1.10 -0.50 0.70 0.30 0.10 0.20 0.20 -0.50 0.40 0.00 0.30 0.70 1.00 0.70 1.50 1.10 0.90 B -0.20 -0.50 -0.20 -0.30 -0.70 -0.70 -0.30 0.60 0.20 0.10 0.30 0.20 -0.40 0.40 0.10 0.40 0.50 0.70 1.10 1.10 1.10 0.60 Z -0.20 -0.20 -0.20 -0.10 -0.70 -0.80 -0.60 0.30 0.20 0.20 0.00 0.10 -0.60 0.50 0.20 0.40 1.10 1.10 0.40 0.90 0.60 1.10 librg-utils-perl-1.0.43/mat/Maxhom_McLachlan.metric0000644015075101507510000000747611323577622017100 00000000000000#********************************************************** MAXHOM AMINO ACID EXCHANGE MATRIX ********************************************** # see: McLachlan Andrew D., Tests for comparing related amino acid sequences. J.Mol.Biol. 61,409-424, minimal. # 1971 value: -3.0 ; maximal value: 6.0 # symbols: "-BZX!" added # #============================================================================================================================================ STRUCTURE-STATES: 1 I/O-STATES: 1 #============================================================================================================================================ AA STR I/O V L I M F W Y G A P S T C H R K Q E N D B Z V 5.00 2.00 2.00 1.00 0.00 -1.00 0.00 -1.00 0.00 -1.00 -1.00 0.00 -2.00 -1.00 -1.00 -1.00 -1.00 -1.00 -2.00 -2.00 -2.00 -1.00 L 2.00 5.00 2.00 3.00 2.00 0.00 0.00 -2.00 -1.00 -2.00 -1.00 0.00 -3.00 -1.00 -1.00 -1.00 0.00 -2.00 -2.00 -2.00 -2.00 0.00 I 2.00 2.00 5.00 2.00 0.00 0.00 0.00 -2.00 -1.00 -2.00 -1.00 0.00 -2.00 -1.00 -2.00 -2.00 -3.00 -2.00 -2.00 -3.00 -2.00 -3.00 M 1.00 3.00 2.00 5.00 2.00 -2.00 -1.00 -2.00 0.00 -2.00 -1.00 0.00 0.00 0.00 -2.00 -2.00 0.00 -2.00 -1.00 -1.00 -1.00 0.00 F 0.00 2.00 0.00 2.00 6.00 3.00 3.00 -3.00 -2.00 -2.00 -1.00 -2.00 -3.00 1.00 -2.00 -3.00 -3.00 -3.00 -3.00 -2.00 -3.00 -3.00 W -1.00 0.00 0.00 -2.00 3.00 6.00 3.00 -2.00 -2.00 -3.00 0.00 -1.00 -1.00 0.00 0.00 -2.00 -1.00 -2.00 -3.00 -3.00 -3.00 -1.00 Y 0.00 0.00 0.00 -1.00 3.00 3.00 6.00 -3.00 -2.00 -3.00 0.00 -2.00 -2.00 1.00 -1.00 -2.00 -2.00 -1.00 -1.00 -2.00 -1.00 -2.00 G -1.00 -2.00 -2.00 -2.00 -3.00 -2.00 -3.00 5.00 0.00 0.00 0.00 -1.00 -2.00 -1.00 0.00 0.00 -1.00 0.00 0.00 0.00 0.00 -1.00 A 0.00 -1.00 -1.00 0.00 -2.00 -2.00 -2.00 0.00 5.00 1.00 1.00 0.00 -2.00 0.00 -1.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 P -1.00 -2.00 -2.00 -2.00 -2.00 -3.00 -3.00 0.00 1.00 5.00 0.00 0.00 -3.00 0.00 0.00 0.00 0.00 1.00 -2.00 0.00 -2.00 0.00 S -1.00 -1.00 -1.00 -1.00 -1.00 0.00 0.00 0.00 1.00 0.00 5.00 2.00 -1.00 0.00 1.00 0.00 1.00 1.00 2.00 0.00 2.00 1.00 T 0.00 0.00 0.00 0.00 -2.00 -1.00 -2.00 -1.00 0.00 0.00 2.00 5.00 -1.00 1.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 C -2.00 -3.00 -2.00 0.00 -3.00 -1.00 -2.00 -2.00 -2.00 -3.00 -1.00 -1.00 6.00 0.00 -2.00 -3.00 -3.00 -3.00 -2.00 -2.00 -2.00 -3.00 H -1.00 -1.00 -1.00 0.00 1.00 0.00 1.00 -1.00 0.00 0.00 0.00 1.00 0.00 5.00 2.00 1.00 1.00 -1.00 1.00 1.00 1.00 1.00 R -1.00 -1.00 -2.00 -2.00 -2.00 0.00 -1.00 0.00 -1.00 0.00 1.00 0.00 -2.00 2.00 5.00 2.00 2.00 0.00 0.00 -2.00 0.00 2.00 K -1.00 -1.00 -2.00 -2.00 -3.00 -2.00 -2.00 0.00 0.00 0.00 0.00 0.00 -3.00 1.00 2.00 5.00 1.00 1.00 1.00 0.00 1.00 1.00 Q -1.00 0.00 -3.00 0.00 -3.00 -1.00 -2.00 -1.00 0.00 0.00 1.00 0.00 -3.00 1.00 2.00 1.00 5.00 2.00 1.00 1.00 1.00 5.00 E -1.00 -2.00 -2.00 -2.00 -3.00 -2.00 -1.00 0.00 1.00 1.00 1.00 1.00 -3.00 -1.00 0.00 1.00 2.00 5.00 1.00 2.00 1.00 2.00 N -2.00 -2.00 -2.00 -1.00 -3.00 -3.00 -1.00 0.00 0.00 -2.00 2.00 0.00 -2.00 1.00 0.00 1.00 1.00 1.00 5.00 2.00 5.00 1.00 D -2.00 -2.00 -3.00 -1.00 -2.00 -3.00 -2.00 0.00 0.00 0.00 0.00 0.00 -2.00 1.00 -2.00 0.00 1.00 2.00 2.00 5.00 2.00 1.00 B -2.00 -2.00 -2.00 -1.00 -3.00 -3.00 -1.00 0.00 0.00 -2.00 2.00 0.00 -2.00 1.00 0.00 1.00 1.00 1.00 5.00 2.00 5.00 1.00 Z -1.00 0.00 -3.00 0.00 -3.00 -1.00 -2.00 -1.00 0.00 0.00 1.00 0.00 -3.00 1.00 2.00 1.00 5.00 2.00 1.00 1.00 1.00 5.00 librg-utils-perl-1.0.43/mat/Maxhom_Sec_Struc.metric0000644015075101507510000000721611323577622017140 00000000000000#****************************************************************** MAXHOM AMINO ACID EXCHANGE MATRIX *************************************** #============================================================================================================================================ STRUCTURE STATES: 1 I/O STATES: 1 #============================================================================================================================================ AA STR I/O V L I M F W Y G A P S T C H R K Q E N D B Z V 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 L 0.00 0.50 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 -0.75 0.00 0.00 0.00 -0.75 0.00 0.00 0.00 0.00 I 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 M 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 F 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 W 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 Y 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 G 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 A 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 P 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 S 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 T 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 C 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 H 0.00 -0.50 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 -1.00 0.00 0.00 0.00 0.00 R 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 K 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 Q 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 E 0.00 -0.75 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 -1.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 N 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 D 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 B 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 Z 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 librg-utils-perl-1.0.43/mat/Maxhom_Struc_IO.metric0000644015075101507510000005126611323577622016741 00000000000000#****************************************************************** MAXHOM AMINO ACID EXCHANGE MATRIX ************************************** # DESCRIPTION: # '#' : comment line # STRUCTURE-STATES : is a keyword specifying the number of distinct secondary structure assignments # (DSSP-STATES). # I/O-STATES : is a keyword specifying the number of distinct inside/outside assignments. # inside/outside (I/O) assignments are made by using the accessible surface area # of a residue from DSSP (see below). # DSSP-STRUCTURE I/O %ACC-RANGE : is a keyword-line followed by a table specifying the symbols for the DSSP-STATES, # H I 0 - 25 the symbols and ranges for the inside/outide assignment. # H O 25 - 100 # L O 35 - 100 # E I 0 - 15 # E O 15 - 100 # # FORMAT : (7x,a1,13x,a1,5x,i3,3x,i3) # I/O : inside/outside symbols; anything like: B: Buried , I: Inside, O: Outside, A: fully Accesssible # %ACC-RANGE : numbers are the percentage of the maximal accessible surface area for a residue type. # example : an Valin in a Helix with an accessible surface area of 40 A2 (maximal value for Valin is for example 142 A2) # would be assigned to an outside position (28.2% of maximal possible), because the %ACC-RANGE # for 'H' in an 'I' position is 0-25% # NOTE : begin of range is greater or equal : >= x # end of range is smaller than : < y #============================================================================================================================================ STRUCTURE-STATES: 3 I/O-STATES: 2 DSSP-STRUCTURE I/O %ACC-RANGE E I 0 - 15 E O 15 - 100 L I 0 - 35 L O 35 - 100 H I 0 - 25 H O 25 - 100 #============================================================================================================================================ AA STR I/O V L I M F W Y G A P S T C H R K Q E N D B Z V E I 1.93 -0.13 0.11 -0.21 -0.64 -4.54 -2.24 -1.61 0.48 -1.87 -1.27 -0.71 -3.23 -0.94 -0.25 -0.64 -1.70 -0.50 -1.07 -1.93 -1.07 -1.70 V E O 2.11 0.93 1.22 0.67 -0.82 -1.03 -0.15 -0.89 -0.03 -0.50 -2.21 -0.45 -2.07 -1.29 -1.24 -1.61 -1.37 -0.70 -1.46 -0.63 -1.46 -1.37 V L I 2.41 0.85 1.63 0.62 -0.46 -1.84 -1.76 -2.11 0.10 -2.76 -1.46 -0.54 -1.45 -1.93 -2.19 -0.76 -1.85 -0.63 -1.17 -1.39 -1.17 -1.85 V L O 2.78 0.93 0.88 1.61 0.41 -0.48 -0.25 -1.10 0.25 0.26 -0.76 -0.17 0.12 -0.25 -0.63 -0.39 -0.24 -0.06 -0.62 -0.72 -0.62 -0.24 V H I 2.40 0.31 0.51 -1.13 -1.64 -3.95 -1.78 -1.73 -1.04 -1.16 -0.41 0.43 -3.95 -1.19 -0.44 -0.41 -1.59 -1.17 -0.51 -3.20 -0.51 -1.59 V H O 3.12 0.75 2.26 0.84 0.22 0.51 0.33 -1.16 -0.37 -0.82 -1.14 0.34 -0.23 -2.11 -0.94 -1.02 -0.92 -0.94 -1.29 -1.44 -1.29 -0.92 L E I -0.13 1.81 0.10 0.83 -0.08 -5.16 -3.24 -2.95 -1.11 -2.36 -2.44 -3.22 -4.24 -1.45 -1.34 -1.81 -1.82 -1.52 -1.96 -2.47 -1.96 -1.82 L E O 0.93 2.28 0.90 0.72 -0.16 1.56 -1.44 -1.19 -0.82 -0.06 -1.85 -1.51 -1.62 -1.56 -0.76 -1.22 -0.91 -0.63 -1.14 -1.05 -1.14 -0.91 L L I 0.85 2.63 0.77 2.09 -0.08 -2.07 -1.30 -2.89 -1.24 -2.21 -1.75 -0.82 -3.81 -1.77 -1.42 -0.89 -2.04 -1.51 -1.95 -1.86 -1.95 -2.04 L L O 0.93 2.66 0.72 0.44 1.38 0.06 0.94 -2.27 -0.68 0.96 -1.31 -0.76 -0.93 -0.86 0.61 -0.85 -1.01 -0.88 -1.06 -1.03 -1.06 -1.01 L H I 0.31 2.37 -0.11 0.54 0.28 -3.08 -0.71 -1.74 -1.46 -0.47 -1.36 -0.18 -4.18 -2.29 -0.81 -1.03 -0.84 -0.07 -1.16 -4.36 -1.16 -0.84 L H O 0.75 3.42 1.34 0.63 0.99 1.60 0.73 -1.53 -1.25 -1.24 -0.95 -0.35 -1.63 -1.36 -0.09 -0.70 -0.29 -2.34 -0.50 -1.89 -0.50 -0.29 I E I 0.11 0.10 2.06 0.89 -1.19 -4.52 -3.12 -1.61 -1.15 -1.72 -1.96 -1.38 -4.48 -0.04 -2.26 -0.65 -2.48 0.29 -2.32 -2.89 -2.32 -2.48 I E O 1.22 0.90 2.28 0.61 0.44 -0.55 -0.99 0.09 -1.13 -0.47 -1.16 -0.46 -1.16 -0.76 -0.74 -1.31 -1.78 -1.35 -0.97 -0.58 -0.97 -1.78 I L I 1.63 0.77 2.94 0.30 -0.28 -1.92 -0.94 -2.14 -0.76 -3.23 -1.68 -0.51 -1.91 -1.71 -1.72 -0.63 -2.20 -0.63 -1.07 -1.53 -1.07 -2.20 I L O 0.88 0.72 2.40 0.65 1.04 0.01 1.02 -0.57 -0.18 -1.19 0.05 0.33 -0.66 -0.19 -0.10 -0.47 -0.89 -0.20 -0.56 -0.33 -0.56 -0.89 I H I 0.51 -0.11 2.67 1.14 -1.53 -3.01 -0.72 -2.94 -1.84 -1.62 -0.70 0.19 -4.48 -1.86 -1.16 -0.67 -2.37 -1.09 -0.84 -5.12 -0.84 -2.37 I H O 2.26 1.34 3.40 0.50 0.60 1.43 1.11 -0.88 -1.20 -2.68 -0.66 0.59 -2.48 -1.80 -0.29 -0.26 -1.00 -1.72 -0.38 -1.40 -0.38 -1.00 M E I -0.21 0.83 0.89 2.55 -1.44 -4.61 -3.48 -2.01 0.13 -5.24 -1.98 -2.60 -3.49 -1.74 -1.49 -0.65 -0.06 -1.47 -2.84 -2.86 -2.84 -0.06 M E O 0.67 0.72 0.61 4.04 -0.61 -1.30 -1.73 -1.91 -0.64 -0.73 -2.20 -0.39 -0.58 -0.34 -0.48 -1.14 0.58 0.16 -1.01 -0.55 -1.01 0.58 M L I 0.62 2.09 0.30 3.47 -0.75 -2.41 -0.63 -2.59 -0.54 -2.03 -1.15 -0.22 -3.34 -0.94 -0.66 0.21 -1.51 -1.05 -0.47 -1.57 -0.47 -1.51 M L O 1.61 0.44 0.65 4.26 1.50 0.11 -0.19 -0.81 0.14 -1.04 -0.72 -0.03 0.22 0.14 0.37 -0.44 0.37 -0.27 -0.62 -0.45 -0.62 0.37 M H I -1.13 0.54 1.14 4.00 -1.26 -1.61 -2.05 -2.71 -1.53 -0.95 -1.54 -0.78 -4.03 -3.17 -1.12 -0.97 -1.41 -1.49 -1.37 -5.02 -1.37 -1.41 M H O 0.84 0.63 0.50 2.98 0.16 0.58 -0.90 -0.16 0.11 -0.29 -0.39 -0.08 -1.03 -1.88 -0.70 -0.65 0.42 -0.07 0.08 -0.41 0.08 0.42 F E I -0.64 -0.08 -1.19 -1.44 3.22 -0.65 0.78 -2.08 1.07 -1.56 -0.17 -2.02 -2.79 -0.37 -1.08 0.19 -2.16 -0.90 0.40 -3.23 0.40 -2.16 F E O -0.82 -0.16 0.44 -0.61 3.18 1.17 0.84 -2.74 -2.21 -0.73 -2.58 -2.11 -1.87 -0.63 -1.89 -2.83 -2.74 -2.65 -1.78 -1.92 -1.78 -2.74 F L I -0.46 -0.08 -0.28 -0.75 3.13 0.78 1.62 -1.59 -2.14 -2.17 0.26 -1.32 -0.66 -0.28 -2.02 -1.86 -2.55 -2.16 -0.85 -0.44 -0.85 -2.55 F L O 0.41 1.38 1.04 1.50 2.29 1.80 1.72 -1.24 0.23 -1.09 -0.71 0.31 -1.09 0.29 0.14 -0.82 -1.02 0.12 -0.29 -0.37 -0.29 -1.02 F H I -1.64 0.28 -1.53 -1.26 3.44 -1.16 1.18 -2.08 -2.28 -1.79 -1.09 -1.90 -4.48 -1.61 -1.73 -0.77 -0.55 -2.16 -2.03 -5.45 -2.03 -0.55 F H O 0.22 0.99 0.60 0.16 4.15 2.41 1.59 -0.42 -0.08 -1.85 -0.17 -1.22 -1.55 -0.74 -0.65 -0.72 -0.70 -1.66 -1.03 -1.49 -1.03 -0.70 W E I -4.54 -5.16 -4.52 -4.61 -0.65 4.22 -2.04 -5.90 -4.57 -7.36 -5.35 -6.02 -5.37 -5.37 -2.02 -4.46 -5.25 -6.95 -3.79 -6.52 -3.79 -5.25 W E O -1.03 1.56 -0.55 -1.30 1.17 3.63 0.76 -0.33 -2.33 -0.17 -1.82 -2.05 -2.61 -1.39 -0.65 -2.09 -2.68 -2.20 -0.96 -0.98 -0.96 -2.68 W L I -1.84 -2.07 -1.92 -2.41 0.78 5.25 1.57 -3.13 -2.95 -2.60 -2.31 -3.34 -3.00 -0.35 -1.28 -2.29 -1.83 -2.22 -3.44 -3.75 -3.44 -1.83 W L O -0.48 0.06 0.01 0.11 1.80 4.16 2.94 -0.68 0.07 -1.60 -0.84 -0.50 -2.82 0.14 -0.31 -1.31 -2.04 -0.96 -0.19 -0.30 -0.19 -2.04 W H I -3.95 -3.08 -3.01 -1.61 -1.16 4.16 -0.16 -3.29 -2.38 -2.63 -1.91 -3.62 -4.25 -0.72 -2.51 -1.39 -4.12 -3.82 -4.23 -7.18 -4.23 -4.12 W H O 0.51 1.60 1.43 0.58 2.41 4.62 3.11 -1.06 -1.62 -0.61 -0.53 -0.17 -0.87 -0.05 -1.33 -1.25 -0.65 -3.64 -3.00 -2.61 -3.00 -0.65 Y E I -2.24 -3.24 -3.12 -3.48 0.78 -2.04 3.59 -3.08 -1.60 -3.10 -1.97 -2.43 -3.95 -0.24 -0.88 -0.85 -2.90 -1.48 -0.60 -1.14 -0.60 -2.90 Y E O -0.15 -1.44 -0.99 -1.73 0.84 0.76 2.64 -2.10 -2.19 -1.54 -1.51 -1.16 -2.30 -0.05 -1.44 -2.00 -2.10 -1.77 -0.54 -1.46 -0.54 -2.10 Y L I -1.76 -1.30 -0.94 -0.63 1.62 1.57 3.02 -2.45 -1.71 -1.55 -0.12 -0.30 -1.71 0.48 -1.29 -0.77 -1.99 -1.22 0.31 -0.63 0.31 -1.99 Y L O -0.25 0.94 1.02 -0.19 1.72 2.94 2.91 -1.40 -0.16 -2.01 -0.52 -0.89 -1.18 0.55 0.20 -0.71 -1.50 -0.67 -0.05 -0.14 -0.05 -1.50 Y H I -1.78 -0.71 -0.72 -2.05 1.18 -0.16 3.96 -1.40 -1.53 -1.13 -0.19 -1.78 -3.09 -0.11 -0.61 -0.62 -0.79 -1.73 0.06 -4.31 0.06 -0.79 Y H O 0.33 0.73 1.11 -0.90 1.59 3.11 3.48 -0.75 -0.99 -0.66 -0.34 -0.98 -0.42 -0.40 0.37 -1.42 -0.41 -1.82 0.48 -1.20 0.48 -0.41 G E I -1.61 -2.95 -1.61 -2.01 -2.08 -5.90 -3.08 3.47 0.19 -2.11 -0.33 -1.42 -2.85 -0.79 0.23 -0.60 -0.82 -0.21 0.23 0.37 0.23 -0.82 G E O -0.89 -1.19 0.09 -1.91 -2.74 -0.33 -2.10 3.23 0.56 0.07 -1.30 -1.66 -1.72 -1.41 0.08 -0.05 -1.72 -1.43 -0.17 -1.20 -0.17 -1.72 G L I -2.11 -2.89 -2.14 -2.59 -1.59 -3.13 -2.45 2.61 -0.70 -2.37 -1.43 -1.50 -4.10 -1.39 -2.23 -1.56 -3.35 -1.43 -1.49 -1.85 -1.49 -3.35 G L O -1.10 -2.27 -0.57 -0.81 -1.24 -0.68 -1.40 1.77 -0.17 -1.69 -0.71 -1.14 -1.35 -0.59 -1.06 -0.86 -0.57 -0.59 -0.60 -0.39 -0.60 -0.57 G H I -1.73 -1.74 -2.94 -2.71 -2.08 -3.29 -1.40 3.70 0.80 1.44 0.65 -0.82 -3.51 -1.73 0.44 0.27 -0.97 0.72 0.57 -1.41 0.57 -0.97 G H O -1.16 -1.53 -0.88 -0.16 -0.42 -1.06 -0.75 2.72 -0.07 -1.06 0.13 -0.16 -0.91 -2.29 -1.13 -0.50 -0.89 -0.17 -0.39 -0.07 -0.39 -0.89 A E I 0.48 -1.11 -1.15 0.13 1.07 -4.57 -1.60 0.19 2.38 -0.52 0.53 -0.37 -2.73 -0.27 0.48 0.60 -0.40 0.51 -0.06 0.05 -0.06 -0.40 A E O -0.03 -0.82 -1.13 -0.64 -2.21 -2.33 -2.19 0.56 2.70 -0.25 -0.34 -1.29 -0.80 -0.37 -1.59 -1.54 0.35 -1.05 -0.40 -1.23 -0.40 0.35 A L I 0.10 -1.24 -0.76 -0.54 -2.14 -2.95 -1.71 -0.70 2.33 -0.25 -0.38 0.11 -0.76 -1.24 -1.40 -0.03 -1.59 0.47 -0.24 -0.67 -0.24 -1.59 A L O 0.25 -0.68 -0.18 0.14 0.23 0.07 -0.16 -0.17 1.44 -0.22 -0.04 -0.21 -0.17 -0.12 -0.62 -0.03 -0.22 -0.03 -0.61 -0.05 -0.61 -0.22 A H I -1.04 -1.46 -1.84 -1.53 -2.28 -2.38 -1.53 0.80 2.38 0.53 0.36 -0.16 -4.17 -0.96 0.43 0.15 -0.89 -0.15 -0.91 -3.16 -0.91 -0.89 A H O -0.37 -1.25 -1.20 0.11 -0.08 -1.62 -0.99 -0.07 1.28 0.59 0.09 0.14 -0.09 -2.57 -0.47 -0.67 -0.66 -0.49 -0.61 -0.37 -0.61 -0.66 P E I -1.87 -2.36 -1.72 -5.24 -1.56 -7.36 -3.10 -2.11 -0.52 6.02 -0.79 -1.80 -4.88 -1.64 -1.08 -1.56 -1.51 -1.35 0.28 -1.10 0.28 -1.51 P E O -0.50 -0.06 -0.47 -0.73 -0.73 -0.17 -1.54 0.07 -0.25 3.59 0.04 -0.41 -0.17 -0.06 -0.24 0.04 -1.02 -0.25 -0.12 -0.21 -0.12 -1.02 P L I -2.76 -2.21 -3.23 -2.03 -2.17 -2.60 -1.55 -2.37 -0.25 3.44 -0.25 -0.57 -3.24 -1.39 -1.80 -0.76 -2.03 0.21 -2.56 -1.51 -2.56 -2.03 P L O 0.26 0.96 -1.19 -1.04 -1.09 -1.60 -2.01 -1.69 -0.22 2.33 -0.78 -0.96 -1.04 -0.35 -0.79 -0.63 -1.70 -1.08 -1.54 -1.30 -1.54 -1.70 P H I -1.16 -0.47 -1.62 -0.95 -1.79 -2.63 -1.13 1.44 0.53 4.61 1.17 -0.15 -5.74 -0.42 -0.29 -0.04 -0.08 0.71 0.34 -2.31 0.34 -0.08 P H O -0.82 -1.24 -2.68 -0.29 -1.85 -0.61 -0.66 -1.06 0.59 2.55 0.51 0.58 0.72 -3.10 -1.80 -1.09 -1.00 -1.37 -1.29 -0.46 -1.29 -1.00 S E I -1.27 -2.44 -1.96 -1.98 -0.17 -5.35 -1.97 -0.33 0.53 -0.79 3.42 1.01 -3.32 0.64 1.03 0.54 0.78 -0.41 0.46 1.56 0.46 0.78 S E O -2.21 -1.85 -1.16 -2.20 -2.58 -1.82 -1.51 -1.30 -0.34 0.04 1.91 0.45 -1.42 -0.58 -1.34 -0.87 -1.55 -0.85 0.04 0.47 0.04 -1.55 S L I -1.46 -1.75 -1.68 -1.15 0.26 -2.31 -0.12 -1.43 -0.38 -0.25 1.86 0.51 -1.96 -0.35 -0.84 -0.41 -0.34 -0.32 0.58 -0.35 0.58 -0.34 S L O -0.76 -1.31 0.05 -0.72 -0.71 -0.84 -0.52 -0.71 -0.04 -0.78 1.14 0.36 -0.89 -0.65 0.00 -0.58 -0.67 -0.50 0.12 -0.12 0.12 -0.67 S H I -0.41 -1.36 -0.70 -1.54 -1.09 -1.91 -0.19 0.65 0.36 1.17 3.10 0.90 -1.21 -0.75 0.50 0.52 -0.26 0.08 0.39 -2.42 0.39 -0.26 S H O -1.14 -0.95 -0.66 -0.39 -0.17 -0.53 -0.34 0.13 0.09 0.51 1.36 0.32 0.13 -1.75 -0.48 -0.44 -0.26 -0.74 -0.10 -0.12 -0.10 -0.26 T E I -0.71 -3.22 -1.38 -2.60 -2.02 -6.02 -2.43 -1.42 -0.37 -1.80 1.01 2.90 -3.48 0.12 0.55 1.47 1.17 1.13 1.02 -0.37 1.02 1.17 T E O -0.45 -1.51 -0.46 -0.39 -2.11 -2.05 -1.16 -1.66 -1.29 -0.41 0.45 1.85 -1.83 -0.55 -0.13 -0.06 -0.68 0.03 -0.30 0.37 -0.30 -0.68 T L I -0.54 -0.82 -0.51 -0.22 -1.32 -3.34 -0.30 -1.50 0.11 -0.57 0.51 2.18 -1.86 -0.37 -0.31 0.46 -0.59 -0.07 0.50 -0.06 0.50 -0.59 T L O -0.17 -0.76 0.33 -0.03 0.31 -0.50 -0.89 -1.14 -0.21 -0.96 0.36 1.62 -0.62 -0.44 -0.14 -0.38 -0.21 0.03 0.22 -0.47 0.22 -0.21 T H I 0.43 -0.18 0.19 -0.78 -1.90 -3.62 -1.78 -0.82 -0.16 -0.15 0.90 2.98 -2.85 0.37 -0.05 0.95 -0.69 0.45 0.52 -2.69 0.52 -0.69 T H O 0.34 -0.35 0.59 -0.08 -1.22 -0.17 -0.98 -0.16 0.14 0.58 0.32 2.02 -0.09 -1.84 -0.17 -0.15 -0.66 -1.23 -0.59 -0.72 -0.59 -0.66 C E I -3.23 -4.24 -4.48 -3.49 -2.79 -5.37 -3.95 -2.85 -2.73 -4.88 -3.32 -3.48 3.06 -2.16 -2.79 -1.87 -3.38 -1.25 -4.65 -3.43 -4.65 -3.38 C E O -2.07 -1.62 -1.16 -0.58 -1.87 -2.61 -2.30 -1.72 -0.80 -0.17 -1.42 -1.83 5.61 -0.20 -1.03 -2.20 -0.79 -0.74 -1.63 -1.62 -1.63 -0.79 C L I -1.45 -3.81 -1.91 -3.34 -0.66 -3.00 -1.71 -4.10 -0.76 -3.24 -1.96 -1.86 4.90 -1.57 -2.76 -2.37 -3.00 -2.65 -2.08 -1.86 -2.08 -3.00 C L O 0.12 -0.93 -0.66 0.22 -1.09 -2.82 -1.18 -1.35 -0.17 -1.04 -0.89 -0.62 6.56 -0.94 -1.64 -1.30 -1.92 -0.50 -0.11 -0.57 -0.11 -1.92 C H I -3.95 -4.18 -4.48 -4.03 -4.48 -4.25 -3.09 -3.51 -4.17 -5.74 -1.21 -2.85 2.94 -4.57 -2.21 -2.18 -2.39 -3.48 -1.45 -5.02 -1.45 -2.39 C H O -0.23 -1.63 -2.48 -1.03 -1.55 -0.87 -0.42 -0.91 -0.09 0.72 0.13 -0.09 4.60 -1.09 -1.80 -2.02 -2.11 -2.01 -0.15 -1.59 -0.15 -2.11 H E I -0.94 -1.45 -0.04 -1.74 -0.37 -5.37 -0.24 -0.79 -0.27 -1.64 0.64 0.12 -2.16 4.91 1.45 0.72 1.98 0.99 1.67 0.73 1.67 1.98 H E O -1.29 -1.56 -0.76 -0.34 -0.63 -1.39 -0.05 -1.41 -0.37 -0.06 -0.58 -0.55 -0.20 3.60 0.03 -0.32 -0.21 -0.64 1.45 -0.25 1.45 -0.21 H L I -1.93 -1.77 -1.71 -0.94 -0.28 -0.35 0.48 -1.39 -1.24 -1.39 -0.35 -0.37 -1.57 3.82 -0.35 -0.59 -1.23 0.29 0.90 -0.58 0.90 -1.23 H L O -0.25 -0.86 -0.19 0.14 0.29 0.14 0.55 -0.59 -0.12 -0.35 -0.65 -0.44 -0.94 2.62 0.25 0.62 0.53 -0.25 0.64 -0.11 0.64 0.53 H H I -1.19 -2.29 -1.86 -3.17 -1.61 -0.72 -0.11 -1.73 -0.96 -0.42 -0.75 0.37 -4.57 5.24 0.27 -0.48 -0.30 -0.45 1.24 -3.74 1.24 -0.30 H H O -2.11 -1.36 -1.80 -1.88 -0.74 -0.05 -0.40 -2.29 -2.57 -3.10 -1.75 -1.84 -1.09 3.88 -1.05 -1.30 -0.19 -2.75 -1.11 -1.50 -1.11 -0.19 R E I -0.25 -1.34 -2.26 -1.49 -1.08 -2.02 -0.88 0.23 0.48 -1.08 1.03 0.55 -2.79 1.45 3.56 1.73 2.68 1.00 2.44 1.55 2.44 2.68 R E O -1.24 -0.76 -0.74 -0.48 -1.89 -0.65 -1.44 0.08 -1.59 -0.24 -1.34 -0.13 -1.03 0.03 2.06 1.37 1.24 -0.17 -0.05 -0.61 -0.05 1.24 R L I -2.19 -1.42 -1.72 -0.66 -2.02 -1.28 -1.29 -2.23 -1.40 -1.80 -0.84 -0.31 -2.76 -0.35 3.61 1.09 -0.99 0.19 -0.49 -1.35 -0.49 -0.99 R L O -0.63 0.61 -0.10 0.37 0.14 -0.31 0.20 -1.06 -0.62 -0.79 0.00 -0.14 -1.64 0.25 1.61 0.45 0.46 0.11 -0.42 -0.49 -0.42 0.46 R H I -0.44 -0.81 -1.16 -1.12 -1.73 -2.51 -0.61 0.44 0.43 -0.29 0.50 -0.05 -2.21 0.27 4.37 1.70 0.35 -0.05 0.70 -2.70 0.70 0.35 R H O -0.94 -0.09 -0.29 -0.70 -0.65 -1.33 0.37 -1.13 -0.47 -1.80 -0.48 -0.17 -1.80 -1.05 2.94 0.37 -0.13 -1.48 -0.35 -1.27 -0.35 -0.13 K E I -0.64 -1.81 -0.65 -0.65 0.19 -4.46 -0.85 -0.60 0.60 -1.56 0.54 1.47 -1.87 0.72 1.73 2.73 2.12 2.28 2.34 0.97 2.34 2.12 K E O -1.61 -1.22 -1.31 -1.14 -2.83 -2.09 -2.00 -0.05 -1.54 0.04 -0.87 -0.06 -2.20 -0.32 1.37 2.21 0.33 0.93 0.17 -0.57 0.17 0.33 K L I -0.76 -0.89 -0.63 0.21 -1.86 -2.29 -0.77 -1.56 -0.03 -0.76 -0.41 0.46 -2.37 -0.59 1.09 3.14 -0.12 0.77 0.12 -0.71 0.12 -0.12 K L O -0.39 -0.85 -0.47 -0.44 -0.82 -1.31 -0.71 -0.86 -0.03 -0.63 -0.58 -0.38 -1.30 0.62 0.45 1.90 0.75 -0.20 -0.43 -0.59 -0.43 0.75 K H I -0.41 -1.03 -0.67 -0.97 -0.77 -1.39 -0.62 0.27 0.15 -0.04 0.52 0.95 -2.18 -0.48 1.70 3.22 1.04 0.85 1.22 -2.20 1.22 1.04 K H O -1.02 -0.70 -0.26 -0.65 -0.72 -1.25 -1.42 -0.50 -0.67 -1.09 -0.44 -0.15 -2.02 -1.30 0.37 1.94 0.02 -0.78 -0.28 -0.70 -0.28 0.02 Q E I -1.70 -1.82 -2.48 -0.06 -2.16 -5.25 -2.90 -0.82 -0.40 -1.51 0.78 1.17 -3.38 1.98 2.68 2.12 3.75 1.89 2.17 0.78 2.17 3.75 Q E O -1.37 -0.91 -1.78 0.58 -2.74 -2.68 -2.10 -1.72 0.35 -1.02 -1.55 -0.68 -0.79 -0.21 1.24 0.33 2.71 0.07 -0.34 -0.26 -0.34 2.71 Q L I -1.85 -2.04 -2.20 -1.51 -2.55 -1.83 -1.99 -3.35 -1.59 -2.03 -0.34 -0.59 -3.00 -1.23 -0.99 -0.12 3.41 0.30 -0.93 -1.24 -0.93 3.41 Q L O -0.24 -1.01 -0.89 0.37 -1.02 -2.04 -1.50 -0.57 -0.22 -1.70 -0.67 -0.21 -1.92 0.53 0.46 0.75 2.18 0.89 -0.76 -0.28 -0.76 2.18 Q H I -1.59 -0.84 -2.37 -1.41 -0.55 -4.12 -0.79 -0.97 -0.89 -0.08 -0.26 -0.69 -2.39 -0.30 0.35 1.04 4.36 1.12 0.62 -1.29 0.62 4.36 Q H O -0.92 -0.29 -1.00 0.42 -0.70 -0.65 -0.41 -0.89 -0.66 -1.00 -0.26 -0.66 -2.11 -0.19 -0.13 0.02 2.20 -0.29 -0.22 -0.04 -0.22 2.20 E E I -0.50 -1.52 0.29 -1.47 -0.90 -6.95 -1.48 -0.21 0.51 -1.35 -0.41 1.13 -1.25 0.99 1.00 2.28 1.89 3.56 1.64 1.00 1.64 1.89 E E O -0.70 -0.63 -1.35 0.16 -2.65 -2.20 -1.77 -1.43 -1.05 -0.25 -0.85 0.03 -0.74 -0.64 -0.17 0.93 0.07 2.77 -0.07 1.06 -0.07 0.07 E L I -0.63 -1.51 -0.63 -1.05 -2.16 -2.22 -1.22 -1.43 0.47 0.21 -0.32 -0.07 -2.65 0.29 0.19 0.77 0.30 2.94 -0.55 0.15 -0.55 0.30 E L O -0.06 -0.88 -0.20 -0.27 0.12 -0.96 -0.67 -0.59 -0.03 -1.08 -0.50 0.03 -0.50 -0.25 0.11 -0.20 0.89 1.84 -0.39 0.44 -0.39 0.89 E H I -1.17 -0.07 -1.09 -1.49 -2.16 -3.82 -1.73 0.72 -0.15 0.71 0.08 0.45 -3.48 -0.45 -0.05 0.85 1.12 3.53 1.19 -1.18 1.19 1.12 E H O -0.94 -2.34 -1.72 -0.07 -1.66 -3.64 -1.82 -0.17 -0.49 -1.37 -0.74 -1.23 -2.01 -2.75 -1.48 -0.78 -0.29 1.69 -0.91 0.44 -0.91 -0.29 N E I -1.07 -1.96 -2.32 -2.84 0.40 -3.79 -0.60 0.23 -0.06 0.28 0.46 1.02 -4.65 1.67 2.44 2.34 2.17 1.64 3.84 2.86 3.84 2.17 N E O -1.46 -1.14 -0.97 -1.01 -1.78 -0.96 -0.54 -0.17 -0.40 -0.12 0.04 -0.30 -1.63 1.45 -0.05 0.17 -0.34 -0.07 2.71 0.56 2.71 -0.34 N L I -1.17 -1.95 -1.07 -0.47 -0.85 -3.44 0.31 -1.49 -0.24 -2.56 0.58 0.50 -2.08 0.90 -0.49 0.12 -0.93 -0.55 2.46 0.26 2.46 -0.93 N L O -0.62 -1.06 -0.56 -0.62 -0.29 -0.19 -0.05 -0.60 -0.61 -1.54 0.12 0.22 -0.11 0.64 -0.42 -0.43 -0.76 -0.39 2.02 0.49 2.02 -0.76 N H I -0.51 -1.16 -0.84 -1.37 -2.03 -4.23 0.06 0.57 -0.91 0.34 0.39 0.52 -1.45 1.24 0.70 1.22 0.62 1.19 3.24 0.01 3.24 0.62 N H O -1.29 -0.50 -0.38 0.08 -1.03 -3.00 0.48 -0.39 -0.61 -1.29 -0.10 -0.59 -0.15 -1.11 -0.35 -0.28 -0.22 -0.91 2.30 0.17 2.30 -0.22 D E I -1.93 -2.47 -2.89 -2.86 -3.23 -6.52 -1.14 0.37 0.05 -1.10 1.56 -0.37 -3.43 0.73 1.55 0.97 0.78 1.00 2.86 5.18 2.86 0.78 D E O -0.63 -1.05 -0.58 -0.55 -1.92 -0.98 -1.46 -1.20 -1.23 -0.21 0.47 0.37 -1.62 -0.25 -0.61 -0.57 -0.26 1.06 0.56 2.65 0.56 -0.26 D L I -1.39 -1.86 -1.53 -1.57 -0.44 -3.75 -0.63 -1.85 -0.67 -1.51 -0.35 -0.06 -1.86 -0.58 -1.35 -0.71 -1.24 0.15 0.26 3.30 0.26 -1.24 D L O -0.72 -1.03 -0.33 -0.45 -0.37 -0.30 -0.14 -0.39 -0.05 -1.30 -0.12 -0.47 -0.57 -0.11 -0.49 -0.59 -0.28 0.44 0.49 2.00 0.49 -0.28 D H I -3.20 -4.36 -5.12 -5.02 -5.45 -7.18 -4.31 -1.41 -3.16 -2.31 -2.42 -2.69 -5.02 -3.74 -2.70 -2.20 -1.29 -1.18 0.01 2.80 0.01 -1.29 D H O -1.44 -1.89 -1.40 -0.41 -1.49 -2.61 -1.20 -0.07 -0.37 -0.46 -0.12 -0.72 -1.59 -1.50 -1.27 -0.70 -0.04 0.44 0.17 1.74 0.17 -0.04 B E I -1.07 -1.96 -2.32 -2.84 0.40 -3.79 -0.60 0.23 -0.06 0.28 0.46 1.02 -4.65 1.67 2.44 2.34 2.17 1.64 3.84 2.86 3.84 2.17 B E O -1.46 -1.14 -0.97 -1.01 -1.78 -0.96 -0.54 -0.17 -0.40 -0.12 0.04 -0.30 -1.63 1.45 -0.05 0.17 -0.34 -0.07 2.71 0.56 2.71 -0.34 B L I -1.17 -1.95 -1.07 -0.47 -0.85 -3.44 0.31 -1.49 -0.24 -2.56 0.58 0.50 -2.08 0.90 -0.49 0.12 -0.93 -0.55 2.46 0.26 2.46 -0.93 B L O -0.62 -1.06 -0.56 -0.62 -0.29 -0.19 -0.05 -0.60 -0.61 -1.54 0.12 0.22 -0.11 0.64 -0.42 -0.43 -0.76 -0.39 2.02 0.49 2.02 -0.76 B H I -0.51 -1.16 -0.84 -1.37 -2.03 -4.23 0.06 0.57 -0.91 0.34 0.39 0.52 -1.45 1.24 0.70 1.22 0.62 1.19 3.24 0.01 3.24 0.62 B H O -1.29 -0.50 -0.38 0.08 -1.03 -3.00 0.48 -0.39 -0.61 -1.29 -0.10 -0.59 -0.15 -1.11 -0.35 -0.28 -0.22 -0.91 2.30 0.17 2.30 -0.22 Z E I -1.70 -1.82 -2.48 -0.06 -2.16 -5.25 -2.90 -0.82 -0.40 -1.51 0.78 1.17 -3.38 1.98 2.68 2.12 3.75 1.89 2.17 0.78 2.17 3.75 Z E O -1.37 -0.91 -1.78 0.58 -2.74 -2.68 -2.10 -1.72 0.35 -1.02 -1.55 -0.68 -0.79 -0.21 1.24 0.33 2.71 0.07 -0.34 -0.26 -0.34 2.71 Z L I -1.85 -2.04 -2.20 -1.51 -2.55 -1.83 -1.99 -3.35 -1.59 -2.03 -0.34 -0.59 -3.00 -1.23 -0.99 -0.12 3.41 0.30 -0.93 -1.24 -0.93 3.41 Z L O -0.24 -1.01 -0.89 0.37 -1.02 -2.04 -1.50 -0.57 -0.22 -1.70 -0.67 -0.21 -1.92 0.53 0.46 0.75 2.18 0.89 -0.76 -0.28 -0.76 2.18 Z H I -1.59 -0.84 -2.37 -1.41 -0.55 -4.12 -0.79 -0.97 -0.89 -0.08 -0.26 -0.69 -2.39 -0.30 0.35 1.04 4.36 1.12 0.62 -1.29 0.62 4.36 Z H O -0.92 -0.29 -1.00 0.42 -0.70 -0.65 -0.41 -0.89 -0.66 -1.00 -0.26 -0.66 -2.11 -0.19 -0.13 0.02 2.20 -0.29 -0.22 -0.04 -0.22 2.20 librg-utils-perl-1.0.43/mat/Makefile.am0000644015075101507510000000012611576712143014554 00000000000000pkgdataresourcedir = $(pkgdatadir)/mat dist_pkgdataresource_DATA = $(srcdir)/*metric librg-utils-perl-1.0.43/mat/Makefile.in0000644015075101507510000002463011652606215014570 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = mat DIST_COMMON = $(dist_pkgdataresource_DATA) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkgdataresourcedir)" DATA = $(dist_pkgdataresource_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ INSTALL = @INSTALL@ INSTALL_BASE_ARG = @INSTALL_BASE_ARG@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ am__leading_dot = @am__leading_dot@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkgdataresourcedir = $(pkgdatadir)/mat dist_pkgdataresource_DATA = $(srcdir)/*metric all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mat/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu mat/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-dist_pkgdataresourceDATA: $(dist_pkgdataresource_DATA) @$(NORMAL_INSTALL) test -z "$(pkgdataresourcedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdataresourcedir)" @list='$(dist_pkgdataresource_DATA)'; test -n "$(pkgdataresourcedir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdataresourcedir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdataresourcedir)" || exit $$?; \ done uninstall-dist_pkgdataresourceDATA: @$(NORMAL_UNINSTALL) @list='$(dist_pkgdataresource_DATA)'; test -n "$(pkgdataresourcedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(pkgdataresourcedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgdataresourcedir)" && rm -f $$files tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(pkgdataresourcedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dist_pkgdataresourceDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-dist_pkgdataresourceDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-dist_pkgdataresourceDATA install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am uninstall uninstall-am \ uninstall-dist_pkgdataresourceDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: