| 1 | #include "muscle.h" |
|---|
| 2 | #include "textfile.h" |
|---|
| 3 | #include "seqvect.h" |
|---|
| 4 | #include "distfunc.h" |
|---|
| 5 | #include "msa.h" |
|---|
| 6 | #include "tree.h" |
|---|
| 7 | #include "clust.h" |
|---|
| 8 | #include "profile.h" |
|---|
| 9 | #include "clustsetmsa.h" |
|---|
| 10 | |
|---|
| 11 | void Refine() |
|---|
| 12 | { |
|---|
| 13 | SetOutputFileName(g_pstrOutFileName); |
|---|
| 14 | SetInputFileName(g_pstrInFileName); |
|---|
| 15 | SetStartTime(); |
|---|
| 16 | |
|---|
| 17 | SetMaxIters(g_uMaxIters); |
|---|
| 18 | SetSeqWeightMethod(g_SeqWeight1); |
|---|
| 19 | |
|---|
| 20 | TextFile fileIn(g_pstrInFileName); |
|---|
| 21 | MSA msa; |
|---|
| 22 | msa.FromFile(fileIn); |
|---|
| 23 | |
|---|
| 24 | const unsigned uSeqCount = msa.GetSeqCount(); |
|---|
| 25 | if (0 == uSeqCount) |
|---|
| 26 | Quit("No sequences in input file"); |
|---|
| 27 | |
|---|
| 28 | ALPHA Alpha = ALPHA_Undefined; |
|---|
| 29 | switch (g_SeqType) |
|---|
| 30 | { |
|---|
| 31 | case SEQTYPE_Auto: |
|---|
| 32 | Alpha = msa.GuessAlpha(); |
|---|
| 33 | break; |
|---|
| 34 | |
|---|
| 35 | case SEQTYPE_Protein: |
|---|
| 36 | Alpha = ALPHA_Amino; |
|---|
| 37 | break; |
|---|
| 38 | |
|---|
| 39 | case SEQTYPE_DNA: |
|---|
| 40 | Alpha = ALPHA_DNA; |
|---|
| 41 | break; |
|---|
| 42 | |
|---|
| 43 | case SEQTYPE_RNA: |
|---|
| 44 | Alpha = ALPHA_RNA; |
|---|
| 45 | break; |
|---|
| 46 | |
|---|
| 47 | default: |
|---|
| 48 | Quit("Invalid SeqType"); |
|---|
| 49 | } |
|---|
| 50 | SetAlpha(Alpha); |
|---|
| 51 | msa.FixAlpha(); |
|---|
| 52 | |
|---|
| 53 | SetPPScore(); |
|---|
| 54 | if (ALPHA_DNA == Alpha || ALPHA_RNA == Alpha) |
|---|
| 55 | SetPPScore(PPSCORE_SPN); |
|---|
| 56 | |
|---|
| 57 | MSA::SetIdCount(uSeqCount); |
|---|
| 58 | |
|---|
| 59 | // Initialize sequence ids. |
|---|
| 60 | // From this point on, ids must somehow propogate from here. |
|---|
| 61 | for (unsigned uSeqIndex = 0; uSeqIndex < uSeqCount; ++uSeqIndex) |
|---|
| 62 | msa.SetSeqId(uSeqIndex, uSeqIndex); |
|---|
| 63 | SetMuscleInputMSA(msa); |
|---|
| 64 | |
|---|
| 65 | Tree GuideTree; |
|---|
| 66 | TreeFromMSA(msa, GuideTree, g_Cluster2, g_Distance2, g_Root2); |
|---|
| 67 | SetMuscleTree(GuideTree); |
|---|
| 68 | |
|---|
| 69 | if (g_bAnchors) |
|---|
| 70 | RefineVert(msa, GuideTree, g_uMaxIters); |
|---|
| 71 | else |
|---|
| 72 | RefineHoriz(msa, GuideTree, g_uMaxIters, false, false); |
|---|
| 73 | |
|---|
| 74 | ValidateMuscleIds(msa); |
|---|
| 75 | ValidateMuscleIds(GuideTree); |
|---|
| 76 | |
|---|
| 77 | // TextFile fileOut(g_pstrOutFileName, true); |
|---|
| 78 | // msa.ToFile(fileOut); |
|---|
| 79 | MuscleOutput(msa); |
|---|
| 80 | } |
|---|