- 論壇徽章:
- 0
|
回復(fù) 45# yanglc2013
你覺得這樣子輸出有具體意義嗎?inc中任何一個region都會被輸出到non_include中去,只要你的refGene足夠多。對于后面三種有交集的情況,如果要輸出到多個文件中,你把下面的代碼替換一下就行。- my %result; # one of ref_include_inc, inc_include_ref, overlap or undef
- while (@ref_data) {
- my @rd = @{+shift @ref_data};
- # igore genes on the left side of inc region
- next if $rd[3] < $id[2];
- push @store, [@rd];
- # stop when this gene is on the right side of inc region
- last if $rd[2] > $id[3];
- # this gene must overlap with this inc region
- if ($id[2] >= $rd[2] && $id[3] <= $rd[3]) {
- $result{ref_include_inc} = 1;
- }
- elsif ($rd[2] >= $id[2] && $rd[3] <= $id[3]) {
- $result{inc_include_ref} = 1;
- }
- else {
- $result{overlap} = 1;
- }
- }
- # output result
- if (%result) {
- if ($result{ref_include_inc}) {
- print {$ref_include_inc} join("\t", @id), "\n";
- }
- if ($result{inc_include_ref}) {
- print {$inc_include_ref} join("\t", @id), "\n";
- }
- if ($result{overlap}) {
- print {$overlap} join("\t", @id), "\n";
- }
- }
- else { # if $result is undef, means no overlapped genes
- print {$non_include} join("\t", @id), "\n";
- }
-
- # put this genes back into @ref_data, use to check next inc region
- unshift @ref_data, @store;
- @store = ();
- }
復(fù)制代碼 |
|