From aca4346fe1218c6c5996b32e7f21480ea59a1094 Mon Sep 17 00:00:00 2001 From: Ben Blackburne Date: Wed, 11 Aug 2010 17:17:45 +0100 Subject: [PATCH] Clean up ReadTree --- src/main/scala/org/modiphy/tree/Tree.scala | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/scala/org/modiphy/tree/Tree.scala b/src/main/scala/org/modiphy/tree/Tree.scala index de45852..c0fe06f 100644 --- a/src/main/scala/org/modiphy/tree/Tree.scala +++ b/src/main/scala/org/modiphy/tree/Tree.scala @@ -55,6 +55,13 @@ object DataParse{ val seqMap = aln.foldLeft(Map[String,String]()){_+_} apply(tree,SimpleAlignment(seqMap,alphabet)) } + def fromFiles[A<:BioEnum](treeFile:String,alnFile:String,alphabet:A):(Tree[A],SimpleAlignment[A])={ + apply( + scala.io.Source.fromFile(treeFile).getLines().map{_.trim}.mkString(""), + scala.io.Source.fromFile(alnFile).getLines(), + alphabet + ) + } def apply[A <: BioEnum](tree:String,aln:SimpleAlignment[A]):(Tree[A],SimpleAlignment[A])={ @@ -121,11 +128,7 @@ trait Node[A <: BioEnum] extends Actor with Logging{ object ReadTree{ def fromFiles[A <: BioEnum](tree:String,aln:String,alphabet:A):Tree[A]={ - DataParse( - scala.io.Source.fromFile(tree).getLines().map{_.trim}.mkString(""), - scala.io.Source.fromFile(aln).getLines(), - alphabet - )._1 + DataParse.fromFiles( tree,aln,alphabet)._1 } } -- 2.11.4.GIT