Repository navigation
SearchIO module - #329
SearchIO module#329
Conversation
…gnment to biojava-core. Mantaining main biological data structures in core will help to avoid problems of unwanted dependency. Unfortunately the substitution matrices related classes are tight coupled with SimpleSequencePair class and were moved too from alignment. Updated pom file to remove dependency of core from alignment module temporary added by first implementation of SearchIO.
|
I'm sorry guys, I'm now realizing that the structure module that actually I didn't touch it is failing. |
|
You might check that your patch didn't accidentally delete those (and other
|
|
Ok, did it! As supposed, it was a hard coded reference to a substitution matrix in a test file. Not so painful. |
There was a problem hiding this comment.
Two comments here:
- equals should not be implemented by comparing hashCodes. Hash codes do not guarantee equality. Hash equality is a necessary but not sufficient condition for equality (2 different objects can have the same hash)
- the best way to implement a hashCode is to follow the indications in this SO thread. Actually if you are using eclipse it can even implement such a thing for you automatically, just go to 'Source' -> 'Generate hashCode and equals', you then only need to select which fields of the class should be used (I imagine other IDEs will have similar functions).
There was a problem hiding this comment.
I have changed the full stuff. I have revisited the way equality is
evaluated and I have modified properties accordingly.
2015-09-22 20:23 GMT+02:00 Jose Manuel Duarte notifications@github.com:
In biojava-core/src/main/java/org/biojava/nbio/core/search/io/Hsp.java
#329 (comment):
\* Experimental.\* Wants to return an hashcode designed to allow conceptual comparisons of search results.\* Fields unrelated to search are deliberately not considered.\* @return*/- public int hashCode(){
String allInOne = hspQseq+"\n"+hspIdentityString+"\n"+hspHseq;return allInOne.hashCode();- }
- @OverRide
- public boolean equals(Object o){
if (!(o instanceof Hsp)) return false;
return o.hashCode() == this.hashCode();- }
Two comments here:
equals should not be implemented by comparing hashCodes. Hash codes do
not guarantee equality. Hash equality is a necessary but not sufficient
condition for equality (2 different objects can have the same hash)the best way to implement a hashCode is to follow the indications in this
SO thread
http://stackoverflow.com/questions/113511/best-implementation-for-hashcode-method.
Actually if you are using eclipse it can even implement such a thing for
you automatically, just go to 'Source' -> 'Generate hashCode and equals',
you then only need to select which fields of the class should be used (I
imagine other IDEs will have similar functions).—
Reply to this email directly or view it on GitHub
https://github.com/biojava/biojava/pull/329/files#r40123811.
…ied tests accordingly.
…om the old implementation in org.biojava.nbio.genome.query.BlastXMLQuery.
There was a problem hiding this comment.
Logging in Biojava (since Biojava 4) is happening through the slf4j interface. You should change this to use slf4j. You simply need to import on top:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;then declare a static variable for the logger:
private static final Logger logger = LoggerFactory.getLogger(Hsp.class);and then use it like:
logger.error("Unexpected error, could not find compound blah blah ", ex);See for instance org.biojava.nbio.structure.StructureImpl for an example of the above.
|
Added discussed final improvements. |
Dear all,
I am submitting changes largely discussed on the mailing list.
Since those changes introduces several variation to the API in terms of alignment package data structures that have moved to core, my advice is to merge this with next major version to warn all developers.
Bye bye,
Paolo