Commit 12ae60bd authored by Alexis  CRISCUOLO's avatar Alexis CRISCUOLO
Browse files

2.0

parent 12f9fd20
This diff is collapsed.
# BMGE
Block Mapping and Gathering with Entropy
_BMGE_ (Block Mapping and Gathering with Entropy) is a command line program written in [Java](https://docs.oracle.com/en/java/) to select regions in a multiple sequence alignment that are suited for phylogenetic inference. For more details, see the associated publication (Criscuolo and Gribaldo 2010).
## Getting started
Since _BMGE_ v2.0, this GitLab repository replaces the [previous ftp repository](ftp://ftp.pasteur.fr/pub/gensoft/projects/BMGE/).
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
_BMGE_ v2.0 has major differences compared to the previous version (1.12):
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
+ complete reimplemention of the source code to obtain signicantly faster running times (especially when compiled with [GraalVM](https://www.graalvm.org/)),
## Add your files
+ no longer need of the matrix package [JAMA](https://math.nist.gov/javanumerics/jama/),
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
+ fixed bugs,
```
cd existing_repo
git remote add origin https://gitlab.pasteur.fr/GIPhy/BMGE.git
git branch -M main
git push -uf origin main
```
+ simplified/intuitive options (e.g. `-h` is replaced with `-e` to set entropy value thresholds),
## Integrate with your tools
+ modified default values (i.e.. `-b`, `-g`, `-m`) to prevent a too strong degradation of the overall phylogenetic signal in standard usage (as highlighted by e.g. Tan et al. 2015),
- [ ] [Set up project integrations](https://gitlab.pasteur.fr/GIPhy/BMGE/-/settings/integrations)
+ new verbose option (`-v`) to print each character entropy value in tab-delimited format,
## Collaborate with your team
+ stationary-based character trimming no longer supported,
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
+ gap-based filtering no longer supported for sequence (only for characters),
## Test and Deploy
+ reformatting of the NCBI-formatted FASTA headers no longer supported,
Use the built-in continuous integration in GitLab.
+ lighter HTML output files
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
## Installation
# Editing this README
Clone this repository with the following command line:
```bash
git clone https://gitlab.pasteur.fr/GIPhy/BMGE.git
```
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Compilation and execution
## Name
Choose a self-explaining name for your project.
The source code of _BMGE_ is inside the _src_ directory. It requires **Java 11** (or higher) and can be compiled and executed in two different ways.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
#### Building an executable jar file
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
On computers with [Oracle JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html) (**11** or higher) installed, a Java executable jar file can be created. In a command-line window, go to the _src_ directory and type:
```bash
javac BMGE.java
echo Main-Class: BMGE > MANIFEST.MF
jar -cmvf MANIFEST.MF BMGE.jar BMGE.class bmge/*.class
rm MANIFEST.MF BMGE.class bmge/*.class
```
This will create the executable jar file `BMGE.jar` that can be run with the following command line model:
```bash
java -jar BMGE.jar [options]
```
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
#### Building a native code binary
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
On computers with [GraalVM](https://www.graalvm.org/downloads/) installed, a native executable can be built. In a command-line window, go to the _src_ directory, and type:
```bash
javac BMGE.java
native-image BMGE BMGE
rm BMGE.class bmge/*.class
```
This will create the native executable `BMGE` that can be run with the following command line model:
```bash
./BMGE [options]
```
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
Run _BMGE_ without option to read the following documentation:
```
Block Mapping and Gathering with Entropy
Criscuolo and Gribaldo (2010) doi:10.1186/1471-2148-10-210
https://research.pasteur.fr/software/bmge-block-mapping-and-gathering-with-entropy
USAGE: BMGE -i <infile> -t <datatype> -o <outfile> [options]
OPTIONS:
-i <file> multiple sequence alignment file in FASTA or PHYLIP sequential format (mandatory)
-t <AA|CO|NT> input data type; AA: amino acid, CO: codon, NT: nucleotide (mandatory)
-o[<string>] <file> output file name in FASTA (-o, -of), NEXUS (-ox), PHYLIP sequential (-op), or
HTML (-oh) format; character state conversion can be performed by adding suffix
aa (amino acid), co (codon), nt (nucleotide) or ry (RY coding); codon position p
selected by adding suffix 1 (p=1), 2 (p=2) and/or 3 (p=3)
-m BLOSUM<int> [AA, CO] name of the BLOSUM matrix; n = 30, 35, 40, ..., 60, 62, 65, ..., 90, 95
(default: BLOSUM30)
-m DNAPAM<int:real> [NT] name of the DNA PAMn matrix (n > 0) with transition/transversion ratio t > 0
(default: DNAPAM180:2)
-m DNAPAM<int> [NT] name of the DNA PAMn matrix with transition/transversion ratio t = 1
-m ID [AA, CO, NT] identity matrix to compute Shannon instead of von Neumann entropy
-w <int> sliding window (odd) size for smoothing entropy values (default: 3)
-e <real> maximum entropy value threshold (default: 0.5)
-e <real:real> minimum and maximum entropy value thresholds, respectively (default: 0:0.5)
-g <real> maximum gap rate allowed per character (default: 0.5)
-b <int> minimum width of the gathered blocks (default: 3)
-v verbose mode
-h prints this help and exits
EXAMPLES:
BMGE -i dna.fasta -t NT -m DNAPAM100:3 -b 1 -o out.fna -ory out.ry.fasta
BMGE -i msa.faa -t AA -m BLOSUM30 -g 0.1 -oh out.html -opco out.phy
BMGE -i codon.phy -t CO -m BLOSUM50 -e 0.4 -oaa out.faa -onco12 out.nex
```
## Notes
+ For any detail about the character filtering method implemented by BMGE, see the associated paper (Criscuolo and Gribaldo 2010).
+ By default, _BMGE_ is expected to gather character blocks that are well-suited for phylogenetic inference without altering the overall phylogenetic signal. However, to modify the character filtering stringency, it is highly recommended to set the option `-m` with dedicated similarity matrices, instead of modifying the entropy threshold (i.e. option `-e`; see e.g. Steenwyk et al. 2020). When dealing with nucleotide sequences (`-t NT`), the stringency will increase (i.e. less characters are gathered) when lowering the DNAPAM matrix value, e.g. from DNAPAM180 (default) to DNAPAM50. For amino acid or codon sequences, the stringency will increase when setting large BLOSUM matrix values, e.g. from BLOSUM30 (default) to BLOSUM90.
+ An alternative to increase the stringency of _BMGE_ (at the cost of some reduction of the phylogenetic signal) is to gather only large blocks of conserved characters by setting the option `-b` with large values (e.g. 10).
+ _BMGE_ can also be used to convert input files in FASTA or PHYLIP (sequential) format into FASTA (option `of`), NEXUS (`-ox`) or PHYLIP sequential (`-op`) format. HTML output files (`-oh`) can be also written to have a look at the multiple sequence alignment after character filtering. In complement, translation, back-translation or codon position selection can be easily performed by adding dedicated suffixes to the option `-o`. Of important note, to only perform such transformations, run _BMGE_ with options `-e 1 -g 1` to unset character filtering steps.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
## References
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
Criscuolo A, Gribaldo S (2010) _BMGE (Block Mapping and Gathering with Entropy): a new software for selection of phylogenetic informative regions from multiple sequence alignments_. **BMC Evolutionary Biology**, 10:210. [doi:10.1186/1471-2148-10-210](https://doi.org/10.1186/1471-2148-10-210)
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
Steenwyk JL, Buida TJ III, Li Y, Shen X-X, Rokas A (2020) _ClipKIT: A multiple sequence alignment trimming software for accurate phylogenomic inference_. **PLoS Biology**, 18(12):e3001007. [doi:10.1371/journal.pbio.3001007](https://doi.org/10.1371/journal.pbio.3001007)
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
Tan G, Muffato M, Ledergerber C, Herrero J, Goldman N, Gil M, Dessimoz C (2015) _Current Methods for Automated Filtering of Multiple Sequence Alignments Frequently Worsen Single-Gene Phylogenetic Inference_. **Systematic Biology**, 64(5):778-791. [doi:10.1093/sysbio/syv033](https://doi.org/10.1093/sysbio/syv033)
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
Each of the two files prmA.faa and prmA.fna contains a multiple sequence alignment in FASTA format.
The file prmA.faa was built from cyanobacterial prmA amino acid sequences, and the file prmA.fna
corresponds to their back-translated nucleotide sequences. The other files prmA.* were obtained
with the following command lines:
java -jar BMGE.jar -i prmA.faa -t AA -m BLOSUM95 -o prmA.blosum95.faa -oh prmA.blosum95.html
java -jar BMGE.jar -i prmA.fna -t NT -m DNAPAM150:2 -o prmA.pam150.fna -oh prmA.pam150.html
java -jar BMGE.jar -i prmA.faa -t AA -oco prmA.blosum30.fna -oh prmA.blosum30.html
This diff is collapsed.
This diff is collapsed.
>Acaryochloris_marina_MBIC11017|||NC_009925:1265568-1266503
QWWEIKLLDDLLFWRLEEGCQGTASCGYLSIDLQKLAITEEDWAHNWRDYWHPQEVGNRLLIYPAWLEVPEERLLIRLNPGVAFGTGAHATTQLCLRALEQSIADIGCGTGILSIAALLLGVQKAYAVDLDPLAIGATASRELNGEGSLVQGFCCNILAHIILDLIPHNGWGILSGILDTQEALNHGWQEQDWCSLI
>Anabaena_variabilis_ATCC_29413|||NC_007413:4682250-4683167
TWWEIQALEDSVSWRLDFGCRGTASKGYLPLDLAALGIDEEDWASSWKQYWHPQEIGDRFLINPAWLPSPEDRLVIRLDPGVAFGTGNHATTQLCLESLEMIIADIGCGSGILSIGAILLGAEKVYAVDTDPLAVQSTSNRALNEEGSVVDGIVCNILADVIIQLVPESTWAIFSGILVEQSALEHGWVRKEWCCLN
>Arthrospira_maxima_CS_328|||NZ_ABYK01000006:c131237-132163
SWWEIRNLEETVFWRLNFGFRGTASCAYLPLDLAALSIDEEDWSSSWKQHWEPTEIGDRFWIYPAWLTPPEDRLILRLDPGVAFGTGAHATTQLCLESLEMTVVDIGCGSGILGIGAILLGATQVYGVDTDPLAVRSAENRDLNHVGSVVDGILCNILAEVIMDIIPQNSWGVLSGILLEQALLEHGWIRQNWCCFN
>Arthrospira_platensis_str_Paraca|||NZ_ACSK01000554:c2958-3845
SWWEIRNLEETVFWRLNFGFRGTASCAYLPLDLAALSIDEEDWSSSWKQHWEPTEIGDRFLIYPAWLTPPEDRLILRLDPGVAFGTGAHATTQLCLESLEMTIADIGCGSGILGIGAILLGATQVYGVDTDPLAVRSAENRDLNHVGSVVDGILCNILAEVIMDIIPQNSWGVLSGILLEQALLEHGWIRQDWCCFN
>Crocosphaera_watsonii_WH_8501|||NZ_AADV02000001:717547-718443
SWWEITHLEESITWRLKFGCSGTSRQGYIPLDISALSIDEEDWSSSWKQYWEPTEVGDRFIIYPAWLTPPEDKLILKLDPGVAFGTGTHPTTQLCLESLEMVIADIGSGSGILSIGAILLGASKAYAVDIDPLAVKAAENRHLNQQGSLVDGIVCNILAEVIIDLIPQNTWGILSGILLEQSTLEEGWIRKKWCCFQ
>Cyanobium_sp_PCC_7001|||NZ_ABSE01000018:364965-365864
SWWRLEELEESLLWKLQLGIGRVAILAWLPPERQALEQPEEDWSLSWKQHWQPDPVGRRLLILPAWLELPPERLVIRMDPGSAFGTGSHPTTRLCLEAIEATVADLGCGSGILGLAALLQGAGRVCAADTDSLAVGATENALVSGQGSVADLLLCNILAPVIEALCPAAGVGLLSGLLVDQAVLAEGWRQSAWGLLR
>Cyanothece_sp_ATCC_51142|||NC_010546:c2168537-2169433
SWWEITHLEESITWRLKFGCSGTSRQAYAPLDISALSIDEEDWASSWKEHWEPTEVGDRFIIYPAWLTPPEDKLILRLDPGVAFGTGTHPTTQLCLESLEMVIADIGSGSGILSIGAILLGAKKAYAVDIDPLAVKAAENRHLNQQGSLVDGIVCNILAEVIIELIPQNTWGILSGILLEQSTLEEGWIRKQWCCFQ
>Cyanothece_sp_CCY_0110|||NZ_AAXW01000012:c16090-16986
SWWEITHLEESITWRLKFGCSGTSRQAYAPLDISALSIEEEDWASSWKEHWEPTEVGDRFIVYPAWLTPPEDKLILRLDPGVAFGTGTHPTTQLCLESLEMVIADIGSGSGILSIGAILLGASKAYAVDIDPLAVKAAENRHLNQQGSLVDGIVCNILAEVIIDLIPHNTWGVLSGILIEQSTLEEGWIRKQWCCFQ
>Cyanothece_sp_PCC_7424|||NC_011729:4219479-4220372
SWWEIQNLEESVFWRLKFGCSGTATKAYIPLDLAALSIDEEDWASSWKQHWQPTEIGDRMIIYPAWLTPPTDQIIIRLDPGSAFGTGTHATTQLCLESLEMTLADIGCGSGILSIGAILLGAQKVYAVDTDPLAVSATSNRHLNEQGSIVDGIVCNILAEVIMDMIPQKSWAILSGILLEQATLEHDWVRGDWCCFN
>Cyanothece_sp_PCC_7425|||NC_011884:3331653-3332537
SWWEIQALEEGISWRLSFGCQGTASTGYLPLDLAALSINEEDWATSWQQYWHPQEVGDRLLIYPAWLDLPEERLLLRLDPGVAFGTGTHPTTQLCLEALEMTVADIGCGTGILSIAALRLGAKQAFAVDLDPLAVESARSRDLNEQGSVVQGIVCNILAETIIDLIPTHTWAAFSGILVTQAALEQGWQRQDWCCIN
>Cyanothece_sp_PCC_7822|||NZ_ABVE01000002:893448-894341
SWWEIRDLEESIFWRLKFGCSGTATRAYIPLDLAALSIDEEDWASSWKQHWEPTSIGDRFIIYPAWLTPASDKIILRLDPGMAFGTGTHPTTQLCLESLEMVIADIGCGSGILSIGAVLLGAPQVYAVDNDPLAVKAASNRQLNQQGSIVDGFVCNILAEVIIEMIPQQCWAILSGILLEQATLEHDWVRQDWCCFN
>Cyanothece_sp_PCC_8801|||NC_011726:c2444809-2445696
SWWEISNLEESIFWRLQFGCSGTARRAYVPLDLAALSIDDEDWASSWKDHWQPTEVGDRFLIYPAWLTLPQDRLILRLDPGAAFGTGTHPTTQLCLESLEMIIADIGCGSGILSIGAVLLGATKVYAVDIDPLAVDAASNRHLNQQGSVVDGILCNILAEVIIELIPQHAWAILSGILIDQSTLEYGWVQGEWSCLH
>Cyanothece_sp_PCC_8802|||NZ_ABVI01000012:40911-41798
SWWEISNLEESIFWRLQFGCSGTARRAYVPLDLAALSIDDEDWASSWKDHWQPTEVGDRFLIYPAWLTLPQDRLILRLDPGAAFGTGTHPTTQLCLESLEMTIADIGCGSGILSIGAVLLGATKVYAVDIDPLAVDAASNRHLNQQGSVVDGILCNILAEVIIDLIPQHAWAILSGILIDQSTLEYGWVQGEWSCLH
>Gloeobacter_violaceus_PCC_7421|||NC_005125:2287095-2288042
QWWAVAEVEETLYWYLELGLPHVERRGYLS---GVMEVERRDWQAAWREQWRPIFVGERLVIWPVWLPDP-DRLVIPLDPGMAFGTGEHATTRLCLRALESTFADVGCGSGVLTVAALKLGAGRGWAVDTDDLAVVSTKNLEISGRGSTLDGVVSNILAEVIANLAPEGGWGIFSGLLLTQAALAQGFAEGDWACLV
>Lyngbya_sp_PCC_8106|||NZ_AAVU01000041:c30677-31564
SWWEIQVLEESIFWRLSFGCRGTASSAYLPLDLAALAIDEQDWASSWKKHWEPTKIGDYFLIYPAWLETPADRILLHLDPGVAFGTGAHATTQLCLESIEMVVADVGCGSGILSIGALLLGATKAYAVDIDPMAVRSAQNRQLNNQGGIVDGILCNILAEVIIDLIPKTTWGILSGILLDQATLEHGWIRQDWCCFN
>Microcoleus_chthonoplastes_PCC_7420|||NZ_ABRS01000006:c213159-214046
SWWEIKDLEDLIFWRLSFGCRGMSCRAHLPLDLAALSIDEEDWASSWKQHWQPTEIGDCFLIYPAWLSVPQDRLLLRLDPGAAFGTGTHPTTHLCLEALEMVIADIGCGSGILSIASVLLGAKKVLGVDIDPLAVRSASNRELNQKGSVVDGILCNILAEVIIDLIPGHSWGIISGILLDQATLEHNWTRQEWCCFN
>Microcystis_aeruginosa_NIES_843|||NC_010296:c4648083-4648976
SWWEITSLEETVFWRLDFGCSGTATKAYIPLDLEALSMDEEDWASSWKQHWQISEIGDRFLICPAWLNPPEQRLVIKIDPGSAFGTGTHPTTQLCLESLEMIIADIGCGSGILAIGAILLGAKKVYAVDTDPLAVNATSNRHLNRQGSVVDGIVCNILAETIIALMPETTWGILSGILVTQAILEQGWTRQEWCCLQ
>Microcystis_aeruginosa_PCC_7806|||AM778923:c185-42078
SWWEITSLEETVFWRLDFGCSGTATKAYIPPDLEALSMDEEDWASSWKQHWQISEIGDRFLICPAWLNPPEQRLVIKIDPGSAFGTGTHPTTQLCLESLEMIIADIGCGSGILAIGAILLGAKKVYAVDIDPLAVNATSNRHLNGQGSVVDGIVCNILAETIIALMPETTWGILSGILFTQAILEHGWTRQEWCCIQ
>Nodularia_spumigena_CCY_9414|||NZ_AAVW01000001:15814-16731
TWWELQALEESVSWRLNFSSRGTASKAYLPLDLAALSIDEEDWATSWKQYWKPEEIGDRFLINPAWLALPEERLVIRLDPGVAFGTGNHATTQLCLESLEMVIADIGCGSGILSIGALLLGAAKVYAVDTDPLAVQSTSNRALNDEGSVVDGIVCNILADVIIQLVPENTWAIFSGILLEQSALENGWIKKEWCCLN
>Nostoc_azollae_0708|||NZ_ACIR01000080:c7475-8392
TWWELKDLEDIIFWRLGFGCRGTASKAYLPLDLSALSIDEEDWASRWKQYWQPQEIGDRFLINPAWLPLQDERLVIRLDPGIAFGTGNHSTTQLCLESLEMVIADIGCGSGILSIGAILLGAEKVYAVDNDPLAVKSTSNRALNDQGSVVDGIVCNILADVIIELIPETSWGVFSGILLEQSVLENGWVRKEWCCLN
>Nostoc_punctiforme_PCC_73102|||NC_010628:c6457967-6458884
TWWELQDLEDSIFWRLDFGCRGTASRAYLSLDLAALSIDEEDWATSWKQYWHPQEIGDRFLINPAWLPLPEERLVIRLDPGVAFGTGNHATTQLCLESLEMVIADIGCGSGILSIGALLLGAEKVYAVDNDPLAVQSTSNGLLNDLGSVVDGIVCNILAHVIIELIPEETWAIFSGILLEQSALENGWVRKEWCCLN
>Nostoc_sp_PCC_7120|||NC_003272:2261255-2262172
TWWELQALEDSVSWRLDFGCRGTASKGYLPLDLAALGIDEEDWASSWKQYWHPQEIGDRFLINPAWLPSPEDRLIIRLDPGVAFGTGNHATTQLCLESLEMIIADIGCGSGILSIGAVLLGAQKVYAVDTDPLAVQSTSNRALNEEGSVVDGIVCNILADVIIQLVPESTWAIFSGILVEQSALEHGWVRKEWCCLN
>Prochlorococcus_marinus_str_AS9601|||NC_008816:c1331733-1332641
DWYKLTDSEEIIIWKLELGIFSFSFNIWLPSSRFGVEIKEEDWLTSWKKYWAPELVGNHFLILPCWINLNEDKKIIKIDPGAAFGTGSHPSTYLCLEKMDNKILDIGSGSGILSVAARLLGAKEVCAVDNDYLAINATSNFQLNFLGSFFDFVLCNILAEVIKEMIPNNGEVIFSGILNSQKILINDLKRKDWACIS
>Prochlorococcus_marinus_str_MIT_9202|||NZ_ACDW01000003:c255438-256346
DWYKLTDSEDIIIWKLELGILSFSFNIWLPNSRSDFEIKEEDWLTSWKKYWAPELVGNHFLILPCWINLNEDKQIIKIDPGAAFGTGSHPSTYLCLEKMENKVLDIGSGSGILSIAARLRGAKEVFAVDNDYLAINSTSNFQLNFLGSFFDFVLCNILAEVIKGMIPNNGEVIFSGILNSQKILINNLKRKNWACIS
>Prochlorococcus_marinus_str_MIT_9211|||NC_009976:c1273528-1274442
FWWRLKELEESMIWKLHLSIKSYAIYIWLIYQREQLIVDDEDWSSSWKKYWGPAPVGKRLLILPAWMDLPAERIVVKLDPGAAFGTGDHPTTKLCLEAIERRIVDIGCGSGVLGLAALRLGAKEVIGVDIDPLAIGSARNAFLNDHGSIADLLLCNILAPVIKTLGEDQGNALISGLLVEQMFLVLGWNQDNWALIQ
>Prochlorococcus_marinus_str_MIT_9215|||NC_009840:c1373279-1374205
DWYKLTDSEDIIIWKLELGIFSFSFNIWLPNSRSDFEIKEEDWLTSWKKFWAPELVGNHFLILPCWINLNEDKQIIKIDPGAAFGTGSHPSTYLCLEKMENKVLDIGSGSGILSIAARLGGAKEVCAVDNDYLAINSTSNFQLNFLGSFFDFVLCNILAEVIKGMIPNNGEVIFSGILNSQKILINNLKRKNWACIS
>Prochlorococcus_marinus_str_MIT_9301|||NC_009091:c1304826-1305734
DWYKLTDSEEIIIWKLELGIFSFSFNIWLPSSRSSFEIKQEDWLTSWKKYWAPELVGNHFLILPCWINLNKDKQIIKIDPGAAFGTGSHPSTYLCLEKMENKVLDIGSGSGILSVAARLLGAKEVCAVDNDYLAINSTSNFQLNFLGSFFDFVLCNILAEVIKGMIPNNGEVIFSGILNSQKILIHDLKRKDWACIS
>Prochlorococcus_marinus_str_MIT_9303|||NC_008820:513499-514401
CWWRLAELEESLIWKLELGISRIAVLAWLPSDRDQLMVADEDWSLNWKQHWQSDPVGQRLLILPAWLDLPQDRLVVRMDPGSAFGTGSHPSTRLCLEALEKRVADLGCGSGVLGFAALGFGARQVLAADTDSQAVCASANAELNQHGSVVDLLLCNILAPVIEALASSNGRCLLSGLLVDQAVLELGWRQGCWGLLD
>Prochlorococcus_marinus_str_MIT_9312|||NC_007577:c1362362-1363270
DWYKLNDLEEIIIWKLELGIFSFSFNIWLPSSRSDFEIKEEDWLTSWKKYWAPELVGNHFLILPCWINLNEDKQIIKIDPGAAFGTGSHPSTYLCLEKMEKKVLDIGSGSGILSIAARLLGAKEVCAIDNDYLAINSTSNFQLNFLGSFIDFVVCNILAEVIKEMIPNNGEVIFSGILNSQKILINNLKRKDWACIY
>Prochlorococcus_marinus_str_MIT_9313|||NC_005071:c1518116-1519018
RWWRLSELEESLIWKLDLGLCRLAVLAWLPSDRDQLMVADEDWSLNWKQDWQPDPVGQRLLILPAWLDLPQDRFVVRLDPGSAFGTGSHPSTRLCLEALERRVADLGCGSGVLGFAALAFGARQVLAADTDCQAVCASANTELNQHGSVVDLLLCNILAPVIEVLAPSNGRGLLSGLLVKQAVLELGWRQGCWGLLD
>Prochlorococcus_marinus_str_MIT_9515|||NC_008817:c1347454-1348353
YWYKLTNLEEIIIWKLELGISSYALLIWLPSLRIKLEIEQEDWMSSWKKYWGPELVGKKLLVLPCWLELPENKKVIKIDPGAAFGTGSHPTTSLCLEELEKKILDIGSGSGILSIAARYFGASKVYSIDNDYLAINSTSNFRLNFLGRFFDLILCNILAEVIKGIIPDNGEVIFSGILNSQKLLNSNLQKQGWVCIT
>Prochlorococcus_marinus_str_NATL1A|||NC_008819:c1460594-1461526
SWLRLEELEDSFYWLLKLDIHRFSFFIWLPRDQEILVVKDEDWSLSWKKNWKPDPVGKSILILPAWLDVPEERKIIRLDPGSAFGTGSHPSTRLCLEALDNTIADIGCGSGILSLTALKLGAKSTFSVDTDSLSISATINSALNDLGSIIDLILCNILAPVIKLLGPSKGKVILSGLLVQQIFFLLGWQKDQWALMV
>Prochlorococcus_marinus_str_NATL2A|||NC_007335:c1426088-1427020
SWLRLEELEDSFYWLLKLDIHRFSFFIWLPRDQEILVVKDEDWSLSWKKNWKPDPVGKSILILPAWLDVPEERKIIRLDPGSAFGTGSHPSTRLCLEALDNTIADIGCGSGILSLTALKLGAKSTFSVDTDSLSISATINSALNDLGSIIDLILCNILAPVIKLLGPSKGKVILSGLLVQQIFFLLGWQKDQWALMV
>Prochlorococcus_marinus_subsp_marinus_str_CCMP1375|||NC_005042:c1333189-1334100
FWWKFEDVEESFLWFLMAGIKSYAIMVWLPKDREEFEIIDEDWSSSWKKFWKADPVGSKILILPSWLELPDNRIVIKLDPGSAFGTGSHPTTRLCLEDLERKVVDIGCGSGVLGIAAIKLGAKEVRAIDIDSLAVRATENIVLNNLGSIADLLICNTLSPVIKELAPYYSRLCLSGLLVAQVFLSLGWESDNWALIR
>Prochlorococcus_marinus_subsp_pastoris_str_CCMP1986|||NC_005072:c1302244-1303143
NWYELTNLEEIIIWKLELGISSYAFIIWLPSLRIKLVIEQEDWISSWKKYWGPEIVGDNLLILPCWLELPENKKVIKIDPGAAFGTGSHPTTSLCLEELEKKILDIGSGSGILSIAARSFGASKIYSIDNDYLAINSTSNFRLNFLGSFFDFILCNILAEVIKGIIPDDGEVILSGILNSQKLLKSNLRKKDWVCIT
>Synechococcus_elongatus_PCC_6301|||NC_006576:c2646407-2647303
SWWQVELLEDLLYWRLEAGGRGFVCHSYFPTIRDRLLLDEEDWSESWKRHWQPQELGDRFLIQPAWLEP-EDRLLLQLDPGTAFGTGAHPTTQLCLEGLETVIADVGCGSGILAIGALLLGAKQVYAVDTDPLAVGATANAALNDIGSAFDGFLCNILAHIIQALTPTGSWAIFSGLLTSQATLEYGWVQGDWCRLV
>Synechococcus_elongatus_PCC_7942|||NC_007604:c1549182-1550078
SWWQVELLEDLLYWRLEAGGRGFVCHSYFPTIRDRLLLDEEDWSESWKRHWQPQELGDRFLIQPAWLEP-EDRLLLQLDPGTAFGTGAHPTTQLCLEGLETVIADVGCGSGILAIGALLLGAKQVYAVDTDPLAVGATANAALNDIGSAFDGFLCNILAHIIQALTPTGSWAIFSGLLTSQATLEYGWVQGDWCRLV
>Synechococcus_sp_BL107|||NZ_AATZ01000001:c751918-752802
MWWRLSELEESLVWKLDLGLHRFAVLVWLPAEREQLLVADEDWSLSWKQHWQPDPVGQRLLILPAWLDVPSDRLVIRMDPGSAFGTGSHPTTRLCLEALEALVADLGCGSGVLGLASLSLGADAVLAADTDSLAIRATGNRSLNHLGSVADLLLCNILAPVIEALSPGQGRALLSGLLVDQAVLAHGWQQGRWGLLE
>Synechococcus_sp_CC9311|||NC_008319:c1980683-1981567
MWWRLSVLEESLLWKLSLGLHRLAVLAWLPDQRKQLLLADEDWSLSWKKHWQPDPVGQRLLILPAWLEVPEHRLVLKMDPGSAFGTGSHPTTRLCLEALEARVADLGCGSGVLGLASLALGADEVLAADTDSLAVRATDNAALNGHGSIADLLLCNILAPVIEALAPQNGRGLLSGLLLDQAVLACGWQQGRWGLLE
>Synechococcus_sp_CC9605|||NC_007516:c1967459-1968343
MWWRLTELEESLVWKLDLGLHRHAVLVWLPPQRQELVVADEDWSLSWKQHWQADPVGTGLLILPAWLEVPPDRLVIKMDPGSAFGTGSHPTTRLCLKALEQLVADLGCGSGVLGLAALGLGAESVVAADTDSLAVRATDNRGLNGLGSVADLLLCNILAPVIEALSPGDGCALLSGLLVDQAVLGLGWLQGRWGLLE
>Synechococcus_sp_CC9902|||NC_007513:539256-540140
MWWRLSELEESLAWKLDLGLHRFALLVWLPAEREQLLVADEDWSLSWKQHWQPDPVGQRLLILPAWLDVPEDRLVIRMDPGSAFGTGSHPTTRLCLEALEALVADLGCGSGVLGLASLCLGADAVLAADTDSLAIRATGNRSLNRLGSVADLLLCNILAPVIEALSPGNGRALLSGLLVDQAVLAQGWQQGRWGLLE
>Synechococcus_sp_JA_2_3Ba_2_13_|||NC_007776:c714110-715048
AWWDISAQEDLIFWRLNFGCRGMTSHAYLPLDLAALSIEAEDWSSSWKQHWQPQPIGDKLLICPAWLDPPPGRHLLRLDPGMAFGTGTHPTTQLCLESLEMTLADVGCGSGILSLAAALLGVKRVFAVDIDPLAVQATHNRDLNGQGSLVDGLVCNILADVILDMIPEGGWLILSGILIEQAMLENEWVRGEWCCLN
>Synechococcus_sp_JA_3_3Ab|||NC_007775:2502681-2503610
AWWALNAQEDQIFWRLSFGCQGMASHAYLPLDLAALAIEAEDWSNSWKQHWQPEPVGDKLLICPAWLDPPPGRLLLRLDPGMAFGTGTHPTTQLCLEALEMTVADVGCGSGILSVAAALLGAKRVFAVDIDPLAVQATHNRDLNGQGSLVDGLVCNILTDVILDMIPEGGWLILSGILLEQAMLENEWARGEWCCLN
>Synechococcus_sp_PCC_7002|||NC_010475:1287177-1288064
TWWELQSLEETIFWRLDFGCRGMAGRAYSPLDLAALAIDEEDWSSSWKSHWQPEEIGDRLLIYPAWLEVPTERLLLRLDPGSAFGTGAHQTTQLCLEALEMVIADIGCGSGILSIGSLLLGAKQTFGVDTDILAVTASSNRALNNQGSIFDGIVCNILAEIIIELIPKDTWGILSGILIEQITLENGWAKDEWCCFN
>Synechococcus_sp_PCC_7335|||NZ_ABRV01000015:c80145-81116
QWWEVVTLEESVYWYFQLESKGTASKAYLLETLETLRIAEEDWSSSWKVHWQPEEVGDRLLINPAWMEP-PDRTILTLDPGSAFGTGAHATTQLCLKALEEVIADIGCGSGILSIVSLLYGAKQVYAADVDPLAIRASDNANLNDLGSVVDGIVCNILSEIIVGLIPRHTWGILCGILTSKAHLTRGWQQDEWCAMT
>Synechococcus_sp_RCC307|||NC_009482:c1605020-1605922
SWWRLEELEESLLWRLSLGVHRLAVQAWLPPERVALAQPEEDWALSWKRHWQPDPVGQRLLILPAWLQVPAERLALLIDPGSAFGTGSHPTTRLCLEALEKRVADLGCGSGILGIASLVLGAREVLASDTDSLAVRATENAALNQLGSAADLLLCNILAPVLTALTPARGEGLLSGLLVDQAHLEHGWRQGRWALLA
>Synechococcus_sp_RS9916|||NZ_AAUA01000001:c598364-599275
RWWRLSELEESLLWKLSLGLHRLAVLAWLPDQRRELVLDDEDWSLTWKQHWQADPVGQRLLILPAWLEAPQHRLVLRMDPGSAFGTGSHPTTRLCLEALEATVADLGCGSGVLSLAALALGAERVLAADTDSLAERATDNAGLNGQGSVSELLLCNILAPVIEALSPQGGRGLLSGLLVEQAVLELGWSQGRWGLLE
>Synechococcus_sp_RS9917|||NZ_AANP01000002:21745-22656
RWWRLSELEESLLWKLSLGLQRVSVHLWLPPERVALLLDDEDWSLTWKQHWEPDPVGATLLILPAWLEPPAHRLVLRMDPGSAFGTGSHPTTRLCLEALEQRVADLGCGSGILGLAALAMGARTVCAVDTDSLAVRATENARLGAQGSAADLLLCNILAPVLEALAPASGRGLLSGLLLEQAVLELGWQQGRWGLLE
>Synechococcus_sp_WH_5701|||NZ_AANO01000002:c168935-169873
RWWRLEELEESLLWKLSLGIRRVAIVAWLPPERQRLAQDEEDWSLSWKRHWQPDPVGERLLILPAWLEPPEGREQIRIDPGSAFGTGSHPTTRLCLEAMERRVADLGCGSGILGLGALRLGARCVAAADTDPLAVRATSNGELNGQGSAADLLLCNILAPVIAELAGQGGLGLLSGLLVDQALLAEGWSQGVWGLLE
>Synechococcus_sp_WH_7803|||NC_009481:c1812212-1813102
MWWRLSELEESLLWKLAMGLHRVAVLAWLPDQRLELILADEDWSRSWKQHWQPDPVGKGLLILPAWLSVPEQRLVLKMDPGSAFGTGSHPTTRLCLEALEARVADLGCGSGVLGLAALGLGAREVMAVDTDSLAVRATENASLNGQGSLSDLLLCNILAPVIEALAPGQGRGLLSGLLVEQAVLELGWSQGRWGLLE
>Synechococcus_sp_WH_7805|||NZ_AAOK01000001:305936-306826
MWWRLSELEESLLWKLAMGLHRVAVLAWLPDQRLQLILADEDWSRSWKQHWQPDPVGNELLILPAWLSVPKQRLVLKMDPGSAFGTGSHPTTRLCLEALEARVADLGCGSGVLGLAALGLGAHEVIAVDTDSLAVRATDNAALNGQGSLADLLLCNILAPVIEALAPGNGRGLLSGLLVEQAVLELGWSQGRWGLLE
>Synechococcus_sp_WH_8102|||NC_005070:527909-528793
MWWRLTELEESLVWKLDLGLHRHAVLLWLPAERQQLLVADEDWSLSWKQHWQPDPVGEGLLILPAWLEVPPERLVIRMDPGSAFGTGSHPTTRLCLEALEKLVADLGCGSGVLGLAALGLGATAVVAADTDSLAVRATDNRELNGLGSVADLLLCNILAPVIEALAPGEGRALLSGLLVDQAVLGLGWRQGRWGLLE
>Synechococcus_sp_WH_8109|||NZ_ACNY01000004:9874-10833
MWWRLTELEESLVWKLDLGLHRHAVLVWLPPQRQELIVADEDWSLSWKQHWQADPVGTGLLILPAWLEVPPDRLVIKMDPGSAFGTGSHPTTRLCLEALEQLVADLGCGSGVLGLAALGLGAESVVAADTDSLAVRATDNRSLNDLGSVVDLLLCNILAPVIEALSPGDGRALLSGLLVDQAVLGLGWLQGRWGLLE
>Synechocystis_sp_PCC_6803|||NC_000911:c1431999-1432898
SWWEIRSLEETAFWRLKFGCLGTSTRGYLPLDLAALAIDEEDWSISWKEHWQPTPVGDRFIIYPAWIDPPEDRLILRLDPGVAFGTGTHATTQLCLESLEMVLADLGCGSGILGIGAVLLGAAKVYGVDNDPLTVESAHNRHLNQEGSVVDGIICNILAEVIVDLLPQHGWAILSGIMVEQSALENGWTRQEWCCFQ
>Thermosynechococcus_elongatus_BP_1|||NC_004113:314932-315828
RWWEITEAEELVYWRLSFGCQGTATQGYVPLDIAALGVNEQDWAHSWQAYWHPIPVGDRLLICPAWEMPPLTRLVIKLDPGMAFGTGTHETTQLCLEALEMVIADIGCGSGILAIASLLLGAQKAYAVDTSDLAVTATRNAELNGQGSWVDGVVCNILAPVIIEILPHKGWGIFSGILLDQAQLKQGWSRNEWCCLN
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
########################################################################################################
BMGE: Block Mapping and Gathering with Entropy
Copyright (C) 2010-2022 Institut Pasteur
This file is part of BMGE.
BMGE is free software: you can redistribute it and/or modify it under the terms of the GNU General
Public License as published by the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
BMGE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see
<http://www.gnu.org/licenses/>.
Contact:
Alexis Criscuolo alexis.criscuolo@pasteur.fr
Genome Informatics & Phylogenetics (GIPhy) giphy.pasteur.fr
Bioinformatics and Biostatistics Hub research.pasteur.fr/team/hub-giphy
Institut Pasteur, Paris, FRANCE research.pasteur.fr/team/bioinformatics-and-biostatistics-hub
Simonetta Gribaldo simonetta.gribaldo@pasteur.fr
Evolutionary Biology of the Microbial Cell https://research.pasteur.fr/en/b/6jQ
Institut Pasteur, Paris, FRANCE https://research.pasteur.fr
########################################################################################################
*/
package bmge;
import java.util.Arrays;
/*
NOTE:
This class is a complete rewriting of the class EigenvalueDecomposition from the package JAMA.
+ JAMA: https://math.nist.gov/javanumerics/jama/
+ EigenvalueDecomposition: https://math.nist.gov/javanumerics/jama/doc/Jama/EigenvalueDecomposition.html
*/
public class Eigen {
//## constants
private final double EPS = Math.pow(2.0,-52.0);
//## data
private int n; //## NOTE: size
private int n_1; //## NOTE: size-1
private boolean issymmetric; //## NOTE: true if symmetric
private double[] d, e; //## NOTE: eigenvalues
private double[][] V; //## NOTE: eigenvectors
private double[][] inV; //## NOTE: inverse eigenvectors
//## stuffs
private int i, i_1, i1, j, k, l, m, nn, iter;
private double c, c2, c3, f, g, h, p, q, r, s, s2, t, w, x, y, z;
private double dl1, el1, exshift, hh, norm, scale, tst1, ra, sa, vr, vi;
private boolean notlast;
private double[][] H;
private double[] ort;
public Eigen (final double[][] mat) {
n_1 = n = mat.length;
--n_1;
V = new double[n][n];
inV = new double[n][n];
d = new double[n];
e = new double[n];
issymmetric = true;
i = n; while ( issymmetric && (j=--i) >= 0 ) while ( issymmetric && --j >= 0 ) issymmetric = ( mat[i][j] == mat[j][i] );
if ( issymmetric ) {
i = n; while ( --i >= 0 ) System.arraycopy(mat[i], 0, V[i], 0, n);
tred2(); //## tridiagonalizing
tql2(); //## diagonalizing
}
else {
H = new double[n][n];
ort = new double[n];
i = n; while ( --i >= 0 ) System.arraycopy(mat[i], 0, H[i], 0, n);
orthes(); //## reducing to Hessenberg form.
hqr2(); //## reducing Hessenberg to real Schur form.
}
inv(); //## inverting V
}
//## returns the eigenvector matrix
public double[][] getEigenvectors () { return Arrays.copyOf(V, n); }
//## returns the inverse eigenvector matrix
public double[][] getInvEigenvectors () { return Arrays.copyOf(inV, n); }
//## returns the real parts of the eigenvalues
public double[] getRealEigenvalues () { return Arrays.copyOf(d, n); }
//## returns the imaginary parts of the eigenvalues
public double[] getImagEigenvalues () { return Arrays.copyOf(e, n); }
//## returns x*x
private static double square(final double x) { return x*x; }
//## returns sqrt(a^2 + b^2) without under/overflow.
private static double hypot(final double a, final double b) { return ( Math.abs(a) > Math.abs(b) ) ? Math.abs(a) * Math.sqrt(1+square(b/a)) : ( b != 0 ) ? Math.abs(b) * Math.sqrt(1+square(a/b)) : 0; }
//## Symmetric Householder reduction to tridiagonal form.
private void tred2 () {
j = n; while ( --j >= 0 ) d[j] = V[n_1][j];
i = n;
while ( --i > 0 ) {
// Scale to avoid under/overflow.
i_1 = i; --i_1; scale = h = 0;
k = i; while ( --k >= 0 ) scale += Math.abs(d[k]);
if ( scale == 0.0 ) {
e[i] = d[i_1];
j = i; while ( --j >= 0 ) { d[j] = V[i_1][j]; V[i][j] = 0.0; V[j][i] = 0.0; }
}
else {
// Generate Householder vector.
k = i; while ( --k >= 0 ) { d[k] /= scale; h += square(d[k]); }
f = d[i_1];
g = ( f > 0 ) ? -Math.sqrt(h) : Math.sqrt(h);
e[i] = scale * g;
h -= f * g;
d[i_1] = f - g;
j = i; while ( --j >= 0 ) e[j] = 0.0;
// Apply similarity transformation to remaining columns.
j = -1;
while ( ++j < i ) {
V[j][i] = f = d[j];
g = e[j] + V[j][j] * f;
k = j; while ( ++k <= i_1 ) { g += V[k][j] * d[k]; e[k] += V[k][j] * f; }
e[j] = g;
}
f = 0; j = i; while ( --j >= 0 ) { e[j] /= h; f += e[j] * d[j]; }
hh = f / (2*h);
j = i; while ( --j >= 0 ) e[j] -= hh * d[j];
j = -1;
while ( ++j < i ) {
f = d[j]; g = e[j];
k = i; while ( --k >= j ) V[k][j] -= (f * e[k] + g * d[k]);
d[j] = V[i_1][j]; V[i][j] = 0;
}
}
d[i] = h;
}
// Accumulate transformations
i = n_1;
while ( --i >= 0 ) {
V[n_1][i] = V[i][i];
V[i][i] = 1;
i1 = i+1;
if ( (h=d[(i1)]) != 0.0 ) {
k = i1; while ( --k >= 0 ) d[k] = V[k][i1] / h;
j = i1;
while ( --j >= 0 ) {
g = 0;
k = i1; while ( --k >= 0 ) g += V[k][i1] * V[k][j];
i = i1; while ( --k >= 0 ) V[k][j] -= g * d[k];
}
}
k = i1; while ( --k >= 0 ) V[k][i1] = 0;
}
j = n; while ( --j >= 0 ) { d[j] = V[n_1][j]; V[n_1][j] = 0; }
V[n_1][n_1] = 1;
e[0] = 0.0;
}
//## Symmetric tridiagonal QL algorithm.
private void tql2 () {
i = n; while ( --i > 0 ) e[i-1] = e[i];
e[n_1] = 0.0;
f = tst1 = 0;
l = n;
while ( --l >= 0 ) {
// Find small subdiagonal element
tst1 = Math.max(tst1, Math.abs(d[l])+Math.abs(e[l]));
m = l; while ( m < n && Math.abs(e[m]) > EPS*tst1 ) ++m;
// If m == l, d[l] is an eigenvalue, otherwise, iterate.
if ( m > l) {
iter = 0;
do {
++iter;
// Compute implicit shift
g = d[l];
p = (d[l+1] - g) / (2.0 * e[l]);
r = ( p < 0 ) ? -hypot(p, 1.0) : hypot(p, 1.0);
d[l] = e[l] / (p + r);
d[l+1] = e[l] * (p + r);
h = g - d[l];
dl1 = d[i=(l+1)];
while ( ++i < n ) d[i] -= h;
f = f + h;
// Implicit QL transformation
p = d[m];
c = 1.0;
c2 = c3 = c;
el1 = e[l+1];
s = s2 = 0.0;
i = m;
while ( --i >= l ) {
c3 = c2;
c2 = c;
s2 = s;
g = c * e[i];
h = c * p;
r = hypot(p, e[i]);
e[i+1] = s * r;
s = e[i] / r;
c = p / r;
p = c * d[i] - s * g;
d[i+1] = h + s * (c * g + s * d[i]);
// Accumulate transformation
i1 = i+1;
k = n; while ( --k >= 0 ) { h = V[k][i1]; V[k][i1] = s * V[k][i] + c * h; V[k][i] = c * V[k][i] - s * h; }
}
p = -s * s2 * c3 * el1 * e[l] / dl1;
e[l] = s * p;
d[l] = c * p;
} while ( Math.abs(e[l]) > EPS*tst1 );
}
d[l] = d[l] + f;
e[l] = 0;
}
// Sort eigenvalues and corresponding vectors
i = n;
while ( --i >= 0 ) {
p = d[j=k=i];
while ( ++j < n ) if ( d[j] < p ) { k = j; p = d[j]; }
if ( k != i ) {
d[k] = d[i];
d[i] = p;
j = n; while ( --j >= 0 ) { p = V[j][i]; V[j][i] = V[j][k]; V[j][k] = p; }
}
}
}
//## Nonsymmetric reduction to Hessenberg form.
private void orthes () {
final int low = 0, low1 = low+1, high = n_1, high1 = high+1;
m = low;
while ( ++m < high ) {
// Scale column.
scale = 0.0;
i = m; --i; while ( ++i <= high ) scale += Math.abs(H[i][m-1]);
if ( scale != 0.0 ) {
// Compute Householder transformation.
h = 0.0; i = high1; while (--i >= m ) h += square((ort[i]=H[i][m-1]/scale));
g = ( ort[m] > 0 ) ? -Math.sqrt(h) : Math.sqrt(h);
h -= ort[m] * g;
ort[m] -= g;
// Apply Householder similarity transformation: H = (I-u*u'/h)*H*(I-u*u')/h)
j = m; --j;
while ( ++j < n ) {
f = 0.0; i = high; ++i; while ( --i >= m ) f += ort[i]*H[i][j];
f /= h; i = m; --i; while ( ++i <= high ) H[i][j] -= f*ort[i];
}
i = high1;
while ( --i >= 0 ) {
f = 0.0; j = high1; while ( --j >= m ) f += ort[j]*H[i][j];
f /= h; j = high1; while ( --j >= m ) H[i][j] -= f*ort[j];
}
ort[m] = scale * ort[m];
H[m][m-1] = scale*g;
}
}
// Accumulate transformations (Algol's ortran).
i = n; while ( --i >= 0 ) V[i][i] = 1.0;
m = high;
while ( --m >= low1 )
if ( H[m][m-1] != 0.0 ) {
i = m; while ( ++i <= high ) ort[i] = H[i][m-1];
j = m; --j;
while ( ++j <= high ) {
g = 0; i = high1; while ( --i >= m ) g += ort[i] * V[i][j];
g = (g / ort[m]) / H[m][m-1]; i = high1; while ( --i >= m ) V[i][j] += g * ort[i];
}
}