Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

perl script to sort out the genes which i have in the human chromosome

by anisha3 (Novice)
on May 15, 2012 at 14:43 UTC ( #970649=perlquestion: print w/ replies, xml ) Need Help??
anisha3 has asked for the wisdom of the Perl Monks concerning the following question:

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"; } #} }

Comment on perl script to sort out the genes which i have in the human chromosome
Download Code
Re: perl script to sort out the genes which i have in the human chromosome
by marto (Chancellor) on May 15, 2012 at 14:53 UTC

    You should start by adding the following lines at the start of your code:

    use strict; use warnings;

    Start working through your code defining variables and you'll find a few problems (e.g, delete($Dna[0]); is the first mention of $Dna).

Re: perl script to sort out the genes which i have in the human chromosome
by sauoq (Abbot) on May 15, 2012 at 18:16 UTC
    its takng lots of time n unabl 2 get d desired op please help me out!!!!!!

    Is there an SMS/perlmonks gateway I don't know about?

    -sauoq
    "My two cents aren't worth a dime.";

      oh! you need to get used to it... no big deal really.

      Get with the times man.. textation is big these days(also, it's way cooler, why write the full word whn u can cut wrds short like dis) even here..

      Also, Things like "give me solution ASAP!!!!" , "please haaaaalp !!!!" are common.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://970649]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2014-09-18 03:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (105 votes), past polls