Code Monkey home page Code Monkey logo

cnp2cnp's Introduction

The python programs provided here were tested with python 2.7.12 and python 3.5.2.
Provided python is installed, there are no special library dependencies.
To run the simulations, numpy is needed.  

*** If you are interested in the data files used for our simulations, they are too large for github.  They can be foud at 
https://depot-rech.dinf.usherbrooke.ca/grif/bioinfo/cnp2cnp_data


The main program is cnp2cnp.py.  It takes a CNP fasta file as input and it can either

- compute the distance between two CNPs (by default, or use argument "-m dist"),
- compute the distance matrix between a set of CNPs (use argument "-m matrix").

Example executions:
> python cnp2cnp.py -m dist -i examples/cnp_pair.fa
> python cnp2cnp.py -m matrix -i examples/cnps.fa -o examples/cnps.phy

See
> python cnp2cnp.py --help 
for details

Four distances can be computed (see [Cordonnier & Lafond] for details):
- any: with unrestricted movement at unit cost, uses the improved approximation algorithm (by default, or use "-d any")
- dbl: same algorithm as any, but prevents amplifications that would more than double a position count (use "-d dbl")
- flat: counts the number of flat intervals (use "-d flat")
- euclidean: counts the square root of the sum of differences squares (use "-d euclidean")



In mode "dist", the expected input file is in fasta format and has 2 CNPs.
The copy-numbers must be non-negative integers and are comma separated.
Example of fasta file: 
> my_first_cnp
1,2,0,3,2,1
> my_second_cnp
1,2,3,0,1,1

The positions with a 0 in the first CNP will be removed.
The computed distance will be written to stdout.


In mode "matrix", a distance matrix is computed between all pairs of sequences in a given fasta file (see above for format).
In case of "any", "dbl" or "flat" distances, the distance is not symmetric, but the output matrx is symmetric.  
The program will compute d(u, v) if u is before v in the fasta file, or d(v, u) otherwise.
The output is written to a phylip file, destined to be used by the "phylip neighbor" program.



The program cnp_simulator.py was used to simulate our trees and evaluate them.  
It is less well-documented but the code should be clean enough for usage by any programmer.

cnp2cnp's People

Contributors

aevo-lab avatar

Watchers

James Cloos avatar

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.