Hi all, I have a file that looks like this
protein_id goterm product
AG8P000026-PA GO:0003824 catalytic activity
AG8P001026-PA GO:0004181 metallocarboxypeptidase activity
AG8P001026-PA GO:0008233 peptidase activity
AG8P001039-PA GO:0016787 hydrolase activity
AG7P001036-PA GO:0004182 carboxypeptidase A activity
AG7P001036-PA GO:0004180 carboxypeptidase activity
AG7P001040-PA GO:0022237 metallopeptidase activity
when I use perl hash it prints
what it prints
AG8P000026-PA GO:0008233 peptidase activity
AG8P001039-PA GO:0016787 hydrolase activity
AG7P001036-PA GO:0004180 carboxypeptidase activity
AG7P001040-PA GO:0022237 metallopeptidase activity
but I want it to print
AG8P000026-PA GO:0003824 catalytic activity
AG8P001026-PA GO:0004181 metallocarboxypeptidase activity
AG8P001026-PA GO:0008233 peptidase activity
AG8P001039-PA GO:0016787 hydrolase activity
AG7P001036-PA GO:0004182 carboxypeptidase A activity
AG7P001036-PA GO:0004180 carboxypeptidase activity
AG7P001040-PA GO:0022237 metallopeptidase activity
please How do I modify this code?
perl code:
my $filename ="data";
open(my $INFILE,$filename)|| die("Error in reading file $filename");
my %infodata;
while(my $line= <$INFILE> )
{
chomp $line;
my ($id,@info)= split /\t/,$line;
$infodata{$id} =join("\t",@info);
}
Why do you think it prints Ben only once?
In perl hash prints a key once and discard the rest. Am writing a program that is similar to what is posted. i have similar output
Hello tg!
We believe that this post does not fit the main topic of this site.
This isn't a perl forum.
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!
I disagree. perl is a programming language I used in bioinformatics. I have a problem that is a model of what I just posted it's not fair to do this
Arguing with an administrator about what's fair is about the least effective thing one can do (hint: I'm familiar with the community standards here). If you update your question to at least include a biologically relevant example then it'll be relevant to the site and I'll reopen the post (add a reply too, since I don't get notified when posts are modified).
I have put up a sample of what I am working on can you please open my thread so I can get help from people that cares
Yup, it's been reopened.
Hi Devon this is a bioinformatics forum. I guess one is free to ask question to solve a problem one has doubt on. You say we believe you are acting alone because I don't believe I have asked a silly question. my program solves a bioinformatics question. i just put a model up. that is ash thing to do and insensitive thing to do.
Hi tg,
I do not know the first revision of your question but I guess it didn't show the example data with GO terms, is this correct? If so, the initial decision to close the question was correct. If you have doubts about what kind of questions you are free to post but instead of complaining you should rather take the advise to improve your question. Your question is still only weakly related to bioinformatics because it is mainly about basic programming (use of hash) applied to parsing a tab separated file which by chance contains GO terms. That's good enough to keep your question open. But you still need to improve it and make it more specific, because at the moment your desired output is identical to the input. So why parse at all?
The original version dealt with students in different classes and their scores. Hopefully tg will update again with the actual goal, since it's also completely unclear to me why one would use a hash to simply copy print a tsv's contents.
I want to add annotation to my genbank file but because the protein id is the same but diff protein annotation details it's updating only one protein id out of the identical protein id. I want to be able to update all the protein id but it seems hash only specifies one key. That reflects in the sample data I posted.
I want to add annotation to my genbank file but because the protein id is the same but diff protein annotation details it's updating only one protein id out of the identical protein id. I want to be able to update all the protein id but it seems hash only specifies one key. That reflects in the sample data I posted.