Skip to content

Commit

Permalink
This should fix #196
Browse files Browse the repository at this point in the history
  • Loading branch information
lucventurini committed Jul 25, 2019
1 parent 8eb756f commit ffc6ec3
Show file tree
Hide file tree
Showing 4 changed files with 264 additions and 10 deletions.
1 change: 1 addition & 0 deletions Mikado/preparation/annotation_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ def load_from_gtf(shelf_name,
exon_lines[row.transcript]["source"] = label
else:
exon_lines[row.transcript]["source"] = row.source
exon_lines[row.transcript]["features"] = dict()
exon_lines[row.transcript]["chrom"] = row.chrom
exon_lines[row.transcript]["strand"] = row.strand
exon_lines[row.transcript]["exon"] = []
Expand Down
108 changes: 108 additions & 0 deletions Mikado/tests/cufflinks.no_transcript.gtf
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
Chr5 Cufflinks exon 26575364 26575410 . - . gene_id "cufflinks_star_at.23553";transcript_id "cufflinks_star_at.23553.1";
Chr5 Cufflinks exon 26575495 26575620 . - . gene_id "cufflinks_star_at.23553";transcript_id "cufflinks_star_at.23553.1";
Chr5 Cufflinks exon 26575711 26575797 . - . gene_id "cufflinks_star_at.23553";transcript_id "cufflinks_star_at.23553.1";
Chr5 Cufflinks exon 26575885 26575944 . - . gene_id "cufflinks_star_at.23553";transcript_id "cufflinks_star_at.23553.1";
Chr5 Cufflinks exon 26576035 26576134 . - . gene_id "cufflinks_star_at.23553";transcript_id "cufflinks_star_at.23553.1";
Chr5 Cufflinks exon 26576261 26577069 . - . gene_id "cufflinks_star_at.23553";transcript_id "cufflinks_star_at.23553.1";
Chr5 Cufflinks exon 26577163 26577288 . - . gene_id "cufflinks_star_at.23553";transcript_id "cufflinks_star_at.23553.1";
Chr5 Cufflinks exon 26577378 26577449 . - . gene_id "cufflinks_star_at.23553";transcript_id "cufflinks_star_at.23553.1";
Chr5 Cufflinks exon 26577856 26578163 . - . gene_id "cufflinks_star_at.23553";transcript_id "cufflinks_star_at.23553.1";
Chr5 Cufflinks exon 26581218 26581528 . - . gene_id "cufflinks_star_at.23551";transcript_id "cufflinks_star_at.23551.1";
Chr5 Cufflinks exon 26583335 26583874 . - . gene_id "cufflinks_star_at.23551";transcript_id "cufflinks_star_at.23551.1";
Chr5 Cufflinks exon 26583267 26583874 . - . gene_id "cufflinks_star_at.23551";transcript_id "cufflinks_star_at.23551.2";
Chr5 Cufflinks exon 26584796 26584879 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.2";
Chr5 Cufflinks exon 26585220 26585273 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.2";
Chr5 Cufflinks exon 26585345 26585889 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.2";
Chr5 Cufflinks exon 26585982 26586294 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.2";
Chr5 Cufflinks exon 26586420 26586524 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.2";
Chr5 Cufflinks exon 26586638 26586850 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.2";
Chr5 Cufflinks exon 26586934 26586996 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.2";
Chr5 Cufflinks exon 26587084 26587202 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.2";
Chr5 Cufflinks exon 26587287 26587345 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.2";
Chr5 Cufflinks exon 26587427 26587773 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.2";
Chr5 Cufflinks exon 26584796 26584879 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.1";
Chr5 Cufflinks exon 26585220 26585273 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.1";
Chr5 Cufflinks exon 26585345 26585889 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.1";
Chr5 Cufflinks exon 26585982 26586294 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.1";
Chr5 Cufflinks exon 26586420 26586524 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.1";
Chr5 Cufflinks exon 26586633 26586996 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.1";
Chr5 Cufflinks exon 26587084 26587202 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.1";
Chr5 Cufflinks exon 26587287 26587345 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.1";
Chr5 Cufflinks exon 26587427 26587773 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.1";
Chr5 Cufflinks exon 26584930 26585023 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.3";
Chr5 Cufflinks exon 26585220 26585273 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.3";
Chr5 Cufflinks exon 26585345 26585889 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.3";
Chr5 Cufflinks exon 26585982 26586102 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.3";
Chr5 Cufflinks exon 26586217 26586294 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.3";
Chr5 Cufflinks exon 26586420 26586524 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.3";
Chr5 Cufflinks exon 26586638 26586850 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.3";
Chr5 Cufflinks exon 26586934 26586996 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.3";
Chr5 Cufflinks exon 26587084 26587202 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.3";
Chr5 Cufflinks exon 26587287 26587345 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.3";
Chr5 Cufflinks exon 26587427 26587773 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.3";
Chr5 Cufflinks exon 26586921 26587202 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.4";
Chr5 Cufflinks exon 26587287 26587345 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.4";
Chr5 Cufflinks exon 26587427 26587773 . + . gene_id "cufflinks_star_at.23555";transcript_id "cufflinks_star_at.23555.4";
Chr5 Cufflinks exon 26588405 26588625 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.2";
Chr5 Cufflinks exon 26589196 26589279 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.2";
Chr5 Cufflinks exon 26589386 26590167 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.2";
Chr5 Cufflinks exon 26590261 26590393 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.2";
Chr5 Cufflinks exon 26590495 26590566 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.2";
Chr5 Cufflinks exon 26590641 26590739 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.2";
Chr5 Cufflinks exon 26590880 26591092 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.2";
Chr5 Cufflinks exon 26591174 26591236 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.2";
Chr5 Cufflinks exon 26591324 26591442 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.2";
Chr5 Cufflinks exon 26591514 26591578 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.2";
Chr5 Cufflinks exon 26591681 26592252 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.2";
Chr5 Cufflinks exon 26588405 26588625 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.3";
Chr5 Cufflinks exon 26589196 26589279 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.3";
Chr5 Cufflinks exon 26589386 26590167 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.3";
Chr5 Cufflinks exon 26590261 26590393 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.3";
Chr5 Cufflinks exon 26590495 26590566 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.3";
Chr5 Cufflinks exon 26590641 26590739 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.3";
Chr5 Cufflinks exon 26590880 26591092 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.3";
Chr5 Cufflinks exon 26591174 26591236 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.3";
Chr5 Cufflinks exon 26591324 26591442 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.3";
Chr5 Cufflinks exon 26591520 26591578 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.3";
Chr5 Cufflinks exon 26591681 26591845 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.3";
Chr5 Cufflinks exon 26591937 26592252 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.3";
Chr5 Cufflinks exon 26588405 26588625 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.1";
Chr5 Cufflinks exon 26589196 26589279 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.1";
Chr5 Cufflinks exon 26589386 26590167 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.1";
Chr5 Cufflinks exon 26590261 26590393 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.1";
Chr5 Cufflinks exon 26590495 26590566 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.1";
Chr5 Cufflinks exon 26590641 26590739 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.1";
Chr5 Cufflinks exon 26590879 26591092 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.1";
Chr5 Cufflinks exon 26591174 26591236 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.1";
Chr5 Cufflinks exon 26591324 26591442 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.1";
Chr5 Cufflinks exon 26591520 26591578 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.1";
Chr5 Cufflinks exon 26591681 26592252 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.1";
Chr5 Cufflinks exon 26592683 26593365 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.4";
Chr5 Cufflinks exon 26593449 26593836 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.4";
Chr5 Cufflinks exon 26593930 26594062 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.4";
Chr5 Cufflinks exon 26594172 26594243 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.4";
Chr5 Cufflinks exon 26594318 26594416 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.4";
Chr5 Cufflinks exon 26594569 26594772 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.4";
Chr5 Cufflinks exon 26594860 26594922 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.4";
Chr5 Cufflinks exon 26595003 26595268 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.4";
Chr5 Cufflinks exon 26595366 26595742 . + . gene_id "cufflinks_star_at.23563";transcript_id "cufflinks_star_at.23563.4";
Chr5 Cufflinks exon 26599401 26599654 . + . gene_id "cufflinks_star_at.23556";transcript_id "cufflinks_star_at.23556.1";
Chr5 Cufflinks exon 26599767 26600053 . + . gene_id "cufflinks_star_at.23556";transcript_id "cufflinks_star_at.23556.1";
Chr5 Cufflinks exon 26600151 26600394 . + . gene_id "cufflinks_star_at.23556";transcript_id "cufflinks_star_at.23556.1";
Chr5 Cufflinks exon 26600497 26600616 . + . gene_id "cufflinks_star_at.23556";transcript_id "cufflinks_star_at.23556.1";
Chr5 Cufflinks exon 26600696 26600908 . + . gene_id "cufflinks_star_at.23556";transcript_id "cufflinks_star_at.23556.1";
Chr5 Cufflinks exon 26600987 26601049 . + . gene_id "cufflinks_star_at.23556";transcript_id "cufflinks_star_at.23556.1";
Chr5 Cufflinks exon 26601139 26601316 . + . gene_id "cufflinks_star_at.23556";transcript_id "cufflinks_star_at.23556.1";
Chr5 Cufflinks exon 26601398 26601707 . + . gene_id "cufflinks_star_at.23556";transcript_id "cufflinks_star_at.23556.1";
Chr5 Cufflinks exon 26603037 26604446 . + . gene_id "cufflinks_star_at.23557";transcript_id "cufflinks_star_at.23557.1";
Chr5 Cufflinks exon 26603174 26603638 . - . gene_id "cufflinks_star_at.23558";transcript_id "cufflinks_star_at.23558.1";
Chr5 Cufflinks exon 26603727 26604375 . - . gene_id "cufflinks_star_at.23558";transcript_id "cufflinks_star_at.23558.1";
Chr5 Cufflinks exon 26608458 26608780 . + . gene_id "cufflinks_star_at.23559";transcript_id "cufflinks_star_at.23559.1";
Chr5 Cufflinks exon 26609366 26610543 . - . gene_id "cufflinks_star_at.23560";transcript_id "cufflinks_star_at.23560.1";
Chr5 Cufflinks exon 26611509 26612012 . - . gene_id "cufflinks_star_at.23561";transcript_id "cufflinks_star_at.23561.1";
Chr5 Cufflinks exon 26612165 26612722 . - . gene_id "cufflinks_star_at.23562";transcript_id "cufflinks_star_at.23562.1";
Chr5 Cufflinks exon 26612846 26613194 . - . gene_id "cufflinks_star_at.23562";transcript_id "cufflinks_star_at.23562.1";
Chr5 Cufflinks exon 26613900 26614294 . - . gene_id "cufflinks_star_at.23562";transcript_id "cufflinks_star_at.23562.1";
Chr5 Cufflinks exon 26612165 26612727 . - . gene_id "cufflinks_star_at.23562";transcript_id "cufflinks_star_at.23562.2";
Chr5 Cufflinks exon 26612846 26612932 . - . gene_id "cufflinks_star_at.23562";transcript_id "cufflinks_star_at.23562.2";
Chr5 Cufflinks exon 26613900 26614294 . - . gene_id "cufflinks_star_at.23562";transcript_id "cufflinks_star_at.23562.2";
21 changes: 11 additions & 10 deletions Mikado/tests/test_system_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ def test_prepare_trinity_gff(self):
for test_file in ("trinity.gff3",
"trinity.match_matchpart.gff3",
"trinity.cDNA_match.gff3",
"trinity.gtf"):
"trinity.gtf",
"trinity.no_transcript_feature.gtf"):
with self.subTest(test_file=test_file):
self.conf["prepare"]["files"]["gff"] = [pkg_resources.resource_filename("Mikado.tests",
test_file)]
Expand All @@ -185,26 +186,26 @@ def test_prepare_trinity_gff(self):
def test_prepare_trinity_and_cufflinks(self):

self.conf["prepare"]["files"]["labels"] = ["cl", "tr"]
self.conf["prepare"]["files"]["gff"].append(pkg_resources.resource_filename("Mikado.tests",
"cufflinks.gtf"))
self.conf["prepare"]["files"]["gff"].append("")

self.conf["prepare"]["files"]["gff"] = [None, None]
dir = tempfile.TemporaryDirectory()
self.conf["prepare"]["files"]["output_dir"] = dir.name
self.conf["prepare"]["files"]["out_fasta"] = "mikado_prepared.fasta"
self.conf["prepare"]["files"]["out"] = "mikado_prepared.gtf"
args = Namespace()

for test_file in ("trinity.gff3",
"trinity.match_matchpart.gff3",
"trinity.cDNA_match.gff3",
"trinity.gtf"):
with self.subTest(test_file=test_file):
for cuff_file, test_file in itertools.product(
("cufflinks.gtf", "cufflinks.no_transcript.gtf"),
(("trinity.gff3", "trinity.match_matchpart.gff3", "trinity.cDNA_match.gff3", "trinity.gtf",
"trinity.no_transcript_feature.gtf"))):
with self.subTest(test_file=test_file, cuff_file=cuff_file):
self.conf["prepare"]["files"]["gff"][0] = pkg_resources.resource_filename("Mikado.tests",
cuff_file)
self.conf["prepare"]["files"]["gff"][1] = pkg_resources.resource_filename("Mikado.tests",
test_file)
self.conf["prepare"]["files"]["out_fasta"] = "mikado_prepared.fasta"
self.conf["prepare"]["files"]["out"] = "mikado_prepared.gtf"
args.strip_cds = True

args.json_conf = self.conf
prepare.prepare(args, self.logger)

Expand Down
Loading

0 comments on commit ffc6ec3

Please sign in to comment.