X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fapplication%2Fmcc.java;h=23320fc8210667a6304644f1179fe97c5453e6bb;hb=eb38568d7687f10934bef10881474845946777dc;hp=e31679a8652f8a0ff6cd5e38ae3fd016779baf7b;hpb=8e37534c03f75befdad0d75fbf8e05be11cde71a;p=jalview.git diff --git a/forester/java/src/org/forester/application/mcc.java b/forester/java/src/org/forester/application/mcc.java index e31679a..23320fc 100644 --- a/forester/java/src/org/forester/application/mcc.java +++ b/forester/java/src/org/forester/application/mcc.java @@ -21,13 +21,15 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA // // Contact: phylosoft @ gmail . com -// WWW: www.phylosoft.org/forester +// WWW: https://sites.google.com/site/cmzmasek/home/software/forester package org.forester.application; import java.io.File; import java.io.FileInputStream; +import java.io.InputStream; +import org.forester.io.parsers.FastaParser; import org.forester.io.parsers.GeneralMsaParser; import org.forester.msa.Msa; import org.forester.msa.MsaMethods; @@ -76,7 +78,13 @@ public class mcc { System.exit( 0 ); } Msa msa = null; - msa = GeneralMsaParser.parse( new FileInputStream( in ) ); + final InputStream is = new FileInputStream( in ); + if ( FastaParser.isLikelyFasta( in ) ) { + msa = FastaParser.parseMsa( is ); + } + else { + msa = GeneralMsaParser.parse( is ); + } if ( cla.isOptionSet( FROM_OPTION ) ) { singleCalc( in, from, to, msa ); } @@ -90,7 +98,13 @@ public class mcc { } private static void printHelp() { - ForesterUtil.printProgramInformation( PRG_NAME, PRG_DESC, PRG_VERSION, PRG_DATE, E_MAIL, WWW, ForesterUtil.getForesterLibraryInformation() ); + ForesterUtil.printProgramInformation( PRG_NAME, + PRG_DESC, + PRG_VERSION, + PRG_DATE, + E_MAIL, + WWW, + ForesterUtil.getForesterLibraryInformation() ); System.out.println( "Usage:" ); System.out.println(); System.out.println( PRG_NAME + " " ); @@ -115,15 +129,15 @@ public class mcc { step = 1; } final double id_ratios[] = new double[ msa.getLength() ]; - for( int i = 0; i <= msa.getLength() - 1; ++i ) { + for( int i = 0; i <= ( msa.getLength() - 1 ); ++i ) { id_ratios[ i ] = MsaMethods.calculateIdentityRatio( msa, i ); } String min_pos = ""; String max_pos = ""; double min = 1; double max = 0; - for( int i = 0; i <= msa.getLength() - 1; i += step ) { - int to = i + window - 1; + for( int i = 0; i <= ( msa.getLength() - 1 ); i += step ) { + int to = ( i + window ) - 1; if ( to > ( msa.getLength() - 1 ) ) { to = msa.getLength() - 1; }