I am working on a fungus call Neurosprora. Previous lab member built a gbrowser (1.70) to visualize the deep-seq data with GFF2 file format. Now I obtain some new deep-seq data and want to load it onto that browser. I heard that he used bowtie to do alignment and convert into gff2, but I cannot find the script to convert. Does anyone have similar script which could share? Or just indicate any tools can do this trick? I am not a perl person and don't think I could learn it in a short while.
Unconfigured Ad
Collapse
X
-
FWIW, I've just today ended up writing a python script to convert from SAM/BAM files to GFF3 files using pysam. The code may be useful for you if you can't find anything else suitable for your conversion.
For a bit of context, I broke up genomic contigs into 100bp fragments, naming the sequences <contig>#<start>-<end>, then used bowtie2 to map them to the genome -- that's why I've got the 'read.qname.find' bits in the code. My contigs started with 'v', which bowtie replaced with 'N' for some odd reason, so I had to do a bit of extra fiddling to add the 'v' back in.
Here's the relevant part of my code which does the SAM->GFF conversion:
Code:samFile = pysam.Samfile(samFileName, "r") totalCount = 0 sys.stderr.write("Getting reads from SAM file...") sys.stdout.write("##gff-version 3\n") gffWriter = csv.writer(sys.stdout, delimiter = '\t') for read in samFile: totalCount += 1 if(read.tid > 0): qContig = 'v' + read.qname[1:read.qname.find("#")] qContigStart = read.qname[read.qname.find("#")+1:read.qname.find("-")] qContigEnd = read.qname[read.qname.find("-")+1:] tContig = samFile.getrname(read.tid) strand = "-" if read.is_reverse else "+" score = "." for tag in read.tags: if(tag[0] == "XS"): score = str(tag[1]+1000) gffWriter.writerow((qContig, "sam2gff3-"+os.path.basename(samFileName), "nucleotide_match", qContigStart, qContigEnd, score, strand, ".", "Name=SAM_%s,ID=%s-%s;Target=%s %d %d" % (tContig, qContig, tContig, tContig, read.pos, read.aend))) if(totalCount % 100000 == 0): sys.stderr.write(".")Last edited by gringer; 11-02-2011, 12:17 PM. Reason: fixed up GFF3 parsing errors, added Name attribute to avoid contig clashes
Comment
Latest Articles
Collapse
-
by SEQadmin2
Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?
Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating...-
Channel: Articles
10-14-2026, 09:55 AM -
-
by SEQadmin2
Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.
We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing...-
Channel: Articles
-
ad_right_rmr
Collapse
News
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by SEQadmin2, 10-15-2026, 10:52 AM
|
0 responses
14 views
0 reactions
|
Last Post
by SEQadmin2
10-15-2026, 10:52 AM
|
||
|
Started by SEQadmin2, 10-14-2026, 05:39 AM
|
0 responses
21 views
0 reactions
|
Last Post
by SEQadmin2
10-14-2026, 05:39 AM
|
||
|
Started by SEQadmin2, 10-13-2026, 09:56 AM
|
0 responses
19 views
0 reactions
|
Last Post
by SEQadmin2
10-13-2026, 09:56 AM
|
||
|
Started by SEQadmin2, 10-09-2026, 11:14 AM
|
0 responses
27 views
0 reactions
|
Last Post
by SEQadmin2
10-09-2026, 11:14 AM
|
Comment