import org.forester.io.parsers.FastaParser;
import org.forester.msa.Msa;
import org.forester.sequence.BasicSequence;
-import org.forester.sequence.Sequence;
+import org.forester.sequence.MolecularSequence;
import org.forester.util.ForesterUtil;
public class aa {
public static void main( final String args[] ) {
try {
System.out.println( "STARTING..." );
- final List<Sequence> orig = FastaParser
+ final List<MolecularSequence> orig = FastaParser
.parse( new FileInputStream( "C:\\Users\\zma\\Desktop\\RRMa_domains_ext_20.fasta" ) );
final Msa msa = FastaParser.parseMsa( new FileInputStream( "C:\\Users\\zma\\Desktop\\test3_sorted.fasta" ) );
- final Set<Sequence> all_found_seqs = new HashSet<Sequence>();
+ final Set<MolecularSequence> all_found_seqs = new HashSet<MolecularSequence>();
for( int i = 0; i < msa.getNumberOfSequences(); ++i ) {
final String id = msa.getIdentifier( i );
final String id_ = id.substring( 0, id.indexOf( "_" ) );
System.exit( -1 );
}
int found = 0;
- final List<Sequence> found_seqs = new ArrayList<Sequence>();
- for( final Sequence orig_seq : orig ) {
+ final List<MolecularSequence> found_seqs = new ArrayList<MolecularSequence>();
+ for( final MolecularSequence orig_seq : orig ) {
final String orig_seq_id = orig_seq.getIdentifier();
if ( ( orig_seq_id.indexOf( id_ ) >= 0 ) && ( orig_seq_id.indexOf( "[" + range + "]" ) >= 0 ) ) {
found++;
}
}
if ( found > 0 ) {
- for( final Sequence found_seq : found_seqs ) {
+ for( final MolecularSequence found_seq : found_seqs ) {
if ( found_seq.getLength() >= 85 ) {
all_found_seqs.add( BasicSequence.createAaSequence( id, found_seq
- .getMolecularSequenceAsString() ) );
+ .getMolecularSequenceAsString() ) );
}
}
if ( found > 1 ) {
System.out.println( i + ": " + id + "=>" + id_ + " " + range );
System.out.println( " found: " + found );
- for( final Sequence found_seq : found_seqs ) {
+ for( final MolecularSequence found_seq : found_seqs ) {
System.out.println( found_seq.toString() );
}
}
}
final String fasta_ary[] = new String[ all_found_seqs.size() ];
int i = 0;
- for( final Sequence sequence : all_found_seqs ) {
+ for( final MolecularSequence sequence : all_found_seqs ) {
fasta_ary[ i ] = ">" + sequence.getIdentifier() + "\n" + sequence.getMolecularSequenceAsString();
System.out.println( sequence );
i++;
import java.util.regex.Pattern;
import org.forester.io.parsers.FastaParser;
-import org.forester.sequence.Sequence;
+import org.forester.sequence.MolecularSequence;
import org.forester.util.EasyWriter;
import org.forester.util.ForesterUtil;
try {
final EasyWriter out = ( EasyWriter ) ForesterUtil.createEasyWriter( "aaa_out" );
System.out.println( "STARTING..." );
- final List<Sequence> too_short = new ArrayList<Sequence>();
- final List<Sequence> orig = FastaParser
+ final List<MolecularSequence> too_short = new ArrayList<MolecularSequence>();
+ final List<MolecularSequence> orig = FastaParser
.parse( new FileInputStream( "C:\\Users\\zma\\Desktop\\RRMa_domains_ext_20_2.fasta" ) );
final int initial_number = orig.size();
final List<String> new_seqs = new ArrayList<String>();
- for( final Sequence seq : orig ) {
+ for( final MolecularSequence seq : orig ) {
if ( seq.getLength() < MIN_LENGTH ) {
too_short.add( seq );
continue;
out.println( "" );
out.println( "" );
out.println( "Removed because too short:" );
- for( final Sequence s : too_short ) {
+ for( final MolecularSequence s : too_short ) {
out.println( s.toString() );
}
out.println( "" );
try {
final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
phy = factory.create( infile, org.forester.io.parsers.util.ParserUtils
- .createParserDependingOnFileType( infile, true ) )[ 0 ];
+ .createParserDependingOnFileType( infile, true ) )[ 0 ];
}
catch ( final Exception e ) {
System.err.println( e + "\nCould not read " + infile + "\n" );
try {
if ( args.length != 2 ) {
System.out
- .println( "Usage: domainloss_replacement <phylogeny file> <file with replacement characters>" );
+ .println( "Usage: domainloss_replacement <phylogeny file> <file with replacement characters>" );
System.exit( -1 );
}
final Phylogeny p = ParserUtils.readPhylogenies( args[ 0 ] )[ 0 ];
final int losses = lost_chars.size();
lost_chars.retainAll( replacement_domains );
final int intersection = lost_chars.size();
- final double percentage = 100.0 * intersection / losses;
+ final double percentage = ( 100.0 * intersection ) / losses;
System.out.println( name + "\t" + intersection + "\t" + losses + "\t"
+ ForesterUtil.round( percentage, 3 ) );
}
try {
final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
phy = factory.create( infile, org.forester.io.parsers.util.ParserUtils
- .createParserDependingOnFileType( infile, true ) )[ 0 ];
+ .createParserDependingOnFileType( infile, true ) )[ 0 ];
}
catch ( final Exception e ) {
System.err.println( e + "\nCould not read " + infile + "\n" );
}
catch ( final IOException e ) {
System.out.println( "\nError during processing of \"" + names_infile + "\" [" + e.getMessage()
- + "] at line \"" + line + "\"\n" );
+ + "] at line \"" + line + "\"\n" );
System.exit( -1 );
}
System.out.println( "\nDone.\n" );
try {
final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
phy = factory.create( infile, org.forester.io.parsers.util.ParserUtils
- .createParserDependingOnFileType( infile, true ) )[ 0 ];
+ .createParserDependingOnFileType( infile, true ) )[ 0 ];
}
catch ( final Exception e ) {
System.err.println( e + "\nCould not read " + infile + "\n" );
}
private static PhylogenyNode find( final String s, final Phylogeny phy ) {
- final List<PhylogenyNode> l = PhylogenyMethods.searchData( s, phy, true, false, false );
+ final List<PhylogenyNode> l = PhylogenyMethods.searchData( s, phy, true, false, false, false, 0 );
if ( l.size() != 1 ) {
System.err.println( "error: " + s );
System.exit( -1 );
try {
final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
phy = factory.create( infile, org.forester.io.parsers.util.ParserUtils
- .createParserDependingOnFileType( infile, true ) )[ 0 ];
+ .createParserDependingOnFileType( infile, true ) )[ 0 ];
}
catch ( final Exception e ) {
System.err.println( e + "\nCould not read " + infile + "\n" );
if ( !phy.getNode( external_id ).getNodeData().getBinaryCharacters()
.getGainedCharacters().contains( node_char )
&& !phy.getNode( external_id ).getNodeData().getBinaryCharacters()
- .getPresentCharacters().contains( node_char ) ) {
+ .getPresentCharacters().contains( node_char ) ) {
found = false;
break;
}
try {
final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
phy = factory.create( infile, org.forester.io.parsers.util.ParserUtils
- .createParserDependingOnFileType( infile, true ) )[ 0 ];
+ .createParserDependingOnFileType( infile, true ) )[ 0 ];
}
catch ( final Exception e ) {
System.err.println( e + "\nCould not read " + infile + "\n" );
import org.forester.phylogeny.data.Property.AppliesTo;
import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
import org.forester.phylogeny.factories.PhylogenyFactory;
-import org.forester.sequence.Sequence;
+import org.forester.sequence.MolecularSequence;
import org.forester.util.CommandLineArguments;
import org.forester.util.ForesterUtil;
final Phylogeny phy = phylogenies_0[ 0 ];
for( int i = 1; i < cla.getNumberOfNames(); i++ ) {
final String fasta_name = cla.getName( i );
- final List<Sequence> seqs = FastaParser.parse( new File( fasta_name ) );
+ final List<MolecularSequence> seqs = FastaParser.parse( new File( fasta_name ) );
for( int s = 0; s < seqs.size(); s++ ) {
- final Sequence seq = seqs.get( s );
+ final MolecularSequence seq = seqs.get( s );
final int actual_length = seq.getLength() - seq.getNumberOfGapResidues();
String node_name = "" + seq.getIdentifier();
node_name = node_name.substring( 0, node_name.indexOf( "/" ) );
config.putDisplayColors( TreeColorSet.BRANCH, new Color( 0, 0, 0 ) );
config.putDisplayColors( TreeColorSet.TAXONOMY, new Color( 0, 0, 0 ) );
config.setPhylogenyGraphicsType( Options.PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
- config.setTaxonomyColorize( false );
config.setColorizeBranches( true );
- config.setUseBranchesWidths( true );
config.setDisplayTaxonomyCode( false );
// Writing to a graphics file.
AptxUtil.writePhylogenyToGraphicsFile( phy,
try {
final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
phy = factory.create( infile, org.forester.io.parsers.util.ParserUtils
- .createParserDependingOnFileType( infile, true ) )[ 0 ];
+ .createParserDependingOnFileType( infile, true ) )[ 0 ];
}
catch ( final Exception e ) {
System.err.println( e + "\nCould not read " + infile + "\n" );
try {
final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
phy = factory.create( infile, org.forester.io.parsers.util.ParserUtils
- .createParserDependingOnFileType( infile, true ) )[ 0 ];
+ .createParserDependingOnFileType( infile, true ) )[ 0 ];
}
catch ( final Exception e ) {
System.err.println( e + "\nCould not read " + infile + "\n" );
final String c = t.getTaxonomyCode();
if ( c.indexOf( "XX" ) == 3 ) {
System.out.println( "FAKE_CODE_TO_ID_MAP.put( \"" + c + "\", " + t.getIdentifier().getValue()
- + ");" );
+ + ");" );
}
// SurfacingUtil.obtainHexColorStringDependingOnTaxonomyGroup( t.getTaxonomyCode(), phy );
}
}
}
final int n = l.size();
- final double xray_p = ForesterUtil.round( 100.0 * xray / n, 1 );
- final double nmr_p = ForesterUtil.round( 100.0 * nmr / n, 1 );
- final double model_p = ForesterUtil.round( 100.0 * model / n, 1 );
+ final double xray_p = ForesterUtil.round( ( 100.0 * xray ) / n, 1 );
+ final double nmr_p = ForesterUtil.round( ( 100.0 * nmr ) / n, 1 );
+ final double model_p = ForesterUtil.round( ( 100.0 * model ) / n, 1 );
final StringBuilder sb = new StringBuilder();
sb.append( String.valueOf( n ) );
sb.append( "\t" );