File: separate_query_from_database.pl

package info (click to toggle)
sift 6.2.1-2
  • links: PTS, VCS
  • area: non-free
  • in suites: sid
  • size: 4,784 kB
  • sloc: ansic: 18,272; perl: 219; csh: 164; makefile: 152
file content (53 lines) | stat: -rw-r--r-- 955 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/local/bin/perl

# This program is licensed to you under the Fred
# Hutchinos Cancer Research Center (FHCRC)
# NONCOMMERICAL LICENSE.  A copy of the license may be found at
# http://blocks.fhcrc.org/sift/license.html and should be attached
# to this software.
$file = @ARGV[0];
$queryseq = @ARGV[1];
$database = @ARGV[2];

print "hello $file query $queryseq data $database\n";

open (QUERYSEQ,">$queryseq");
open (DATABASE,">$database");

open (FILE,$file);
$count = 0;
$reached_first_seq = 0; # added to get rid of html crap 

while (<FILE>){
	if ($flag == 1){
		if ($prev ne ""){
			print DATABASE "$prev";
		}
		print DATABASE "$_";	
		$prev = "";
	}
	else{
		if ($_ =~ /\>/){
			$count ++;
			$reached_first_seq = 1;
			if ($count == 2){
				$prev = $_;
				$flag = 1;
				next;
			}
			else{
				$prev = "";
			}
		}	
		if ($reached_first_seq) {
			print QUERYSEQ "$_";
		}
	}
	
}

close (FILE);
close (QUERYSEQ);
close (DATABASE);
exit (0);