// printHelp();
// System.exit( 0 );
// }
+
+ if ( realign ) {
+ if ( ForesterUtil.isEmpty( path_to_mafft ) ) {
+ path_to_mafft = MsaCompactor.guessPathToMafft();
+ }
+ checkPathToMafft( path_to_mafft );
+ }
+
+
Msa msa = null;
final FileInputStream is = new FileInputStream( in );
if ( FastaParser.isLikelyFasta( in ) ) {
msa = GeneralMsaParser.parse( is );
}
- if ( realign ) {
- if ( ForesterUtil.isEmpty( path_to_mafft ) ) {
- path_to_mafft = MsaCompactor.guessPathToMafft();
- }
- checkPathToMafft( path_to_mafft );
- }
+
MsaCompactor mc = null;
if ( worst_remove > 0 ) {
- mc = MsaCompactor.removeWorstOffenders( msa, worst_remove, realign, norm );
+ mc = MsaCompactor.removeWorstOffenders( msa, worst_remove, realign, norm, path_to_mafft );
}
else if ( av > 0 ) {
- mc = MsaCompactor.reduceGapAverage( msa, av, step, realign, out, 50 );
+ mc = MsaCompactor.reduceGapAverage( msa, av, step, realign, out, 50, path_to_mafft );
}
else if ( length > 0 ) {
- mc = MsaCompactor.reduceLength( msa, length, step, realign );
+ mc = MsaCompactor.reduceLength( msa, length, step, realign, path_to_mafft );
}
System.out.println( MsaMethods.calcGapRatio( mc.getMsa() ) );
for( final String id : mc.getRemovedSeqIds() ) {
private static final boolean VERBOSE = true;
private Msa _msa;
private final SortedSet<String> _removed_seq_ids;
+ private String _path_to_mafft;
static {
NF_4.setRoundingMode( RoundingMode.HALF_UP );
NF_3.setRoundingMode( RoundingMode.HALF_UP );
final private void mafft() throws IOException, InterruptedException {
+ // final MsaInferrer mafft = Mafft
+ // .createInstance( "/home/czmasek/SOFTWARE/MSA/MAFFT/mafft-7.130-without-extensions/scripts/mafft" );
+
final MsaInferrer mafft = Mafft
- .createInstance( "/home/czmasek/SOFTWARE/MSA/MAFFT/mafft-7.130-without-extensions/scripts/mafft" );
+ .createInstance( _path_to_mafft );
+
+
final List<String> opts = new ArrayList<String>();
opts.add( "--maxiterate" );
opts.add( "1000" );
final int step,
final boolean realign,
final File out,
- final int minimal_effective_length ) throws IOException,
+ final int minimal_effective_length,
+ final String path_to_mafft ) throws IOException,
InterruptedException {
final MsaCompactor mc = new MsaCompactor( msa );
+ if ( realign) {
+ mc.setPathToMafft( path_to_mafft );
+ }
mc.removeViaGapAverage( max_gap_average, step, realign, out, minimal_effective_length );
return mc;
}
public final static MsaCompactor reduceLength( final Msa msa,
final int length,
final int step,
- final boolean realign ) throws IOException, InterruptedException {
+ final boolean realign,
+ final String path_to_mafft ) throws IOException, InterruptedException {
final MsaCompactor mc = new MsaCompactor( msa );
+ if ( realign) {
+ mc.setPathToMafft( path_to_mafft );
+ }
mc.removeViaLength( length, step, realign );
return mc;
}
public final static MsaCompactor removeWorstOffenders( final Msa msa,
final int worst_offenders_to_remove,
final boolean realign,
- final boolean norm ) throws IOException,
+ final boolean norm,
+ final String path_to_mafft ) throws IOException,
InterruptedException {
final MsaCompactor mc = new MsaCompactor( msa );
+ if ( realign) {
+ mc.setPathToMafft( path_to_mafft );
+ }
mc.removeWorstOffenders( worst_offenders_to_remove, 1, realign, norm );
return mc;
}
+
+ private void setPathToMafft( final String path_to_mafft ) {
+ _path_to_mafft = path_to_mafft;
+
+ }
}