Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

intron length

by MBobur (Initiate)
on Feb 27, 2013 at 06:43 UTC ( [id://1020810]=perlquestion: print w/replies, xml ) Need Help??

MBobur has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: intron length
by marto (Cardinal) on Feb 27, 2013 at 09:09 UTC

      Thank you for your response. I got script which calculates full sequence length in fasta file format. But I want add script which will calculate intron length, which is "intron length = full length - exon length". Exon length = Transcription length.

      #!/usr/bin/perl use strict; use warnings; my $fastaName = "example2.fasta"; open FASTA, $fastaName or die "cannot open $fastaName\n"; my $sequence = ""; my $sequencelength; while ( my $line = <FASTA> ) { chomp($line); if ( substr( $line, 0, 1 ) eq ">" ) { if ( length($sequence) > 1 ) { #Calculate sequence lenght $sequencelength = length($sequence); print "Sequence length: $sequencelength"; print "\n"; $sequence = ""; } print "$line\n"; } else { $sequence .= $line; } } #Calculate sequence lenght for last sequence $sequencelength = length($sequence); #Print sequence lenght print "Sequence length: $sequencelength"; print "\n";

        "But I want add script which will calculate intron length, which is "intron length = full length - exon length". Exon length = Transcription length."

        Your code makes no mention of intron, exon or transcription. FASTA_format makes no mention of these eiter. I, like most people am not a bioinformatician. You're either going to have to describe your problem better (see links I previously gave which describe this in detail, direct link) or wait for someone who is familiar with terms you're using who is willing to help.

        It isn't clear what you are using here to determine the intron lengths. What was initially "posted" was output from cufflinks, which has your gene/transcript information and FPKM scores for each. Your newly posted script reads in a fasta file and determines the sequence length for each entry in the fasta file. Easy enough. The introns aren't marked in a fasta file, so I'm guessing that you'll use transcript information from the refFlat file from the UCSC genome browser or ensembl, etc. If you wanted to know the length of all exons combined for a given transcript (and ignoring any splicing variants, etc.) then you'll want to use the refFlat.txt file that can be downloaded from UCSC. It's easy to parse, and you can use the table browser to help figure out what values are in what columns (it notes where each exon begins and ends, for instance). You can import the data into a hash with the gene symbol or the accession number as a key and then calculate the exon/intron lengths for only the transcripts that you are interested in.

        In the future, I'd try to post a bit more information and be careful to format it better on the site. People here are willing to help, but are less likely to do so if it annoys them. I can look at what you posted and see exactly what you are doing because I work with this type of data all day long; others may not but still have invaluable input in writing your scripts properly, so try to help them get on board. Good luck!

        Bioinformatics
Re: intron length
by sundialsvc4 (Abbot) on Feb 27, 2013 at 14:10 UTC

    A .GTF file?   Well, a tiny bit of Googling sent me to this page at this very interesting-looking site:   http://www.bioperl.org/wiki/GTF.

    In fact, the first page of my Google search pointed to an abundance of pages, and Perl packages including Bio::FeatureIO::GTF which ... although I am not a biologist ... do strongly suggest to me that the problem you are trying to solve is one that has been thoroughly solved before.   That is usually the case with Perl.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2025-04-20 00:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.