Author: Olivier Sallou <osallou@debian/org>
Last-Updated: 2015-01-31
Subject: Some tests use network access
Description: Remove tests requiring external
 network access
Forwarded: yes
Bug: https://redmine.open-bio.org/issues/3402
--- a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankCookbookTest.java
+++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankCookbookTest.java
@@ -75,18 +75,7 @@
         /*
          * Method 1: With the GenbankProxySequenceReader
          */
-        //Try with the GenbankProxySequenceReader
-        GenbankProxySequenceReader<AminoAcidCompound> genbankProteinReader
-                = new GenbankProxySequenceReader<AminoAcidCompound>(System.getProperty("java.io.tmpdir"), "NP_000257", AminoAcidCompoundSet.getAminoAcidCompoundSet());
-        ProteinSequence proteinSequence = new ProteinSequence(genbankProteinReader);
-        genbankProteinReader.getHeaderParser().parseHeader(genbankProteinReader.getHeader(), proteinSequence);
-        logger.info("Sequence({},{}) = {}...", proteinSequence.getAccession(), proteinSequence.getLength(), proteinSequence.getSequenceAsString().substring(0, 10));
-
-	GenbankProxySequenceReader<NucleotideCompound> genbankDNAReader 
-	= new GenbankProxySequenceReader<NucleotideCompound>(System.getProperty("java.io.tmpdir"), "NM_001126", DNACompoundSet.getDNACompoundSet());
-	DNASequence dnaSequence = new DNASequence(genbankDNAReader);
-	genbankDNAReader.getHeaderParser().parseHeader(genbankDNAReader.getHeader(), dnaSequence);
-	logger.info("Sequence({},{}) = {}...", dnaSequence.getAccession(), dnaSequence.getLength(), dnaSequence.getSequenceAsString().substring(0, 10));
+
         /*
          * Method 2: With the GenbankReaderHelper
          */
--- a/biojava-protein-disorder/src/test/java/org/biojava/nbio/ronn/NonstandardProteinCompoundTest.java
+++ b/biojava-protein-disorder/src/test/java/org/biojava/nbio/ronn/NonstandardProteinCompoundTest.java
@@ -67,20 +67,6 @@
 	
 	private void testUniprot(String uniprotID) throws CompoundNotFoundException, IOException {
 		
-		ProteinSequence seq = getUniprot(uniprotID);
-		
-		AminoAcidCompoundSet compoundSet = AminoAcidCompoundSet.getAminoAcidCompoundSet();
-		
-/*		for (AminoAcidCompound compound : seq) {
-			System.out.println(compound.getShortName() + " " + compound.getLongName() + " " + compound.getDescription() + " | " + compoundSet.getEquivalentCompounds(compound) + " " + compound.getMolecularWeight() + " " + compound.getBase());
-		} 
-		*/
-		assertTrue(compoundSet.isValidSequence(seq));
-		
-		
-		
-		Jronn.getDisorderScores(seq);
-		
 		
 	}
 	
--- a/biojava-core/src/test/java/org/biojava/nbio/core/sequence/loader/GenbankProxySequenceReaderTest.java
+++ b/biojava-core/src/test/java/org/biojava/nbio/core/sequence/loader/GenbankProxySequenceReaderTest.java
@@ -75,88 +75,10 @@
 
     @Test
     public void testFeatures() throws IOException, InterruptedException, CompoundNotFoundException {
-        logger.info("run test for protein: {}", gi);
-        GenbankProxySequenceReader<AminoAcidCompound> genbankReader
-                = new GenbankProxySequenceReader<AminoAcidCompound>(System.getProperty("java.io.tmpdir"),
-                        this.gi,
-                        AminoAcidCompoundSet.getAminoAcidCompoundSet());
-
-        // why only tests on protein sequences?
-        ProteinSequence seq = new ProteinSequence(genbankReader);
-
-        Assert.assertNotNull("protein sequence is null", seq);
-
-        /*
-         parse description from header. There is no separate interface/abstract class for method getHeader()
-         so it should be done here (manualy).
-         */
-        genbankReader.getHeaderParser().parseHeader(genbankReader.getHeader(), seq);
-
-        // test description
-        Assert.assertTrue(seq.getDescription() != null);
-
-        // test accession Id
-        logger.info("accession id: {}", seq.getAccession().getID());
-        Assert.assertNotNull(seq.getAccession().getID());
-        // test GID number
-        Assert.assertEquals(gi, seq.getAccession().getIdentifier());
-        logger.info("found identifier '{}'", seq.getAccession().getIdentifier());
-
-        // test taxonomy id
-        logger.info("taxonomy id: {}", seq.getTaxonomy().getID());
-        Assert.assertNotNull(seq.getTaxonomy().getID());
-        Assert.assertNotNull(Integer.decode(seq.getTaxonomy().getID().split(":")[1]));
-
-        // test taxonomy name
-        String taxonName = seq.getFeaturesByType("source").get(0).getQualifiers().get("organism").getValue();
-        logger.info("taxonomy name '{}'", taxonName);
-        Assert.assertNotNull(taxonName);
-
-        if (seq.getFeaturesByType("CDS").size() > 0) {
-            FeatureInterface<AbstractSequence<AminoAcidCompound>, AminoAcidCompound> CDS = seq.getFeaturesByType("CDS").get(0);
-            logger.info("CDS: {}", CDS);
-            String codedBy = CDS.getQualifiers().get("coded_by").getValue();
-            Assert.assertNotNull(codedBy);
-            Assert.assertTrue(!codedBy.isEmpty());
-            logger.info("\t\tcoded_by: {}", codedBy);
-        }
     }
 
     @Test
     public void testProteinSequenceFactoring() throws Exception {
         logger.info("create protein sequence test for target {}", gi);
-
-        GenbankProxySequenceReader<AminoAcidCompound> genbankReader
-                = new GenbankProxySequenceReader<AminoAcidCompound>(System.getProperty("java.io.tmpdir"),
-                        this.gi,
-                        AminoAcidCompoundSet.getAminoAcidCompoundSet());
-
-        ProteinSequence seq = new ProteinSequence(genbankReader);
-
-        // if target protein contain CDS/coded_by than it should contain parent nucleotide seq
-        ArrayList<AbstractFeature> CDSs = genbankReader.getFeatures().get("CDS");
-
-        if (CDSs != null) {
-            if (CDSs.size() == 1) {
-                Qualifier codedBy = (Qualifier) CDSs.get(0).getQualifiers().get("coded_by");
-                if (codedBy != null) {
-
-                    AbstractSequence<?> parentSeq = seq.getParentSequence();
-                    Assert.assertNotNull(parentSeq);
-
-                    /* 
-                     Sometimes protein might have many 'parents' with different accessions
-                     so accession is not set.
-                
-                     That test is always failed
-                     */
-                    //Assert.assertTrue(parentSeq.getAccession()); 
-                    Assert.assertTrue(!parentSeq.getSequenceAsString().isEmpty());
-                }
-            }
-        } else {
-            logger.info("target {} has no CDS", gi);
-        }
-
     }
 }
