Code Monkey home page Code Monkey logo

raxml_ascbias's Introduction

raxml_ascbias

Python 3 script for removing and counting invariant sites from a PHYLIP file to use for the RAxML 8.2.X ascertainment bias correction

The script removes all invariant sites and generates output files for the Felsenstein and Stamatakis ascertainment bias corrections. It now does all three steps in a single execution.

The script is also optimized and way, way faster now. I ran it on a PHYLIP file with 107 individuals and 1,094,776 sites in 273 seconds.

NOTE: It uses a good bit of memory. On my PC it used ~3 or 4 GB of RAM when using a file with >1,000,000 sites.

Dependencies:

numpy
pandas
biopython

You will need the Python 3 versions of each dependency. They can be easily installed using Anaconda or using apt-get or pip.

Output files:

out.phy: PHYLIP file with invariant sites removed.
out.phy.felsenstein: Counts number of invariant sites and writes the count to file for input into RAxML (Felsenstein correction):

#_invariant_sites

out.phy.stamatakis: Counts invariant sites for each base and writes counts to space-delimited file:

A's C's G's T's

RAxML considers IUPAC characters and gaps to be invariant if phasing them could yield invariant sites. Consider the following example:

AAT  
ART  
TAG  
T-G  

ascbias.py will remove column 2 and yield:

AT  
AT  
TG  
TG  

Usage:

./ascbias.py -p <PHYLIP_INFILE> -o <OUTFILE; optional (default="out.phy")>

You might need to call the script with python3 to run it, depending on your system setup. E.g.:

python3 ./ascbias.py -p <PHYLIP_INFILE>

raxml_ascbias's People

Contributors

btmartin721 avatar marekslenker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

raxml_ascbias's Issues

Counting and extracting invariant sites question.

Hi again - Well I think your script runs fine but I noticed that there might be one small issue that could potentially inflate counts of the invariant sites. In fact I've tested this with another in-house script (its not quite as fast and I did not write it). Lets assume in Col 1 or any col for that matter there is one or 2 samples with an N at one position and every other genome contain bases at that position. Will your script call this position as a monomorphic site? Because my understanding is even if there are bases at all the other positions, that site is not considered monomorphic.

Based on your example...will this:

ANAT
AART
AAAG
AA-G

Produce this?

AT
AT
AG
AG

Thanks

Returns 0s for partition files.

Hello I have some WGS samples and I ran gubbins following whole genome SNP alignment to remove recombinant sites which produces a phylip file. I used that as input and ran your script as stated in the readme python3 ./ascbias.py -p Gubbins.filtered_polymorphic_sites.phylip -o testout.phy

The output file just returns 0s....specifically 0 0 0 0.

Any clue and why that might be?

IUPAC sites were not removed

Hi,

I was using the ascbias.py script to remove the invariant sites. It seems to not work for me. I first converted my vcf file to phylip format using the script https://raw.githubusercontent.com/edgardomortiz/vcf2phylip/master/vcf2phylip.py, and then using this script to remove invariant sites for raxml phylogeny inference. But the phylip file after processing still contains IUPAC sites, and raxml was conplaining there are invariant sites in the input file that I shouldn't user the model GTR+ASC_LEWIS.

Do you know what could be the reason?

thanks,
Cui

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.