Re: problam in nesting loop




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

.



Relevant Pages

  • Re: Die Musikindustrie und der Kopierschutz-Tod
    ... Instruction Set der Maschine ab. ... dass der Obfuskator genausowenig über das Programm ... irgendwelche Sequence Points zu ignorieren. ... Der x86-Code wurde aus einer Hochsprache erzeugt, die Sequence Points ...
    (de.org.ccc)
  • Re: Die Musikindustrie und der Kopierschutz-Tod
    ... Die Sprache C definiert keine konkrete Maschine, ... Konkret schreibst du jeweils einen Jump an eine spezielle Adresse, wo du dann jeweils zu den passenden Routinen springt. ... crasht das Programm beim Erreichen dieser Möglichkeit. ... Einfach einen NOP-Slide bis zum nächsten Sequence Point, dann einen unbedingten Jump in einen eigenen, unbenutzten Speicherbereich, und dort kannst du dann beliebig viel Ersetzungscode einfügen. ...
    (de.org.ccc)
  • Re: random numbers
    ... > why the programm always generates the same numbers when executing it?? ... "pseudo-random" sequence. ... without an external source of randomness (e.g., ... Suppose you do a simulation that uses rand() and at some ...
    (comp.lang.c)
  • Re: static field initialised twice
    ... I know whats going on like this: ... private static long sequence = 1; ... plus I write this programm for a company and can't give it to everybody. ...
    (comp.lang.java.programmer)
  • Re: Sort files by filename
    ... Mark Haney wrote: ... are out of sequence as is, changing the filename would eliminate that ... Is there a reason why rsync cannot be used for this? ...
    (Fedora)