work for rrm project (ComPhy 2012 Moscow)
[jalview.git] / forester / java / src / org / forester / application / aa.java
index 6d7be4f..899120c 100644 (file)
@@ -3,6 +3,7 @@ package org.forester.application;
 
 import java.io.FileInputStream;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -10,6 +11,7 @@ import java.util.TreeSet;
 
 import org.forester.io.parsers.FastaParser;
 import org.forester.msa.Msa;
+import org.forester.sequence.BasicSequence;
 import org.forester.sequence.Sequence;
 import org.forester.util.ForesterUtil;
 
@@ -45,6 +47,12 @@ public class aa {
                     }
                 }
                 if ( found > 0 ) {
+                    for( final Sequence found_seq : found_seqs ) {
+                        if ( found_seq.getLength() >= 85 ) {
+                            
+                            all_found_seqs.add( BasicSequence.createAaSequence( id, found_seq.getMolecularSequenceAsString() ) );
+                        }
+                    }
                     if ( found > 1 ) {
                         System.out.println( i + ": " + id + "=>" + id_ + " " + range );
                         System.out.println( "  found: " + found );
@@ -58,6 +66,19 @@ public class aa {
                     System.exit( -1 );
                 }
             }
+            String fasta_ary[] = new String[ all_found_seqs.size() ];
+            int i = 0;
+            for( Sequence sequence : all_found_seqs ) {
+                fasta_ary[ i ] = ">" + sequence.getIdentifier() + "\n" + sequence.getMolecularSequenceAsString();
+                System.out.println( sequence );
+                i++;
+            }
+            Arrays.sort( fasta_ary );
+            
+            for( int j = 0; j < fasta_ary.length; ++j ) {
+                System.out.println(  fasta_ary[ j ] );
+            }
+            
             System.out.println( "DONE." );
         }
         catch ( final Exception e ) {