X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fws%2Fseqdb%2FSequenceDbWsTools.java;h=606d35a1a292d013a054a0e73f47cc07b429df51;hb=af5e25d369f3240ce41018957383044c12126d98;hp=ed6387ee105cc51ad9da072bd24650ae33af0c99;hpb=0ac19dbd836236ac1c4da82415702836b7c54843;p=jalview.git diff --git a/forester/java/src/org/forester/ws/seqdb/SequenceDbWsTools.java b/forester/java/src/org/forester/ws/seqdb/SequenceDbWsTools.java index ed6387e..606d35a 100644 --- a/forester/java/src/org/forester/ws/seqdb/SequenceDbWsTools.java +++ b/forester/java/src/org/forester/ws/seqdb/SequenceDbWsTools.java @@ -49,21 +49,23 @@ import org.forester.phylogeny.data.Identifier; import org.forester.phylogeny.data.Sequence; import org.forester.phylogeny.data.Taxonomy; import org.forester.phylogeny.iterators.PhylogenyNodeIterator; +import org.forester.sequence.MolecularSequence.TYPE; import org.forester.util.ForesterUtil; import org.forester.util.SequenceAccessionTools; public final class SequenceDbWsTools { - public final static String BASE_UNIPROT_URL = "http://www.uniprot.org/"; - public final static int DEFAULT_LINES_TO_RETURN = 4000; - public final static String EMBL_DBS_REFSEQ_N = "refseqn"; - public final static String EMBL_DBS_REFSEQ_P = "refseqp"; - public final static String EMBL_GENBANK = "http://www.ebi.ac.uk/Tools/dbfetch/dbfetch?db=GENBANK&style=raw&id="; - public final static String EMBL_REFSEQ = "http://www.ebi.ac.uk/Tools/dbfetch/dbfetch?db=REFSEQ&style=raw&id="; - public final static String EMBL_EMBL = "http://www.ebi.ac.uk/Tools/dbfetch/dbfetch?db=EMBL&style=raw&id="; - private final static boolean DEBUG = true; - private final static String URL_ENC = "UTF-8"; - private final static int SLEEP = 200; + public final static String BASE_UNIPROT_URL = "http://www.uniprot.org/"; + public final static int DEFAULT_LINES_TO_RETURN = 4000; + public final static String EMBL_DBS_REFSEQ_N = "refseqn"; + public final static String EMBL_DBS_REFSEQ_P = "refseqp"; + public final static String EMBL_GENBANK = "http://www.ebi.ac.uk/Tools/dbfetch/dbfetch?db=GENBANK&style=raw&id="; + public final static String EMBL_REFSEQ = "http://www.ebi.ac.uk/Tools/dbfetch/dbfetch?db=REFSEQ&style=raw&id="; + public final static String EMBL_EMBL = "http://www.ebi.ac.uk/Tools/dbfetch/dbfetch?db=EMBL&style=raw&id="; + private final static boolean DEBUG = true; + private final static String URL_ENC = "UTF-8"; + private final static int SLEEP = 200; + private static final boolean ALLOW_TO_OVERWRITE_MOL_SEQ = false; public static List getTaxonomiesFromCommonNameStrict( final String cn, final int max_taxonomies_return ) @@ -380,6 +382,21 @@ public final class SequenceDbWsTools { // Eat this exception. } } + if ( ( db_entry.getMolecularSequence() != null ) + && !ForesterUtil.isEmpty( db_entry.getMolecularSequence().getMolecularSequenceAsString() ) + && ( ALLOW_TO_OVERWRITE_MOL_SEQ || seq.getMolecularSequence().isEmpty() ) ) { + seq.setMolecularSequence( db_entry.getMolecularSequence().getMolecularSequenceAsString() ); + seq.setMolecularSequenceAligned( false ); + if ( db_entry.getMolecularSequence().getType() == TYPE.AA ) { + seq.setType( "protein" ); + } + else if ( db_entry.getMolecularSequence().getType() == TYPE.DNA ) { + seq.setType( "dna" ); + } + else if ( db_entry.getMolecularSequence().getType() == TYPE.RNA ) { + seq.setType( "rna" ); + } + } if ( ( db_entry.getGoTerms() != null ) && !db_entry.getGoTerms().isEmpty() ) { for( final GoTerm go : db_entry.getGoTerms() ) { final Annotation ann = new Annotation( go.getGoId().getId() );