Giter Site home page Giter Site logo

Writing a for loop for treepl? about treepl HOT 2 CLOSED

dylanHco avatar dylanHco commented on August 11, 2024
Writing a for loop for treepl?

from treepl.

Comments (2)

dylanHco avatar dylanHco commented on August 11, 2024 1

Hi Joseph,

Thank you so much for this! I tried both, but in the end the second method worked for me.

from treepl.

josephwb avatar josephwb commented on August 11, 2024

If you are using the same config file for all the trees (say, trees from a common bootstrap or posterior distribution), this will work:

#!/bin/bash

# assumes:
# 1. a single treePL config file 'treepl.config' for all trees
#    - this assumes that all settings are the same
#       - constraints, mrcas, smoothing parameter, etc.
# 2. the tree filename specified in the config file is 'test.tre'
#    - do not set an output file name. we will use the default of 'out_dates'
# 3. there is an existing directory called 'complete'

for f in *.tre; do
  # copy current tree into 'test.tre'
  cp $f test.tre
  
  # run treePL
  treePL treepl.config
  
  # rename and move results
  mv out_dates.tre complete/"${f%.*}".dates.tre
  mv out_dates.tre.r8s complete/"${f%.*}".r8s.tre
  
done;

# get rid of test.tre to clean up
rm test.tre

put the above code in a text file called run_multi.sh and do:

chmod 755 run_multi.sh

to make it executable.
Make sure the output directory complete exists in the directory with the trees and single config file, and do:

./run_multi.sh

If you have separate config files for each tree, make sure they do have output file names specified (if not, one result will just overwrite the previous). Everything (tree and config files) can reside in the same directory, and then your bash script would simply be:

#!/bin/bash

for f in *.config; do
  treePL $f
done;

HTH.

from treepl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.