Esempio n. 1
0
class RNA(Polynucleotide):
    alphabet_dict = {'strict':IUPACUnambiguousRNA(),'permissive':IUPACAmbiguousRNA()}

    def get_dna(self,*args,**kwargs):
        return self.convert_sequence(*args,**kwargs).back_transcribe()

    def get_rna(self,*args,**kwargs):
        return self.convert_sequence(*args,**kwargs)

    def get_protein(self,*args,**kwargs):
        return self.translate(*args,**kwargs)
Esempio n. 2
0
def seqcategory(oneseq):
    seqtype=''
    seqDNA=Seq(oneseq,IUPACAmbiguousDNA()) #Produce a sequence using the string received and the DNA alphabet.
    seqRNA=Seq(oneseq,IUPACAmbiguousRNA()) #Produce a sequence using the string received and the RNA alphabet.
    seqProt=Seq(oneseq,ExtendedIUPACProtein()) #Produce a sequence using the string received and the protein alphabet.
    if Alphabet._verify_alphabet(seqDNA): #Verify if is a DNA sequence.
        seqtype='DNA'
    elif Alphabet._verify_alphabet(seqRNA): #Verify if is a RNA sequence.
        seqtype='RNA'
    else:
        if Alphabet._verify_alphabet(seqProt): #Verify if is a protein sequence.
            seqtype='protein'
        else:
            seqtype='noseq' #If any, is not a valid sequence.
    return seqtype
parser.add_argument('-pw',
                    '--pwa-width',
                    type=int,
                    default='60',
                    help='pairwise alignment output width')
args = parser.parse_args()

for file in (args.query_seq, args.target_seq):
    if not path.isfile(file):
        parser.error("File %s doesn't exist" % file)

# alphabet
if args.seq_type == 'dna':
    args.seq_abc = IUPACAmbiguousDNA()
elif args.seq_type == 'rna':
    args.seq_abc = IUPACAmbiguousRNA()
else:
    args.seq_abc = ExtendedIUPACProtein()

# Aligners setup
aligners = {'global': PairwiseAligner(), 'local': None}
aligners['global'].mode = 'global'
if args.seq_type in ('dna', 'rna'):
    aligners['global'].match = args.match_score
    aligners['global'].mismatch = args.mismatch_score
    if not args.open_gap_score:
        args.open_gap_score = -5
    if not args.extend_gap_score:
        args.extend_gap_score = -2
else:
    sub_matrix = getattr(import_module('Bio.SubsMat.MatrixInfo'),