Repository navigation
Expand file tree
/
Copy pathRNASequence.java
More file actions
133 lines (120 loc) · 3.88 KB
/
Copy pathRNASequence.java
File metadata and controls
133 lines (120 loc) · 3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
* BioJava development code
*
* This code may be freely distributed and modified under the
* terms of the GNU Lesser General Public Licence. This should
* be distributed with the code. If you do not have a copy,
* see:
*
* http://www.gnu.org/copyleft/lesser.html
*
* Copyright for this code is held jointly by the individual
* authors. These should be listed in @author doc comments.
*
* For more information on the BioJava project and its aims,
* or to join the biojava-l mailing list, visit the home page
* at:
*
* http://www.biojava.org/
*
* Created on DATE
*
*/
package org.biojava.nbio.core.sequence;
/**
* @author Scooter Willis
*
*/
import org.biojava.nbio.core.exceptions.CompoundNotFoundException;
import org.biojava.nbio.core.sequence.compound.NucleotideCompound;
import org.biojava.nbio.core.sequence.compound.RNACompoundSet;
import org.biojava.nbio.core.sequence.template.AbstractSequence;
import org.biojava.nbio.core.sequence.template.CompoundSet;
import org.biojava.nbio.core.sequence.template.ProxySequenceReader;
import org.biojava.nbio.core.sequence.template.SequenceView;
import org.biojava.nbio.core.sequence.transcription.TranscriptionEngine;
import org.biojava.nbio.core.sequence.views.ComplementSequenceView;
import org.biojava.nbio.core.sequence.views.ReversedSequenceView;
/**
* RNASequence where RNACompoundSet are the allowed values
* @author Scooter Willis <willishf at gmail dot com>
*/
public class RNASequence extends AbstractSequence<NucleotideCompound> {
/**
* Create a RNA sequence from a String
* @param seqString
* @throws CompoundNotFoundException
*/
public RNASequence(String seqString) throws CompoundNotFoundException {
super(seqString, RNACompoundSet.getRNACompoundSet());
}
/**
* Create a RNA aequence from a proxy reader
* @param proxyLoader
*/
public RNASequence(ProxySequenceReader<NucleotideCompound> proxyLoader) {
super(proxyLoader, RNACompoundSet.getRNACompoundSet());
}
/**
* Create a RNA sequence from a string with a user defined RNA compound set
* @param seqString
* @param compoundSet
* @throws CompoundNotFoundException
*/
public RNASequence(String seqString, CompoundSet<NucleotideCompound> compoundSet) throws CompoundNotFoundException {
super(seqString, compoundSet);
}
/**
* Create a RNA sequence from a proxy reader and user defined RNA compound set
* @param proxyLoader
* @param compoundSet
*/
public RNASequence(ProxySequenceReader<NucleotideCompound> proxyLoader,
CompoundSet<NucleotideCompound> compoundSet) {
super(proxyLoader, compoundSet);
}
/**
* Get reverse complement view of the sequence
* @return
*/
public SequenceView<NucleotideCompound> getReverseComplement() {
return new ComplementSequenceView<NucleotideCompound>(getInverse());
}
/**
* Get the inverse view of the sequence. It is the reverse sequence from
* end to begin where use reverse could imply complement. Called getInverse()
* in the hopes of making less confusing.
* @return
*/
@Override
public SequenceView<NucleotideCompound> getInverse() {
return new ReversedSequenceView<NucleotideCompound>(this);
}
/**
* Get the complement view of the RNA sequence
* @return
*/
public SequenceView<NucleotideCompound> getComplement() {
return new ComplementSequenceView<NucleotideCompound>(this);
}
/**
* Get the ProteinSequence from the RNA sequence
* @return
*/
public ProteinSequence getProteinSequence() {
return getProteinSequence(TranscriptionEngine.getDefault());
}
/**
* Get the ProteinSequene from the RNA sequence with user defined
* transcription engine
*
* @param engine
* @return
*/
public ProteinSequence getProteinSequence(TranscriptionEngine engine) {
return (ProteinSequence)engine.getRnaAminoAcidTranslator().createSequence(this);
}
public double getGC() {
throw new UnsupportedOperationException("Not supported yet");
}
}