annotate SMART/bacteriaRegulatoryRegion_Detection/strictlyIncludeGff.pl @ 18:94ab73e8a190

Uploaded
author m-zytnicki
date Mon, 29 Apr 2013 03:20:15 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
1 #!/usr/bin/perl -w
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
2 ###
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
3 # But : protocol permettant la detection d'RNA non codant potentiel
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
4 #
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
5 # Entrees : fichier de mapping Smart gff3
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
6 # fichier gff des gènes
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
7 # fichier gff des clusters Cis regulateur potentiel
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
8 #
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
9 # Sortie : fichier gff des clusters ARN nc
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
10 #
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
11 ###------------------------------------------------------
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
12
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
13 use vars qw($USAGE);
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
14 use strict;
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
15
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
16 =head1 NAME
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
17
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
18 protocol_NC_V2_CTN3.pl
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
19
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
20 =head1 SYNOPSIS
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
21
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
22 % strictlyIncludeGff.pl -i toSelect.gff3 -t template.gff3 > result.gff3
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
23
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
24 =head1 DESCRIPTION
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
25
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
26 strictlyIncludeGff.pl - print elements strictly include in template (gff files)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
27
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
28 -i|--input fileName gff input file name
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
29 -t|--template fileName gff template file name
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
30 [-h|--help] help mode then die
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
31
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
32 =head1 AUTHOR - CTN - mar.11
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
33 (from RNA-Vibrio/protocol_NC_V2_CTN3.pl - Claire KUCHLY)
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
34
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
35 =cut
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
36
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
37 #----------------------------------------------------------------------------
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
38 # check command line :
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
39 my $outFileName = "outSIG.gff3";
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
40 if ($#ARGV==0) {
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
41 die (exec("pod2text $0\n"));
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
42 } else {
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
43 foreach my $num (0 .. $#ARGV) {
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
44 SWITCH: for ($ARGV[$num]) {
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
45 /--input|-i/ && do { open(ARN,"<$ARGV[$num+1]")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
46 or die "Error: Can't open \"$ARGV[$num+1]\", $!";
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
47 last };
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
48 /--template|-t/ && do { open(SEED,"<$ARGV[$num+1]")
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
49 or die "Error : Can't open file \"$ARGV[$num+1]\", $!";
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
50 last };
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
51 /--help|-h/ && do { exec("pod2text $0\n") ; die };
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
52 }
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
53 }
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
54 ##NC_011753.2 RefSeq gene 367 834 . - . locus_tag=VS_0001;db_xref=GeneID:7162789
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
55 # open(OUT,">$outFileName") or die "Error can't $outFileName open for output. $!\n";
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
56 my @seed ;
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
57 my $s=0;
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
58 while (my $seedLine = <SEED> ) {
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
59 my @list = split(/\t/,$seedLine);
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
60 $seed[$s][0]= $list[3] ; # position begin seed
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
61 $seed[$s][1]= $list[4] ; # position end seed
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
62 $seed[$s][2]= $list[6] ; # seed sens
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
63 $seed[$s][3]= $list[0] ; # chromesome name
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
64 $s++;
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
65 }
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
66 close SEED ;
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
67 while(my $ligne = <ARN>){
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
68 $s=0;
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
69 my @list = split(/\t/,$ligne);
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
70 while (($s <= $#seed)) {
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
71 if (($seed[$s][3] eq $list[0]) and ($seed[$s][0] <= $list[3]) and ($seed[$s][1] >= $list[4]) and ($seed[$s][2] eq $list[6])) { # if list include in seed + same direction
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
72 print "$ligne";
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
73 }
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
74 $s++;
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
75 }
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
76 }
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
77 close ARN ;
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
78 exit(0);
94ab73e8a190 Uploaded
m-zytnicki
parents:
diff changeset
79 }