seqloc 0.5.0.2 → 0.5.1.0
raw patch · 4 files changed
+30/−6 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Bio.SeqLoc.Location: allPos :: Location l => l -> [Pos]
Files
- seqloc.cabal +1/−1
- src/Bio/SeqLoc/Location.hs +8/−0
- src/Bio/SeqLoc/SpliceLocation.hs +1/−0
- test/TestMain.hs +20/−5
seqloc.cabal view
@@ -1,5 +1,5 @@ Name: seqloc-Version: 0.5.0.2+Version: 0.5.1.0 Cabal-Version: >= 1.6 Synopsis: Handle sequence locations for bioinformatics Description: Handle sequence locations for bioinformatics
src/Bio/SeqLoc/Location.hs view
@@ -52,6 +52,10 @@ -- 'startPos'. endPos :: l -> Pos.Pos + -- | List of sequence positions in the location, in order from the+ -- 5' end to the 3' end of the location strand.+ allPos :: l -> [Pos.Pos]+ -- | Extract 'Just' the nucleotide 'SeqLike' for the sequence -- location, or 'Nothing' if f any part of the location lies outside -- the bounds of the sequence.@@ -157,6 +161,10 @@ = case str of Plus -> Pos.Pos (seq5 + len - 1) str Minus -> Pos.Pos seq5 str+ allPos (ContigLoc seq5 len str) + = case str of+ Plus -> [ Pos.Pos (seq5+o) str | o <- [0..(len - 1)] ]+ Minus -> [ Pos.Pos (seq5+len-(1+o)) str | o <- [0..(len - 1)] ] clocInto = clocClocInto clocOutof = clocClocOutof extend = clocExtend
src/Bio/SeqLoc/SpliceLocation.hs view
@@ -88,6 +88,7 @@ posOutof pos = posOutofContigs pos . contigs startPos = startPos . firstContig endPos = endPos . lastContig+ allPos = concatMap allPos . contigs clocInto = slocClocInto clocOutof = slocClocOutof extend = slocExtend
test/TestMain.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE ExistentialQuantification #-}+{-# LANGUAGE ExistentialQuantification, BangPatterns #-} module Main where @@ -45,6 +45,7 @@ , T "Contig loc outof/into inverse" property_ContigLocOutofInto , T "Contig into based on bounds" test_Contig_IntoBounds , T "Contig outof based on bounds" test_Contig_OutofBounds+ , T "Contig allPos/outof equiv" property_Contig_allPos_outof , T "Contig seqData" property_Contig_seqData , T "Contig seqDataPadded" property_Contig_seqDataPadded , T "Contig seqData2" property_Contig_seqData2@@ -53,13 +54,14 @@ , T "Contig fromBoundsStrand" property_Contig_fromBoundsStrand , T "Contig overlaps" property_Contig_overlaps , T "Contig repr" test_Contig_repr- + , T "Loc revCompl" test_Loc_Minus , T "Loc pos into/outof inverse" property_LocIntoOutof , T "Loc pos outof/into inverse" property_LocOutofInto , T "Loc outof based on bounds" test_Loc_OutofBounds , T "Loc loc outof/into inverse" property_LocCLocOutofInto , T "Loc outof association" property_LocOutofAssoc+ , T "Loc allPos/outof equiv" property_Loc_allPos_outof , T "Loc locOutof" property_SpLocOutof , T "Loc locOutof valid" property_SpLocOutofGood , T "Loc within" property_Loc_Within@@ -85,9 +87,6 @@ instance Arbitrary SeqLabel where arbitrary = genName -instance Show SeqLabel where- show = show . unSeqLabel- test_revCompl :: (Eq s, Stranded s) => s -> Bool test_revCompl s = (revCompl . revCompl) s == s @@ -188,6 +187,14 @@ = let !offset = Pos.offset pos in (isJust $ Loc.posOutof pos contig) == (offset >= 0 && offset < Loc.length contig) +property_Contig_allPos_outof :: Loc.ContigLoc -> Property+property_Contig_allPos_outof contig+ = forAll (choose (0, fromIntegral $ Loc.length contig - 1)) $ \ioff ->+ let p = drop ioff $ Loc.allPos contig+ in and [ not $ null p+ , Loc.posOutof (Pos.Pos (Pos.Offset $ fromIntegral ioff) Plus) contig == Just (head p)+ ]+ property_Contig_seqData :: Loc.ContigLoc -> Property property_Contig_seqData contig = forAll (genNonNegOffset >>= genNtByteString . fromIntegral) $ \sequ ->@@ -312,6 +319,14 @@ mapM (flip Loc.clocOutof outerloc) $ Loc.toContigs subloc in (isJust mOutofContigs) ==> mOutofContigs == mContigsOutof++property_Loc_allPos_outof :: SpLoc.SpliceLoc -> Property+property_Loc_allPos_outof sploc+ = forAll (choose (0, fromIntegral $ Loc.length sploc - 1)) $ \ioff ->+ let p = drop ioff $ Loc.allPos sploc+ in and [ not $ null p+ , Loc.posOutof (Pos.Pos (Pos.Offset $ fromIntegral ioff) Plus) sploc == Just (head p)+ ] property_Loc_seqData :: SpLoc.SpliceLoc -> Property property_Loc_seqData loc