Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this user
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
annaldasula
/
isoform_differentiation
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
0
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security
Insights
Files
e3098e6
test
README.md
Snakefile
filter_transcripts.py
filter_utr.py
gene_transcripts.py
genes.tab
interproscan_analysis.py
iso_diff.py
isoform_r.ipynb
isoform_transcripts.ipynb
iupred2a_analysis.py
plotIsoforms.py
protein_transcript_sequences.sh
sashimi-plot.py
sgseq_transcripts.Rmd
shortReadStats.R
transcript_analysis.py
transcript_stats.py
translation_protein.py
utr_regions.py
Breadcrumbs
isoform_differentiation
/
filter_utr.py
Copy path
Blame
Blame
Latest commit
History
History
53 lines (45 loc) · 1.57 KB
Breadcrumbs
isoform_differentiation
/
filter_utr.py
Top
File metadata and controls
Code
Blame
53 lines (45 loc) · 1.57 KB
Raw
from Bio import SeqIO utr_sequences = open(snakemake.input[0], "r") utr_lines = utr_sequences.readlines() utr_sequences.close() trans_utr = dict() for line in utr_lines: if (line.startswith(">")): trans_id = line[1:].strip() if (trans_id not in trans_utr): trans_utr[trans_id] = [] else: trans_utr[trans_id].append(line.strip()) transcripts_filename = snakemake.input[1] transcripts = SeqIO.index(transcripts_filename, "fasta") output = [] for transcript in transcripts: transcript_id = str(transcripts[transcript].id).split("|")[-1].strip() seq = str(transcripts[transcript].seq) try: if transcript_id in trans_utr: for utr in trans_utr[transcript_id]: pos = seq.find(utr) if (pos != -1): seq = seq[:pos] + seq[pos + len(utr):] long_seq = seq else: long_seq_len = 0 long_seq = "" for t in trans_utr: s = seq seq_len = len(trans_utr[t]) if (seq_len > long_seq_len): long_seq_len = seq_len for utr in trans_utr[t]: pos = s.find(utr) if (pos != -1): s = s[:pos] + s[pos + len(utr):] long_seq = s except: long_seq = seq output.append(">" + str(transcripts[transcript].id)) output.append(long_seq) output_file = open(snakemake.output[0],"w+") output_file.write("\n".join(output)) output_file.close()
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
You can’t perform that action at this time.