Coder Social home page Coder Social logo

resolvepairs's Introduction

resolvepair

September 3 2014: resolvepairs should now support Python 2.6 - Python 3.4

A short python script for resolving pair membership for groups of reads with the same name.

When reconstructing a FASTQ file from an aligned BAM, it is sometimes the case that query names will be non-unique not only between mates but across pairs of mates. This script will append a unique id to the names of reads belonging to the same mate pair.

Running SamToFastq from Picard tools on a input file with ambiguous pairs will cause it too fail with:

Exception in thread "main" net.sf.picard.PicardException: Illegal mate state: [Read Name]

resolvepair reads a name sorted SAM file from STDIN and writes a SAM file with renamed query names to STDOUT.

Example

samtools sort -o -n input.bam | ./resolvepair | java -Xmx16g -XX:-UseGCOverheadLimit -jar $PICARD/SamToFastq.jar I=/dev/stdin F=r_1.fastq F2=r_2.fastq

Behaviour

resolvepair will write a short summary to stderr. Reads that do not belong to evenly populated groups (lonely reads) will be omitted.

resolvepair requires SAM input sorted by read name.

Currently, reads are renamed by appending an incremented integer to the first of colon delimited fields (if any) in the original readname.

Note that such improperly named reads might indicate a failure in an early stage of the sequencing pipeline

resolvepairs's People

Contributors

jeff-k avatar

Stargazers

 avatar

Watchers

 avatar  avatar

resolvepairs's Issues

issue on line 94 of the resolvepair

Hello, I you could see in the output below, that there is an issue on line 94 of the resolvepair. Would appreciate help with solution. thank you

LSBATCH: User input

samtools sort -o -n input.bam | /opt/python-3.4.0/bin/python3.4 resolvepair | /opt/java/jdk1.7.0_45/bin/java -jar /opt/picard-tools-1.79/SamToFastq.jar INPUT=input.bam FASTQ=read_1.fastq SECOND_END_FASTQ=read_2.fastq

Exited with exit code 1.
Usage: samtools sort [options] <in.bam> <out.prefix>
Options: -n sort by read name
-f use <out.prefix> as full file name instead of prefix
-o final output to stdout
-l INT compression level, from 0 to 9 [-1]
-@ INT number of sorting and compression threads [1]
-m INT max memory per thread; suffix K/M/G recognized [768M]

[Tue Sep 02 17:17:42 EDT 2014] net.sf.picard.sam.SamToFastq INPUT=input.bam FASTQ=read_1.fastq SECOND_END_FASTQ=read_2.fastq OUTPUT_PER_RG=false RE_REVERSE=true INCLUDE_NON_PF_READS=false READ1_TRIM=0 READ2_TRIM=0 INCLUDE_NON_PRIMARY_ALIGNMENTS=false VERBOSITY=INFO QUIET=false VALIDATION_STRINGENCY=STRICT COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false
[Tue Sep 02 17:17:42 EDT 2014] Executing as ft42@clarinet002-111 on Linux 3.2.41-bpo.4-ritg1-amd64 amd64; Java HotSpot(TM) 64-Bit Server VM 1.7.0_45-b18; Picard version: 1.79(1282)
File "resolvepair", line 94
print printSam(pairs[i][0], i)
^
SyntaxError: invalid syntax
[Tue Sep 02 17:17:42 EDT 2014] net.sf.picard.sam.SamToFastq done. Elapsed time: 0.00 minutes.
Runtime.totalMemory()=1521483776
FAQ: http://sourceforge.net/apps/mediawiki/picard/index.php?title=Main_Page
Exception in thread "main" net.sf.picard.PicardException: Illegal mate state: HWI-ST1006:65:C0VRNACXX:2:1101:1376:193146
at net.sf.picard.sam.SamToFastq.assertPairedMates(SamToFastq.java:325)
at net.sf.picard.sam.SamToFastq.doWork(SamToFastq.java:146)
at net.sf.picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:177)
at net.sf.picard.sam.SamToFastq.main(SamToFastq.java:119)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.