Re: problam in nesting loop
- From: "Rita" <ritu_minda@xxxxxxxxxxx>
- Date: 21 Nov 2005 07:28:54 -0800
Hi
Your Programm is so good and it's working for two files. But my problam
is I don't want to give two input filename. I just want to give one
filename Data.txt which has 5 fields like
Submitter Name Sequence ID GB Accession # Comments
Source sequence
And my Data is
Ik-Young 12945 AW348161 good sequence
TGCAHJKLSURIOEPWIFJDIJDOIOKDSCMKCVCNCNCJLJDOFUOKFDLJLXVJNCLVJDLFDFJOFJUDOPPWPLDMGCCGCAACJLDJKLKLKJAOJODLOFOOQPQKDLSFJXNVNZMLPIRPEJIOFJFKLFVJODIPIEKKLCMMVLJOFPKAKLVMMLCVJFOLJOFPFKLDFKOEWIEOOGHHJGLFWPPEPFFFJPJGPGITIPEOPQFKKPROPEGOJVBJMKLNLCMLKASLKOPIIPRKVKMMBOPOEPLCDCVMLFBJTOJGTORIROEIRPEOIPWEIKEPRIPRPIRPWIRPEIPEIRWPIEPRIPE
..
..
..
..
..
..50 Data like this
I want to extract 2 fields in it. First one is Sequence ID and Second
one is Source Sequence.So i Use this code in programm but this code
reading only First Sequence
# Get the name of the text file from the user that has the seqid,
source seq :
print "Please type the filename of the seqid and source seq : ";
my $filename = <STDIN>;
# Remove the newline from the filename
chomp $filename;
# either open the file, or exit from the program
open FILE,$filename ||die "Cannot open file \"$filename\"\n\n $!";
<FILE>;
chomp(my $line = <FILE>);
my ($seqid, $source_seq) = (split /\t/, $line)[1,4];
print $seqid,"\t";
print $source_seq,"\n";
Now i want to write source sequence in fasta format in a temprary file
So I use
#write First sequence in Fasta Format and store in file name tmp:
my $seqio = Bio::SeqIO ->new(-file =>'>tmp',-format =>'fasta');
$source_seq = Bio::Seq-> new(-seq => $source_seq, -disaply_id
=>'test1');
$seqio ->write_seq($source_seq);
Then I want to give Second file name which is same as Sequence ID :
So I give code
my$filename1="$seqid";
open(FILE1,"C:/Ritu/FastaSeqs/$filename1.CONSENS.fasta")||die "Cannot
open file
\"$filename1\"\n\n $!";
This file has only one sequence . I have 1 folder with 50 files which
name is same as Sequence ID.
Then I Blast it
#Blast to both sequences and store output in file name temp.blast:
system("c:/downloads/bin/bl2seq -i tmp -j
C:/Ritu/FastaSeqs/$filename1.CONSENS.fasta -p blastn -o temp.blast ");
After Blast i Want toResult which has Nomatch Sequence
my $in = Bio::SearchIO ->new(-format => 'blast',
-file => 'temp.blast');
while( my $result = $in->next_result ) {
while( my $hit = $result->next_hit ) {
#Print Starting and Ending Point of 1 Hsps-
my $hsp1 =$hit->next_hsp;
my$start1=$hsp1->hit->start;
my $end1=$hsp1->hit->end;
print "start First Hsp ",$start1,"\n";
print "End First Hsp ",$end1,"\n\n";
#Print Starting and Ending Point of 2 Hsps-
my $hsp2 =$hit->next_hsp;
my$start2=$hsp2->query->start;
my $end2=$hsp2->query->end;
print "start Second Hsp ",$start2,"\n";
print "End Second Hsp ",$end2,"\n\n";
#Get Gap Sequence :
print "Gap Sequence- ",$sts_seq->subseq($end1+1,$start2-1);
}
}
#Close the file
close(FILE) or warn("Error closing $file1: $!");
close(FILE1) or warn("Error closing $file2: $!");
This Programm is giving me Result what I want But It is Good only for
two Sequence and I want to make for all 50 Sequences .
and for that first i have to use loop in whole program and second thing
is i have to put loop for get Gap Sequence too .Because this Sequence
has only one nonmatch or Gap Sequence but may be another 49 sequence
have 0 or 2,3.... Nonmatch or Gap Sequence.
I am trying but i couldn't figureout that.
still can i use your script in this programm?
Rita
.
- Follow-Ups:
- Re: problam in nesting loop
- From: Jim Gibson
- Re: problam in nesting loop
- References:
- problam in nesting loop
- From: Rita
- Re: problam in nesting loop
- From: Jim Gibson
- problam in nesting loop
- Prev by Date: Re: XML Parsing too slow with XML::Simple
- Next by Date: Re: two arrays
- Previous by thread: Re: problam in nesting loop
- Next by thread: Re: problam in nesting loop
- Index(es):
Relevant Pages
|