User Profile

Collapse

Profile Sidebar

Collapse
kumarboston
kumarboston
Last Activity: Feb 13 '10, 05:11 AM
Joined: Sep 13 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • kumarboston
    replied to Counting in while loop splitting
    in Perl
    Yes, the last section will always be having WAT section whether the data is there or not."
    Thanks
    See more | Go to post

    Leave a comment:


  • kumarboston
    replied to Counting in while loop splitting
    in Perl
    Hi RonB,
    I tried to run the script using your suggestions but somehow it is printing all zero values.
    I have attached the data file, and the script file also. The data file wil always be in a group of three, HEAD, TAIL,and WAT.

    [code=perl]
    #!/usr/bin/perl

    use strict;
    use warnings;
    use Data::Dumper;

    open (DATA, "file.txt") ;

    printf "%4s...
    See more | Go to post

    Leave a comment:


  • kumarboston
    replied to Counting in while loop splitting
    in Perl
    Hi RonB,
    Thanks for the clarification. This is not an homework assinment, my output file from the CHARMM program is 4.8 GB and from that I am extracting the data for my research project.
    I am having trouble in printing the values for each row of data, I tried to print iniside the "while loop" and it all printed in cummulative sum of the counts.

    Thanks
    See more | Go to post

    Leave a comment:


  • kumarboston
    replied to Counting in while loop splitting
    in Perl
    Thanks Ron for the reply,
    I agree with you and tried your suggestion in my script. My data file is regular and I am trying to print the values of HEAD, TAIL and WAT each time the program encounters if in a set of three. So for example, the final processing output be like this: 3 column -> 1st one for HEAD, 2nd one for TAIL and 3rd one for WAT and the parsing should be done in the group of three, so for example when the program matches HEAD,...
    See more | Go to post

    Leave a comment:


  • kumarboston
    started a topic Counting in while loop splitting
    in Perl

    Counting in while loop splitting

    Hi All,
    I have an output data from CHARMM program which I am trying to parse. So, there are three variable in my output program "HEAD, TAIL, WAT" on which I have to count the number of occurence each time and print the values.
    I have attached the output data of the program and my script file.
    [code=data]
    CHARMM> coor contact cut 4.5 sele HEAD end sele RES .and. .not. HEAD end
    MEMB POPC 41 O3...
    See more | Go to post

  • kumarboston
    started a topic Printing first column value
    in Perl

    Printing first column value

    Hi All,

    I have data file which has 6 column, I am trying to take the first value(-16.2577) of 6th column and substract it to the rest of the values of 6th column.
    I split the file on space and stored in an array but the problem is I am not able to pick the first value and substract it in while loop.

    DATA FILE:
    -16.2262 -6.01803 -25.5829 -19.4488 -14.0128 -16.2577
    -18.6505 -23.0397 -26.0685 -24.5328...
    See more | Go to post

  • kumarboston
    replied to average by user defined cutoff
    in Perl
    Thanks so much Kevin,
    the output for the calculation of 1 to 10 " Average = 2 ; Average = 5.5; Average = 9" is correct, only a last small help, if in the end if I want to take the average of these values then how do i modifiy the subroutine?

    Thanks
    Kumar
    See more | Go to post

    Leave a comment:


  • kumarboston
    replied to average by user defined cutoff
    in Perl
    Thanks KevinADC for the reply,
    I ran your code on a file with numbers 1 to 10, but its throwing an error, "Can't modify <HANDLE> in chomp at new.pl line 14, near "<$IN> for "
    Execution of new.pl aborted due to compilation errors."
    I checked on the error and when I removed the chomp it was working fine but now "Illegal division by zero at new.pl line 27." error is coming and was not able...
    See more | Go to post

    Leave a comment:


  • kumarboston
    started a topic average by user defined cutoff
    in Perl

    average by user defined cutoff

    Hi all,
    I was trying to calculate the average value from different parts of the same data file. For example, if suppose we have number 1 - 10 and i was trying to calculate the average of only first 3 values and then 4 values and then last 3 value and then calculate the three averages. I have written a code but I guess it is very good way to calculate it and sometimes i get garbage values also.

    Here is a data file:
    [CODE=perl]...
    See more | Go to post

  • kumarboston
    started a topic File open in for loop
    in Perl

    File open in for loop

    Hi All,

    How do we open certain number of files in for loop. In my case I have couple of files with name scd_1_2.dat here, the number 1 goes till 5 and 2 goes till 14, I am trying to open recursively but getting some error.
    [CODE=perl]
    #!/usr/bin/perl
    use strict;
    use warnings;

    for (my $i=1;$i<=5;$i++ )
    {
    for (my $j=2;$j<=14;$j+ +)
    {
    open(A, "scd_$i_$j.dat" )...
    See more | Go to post

  • kumarboston
    replied to Renaming files
    in Perl
    Thanks Kevin for your help.
    One last thing, i would like to seek your help. How to insert the code to remove the duplicate entries of song in the same code.
    Here is the working code.
    Code:
    #!/usr/bin/perl
    use strict;
    use warnings;
    
    my $cnt = 1;
    my $folder = "/home/kk/song/latest";
    chdir($folder) or die "$!";
    opendir(DIR , '.') or die "$!";
    my @files =
    ...
    See more | Go to post

    Leave a comment:


  • kumarboston
    replied to Renaming files
    in Perl
    thanks Jeff for the reply,
    I tried to give a new directory path for the rename files but it showed error that "cannot stat.....no such file or directory".


    Thanks
    Kumar
    See more | Go to post

    Leave a comment:


  • kumarboston
    started a topic Renaming files
    in Perl

    Renaming files

    Hi All,
    I am trying to organize my song directory and trying to remove the duplicate entries, I have written a small code but somehow I am not able to rename the song name.
    I am trying to change all the song name to uppercase and then removing the spaces, any number and other characters.
    Code:
    #!/usr/bin/perl
    use strict;
    use warnings;
    
    my $cnt = 1;
    my $folder = "/home/kk/song/latest";
    ...
    See more | Go to post

  • kumarboston
    replied to Average and Standard deviation
    in Perl
    Thanks Nithinpes and All, for suggestions and now the program works perfectly fine.

    Thanks
    Kumar
    See more | Go to post

    Leave a comment:


  • kumarboston
    replied to Average and Standard deviation
    in Perl
    Thanks for the reply,
    I finally succeded in calculating the values but one thing still remains, due to for loop in the code, all the values are printed repeatedly till the end, which makes it redundant,
    I am posting the code which runs on the data file, which i posted earlier and one can see the results after running the code.
    Code:
    #!/usr/bin/perl
    
    use strict;
    use warnings;
    
    my ($line,@temp,$respos1,$respos2,@respos1,@respos2,$cadis,@lstdist,$i,$j,@cadist,@result,$length,$ele,$val,$abar,$deviation);
    ...
    See more | Go to post

    Leave a comment:


  • kumarboston
    replied to Average and Standard deviation
    in Perl
    Hi All,
    Thanks for the reply, I tried to calculate the average and the SD but something is wrong I am not sure.
    here is my code
    Code:
    #!/usr/bin/perl
    
    use strict;
    use warnings;
    
    my (@pos,@cadist,$mean,%hash,$respos1,$respos2,$cadist,$val,$line,@temp,@respos2);
    my ($cnt,$dis,$sum) = 0;
    
    open (FH,"caca.dat") or die "Check the file";
    while (<FH>)
    ...
    See more | Go to post

    Leave a comment:


  • kumarboston
    started a topic Average and Standard deviation
    in Perl

    Average and Standard deviation

    Hi All,
    I am trying to get an average value for my data, here is my data file
    Code:
    DATA FILE
    EP1934.PDB 250 250 11.27
    EP1934.PDB 251 251 12.7332
    EP1934.PDB 252 252 6.38341
    EP1934.PDB 253 253 8.04318
    EP1934.PDB 254 254 13.7123
    EP1934.PDB 255 255 10.5251
    EP1934.PDB 256 256 6.0811
    EP1934.PDB 257 257 13.317
    EP1934.PDB 258 258 14.1105
    EP1934.PDB 259 259 6.98834
    ...
    See more | Go to post

  • kumarboston
    replied to sort and compare
    in Perl
    Sorry for the confusion,
    actually what I am trying to do is, when the result is printed then, if the number of elements(last column values) are less than 100 then put a new line between the result.
    so the result should look something like this:
    Code:
    #Total number of cluster = 17
    
    1 Cluster 12 : Number of members = 5309
    2 Cluster 8 : Number of members = 1697
    3 Cluster 17 : Number of members = 683
    ...
    See more | Go to post

    Leave a comment:


  • kumarboston
    replied to sort and compare
    in Perl
    Hi All,
    Thanks for your help, I solved the problem of sorting and printing, only a small issue, while printing the data I want to put a new line(only once) when the value is less than 100 but when i am using the if condition its printing in the all the values which i don't want. Any help. I am posting my code, sample data and result output.
    Code:
    open (FH, "sample4.out") or die "Check the input file";
    my
    ...
    See more | Go to post

    Leave a comment:


  • kumarboston
    replied to sort and compare
    in Perl
    and here is my sample data
    Code:
    Cluster 1  Number of members =  23
    Cluster 2  Number of members =  285
    Cluster 3  Number of members =  4
    Cluster 4  Number of members =  28
    Cluster 5  Number of members =  1
    Cluster 6  Number of members =  24
    Cluster 7  Number of members =  54
    Cluster 8  Number of members =  246
    Cluster 9  Number of members =  1435
    Thanks
    ...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...