Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
Imamachi-n committed Feb 8, 2017
1 parent ed51bbc commit dc2744d
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 1 deletion.
1 change: 1 addition & 0 deletions RNA-seq_Tutorial/RNA-seq_unstr_single-end_2_edgeR_calc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ Yes

# Add Annotation
python2 ~/custom_command/annotate_gene_symbol_type.py ${annoList} ${saveDir}/edgeR_test_result.txt ${saveDir}/edgeR_test_result_anno_plus.txt
python2 ~/custom_command/split_into_each_gene_type.py ${saveDir}/edgeR_test_result_anno_plus.txt
61 changes: 61 additions & 0 deletions RNA-seq_Tutorial/split_into_each_gene_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env python2

from __future__ import print_function
import sys
import os

input_file = open(sys.argv[1], 'r')

output_filename_core = os.path.splitext(sys.argv[1])[0]
mRNA_output_file = open(output_filename_core + '_mRNA.txt', 'w')
lncRNA_output_file = open(output_filename_core + '_lncRNA.txt', 'w')
pseudogene_output_file = open(output_filename_core + '_pseudogene.txt', 'w')
others_output_file = open(output_filename_core + '_others.txt', 'w')
Akimitsu_eRNA_output_file = open(output_filename_core + '_Akimitsu_eRNA.txt', 'w')
FANTOM5_eRNA_output_file = open(output_filename_core + '_FANTOM5_eRNA.txt', 'w')
Akimitsu_PROMPT_output_file = open(output_filename_core + '_Akimitsu_PROMPT.txt', 'w')

header_flg = 0
mRNA_counter = 1
lncRNA_counter = 1
pseudogene_counter = 1
others_counter = 1
Akimitsu_eRNA_counter = 1
FANTOM5_eRNA_counter = 1
Akimitsu_PROMPT_counter = 1

for line in input_file:
line = line.rstrip()
data = line.split("\t")
if header_flg == 0:
print("gr_id", line, sep="\t", end="\n", file=mRNA_output_file)
print("gr_id", line, sep="\t", end="\n", file=lncRNA_output_file)
print("gr_id", line, sep="\t", end="\n", file=pseudogene_output_file)
print("gr_id", line, sep="\t", end="\n", file=others_output_file)
print("gr_id", line, sep="\t", end="\n", file=Akimitsu_eRNA_output_file)
print("gr_id", line, sep="\t", end="\n", file=FANTOM5_eRNA_output_file)
print("gr_id", line, sep="\t", end="\n", file=Akimitsu_PROMPT_output_file)
header_flg = 1
continue
gene_type = data[2]
if gene_type == 'mRNA':
print(mRNA_counter, line, sep="\t", end="\n", file=mRNA_output_file)
mRNA_counter += 1
elif gene_type == 'lncRNA':
print(lncRNA_counter, line, sep="\t", end="\n", file=lncRNA_output_file)
lncRNA_counter += 1
elif gene_type == 'pseudogene':
print(pseudogene_counter, line, sep="\t", end="\n", file=pseudogene_output_file)
pseudogene_counter += 1
elif gene_type == 'others':
print(others_counter, line, sep="\t", end="\n", file=others_output_file)
others_counter += 1
elif gene_type == 'Akimitsu_eRNA':
print(Akimitsu_eRNA_counter, line, sep="\t", end="\n", file=Akimitsu_eRNA_output_file)
Akimitsu_eRNA_counter += 1
elif gene_type == 'FANTOM5_eRNA':
print(FANTOM5_eRNA_counter, line, sep="\t", end="\n", file=FANTOM5_eRNA_output_file)
FANTOM5_eRNA_counter += 1
elif gene_type == 'Akimitsu_PROMPT':
print(Akimitsu_PROMPT_counter, line, sep="\t", end="\n", file=Akimitsu_PROMPT_output_file)
Akimitsu_PROMPT_counter += 1
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ ${saveDir} \
Yes

# Add Annotation
python2 ~/custom_command/annotate_gene_symbol_type.py ${annoList} ${saveDir}/edgeR_test_result.txt ${saveDir}/edgeR_test_result_anno_plus.txt
python2 ~/custom_command/annotate_gene_symbol_type.py ${annoList} ${saveDir}/edgeR_test_result.txt ${saveDir}/edgeR_test_result_anno_plus.txt
python2 ~/custom_command/split_into_each_gene_type.py ${saveDir}/edgeR_test_result_anno_plus.txt
61 changes: 61 additions & 0 deletions Strand-specific_RNA-seq_Tutorial/split_into_each_gene_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env python2

from __future__ import print_function
import sys
import os

input_file = open(sys.argv[1], 'r')

output_filename_core = os.path.splitext(sys.argv[1])[0]
mRNA_output_file = open(output_filename_core + '_mRNA.txt', 'w')
lncRNA_output_file = open(output_filename_core + '_lncRNA.txt', 'w')
pseudogene_output_file = open(output_filename_core + '_pseudogene.txt', 'w')
others_output_file = open(output_filename_core + '_others.txt', 'w')
Akimitsu_eRNA_output_file = open(output_filename_core + '_Akimitsu_eRNA.txt', 'w')
FANTOM5_eRNA_output_file = open(output_filename_core + '_FANTOM5_eRNA.txt', 'w')
Akimitsu_PROMPT_output_file = open(output_filename_core + '_Akimitsu_PROMPT.txt', 'w')

header_flg = 0
mRNA_counter = 1
lncRNA_counter = 1
pseudogene_counter = 1
others_counter = 1
Akimitsu_eRNA_counter = 1
FANTOM5_eRNA_counter = 1
Akimitsu_PROMPT_counter = 1

for line in input_file:
line = line.rstrip()
data = line.split("\t")
if header_flg == 0:
print("gr_id", line, sep="\t", end="\n", file=mRNA_output_file)
print("gr_id", line, sep="\t", end="\n", file=lncRNA_output_file)
print("gr_id", line, sep="\t", end="\n", file=pseudogene_output_file)
print("gr_id", line, sep="\t", end="\n", file=others_output_file)
print("gr_id", line, sep="\t", end="\n", file=Akimitsu_eRNA_output_file)
print("gr_id", line, sep="\t", end="\n", file=FANTOM5_eRNA_output_file)
print("gr_id", line, sep="\t", end="\n", file=Akimitsu_PROMPT_output_file)
header_flg = 1
continue
gene_type = data[2]
if gene_type == 'mRNA':
print(mRNA_counter, line, sep="\t", end="\n", file=mRNA_output_file)
mRNA_counter += 1
elif gene_type == 'lncRNA':
print(lncRNA_counter, line, sep="\t", end="\n", file=lncRNA_output_file)
lncRNA_counter += 1
elif gene_type == 'pseudogene':
print(pseudogene_counter, line, sep="\t", end="\n", file=pseudogene_output_file)
pseudogene_counter += 1
elif gene_type == 'others':
print(others_counter, line, sep="\t", end="\n", file=others_output_file)
others_counter += 1
elif gene_type == 'Akimitsu_eRNA':
print(Akimitsu_eRNA_counter, line, sep="\t", end="\n", file=Akimitsu_eRNA_output_file)
Akimitsu_eRNA_counter += 1
elif gene_type == 'FANTOM5_eRNA':
print(FANTOM5_eRNA_counter, line, sep="\t", end="\n", file=FANTOM5_eRNA_output_file)
FANTOM5_eRNA_counter += 1
elif gene_type == 'Akimitsu_PROMPT':
print(Akimitsu_PROMPT_counter, line, sep="\t", end="\n", file=Akimitsu_PROMPT_output_file)
Akimitsu_PROMPT_counter += 1

0 comments on commit dc2744d

Please sign in to comment.