/** * * @param sequence The Sequence from a String * @param index Currently not used * @return */ @Override public AbstractSequence<NucleotideCompound> getSequence(String sequence, long index) throws CompoundNotFoundException { return new DNASequence(sequence, compoundSet); } /**
private static boolean isDNASequence(String str) { try { new DNASequence(str); } catch (CompoundNotFoundException e) { return false; } return true; }
/** * * @param sequence The Sequence from a String * @param index Currently not used * @return */ @Override public AbstractSequence<NucleotideCompound> getSequence(String sequence, long index) throws CompoundNotFoundException { return new DNASequence(sequence, compoundSet); } /**
/** * * @param proxyLoader The Sequence from a ProxySequenceReader * @param index Currently not used * @return */ @Override public AbstractSequence<NucleotideCompound> getSequence( ProxySequenceReader<NucleotideCompound> proxyLoader, long index) { return new DNASequence(proxyLoader, compoundSet); }
/** * * @param proxyLoader The Sequence from a ProxySequenceReader * @param index Currently not used * @return */ @Override public AbstractSequence<NucleotideCompound> getSequence( ProxySequenceReader<NucleotideCompound> proxyLoader, long index) { return new DNASequence(proxyLoader, compoundSet); }
/** * Returns the DNASequence or null if one can't be created * @param str * @return */ private static DNASequence getDNASequence(String str) { try { DNASequence s = new DNASequence(str); return s; } catch (CompoundNotFoundException e) { logger.error("Unexpected error when creating DNASequence ",e); } return null; }
new ProteinDNA(new DNASequence("SOME STRING"), num);
/** Converts the DNA sequence to protein sequence. * * @param dnaSequence the DNA sequence * * @return the protein sequence */ public static ProteinSequence convertDNAtoProteinSequence(String dnaSequence) throws CompoundNotFoundException { DNASequence dna = new DNASequence(dnaSequence); return convertDNAtoProteinSequence(dna); }
/** * Even though we are passing in the sequence we really only care about the length of the sequence and the offset * index in the fasta file. * @param sequence * @param index * @return * @throws CompoundNotFoundException * @throws IOException */ @Override public AbstractSequence<NucleotideCompound> getSequence(String sequence, long index ) throws CompoundNotFoundException, IOException { SequenceFileProxyLoader<NucleotideCompound> sequenceFileProxyLoader = new SequenceFileProxyLoader<NucleotideCompound>( file, sequenceParser, index, sequence.length(), compoundSet); return new DNASequence(sequenceFileProxyLoader, compoundSet); }
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; }
public static void main(String[] args) throws Exception { DNASequence dnaSequence = new DNASequence("ATCG"); logger.info("DNA Sequence: {}", dnaSequence.toString()); StringProxySequenceReader<NucleotideCompound> sequenceStringProxyLoader = new StringProxySequenceReader<NucleotideCompound>("GCTA", DNACompoundSet.getDNACompoundSet()); DNASequence dnaSequenceFromProxy = new DNASequence(sequenceStringProxyLoader); logger.info("DNA Sequence from Proxy: {}", dnaSequenceFromProxy.toString()); } }
public static void main(String[] args) throws Exception { DNASequence dnaSequence = new DNASequence("ATCG"); logger.info("DNA Sequence: {}", dnaSequence.toString()); StringProxySequenceReader<NucleotideCompound> sequenceStringProxyLoader = new StringProxySequenceReader<NucleotideCompound>("GCTA", DNACompoundSet.getDNACompoundSet()); DNASequence dnaSequenceFromProxy = new DNASequence(sequenceStringProxyLoader); logger.info("DNA Sequence from Proxy: {}", dnaSequenceFromProxy.toString()); } }
public Sequence<?> getSequenceFromString(String sequence) throws CompoundNotFoundException { if( isNucleotideSequence(sequence)) { return new DNASequence(sequence); } else { return new ProteinSequence(sequence); } }
public Sequence<?> getSequenceFromString(String sequence) throws CompoundNotFoundException { if( isNucleotideSequence(sequence)) { return new DNASequence(sequence); } else { return new ProteinSequence(sequence); } }
private Sequence getSequence(String gappedSequenceString){ if (gappedSequenceString == null) return null; Sequence returnSeq = null; String sequenceString = gappedSequenceString.replace("-", ""); try { if (sequenceString.matches("^[ACTG]+$")) returnSeq = new DNASequence(sequenceString, DNACompoundSet.getDNACompoundSet()); else if (sequenceString.matches("^[ACUG]+$")) returnSeq = new RNASequence(sequenceString, DNACompoundSet.getDNACompoundSet()); else returnSeq = new ProteinSequence(sequenceString, AminoAcidCompoundSet.getAminoAcidCompoundSet()); } catch (CompoundNotFoundException ex) { logger.error("Unexpected error, could not find compound when creating Sequence object from Hsp", ex); } return returnSeq; }
/** * Create and return a new {@link DNASequence} from the specified FASTQ formatted sequence. * * @param fastq FASTQ formatted sequence, must not be null * @return a new {@link DNASequence} from the specified FASTQ formatted sequence * @throws CompoundNotFoundException if DNA sequence in fastq contains unrecognised compounds */ public static DNASequence createDNASequence(final Fastq fastq) throws CompoundNotFoundException { if (fastq == null) { throw new IllegalArgumentException("fastq must not be null"); } DNASequence sequence = new DNASequence(fastq.getSequence()); sequence.setOriginalHeader(fastq.getDescription()); return sequence; }
private Sequence getSequence(String gappedSequenceString){ if (gappedSequenceString == null) return null; Sequence returnSeq = null; String sequenceString = gappedSequenceString.replace("-", ""); try { if (sequenceString.matches("^[ACTG]+$")) returnSeq = new DNASequence(sequenceString, DNACompoundSet.getDNACompoundSet()); else if (sequenceString.matches("^[ACUG]+$")) returnSeq = new RNASequence(sequenceString, DNACompoundSet.getDNACompoundSet()); else returnSeq = new ProteinSequence(sequenceString, AminoAcidCompoundSet.getAminoAcidCompoundSet()); } catch (CompoundNotFoundException ex) { logger.error("Unexpected error, could not find compound when creating Sequence object from Hsp", ex); } return returnSeq; }
/** * 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; }
/** * * @param list * @return */ @Override public AbstractSequence<NucleotideCompound> getSequence( List<NucleotideCompound> list) { ArrayListProxySequenceReader<NucleotideCompound> store = new ArrayListProxySequenceReader<NucleotideCompound>(); store.setCompoundSet(compoundSet); store.setContents(list); return new DNASequence(store); } }
/** * * @param list * @return */ @Override public AbstractSequence<NucleotideCompound> getSequence( List<NucleotideCompound> list) { ArrayListProxySequenceReader<NucleotideCompound> store = new ArrayListProxySequenceReader<NucleotideCompound>(); store.setCompoundSet(compoundSet); store.setContents(list); return new DNASequence(store); } }