Skip to content

Commit

Permalink
refine Oct24
Browse files Browse the repository at this point in the history
  • Loading branch information
Aone committed Oct 24, 2016
1 parent f8c863c commit 539912b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 27 deletions.
41 changes: 20 additions & 21 deletions ATGC.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ def seq(x,y):
elif i == 'c': comp.append('g')
elif i == 'U': comp.append('A')
elif i == 'u': comp.append('a')
if y == 'c' or y == 'C':
if y.upper() == 'C':
return ''.join(comp)
if y == 'r' or y == 'R':
if y.upper() == 'R':
return ''.join(x)[::-1]
if y == 'rc' or y == 'RC':
if y.upper() == 'RC':
return ''.join(comp)[::-1]
else:return ''.join(x)

Expand All @@ -31,39 +31,38 @@ def seq(x,y):

#def get list from input or file
def add(x):
s = []
n = len(x)
#get list
for i in range(n):
if x[i] in base:
ins.append(x[i])
s.append(x[i])
#RNA sequence "U" warning
if 'U' in ins or 'u' in ins:
if 'U' in s or 'u' in s:
print '!!!The sequence contains "U" or "u", Using A:U pair!!!'
return s

####MAIN####
#from file (arguments)
try:
import sys
in_file = sys.argv[1]
inf = open(in_file,'r')
out_file = sys.argv[2]
outf = open(out_file,'w')
s = sys.argv[3]
ins = []
a = inf.read()
add(a)
outf.writelines(seq(ins,s))
in_file = open(sys.argv[1])
out_file = open(sys.argv[2], 'w')
mode = sys.argv[3]
content = in_file.read()
sequence = add(content)
out_file.writelines(seq(sequence, mode))
out_file.close()

#from raw input
except:
except IndexError:
while True:
a = raw_input('Enter the input sequence:')
if not a:break
content = raw_input('Enter the input sequence:')
if not content: break
#kind of output
b = raw_input('Reverse(r) or Complement(c) or Reverse Complement(rc):')
ins = []
add(a)
print seq(ins,b)
mode = raw_input('Reverse(r) or Complement(c) or Reverse Complement(rc):')
sequence = add(content)
print seq(sequence, mode)

################ END ################
# Created by Aone #
Expand Down
3 changes: 1 addition & 2 deletions bowtie2_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ def paried(self,left,right):
###
class mapping:
def __init__(self):
pass

pass
# help_message() print help message for this pipeline
def help_message():
print '''##########
Expand Down
1 change: 0 additions & 1 deletion bwa_aln_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def paired_end(x,left,right,o):
rmdup = '-S'
paired_end(args[0],args[1],args[2],output)


###
# SAM to BAM
cmd = 'samtools view -S -b %s > %s.bam' % (sam,output)
Expand Down
4 changes: 2 additions & 2 deletions cuffmerge_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ def cuffdiff(l,b):

# cuffmerge
txt = './list.txt'
cmd = cuffmerge(args[0],args[1],txt)
cmd = cuffmerge(args[0], args[1], txt)
os.system(cmd)

# cuffdiff
cmd = cuffdiff(label,bam)
cmd = cuffdiff(label, bam)
os.system(cmd)

################ END ################
Expand Down
1 change: 1 addition & 0 deletions overlap_intersectBed.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def intersect(g,p,o,r):
for line in open(bed_result,'r'):
a = line.split('\t')
f.writelines(a[4]+'\t'+a[5])
f.close()
os.system('rm %s.bed' % output)

################ END ################
Expand Down
2 changes: 1 addition & 1 deletion translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def add(x):
except:pass

#from raw input
except:
except IndexError:
while True:
a = raw_input('Enter the input sequence:')
if not a:break
Expand Down

0 comments on commit 539912b

Please sign in to comment.