Entering edit mode
                    10.5 years ago
        adityagudibanda1995
        
    
        ▴
    
    10
    I am trying to implement the program given here:
dasan.sejong.ac.kr/~wikim/notice.html
Here are the relevant parts of the code that are throwing errors:
public void readGenomes(ArrayList oldRunGenomeList, ArrayList genomeList) {
    Hashtable tmp1 = new Hashtable();
    Hashtable tmp2 = new Hashtable();
    for (int i=0; i<genomeList.size(); ++i) {
        Vector queryV = (Vector)getQuerySequence((String)genomeList.get(i));
        for (int k=i; k<genomeList.size(); ++k) {
            if (oldRunGenomeList.contains(genomeList.get(i)+"_"+genomeList.get(k))) {
                System.out.println("Done (Blasted)...... ortholog detection between [" + 
                    (String)genomeList.get(i) + "] genome and [ " +(String)genomeList.get(k)+"] genome");
            }  
            else if (oldRunGenomeList.contains(genomeList.get(k)+"_"+genomeList.get(i))) {
                System.out.println("Done (Blasted)...... ortholog detection between [" + 
                    (String)genomeList.get(k)+"] genome and ["+(String)genomeList.get(i)+"] genome");
            }
            else {
                for (int j=0; j<queryV.size(); ++j) {
                    writeQuery((String)queryV.elementAt(j));
                    // gene =======> subject
                    ArrayList scoreList = (ArrayList)runBlast(ParaNames.Query, (String)genomeList.get(k));
                    tmp1 = (Hashtable)getBestScore(scoreList);
                    Enumeration enum1 = tmp1.keys();
                    while (enum1.hasMoreElements()) {
                        String seqNum1 = (String)enum1.nextElement();
                        double bestScore1 = (Double)tmp1.get(seqNum1);
                        String subjectSequence = getSubjectSequence((String)genomeList.get(k), Integer.parseInt(seqNum1));
                        writeQuery(subjectSequence);
And here is the part of the input that this code is parsing:
>gi|15605613|ref|NP_212986.1| elongation factor EF-G [Aquifex aeolicus VF5]
MAREVPIEKLRNIGIVAHIDAGKTTTTERILYYTGKTYKIGEVHEGAATMDWMPQEKERGITITVATTAC
YWTRNGERYQINIIDTPGHVDFSVEVVRSMKVLDGIVFIFSAVEGVQPQSEANWRWADRFQVPRIAFINK
MDRLGADFYRVFKEIEEKLTIKPVAIQIPLGAEDQFEGVIDLMEMKAIRWLEETLGAKYEVVDIPPEYQE
KAQEWREKMIETIVETDDELMEKYLEGQEISIDELRKALRKATIERKLVPVLCGSAFKNKGVQPLLDAVI
When I try to run the program with the given files without the pre-calculated BLAST results, the following occurs:
Exception in thread "main" java.lang.NumberFormatException: For input string: "212986.1|"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:580)
    at java.lang.Integer.parseInt(Integer.java:615)
    at ReMark.RecursiveClustering.readGenomes(RecursiveClustering.java:113)
    at ReMark.RecursiveClustering.<init>(RecursiveClustering.java:46)
    at ReMark.RecursiveClustering.main(RecursiveClustering.java:814)
Here is the link to the file that is throwing the error:
It is having difficulty parsing the strings in the input file. Here is the input file:
Here is the getBestScore function:
public Hashtable getBestScore(ArrayList scoreList) {
    double bestScore = -1.0;
    Hashtable tmp = new Hashtable();
    Hashtable geneIDs2bestScore = new Hashtable();
    for (int i=0; i<scoreList.size(); ++i) {
        String result = (String)scoreList.get(i);
        // read subjectID
        int subjectIDstart = result.indexOf(",");
        int subjectIDend = result.indexOf(",", subjectIDstart+1);
        String subjectID = result.substring(subjectIDstart+1, subjectIDend);
        int subjectSeqNumStart = subjectID.indexOf("_");
        String seqNum = subjectID.substring(subjectSeqNumStart+1, subjectID.length());
        // read score
        double score = Double.parseDouble(result.substring(subjectIDend+1, result.length()));
        if (score >= bestScore) {
            bestScore = score;
            tmp.put(seqNum, score);
       }
    }
    Enumeration enumeration = tmp.keys();
    while (enumeration.hasMoreElements()) { 
        String seqNum2 = (String)enumeration.nextElement();
        double bestScore2 = (Double)tmp.get(seqNum2);
        if (bestScore == bestScore2) // && bestScore != -1.0)
            geneIDs2bestScore.put(seqNum2, bestScore);
        }    
    return geneIDs2bestScore;
}