Example #1
0
	def test_YDR114C(self):
		"""Maximum number of iterations prevents overlong searches"""
		pp = self.pp
		# This sequence takes an eternity to search for pI.
		pp = protprop.ProteinProperties()
		ydr = "MPLFARLCQPQSRRMFSSISSFSALSVLRPQTGMLLNSSPLKTPSFTPLGFGLIGQRRWKSRGNTYQPSTLKRKRTFGFLARAKSKQGSKILKRRKLKGRWFLSH"
		pI = pp.getIsoelectricPoint(ydr)
		charge = pp.getCharge(ydr, pH=7.2)
Example #2
0
	def test_comp_counts(self):
		"""Composition and motifs with skips"""
		comp = protprop.Composition()
		pp = protprop.ProteinProperties()
		aa_classes = ['FY','P','NQ']
		for xi in range(5):
			seq = genMotif(aa_classes, [(0,2),(1,1),(2,2),(0,2),(1,1),(2,2)])
			counts = pp.counts(seq, aa_classes)
			self.assertTrue(counts==[4,2,4])
Example #3
0
	def test_run_skip(self):
		"""Composition and motifs with skips"""
		comp = protprop.Composition()
		pp = protprop.ProteinProperties()
		aa_classes = ['FY','P','NQ']
		for xi in range(5):
			seq = genMotif(aa_classes, [(0,2),(1,1),(2,2),(0,2),(1,1),(2,2)])
			self.assertTrue(pp.count(seq, 'FY')==4)
			mot = pp.motif(seq, ['FY','NQ'])
			#print seq, mot
			self.assertTrue(mot=='aabbaabb')
Example #4
0
	def test_alldistcount(self):
		"""Number of distances for all distances"""
		comp = protprop.Composition()
		pp = protprop.ProteinProperties()
		aa_classes = ['A']
		aa = aa_classes[0]
		for xi in range(2,10):
			seq = ''.join(aa*xi)
			#print seq
			dists = pp.allDistances(seq, aa)
			self.assertTrue(len(dists[aa])==stats.Choose(xi,2))
Example #5
0
	def test_neardist(self):
		"""Nearest distances"""
		comp = protprop.Composition()
		pp = protprop.ProteinProperties()
		aa_classes = ['FY','P','NQ']
		for xi in range(5):
			seq = genMotif(aa_classes, [(0,2),(1,1),(2,2),(0,2),(1,1),(2,2)])
			#print seq
			dists = pp.nearestDistances(seq, aa_classes)
			#print dists
			hist = stats.Histogram(vals=dists['FY'], n_bins=7, min_val=-0.5,max_val=6.5)
			#print hist
			self.assertTrue(hist[1].count==2)
			self.assertTrue(hist[4].count==1)
			self.assertTrue(hist[2].count==0)
Example #6
0
	def test_alldist(self):
		"""All distances"""
		comp = protprop.Composition()
		pp = protprop.ProteinProperties()
		aa_classes = ['FY','P','NQ']
		for xi in range(5):
			seq = genMotif(aa_classes, [(0,2),(1,1),(2,2),(0,2),(1,1),(2,2)])
			#print seq
			dists = pp.allDistances(seq, aa_classes)
			#print dists
			hist = stats.Histogram(vals=dists['FY'], n_bins=7, min_val=-0.5,max_val=6.5)
			#print hist
			self.assertTrue(hist[1].count==2)
			self.assertTrue(hist[4].count==1)
			self.assertTrue(hist[2].count==0)
			answer = [1, 5, 6, 4, 5, 1]
			for (a,b) in zip(dists['FY'], answer):
				self.assertTrue(a==b)
Example #7
0
	def setUp(self):
		self.pp = protprop.ProteinProperties()
Example #8
0
                        help="translate the input sequences?")
    parser.add_argument("--pH",
                        dest="pH",
                        type=float,
                        default=7.2,
                        help="pH for charge determination")
    options = parser.parse_args()

    outs = util.OutStreams()
    if not options.out_fname is None:
        outf = file(os.path.expanduser(options.out_fname), 'w')
        outs.addStream(outf)
    else:
        outs.addStream(sys.stdout)

    pp = protprop.ProteinProperties()
    if not options.sequence is None:
        if options.translate:
            seq = translate.translateRaw(options.sequence)
        else:
            seq = options.sequence
        seq_dict = {"input": seq}
    else:
        # Load from FASTA
        seq_dict = biofile.readFASTADict(options.in_fname)
        if options.translate:
            for k in seq_dict.keys():
                seq_dict[k] = translate.translate(seq_dict[k])

    outs.write("# {}\n".format(options))
    outs.write("pos\taa\tcharge\n")
Example #9
0
 def __init__(self):
     self._prop = protprop.ProteinProperties()