コード例 #1
0
ファイル: UniStsParser.java プロジェクト: NCIP/geneconnect
 /**
  * reset the various unigene records
  *
  * @param alias boolean to show whether file is uniSTS.alias
  */
 private void resetRecords(boolean noAlias) {
   if (true == noAlias) {
     uniStsRecord.resetAllFields();
     uniStsAccNoRecord.resetAllFields();
   } else {
     uniStsAliasRecord.resetAllFields();
   }
 }
コード例 #2
0
ファイル: UniStsParser.java プロジェクト: NCIP/geneconnect
 /**
  * Parsing of the Unigene record for 1st,5th,7th and 8th token. The first field indicates STS id.
  * The fifth (NAME) coresponds to STSNAME. The seventh(ACCESSION NUMBER) & eighth(ORGANISM). For
  * the UniStsAlias Record we use 1st and 2nd token The first field indicates STS id. The first
  * field indicates Aliases.
  *
  * @param alias boolean to indicate if file being parsed in unSTS.alias
  */
 private void parseLine(boolean noAlias) throws FatalException {
   m_tokenizer = new StringTokenizer(m_line, m_fieldDelimiter);
   if (true == noAlias) {
       /** noAlias = true ---> filename = UNISTS.STS */
     if (m_tokenizer.countTokens() >= Constants.uniStsTableCols) {
       String uniStsElement = null;
       int count = 0;
       while (m_tokenizer.hasMoreTokens()) {
         uniStsElement = m_tokenizer.nextToken();
         uniStsElement = uniStsElement.trim();
         count++; // ith term
         if (count == 1) {
           uniStsRecord.fields[0].append(uniStsElement);
           uniStsAccNoRecord.fields[0].append(uniStsElement);
         } else if (count == 5) {
           uniStsRecord.fields[1].append(uniStsElement);
         } else if (count == 7) {
           uniStsAccNoRecord.fields[2].append(uniStsElement);
         } else if (count == 8) {
           String localTaxid = (String) Variables.hmOrganismLocalId.get(uniStsElement);
           uniStsRecord.fields[2].append(localTaxid);
           uniStsAccNoRecord.fields[1].append(localTaxid);
         }
       }
     }
   } else {
     /** noAlias = false ---> filename = UNISTSalias file */
     if (m_tokenizer.countTokens() >= Constants.uniStsAliasTableCols) {
       String uniStsAliasElement = null;
       int count = 0;
       /** here we have to add the records with same locus id,different alias. */
       while (m_tokenizer.hasMoreTokens()) {
         uniStsAliasElement = m_tokenizer.nextToken();
         uniStsAliasElement = uniStsAliasElement.trim();
         count++; // ith term
         if (count == 1) uniStsAliasRecord.fields[0].append(uniStsAliasElement);
         else if (count == 2) {
           StringTokenizer token = new StringTokenizer(uniStsAliasElement, semiColonSeperator);
           int counttoken = token.countTokens();
           if (counttoken != 0) {
             StringBuffer id = new StringBuffer(uniStsAliasRecord.fields[0].toString());
             uniStsAliasRecord.resetAllFields();
             while (token.hasMoreElements()) {
               uniStsAliasRecord.fields[0].append(id.toString());
               uniStsAliasRecord.fields[1].append(token.nextElement());
               try {
                 writeRecordToDb(Variables.uniStsAliasTableName, uniStsAliasRecord);
               } catch (InsertException ie) {
                 Logger.log("Exception in UniSTS parser :" + ie.getMessage(), Logger.DEBUG);
               }
               uniStsAliasRecord.resetAllFields();
             }
           } else {
             uniStsAliasRecord.fields[1].append(uniStsAliasElement);
             try {
               writeRecordToDb(Variables.uniStsAliasTableName, uniStsAliasRecord);
             } catch (InsertException ie) {
               Logger.log("Exception in UniSTS parser :" + ie.getMessage(), Logger.DEBUG);
             }
           }
           resetRecords(false);
         }
       }
     }
   }
 }