public static boolean processNoContigAceFiles(CharacterData data, MesquiteModule ownerModule) {
    DNAData editedData = ChromaseqUtil.getEditedData(data);
    if (editedData == null) return false;
    boolean changed = false;
    MesquiteFile file = data.getProject().getHomeFile();
    int count = 0;
    int originalChars = editedData.getNumChars();
    for (int it = 0; it < editedData.getNumTaxa(); it++)
      if (ChromaseqUtil.reprocessContig(editedData, it)) {
        AceDirectoryProcessor aceDirProcessor = new AceDirectoryProcessor();
        aceDirProcessor.reprocessAceFileDirectory(file, ownerModule, editedData, it);
        count++;
      }
    if (count > 0) {
      editedData.getTaxa().notifyListeners(ownerModule, new Notification(ownerModule.PARTS_ADDED));
      MesquiteMessage.discreetNotifyUser(
          "Some of the contigs have been reprocessed; this will be lost permanently unless you resave the file.");
      changed = true;
    }
    if (originalChars < editedData.getNumChars())
      editedData.notifyListeners(ownerModule, new Notification(ownerModule.PARTS_ADDED));
    else if (originalChars > editedData.getNumChars())
      editedData.notifyListeners(ownerModule, new Notification(ownerModule.PARTS_DELETED));

    ChromaseqUtil.removeAssociatedObjects(editedData, ChromaseqUtil.reprocessContigRef);
    return changed;
  }
  /*.................................................................................................................*/
  public void processAceFileWithContig(
      CharacterData data,
      MesquiteModule ownerModule,
      String processedAceFilePath,
      String fragmentDirPath,
      AceFile ace,
      SequenceUploader uploader,
      String geneName,
      MesquiteString fullName,
      String baseName,
      MesquiteString voucherCode,
      int it) {
    DNAData editedData = ChromaseqUtil.getEditedData(data);
    DNAData originalData = ChromaseqUtil.getOriginalData(data);
    Taxa taxa = data.getTaxa();
    ace.setNameTranslation(fileNameTranslation);
    ownerModule.log(ace.contigListForLog() + StringUtil.lineEnding());
    if (processPolymorphisms) ace.processPolys(); // creates an additional CO that has polys in it
    if (renameContigsInAceFiles) ace.renameContigs(fullName.toString(), addFragName, geneName);
    ace.setLowQualityToLowerCase(qualThresholdForLowerCase);
    ace.writeToPropertiesFile(contigPropertiesFileBuffer, fullName.toString());
    if (truncateMixedEnds)
      ace.trimMixedEnds(mixedEndThreshold, mixedEndWindow, qualThresholdForTrim, addPhrapFailures);

    /*		if (uploadResultsToDatabase && StringUtil.notEmpty(databaseURL)) {
    			uploader.uploadAceFileToServer(MesquiteXMLToLUtilities.getTOLPageDatabaseURL(databaseURL), ace, processPolymorphisms, qualThresholdForTrim);
    		}
    */
    System.out.println("\n\nfasta file name: " + baseName + " ace file: " + ace);
    MesquiteFile.putFileContents(
        fragmentDirPath
            + MesquiteFile.fileSeparator
            + ChromaseqUtil.processedFastaFolder
            + MesquiteFile.fileSeparator
            + baseName
            + ".fas",
        ace.toFASTAString(processPolymorphisms, qualThresholdForTrim),
        true);
    MesquiteFile.putFileContents(processedAceFilePath, ace.toString(processPolymorphisms), true);
    ace.importSequence(
        taxa,
        editedData,
        it,
        originalData,
        ChromaseqUtil.getQualityData(data),
        ChromaseqUtil.getRegistryData(data),
        singleTaxaBlock,
        processPolymorphisms,
        maxChar,
        " contig ",
        false,
        voucherCode);
  }
示例#3
0
  /*.................................................................................................................*/
  private void recordSourceProject() {
    MesquiteString s = new MesquiteString();
    s.setValue(getProject().getHomeFileName());
    if (!QueryDialogs.queryString(
        containerOfModule(),
        "Name to Stamp",
        "Indicate source file name to stamp on matrix rows",
        s)) return;

    int numMatrices = getProject().getNumberCharMatrices();
    NameReference sourceRef = NameReference.getNameReference("SourceFile");

    for (int im = 0; im < numMatrices; im++) {
      CharacterData data = getProject().getCharacterMatrix(im);
      Taxa taxa = data.getTaxa();
      Associable tInfo = data.getTaxaInfo(true);
      boolean anySelected = taxa.anySelected();
      for (int it = 0; it < taxa.getNumTaxa(); it++) {
        if (data.hasDataForTaxon(it) && (!anySelected || taxa.getSelected(it)))
          tInfo.setAssociatedObject(sourceRef, it, s.getValue());
      }
    }
  }