Skip to content
Permalink
Browse files

Updates man pages and man->tex conversion; adds rmanprocess.py

  • Loading branch information...
cryptogenomicon committed May 1, 2018
1 parent 745a9a1 commit b11c19047723a89fd7e13bda95edabb44d46c4ce
@@ -71,7 +71,7 @@ m4_include([m4/ax_pthread.m4])
################################################################
# 2. AC_INIT
################################################################
AC_INIT(Easel, 0.44rc1, sean@eddylab.org, easel)
AC_INIT(Easel, 0.44, sean@eddylab.org, easel)
AC_MSG_NOTICE([Configuring the Easel library for your system.])

# remember if the user is overriding CFLAGS
@@ -108,7 +108,7 @@ fi
# EASEL_VERSION e.g. "1.9a"
#

EASEL_DATE="March 2018"
EASEL_DATE="April 2018"
EASEL_COPYRIGHT="Copyright (C) 2018 Howard Hughes Medical Institute"
EASEL_LICENSE="Freely distributed under the BSD open source license."
EASEL_VERSION=$PACKAGE_VERSION
@@ -0,0 +1,86 @@
#! /usr/bin/env python

# rmanprocess.py
# Massages output of PolyGlotMan's `rman -f latex2e` to fit Tufteian userguide style.
# Example:
# rman -f latex2e hmmbuild.man | rmanprocess.py > manpage.tex
#


import sys
import re

in_synopsis = False

if len(sys.argv) == 1:
f = sys.stdin
else:
f = open(sys.argv[1])

for line in f:
line = line.rstrip('\n')

# State flags (where are we in the document)
if re.match(r'\\section{Synopsis}', line):
in_synopsis = True
elif re.match(r'\\section{', line):
in_synopsis = False

#
# Linewise substitutions: replace certain entire lines with something else.
#
# Remove \documentclass, and changes to \parindent and \parskip
if re.match(r'\\documentclass', line): continue
if re.match(r'\\setlength{\\parindent}', line): continue
if re.match(r'\\setlength{\\parskip}', line): continue
if re.match(r'\\begin\{document\}', line): continue

# Replace \section{Name} with \section{progname - description}, using next line too.
if re.match(r'\\section\{Name\}', line):
for line in f:
if not re.fullmatch(r'\s*', line):
break
m = re.match(r'(\S+)\s*\\?-\s*(.+)$', line)
if m:
print(r'\section{{\monob{{{0}}} - {1}}}'.format(m.group(1), m.group(2)))
else:
print("Error: no progname/description line found");
sys.exit(1)
continue

# Remove everything after \section{See Also), and finish.
if re.match(r'\\section\{See', line) or re.match(r'\\end\{document', line):
print("\\newpage");
break


#
# Extra directives: preface certain lines with something extra, but still
# process the line.
#

# In synopsis, put \noindent in front of each commandline, and preserve the .B's as bold.
if in_synopsis and re.match(r'\s*\\textbf{', line):
line = re.sub(r'\\textbf\{', r'\\monob{', line)
print("\\noindent")

#
# Substitutions within a line.
# The order of these replacements is important. (More specific ones first.)
#
line = re.sub(r'\\begin\{itemize\}', r'\\begin{wideitem}', line)
line = re.sub(r'\\end\{itemize\}', r'\\end{wideitem}', line)
line = re.sub(r'\\section\{', r'\\subsection*{', line) # \subsection* suppresses inclusion in TOC
line = re.sub(r'--', r'{-}{-}', line)
line = re.sub(r'\\item\s*\[\\textbf', r'\\item [\\monob', line) # option names in .TP are emphasized bold
line = re.sub(r'\\textbf\{\\% ', r'\\user{\\% ', line) # example command lines are bold, on their own line
line = re.sub(r'\\textit\{', r'\\monoi{', line) # metavariables (options, args) are .I in man, mono italic in tex
line = re.sub(r'\\textbf\{', r'\\mono{', line) # literals (commands, etc) are .B in man, normal mono in tex

print(line)



if f != sys.stdin:
f.close()

@@ -654,7 +654,10 @@ esl_msafile_GuessFileFormat(ESL_BUFFER *bf, int *ret_fmtcode, ESL_MSAFILE_FMTDAT
else // if we haven't guessed so far, try selex.
{ /* selex parser can handle psiblast too */
if (fmt_bysuffix == eslMSAFILE_SELEX) *ret_fmtcode = eslMSAFILE_SELEX;
else if (msafile_check_selex(bf) == eslOK) *ret_fmtcode = eslMSAFILE_SELEX;
else if (msafile_check_selex(bf) == eslOK) {
if (fmt_bysuffix == eslMSAFILE_PSIBLAST) *ret_fmtcode = eslMSAFILE_PSIBLAST;
else *ret_fmtcode = eslMSAFILE_SELEX;
}
else ESL_XFAIL(eslENOFORMAT, errbuf, "couldn't guess alignment input format - doesn't even look like selex");
}

@@ -717,13 +720,13 @@ esl_msafile_EncodeFormat(char *fmtstring)
if (strcasecmp(fmtstring, "stockholm") == 0) return eslMSAFILE_STOCKHOLM;
if (strcasecmp(fmtstring, "pfam") == 0) return eslMSAFILE_PFAM;
if (strcasecmp(fmtstring, "a2m") == 0) return eslMSAFILE_A2M;
if (strcasecmp(fmtstring, "phylip") == 0) return eslMSAFILE_PHYLIP;
if (strcasecmp(fmtstring, "phylips") == 0) return eslMSAFILE_PHYLIPS;
if (strcasecmp(fmtstring, "psiblast") == 0) return eslMSAFILE_PSIBLAST;
if (strcasecmp(fmtstring, "selex") == 0) return eslMSAFILE_SELEX;
if (strcasecmp(fmtstring, "afa") == 0) return eslMSAFILE_AFA;
if (strcasecmp(fmtstring, "clustal") == 0) return eslMSAFILE_CLUSTAL;
if (strcasecmp(fmtstring, "clustallike") == 0) return eslMSAFILE_CLUSTALLIKE;
if (strcasecmp(fmtstring, "phylip") == 0) return eslMSAFILE_PHYLIP;
if (strcasecmp(fmtstring, "phylips") == 0) return eslMSAFILE_PHYLIPS;
return eslMSAFILE_UNKNOWN;
}

@@ -709,16 +709,15 @@ esl_sqio_IsAlignment(int fmt)
int
esl_sqio_EncodeFormat(char *fmtstring)
{
if (strcasecmp(fmtstring, "daemon") == 0) return eslSQFILE_DAEMON;
if (strcasecmp(fmtstring, "ddbj") == 0) return eslSQFILE_DDBJ;
if (strcasecmp(fmtstring, "embl") == 0) return eslSQFILE_EMBL;
if (strcasecmp(fmtstring, "fasta") == 0) return eslSQFILE_FASTA;
if (strcasecmp(fmtstring, "fmindex") == 0) return eslSQFILE_FMINDEX;
if (strcasecmp(fmtstring, "embl") == 0) return eslSQFILE_EMBL;
if (strcasecmp(fmtstring, "genbank") == 0) return eslSQFILE_GENBANK;
if (strcasecmp(fmtstring, "hmmpgmd") == 0) return eslSQFILE_HMMPGMD;
if (strcasecmp(fmtstring, "ncbi") == 0) return eslSQFILE_NCBI;
if (strcasecmp(fmtstring, "ddbj") == 0) return eslSQFILE_DDBJ;
if (strcasecmp(fmtstring, "uniprot") == 0) return eslSQFILE_UNIPROT;

if (strcasecmp(fmtstring, "ncbi") == 0) return eslSQFILE_NCBI;
if (strcasecmp(fmtstring, "daemon") == 0) return eslSQFILE_DAEMON;
if (strcasecmp(fmtstring, "hmmpgmd") == 0) return eslSQFILE_HMMPGMD;
if (strcasecmp(fmtstring, "fmindex") == 0) return eslSQFILE_FMINDEX;
return esl_msafile_EncodeFormat(fmtstring);
}

@@ -741,9 +740,10 @@ esl_sqio_DecodeFormat(int fmt)
case eslSQFILE_GENBANK: return "GenBank";
case eslSQFILE_DDBJ: return "DDBJ";
case eslSQFILE_UNIPROT: return "UniProt";
case eslSQFILE_NCBI: return "NCBI";
case eslSQFILE_DAEMON: return "daemon";
case eslSQFILE_HMMPGMD: return "hmmpgmd";
case eslSQFILE_NCBI: return "NCBI";
case eslSQFILE_FMINDEX: return "fmindex";
default: break;
}
esl_exception(eslEINVAL, FALSE, __FILE__, __LINE__, "no such sqio format code %d", fmt);
@@ -1,34 +1,23 @@
.TH "esl-afetch" 1 "@EASEL_DATE@" "Easel @EASEL_VERSION@" "Easel Manual"
.TH "esl\-afetch" 1 "@EASEL_DATE@" "Easel @EASEL_VERSION@" "Easel Manual"

.SH NAME
.TP
esl-afetch - retrieve alignments from a multi-MSA database
esl\-afetch \- retrieve alignments from a multi-MSA database

.SH SYNOPSIS

.TP
Single MSA retrieval:
.B esl-afetch
.I [options]
.I msafile
.I key

.TP
Multiple MSA retrieval:
.B esl-afetch -f
.I [options]
.I msafile
.I keyfile
.nf
\fBesl\-afetch\fR [\fIoptions\fR] \fImsafile key\fR
(single MSA retrieval)

.TP
Indexing an MSA file for retrieval:
.B esl-afetch --index
.I msafile
\fBesl\-afetch \-f\fR [\fIoptions\fR] \fImsafile keyfile\fR
(multiple MSA retrieval, from a file of keys)

\fBesl\-afetch \-\-index \fImsafile\fR
(index an MSA file for retrieval)

.SH DESCRIPTION

.B esl-afetch
.B esl\-afetch
retrieves the alignment named
.I key
from an alignment database in file
@@ -44,71 +33,75 @@ number (AC).

.PP
Alternatively,
.B esl-afetch -f
.B esl\-afetch \-f
provides the ability to fetch many alignments at once.
The
.I -f
option has it interpret the second argument as a <keyfile>, a
file consisting of one name or accession per line.
.B \-f
option has it interpret the second argument as a
.IR keyfile ,
a file consisting of one name or accession per line.

.PP
The
.I msafile
should first be SSI indexed with
.B esl-afetch --index
.B esl\-afetch \-\-index
for efficient retrieval. An SSI index is
not required, but without one alignment retrieval may
be painfully slow.

.SH OPTIONS

.TP
.B -h
.B \-h
Print brief help; includes version number and summary of
all options, including expert options.

.TP
.B -f
.B \-f
Interpret the second argument as a
.I keyfile
instead of as just one
.I key.
.IR key .
The
.I keyfile
contains one name or accession per line.
This option doesn't work with the
.B --index
.B \-\-index
option.


.TP
.BI -o " <f>"
.BI \-o " <f>"
Output retrieved alignments to a file
.I <f>
instead of to
.I stdout.
instead of to stdout.

.TP
.BI -O
.BI \-O
Output retrieved alignment to a file named
.I <key>.
.IR key .
This is a convenience for saving some typing:
instead of
.B esl-afetch -o RRM_1 msafile RRM_1
.nf
\fB% esl\-afetch \-o RRM_1 msafile RRM_1\fR
.fi
you can just type
.B esl-afetch -O msafile RRM_1.
.nf
\fB% esl\-afetch \-O msafile RRM_1\fR
.fi
The
.B -O
.B \-O
option only works if you're retrieving a
single alignment; it is incompatible with
.B -f.
.B \-f.

.TP
.B --index
.B \-\-index
Instead of retrieving a
.I key,
the special command
.B esl-afetch --index
.B esl\-afetch \-\-index
.I msafile
produces an SSI index of the names and accessions
of the alignments in

0 comments on commit b11c190

Please sign in to comment.
You can’t perform that action at this time.