ths script has matching the gene id with human chromosome and also with snp file then gives output
but the problem s its takng lots of time n unabl 2 get d desired op please help me out!!!!!!
#!/usr/bin/perl
$inputFile = $ARGV[0];
chomp($inputFile);
open(IN,"$inputFile");
unless(open(IN, $inputFile)){
print "Error: Cannot open file \"$inputFile\".\n\n";
exit;
}
@genes=<IN>;
delete($Dna[0]);
close IN;
$i=1;
foreach $geneLine(@genes){
#$geneLine = "ENSG00000204873 TAAATAGTGGTCATAACAAATATATTATCTAAT
+AAG";
@gl = split('\t', $geneLine);
#print "\n".$gl[0]." - ".$gl[1];
#for($i=1; $i<2; $i++){
$chrFile = "human_chromosomes/chr".$i.".fa";
chomp($chrFile);
open(CHR,"$chrFile");
unless(open(CHR, $chrFile)){
print "Error: Cannot open file \"$snpFile\".\n\n";
exit;
}
@chr = <CHR>;
delete($chr[0]);
close CHR;
$chrSeq = join('', @chr);
$chrSeq =~s/\s//g; # Remove white space
$chrSeq =~ s/($chrSeq)/\U$1/gi;
@chrFrags = split/$gl[1]/,$chrSeq;
$count = @chrFrags;
if($count>1){
$n = length($chrFrags[0]);
$startPos = $n;
$length = length($gl[1]);
$snpFile = "SNP_CHROMOSOMES/chr".$i.".subst.fa";
chomp($snpFile);
open(SNP,"$snpFile");
unless(open(SNP, $snpFile)){
print "Error: Cannot open file \"$snpFile\".\n\n";
exit;
}
@snp = <SNP>;
delete($snp[0]);
close SNP;
$snpSeq = join('', @snp);
$snpSeq =~s/\s//g; # Remove white space
$snpSeq =~ s/($snpSeq)/\U$1/gi;
$seqMatch = substr($snpSeq,$startPos,$length);
print "Gene ID: $gl[0]\nStart position = $startPos \nLengt
+h = $length\n";
print "Choromosome $i.\n";
print "\nGene : ".$gl[1]."\nSNP : $seqMatch\n";
($snpMatch1=$seqMatch)=~s/[ATGC]/-/g;
($snpMatch2=$snpMatch1)=~s/[\w]/+/g;
#$snpMatch2=~s/[-]/0/g;
print "Match: $snpMatch2\n\n##############################
+#####################################################################
+####\n\n";
}
else{
#print "match not found\n";
}
#}
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.