/** * * @param sequence * @param index * @return * @throws CompoundNotFoundException */ @Override public AbstractSequence<NucleotideCompound> getSequence(String sequence, long index) throws CompoundNotFoundException { return new RNASequence(sequence, compoundSet); } /**
/** Converts the DNA sequence to protein sequence. * * @param dnaSequence the DNA sequence * * @return the protein sequence */ public static ProteinSequence convertDNAtoProteinSequence(DNASequence dnaSequence) throws CompoundNotFoundException { RNASequence mRNA = dnaSequence.getRNASequence(); return mRNA.getProteinSequence(); } }
/** * Get reverse complement view of the sequence * @return */ public SequenceView<NucleotideCompound> getReverseComplement() { return new ComplementSequenceView<NucleotideCompound>(getInverse()); }
/** * * @param sequence * @param index * @return * @throws CompoundNotFoundException */ @Override public AbstractSequence<NucleotideCompound> getSequence(String sequence, long index) throws CompoundNotFoundException { return new RNASequence(sequence, compoundSet); } /**
/** * Get the ProteinSequence from the RNA sequence * @return */ public ProteinSequence getProteinSequence() { return getProteinSequence(TranscriptionEngine.getDefault()); }
/** * Get reverse complement view of the sequence * @return */ public SequenceView<NucleotideCompound> getReverseComplement() { return new ComplementSequenceView<NucleotideCompound>(getInverse()); }
private static boolean isRNASequence(String str) { try { new RNASequence(str); } catch (CompoundNotFoundException e) { return false; } return true; }
/** * Get the ProteinSequence from the RNA sequence * @return */ public ProteinSequence getProteinSequence() { return getProteinSequence(TranscriptionEngine.getDefault()); }
/** * * @param proxyLoader * @param index * @return */ @Override public AbstractSequence<NucleotideCompound> getSequence( ProxySequenceReader<NucleotideCompound> proxyLoader, long index) { return new RNASequence(proxyLoader, compoundSet); } /**
public static void main(String[] args) throws Exception { LinkedHashMap<String, DNASequence> dnaSequences = GenbankReaderHelper.readGenbankDNASequence(new File("src/test/resources/NM_000266.gb"), true); for (DNASequence sequence : dnaSequences.values()) { logger.info("DNA Sequence: {}", sequence.getRNASequence().getProteinSequence().getSequenceAsString()); } LinkedHashMap<String, ProteinSequence> proteinSequences = GenbankReaderHelper.readGenbankProteinSequence(new File("src/test/resources/BondFeature.gb"), true); for (ProteinSequence sequence : proteinSequences.values()) { logger.info("Protein Sequence: {}", sequence.getSequenceAsString()); } } }
/** * * @param proxyLoader * @param index * @return */ @Override public AbstractSequence<NucleotideCompound> getSequence( ProxySequenceReader<NucleotideCompound> proxyLoader, long index) { return new RNASequence(proxyLoader, compoundSet); } /**
public static void main(String[] args) throws Exception { LinkedHashMap<String, DNASequence> dnaSequences = FastaReaderHelper.readFastaDNASequence(new File("fasta.fna")); for (DNASequence sequence : dnaSequences.values()) { sequence.getRNASequence().getProteinSequence().getSequenceAsString(); } } }
/** * Returns the RNASequence or null if one can't be created * @param str * @return */ private static RNASequence getRNASequence(String str) { try { RNASequence s = new RNASequence(str); return s; } catch (CompoundNotFoundException e) { logger.error("Unexpected error when creating RNASequence ",e); } return null; }
public static void main(String[] args) throws Exception { LinkedHashMap<String, DNASequence> dnaSequences = GenbankReaderHelper.readGenbankDNASequence(new File("src/test/resources/NM_000266.gb"), true); for (DNASequence sequence : dnaSequences.values()) { logger.info("DNA Sequence: {}", sequence.getRNASequence().getProteinSequence().getSequenceAsString()); } LinkedHashMap<String, ProteinSequence> proteinSequences = GenbankReaderHelper.readGenbankProteinSequence(new File("src/test/resources/BondFeature.gb"), true); for (ProteinSequence sequence : proteinSequences.values()) { logger.info("Protein Sequence: {}", sequence.getSequenceAsString()); } } }
/** * Takes in the given DNA Sequence and returns an instance of RNASequence * which is using {@link RnaSequenceView} as a * {@link ProxySequenceReader}. */ protected RNASequence wrapToRna(Sequence<NucleotideCompound> dna) { ProxySequenceReader<NucleotideCompound> rnaView = new RnaSequenceView(dna); return new RNASequence(rnaView); }
public static void main(String[] args) throws Exception { LinkedHashMap<String, DNASequence> dnaSequences = FastaReaderHelper.readFastaDNASequence(new File("fasta.fna")); for (DNASequence sequence : dnaSequences.values()) { sequence.getRNASequence().getProteinSequence().getSequenceAsString(); } } }
/** * Takes in the given DNA Sequence and returns an instance of RNASequence * which is using {@link RnaSequenceView} as a * {@link ProxySequenceReader}. */ protected RNASequence wrapToRna(Sequence<NucleotideCompound> dna) { ProxySequenceReader<NucleotideCompound> rnaView = new RnaSequenceView(dna); return new RNASequence(rnaView); }
ProteinSequence proteinSequence = rnaCodingSequence.getProteinSequence(TranscriptionEngine.getDefault()); proteinSequence.setAccession(new AccessionID(cdsSequence.getAccession().getID())); proteinSequence.setParentDNASequence(cdsSequence, 1, cdsSequence.getLength());
/** * 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 RNASequence(sequenceFileProxyLoader, compoundSet); }