share/install/Organism/organism_helpers.rb in rbbt-sources-3.0.6 vs share/install/Organism/organism_helpers.rb in rbbt-sources-3.0.7

- old
+ new

@@ -314,28 +314,29 @@ nil end end file 'exon_offsets' => %w(exons transcript_exons gene_transcripts transcripts transcript_exons) do |t| - exons = TSV.open('exons') exon_transcripts = nil exon_transcripts = TSV.open('transcript_exons', :double, :key_field => "Ensembl Exon ID", :fields => ["Ensembl Transcript ID"], :merge => true) gene_transcripts = TSV.open('gene_transcripts', :flat) transcript_info = TSV.open('transcripts', :list, :fields => ["Ensembl Protein ID"]) transcript_exons = TSV.open('transcript_exons', :double, :fields => ["Ensembl Exon ID","Exon Rank in Transcript"]) string = "#: :namespace=#{$namespace}\n" string += "#Ensembl Exon ID\tEnsembl Transcript ID\tOffset\n" - exons.unnamed = true exon_transcripts.unnamed = true gene_transcripts.unnamed = true transcript_info.unnamed = true transcript_exons.unnamed = true + exons = TSV.open('exons') + exons.unnamed = true exons.monitor = true exons.through do |exon, info| + exon = exon.first if Array === exon gene, start, finish, strand, chr = info transcripts = coding_transcripts_for_exon(exon, exon_transcripts, transcript_info) transcript_offsets = {} @@ -510,15 +511,19 @@ archive = $1 task = $2 Misc.in_dir(archive) do BioMart.set_archive archive begin + old_namespace = $namespace + $namespace = $namespace + "/" << archive Rake::Task[task].invoke rescue Log.error "Error producing archived (#{archive}) version of #{task}: #{t.name}" Log.exception $! raise $! + ensure + $namespace = old_namespace end BioMart.unset_archive end end @@ -533,11 +538,12 @@ exon_info = TSV.open('exons', :type => :list, :fields => ["Exon Strand", "Exon Chr Start", "Exon Chr End", "Chromosome Name"], :unnamed => true) chr_transcript_ranges ||= {} transcript_strand = {} - TSV.traverse Path.setup(File.expand_path('transcript_exons')) do |transcript,values| #TSV.open('transcript_exons', :unnamed => true).through do |transcript, values| + TSV.traverse Path.setup(File.expand_path('transcript_exons')) do |transcript,values| + transcript = transcript.first if Array === transcript transcript_ranges = [] exons = Misc.zip_fields(values).sort_by{|exon,rank| rank.to_i}.collect{|exon,rank| exon} chr = nil