Skip to content

Commit ad0174d

Browse files
authored
Add new options to resinfo short (#1158)
* Fix maxwidth behavior * Add groupsize keyword * 6.30.1 - revision bump for resinfo short groupsize keyword * Add nucleic keyword * Update resinfo manual entry * Update manual * Add test
1 parent ed3431d commit ad0174d

9 files changed

Lines changed: 44 additions & 9 deletions

File tree

doc/CpptrajManual.pdf

149 KB
Binary file not shown.

doc/DocumentChecksums.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
b37726e7a841f6fc695ecd7fb040ffbf CpptrajDevelopmentGuide.lyx
2-
70869c8569e7bd44d1669bc9ba6d68d8 cpptraj.lyx
2+
30abc9d08551e23061abcb780f78b02a cpptraj.lyx
33
5d9b5b5ed47a3ded57b6464df99b3585 CpptrajManual.lyx

doc/cpptraj.lyx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16684,7 +16684,11 @@ parmresinfo
1668416684

1668516685
\end_inset
1668616686

16687-
[parm <name> | parmindex <#> | <#>] <mask> [short [maxwidth <#res>]]
16687+
[parm <name> | parmindex <#> | <#>] <mask>
16688+
\end_layout
16689+
16690+
\begin_layout LyX-Code
16691+
[short {nucleic|[maxwidth <#res>] [groupsize <#res>]}]
1668816692
\end_layout
1668916693

1669016694
\begin_layout LyX-Code
@@ -16738,6 +16742,19 @@ parmindex
1673816742
<#res>] Max # of residues to print in one line (default 50).
1673916743
\end_layout
1674016744

16745+
\begin_layout Description
16746+
[groupsize
16747+
\begin_inset space ~
16748+
\end_inset
16749+
16750+
<#res>] Max # of residues to put in a group (default 10).
16751+
\end_layout
16752+
16753+
\begin_layout Description
16754+
[nucleic] Do a printout suitable for nucleic acid residues (maxwidth 45,
16755+
groupsize 3).
16756+
\end_layout
16757+
1674116758
\end_deeper
1674216759
\begin_layout Description
1674316760
[out

src/Exec_Top.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,18 +174,24 @@ Exec::RetType Exec_AtomInfo::Execute(CpptrajState& State, ArgList& argIn) {
174174

175175
// -----------------------------------------------------------------------------
176176
void Exec_ResInfo::Help() const {
177-
mprintf("\t[%s] <mask> [short [maxwidth <#res>]]\n\t[out <file>]\n", DataSetList::TopIdxArgs);
177+
mprintf("\t[%s] <mask> \n\t[short {nucleic|[maxwidth <#res>] [groupsize <#res>]}]\n\t[out <file>]\n", DataSetList::TopIdxArgs);
178178
mprintf(" Print info for residues in <mask> for specified topology (first by default).\n"
179179
" If 'short' is specified print residue info in shorter form.\n");
180180
}
181181

182182
Exec::RetType Exec_ResInfo::Execute(CpptrajState& State, ArgList& argIn) {
183183
bool printShort = argIn.hasKey("short");
184+
int maxwidth = argIn.getKeyInt("maxwidth", 50);
185+
int groupsize = argIn.getKeyInt("groupsize", 10);
186+
if (argIn.hasKey("nucleic")) {
187+
maxwidth = 45;
188+
groupsize = 3;
189+
}
184190
TopInfo info;
185191
if (CommonSetup(info, State, argIn, "Residue info")) return CpptrajState::ERR;
186192
int err;
187193
if (printShort)
188-
err = info.PrintShortResInfo( argIn.GetMaskNext(), argIn.getKeyInt("maxwidth",50) );
194+
err = info.PrintShortResInfo( argIn.GetMaskNext(), maxwidth, groupsize );
189195
else
190196
err = info.PrintResidueInfo( argIn.GetMaskNext() );
191197
if (err != 0) return CpptrajState::ERR;

src/TopInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ int TopInfo::PrintResidueInfo(std::string const& maskExpression) const {
218218
}
219219

220220
/** Print residue info using single char names. */ // TODO use Topology::ResnumsSelectedBy
221-
int TopInfo::PrintShortResInfo(std::string const& maskString, int maxChar) const {
221+
int TopInfo::PrintShortResInfo(std::string const& maskString, int maxChar, int groupSize) const {
222222
if (maskString.empty()) {
223223
mprinterr("Error: No valid mask given for short residue info.\n");
224224
return 1;
@@ -261,7 +261,7 @@ int TopInfo::PrintShortResInfo(std::string const& maskString, int maxChar) const
261261
if (current_res == max_res) break;
262262
startRes = -1;
263263
resLine.clear();
264-
} else if ((total % 10) == 0)
264+
} else if ((total % groupSize) == 0)
265265
resLine += ' ';
266266
rn = current_res;
267267
}

src/TopInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TopInfo {
1919
int SetupTopInfo(Topology const* p, DataSet_Coords* c) { return SetupTopInfo(0, p, c); }
2020

2121
int PrintAtomInfo(std::string const&) const;
22-
int PrintShortResInfo(std::string const&, int) const;
22+
int PrintShortResInfo(std::string const&, int, int) const;
2323
int PrintResidueInfo(std::string const&) const;
2424
int PrintMoleculeInfo(std::string const&) const;
2525
int PrintShortMolInfo(std::string const&) const;

src/Version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Whenever a number that precedes <revision> is incremented, all subsequent
1313
* numbers should be reset to 0.
1414
*/
15-
#define CPPTRAJ_INTERNAL_VERSION "V6.30.0"
15+
#define CPPTRAJ_INTERNAL_VERSION "V6.30.1"
1616
/// PYTRAJ relies on this
1717
#define CPPTRAJ_VERSION_STRING CPPTRAJ_INTERNAL_VERSION
1818
#endif

test/Test_TopInfo/RunTest.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
CleanFiles info.in atoms.dat residues.dat bonds.dat angles.dat dihedrals.dat \
66
molecules.dat masscharge.dat values.dat molshort.dat molselect.dat \
7-
molselect2.dat ChargeMass.dat
7+
molselect2.dat ChargeMass.dat ftu.res.out ftu.nucleic.out
88

99
INPUT="-i info.in"
1010
cat > info.in <<EOF
@@ -43,6 +43,10 @@ molinfo short 1 *
4343
molinfo short out molshort.dat 1 *
4444
resinfo ^2,5-7,100 out molselect.dat parm dna30.parm7
4545
atoms ^1:DC@P,O?P out molselect2.dat parmindex 1
46+
47+
parm ../FtuFabI.NAD.TCL.parm7
48+
resinfo parmindex 2 ^1 short maxwidth 45 groupsize 3 out ftu.res.out
49+
resinfo parmindex 2 ^1 short nucleic out ftu.nucleic.out
4650
quit
4751
EOF
4852
RunCpptraj "Topology info print test."
@@ -57,6 +61,8 @@ DoTest molshort.dat.save molshort.dat
5761
DoTest molselect.dat.save molselect.dat
5862
DoTest molselect2.dat.save molselect2.dat
5963
DoTest ChargeMass.dat.save ChargeMass.dat
64+
DoTest ftu.res.out.save ftu.res.out
65+
DoTest ftu.res.out.save ftu.nucleic.out
6066

6167
UNITNAME='Topology info with reference coords test'
6268
CheckFor netcdf

test/Test_TopInfo/ftu.res.out.save

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
1 MGF LAG KKI LIT GLL SNK SIA YGI AKA MHR EGA ELA FTY VGQ FKD
2+
46 RVE KLC AEF NPA AVL PCD VIS DQE IKD LFV ELG KVW DGL DAI VHS
3+
91 IAF APR DQL EGN FID CVT REG FSI AHD ISA YSF AAL AKE GRS MMK
4+
136 NRN ASM VAL TYI GAE KAM PSY NTM GVA KAS LEA TVR YTA LAL GED
5+
181 GIK VNA VSA GPI KTL AAS GIS NFK KML DYN AMV SPL KKN VDI MEV
6+
226 GNT VAF LCS DMA TGI TGE VVH VDA GYH CVS MGN VLL EHH HHH H

0 commit comments

Comments
 (0)