forked from Serulab/Py4Bio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sebastian Bassi
committed
Jul 10, 2017
1 parent
f8cd09a
commit aac8104
Showing
8 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import re | ||
regex = re.compile(' |\d|\n|\t') | ||
seq = '' | ||
for line in open('../../samples/pMOSBlue.txt'): | ||
seq += regex.sub('', line) | ||
print(seq) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import re, sys | ||
myregex = re.compile(sys.argv[2]) | ||
i = 0 | ||
with open(sys.argv[1]) as fh: | ||
for line in fh: | ||
i += len(myregex.findall(line)) | ||
print(i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import re | ||
regex = re.compile("(?:GC){3,}") | ||
seq = 'ATGATCGTACTGCGCGCTTCATGTGATGCGCGCGCGCAGACTATAAG' | ||
print('Before: {0}'.format(seq)) | ||
print('After: {0}'.format(regex.sub('', seq))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import re | ||
seq = "ATATAAGATGCGCGCGCTTATGCGCGCA" | ||
rgx = re.compile("TAT") | ||
i = 1 | ||
for mo in rgx.finditer(seq): | ||
print('Ocurrence {0}: {1}'.format(i, mo.group())) | ||
print('Position: From {0} to {1}'.format(mo.start(), | ||
mo.end())) | ||
i += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import re, sys | ||
myregex = re.compile(sys.argv[2]) | ||
counter = 0 | ||
with open(sys.argv[1]) as fh: | ||
for line in fh: | ||
if myregex.search(line): | ||
counter += 1 | ||
print(counter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import re | ||
pattern = "[LIVM]{2}.RL[DE].{4}RLE" | ||
with open('../../samples/Q5R5X8.fas') as fh: | ||
fh.readline() # Discard the first line. | ||
seq = "" | ||
for line in fh: | ||
seq += line.strip() | ||
rgx = re.compile(pattern) | ||
result = rgx.search(seq) | ||
patternfound = result.group() | ||
span = result.span() | ||
leftpos = span[0]-10 | ||
if leftpos<0: | ||
leftpos = 0 | ||
print(seq[leftpos:span[0]].lower() + patternfound + | ||
seq[span[1]:span[1]+10].lower()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
>Q5R5X8|CAP2_PONPY CAP 2 - Pongo pygmaeus (Orangutan). | ||
MANMQGLVERLERAVSRLESLSAESHRPPGNCGEVNGVIGGVAPSVEAFDKLMDSMVAEF | ||
LKNSRILAGDVETHAEMVHSAFQAQRAFLLMASQYQQPHENDVAALLKPISEKIQEIQTF | ||
RERNRGSNMFNHLSAVSESIPALGWIAVSPKPGPYVKEMNDAATFYTNRVLKDYKHSDLR | ||
HVDWVKSYLNIWSELQAYIKEHHTTGLTWSKTGPVASTVSAFSVLSSGPGLPPPPPPPPP | ||
PGPPPLLENEGKKEESSPSRSALFAQLNQGEAITKGLRHVTDDQKTYKNPSLRAQGGQTR | ||
SPTKSHTPSPTSPKSYPSQKHAPVLELEGKKWRVEYQEDRNDLVISETELKQVAYIFKCE | ||
KSTLQIKGKVNSIIIDNCKKLGLVFDNVVGIVEVINSQDIQIQVMGRVPTISINKTEGCH | ||
IYLSEDALDCEIVSAKSSEMNILIPQDGDYREFPIPEQFKTAWDGSKLITEPAEIMA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
1 ATGACCATGA TTACGCCAAG CTCTAATACG ACTCACTATA GGGAAAGCTT GCATGCCTGC | ||
|
||
61 AGGTCGACTC TAGAGGATCT ACTAGTCATA TGGATATCGG ATCCCCGGGT ACCGAGCTCG | ||
|
||
121 AATTCACTGG CCGTCGTTTT |