@Override
  public ExampleSet read() throws OperatorException {
    FileInputStream inStream = null;
    try {
      inStream = new FileInputStream(getParameterAsFile(PARAMETER_FASTA_FILE_NAME));
    } catch (FileNotFoundException e) {
      // TODO: "Fill"
    }
    FastaReader<DNASequence, NucleotideCompound> fastaReader =
        new FastaReader<DNASequence, NucleotideCompound>(
            inStream,
            new GenericFastaHeaderParser<DNASequence, NucleotideCompound>(),
            new DNASequenceCreator(DNACompoundSet.getDNACompoundSet()));
    LinkedHashMap<String, DNASequence> b = null;
    try {
      b = fastaReader.process();
    } catch (Exception e) {
      // TODO: "Fill"
    }
    String data[][] = new String[0][];
    if (b != null) {
      data = new String[b.size()][2];
      int i = 0;
      for (Map.Entry<String, DNASequence> entry : b.entrySet()) {
        data[i][0] = entry.getValue().getOriginalHeader();
        data[i][1] = entry.getValue().getSequenceAsString();
        i++;
      }
    }

    ExampleSet outSet = ExampleSetFactory.createExampleSet(data);
    outSet.getAttributes().get("att1").setName("DNA name");
    outSet.getAttributes().get("att2").setName("Chain");
    return outSet;
  }
示例#2
0
  public static void main(String[] args) {
    DNASequence dnaSequence = new DNASequence("ATCG");
    System.out.println(dnaSequence.toString());

    SequenceStringProxyLoader<NucleotideCompound> sequenceStringProxyLoader =
        new SequenceStringProxyLoader("GCTA", DNACompoundSet.getDNACompoundSet());
    DNASequence dnaSequenceFromProxy = new DNASequence(sequenceStringProxyLoader);
    System.out.println(dnaSequenceFromProxy.toString());
  }
示例#3
0
 public DNASequence(SequenceProxyLoader<NucleotideCompound> proxyLoader) {
   super(proxyLoader, DNACompoundSet.getDNACompoundSet());
 }
示例#4
0
 public DNASequence(String seqString) {
   super(seqString, DNACompoundSet.getDNACompoundSet());
 }
  @Override
  public ExampleSet read() throws OperatorException {
    FileInputStream inStream = null;
    try {
      inStream = new FileInputStream(getParameterAsFile(PARAMETER_FASTA_NAME));
    } catch (FileNotFoundException e) {
      // TODO: "Fill"
    }
    FastaReader<DNASequence, NucleotideCompound> fastaReader =
        new FastaReader<DNASequence, NucleotideCompound>(
            inStream,
            new GenericFastaHeaderParser<DNASequence, NucleotideCompound>(),
            new DNASequenceCreator(DNACompoundSet.getDNACompoundSet()));
    LinkedHashMap<String, DNASequence> genome = null;
    try {
      genome = fastaReader.process();
    } catch (Exception e) {
      // TODO: "Fill"
    }

    ORMFinder finder = new ORMFinder();
    ArrayList<DNASequence> startTrip = new ArrayList<DNASequence>();
    startTrip.add(new DNASequence("ATG")); // +
    startTrip.add(new DNASequence("TTG")); // +
    startTrip.add(new DNASequence("CTG")); // +
    startTrip.add(new DNASequence("ATT")); // +
    startTrip.add(new DNASequence("ATC")); // --
    startTrip.add(new DNASequence("ATA")); // --
    startTrip.add(new DNASequence("GTG")); // +
    ArrayList<DNASequence> stopTrip = new ArrayList<DNASequence>();
    stopTrip.add(new DNASequence("TAA"));
    stopTrip.add(new DNASequence("TAG"));
    stopTrip.add(new DNASequence("TGA"));
    ArrayList<String> orfs = null;
    ArrayList<String> starts = null;
    ArrayList<String> stops = null;
    for (Map.Entry<String, DNASequence> entry : genome.entrySet()) {
      orfs =
          finder.find(
              entry.getValue(), getParameterAsInt(PARAMETER_ORF_MIN_LENGTH), startTrip, stopTrip);
      starts = finder.getStarts();
      stops = finder.getStops();
    }

    String data[][] = null;
    if (orfs != null) {
      data = new String[orfs.size()][4];
    }
    for (int i = 0; (i < orfs.size()) && (i < starts.size()) && (i < stops.size()); i++) {
      int annotationEnd = orfs.get(i).indexOf(")");
      String currentAnotation = orfs.get(i).substring(0, annotationEnd + 1);
      String currentOrf = orfs.get(i).substring(annotationEnd + 2, orfs.get(i).length() - 1);
      data[i][0] = currentAnotation;
      data[i][1] = currentOrf;
      data[i][2] = starts.get(i).toString();
      data[i][3] = stops.get(i).toString();
    }
    ExampleSet outSet = ExampleSetFactory.createExampleSet(data);
    outSet.getAttributes().get("att1").setName("Annotation");
    outSet.getAttributes().get("att2").setName("Chain");
    outSet.getAttributes().get("att3").setName("Start position");
    outSet.getAttributes().get("att4").setName("Stop position");
    return outSet;
  }