+ public final void removeSequencesByMinimalLength( final int min_effective_length ) {
+ printMsaProperties( "", new MsaProperties( _msa, "", _report_aln_mean_identity ) );
+ System.out.println();
+ _msa = DeleteableMsa.createInstance( MsaMethods.removeSequencesByMinimalLength( _msa, min_effective_length ) );
+ removeGapColumns();
+ printMsaProperties( "", new MsaProperties( _msa, "", _report_aln_mean_identity ) );
+ System.out.println();
+ }
+
+ public final List<MsaProperties> removeViaGapAverage( final double mean_gapiness ) throws IOException,
+ InterruptedException {
+ final GapContribution stats[] = calcGapContribtionsStats( _norm );
+ final List<String> to_remove_ids = new ArrayList<String>();
+ final List<MsaProperties> msa_props = new ArrayList<MsaProperties>();
+ for( final GapContribution gap_gontribution : stats ) {
+ to_remove_ids.add( gap_gontribution.getId() );
+ }
+ printTableHeader();
+ MsaProperties msa_prop = new MsaProperties( _msa, "", _report_aln_mean_identity );
+ msa_props.add( msa_prop );
+ printMsaProperties( "", msa_prop );
+ System.out.println();
+ int i = 0;
+ while ( MsaMethods.calcGapRatio( _msa ) > mean_gapiness ) {
+ final String id = to_remove_ids.get( i );
+ _removed_seq_ids.add( id );
+ final Sequence deleted = _msa.deleteRow( id, true );
+ _removed_seqs.add( deleted );
+ removeGapColumns();
+ if ( isPrintMsaStatsWriteOutfileAndRealign( i ) || ( MsaMethods.calcGapRatio( _msa ) <= mean_gapiness ) ) {
+ msa_prop = printMsaStatsWriteOutfileAndRealign( _realign, id );
+ msa_props.add( msa_prop );
+ System.out.println();
+ }
+ else if ( isPrintMsaStats( i ) ) {
+ msa_prop = new MsaProperties( _msa, id, _report_aln_mean_identity );
+ msa_props.add( msa_prop );
+ printMsaProperties( id, msa_prop );
+ System.out.println();
+ }
+ ++i;
+ }
+ if ( _removed_seqs_out_base != null ) {
+ final String msg = writeAndAlignRemovedSeqs();
+ System.out.println();
+ System.out.println( msg );
+ }
+ return msa_props;
+ }
+
+ public List<MsaProperties> removeViaLength( final int length ) throws IOException, InterruptedException {
+ final GapContribution stats[] = calcGapContribtionsStats( _norm );
+ final List<String> to_remove_ids = new ArrayList<String>();
+ final List<MsaProperties> msa_props = new ArrayList<MsaProperties>();
+ for( final GapContribution gap_gontribution : stats ) {
+ to_remove_ids.add( gap_gontribution.getId() );
+ }
+ printTableHeader();
+ MsaProperties msa_prop = new MsaProperties( _msa, "", _report_aln_mean_identity );
+ msa_props.add( msa_prop );
+ printMsaProperties( "", msa_prop );
+ System.out.println();
+ int i = 0;
+ while ( _msa.getLength() > length ) {
+ final String id = to_remove_ids.get( i );
+ _removed_seq_ids.add( id );
+ final Sequence deleted = _msa.deleteRow( id, true );
+ _removed_seqs.add( deleted );
+ removeGapColumns();
+ if ( isPrintMsaStatsWriteOutfileAndRealign( i ) || ( _msa.getLength() <= length ) ) {
+ msa_prop = printMsaStatsWriteOutfileAndRealign( _realign, id );
+ msa_props.add( msa_prop );
+ System.out.println();
+ }
+ else if ( isPrintMsaStats( i ) ) {
+ msa_prop = new MsaProperties( _msa, id, _report_aln_mean_identity );
+ printMsaProperties( id, msa_prop );
+ msa_props.add( msa_prop );
+ System.out.println();
+ }
+ ++i;
+ }
+ if ( _removed_seqs_out_base != null ) {
+ final String msg = writeAndAlignRemovedSeqs();
+ System.out.println();
+ System.out.println( msg );
+ }
+ return msa_props;
+ }
+
+ public final List<MsaProperties> removeWorstOffenders( final int to_remove ) throws IOException,
+ InterruptedException {
+ final GapContribution stats[] = calcGapContribtionsStats( _norm );
+ final List<String> to_remove_ids = new ArrayList<String>();
+ final List<MsaProperties> msa_props = new ArrayList<MsaProperties>();
+ for( int j = 0; j < to_remove; ++j ) {
+ to_remove_ids.add( stats[ j ].getId() );
+ _removed_seq_ids.add( stats[ j ].getId() );
+ }
+ printTableHeader();
+ MsaProperties msa_prop = new MsaProperties( _msa, "", _report_aln_mean_identity );
+ msa_props.add( msa_prop );
+ printMsaProperties( "", msa_prop );
+ System.out.println();
+ for( int i = 0; i < to_remove_ids.size(); ++i ) {
+ final String id = to_remove_ids.get( i );
+ _removed_seq_ids.add( id );
+ final Sequence deleted = _msa.deleteRow( id, true );
+ _removed_seqs.add( deleted );
+ removeGapColumns();
+ if ( isPrintMsaStatsWriteOutfileAndRealign( i ) || ( i == ( to_remove_ids.size() - 1 ) ) ) {
+ msa_prop = printMsaStatsWriteOutfileAndRealign( _realign, id );
+ msa_props.add( msa_prop );
+ System.out.println();
+ }
+ else if ( isPrintMsaStats( i ) ) {
+ msa_prop = new MsaProperties( _msa, id, _report_aln_mean_identity );
+ msa_props.add( msa_prop );
+ printMsaProperties( id, msa_prop );
+ System.out.println();
+ }
+ }
+ if ( _removed_seqs_out_base != null ) {
+ final String msg = writeAndAlignRemovedSeqs();
+ System.out.println();
+ System.out.println( msg );
+ }
+ return msa_props;
+ }
+
+ public final void setGapRatio( final double gap_ratio ) {
+ _gap_ratio = gap_ratio;
+ }
+
+ public final void setMafftOptions( final String maffts_opts ) {
+ _maffts_opts = maffts_opts;
+ }
+
+ public final void setMinLength( final int min_length ) {
+ _min_length = min_length;
+ }
+
+ public final void setNorm( final boolean norm ) {
+ _norm = norm;
+ }
+