public LinkedHashMap<String, DNASequence> getDNACodingSequences() throws Exception { LinkedHashMap<String, DNASequence> dnaSequenceList = new LinkedHashMap<String, DNASequence>(); ArrayList<Element> elementList = XMLHelper.selectElements(geneidDoc.getDocumentElement(), "prediction/gene/cDNA"); logger.info("{} hits", elementList.size()); for (Element dnaElement : elementList) { Element geneElement = (Element) dnaElement.getParentNode(); String sequence = dnaElement.getTextContent().replaceAll("\\W",""); DNASequence dnaSequence = new DNASequence(sequence); String idGene = geneElement.getAttribute("idGene"); dnaSequence.setAccession(new AccessionID(idGene)); dnaSequenceList.put(idGene, dnaSequence); } return dnaSequenceList; }
/** * Get the stitched together CDS sequences then maps to the cDNA * @return */ public DNASequence getDNACodingSequence() { StringBuilder sb = new StringBuilder(); for (CDSSequence cdsSequence : cdsSequenceList) { sb.append(cdsSequence.getCodingSequence()); } DNASequence dnaSequence = null; try { dnaSequence = new DNASequence(sb.toString().toUpperCase()); } catch (CompoundNotFoundException e) { // if I understand this should not happen, please correct if I'm wrong - JD 2014-10-24 logger.error("Could not create DNA coding sequence, {}. This is most likely a bug.", e.getMessage()); } dnaSequence.setAccession(new AccessionID(this.getAccession().getID())); return dnaSequence; }
/** * Get the stitched together CDS sequences then maps to the cDNA * @return */ public DNASequence getDNACodingSequence() { StringBuilder sb = new StringBuilder(); for (CDSSequence cdsSequence : cdsSequenceList) { sb.append(cdsSequence.getCodingSequence()); } DNASequence dnaSequence = null; try { dnaSequence = new DNASequence(sb.toString().toUpperCase()); } catch (CompoundNotFoundException e) { // if I understand this should not happen, please correct if I'm wrong - JD 2014-10-24 logger.error("Could not create DNA coding sequence, {}. This is most likely a bug.", e.getMessage()); } dnaSequence.setAccession(new AccessionID(this.getAccession().getID())); return dnaSequence; }
/** * Try to give method clarity where you want a DNASequence coding in the 5' to 3' direction * Returns the DNASequence representative of the 5' and 3' reading based on strand * @return dna sequence */ public DNASequence getSequence5PrimeTo3Prime() { String sequence = getSequenceAsString(this.getBioBegin(), this.getBioEnd(), this.getStrand()); if (getStrand() == Strand.NEGATIVE) { //need to take complement of sequence because it is negative and we are returning the gene sequence from the opposite strand StringBuilder b = new StringBuilder(getLength()); CompoundSet<NucleotideCompound> compoundSet = this.getCompoundSet(); for (int i = 0; i < sequence.length(); i++) { String nucleotide = String.valueOf(sequence.charAt(i)); NucleotideCompound nucleotideCompound = compoundSet.getCompoundForString(nucleotide); b.append(nucleotideCompound.getComplement().getShortName()); } sequence = b.toString(); } DNASequence dnaSequence = null; try { dnaSequence = new DNASequence(sequence.toUpperCase()); } catch (CompoundNotFoundException e) { // this should not happen, the sequence is DNA originally, if it does, there's a bug somewhere logger.error("Could not create new DNA sequence in getSequence5PrimeTo3Prime(). Error: {}",e.getMessage()); } dnaSequence.setAccession(new AccessionID(this.getAccession().getID())); return dnaSequence; } }
/** * Try to give method clarity where you want a DNASequence coding in the 5' to 3' direction * Returns the DNASequence representative of the 5' and 3' reading based on strand * @return dna sequence */ public DNASequence getSequence5PrimeTo3Prime() { String sequence = getSequenceAsString(this.getBioBegin(), this.getBioEnd(), this.getStrand()); if (getStrand() == Strand.NEGATIVE) { //need to take complement of sequence because it is negative and we are returning the gene sequence from the opposite strand StringBuilder b = new StringBuilder(getLength()); CompoundSet<NucleotideCompound> compoundSet = this.getCompoundSet(); for (int i = 0; i < sequence.length(); i++) { String nucleotide = String.valueOf(sequence.charAt(i)); NucleotideCompound nucleotideCompound = compoundSet.getCompoundForString(nucleotide); b.append(nucleotideCompound.getComplement().getShortName()); } sequence = b.toString(); } DNASequence dnaSequence = null; try { dnaSequence = new DNASequence(sequence.toUpperCase()); } catch (CompoundNotFoundException e) { // this should not happen, the sequence is DNA originally, if it does, there's a bug somewhere logger.error("Could not create new DNA sequence in getSequence5PrimeTo3Prime(). Error: {}",e.getMessage()); } dnaSequence.setAccession(new AccessionID(this.getAccession().getID())); return dnaSequence; } }
DNASequence dnaSequence = new DNASequence(genbankDNAReader); genbankDNAReader.getHeaderParser().parseHeader(genbankDNAReader.getHeader(), dnaSequence); dnaSequence.setAccession(new AccessionID("NM_001126")); logger.info("Sequence ({},{})={}...", dnaSequence.getAccession(), dnaSequence.getLength(), dnaSequence.getSequenceAsString().substring(0, 10)); logger.info("Keywords: {}", genbankDNAReader.getKeyWords());
DNASequence dnaSequence = new DNASequence(genbankDNAReader); genbankDNAReader.getHeaderParser().parseHeader(genbankDNAReader.getHeader(), dnaSequence); dnaSequence.setAccession(new AccessionID("NM_001126")); logger.info("Sequence ({},{})={}...", dnaSequence.getAccession(), dnaSequence.getLength(), dnaSequence.getSequenceAsString().substring(0, 10)); logger.info("Keywords: {}", genbankDNAReader.getKeyWords());