Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bruins
    Member
    • Feb 2010
    • 78

    #1

    Usage of SAM-JDK

    Hi all,

    I am having trouble understanding how to use SAM-JDK.

    For example. My Java class needs to filter an input SAM or BAM file to remove all unaligned reads. Commandline, I would use:
    Code:
    ViewSam.jar ALIGNMENT_STATUS=Aligned I=alignment.bam
    But how do I do this directly in my class?

    I have been looking at the docs (http://picard.sourceforge.net/javadoc/) and browsed the mailing list archives and this forum (and I have seen the code example here). However I still have no idea where to start.

    Does anyone have any idea how to address this? Is there some more documentation, or an experienced user to help me on my way?

    Many thanks,

    Wil
  • drio
    Senior Member
    • Oct 2008
    • 323

    #2
    Originally posted by Bruins View Post
    Hi all,

    I am having trouble understanding how to use SAM-JDK.

    For example. My Java class needs to filter an input SAM or BAM file to remove all unaligned reads. Commandline, I would use:
    Code:
    ViewSam.jar ALIGNMENT_STATUS=Aligned I=alignment.bam
    But how do I do this directly in my class?

    I have been looking at the docs (http://picard.sourceforge.net/javadoc/) and browsed the mailing list archives and this forum (and I have seen the code example here). However I still have no idea where to start.

    Does anyone have any idea how to address this? Is there some more documentation, or an experienced user to help me on my way?

    Many thanks,

    Wil
    Does this help?

    http://picard.sourceforge.net/comman...overview.shtml
    -drd

    Comment

    • Bruins
      Member
      • Feb 2010
      • 78

      #3
      I'm sorry, no. Thanks for the quick reply though. The page you gave me has already helped me a lot but explains only how to use the executable jars from the commandline.

      To clarify what I am looking for, here a very minimal code example.
      Code:
      public class FilterAndSort {
      
          [...]
      
          // the method: filter all unaligned reads from a SAM or BAM file
          // @param bamfile the location of a BAM or SAM file as a string
          // @return filteredBamfile the location of the new filtered BAM or SAM file as a string
          private String reportAlignedReads(String bamfile) {
      This is the point where I would like to utilise the ViewSam.jar functionality, but without having to make a commandline call from within my class. Luckily, SAM-JDK exists.

      The code example (this one) shows how to access a SAM or BAM file. I am unsure how to use it and the other classes and methods available in the javadoc (both net.sf.picard and net.sf.samtools) to filter out the unaligned reads - I don't know where to start.

      For example. The javadoc shows that the ViewSam class has constructor ViewSam() and two methods: a main method and a method called doWork() that 'does work after command line has been parsed'. Something tells me I am not supposed to use this class. But what other class...

      Code:
              return filteredBamfile;
          }
      }
      I hope I'm not asking anything completely obvious... if so please tell me... because I get the feeling that I am mixing up things here, the Picard commandline tools and SAM-JDK.

      Many thanks,
      Wil

      *** edit
      Read the thread on the quality of posts (here). I was already unsure whether asking this question was inappropriate or not... So here how I feel about my own question:
      - very sorry if it's silly
      - I am very fond of SAMtools, don't get me wrong!
      - I'd rather not bother the developers with this if it does turn out to be a very silly question. That is why I turn to this forum.
      - and most importantly: a major thanks to all who take the time to read my questions, think about them and reply to them!
      Last edited by Bruins; 05-27-2010, 12:47 AM.

      Comment

      Latest Articles

      Collapse

      • kinpict.com
        Reply to 16S/ITS Profiling vs. Shotgun Metagenomics: What Changes in Your Workflow?
        by kinpict.com
        The part about this topic feels surprisingly grounded, and the details on the page is the bit that made me slow down. I’d keep <a href="https://kinpict.com/">ai family photo generator</a> bookmarked for later.
        Today, 06:37 PM
      • SEQadmin2
        16S/ITS Profiling vs. Shotgun Metagenomics: What Changes in Your Workflow?
        by SEQadmin2





        NGS has revolutionized clinical microbiology by offering new ways to identify and surveil pathogens without prior knowledge of the target. One popular approach is 16S rRNA and ITS amplicon sequencing, which targets specific microbial markers. But studies are increasingly incorporating shotgun metagenomics, a technique that sequences all DNA from a sample without targeting specific microbial markers. This approach allows more detailed taxonomic classification,...
        10-30-2026, 06:46 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by SEQadmin2, 11-12-2026, 07:59 AM
      0 responses
      27 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 11-05-2026, 09:25 AM
      0 responses
      35 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 11-03-2026, 11:54 AM
      2 responses
      56 views
      0 reactions
      Last Post kinpict.com  
      Started by SEQadmin2, 10-28-2026, 09:57 AM
      0 responses
      175 views
      0 reactions
      Last Post SEQadmin2  
      Working...