예제 #1
0
  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;
  }
예제 #2
0
  public boolean clipBoardHasString() {

    Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
    Transferable t = clip.getContents(this);
    try {
      String s = (String) t.getTransferData(DataFlavor.stringFlavor);
      if (s != null) {
        return true;
      }
    } catch (Exception e) {
      MesquiteMessage.printStackTrace(e);
    }
    return false;
  }
예제 #3
0
  /*.................................................................................................................*/
  public void fillNameTranslation(DNAData editedData, int it, int numReads) {
    Associable as = editedData.getTaxaInfo(false);
    if (as == null) return;
    String[] fileNames =
        ChromaseqUtil.getStringsAssociated(as, ChromaseqUtil.origReadFileNamesRef, it);
    String[] primerNames =
        ChromaseqUtil.getStringsAssociated(as, ChromaseqUtil.primerForEachReadNamesRef, it);
    String[] sampleCodes =
        ChromaseqUtil.getStringsAssociated(as, ChromaseqUtil.sampleCodeNamesRef, it);

    for (int i = 0; i < numReads; i++) {

      if (fileNames == null) {
        if (i == 0)
          MesquiteMessage.warnProgrammer(
              "fileNames NULL in AceDirectoryProcess.fileNameTranslation");
      } else if (i * 2 + 1 < fileNames.length) {
        fileNameTranslation[0][i] = fileNames[i * 2];
        fileNameTranslation[1][i] = fileNames[i * 2 + 1];
      } else
        MesquiteMessage.warnProgrammer(
            "fileNames.length too small in AceDirectoryProcess.fileNameTranslation: fileNames.length = "
                + fileNames.length
                + ", numReads: "
                + numReads);

      if (primerNames == null) {
        if (i == 0)
          MesquiteMessage.warnProgrammer(
              "primerNames NULL in AceDirectoryProcess.fileNameTranslation");
      } else if (i * 2 + 1 < primerNames.length) fileNameTranslation[2][i] = primerNames[i * 2 + 1];
      else
        MesquiteMessage.warnProgrammer(
            "primerNames.length too small in AceDirectoryProcess.fileNameTranslation: primerNames.length = "
                + primerNames.length
                + ", numReads: "
                + numReads);

      if (sampleCodes == null) {
        if (i == 0)
          MesquiteMessage.warnProgrammer(
              "sampleCodes NULL in AceDirectoryProcess.fileNameTranslation");
      } else if (i * 3 + 2 < sampleCodes.length) {
        fileNameTranslation[3][i] = sampleCodes[i * 3 + 1];
        fileNameTranslation[4][i] = sampleCodes[i * 3 + 2];
      } else
        MesquiteMessage.warnProgrammer(
            "sampleCodes.length too small in AceDirectoryProcess.fileNameTranslation: sampleCodes.length = "
                + sampleCodes.length
                + ", numReads: "
                + numReads);
    }
  }