Permalink
Browse files

add --prec option to halPhlyoP to control number of digits to write i…

…n wigs. default remains 3
  • Loading branch information...
1 parent eb49d71 commit d6e89da0b1466623a945146a5512108112131c4e @glennhickey glennhickey committed Nov 1, 2013
Showing with 18 additions and 5 deletions.
  1. +5 −1 phyloP/halPhyloPMP.py
  2. +6 −0 phyloP/halTreePhyloP.py
  3. +0 −4 phyloP/impl/halPhyloP.cpp
  4. +7 −0 phyloP/impl/halPhyloPMain.cpp
View
@@ -53,7 +53,8 @@ def getHalPhyloPCmd(options):
opt == 'dupMask' or
opt == 'step' or
opt == 'refBed' or
- opt == 'subtree')):
+ opt == 'subtree' or
+ opt == 'prec')):
if val is not True:
cmd += ' --%s %s' % (opt, str(val))
else:
@@ -270,6 +271,9 @@ def main(argv=None):
hppGrp.add_argument("--subtree",
help="Subtree root for lineage-specific acceleration/conservation",
default=None)
+ hppGrp.add_argument("--prec",
+ help="Number of decimal places in wig output", type=int,
+ default=None)
args = parser.parse_args()
View
@@ -58,6 +58,8 @@ def computeTreePhyloP(args):
args.hal, genome, args.mod, bedFlags, args.numProc, wigFile)
if args.subtree is not None:
cmd += " --subtree %s" % args.subtree
+ if args.prec is not None:
+ cmd += " --prec %d" % args.prec
runShellCommand(cmd)
@@ -117,6 +119,10 @@ def main(argv=None):
parser.add_argument("--subtree",
help="Run clade-specific acceleration/conservation on subtree below this node",
default=None)
+ parser.add_argument("--prec",
+ help="Number of decimal places in wig output", type=int,
+ default=None)
+
# need phyloP options here:
args = parser.parse_args()
@@ -54,10 +54,6 @@ void PhyloP::init(AlignmentConstPtr alignment, const string& modFilePath,
_softMaskDups = (int)softMaskDups;
_outStream = outStream;
- // set float precision to 3 places to be consistent with non-hal phyloP
- _outStream->setf(ios::fixed, ios::floatfield);
- _outStream->precision(3);
-
if (dupType == "ambiguous")
{
_maskAllDups = 0;
@@ -70,6 +70,7 @@ static CLParserPtr initParser()
"leading up to this node), and test for "
"conservation/acceleration in this subtree "
"relative to the rest of the tree", "\"\"");
+ optionsParser->addOption("prec", "Number of decimal places in wig output", 3);
optionsParser->setDescription("Make PhyloP wiggle plot for a genome.");
return optionsParser;
@@ -90,6 +91,7 @@ int main(int argc, char** argv)
hal_size_t length;
hal_size_t step;
string refBedPath;
+ hal_size_t prec;
try
{
optionsParser->parseOptions(argc, argv);
@@ -106,6 +108,7 @@ int main(int argc, char** argv)
subtree = optionsParser->getOption<string>("subtree");
std::transform(dupMask.begin(), dupMask.end(), dupMask.begin(), ::tolower);
refBedPath = optionsParser->getOption<string>("refBed");
+ prec = optionsParser->getOption<hal_size_t>("prec");
}
catch(exception& e)
{
@@ -169,6 +172,10 @@ int main(int argc, char** argv)
}
}
+ // set the precision of floating point output
+ outStream.setf(ios::fixed, ios::floatfield);
+ outStream.precision(prec);
+
PhyloP phyloP;
phyloP.init(alignment, modPath, &outStream, dupMask == "soft" , dupType,
"CONACC", subtree);

0 comments on commit d6e89da

Please sign in to comment.