/** * * @param sequence * @param index * @return * @throws CompoundNotFoundException */ @Override public AbstractSequence<NucleotideCompound> getSequence(String sequence, long index) throws CompoundNotFoundException { return new RNASequence(sequence, compoundSet); } /**
/** * * @param sequence * @param index * @return * @throws CompoundNotFoundException */ @Override public AbstractSequence<NucleotideCompound> getSequence(String sequence, long index) throws CompoundNotFoundException { return new RNASequence(sequence, compoundSet); } /**
private static boolean isRNASequence(String str) { try { new RNASequence(str); } catch (CompoundNotFoundException e) { return false; } return true; }
/** * * @param proxyLoader * @param index * @return */ @Override public AbstractSequence<NucleotideCompound> getSequence( ProxySequenceReader<NucleotideCompound> proxyLoader, long index) { return new RNASequence(proxyLoader, compoundSet); } /**
/** * * @param proxyLoader * @param index * @return */ @Override public AbstractSequence<NucleotideCompound> getSequence( ProxySequenceReader<NucleotideCompound> proxyLoader, long index) { return new RNASequence(proxyLoader, compoundSet); } /**
/** * 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; }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
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; }
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; }
seq = fileAnnotation.isPFam() ? new ProteinSequence(sequence) : new RNASequence(sequence); else if (forcedSequenceType.equals(PFAM)) seq = new ProteinSequence(sequence); else seq = new RNASequence(sequence); } catch (CompoundNotFoundException e) { logger.warn("Could not create sequence because of unknown compounds ({}). Sequence {} will be ignored.",e.getMessage(),sequencename);
seq = fileAnnotation.isPFam() ? new ProteinSequence(sequence) : new RNASequence(sequence); else if (forcedSequenceType.equals(PFAM)) seq = new ProteinSequence(sequence); else seq = new RNASequence(sequence); } catch (CompoundNotFoundException e) { logger.warn("Could not create sequence because of unknown compounds ({}). Sequence {} will be ignored.",e.getMessage(),sequencename);
/** * * @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 RNASequence(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 RNASequence(store); } }
private Sequence<NucleotideCompound> getNucleotideSequence(String seq) { Sequence<NucleotideCompound> s = null; // first we try DNA, then RNA, them hybrid try { s = new DNASequence(seq, AmbiguityDNACompoundSet.getDNACompoundSet()); } catch (CompoundNotFoundException e){ try { s= new RNASequence(seq, AmbiguityRNACompoundSet.getRNACompoundSet()); } catch (CompoundNotFoundException ex) { try { // it could still be a hybrid, e.g. 3hoz, chain T, what to do in that case? s = new DNASequence(seq, AmbiguityDNARNAHybridCompoundSet.getDNARNAHybridCompoundSet()); logger.warn("Hybrid RNA/DNA sequence detected for sequence {}", seq); } catch (CompoundNotFoundException exc) { // not DNA, nor RNA, nor hybrid logger.warn("Could not determine compound set (neither DNA, RNA nor hybrid) for nucleotide sequence " + seq); return null; } } } return s; }
s1 = new RNASequence(seq1,AmbiguityRNACompoundSet.getRNACompoundSet()); } catch (CompoundNotFoundException ex) { logger.warn("Could not align DNA and RNA compound sets: " + seq1); s2 = new RNASequence(seq2,AmbiguityRNACompoundSet.getRNACompoundSet()); } catch (CompoundNotFoundException ex) { logger.warn("Could not align DNA and RNA compound sets: " + seq2);